Skip to content
This repository has been archived by the owner on May 31, 2021. It is now read-only.

Commit

Permalink
Fix javascript error on column block's child items.
Browse files Browse the repository at this point in the history
  • Loading branch information
sazzadh committed Aug 10, 2014
1 parent 9176620 commit e4949cd
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 22 deletions.
52 changes: 30 additions & 22 deletions assets/javascripts/aqpb-fields.js
Expand Up @@ -155,43 +155,51 @@ jQuery(document).ready(function($){

// Visual Editor Block
$('ul.blocks').bind('sortstart', function(event, ui) {
if( ui.item.hasClass('block-aq_editor_block') ) {
textareaID = $(ui.item).find('.wp-editor-area').attr('id');
try { tinyMCE.execCommand('mceRemoveEditor', false, textareaID); } catch(e){
console.log(e);
if( ui != null ){
if( ui.item.hasClass('block-aq_editor_block') ) {
textareaID = $(ui.item).find('.wp-editor-area').attr('id');
try { tinyMCE.execCommand('mceRemoveEditor', false, textareaID); } catch(e){
console.log(e);
}
}
}
});

$('ul.blocks').bind('sortstop', function(event, ui) {
if( ui.item.hasClass('block-aq_editor_block') ) {
textareaID = $(ui.item).find('.wp-editor-area').attr('id');
try {
tinyMCE.execCommand('mceAddEditor', false, textareaID);
tinyMCE.execCommand('mceAddControls', false, textareaID);
} catch(e){
console.log(e);
if( ui != null ){
if( ui.item.hasClass('block-aq_editor_block') ) {
textareaID = $(ui.item).find('.wp-editor-area').attr('id');
try {
tinyMCE.execCommand('mceAddEditor', false, textareaID);
tinyMCE.execCommand('mceAddControls', false, textareaID);
} catch(e){
console.log(e);
}
}
}
});

$('ul.blocks .ui-resizable').bind('resizestart', function(event, ui) {
if( ui.element.hasClass('block-aq_editor_block') ) {
textareaID = $(ui.item).find('.wp-editor-area').attr('id');
try { tinyMCE.execCommand('mceRemoveEditor', false, textareaID); } catch(e){
console.log(e);
if( ui != null ){
if( ui.element.hasClass('block-aq_editor_block') ) {
textareaID = $(ui.item).find('.wp-editor-area').attr('id');
try { tinyMCE.execCommand('mceRemoveEditor', false, textareaID); } catch(e){
console.log(e);
}
}
}
});

$('ul.blocks .ui-resizable').bind('resizestop', function(event, ui) {
if( ui.element.hasClass('block-aq_editor_block') ) {
textareaID = $(ui.item).find('.wp-editor-area').attr('id');
try {
tinyMCE.execCommand('mceAddEditor', false, textareaID);
tinyMCE.execCommand('mceAddControls', false, textareaID);
} catch(e){
console.log(e);
if( ui != null ){
if( ui.element.hasClass('block-aq_editor_block') ) {
textareaID = $(ui.item).find('.wp-editor-area').attr('id');
try {
tinyMCE.execCommand('mceAddEditor', false, textareaID);
tinyMCE.execCommand('mceAddControls', false, textareaID);
} catch(e){
console.log(e);
}
}
}
});
Expand Down
1 change: 1 addition & 0 deletions contribute.md
Expand Up @@ -15,3 +15,4 @@ Please feel free to add yourself on this list :)

* [Syamil MJ](http://aquagraphite.com) (author)
* [Saroj] (Contributor)
* [Tally Themes] (Contributor)

0 comments on commit e4949cd

Please sign in to comment.