TinyMCE:
- Fix toolbar icons in IE9. - Remove background gradients in IE < 10. - Lint our plugins. - Add draggable attribute to the caption wrapper and make the captioned images non-draggable in Chrome. See #24067. Built from https://develop.svn.wordpress.org/trunk@26880 git-svn-id: http://core.svn.wordpress.org/trunk@26763 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
61b84671ff
commit
a16cc19790
|
@ -2,12 +2,13 @@
|
|||
TinyMCE and Quicklinks toolbars
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
.mce-panel {
|
||||
div.mce-panel {
|
||||
border: 0;
|
||||
background: #fff;
|
||||
filter: none;
|
||||
}
|
||||
|
||||
.mce-toolbar-grp {
|
||||
div.mce-toolbar-grp {
|
||||
border-bottom: 1px solid #dedede;
|
||||
background: #f5f5f5;
|
||||
}
|
||||
|
@ -40,6 +41,7 @@
|
|||
margin: 0 1px;
|
||||
-webkit-border-radius: 2px;
|
||||
border-radius: 2px;
|
||||
filter: none;
|
||||
}
|
||||
|
||||
#wp-fullscreen-buttons .mce-btn:hover,
|
||||
|
@ -107,37 +109,37 @@
|
|||
color: #333;
|
||||
}
|
||||
|
||||
.mce-i-bold,
|
||||
.mce-i-italic,
|
||||
.mce-i-bullist,
|
||||
.mce-i-numlist,
|
||||
.mce-i-blockquote,
|
||||
.mce-i-alignleft,
|
||||
.mce-i-aligncenter,
|
||||
.mce-i-alignright,
|
||||
.mce-i-link,
|
||||
.mce-i-unlink,
|
||||
.mce-i-wp_more,
|
||||
.mce-i-strikethrough,
|
||||
.mce-i-spellchecker,
|
||||
.mce-i-fullscreen,
|
||||
.mce-i-wp_fullscreen,
|
||||
.mce-i-wp_adv,
|
||||
.mce-i-underline,
|
||||
.mce-i-alignjustify,
|
||||
.mce-i-forecolor,
|
||||
.mce-i-pastetext,
|
||||
.mce-i-pasteword,
|
||||
.mce-i-removeformat,
|
||||
.mce-i-charmap,
|
||||
.mce-i-outdent,
|
||||
.mce-i-indent,
|
||||
.mce-i-undo,
|
||||
.mce-i-redo,
|
||||
.mce-i-help,
|
||||
.mce-i-wp_help,
|
||||
.mce-i-wp-media-library,
|
||||
.mce-i-ltr {
|
||||
i.mce-i-bold,
|
||||
i.mce-i-italic,
|
||||
i.mce-i-bullist,
|
||||
i.mce-i-numlist,
|
||||
i.mce-i-blockquote,
|
||||
i.mce-i-alignleft,
|
||||
i.mce-i-aligncenter,
|
||||
i.mce-i-alignright,
|
||||
i.mce-i-link,
|
||||
i.mce-i-unlink,
|
||||
i.mce-i-wp_more,
|
||||
i.mce-i-strikethrough,
|
||||
i.mce-i-spellchecker,
|
||||
i.mce-i-fullscreen,
|
||||
i.mce-i-wp_fullscreen,
|
||||
i.mce-i-wp_adv,
|
||||
i.mce-i-underline,
|
||||
i.mce-i-alignjustify,
|
||||
i.mce-i-forecolor,
|
||||
i.mce-i-pastetext,
|
||||
i.mce-i-pasteword,
|
||||
i.mce-i-removeformat,
|
||||
i.mce-i-charmap,
|
||||
i.mce-i-outdent,
|
||||
i.mce-i-indent,
|
||||
i.mce-i-undo,
|
||||
i.mce-i-redo,
|
||||
i.mce-i-help,
|
||||
i.mce-i-wp_help,
|
||||
i.mce-i-wp-media-library,
|
||||
i.mce-i-ltr {
|
||||
font: normal 20px/1 'dashicons';
|
||||
padding: 0;
|
||||
vertical-align: top;
|
||||
|
@ -146,116 +148,117 @@
|
|||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
.mce-i-bold:before {
|
||||
i.mce-i-bold:before {
|
||||
content: '\f200';
|
||||
}
|
||||
|
||||
.mce-i-italic:before {
|
||||
i.mce-i-italic:before {
|
||||
content: '\f201';
|
||||
}
|
||||
|
||||
.mce-i-bullist:before {
|
||||
i.mce-i-bullist:before {
|
||||
content: '\f203';
|
||||
}
|
||||
|
||||
.mce-i-numlist:before {
|
||||
i.mce-i-numlist:before {
|
||||
content: '\f204';
|
||||
}
|
||||
|
||||
.mce-i-blockquote:before {
|
||||
i.mce-i-blockquote:before {
|
||||
content: '\f205';
|
||||
}
|
||||
|
||||
.mce-i-alignleft:before {
|
||||
i.mce-i-alignleft:before {
|
||||
content: '\f206';
|
||||
}
|
||||
|
||||
.mce-i-aligncenter:before {
|
||||
i.mce-i-aligncenter:before {
|
||||
content: '\f207';
|
||||
}
|
||||
|
||||
.mce-i-alignright:before {
|
||||
i.mce-i-alignright:before {
|
||||
content: '\f208';
|
||||
}
|
||||
|
||||
.mce-i-link:before {
|
||||
i.mce-i-link:before {
|
||||
content: '\f103';
|
||||
}
|
||||
|
||||
.mce-i-unlink:before {
|
||||
i.mce-i-unlink:before {
|
||||
content: '\f225';
|
||||
}
|
||||
|
||||
.mce-i-wp_more:before {
|
||||
i.mce-i-wp_more:before {
|
||||
content: '\f209';
|
||||
}
|
||||
|
||||
.mce-i-strikethrough:before {
|
||||
i.mce-i-strikethrough:before {
|
||||
content: '\f224';
|
||||
}
|
||||
|
||||
.mce-i-spellchecker:before {
|
||||
i.mce-i-spellchecker:before {
|
||||
content: '\f210';
|
||||
}
|
||||
|
||||
.mce-i-fullscreen:before,
|
||||
.mce-i-wp_fullscreen:before {
|
||||
i.mce-i-fullscreen:before,
|
||||
i.mce-i-wp_fullscreen:before {
|
||||
content: '\f211';
|
||||
}
|
||||
|
||||
.mce-i-wp_adv:before {
|
||||
i.mce-i-wp_adv:before {
|
||||
content: '\f212';
|
||||
}
|
||||
.mce-i-underline:before {
|
||||
|
||||
i.mce-i-underline:before {
|
||||
content: '\f213';
|
||||
}
|
||||
|
||||
.mce-i-alignjustify:before {
|
||||
i.mce-i-alignjustify:before {
|
||||
content: '\f214';
|
||||
}
|
||||
|
||||
.mce-i-forecolor:before {
|
||||
i.mce-i-forecolor:before {
|
||||
content: '\f215';
|
||||
}
|
||||
|
||||
.mce-i-pastetext:before {
|
||||
i.mce-i-pastetext:before {
|
||||
content: '\f217';
|
||||
}
|
||||
|
||||
.mce-i-removeformat:before {
|
||||
i.mce-i-removeformat:before {
|
||||
content: '\f218';
|
||||
}
|
||||
|
||||
.mce-i-charmap:before {
|
||||
i.mce-i-charmap:before {
|
||||
content: '\f220';
|
||||
}
|
||||
|
||||
.mce-i-outdent:before {
|
||||
i.mce-i-outdent:before {
|
||||
content: '\f221';
|
||||
}
|
||||
|
||||
.mce-i-indent:before {
|
||||
i.mce-i-indent:before {
|
||||
content: '\f222';
|
||||
}
|
||||
|
||||
.mce-i-undo:before {
|
||||
i.mce-i-undo:before {
|
||||
content: '\f171';
|
||||
}
|
||||
|
||||
.mce-i-redo:before {
|
||||
i.mce-i-redo:before {
|
||||
content: '\f172';
|
||||
}
|
||||
|
||||
.mce-i-help:before,
|
||||
.mce-i-wp_help:before {
|
||||
i.mce-i-help:before,
|
||||
i.mce-i-wp_help:before {
|
||||
content: '\f223';
|
||||
}
|
||||
|
||||
.mce-i-wp-media-library:before {
|
||||
i.mce-i-wp-media-library:before {
|
||||
content: '\f104';
|
||||
}
|
||||
|
||||
.mce-i-ltr:before {
|
||||
i.mce-i-ltr:before {
|
||||
content: '\f320';
|
||||
}
|
||||
|
||||
|
@ -299,8 +302,7 @@
|
|||
box-shadow: none;
|
||||
}
|
||||
|
||||
.quicktags-toolbar,
|
||||
.wp_themeSkin tr.mceFirst td.mceToolbar {
|
||||
.quicktags-toolbar {
|
||||
border-bottom: 1px solid #dedede;
|
||||
background: #f5f5f5;
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -2,12 +2,13 @@
|
|||
TinyMCE and Quicklinks toolbars
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
.mce-panel {
|
||||
div.mce-panel {
|
||||
border: 0;
|
||||
background: #fff;
|
||||
filter: none;
|
||||
}
|
||||
|
||||
.mce-toolbar-grp {
|
||||
div.mce-toolbar-grp {
|
||||
border-bottom: 1px solid #dedede;
|
||||
background: #f5f5f5;
|
||||
}
|
||||
|
@ -40,6 +41,7 @@
|
|||
margin: 0 1px;
|
||||
-webkit-border-radius: 2px;
|
||||
border-radius: 2px;
|
||||
filter: none;
|
||||
}
|
||||
|
||||
#wp-fullscreen-buttons .mce-btn:hover,
|
||||
|
@ -107,37 +109,37 @@
|
|||
color: #333;
|
||||
}
|
||||
|
||||
.mce-i-bold,
|
||||
.mce-i-italic,
|
||||
.mce-i-bullist,
|
||||
.mce-i-numlist,
|
||||
.mce-i-blockquote,
|
||||
.mce-i-alignleft,
|
||||
.mce-i-aligncenter,
|
||||
.mce-i-alignright,
|
||||
.mce-i-link,
|
||||
.mce-i-unlink,
|
||||
.mce-i-wp_more,
|
||||
.mce-i-strikethrough,
|
||||
.mce-i-spellchecker,
|
||||
.mce-i-fullscreen,
|
||||
.mce-i-wp_fullscreen,
|
||||
.mce-i-wp_adv,
|
||||
.mce-i-underline,
|
||||
.mce-i-alignjustify,
|
||||
.mce-i-forecolor,
|
||||
.mce-i-pastetext,
|
||||
.mce-i-pasteword,
|
||||
.mce-i-removeformat,
|
||||
.mce-i-charmap,
|
||||
.mce-i-outdent,
|
||||
.mce-i-indent,
|
||||
.mce-i-undo,
|
||||
.mce-i-redo,
|
||||
.mce-i-help,
|
||||
.mce-i-wp_help,
|
||||
.mce-i-wp-media-library,
|
||||
.mce-i-ltr {
|
||||
i.mce-i-bold,
|
||||
i.mce-i-italic,
|
||||
i.mce-i-bullist,
|
||||
i.mce-i-numlist,
|
||||
i.mce-i-blockquote,
|
||||
i.mce-i-alignleft,
|
||||
i.mce-i-aligncenter,
|
||||
i.mce-i-alignright,
|
||||
i.mce-i-link,
|
||||
i.mce-i-unlink,
|
||||
i.mce-i-wp_more,
|
||||
i.mce-i-strikethrough,
|
||||
i.mce-i-spellchecker,
|
||||
i.mce-i-fullscreen,
|
||||
i.mce-i-wp_fullscreen,
|
||||
i.mce-i-wp_adv,
|
||||
i.mce-i-underline,
|
||||
i.mce-i-alignjustify,
|
||||
i.mce-i-forecolor,
|
||||
i.mce-i-pastetext,
|
||||
i.mce-i-pasteword,
|
||||
i.mce-i-removeformat,
|
||||
i.mce-i-charmap,
|
||||
i.mce-i-outdent,
|
||||
i.mce-i-indent,
|
||||
i.mce-i-undo,
|
||||
i.mce-i-redo,
|
||||
i.mce-i-help,
|
||||
i.mce-i-wp_help,
|
||||
i.mce-i-wp-media-library,
|
||||
i.mce-i-ltr {
|
||||
font: normal 20px/1 'dashicons';
|
||||
padding: 0;
|
||||
vertical-align: top;
|
||||
|
@ -146,116 +148,117 @@
|
|||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
.mce-i-bold:before {
|
||||
i.mce-i-bold:before {
|
||||
content: '\f200';
|
||||
}
|
||||
|
||||
.mce-i-italic:before {
|
||||
i.mce-i-italic:before {
|
||||
content: '\f201';
|
||||
}
|
||||
|
||||
.mce-i-bullist:before {
|
||||
i.mce-i-bullist:before {
|
||||
content: '\f203';
|
||||
}
|
||||
|
||||
.mce-i-numlist:before {
|
||||
i.mce-i-numlist:before {
|
||||
content: '\f204';
|
||||
}
|
||||
|
||||
.mce-i-blockquote:before {
|
||||
i.mce-i-blockquote:before {
|
||||
content: '\f205';
|
||||
}
|
||||
|
||||
.mce-i-alignleft:before {
|
||||
i.mce-i-alignleft:before {
|
||||
content: '\f206';
|
||||
}
|
||||
|
||||
.mce-i-aligncenter:before {
|
||||
i.mce-i-aligncenter:before {
|
||||
content: '\f207';
|
||||
}
|
||||
|
||||
.mce-i-alignright:before {
|
||||
i.mce-i-alignright:before {
|
||||
content: '\f208';
|
||||
}
|
||||
|
||||
.mce-i-link:before {
|
||||
i.mce-i-link:before {
|
||||
content: '\f103';
|
||||
}
|
||||
|
||||
.mce-i-unlink:before {
|
||||
i.mce-i-unlink:before {
|
||||
content: '\f225';
|
||||
}
|
||||
|
||||
.mce-i-wp_more:before {
|
||||
i.mce-i-wp_more:before {
|
||||
content: '\f209';
|
||||
}
|
||||
|
||||
.mce-i-strikethrough:before {
|
||||
i.mce-i-strikethrough:before {
|
||||
content: '\f224';
|
||||
}
|
||||
|
||||
.mce-i-spellchecker:before {
|
||||
i.mce-i-spellchecker:before {
|
||||
content: '\f210';
|
||||
}
|
||||
|
||||
.mce-i-fullscreen:before,
|
||||
.mce-i-wp_fullscreen:before {
|
||||
i.mce-i-fullscreen:before,
|
||||
i.mce-i-wp_fullscreen:before {
|
||||
content: '\f211';
|
||||
}
|
||||
|
||||
.mce-i-wp_adv:before {
|
||||
i.mce-i-wp_adv:before {
|
||||
content: '\f212';
|
||||
}
|
||||
.mce-i-underline:before {
|
||||
|
||||
i.mce-i-underline:before {
|
||||
content: '\f213';
|
||||
}
|
||||
|
||||
.mce-i-alignjustify:before {
|
||||
i.mce-i-alignjustify:before {
|
||||
content: '\f214';
|
||||
}
|
||||
|
||||
.mce-i-forecolor:before {
|
||||
i.mce-i-forecolor:before {
|
||||
content: '\f215';
|
||||
}
|
||||
|
||||
.mce-i-pastetext:before {
|
||||
i.mce-i-pastetext:before {
|
||||
content: '\f217';
|
||||
}
|
||||
|
||||
.mce-i-removeformat:before {
|
||||
i.mce-i-removeformat:before {
|
||||
content: '\f218';
|
||||
}
|
||||
|
||||
.mce-i-charmap:before {
|
||||
i.mce-i-charmap:before {
|
||||
content: '\f220';
|
||||
}
|
||||
|
||||
.mce-i-outdent:before {
|
||||
i.mce-i-outdent:before {
|
||||
content: '\f221';
|
||||
}
|
||||
|
||||
.mce-i-indent:before {
|
||||
i.mce-i-indent:before {
|
||||
content: '\f222';
|
||||
}
|
||||
|
||||
.mce-i-undo:before {
|
||||
i.mce-i-undo:before {
|
||||
content: '\f171';
|
||||
}
|
||||
|
||||
.mce-i-redo:before {
|
||||
i.mce-i-redo:before {
|
||||
content: '\f172';
|
||||
}
|
||||
|
||||
.mce-i-help:before,
|
||||
.mce-i-wp_help:before {
|
||||
i.mce-i-help:before,
|
||||
i.mce-i-wp_help:before {
|
||||
content: '\f223';
|
||||
}
|
||||
|
||||
.mce-i-wp-media-library:before {
|
||||
i.mce-i-wp-media-library:before {
|
||||
content: '\f104';
|
||||
}
|
||||
|
||||
.mce-i-ltr:before {
|
||||
i.mce-i-ltr:before {
|
||||
content: '\f320';
|
||||
}
|
||||
|
||||
|
@ -299,8 +302,7 @@
|
|||
box-shadow: none;
|
||||
}
|
||||
|
||||
.quicktags-toolbar,
|
||||
.wp_themeSkin tr.mceFirst td.mceToolbar {
|
||||
.quicktags-toolbar {
|
||||
border-bottom: 1px solid #dedede;
|
||||
background: #f5f5f5;
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -4,10 +4,14 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) {
|
|||
last = 0;
|
||||
|
||||
function toggleToolbars( state ) {
|
||||
var iframe,
|
||||
pixels = 0,
|
||||
initial = state === 'hide',
|
||||
toolbars = editor.theme.panel && editor.theme.panel.find('.toolbar');
|
||||
var iframe, initial, toolbars,
|
||||
pixels = 0;
|
||||
|
||||
initial = ( state === 'hide' );
|
||||
|
||||
if ( editor.theme.panel ) {
|
||||
toolbars = editor.theme.panel.find('.toolbar');
|
||||
}
|
||||
|
||||
if ( ! toolbars || toolbars.length < 2 || ( state === 'hide' && ! toolbars[1].visible() ) ) {
|
||||
return;
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -49,6 +49,11 @@ tinymce.PluginManager.add( 'wpeditimage', function( editor ) {
|
|||
|
||||
function getShortcode( content ) {
|
||||
return content.replace( /<div (?:id="attachment_|class="mceTemp)[^>]*>([\s\S]+?)<\/div>/g, function( a, b ) {
|
||||
if ( b.indexOf('<img ') === -1 ) {
|
||||
// Broken caption. The user dragged the image out?
|
||||
return '';
|
||||
}
|
||||
|
||||
var ret = b.replace( /<dl ([^>]+)>\s*<dt [^>]+>([\s\S]+?)<\/dt>\s*<dd [^>]+>([\s\S]*?)<\/dd>\s*<\/dl>/gi, function( a, b, c, cap ) {
|
||||
var id, cls, w;
|
||||
|
||||
|
@ -129,7 +134,7 @@ tinymce.PluginManager.add( 'wpeditimage', function( editor ) {
|
|||
captionId = '',
|
||||
captionAlign = '',
|
||||
captionWidth = '',
|
||||
wrap, parent, html, P, imgId;
|
||||
wrap, parent, node, html, imgId;
|
||||
|
||||
// Temp image id so we can find the node later
|
||||
data.id = '__wp-temp-img-id';
|
||||
|
@ -178,7 +183,7 @@ tinymce.PluginManager.add( 'wpeditimage', function( editor ) {
|
|||
}
|
||||
|
||||
if ( parent && parent.nodeName === 'P' ) {
|
||||
wrap = dom.create( 'div', { 'class': 'mceTemp' }, html );
|
||||
wrap = dom.create( 'div', { 'class': 'mceTemp', 'draggable': 'true' }, html );
|
||||
dom.insertAfter( wrap, parent );
|
||||
editor.selection.select( wrap );
|
||||
editor.nodeChanged();
|
||||
|
@ -187,7 +192,7 @@ tinymce.PluginManager.add( 'wpeditimage', function( editor ) {
|
|||
dom.remove( parent );
|
||||
}
|
||||
} else {
|
||||
editor.selection.setContent( '<div class="mceTemp">' + html + '</div>' );
|
||||
editor.selection.setContent( '<div class="mceTemp" draggable="true">' + html + '</div>' );
|
||||
}
|
||||
} else {
|
||||
editor.selection.setContent( html );
|
||||
|
@ -244,7 +249,7 @@ tinymce.PluginManager.add( 'wpeditimage', function( editor ) {
|
|||
'<dt class="wp-caption-dt">'+ html +'</dt><dd class="wp-caption-dd">'+ caption +'</dd></dl>';
|
||||
|
||||
if ( parent = dom.getParent( imgNode, 'p' ) ) {
|
||||
wrap = dom.create( 'div', { 'class': 'mceTemp' }, html );
|
||||
wrap = dom.create( 'div', { 'class': 'mceTemp', 'draggable': 'true' }, html );
|
||||
dom.insertAfter( wrap, parent );
|
||||
editor.selection.select( wrap );
|
||||
editor.nodeChanged();
|
||||
|
@ -256,7 +261,7 @@ tinymce.PluginManager.add( 'wpeditimage', function( editor ) {
|
|||
dom.remove( parent );
|
||||
}
|
||||
} else {
|
||||
editor.selection.setContent( '<div class="mceTemp">' + html + '</div>' );
|
||||
editor.selection.setContent( '<div class="mceTemp" draggable="true">' + html + '</div>' );
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -284,7 +289,7 @@ tinymce.PluginManager.add( 'wpeditimage', function( editor ) {
|
|||
|
||||
editor.on( 'wpLoadImageData', function( e ) {
|
||||
var parent,
|
||||
data = e.imgData.data
|
||||
data = e.imgData.data,
|
||||
imgNode = e.imgData.node;
|
||||
|
||||
if ( parent = dom.getParent( imgNode, 'dl.wp-caption' ) ) {
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -10,11 +10,10 @@ tinymce.PluginManager.add( 'wpfullscreen', function( editor ) {
|
|||
var deltaSize, myHeight,
|
||||
d = editor.getDoc(),
|
||||
body = d.body,
|
||||
de = d.documentElement,
|
||||
DOM = tinymce.DOM
|
||||
DOM = tinymce.DOM,
|
||||
resizeHeight = 250;
|
||||
|
||||
if ( ( e && e.type == 'setcontent' && e.initial ) || editor.settings.inline ) {
|
||||
if ( ( e && e.type === 'setcontent' && e.initial ) || editor.settings.inline ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
tinymce.PluginManager.add("wpfullscreen",function(a){function b(c){var d,e,f=a.getDoc(),h=f.body,i=(f.documentElement,tinymce.DOM);resizeHeight=250,c&&"setcontent"==c.type&&c.initial||a.settings.inline||(e=tinymce.Env.ie?h.scrollHeight:tinymce.Env.webkit&&0===h.clientHeight?0:h.offsetHeight,e>250&&(resizeHeight=e),h.scrollTop=0,resizeHeight!==g&&(d=resizeHeight-g,i.setStyle(i.get(a.id+"_ifr"),"height",resizeHeight+"px"),g=resizeHeight,tinymce.isWebKit&&0>d&&b(c)))}function c(){f.wp_fullscreen=!0,a.dom.addClass(a.getDoc().documentElement,"wp-fullscreen"),a.on("change setcontent paste keyup",b)}function d(){f.wp_fullscreen=!1,a.dom.removeClass(a.getDoc().documentElement,"wp-fullscreen"),a.off("change setcontent paste keyup",b),g=0}function e(){"undefined"!=typeof wp&&wp.editor&&wp.editor.fullscreen&&(a.getParam("wp_fullscreen")?wp.editor.fullscreen.off():wp.editor.fullscreen.on())}var f=a.settings,g=0;a.addCommand("wpAutoResize",b),a.addCommand("wpFullScreenOn",c),a.addCommand("wpFullScreenOff",d),a.addCommand("wpFullScreen",e),a.on("init",function(){a.getParam("wp_fullscreen")&&c(),a.addShortcut("alt+shift+w","","wpFullScreen")}),a.addButton("wp_fullscreen",{tooltip:"Distraction Free Writing",shortcut:"Alt+Shift+W",onclick:e}),a.addMenuItem("wp_fullscreen",{text:"Distraction Free Writing",shortcut:"Alt+Shift+W",context:"view",onclick:e})});
|
||||
tinymce.PluginManager.add("wpfullscreen",function(a){function b(c){var d,e,f=a.getDoc(),h=f.body,i=tinymce.DOM,j=250;c&&"setcontent"===c.type&&c.initial||a.settings.inline||(e=tinymce.Env.ie?h.scrollHeight:tinymce.Env.webkit&&0===h.clientHeight?0:h.offsetHeight,e>250&&(j=e),h.scrollTop=0,j!==g&&(d=j-g,i.setStyle(i.get(a.id+"_ifr"),"height",j+"px"),g=j,tinymce.isWebKit&&0>d&&b(c)))}function c(){f.wp_fullscreen=!0,a.dom.addClass(a.getDoc().documentElement,"wp-fullscreen"),a.on("change setcontent paste keyup",b)}function d(){f.wp_fullscreen=!1,a.dom.removeClass(a.getDoc().documentElement,"wp-fullscreen"),a.off("change setcontent paste keyup",b),g=0}function e(){"undefined"!=typeof wp&&wp.editor&&wp.editor.fullscreen&&(a.getParam("wp_fullscreen")?wp.editor.fullscreen.off():wp.editor.fullscreen.on())}var f=a.settings,g=0;a.addCommand("wpAutoResize",b),a.addCommand("wpFullScreenOn",c),a.addCommand("wpFullScreenOff",d),a.addCommand("wpFullScreen",e),a.on("init",function(){a.getParam("wp_fullscreen")&&c(),a.addShortcut("alt+shift+w","","wpFullScreen")}),a.addButton("wp_fullscreen",{tooltip:"Distraction Free Writing",shortcut:"Alt+Shift+W",onclick:e}),a.addMenuItem("wp_fullscreen",{text:"Distraction Free Writing",shortcut:"Alt+Shift+W",context:"view",onclick:e})});
|
|
@ -1,5 +1,5 @@
|
|||
/* global tinymce */
|
||||
tinymce.PluginManager.add('wpgallery', function( editor, url ) {
|
||||
tinymce.PluginManager.add('wpgallery', function( editor ) {
|
||||
|
||||
function parseGallery( content ) {
|
||||
return content.replace( /\[gallery([^\]]*)\]/g, function( match, attr ) {
|
||||
|
@ -69,7 +69,7 @@ tinymce.PluginManager.add('wpgallery', function( editor, url ) {
|
|||
});
|
||||
*/
|
||||
editor.on( 'mouseup', function( e ) {
|
||||
if ( e.target.nodeName == 'IMG' && editor.dom.hasClass( e.target, 'wp-gallery' ) ) {
|
||||
if ( e.target.nodeName === 'IMG' && editor.dom.hasClass( e.target, 'wp-gallery' ) ) {
|
||||
// Don't trigger on right-click
|
||||
if ( e.button !== 2 ) {
|
||||
if ( editor.dom.hasClass( e.target, 'wp-gallery-selected' ) ) {
|
||||
|
|
|
@ -1 +1 @@
|
|||
tinymce.PluginManager.add("wpgallery",function(a){function b(a){return a.replace(/\[gallery([^\]]*)\]/g,function(a,b){var c=tinymce.DOM.encode(b);return'<img src="'+tinymce.Env.transparentSrc+'" class="wp-gallery mceItem" '+'title="gallery'+c+'" data-mce-resize="false" data-mce-placeholder="1" />'})}function c(a){function b(a,b){return b=new RegExp(b+'="([^"]+)"',"g").exec(a),b?tinymce.DOM.decode(b[1]):""}return a.replace(/(?:<p[^>]*>)*(<img[^>]+>)(?:<\/p>)*/g,function(a,c){var d=b(c,"class");return-1!==d.indexOf("wp-gallery")?"<p>["+tinymce.trim(b(c,"title"))+"]</p>":a})}return a.addCommand("WP_Gallery",function(){var b,c,d;"undefined"!=typeof wp&&wp.media&&wp.media.gallery&&(d=a.selection.getNode(),b=wp.media.gallery,"IMG"===d.nodeName&&a.dom.hasClass(d,"wp-gallery")&&(c=b.edit("["+a.dom.getAttrib(d,"title")+"]"),c.state("gallery-edit").on("update",function(c){var e=b.shortcode(c).string().slice(1,-1);a.dom.setAttrib(d,"title",e)})))}),a.on("mouseup",function(b){"IMG"==b.target.nodeName&&a.dom.hasClass(b.target,"wp-gallery")?2!==b.button&&(a.dom.hasClass(b.target,"wp-gallery-selected")?(a.execCommand("WP_Gallery"),a.dom.removeClass(b.target,"wp-gallery-selected")):a.dom.addClass(b.target,"wp-gallery-selected")):a.dom.removeClass(a.dom.select("img.wp-gallery-selected"),"wp-gallery-selected")}),a.on("ResolveName",function(b){var c=a.dom,d=b.target;"IMG"===d.nodeName&&c.hasClass(d,"wp-gallery")&&(b.name="gallery")}),a.on("BeforeSetContent",function(a){a.content=b(a.content)}),a.on("PostProcess",function(a){a.get&&(a.content=c(a.content))}),{_do_gallery:b,_get_gallery:c}});
|
||||
tinymce.PluginManager.add("wpgallery",function(a){function b(a){return a.replace(/\[gallery([^\]]*)\]/g,function(a,b){var c=tinymce.DOM.encode(b);return'<img src="'+tinymce.Env.transparentSrc+'" class="wp-gallery mceItem" '+'title="gallery'+c+'" data-mce-resize="false" data-mce-placeholder="1" />'})}function c(a){function b(a,b){return b=new RegExp(b+'="([^"]+)"',"g").exec(a),b?tinymce.DOM.decode(b[1]):""}return a.replace(/(?:<p[^>]*>)*(<img[^>]+>)(?:<\/p>)*/g,function(a,c){var d=b(c,"class");return-1!==d.indexOf("wp-gallery")?"<p>["+tinymce.trim(b(c,"title"))+"]</p>":a})}return a.addCommand("WP_Gallery",function(){var b,c,d;"undefined"!=typeof wp&&wp.media&&wp.media.gallery&&(d=a.selection.getNode(),b=wp.media.gallery,"IMG"===d.nodeName&&a.dom.hasClass(d,"wp-gallery")&&(c=b.edit("["+a.dom.getAttrib(d,"title")+"]"),c.state("gallery-edit").on("update",function(c){var e=b.shortcode(c).string().slice(1,-1);a.dom.setAttrib(d,"title",e)})))}),a.on("mouseup",function(b){"IMG"===b.target.nodeName&&a.dom.hasClass(b.target,"wp-gallery")?2!==b.button&&(a.dom.hasClass(b.target,"wp-gallery-selected")?(a.execCommand("WP_Gallery"),a.dom.removeClass(b.target,"wp-gallery-selected")):a.dom.addClass(b.target,"wp-gallery-selected")):a.dom.removeClass(a.dom.select("img.wp-gallery-selected"),"wp-gallery-selected")}),a.on("ResolveName",function(b){var c=a.dom,d=b.target;"IMG"===d.nodeName&&c.hasClass(d,"wp-gallery")&&(b.name="gallery")}),a.on("BeforeSetContent",function(a){a.content=b(a.content)}),a.on("PostProcess",function(a){a.get&&(a.content=c(a.content))}),{_do_gallery:b,_get_gallery:c}});
|
|
@ -13,8 +13,9 @@
|
|||
var wpView = this;
|
||||
|
||||
// Check if the `wp.mce` API exists.
|
||||
if ( typeof wp === 'undefined' || ! wp.mce )
|
||||
if ( typeof wp === 'undefined' || ! wp.mce ) {
|
||||
return;
|
||||
}
|
||||
|
||||
editor.on( 'PreInit', function() {
|
||||
// Add elements so we can set `contenteditable` to false.
|
||||
|
@ -26,8 +27,9 @@
|
|||
// view wrappers. Since the editor's DOM is outdated at this point,
|
||||
// we'll wait to render the views.
|
||||
editor.on( 'BeforeSetContent', function( e ) {
|
||||
if ( ! e.content )
|
||||
if ( ! e.content ) {
|
||||
return;
|
||||
}
|
||||
|
||||
e.content = wp.mce.view.toViews( e.content );
|
||||
});
|
||||
|
@ -42,13 +44,14 @@
|
|||
var selection = editor.selection;
|
||||
// When a view is selected, ensure content that is being pasted
|
||||
// or inserted is added to a text node (instead of the view).
|
||||
editor.on( 'BeforeSetContent', function( e ) {
|
||||
editor.on( 'BeforeSetContent', function() {
|
||||
var walker, target,
|
||||
view = wpView.getParentView( selection.getNode() );
|
||||
|
||||
// If the selection is not within a view, bail.
|
||||
if ( ! view )
|
||||
if ( ! view ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If there are no additional nodes or the next node is a
|
||||
// view, create a text node after the current view.
|
||||
|
@ -72,13 +75,15 @@
|
|||
//
|
||||
// Runs on paste and on inserting nodes/html.
|
||||
editor.on( 'SetContent', function( e ) {
|
||||
if ( ! e.context )
|
||||
if ( ! e.context ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var node = selection.getNode();
|
||||
|
||||
if ( ! node.innerHTML )
|
||||
if ( ! node.innerHTML ) {
|
||||
return;
|
||||
}
|
||||
|
||||
node.innerHTML = wp.mce.view.toViews( node.innerHTML );
|
||||
wp.mce.view.render( node );
|
||||
|
@ -88,8 +93,9 @@
|
|||
// When the editor's contents are being accessed as a string,
|
||||
// transform any views back to their text representations.
|
||||
editor.on( 'PostProcess', function( e ) {
|
||||
if ( ( ! e.get && ! e.save ) || ! e.content )
|
||||
if ( ( ! e.get && ! e.save ) || ! e.content ) {
|
||||
return;
|
||||
}
|
||||
|
||||
e.content = wp.mce.view.toText( e.content );
|
||||
});
|
||||
|
@ -97,7 +103,7 @@
|
|||
// Triggers when the selection is changed.
|
||||
// Add the event handler to the top of the stack.
|
||||
editor.on( 'NodeChange', function( e ) {
|
||||
var view = wpView.getParentView( node );
|
||||
var view = wpView.getParentView( e.element );
|
||||
|
||||
// Update the selected view.
|
||||
if ( view ) {
|
||||
|
@ -117,12 +123,13 @@
|
|||
view, instance;
|
||||
|
||||
// If a view isn't selected, let the event go on its merry way.
|
||||
if ( ! selected )
|
||||
if ( ! selected ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If the caret is not within the selected view, deselect the
|
||||
// view and bail.
|
||||
view = wpView.getParentView( selection.getNode() );
|
||||
view = wpView.getParentView( editor.selection.getNode() );
|
||||
if ( view !== selected ) {
|
||||
wpView.deselect();
|
||||
return;
|
||||
|
@ -138,8 +145,9 @@
|
|||
|
||||
// Let keypresses that involve the command or control keys through.
|
||||
// Also, let any of the F# keys through.
|
||||
if ( event.metaKey || event.ctrlKey || ( keyCode >= 112 && keyCode <= 123 ) )
|
||||
if ( event.metaKey || event.ctrlKey || ( keyCode >= 112 && keyCode <= 123 ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
event.preventDefault();
|
||||
});
|
||||
|
@ -147,8 +155,9 @@
|
|||
|
||||
getParentView : function( node ) {
|
||||
while ( node ) {
|
||||
if ( this.isView( node ) )
|
||||
if ( this.isView( node ) ) {
|
||||
return node;
|
||||
}
|
||||
|
||||
node = node.parentNode;
|
||||
}
|
||||
|
@ -159,8 +168,9 @@
|
|||
},
|
||||
|
||||
select : function( view ) {
|
||||
if ( view === selected )
|
||||
if ( view === selected ) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.deselect();
|
||||
selected = view;
|
||||
|
@ -168,8 +178,10 @@
|
|||
},
|
||||
|
||||
deselect : function() {
|
||||
if ( selected )
|
||||
if ( selected ) {
|
||||
wp.mce.view.deselect( selected );
|
||||
}
|
||||
|
||||
selected = null;
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1 +1 @@
|
|||
!function(){var a,b=tinymce.VK,c=tinymce.dom.TreeWalker;tinymce.create("tinymce.plugins.wpView",{init:function(d){var e=this;"undefined"!=typeof wp&&wp.mce&&(d.on("PreInit",function(){d.schema.addValidElements("div[*],span[*]")}),d.on("BeforeSetContent",function(a){a.content&&(a.content=wp.mce.view.toViews(a.content))}),d.on("SetContent",function(){wp.mce.view.render(d.getDoc())}),d.on("init",function(){var a=d.selection;d.on("BeforeSetContent",function(){var b,f,g=e.getParentView(a.getNode());g&&(!g.nextSibling||e.isView(g.nextSibling)?(f=d.getDoc().createTextNode(""),d.dom.insertAfter(f,g)):(b=new c(g.nextSibling,g.nextSibling),f=b.next()),a.select(f),a.collapse(!0))}),d.on("SetContent",function(b){if(b.context){var c=a.getNode();c.innerHTML&&(c.innerHTML=wp.mce.view.toViews(c.innerHTML),wp.mce.view.render(c))}})}),d.on("PostProcess",function(a){(a.get||a.save)&&a.content&&(a.content=wp.mce.view.toText(a.content))}),d.on("NodeChange",function(){var a=e.getParentView(node);return a?(e.select(a),!1):(e.deselect(),void 0)}),d.on("keydown",function(c){var d,f,g=c.keyCode;if(a){if(d=e.getParentView(selection.getNode()),d!==a)return e.deselect(),void 0;(g===b.DELETE||g===b.BACKSPACE)&&(f=wp.mce.view.instance(a))&&(f.remove(),e.deselect()),c.metaKey||c.ctrlKey||g>=112&&123>=g||c.preventDefault()}}))},getParentView:function(a){for(;a;){if(this.isView(a))return a;a=a.parentNode}},isView:function(a){return/(?:^|\s)wp-view-wrap(?:\s|$)/.test(a.className)},select:function(b){b!==a&&(this.deselect(),a=b,wp.mce.view.select(a))},deselect:function(){a&&wp.mce.view.deselect(a),a=null}}),tinymce.PluginManager.add("wpview",tinymce.plugins.wpView)}();
|
||||
!function(){var a,b=tinymce.VK,c=tinymce.dom.TreeWalker;tinymce.create("tinymce.plugins.wpView",{init:function(d){var e=this;"undefined"!=typeof wp&&wp.mce&&(d.on("PreInit",function(){d.schema.addValidElements("div[*],span[*]")}),d.on("BeforeSetContent",function(a){a.content&&(a.content=wp.mce.view.toViews(a.content))}),d.on("SetContent",function(){wp.mce.view.render(d.getDoc())}),d.on("init",function(){var a=d.selection;d.on("BeforeSetContent",function(){var b,f,g=e.getParentView(a.getNode());g&&(!g.nextSibling||e.isView(g.nextSibling)?(f=d.getDoc().createTextNode(""),d.dom.insertAfter(f,g)):(b=new c(g.nextSibling,g.nextSibling),f=b.next()),a.select(f),a.collapse(!0))}),d.on("SetContent",function(b){if(b.context){var c=a.getNode();c.innerHTML&&(c.innerHTML=wp.mce.view.toViews(c.innerHTML),wp.mce.view.render(c))}})}),d.on("PostProcess",function(a){(a.get||a.save)&&a.content&&(a.content=wp.mce.view.toText(a.content))}),d.on("NodeChange",function(a){var b=e.getParentView(a.element);return b?(e.select(b),!1):(e.deselect(),void 0)}),d.on("keydown",function(c){var f,g,h=c.keyCode;if(a){if(f=e.getParentView(d.selection.getNode()),f!==a)return e.deselect(),void 0;(h===b.DELETE||h===b.BACKSPACE)&&(g=wp.mce.view.instance(a))&&(g.remove(),e.deselect()),c.metaKey||c.ctrlKey||h>=112&&123>=h||c.preventDefault()}}))},getParentView:function(a){for(;a;){if(this.isView(a))return a;a=a.parentNode}},isView:function(a){return/(?:^|\s)wp-view-wrap(?:\s|$)/.test(a.className)},select:function(b){b!==a&&(this.deselect(),a=b,wp.mce.view.select(a))},deselect:function(){a&&wp.mce.view.deselect(a),a=null}}),tinymce.PluginManager.add("wpview",tinymce.plugins.wpView)}();
|
|
@ -50,8 +50,12 @@ dl.aligncenter {
|
|||
border: 0 none;
|
||||
}
|
||||
|
||||
.wp-caption img,
|
||||
.wp-caption a {
|
||||
div.mceTemp {
|
||||
-ms-user-select: element;
|
||||
}
|
||||
|
||||
dl.wp-caption,
|
||||
dl.wp-caption * {
|
||||
-webkit-user-drag: none;
|
||||
}
|
||||
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue