Fix JSHint errors in remaining WP TinyMCE plugin files.

fixes #26048.

Built from https://develop.svn.wordpress.org/trunk@26214


git-svn-id: http://core.svn.wordpress.org/trunk@26122 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2013-11-15 15:05:09 +00:00
parent adbf36d393
commit bd265f4983
9 changed files with 44 additions and 49 deletions

File diff suppressed because one or more lines are too long

View File

@ -1,3 +1,4 @@
/* global tinymce, getUserSetting, setUserSetting, switchEditors, autosave */
/** /**
* WordPress plugin. * WordPress plugin.
*/ */
@ -142,7 +143,7 @@
} }
}); });
ed.onExecCommand.add( function( ed, cmd, ui, val ) { ed.onExecCommand.add( function( ed, cmd ) {
if ( tinymce.isWebKit && style && ( 'InsertUnorderedList' == cmd || 'InsertOrderedList' == cmd ) ) if ( tinymce.isWebKit && style && ( 'InsertUnorderedList' == cmd || 'InsertOrderedList' == cmd ) )
ed.dom.remove( style ); ed.dom.remove( style );
}); });
@ -221,7 +222,7 @@
last = k; last = k;
}); });
}; }
// keep empty paragraphs :( // keep empty paragraphs :(
ed.onSaveContent.addToTop(function(ed, o) { ed.onSaveContent.addToTop(function(ed, o) {
@ -291,19 +292,19 @@
// popup buttons for images and the gallery // popup buttons for images and the gallery
ed.onInit.add(function(ed) { ed.onInit.add(function(ed) {
tinymce.dom.Event.add(ed.getWin(), 'scroll', function(e) { tinymce.dom.Event.add(ed.getWin(), 'scroll', function() {
ed.plugins.wordpress._hideButtons(); ed.plugins.wordpress._hideButtons();
}); });
tinymce.dom.Event.add(ed.getBody(), 'dragstart', function(e) { tinymce.dom.Event.add(ed.getBody(), 'dragstart', function() {
ed.plugins.wordpress._hideButtons(); ed.plugins.wordpress._hideButtons();
}); });
}); });
ed.onBeforeExecCommand.add(function(ed, cmd, ui, val) { ed.onBeforeExecCommand.add( function( ed ) {
ed.plugins.wordpress._hideButtons(); ed.plugins.wordpress._hideButtons();
}); });
ed.onSaveContent.add(function(ed, o) { ed.onSaveContent.add( function( ed ) {
ed.plugins.wordpress._hideButtons(); ed.plugins.wordpress._hideButtons();
}); });
@ -325,7 +326,7 @@
ed.windowManager.close(null, id); ed.windowManager.close(null, id);
} }
} }
} };
// close popups when clicking on the background // close popups when clicking on the background
tinymce.dom.Event.remove(document.body, 'click', closeOnClick); tinymce.dom.Event.remove(document.body, 'click', closeOnClick);
@ -361,7 +362,7 @@
}, },
_showButtons : function(n, id) { _showButtons : function(n, id) {
var ed = tinyMCE.activeEditor, p1, p2, vp, DOM = tinymce.DOM, X, Y; var ed = tinymce.activeEditor, p1, p2, vp, DOM = tinymce.DOM, X, Y;
vp = ed.dom.getViewPort(ed.getWin()); vp = ed.dom.getViewPort(ed.getWin());
p1 = DOM.getPos(ed.getContentAreaContainer()); p1 = DOM.getPos(ed.getContentAreaContainer());

View File

@ -1,16 +1,7 @@
/** /* global tinymce */
* editor_plugin_src.js
*
* Copyright 2009, Moxiecode Systems AB
* Released under LGPL
*
* License: http://tinymce.moxiecode.com/license
* Contributing: http://tinymce.moxiecode.com/contributing
*/
(function() { (function() {
tinymce.create('tinymce.plugins.WPDialogs', { tinymce.create('tinymce.plugins.WPDialogs', {
init : function(ed, url) { init : function( ed ) {
tinymce.create('tinymce.WPWindowManager:tinymce.InlineWindowManager', { tinymce.create('tinymce.WPWindowManager:tinymce.InlineWindowManager', {
WPWindowManager : function(ed) { WPWindowManager : function(ed) {
this.parent(ed); this.parent(ed);

File diff suppressed because one or more lines are too long

View File

@ -1,11 +1,13 @@
/* global tinymce */
(function() { (function() {
var mouse = {};
tinymce.create('tinymce.plugins.wpEditImage', { tinymce.create('tinymce.plugins.wpEditImage', {
url: '', url: '',
editor: {}, editor: {},
init: function(ed, url) { init: function(ed, url) {
var t = this, mouse = {}; var t = this;
t.url = url; t.url = url;
t.editor = ed; t.editor = ed;
@ -27,7 +29,7 @@
// when pressing Return inside a caption move the caret to a new parapraph under it // when pressing Return inside a caption move the caret to a new parapraph under it
ed.dom.events.add(ed.getBody(), 'keydown', function(e) { ed.dom.events.add(ed.getBody(), 'keydown', function(e) {
var n, DL, DIV, P, content; var n, DL, DIV, P;
if ( e.keyCode == 13 ) { if ( e.keyCode == 13 ) {
n = ed.selection.getNode(); n = ed.selection.getNode();
@ -105,7 +107,7 @@
// When inserting content, if the caret is inside a caption create new paragraph under // When inserting content, if the caret is inside a caption create new paragraph under
// and move the caret there // and move the caret there
ed.onBeforeExecCommand.add(function(ed, cmd, ui, val) { ed.onBeforeExecCommand.add( function( ed, cmd ) {
var node, p; var node, p;
if ( cmd == 'mceInsertContent' ) { if ( cmd == 'mceInsertContent' ) {
@ -227,7 +229,7 @@
title : ed.getLang('wpeditimage.edit_img') title : ed.getLang('wpeditimage.edit_img')
}); });
tinymce.dom.Event.add(editButton, 'mousedown', function(e) { tinymce.dom.Event.add(editButton, 'mousedown', function() {
t._editImage(); t._editImage();
ed.plugins.wordpress._hideButtons(); ed.plugins.wordpress._hideButtons();
}); });
@ -240,7 +242,7 @@
title : ed.getLang('wpeditimage.del_img') title : ed.getLang('wpeditimage.del_img')
}); });
tinymce.dom.Event.add(dellButton, 'mousedown', function(e) { tinymce.dom.Event.add(dellButton, 'mousedown', function() {
var ed = tinymce.activeEditor, el = ed.selection.getNode(), parent; var ed = tinymce.activeEditor, el = ed.selection.getNode(), parent;
if ( el.nodeName == 'IMG' && ed.dom.getAttrib(el, 'class').indexOf('mceItem') == -1 ) { if ( el.nodeName == 'IMG' && ed.dom.getAttrib(el, 'class').indexOf('mceItem') == -1 ) {
@ -317,7 +319,7 @@
author : 'WordPress', author : 'WordPress',
authorurl : 'http://wordpress.org', authorurl : 'http://wordpress.org',
infourl : '', infourl : '',
version : "1.0" version : '1.0'
}; };
} }
}); });

View File

@ -1 +1 @@
!function(){tinymce.create("tinymce.plugins.wpFullscreenPlugin",{resize_timeout:!1,init:function(a){function b(b,d){var e,f=tinymce.DOM,g=a.getBody(),h=f.get(a.id+"_ifr"),i=a.dom.win.scrollY;c.resize_timeout||(c.resize_timeout=!0,setTimeout(function(){c.resize_timeout=!1},500),e=g.scrollHeight>300?g.scrollHeight:300,e!=h.scrollHeight&&(f.setStyle(h,"height",e+"px"),a.getWin().scrollTo(0,0)),d&&"paste"==d.type&&tinymce.isWebKit&&setTimeout(function(){a.dom.win.scrollTo(0,i)},40))}var c=this,d={},e=tinymce.DOM;a.addCommand("wpFullScreenClose",function(){a.getParam("wp_fullscreen_is_enabled")&&e.win.setTimeout(function(){tinyMCE.remove(a),e.remove("wp_mce_fullscreen_parent"),tinyMCE.settings=tinyMCE.oldSettings},10)}),a.addCommand("wpFullScreenSave",function(){var a,b=tinyMCE.get("wp_mce_fullscreen");b.focus(),a=tinyMCE.get(b.getParam("wp_fullscreen_editor_id")),a.setContent(b.getContent({format:"raw"}),{format:"raw"})}),a.addCommand("wpFullScreenInit",function(){var b,c,e;a=tinyMCE.activeEditor,b=a.getDoc(),c=b.body,tinyMCE.oldSettings=tinyMCE.settings,tinymce.each(a.settings,function(a,b){d[b]=a}),d.id="wp_mce_fullscreen",d.wp_fullscreen_is_enabled=!0,d.wp_fullscreen_editor_id=a.id,d.theme_advanced_resizing=!1,d.theme_advanced_statusbar_location="none",d.content_css=d.content_css?d.content_css+","+d.wp_fullscreen_content_css:d.wp_fullscreen_content_css,d.height=tinymce.isIE?c.scrollHeight:c.offsetHeight,tinymce.each(a.getParam("wp_fullscreen_settings"),function(a,b){d[b]=a}),e=new tinymce.Editor("wp_mce_fullscreen",d),e.onInit.add(function(b){var c=tinymce.DOM,d=c.select("a.mceButton",c.get("wp-fullscreen-buttons"));a.isHidden()?b.setContent(switchEditors.wpautop(b.getElement().value)):b.setContent(a.getContent()),setTimeout(function(){b.onNodeChange.add(function(){tinymce.each(d,function(a){var b,d;(b=c.get("wp_mce_fullscreen_"+a.id.substr(6)))&&(d=b.className,d&&(a.className=d))})})},1e3),b.dom.addClass(b.getBody(),"wp-fullscreen-editor"),b.focus()}),e.render(),"undefined"!=fullscreen&&e.dom.bind(e.dom.doc,"mousemove",function(a){fullscreen.bounder("showToolbar","hideToolbar",2e3,a)})}),a.addCommand("wpFullScreen",function(){"undefined"!=typeof fullscreen&&("wp_mce_fullscreen"==a.id?fullscreen.off():fullscreen.on())}),a.addButton("wp_fullscreen",{title:"wordpress.wp_fullscreen_desc",cmd:"wpFullScreen"}),!a.getParam("fullscreen_is_enabled")&&a.getParam("wp_fullscreen_is_enabled")&&(a.onInit.add(function(a){a.onChange.add(b),a.onSetContent.add(b),a.onPaste.add(b),a.onKeyUp.add(b),a.onPostRender.add(b),a.getBody().style.overflowY="hidden"}),a.getParam("autoresize_on_init",!0)&&a.onLoadContent.add(function(){setTimeout(function(){b()},1200)}),a.addCommand("wpAutoResize",b))},getInfo:function(){return{longname:"WP Fullscreen",author:"WordPress",authorurl:"http://wordpress.org",infourl:"",version:"1.0"}}}),tinymce.PluginManager.add("wpfullscreen",tinymce.plugins.wpFullscreenPlugin)}(); !function(){tinymce.create("tinymce.plugins.wpFullscreenPlugin",{resize_timeout:!1,init:function(a){function b(b,d){var e,f=tinymce.DOM,g=a.getBody(),h=f.get(a.id+"_ifr"),i=a.dom.win.scrollY;c.resize_timeout||(c.resize_timeout=!0,setTimeout(function(){c.resize_timeout=!1},500),e=g.scrollHeight>300?g.scrollHeight:300,e!=h.scrollHeight&&(f.setStyle(h,"height",e+"px"),a.getWin().scrollTo(0,0)),d&&"paste"==d.type&&tinymce.isWebKit&&setTimeout(function(){a.dom.win.scrollTo(0,i)},40))}var c=this,d={},e=tinymce.DOM;a.addCommand("wpFullScreenClose",function(){a.getParam("wp_fullscreen_is_enabled")&&e.win.setTimeout(function(){tinymce.remove(a),e.remove("wp_mce_fullscreen_parent"),tinymce.settings=tinymce.oldSettings},10)}),a.addCommand("wpFullScreenSave",function(){var a,b=tinymce.get("wp_mce_fullscreen");b.focus(),a=tinymce.get(b.getParam("wp_fullscreen_editor_id")),a.setContent(b.getContent({format:"raw"}),{format:"raw"})}),a.addCommand("wpFullScreenInit",function(){var b,c,e;a=tinymce.activeEditor,b=a.getDoc(),c=b.body,tinymce.oldSettings=tinymce.settings,tinymce.each(a.settings,function(a,b){d[b]=a}),d.id="wp_mce_fullscreen",d.wp_fullscreen_is_enabled=!0,d.wp_fullscreen_editor_id=a.id,d.theme_advanced_resizing=!1,d.theme_advanced_statusbar_location="none",d.content_css=d.content_css?d.content_css+","+d.wp_fullscreen_content_css:d.wp_fullscreen_content_css,d.height=tinymce.isIE?c.scrollHeight:c.offsetHeight,tinymce.each(a.getParam("wp_fullscreen_settings"),function(a,b){d[b]=a}),e=new tinymce.Editor("wp_mce_fullscreen",d),e.onInit.add(function(b){var c=tinymce.DOM,d=c.select("a.mceButton",c.get("wp-fullscreen-buttons"));a.isHidden()?b.setContent(switchEditors.wpautop(b.getElement().value)):b.setContent(a.getContent()),setTimeout(function(){b.onNodeChange.add(function(){tinymce.each(d,function(a){var b,d;(b=c.get("wp_mce_fullscreen_"+a.id.substr(6)))&&(d=b.className,d&&(a.className=d))})})},1e3),b.dom.addClass(b.getBody(),"wp-fullscreen-editor"),b.focus()}),e.render(),"undefined"!=fullscreen&&e.dom.bind(e.dom.doc,"mousemove",function(a){fullscreen.bounder("showToolbar","hideToolbar",2e3,a)})}),a.addCommand("wpFullScreen",function(){"undefined"!=typeof fullscreen&&("wp_mce_fullscreen"==a.id?fullscreen.off():fullscreen.on())}),a.addButton("wp_fullscreen",{title:"wordpress.wp_fullscreen_desc",cmd:"wpFullScreen"}),!a.getParam("fullscreen_is_enabled")&&a.getParam("wp_fullscreen_is_enabled")&&(a.onInit.add(function(a){a.onChange.add(b),a.onSetContent.add(b),a.onPaste.add(b),a.onKeyUp.add(b),a.onPostRender.add(b),a.getBody().style.overflowY="hidden"}),a.getParam("autoresize_on_init",!0)&&a.onLoadContent.add(function(){setTimeout(function(){b()},1200)}),a.addCommand("wpAutoResize",b))},getInfo:function(){return{longname:"WP Fullscreen",author:"WordPress",authorurl:"http://wordpress.org",infourl:"",version:"1.0"}}}),tinymce.PluginManager.add("wpfullscreen",tinymce.plugins.wpFullscreenPlugin)}();

View File

@ -1,3 +1,4 @@
/* global tinymce:false, switchEditors, fullscreen */
/** /**
* WP Fullscreen TinyMCE plugin * WP Fullscreen TinyMCE plugin
* *
@ -8,26 +9,26 @@
tinymce.create('tinymce.plugins.wpFullscreenPlugin', { tinymce.create('tinymce.plugins.wpFullscreenPlugin', {
resize_timeout: false, resize_timeout: false,
init : function(ed, url) { init : function( ed ) {
var t = this, oldHeight = 0, s = {}, DOM = tinymce.DOM; var t = this, s = {}, DOM = tinymce.DOM;
// Register commands // Register commands
ed.addCommand('wpFullScreenClose', function() { ed.addCommand('wpFullScreenClose', function() {
// this removes the editor, content has to be saved first with tinyMCE.execCommand('wpFullScreenSave'); // this removes the editor, content has to be saved first with tinymce.execCommand('wpFullScreenSave');
if ( ed.getParam('wp_fullscreen_is_enabled') ) { if ( ed.getParam('wp_fullscreen_is_enabled') ) {
DOM.win.setTimeout(function() { DOM.win.setTimeout(function() {
tinyMCE.remove(ed); tinymce.remove(ed);
DOM.remove('wp_mce_fullscreen_parent'); DOM.remove('wp_mce_fullscreen_parent');
tinyMCE.settings = tinyMCE.oldSettings; // Restore old settings tinymce.settings = tinymce.oldSettings; // Restore old settings
}, 10); }, 10);
} }
}); });
ed.addCommand('wpFullScreenSave', function() { ed.addCommand('wpFullScreenSave', function() {
var ed = tinyMCE.get('wp_mce_fullscreen'), edd; var ed = tinymce.get('wp_mce_fullscreen'), edd;
ed.focus(); ed.focus();
edd = tinyMCE.get( ed.getParam('wp_fullscreen_editor_id') ); edd = tinymce.get( ed.getParam('wp_fullscreen_editor_id') );
edd.setContent( ed.getContent({format : 'raw'}), {format : 'raw'} ); edd.setContent( ed.getContent({format : 'raw'}), {format : 'raw'} );
}); });
@ -35,11 +36,11 @@
ed.addCommand('wpFullScreenInit', function() { ed.addCommand('wpFullScreenInit', function() {
var d, b, fsed; var d, b, fsed;
ed = tinyMCE.activeEditor; ed = tinymce.activeEditor;
d = ed.getDoc(); d = ed.getDoc();
b = d.body; b = d.body;
tinyMCE.oldSettings = tinyMCE.settings; // Store old settings tinymce.oldSettings = tinymce.settings; // Store old settings
tinymce.each(ed.settings, function(v, n) { tinymce.each(ed.settings, function(v, n) {
s[n] = v; s[n] = v;
@ -67,7 +68,7 @@
edd.setContent( switchEditors.wpautop( edd.getElement().value ) ); edd.setContent( switchEditors.wpautop( edd.getElement().value ) );
setTimeout(function(){ // add last setTimeout(function(){ // add last
edd.onNodeChange.add(function(ed, cm, e){ edd.onNodeChange.add( function() {
tinymce.each(buttons, function(c) { tinymce.each(buttons, function(c) {
var btn, cls; var btn, cls;
@ -145,21 +146,21 @@
ed.dom.win.scrollTo(0, y); ed.dom.win.scrollTo(0, y);
}, 40); }, 40);
} }
}; }
// Add appropriate listeners for resizing content area // Add appropriate listeners for resizing content area
ed.onInit.add(function(ed, l) { ed.onInit.add( function( ed ) {
ed.onChange.add(resize); ed.onChange.add(resize);
ed.onSetContent.add(resize); ed.onSetContent.add(resize);
ed.onPaste.add(resize); ed.onPaste.add(resize);
ed.onKeyUp.add(resize); ed.onKeyUp.add(resize);
ed.onPostRender.add(resize); ed.onPostRender.add(resize);
ed.getBody().style.overflowY = "hidden"; ed.getBody().style.overflowY = 'hidden';
}); });
if ( ed.getParam('autoresize_on_init', true) ) { if ( ed.getParam('autoresize_on_init', true) ) {
ed.onLoadContent.add(function(ed, l) { ed.onLoadContent.add( function() {
// Because the content area resizes when its content CSS loads, // Because the content area resizes when its content CSS loads,
// and we can't easily add a listener to its onload event, // and we can't easily add a listener to its onload event,
// we'll just trigger a resize after a short loading period // we'll just trigger a resize after a short loading period
@ -169,7 +170,7 @@
}); });
} }
// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample'); // Register the command so that it can be invoked by using tinymce.activeEditor.execCommand('mceExample');
ed.addCommand('wpAutoResize', resize); ed.addCommand('wpAutoResize', resize);
}, },

View File

@ -1,4 +1,4 @@
/* global tinymce */
(function() { (function() {
tinymce.create('tinymce.plugins.wpGallery', { tinymce.create('tinymce.plugins.wpGallery', {
@ -78,7 +78,7 @@
function getAttr(s, n) { function getAttr(s, n) {
n = new RegExp(n + '=\"([^\"]+)\"', 'g').exec(s); n = new RegExp(n + '=\"([^\"]+)\"', 'g').exec(s);
return n ? tinymce.DOM.decode(n[1]) : ''; return n ? tinymce.DOM.decode(n[1]) : '';
}; }
return co.replace(/(?:<p[^>]*>)*(<img[^>]+>)(?:<\/p>)*/g, function(a,im) { return co.replace(/(?:<p[^>]*>)*(<img[^>]+>)(?:<\/p>)*/g, function(a,im) {
var cls = getAttr(im, 'class'); var cls = getAttr(im, 'class');
@ -112,10 +112,10 @@
title : ed.getLang('wordpress.editgallery') title : ed.getLang('wordpress.editgallery')
}); });
tinymce.dom.Event.add(editButton, 'mousedown', function(e) { tinymce.dom.Event.add( editButton, 'mousedown', function() {
var ed = tinymce.activeEditor; var ed = tinymce.activeEditor;
ed.wpGalleryBookmark = ed.selection.getBookmark('simple'); ed.wpGalleryBookmark = ed.selection.getBookmark('simple');
ed.execCommand("WP_Gallery"); ed.execCommand('WP_Gallery');
ed.plugins.wordpress._hideButtons(); ed.plugins.wordpress._hideButtons();
}); });
@ -147,7 +147,7 @@
author : 'WordPress', author : 'WordPress',
authorurl : 'http://wordpress.org', authorurl : 'http://wordpress.org',
infourl : '', infourl : '',
version : "1.0" version : '1.0'
}; };
} }
}); });