Fix JSHint errors in remaining WP TinyMCE plugin files.

fixes #26048.


git-svn-id: https://develop.svn.wordpress.org/trunk@26214 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2013-11-15 15:04:04 +00:00
parent d8e08549bb
commit f75ee9ea0f
5 changed files with 41 additions and 46 deletions

View File

@ -1,3 +1,4 @@
/* global tinymce, getUserSetting, setUserSetting, switchEditors, autosave */
/**
* 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 ) )
ed.dom.remove( style );
});
@ -221,7 +222,7 @@
last = k;
});
};
}
// keep empty paragraphs :(
ed.onSaveContent.addToTop(function(ed, o) {
@ -291,19 +292,19 @@
// popup buttons for images and the gallery
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();
});
tinymce.dom.Event.add(ed.getBody(), 'dragstart', function(e) {
tinymce.dom.Event.add(ed.getBody(), 'dragstart', function() {
ed.plugins.wordpress._hideButtons();
});
});
ed.onBeforeExecCommand.add(function(ed, cmd, ui, val) {
ed.onBeforeExecCommand.add( function( ed ) {
ed.plugins.wordpress._hideButtons();
});
ed.onSaveContent.add(function(ed, o) {
ed.onSaveContent.add( function( ed ) {
ed.plugins.wordpress._hideButtons();
});
@ -325,7 +326,7 @@
ed.windowManager.close(null, id);
}
}
}
};
// close popups when clicking on the background
tinymce.dom.Event.remove(document.body, 'click', closeOnClick);
@ -361,7 +362,7 @@
},
_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());
p1 = DOM.getPos(ed.getContentAreaContainer());

View File

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

View File

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

View File

@ -1,3 +1,4 @@
/* global tinymce:false, switchEditors, fullscreen */
/**
* WP Fullscreen TinyMCE plugin
*
@ -8,26 +9,26 @@
tinymce.create('tinymce.plugins.wpFullscreenPlugin', {
resize_timeout: false,
init : function(ed, url) {
var t = this, oldHeight = 0, s = {}, DOM = tinymce.DOM;
init : function( ed ) {
var t = this, s = {}, DOM = tinymce.DOM;
// Register commands
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') ) {
DOM.win.setTimeout(function() {
tinyMCE.remove(ed);
tinymce.remove(ed);
DOM.remove('wp_mce_fullscreen_parent');
tinyMCE.settings = tinyMCE.oldSettings; // Restore old settings
tinymce.settings = tinymce.oldSettings; // Restore old settings
}, 10);
}
});
ed.addCommand('wpFullScreenSave', function() {
var ed = tinyMCE.get('wp_mce_fullscreen'), edd;
var ed = tinymce.get('wp_mce_fullscreen'), edd;
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'} );
});
@ -35,11 +36,11 @@
ed.addCommand('wpFullScreenInit', function() {
var d, b, fsed;
ed = tinyMCE.activeEditor;
ed = tinymce.activeEditor;
d = ed.getDoc();
b = d.body;
tinyMCE.oldSettings = tinyMCE.settings; // Store old settings
tinymce.oldSettings = tinymce.settings; // Store old settings
tinymce.each(ed.settings, function(v, n) {
s[n] = v;
@ -67,7 +68,7 @@
edd.setContent( switchEditors.wpautop( edd.getElement().value ) );
setTimeout(function(){ // add last
edd.onNodeChange.add(function(ed, cm, e){
edd.onNodeChange.add( function() {
tinymce.each(buttons, function(c) {
var btn, cls;
@ -145,21 +146,21 @@
ed.dom.win.scrollTo(0, y);
}, 40);
}
};
}
// Add appropriate listeners for resizing content area
ed.onInit.add(function(ed, l) {
ed.onInit.add( function( ed ) {
ed.onChange.add(resize);
ed.onSetContent.add(resize);
ed.onPaste.add(resize);
ed.onKeyUp.add(resize);
ed.onPostRender.add(resize);
ed.getBody().style.overflowY = "hidden";
ed.getBody().style.overflowY = 'hidden';
});
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,
// and we can't easily add a listener to its onload event,
// 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);
},

View File

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