diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 6193ba2ec786dc14c0cef45fdc471019b0c52ce0..75f1bb20a3668291a9b6e17e69597304769f65cc 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -6,6 +6,7 @@ Wysiwyg x.x-x.x, xxxx-xx-xx Wysiwyg 6.x-2.x, xxxx-xx-xx --------------------------- +#367632 by sun: Fixed invalid JavaScript syntax. #319363 by sun: Follow-up: Synced 1.x with 2.x where possible. #319363 by sun, quicksketch: Rewrote editor plugin API. The new plugin API allows Drupal modules to expose editor plugins for ANY editor without diff --git a/editors/js/fckeditor-2.6.js b/editors/js/fckeditor-2.6.js index e2f4cc46c9331c6fd5f2c9bd9940f58ffd1100d6..43c9c78177eeac3d9a95dec9ea15f8acc54d0376 100644 --- a/editors/js/fckeditor-2.6.js +++ b/editors/js/fckeditor-2.6.js @@ -27,17 +27,17 @@ Drupal.wysiwyg.editor.attach.fckeditor = function(context, params, settings) { */ Drupal.wysiwyg.editor.detach.fckeditor = function(context, params) { if (typeof params != 'undefined' && typeof FCKeditorAPI != 'undefined') { - var editor = FCKeditorAPI.GetInstance(params.field); - if (editor) { - $('#' + params.field).val(editor.GetXHTML()).show(); + var instance = FCKeditorAPI.GetInstance(params.field); + if (instance) { + $('#' + params.field).val(instance.GetXHTML()).show(); $('#' + params.field + '___Config').remove(); $('#' + params.field + '___Frame').remove(); delete FCKeditorAPI.__Instances[params.field]; } } else { - for (instance in FCKeditorAPI.__Instances) { - $('#' + instance).val(editor.GetXHTML()).show(); + for (var instance in FCKeditorAPI.__Instances) { + $('#' + instance).val(instance.GetXHTML()).show(); $('#' + instance + '___Config').remove(); $('#' + instance + '___Frame').remove(); delete FCKeditorAPI.__Instances[instance]; diff --git a/editors/js/none.js b/editors/js/none.js index 1879ef9dd3396a1afa8456edf5c6f3bd18c0ca49..898855c97284fba6b7bdd3253c2e673cc81f3a04 100644 --- a/editors/js/none.js +++ b/editors/js/none.js @@ -53,7 +53,7 @@ Drupal.wysiwyg.editor.instance.none = { // IE support. if (document.selection) { editor.focus(); - sel = document.selection.createRange(); + var sel = document.selection.createRange(); sel.text = content; } // Mozilla/Firefox/Netscape 7+ support. diff --git a/editors/js/tinymce-3.js b/editors/js/tinymce-3.js index e80f7b8468e76ee78eafc8913323a008e6c72917..0136aaed3a458ffc212d1e19f8d6d0a290167fbf 100644 --- a/editors/js/tinymce-3.js +++ b/editors/js/tinymce-3.js @@ -55,18 +55,18 @@ Drupal.wysiwyg.editor.attach.tinymce = function(context, params, settings) { */ Drupal.wysiwyg.editor.detach.tinymce = function(context, params) { if (typeof params != 'undefined') { - var editor = tinyMCE.get(params.field); - if (editor) { - editor.save(); - editor.remove(); + var instance = tinyMCE.get(params.field); + if (instance) { + instance.save(); + instance.remove(); } } else { // Save contents of all editors back into textareas. tinyMCE.triggerSave(); // Remove all editor instances. - for (var instanceId in tinyMCE.editors) { - tinyMCE.editors[instanceId].remove(); + for (var instance in tinyMCE.editors) { + tinyMCE.editors[instance].remove(); } } }; @@ -168,7 +168,7 @@ Drupal.wysiwyg.editor.instance.tinymce = { var specialProperties = { img: { class: 'mceItem' } }; - $content = $('
' + content + '
'); // No .outerHTML() in jQuery :( + var $content = $('
' + content + '
'); // No .outerHTML() in jQuery :( jQuery.each(specialProperties, function(element, properties) { $content.find(element).each(function() { for (var property in properties) { diff --git a/plugins/break/break.js b/plugins/break/break.js index 7e34b8cd1bbf9ffffaa0905b8cd06eeba5b0d0f4..a0cca268dc68225a12b93baf8d25c213ba82c874 100644 --- a/plugins/break/break.js +++ b/plugins/break/break.js @@ -45,7 +45,7 @@ Drupal.wysiwyg.plugins.break = { * Replace images with tags in content upon detaching editor. */ detach: function(content, settings, instanceId) { - $content = $('
' + content + '
'); // No .outerHTML() in jQuery :( + var $content = $('
' + content + '
'); // No .outerHTML() in jQuery :( $('img.wysiwyg-break', $content).replaceWith(''); return $content.html(); }, diff --git a/wysiwyg.js b/wysiwyg.js index 7aa7517d2c466cac6b4ae3f9bf0471e9427361c1..209a6e9e5fbee415b75dd6411ae30fe31f3c107c 100644 --- a/wysiwyg.js +++ b/wysiwyg.js @@ -11,7 +11,7 @@ Drupal.wysiwygInit = function() { // Clone, so original settings are not overwritten. this(Drupal.wysiwyg.clone(Drupal.settings.wysiwyg.configs[editor])); }); -} +}; /** * Attach editors to input formats and target elements (f.e. textareas). @@ -57,7 +57,7 @@ Drupal.behaviors.attachWysiwyg = function(context) { } $this.addClass('wysiwyg-processed'); }); -} +}; /** * Attach an editor to a target element. @@ -98,7 +98,7 @@ Drupal.wysiwygAttach = function(context, params) { Drupal.wysiwyg.instances[params.field].editor = 'none'; } } -} +}; /** * Detach all editors from a target element. @@ -113,7 +113,7 @@ Drupal.wysiwygDetach = function(context, params) { if (jQuery.isFunction(Drupal.wysiwyg.editor.detach[editor])) { Drupal.wysiwyg.editor.detach[editor](context, params); } -} +}; /** * Append or update an editor toggle link to a target element. @@ -158,7 +158,7 @@ Drupal.wysiwygAttachToggleLink = function(context, params) { if (params.editor == 'none') { $('#wysiwyg-toggle-' + params.field).hide(); } -} +}; /** * Parse the CSS classes of an input format DOM element into parameters. @@ -186,7 +186,7 @@ Drupal.wysiwyg.getParams = function(element, params) { params.status = parseInt(params.status); params.resizable = parseInt(params.resizable); return params; -} +}; /** * Clone a configuration object recursively. @@ -208,7 +208,7 @@ Drupal.wysiwyg.clone = function(obj) { } } return clone; -} +}; /** * Allow certain editor libraries to initialize before the DOM is loaded.