TinyMCE textpattern:
- Add description of the new patterns to the Shortcuts help modal. - Fix the layout a bit and make the patterns in two columns. - Disable the `textpatterns` plugin in IE < 9. See #33300. Built from https://develop.svn.wordpress.org/trunk@36761 git-svn-id: http://core.svn.wordpress.org/trunk@36728 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
f976c0a6c8
commit
d0b708fcb9
|
@ -1066,6 +1066,8 @@ final class _WP_Editors {
|
|||
__( 'When starting a new paragraph with one of these formatting shortcuts followed by a space, the formatting will be applied automatically. Press Backspace or Escape to undo.' ),
|
||||
'The following formatting shortcuts are replaced when pressing Enter. Press Escape or the Undo button to undo.' =>
|
||||
__( 'The following formatting shortcuts are replaced when pressing Enter. Press Escape or the Undo button to undo.' ),
|
||||
'The next group of formatting shortcuts are applied as you type or when you insert them around plain text in the same paragraph. Press Escape or the Undo button to undo.' =>
|
||||
__( 'The next group of formatting shortcuts are applied as you type or when you insert them around plain text in the same paragraph. Press Escape or the Undo button to undo.' ),
|
||||
);
|
||||
|
||||
/**
|
||||
|
|
|
@ -136,6 +136,28 @@
|
|||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.mce-window .wp-editor-help table.wp-help-single {
|
||||
margin: 0 8px 20px;
|
||||
}
|
||||
|
||||
.mce-window .wp-editor-help table.fixed {
|
||||
table-layout: fixed;
|
||||
}
|
||||
|
||||
.mce-window .wp-editor-help table.fixed th:nth-child(odd),
|
||||
.mce-window .wp-editor-help table.fixed td:nth-child(odd) {
|
||||
width: 12%;
|
||||
}
|
||||
|
||||
.mce-window .wp-editor-help table.fixed th:nth-child(even),
|
||||
.mce-window .wp-editor-help table.fixed td:nth-child(even) {
|
||||
width: 38%;
|
||||
}
|
||||
|
||||
.mce-window .wp-editor-help table.fixed th:nth-child(odd) {
|
||||
padding: 5px 0 0;
|
||||
}
|
||||
|
||||
.mce-window .wp-editor-help td,
|
||||
.mce-window .wp-editor-help th {
|
||||
font-size: 13px;
|
||||
|
@ -159,11 +181,6 @@
|
|||
background: rgba(0,0,0,0.08);
|
||||
}
|
||||
|
||||
.mce-window .wp-help-header td {
|
||||
font-weight: bold;
|
||||
padding: 0 5px;
|
||||
}
|
||||
|
||||
.mce-window .wp-help-th-center td:nth-child(odd),
|
||||
.mce-window .wp-help-th-center th:nth-child(odd) {
|
||||
text-align: center;
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -136,6 +136,28 @@
|
|||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.mce-window .wp-editor-help table.wp-help-single {
|
||||
margin: 0 8px 20px;
|
||||
}
|
||||
|
||||
.mce-window .wp-editor-help table.fixed {
|
||||
table-layout: fixed;
|
||||
}
|
||||
|
||||
.mce-window .wp-editor-help table.fixed th:nth-child(odd),
|
||||
.mce-window .wp-editor-help table.fixed td:nth-child(odd) {
|
||||
width: 12%;
|
||||
}
|
||||
|
||||
.mce-window .wp-editor-help table.fixed th:nth-child(even),
|
||||
.mce-window .wp-editor-help table.fixed td:nth-child(even) {
|
||||
width: 38%;
|
||||
}
|
||||
|
||||
.mce-window .wp-editor-help table.fixed th:nth-child(odd) {
|
||||
padding: 5px 0 0;
|
||||
}
|
||||
|
||||
.mce-window .wp-editor-help td,
|
||||
.mce-window .wp-editor-help th {
|
||||
font-size: 13px;
|
||||
|
@ -159,11 +181,6 @@
|
|||
background: rgba(0,0,0,0.08);
|
||||
}
|
||||
|
||||
.mce-window .wp-help-header td {
|
||||
font-weight: bold;
|
||||
padding: 0 5px;
|
||||
}
|
||||
|
||||
.mce-window .wp-help-th-center td:nth-child(odd),
|
||||
.mce-window .wp-help-th-center th:nth-child(odd) {
|
||||
text-align: center;
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -262,43 +262,51 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) {
|
|||
// Main section, default and additional shortcuts
|
||||
html = html +
|
||||
'<h2>' + __( 'Default shortcuts,' ) + ' ' + meta + '</h2>' +
|
||||
'<table class="wp-help-th-center">' +
|
||||
'<table class="wp-help-th-center fixed">' +
|
||||
header +
|
||||
table1.join('') +
|
||||
'</table>' +
|
||||
'<h2>' + __( 'Additional shortcuts,' ) + ' ' + access + '</h2>' +
|
||||
'<table class="wp-help-th-center">' +
|
||||
'<table class="wp-help-th-center fixed">' +
|
||||
header +
|
||||
table2.join('') +
|
||||
'</table>';
|
||||
|
||||
if ( editor.plugins.wptextpattern ) {
|
||||
if ( editor.plugins.wptextpattern && ( ! tinymce.Env.ie || tinymce.Env.ie > 8 ) ) {
|
||||
// Text pattern section
|
||||
html = html +
|
||||
'<h2>' + __( 'When starting a new paragraph with one of these formatting shortcuts followed by a space, the formatting will be applied automatically. Press Backspace or Escape to undo.' ) + '</h2>' +
|
||||
'<table>' +
|
||||
tr({ '*': 'Bullet list' }) +
|
||||
tr({ '-': 'Bullet list' }) +
|
||||
tr({ '1.': 'Numbered list' }) +
|
||||
tr({ '1)': 'Numbered list' }) +
|
||||
'<table class="wp-help-th-center fixed">' +
|
||||
tr({ '*': 'Bullet list', '1.': 'Numbered list' }) +
|
||||
tr({ '-': 'Bullet list', '1)': 'Numbered list' }) +
|
||||
'</table>';
|
||||
|
||||
html = html +
|
||||
'<h2>' + __( 'The following formatting shortcuts are replaced when pressing Enter. Press Escape or the Undo button to undo.' ) + '</h2>' +
|
||||
'<table>' +
|
||||
'<table class="wp-help-single">' +
|
||||
tr({ '>': 'Blockquote' }) +
|
||||
tr({ '##': 'Heading 2' }) +
|
||||
tr({ '###': 'Heading 3' }) +
|
||||
tr({ '####': 'Heading 4' }) +
|
||||
tr({ '#####': 'Heading 5' }) +
|
||||
tr({ '######': 'Heading 6' }) +
|
||||
tr({ '---': 'Horizontal rule' }) +
|
||||
tr({ '***': 'Horizontal rule' }) +
|
||||
'</table>';
|
||||
|
||||
html = html +
|
||||
'<h2>' + __( 'The next group of formatting shortcuts are applied as you type or when you insert them around plain text in the same paragraph. Press Escape or the Undo button to undo.' ) + '</h2>' +
|
||||
'<table class="wp-help-th-center fixed">' +
|
||||
tr({ '*': 'Italic', '**': 'Bold' }) +
|
||||
tr({ '_': 'Italic', '__': 'Bold' }) +
|
||||
tr({ '`': 'Code', empty: '' }) +
|
||||
'</table>';
|
||||
}
|
||||
|
||||
// Focus management section
|
||||
html = html +
|
||||
'<h2>' + __( 'Focus shortcuts:' ) + '</h2>' +
|
||||
'<table>' +
|
||||
'<table class="wp-help-single">' +
|
||||
tr({ 'Alt + F8': 'Inline toolbar (when an image, link or preview is selected)' }) +
|
||||
tr({ 'Alt + F9': 'Editor menu (when enabled)' }) +
|
||||
tr({ 'Alt + F10': 'Editor toolbar' }) +
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -11,6 +11,10 @@
|
|||
* using the undo shortcut, or the undo button in the toolbar.
|
||||
*/
|
||||
( function( tinymce, setTimeout ) {
|
||||
if ( tinymce.Env.ie && tinymce.Env.ie < 9 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
tinymce.PluginManager.add( 'wptextpattern', function( editor ) {
|
||||
var VK = tinymce.util.VK;
|
||||
|
||||
|
@ -82,7 +86,7 @@
|
|||
var format;
|
||||
var zero;
|
||||
|
||||
if ( node.nodeType !== 3 || ! node.data.length || ! offset ) {
|
||||
if ( ! node || node.nodeType !== 3 || ! node.data.length || ! offset ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
!function(a,b){a.PluginManager.add("wptextpattern",function(c){function d(){function d(a){for(var b,c=m.length;c--;)if(g=m[c],b=a.data.indexOf(g.end),-1!==b)return b}var e,f,g,h,j,k=c.selection.getRng(),l=k.startContainer,o=k.startOffset;3===l.nodeType&&l.data.length&&o&&-1!==a.inArray(n,l.data.charAt(o-1))&&(e=d(l),f=l.data.lastIndexOf(g.end),e!==f&&-1!==f&&(f-e<=g.start.length||-1===l.data.slice(e+g.start.length,f).indexOf(g.start.slice(0,1))&&(h=c.formatter.get(g.format),h&&h[0].inline&&(c.undoManager.add(),c.undoManager.transact(function(){l.insertData(o,"\u200b"),l=l.splitText(e),j=l.splitText(o-e),l.deleteData(0,g.start.length),l.deleteData(l.data.length-g.end.length,g.end.length),c.formatter.apply(g.format,{},l),c.selection.setCursorLocation(j,1)}),b(function(){i="space",c.once("selectionchange",function(){var a;j&&(a=j.data.indexOf("\u200b"),-1!==a&&j.deleteData(a,a+1))})})))))}function e(a){var b,d=c.dom.getParent(a,"p");if(d){for(;(b=d.firstChild)&&3!==b.nodeType;)d=b;if(b)return b.data||(b=b.nextSibling&&3===b.nextSibling.nodeType?b.nextSibling:null),b}}function f(){var d,f,g=c.selection.getRng(),h=g.startContainer;h&&e(h)===h&&(d=h.parentNode,f=h.data,a.each(k,function(a){var e=f.match(a.regExp);if(e&&g.startOffset===e[0].length)return c.undoManager.add(),c.undoManager.transact(function(){h.deleteData(0,e[0].length),d.innerHTML||d.appendChild(document.createElement("br")),c.selection.setCursorLocation(d),c.execCommand(a.cmd)}),b(function(){i="space"}),!1}))}function g(){var d,f,g,j=c.selection.getRng(),k=j.startContainer,m=e(k),n=l.length;if(m){for(d=m.data;n--;)if(l[n].start){if(0===d.indexOf(l[n].start)){f=l[n];break}}else if(l[n].regExp&&l[n].regExp.test(d)){f=l[n];break}f&&(m!==k||a.trim(d)!==f.start)&&c.once("keyup",function(){c.undoManager.add(),c.undoManager.transact(function(){f.format?(c.formatter.apply(f.format,{},m),m.replaceData(0,m.data.length,h(m.data.slice(f.start.length)))):f.element&&(g=m.parentNode&&m.parentNode.parentNode,g&&g.replaceChild(document.createElement(f.element),m.parentNode))}),b(function(){i="enter"})})}}function h(a){return a?a.replace(/^\s+/,""):""}var i,j=a.util.VK,k=[{regExp:/^[*-]\s/,cmd:"InsertUnorderedList"},{regExp:/^1[.)]\s/,cmd:"InsertOrderedList"}],l=[{start:"##",format:"h2"},{start:"###",format:"h3"},{start:"####",format:"h4"},{start:"#####",format:"h5"},{start:"######",format:"h6"},{start:">",format:"blockquote"},{regExp:/^\s*(?:(?:\* ?){3,}|(?:_ ?){3,}|(?:- ?){3,})\s*$/,element:"hr"}],m=[{start:"*",end:"*",format:"italic"},{start:"**",end:"**",format:"bold"},{start:"_",end:"_",format:"italic"},{start:"__",end:"__",format:"bold"},{start:"`",end:"`",format:"code"}],n=[];a.each(m,function(b){a.each((b.start+b.end).split(""),function(b){-1===a.inArray(n,b)&&n.push(b)})}),c.on("selectionchange",function(){i=null}),c.on("keydown",function(a){(i&&27===a.keyCode||"space"===i&&a.keyCode===j.BACKSPACE)&&(c.undoManager.undo(),a.preventDefault(),a.stopImmediatePropagation()),a.keyCode!==j.ENTER||j.modifierPressed(a)||g()},!0),c.on("keyup",function(a){a.keyCode!==j.SPACEBAR||a.ctrlKey||a.metaKey||a.altKey?a.keyCode>47&&!(a.keyCode>=91&&a.keyCode<=93)&&d():f()})})}(window.tinymce,window.setTimeout);
|
||||
!function(a,b){a.Env.ie&&a.Env.ie<9||a.PluginManager.add("wptextpattern",function(c){function d(){function d(a){for(var b,c=m.length;c--;)if(g=m[c],b=a.data.indexOf(g.end),-1!==b)return b}var e,f,g,h,j,k=c.selection.getRng(),l=k.startContainer,o=k.startOffset;l&&3===l.nodeType&&l.data.length&&o&&-1!==a.inArray(n,l.data.charAt(o-1))&&(e=d(l),f=l.data.lastIndexOf(g.end),e!==f&&-1!==f&&(f-e<=g.start.length||-1===l.data.slice(e+g.start.length,f).indexOf(g.start.slice(0,1))&&(h=c.formatter.get(g.format),h&&h[0].inline&&(c.undoManager.add(),c.undoManager.transact(function(){l.insertData(o,"\u200b"),l=l.splitText(e),j=l.splitText(o-e),l.deleteData(0,g.start.length),l.deleteData(l.data.length-g.end.length,g.end.length),c.formatter.apply(g.format,{},l),c.selection.setCursorLocation(j,1)}),b(function(){i="space",c.once("selectionchange",function(){var a;j&&(a=j.data.indexOf("\u200b"),-1!==a&&j.deleteData(a,a+1))})})))))}function e(a){var b,d=c.dom.getParent(a,"p");if(d){for(;(b=d.firstChild)&&3!==b.nodeType;)d=b;if(b)return b.data||(b=b.nextSibling&&3===b.nextSibling.nodeType?b.nextSibling:null),b}}function f(){var d,f,g=c.selection.getRng(),h=g.startContainer;h&&e(h)===h&&(d=h.parentNode,f=h.data,a.each(k,function(a){var e=f.match(a.regExp);if(e&&g.startOffset===e[0].length)return c.undoManager.add(),c.undoManager.transact(function(){h.deleteData(0,e[0].length),d.innerHTML||d.appendChild(document.createElement("br")),c.selection.setCursorLocation(d),c.execCommand(a.cmd)}),b(function(){i="space"}),!1}))}function g(){var d,f,g,j=c.selection.getRng(),k=j.startContainer,m=e(k),n=l.length;if(m){for(d=m.data;n--;)if(l[n].start){if(0===d.indexOf(l[n].start)){f=l[n];break}}else if(l[n].regExp&&l[n].regExp.test(d)){f=l[n];break}f&&(m!==k||a.trim(d)!==f.start)&&c.once("keyup",function(){c.undoManager.add(),c.undoManager.transact(function(){f.format?(c.formatter.apply(f.format,{},m),m.replaceData(0,m.data.length,h(m.data.slice(f.start.length)))):f.element&&(g=m.parentNode&&m.parentNode.parentNode,g&&g.replaceChild(document.createElement(f.element),m.parentNode))}),b(function(){i="enter"})})}}function h(a){return a?a.replace(/^\s+/,""):""}var i,j=a.util.VK,k=[{regExp:/^[*-]\s/,cmd:"InsertUnorderedList"},{regExp:/^1[.)]\s/,cmd:"InsertOrderedList"}],l=[{start:"##",format:"h2"},{start:"###",format:"h3"},{start:"####",format:"h4"},{start:"#####",format:"h5"},{start:"######",format:"h6"},{start:">",format:"blockquote"},{regExp:/^\s*(?:(?:\* ?){3,}|(?:_ ?){3,}|(?:- ?){3,})\s*$/,element:"hr"}],m=[{start:"*",end:"*",format:"italic"},{start:"**",end:"**",format:"bold"},{start:"_",end:"_",format:"italic"},{start:"__",end:"__",format:"bold"},{start:"`",end:"`",format:"code"}],n=[];a.each(m,function(b){a.each((b.start+b.end).split(""),function(b){-1===a.inArray(n,b)&&n.push(b)})}),c.on("selectionchange",function(){i=null}),c.on("keydown",function(a){(i&&27===a.keyCode||"space"===i&&a.keyCode===j.BACKSPACE)&&(c.undoManager.undo(),a.preventDefault(),a.stopImmediatePropagation()),a.keyCode!==j.ENTER||j.modifierPressed(a)||g()},!0),c.on("keyup",function(a){a.keyCode!==j.SPACEBAR||a.ctrlKey||a.metaKey||a.altKey?a.keyCode>47&&!(a.keyCode>=91&&a.keyCode<=93)&&d():f()})})}(window.tinymce,window.setTimeout);
|
Binary file not shown.
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.5-beta1-36760';
|
||||
$wp_version = '4.5-beta1-36761';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue