Archived
Updates
This commit is contained in:
1 parent
70d2335bba
commit
7428b67da5
1086 files changed
+94145
-59082
No files matched your search
@@ -4,9 +4,16 @@
|
||||
tinymce.ui.FloatPanel.zIndex = 100100;
|
||||
|
||||
tinymce.PluginManager.add( 'wordpress', function( editor ) {
|
||||
var DOM = tinymce.DOM, wpAdvButton, modKey, style,
|
||||
var DOM = tinymce.DOM,
|
||||
each = tinymce.each,
|
||||
__ = editor.editorManager.i18n.translate,
|
||||
wpAdvButton, style,
|
||||
last = 0;
|
||||
|
||||
if ( typeof window.jQuery !== 'undefined' ) {
|
||||
window.jQuery( document ).triggerHandler( 'tinymce-editor-setup', [ editor ] );
|
||||
}
|
||||
|
||||
function toggleToolbars( state ) {
|
||||
var iframe, initial, toolbars,
|
||||
pixels = 0;
|
||||
@@ -25,7 +32,7 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) {
|
||||
state = 'hide';
|
||||
}
|
||||
|
||||
tinymce.each( toolbars, function( toolbar, i ) {
|
||||
each( toolbars, function( toolbar, i ) {
|
||||
if ( i > 0 ) {
|
||||
if ( state === 'hide' ) {
|
||||
toolbar.hide();
|
||||
@@ -87,7 +94,7 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) {
|
||||
|
||||
if ( e.content ) {
|
||||
if ( e.content.indexOf( '<!--more' ) !== -1 ) {
|
||||
title = editor.editorManager.i18n.translate( 'Read more...' );
|
||||
title = __( 'Read more...' );
|
||||
|
||||
e.content = e.content.replace( /<!--more(.*?)-->/g, function( match, moretext ) {
|
||||
return '<img src="' + tinymce.Env.transparentSrc + '" data-wp-more="more" data-wp-more-text="' + moretext + '" ' +
|
||||
@@ -96,7 +103,7 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) {
|
||||
}
|
||||
|
||||
if ( e.content.indexOf( '<!--nextpage-->' ) !== -1 ) {
|
||||
title = editor.editorManager.i18n.translate( 'Page break' );
|
||||
title = __( 'Page break' );
|
||||
|
||||
e.content = e.content.replace( /<!--nextpage-->/g,
|
||||
'<img src="' + tinymce.Env.transparentSrc + '" data-wp-more="nextpage" class="wp-more-tag mce-wp-nextpage" ' +
|
||||
@@ -145,7 +152,7 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) {
|
||||
tag = tag || 'more';
|
||||
classname += ' mce-wp-' + tag;
|
||||
title = tag === 'more' ? 'Read more...' : 'Next page';
|
||||
title = editor.editorManager.i18n.translate( title );
|
||||
title = __( title );
|
||||
html = '<img src="' + tinymce.Env.transparentSrc + '" title="' + title + '" class="' + classname + '" ' +
|
||||
'data-wp-more="' + tag + '" data-mce-resize="false" data-mce-placeholder="1" />';
|
||||
|
||||
@@ -189,8 +196,8 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) {
|
||||
title: 'Keyboard Shortcuts',
|
||||
width: 450,
|
||||
height: 420,
|
||||
inline: 1,
|
||||
classes: 'wp-help'
|
||||
classes: 'wp-help',
|
||||
buttons: { text: 'Close', onclick: 'close' }
|
||||
});
|
||||
});
|
||||
|
||||
@@ -305,7 +312,7 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) {
|
||||
|
||||
bodyClass.push('wp-editor');
|
||||
|
||||
tinymce.each( bodyClass, function( cls ) {
|
||||
each( bodyClass, function( cls ) {
|
||||
if ( cls ) {
|
||||
dom.addClass( doc.body, cls );
|
||||
}
|
||||
@@ -347,7 +354,7 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) {
|
||||
|
||||
editor.on( 'PastePostProcess', function( event ) {
|
||||
// Remove empty paragraphs
|
||||
tinymce.each( dom.select( 'p', event.node ), function( node ) {
|
||||
each( dom.select( 'p', event.node ), function( node ) {
|
||||
if ( dom.isEmpty( node ) ) {
|
||||
dom.remove( node );
|
||||
}
|
||||
@@ -390,8 +397,10 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) {
|
||||
|
||||
// Remove spaces from empty paragraphs.
|
||||
editor.on( 'BeforeSetContent', function( event ) {
|
||||
var paragraph = tinymce.Env.webkit ? '<p><br /></p>' : '<p></p>';
|
||||
|
||||
if ( event.content ) {
|
||||
event.content = event.content.replace( /<p>(?: |\u00a0|\uFEFF| )+<\/p>/gi, '<p></p>' );
|
||||
event.content = event.content.replace( /<p>(?: |\u00a0|\uFEFF|\s)+<\/p>/gi, paragraph );
|
||||
}
|
||||
});
|
||||
|
||||
@@ -402,112 +411,344 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) {
|
||||
if ( tinymce.Env.iOS ) {
|
||||
editor.settings.height = 300;
|
||||
}
|
||||
});
|
||||
|
||||
// Add custom shortcuts
|
||||
modKey = 'alt+shift';
|
||||
each( {
|
||||
c: 'JustifyCenter',
|
||||
r: 'JustifyRight',
|
||||
l: 'JustifyLeft',
|
||||
j: 'JustifyFull',
|
||||
q: 'mceBlockQuote',
|
||||
u: 'InsertUnorderedList',
|
||||
o: 'InsertOrderedList',
|
||||
s: 'unlink',
|
||||
m: 'WP_Medialib',
|
||||
z: 'WP_Adv',
|
||||
t: 'WP_More',
|
||||
d: 'Strikethrough',
|
||||
h: 'WP_Help',
|
||||
p: 'WP_Page',
|
||||
x: 'WP_Code'
|
||||
}, function( command, key ) {
|
||||
editor.shortcuts.add( 'access+' + key, '', command );
|
||||
} );
|
||||
|
||||
editor.addShortcut( modKey + '+c', '', 'JustifyCenter' );
|
||||
editor.addShortcut( modKey + '+r', '', 'JustifyRight' );
|
||||
editor.addShortcut( modKey + '+l', '', 'JustifyLeft' );
|
||||
editor.addShortcut( modKey + '+j', '', 'JustifyFull' );
|
||||
editor.addShortcut( modKey + '+q', '', 'mceBlockQuote' );
|
||||
editor.addShortcut( modKey + '+u', '', 'InsertUnorderedList' );
|
||||
editor.addShortcut( modKey + '+o', '', 'InsertOrderedList' );
|
||||
editor.addShortcut( modKey + '+n', '', 'mceSpellCheck' );
|
||||
editor.addShortcut( modKey + '+s', '', 'unlink' );
|
||||
editor.addShortcut( modKey + '+m', '', 'WP_Medialib' );
|
||||
editor.addShortcut( modKey + '+z', '', 'WP_Adv' );
|
||||
editor.addShortcut( modKey + '+t', '', 'WP_More' );
|
||||
editor.addShortcut( modKey + '+d', '', 'Strikethrough' );
|
||||
editor.addShortcut( modKey + '+h', '', 'WP_Help' );
|
||||
editor.addShortcut( modKey + '+p', '', 'WP_Page' );
|
||||
editor.addShortcut( modKey + '+x', '', 'WP_Code' );
|
||||
editor.addShortcut( 'ctrl+s', '', function() {
|
||||
if ( typeof wp !== 'undefined' && wp.autosave ) {
|
||||
wp.autosave.server.triggerSave();
|
||||
}
|
||||
});
|
||||
editor.addShortcut( 'ctrl+s', '', function() {
|
||||
if ( typeof wp !== 'undefined' && wp.autosave ) {
|
||||
wp.autosave.server.triggerSave();
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
// popup buttons for the gallery, etc.
|
||||
editor.on( 'init', function() {
|
||||
editor.dom.bind( editor.getWin(), 'scroll', function() {
|
||||
_hideButtons();
|
||||
});
|
||||
/**
|
||||
* Experimental: create a floating toolbar.
|
||||
* This functionality will change in the next releases. Not recommended for use by plugins.
|
||||
*/
|
||||
( function() {
|
||||
var Factory = tinymce.ui.Factory,
|
||||
settings = editor.settings,
|
||||
currentToolbar,
|
||||
currentSelection;
|
||||
|
||||
editor.dom.bind( editor.getBody(), 'dragstart', function() {
|
||||
_hideButtons();
|
||||
});
|
||||
});
|
||||
function create( buttons ) {
|
||||
var toolbar,
|
||||
toolbarItems = [],
|
||||
buttonGroup;
|
||||
|
||||
editor.on( 'BeforeExecCommand', function() {
|
||||
_hideButtons();
|
||||
});
|
||||
each( buttons, function( item ) {
|
||||
var itemName;
|
||||
|
||||
editor.on( 'SaveContent', function() {
|
||||
_hideButtons();
|
||||
});
|
||||
function bindSelectorChanged() {
|
||||
var selection = editor.selection;
|
||||
|
||||
editor.on( 'MouseDown', function( e ) {
|
||||
if ( e.target.nodeName !== 'IMG' ) {
|
||||
_hideButtons();
|
||||
}
|
||||
});
|
||||
if ( itemName === 'bullist' ) {
|
||||
selection.selectorChanged( 'ul > li', function( state, args ) {
|
||||
var i = args.parents.length,
|
||||
nodeName;
|
||||
|
||||
editor.on( 'keydown', function( e ) {
|
||||
if ( e.which === tinymce.util.VK.DELETE || e.which === tinymce.util.VK.BACKSPACE ) {
|
||||
_hideButtons();
|
||||
}
|
||||
});
|
||||
while ( i-- ) {
|
||||
nodeName = args.parents[ i ].nodeName;
|
||||
|
||||
// Internal functions
|
||||
function _setEmbed( c ) {
|
||||
return c.replace( /\[embed\]([\s\S]+?)\[\/embed\][\s\u00a0]*/g, function( a, b ) {
|
||||
return '<img width="300" height="200" src="' + tinymce.Env.transparentSrc + '" class="wp-oembed" ' +
|
||||
'alt="'+ b +'" title="'+ b +'" data-mce-resize="false" data-mce-placeholder="1" />';
|
||||
});
|
||||
}
|
||||
if ( nodeName === 'OL' || nodeName == 'UL' ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function _getEmbed( c ) {
|
||||
return c.replace( /<img[^>]+>/g, function( a ) {
|
||||
if ( a.indexOf('class="wp-oembed') !== -1 ) {
|
||||
var u = a.match( /alt="([^\"]+)"/ );
|
||||
item.active( state && nodeName === 'UL' );
|
||||
} );
|
||||
}
|
||||
|
||||
if ( u[1] ) {
|
||||
a = '[embed]' + u[1] + '[/embed]';
|
||||
if ( itemName === 'numlist' ) {
|
||||
selection.selectorChanged( 'ol > li', function( state, args ) {
|
||||
var i = args.parents.length,
|
||||
nodeName;
|
||||
|
||||
while ( i-- ) {
|
||||
nodeName = args.parents[ i ].nodeName;
|
||||
|
||||
if ( nodeName === 'OL' || nodeName === 'UL' ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
item.active( state && nodeName === 'OL' );
|
||||
} );
|
||||
}
|
||||
|
||||
if ( item.settings.stateSelector ) {
|
||||
selection.selectorChanged( item.settings.stateSelector, function( state ) {
|
||||
item.active( state );
|
||||
}, true );
|
||||
}
|
||||
|
||||
if ( item.settings.disabledStateSelector ) {
|
||||
selection.selectorChanged( item.settings.disabledStateSelector, function( state ) {
|
||||
item.disabled( state );
|
||||
} );
|
||||
}
|
||||
}
|
||||
|
||||
if ( item === '|' ) {
|
||||
buttonGroup = null;
|
||||
} else {
|
||||
if ( Factory.has( item ) ) {
|
||||
item = {
|
||||
type: item
|
||||
};
|
||||
|
||||
if ( settings.toolbar_items_size ) {
|
||||
item.size = settings.toolbar_items_size;
|
||||
}
|
||||
|
||||
toolbarItems.push( item );
|
||||
|
||||
buttonGroup = null;
|
||||
} else {
|
||||
if ( ! buttonGroup ) {
|
||||
buttonGroup = {
|
||||
type: 'buttongroup',
|
||||
items: []
|
||||
};
|
||||
|
||||
toolbarItems.push( buttonGroup );
|
||||
}
|
||||
|
||||
if ( editor.buttons[ item ] ) {
|
||||
itemName = item;
|
||||
item = editor.buttons[ itemName ];
|
||||
|
||||
if ( typeof item === 'function' ) {
|
||||
item = item();
|
||||
}
|
||||
|
||||
item.type = item.type || 'button';
|
||||
|
||||
if ( settings.toolbar_items_size ) {
|
||||
item.size = settings.toolbar_items_size;
|
||||
}
|
||||
|
||||
item = Factory.create( item );
|
||||
|
||||
buttonGroup.items.push( item );
|
||||
|
||||
if ( editor.initialized ) {
|
||||
bindSelectorChanged();
|
||||
} else {
|
||||
editor.on( 'init', bindSelectorChanged );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
toolbar = Factory.create( {
|
||||
type: 'panel',
|
||||
layout: 'stack',
|
||||
classes: 'toolbar-grp inline-toolbar-grp',
|
||||
ariaRoot: true,
|
||||
ariaRemember: true,
|
||||
items: [ {
|
||||
type: 'toolbar',
|
||||
layout: 'flow',
|
||||
items: toolbarItems
|
||||
} ]
|
||||
} );
|
||||
|
||||
function hide() {
|
||||
toolbar.hide();
|
||||
}
|
||||
|
||||
return a;
|
||||
});
|
||||
}
|
||||
function reposition() {
|
||||
var top, left, minTop, className,
|
||||
windowPos, adminbar, mceToolbar, boundary,
|
||||
boundaryMiddle, boundaryVerticalMiddle, spaceTop,
|
||||
spaceBottom, windowWidth, toolbarWidth, toolbarHalf,
|
||||
iframe, iframePos, iframeWidth, iframeHeigth,
|
||||
toolbarNodeHeight, verticalSpaceNeeded,
|
||||
toolbarNode = this.getEl(),
|
||||
buffer = 5,
|
||||
margin = 8,
|
||||
adminbarHeight = 0;
|
||||
|
||||
function _showButtons( n, id ) {
|
||||
var p1, p2, vp, X, Y;
|
||||
if ( ! currentSelection ) {
|
||||
return;
|
||||
}
|
||||
|
||||
vp = editor.dom.getViewPort( editor.getWin() );
|
||||
p1 = DOM.getPos( editor.getContentAreaContainer() );
|
||||
p2 = editor.dom.getPos( n );
|
||||
windowPos = window.pageYOffset || document.documentElement.scrollTop;
|
||||
adminbar = tinymce.$( '#wpadminbar' )[0];
|
||||
mceToolbar = tinymce.$( '.mce-toolbar-grp', editor.getContainer() )[0];
|
||||
boundary = currentSelection.getBoundingClientRect();
|
||||
boundaryMiddle = ( boundary.left + boundary.right ) / 2;
|
||||
boundaryVerticalMiddle = ( boundary.top + boundary.bottom ) / 2;
|
||||
spaceTop = boundary.top;
|
||||
spaceBottom = iframeHeigth - boundary.bottom;
|
||||
windowWidth = window.innerWidth;
|
||||
toolbarWidth = toolbarNode.offsetWidth;
|
||||
toolbarHalf = toolbarWidth / 2;
|
||||
iframe = document.getElementById( editor.id + '_ifr' );
|
||||
iframePos = DOM.getPos( iframe );
|
||||
iframeWidth = iframe.offsetWidth;
|
||||
iframeHeigth = iframe.offsetHeight;
|
||||
toolbarNodeHeight = toolbarNode.offsetHeight;
|
||||
verticalSpaceNeeded = toolbarNodeHeight + margin + buffer;
|
||||
|
||||
X = Math.max( p2.x - vp.x, 0 ) + p1.x;
|
||||
Y = Math.max( p2.y - vp.y, 0 ) + p1.y;
|
||||
if ( spaceTop >= verticalSpaceNeeded ) {
|
||||
className = ' mce-arrow-down';
|
||||
top = boundary.top + iframePos.y - toolbarNodeHeight - margin;
|
||||
} else if ( spaceBottom >= verticalSpaceNeeded ) {
|
||||
className = ' mce-arrow-up';
|
||||
top = boundary.bottom + iframePos.y;
|
||||
} else {
|
||||
top = buffer;
|
||||
|
||||
DOM.setStyles( id, {
|
||||
'top' : Y + 5 + 'px',
|
||||
'left' : X + 5 + 'px',
|
||||
'display': 'block'
|
||||
});
|
||||
}
|
||||
if ( boundaryVerticalMiddle >= verticalSpaceNeeded ) {
|
||||
className = ' mce-arrow-down';
|
||||
} else {
|
||||
className = ' mce-arrow-up';
|
||||
}
|
||||
}
|
||||
|
||||
function _hideButtons() {
|
||||
DOM.hide( DOM.select( '#wp_editbtns, #wp_gallerybtns' ) );
|
||||
}
|
||||
// Make sure the image toolbar is below the main toolbar.
|
||||
if ( mceToolbar ) {
|
||||
minTop = DOM.getPos( mceToolbar ).y + mceToolbar.clientHeight;
|
||||
} else {
|
||||
minTop = iframePos.y;
|
||||
}
|
||||
|
||||
// Make sure the image toolbar is below the adminbar (if visible) or below the top of the window.
|
||||
if ( windowPos ) {
|
||||
if ( adminbar && adminbar.getBoundingClientRect().top === 0 ) {
|
||||
adminbarHeight = adminbar.clientHeight;
|
||||
}
|
||||
|
||||
if ( windowPos + adminbarHeight > minTop ) {
|
||||
minTop = windowPos + adminbarHeight;
|
||||
}
|
||||
}
|
||||
|
||||
if ( top && minTop && ( minTop + buffer > top ) ) {
|
||||
top = minTop + buffer;
|
||||
className = '';
|
||||
}
|
||||
|
||||
left = boundaryMiddle - toolbarHalf;
|
||||
left += iframePos.x;
|
||||
|
||||
if ( boundary.left < 0 || boundary.right > iframeWidth ) {
|
||||
left = iframePos.x + ( iframeWidth - toolbarWidth ) / 2;
|
||||
} else if ( toolbarWidth >= windowWidth ) {
|
||||
className += ' mce-arrow-full';
|
||||
left = 0;
|
||||
} else if ( ( left < 0 && boundary.left + toolbarWidth > windowWidth ) ||
|
||||
( left + toolbarWidth > windowWidth && boundary.right - toolbarWidth < 0 ) ) {
|
||||
|
||||
left = ( windowWidth - toolbarWidth ) / 2;
|
||||
} else if ( left < iframePos.x ) {
|
||||
className += ' mce-arrow-left';
|
||||
left = boundary.left + iframePos.x;
|
||||
} else if ( left + toolbarWidth > iframeWidth + iframePos.x ) {
|
||||
className += ' mce-arrow-right';
|
||||
left = boundary.right - toolbarWidth + iframePos.x;
|
||||
}
|
||||
|
||||
toolbarNode.className = toolbarNode.className.replace( / ?mce-arrow-[\w]+/g, '' );
|
||||
toolbarNode.className += className;
|
||||
|
||||
DOM.setStyles( toolbarNode, { 'left': left, 'top': top } );
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
toolbar.on( 'show', function() {
|
||||
currentToolbar = this;
|
||||
this.reposition();
|
||||
} );
|
||||
|
||||
toolbar.on( 'hide', function() {
|
||||
currentToolbar = false;
|
||||
} );
|
||||
|
||||
toolbar.on( 'keydown', function( event ) {
|
||||
if ( event.keyCode === 27 ) {
|
||||
this.hide();
|
||||
editor.focus();
|
||||
}
|
||||
} );
|
||||
|
||||
toolbar.on( 'remove', function() {
|
||||
DOM.unbind( window, 'resize scroll', hide );
|
||||
editor.dom.unbind( editor.getWin(), 'resize scroll', hide );
|
||||
editor.off( 'blur hide', hide );
|
||||
} );
|
||||
|
||||
editor.once( 'init', function() {
|
||||
DOM.bind( window, 'resize scroll', hide );
|
||||
editor.dom.bind( editor.getWin(), 'resize scroll', hide );
|
||||
editor.on( 'blur hide', hide );
|
||||
} );
|
||||
|
||||
toolbar.reposition = reposition;
|
||||
toolbar.hide().renderTo( document.body );
|
||||
|
||||
return toolbar;
|
||||
}
|
||||
|
||||
editor.shortcuts.add( 'alt+119', '', function() {
|
||||
var node;
|
||||
|
||||
if ( currentToolbar ) {
|
||||
node = currentToolbar.find( 'toolbar' )[0];
|
||||
node && node.focus( true );
|
||||
}
|
||||
} );
|
||||
|
||||
editor.on( 'nodechange', function( event ) {
|
||||
var collapsed = editor.selection.isCollapsed();
|
||||
|
||||
var args = {
|
||||
element: event.element,
|
||||
parents: event.parents,
|
||||
collapsed: collapsed
|
||||
};
|
||||
|
||||
editor.fire( 'wptoolbar', args );
|
||||
|
||||
currentSelection = args.selection || args.element;
|
||||
|
||||
currentToolbar && currentToolbar.hide();
|
||||
args.toolbar && args.toolbar.show();
|
||||
} );
|
||||
|
||||
editor.wp = editor.wp || {};
|
||||
editor.wp._createToolbar = create;
|
||||
}());
|
||||
|
||||
function noop() {}
|
||||
|
||||
// Expose some functions (back-compat)
|
||||
return {
|
||||
_showButtons: _showButtons,
|
||||
_hideButtons: _hideButtons,
|
||||
_setEmbed: _setEmbed,
|
||||
_getEmbed: _getEmbed
|
||||
_showButtons: noop,
|
||||
_hideButtons: noop,
|
||||
_setEmbed: noop,
|
||||
_getEmbed: noop
|
||||
};
|
||||
});
|
||||
+1
-1
@@ -1 +1 @@
|
||||
tinymce.ui.FloatPanel.zIndex=100100,tinymce.PluginManager.add("wordpress",function(a){function b(b){var c,d,e,f=0;d="hide"===b,a.theme.panel&&(e=a.theme.panel.find(".toolbar:not(.menubar)")),!e||e.length<2||"hide"===b&&!e[1].visible()||(!b&&e[1].visible()&&(b="hide"),tinymce.each(e,function(a,c){c>0&&("hide"===b?(a.hide(),f+=30):(a.show(),f-=30))}),f&&!d&&(tinymce.Env.iOS||(c=a.getContentAreaContainer().firstChild,j.setStyle(c,"height",c.clientHeight+f)),"hide"===b?(setUserSetting("hidetb","0"),g&&g.active(!1)):(setUserSetting("hidetb","1"),g&&g.active(!0))),a.fire("wp-toolbar-toggle"))}function c(a){return a.replace(/\[embed\]([\s\S]+?)\[\/embed\][\s\u00a0]*/g,function(a,b){return'<img width="300" height="200" src="'+tinymce.Env.transparentSrc+'" class="wp-oembed" alt="'+b+'" title="'+b+'" data-mce-resize="false" data-mce-placeholder="1" />'})}function d(a){return a.replace(/<img[^>]+>/g,function(a){if(-1!==a.indexOf('class="wp-oembed')){var b=a.match(/alt="([^\"]+)"/);b[1]&&(a="[embed]"+b[1]+"[/embed]")}return a})}function e(b,c){var d,e,f,g,h;f=a.dom.getViewPort(a.getWin()),d=j.getPos(a.getContentAreaContainer()),e=a.dom.getPos(b),g=Math.max(e.x-f.x,0)+d.x,h=Math.max(e.y-f.y,0)+d.y,j.setStyles(c,{top:h+5+"px",left:g+5+"px",display:"block"})}function f(){j.hide(j.select("#wp_editbtns, #wp_gallerybtns"))}var g,h,i,j=tinymce.DOM,k=0;return a.addButton("wp_adv",{tooltip:"Toolbar Toggle",cmd:"WP_Adv",onPostRender:function(){g=this,g.active("1"===getUserSetting("hidetb")?!0:!1)}}),a.on("PostRender",function(){a.getParam("wordpress_adv_hidden",!0)&&"0"===getUserSetting("hidetb","0")&&b("hide")}),a.addCommand("WP_Adv",function(){b()}),a.on("focus",function(){window.wpActiveEditor=a.id}),a.on("BeforeSetContent",function(b){var c;b.content&&(-1!==b.content.indexOf("<!--more")&&(c=a.editorManager.i18n.translate("Read more..."),b.content=b.content.replace(/<!--more(.*?)-->/g,function(a,b){return'<img src="'+tinymce.Env.transparentSrc+'" data-wp-more="more" data-wp-more-text="'+b+'" class="wp-more-tag mce-wp-more" title="'+c+'" data-mce-resize="false" data-mce-placeholder="1" />'})),-1!==b.content.indexOf("<!--nextpage-->")&&(c=a.editorManager.i18n.translate("Page break"),b.content=b.content.replace(/<!--nextpage-->/g,'<img src="'+tinymce.Env.transparentSrc+'" data-wp-more="nextpage" class="wp-more-tag mce-wp-nextpage" title="'+c+'" data-mce-resize="false" data-mce-placeholder="1" />')))}),a.on("PostProcess",function(a){a.get&&(a.content=a.content.replace(/<img[^>]+>/g,function(a){var b,c="";return-1!==a.indexOf('data-wp-more="more"')?((b=a.match(/data-wp-more-text="([^"]+)"/))&&(c=b[1]),a="<!--more"+c+"-->"):-1!==a.indexOf('data-wp-more="nextpage"')&&(a="<!--nextpage-->"),a}))}),a.on("ResolveName",function(b){var c;"IMG"===b.target.nodeName&&(c=a.dom.getAttrib(b.target,"data-wp-more"))&&(b.name=c)}),a.addCommand("WP_More",function(b){var c,d,e,f="wp-more-tag",g=a.dom,h=a.selection.getNode();return b=b||"more",f+=" mce-wp-"+b,e="more"===b?"Read more...":"Next page",e=a.editorManager.i18n.translate(e),d='<img src="'+tinymce.Env.transparentSrc+'" title="'+e+'" class="'+f+'" data-wp-more="'+b+'" data-mce-resize="false" data-mce-placeholder="1" />',"BODY"===h.nodeName||"P"===h.nodeName&&"BODY"===h.parentNode.nodeName?void a.insertContent(d):(c=g.getParent(h,function(a){return a.parentNode&&"BODY"===a.parentNode.nodeName?!0:!1},a.getBody()),void(c&&("P"===c.nodeName?c.appendChild(g.create("p",null,d).firstChild):g.insertAfter(g.create("p",null,d),c),a.nodeChanged())))}),a.addCommand("WP_Code",function(){a.formatter.toggle("code")}),a.addCommand("WP_Page",function(){a.execCommand("WP_More","nextpage")}),a.addCommand("WP_Help",function(){a.windowManager.open({url:tinymce.baseURL+"/wp-mce-help.php",title:"Keyboard Shortcuts",width:450,height:420,inline:1,classes:"wp-help"})}),a.addCommand("WP_Medialib",function(){"undefined"!=typeof wp&&wp.media&&wp.media.editor&&wp.media.editor.open(a.id)}),a.addButton("wp_more",{tooltip:"Insert Read More tag",onclick:function(){a.execCommand("WP_More","more")}}),a.addButton("wp_page",{tooltip:"Page break",onclick:function(){a.execCommand("WP_More","nextpage")}}),a.addButton("wp_help",{tooltip:"Keyboard Shortcuts",cmd:"WP_Help"}),a.addButton("wp_code",{tooltip:"Code",cmd:"WP_Code",stateSelector:"code"}),"undefined"!=typeof wp&&wp.media&&wp.media.editor&&a.addMenuItem("add_media",{text:"Add Media",icon:"wp-media-library",context:"insert",cmd:"WP_Medialib"}),a.addMenuItem("wp_more",{text:"Insert Read More tag",icon:"wp_more",context:"insert",onclick:function(){a.execCommand("WP_More","more")}}),a.addMenuItem("wp_page",{text:"Page break",icon:"wp_page",context:"insert",onclick:function(){a.execCommand("WP_More","nextpage")}}),a.on("BeforeExecCommand",function(b){!tinymce.Env.webkit||"InsertUnorderedList"!==b.command&&"InsertOrderedList"!==b.command||(i||(i=a.dom.create("style",{type:"text/css"},"#tinymce,#tinymce span,#tinymce li,#tinymce li>span,#tinymce p,#tinymce p>span{font:medium sans-seLine truncated
|
||||
tinymce.ui.FloatPanel.zIndex=100100,tinymce.PluginManager.add("wordpress",function(a){function b(b){var c,e,h,i=0;e="hide"===b,a.theme.panel&&(h=a.theme.panel.find(".toolbar:not(.menubar)")),!h||h.length<2||"hide"===b&&!h[1].visible()||(!b&&h[1].visible()&&(b="hide"),g(h,function(a,c){c>0&&("hide"===b?(a.hide(),i+=30):(a.show(),i-=30))}),i&&!e&&(tinymce.Env.iOS||(c=a.getContentAreaContainer().firstChild,f.setStyle(c,"height",c.clientHeight+i)),"hide"===b?(setUserSetting("hidetb","0"),d&&d.active(!1)):(setUserSetting("hidetb","1"),d&&d.active(!0))),a.fire("wp-toolbar-toggle"))}function c(){}var d,e,f=tinymce.DOM,g=tinymce.each,h=a.editorManager.i18n.translate,i=0;return"undefined"!=typeof window.jQuery&&window.jQuery(document).triggerHandler("tinymce-editor-setup",[a]),a.addButton("wp_adv",{tooltip:"Toolbar Toggle",cmd:"WP_Adv",onPostRender:function(){d=this,d.active("1"===getUserSetting("hidetb")?!0:!1)}}),a.on("PostRender",function(){a.getParam("wordpress_adv_hidden",!0)&&"0"===getUserSetting("hidetb","0")&&b("hide")}),a.addCommand("WP_Adv",function(){b()}),a.on("focus",function(){window.wpActiveEditor=a.id}),a.on("BeforeSetContent",function(a){var b;a.content&&(-1!==a.content.indexOf("<!--more")&&(b=h("Read more..."),a.content=a.content.replace(/<!--more(.*?)-->/g,function(a,c){return'<img src="'+tinymce.Env.transparentSrc+'" data-wp-more="more" data-wp-more-text="'+c+'" class="wp-more-tag mce-wp-more" title="'+b+'" data-mce-resize="false" data-mce-placeholder="1" />'})),-1!==a.content.indexOf("<!--nextpage-->")&&(b=h("Page break"),a.content=a.content.replace(/<!--nextpage-->/g,'<img src="'+tinymce.Env.transparentSrc+'" data-wp-more="nextpage" class="wp-more-tag mce-wp-nextpage" title="'+b+'" data-mce-resize="false" data-mce-placeholder="1" />')))}),a.on("PostProcess",function(a){a.get&&(a.content=a.content.replace(/<img[^>]+>/g,function(a){var b,c="";return-1!==a.indexOf('data-wp-more="more"')?((b=a.match(/data-wp-more-text="([^"]+)"/))&&(c=b[1]),a="<!--more"+c+"-->"):-1!==a.indexOf('data-wp-more="nextpage"')&&(a="<!--nextpage-->"),a}))}),a.on("ResolveName",function(b){var c;"IMG"===b.target.nodeName&&(c=a.dom.getAttrib(b.target,"data-wp-more"))&&(b.name=c)}),a.addCommand("WP_More",function(b){var c,d,e,f="wp-more-tag",g=a.dom,i=a.selection.getNode();return b=b||"more",f+=" mce-wp-"+b,e="more"===b?"Read more...":"Next page",e=h(e),d='<img src="'+tinymce.Env.transparentSrc+'" title="'+e+'" class="'+f+'" data-wp-more="'+b+'" data-mce-resize="false" data-mce-placeholder="1" />',"BODY"===i.nodeName||"P"===i.nodeName&&"BODY"===i.parentNode.nodeName?void a.insertContent(d):(c=g.getParent(i,function(a){return a.parentNode&&"BODY"===a.parentNode.nodeName?!0:!1},a.getBody()),void(c&&("P"===c.nodeName?c.appendChild(g.create("p",null,d).firstChild):g.insertAfter(g.create("p",null,d),c),a.nodeChanged())))}),a.addCommand("WP_Code",function(){a.formatter.toggle("code")}),a.addCommand("WP_Page",function(){a.execCommand("WP_More","nextpage")}),a.addCommand("WP_Help",function(){a.windowManager.open({url:tinymce.baseURL+"/wp-mce-help.php",title:"Keyboard Shortcuts",width:450,height:420,classes:"wp-help",buttons:{text:"Close",onclick:"close"}})}),a.addCommand("WP_Medialib",function(){"undefined"!=typeof wp&&wp.media&&wp.media.editor&&wp.media.editor.open(a.id)}),a.addButton("wp_more",{tooltip:"Insert Read More tag",onclick:function(){a.execCommand("WP_More","more")}}),a.addButton("wp_page",{tooltip:"Page break",onclick:function(){a.execCommand("WP_More","nextpage")}}),a.addButton("wp_help",{tooltip:"Keyboard Shortcuts",cmd:"WP_Help"}),a.addButton("wp_code",{tooltip:"Code",cmd:"WP_Code",stateSelector:"code"}),"undefined"!=typeof wp&&wp.media&&wp.media.editor&&a.addMenuItem("add_media",{text:"Add Media",icon:"wp-media-library",context:"insert",cmd:"WP_Medialib"}),a.addMenuItem("wp_more",{text:"Insert Read More tag",icon:"wp_more",context:"insert",onclick:function(){a.execCommand("WP_More","more")}}),a.addMenuItem("wp_page",{text:"Page break",icon:"wp_page",context:"insert",onclick:function(){a.execCommand("WP_More","nextpage")}}),a.on("BeforeExecCommand",function(b){!tinymce.Env.webkit||"InsertUnorderedList"!==b.command&&"InsertOrderedList"!==b.command||(e||(e=a.dom.create("style",{type:"text/css"},"#tinymce,#tinymce span,#tinymce li,#tinymce li>span,#tinymce p,#tinymce p>span{font:medium sans-serif;color:#000;line-height:normal;}")),a.getDoc().head.appendChild(e))}),a.on("ExecCommand",function(b){tinymce.Env.webkit&&e&&("InsertUnorderedList"===b.command||"InsertOrderedList"===b.command)&&a.dom.remove(e)}),a.on("init",function(){var b=tinymce.Env,c=["mceContentBody"],d=a.getDoc(),e=a.dom;tinymce.Env.iOS&&e.addClass(d.documentElement,"ios"),"rtl"===a.getParam("directionality")&&(c.push("rtl"),e.setAttrib(d.documentElement,"dir","rtl")),b.ie?9===parseInt(b.ie,10)?c.push("ie9"):8===parseInt(b.ie,10)?c.push("ie8"):b.ie<8&&c.push("ie7"):b.webkit&&c.push("webkit"),c.push("wp-editor"),g(c,function(a){a&&e.addClass(d.body,a)}),a.onLine truncated
|
||||
Reference in new issue
Block a user