From dfcf1d00358bed25aa25768a66d5f001ef62a9d0 Mon Sep 17 00:00:00 2001 From: Konstantin Obenland Date: Mon, 17 Aug 2015 14:51:24 +0000 Subject: [PATCH] Editor: Exclude `shift` from modifier keys when handling spacebar shortcuts. Patterns that activate on enter are still canceled with any modifier active. Props azaozz. Fixes #33382. Built from https://develop.svn.wordpress.org/trunk@33622 git-svn-id: http://core.svn.wordpress.org/trunk@33589 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- .../tinymce/plugins/wptextpattern/plugin.js | 10 ++++------ .../plugins/wptextpattern/plugin.min.js | 2 +- wp-includes/js/tinymce/wp-tinymce.js.gz | Bin 146891 -> 146897 bytes wp-includes/version.php | 2 +- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/wp-includes/js/tinymce/plugins/wptextpattern/plugin.js b/wp-includes/js/tinymce/plugins/wptextpattern/plugin.js index 8343e632b9..6c894237d8 100644 --- a/wp-includes/js/tinymce/plugins/wptextpattern/plugin.js +++ b/wp-includes/js/tinymce/plugins/wptextpattern/plugin.js @@ -44,12 +44,10 @@ }, true ); editor.on( 'keyup', function( event ) { - if ( ! VK.modifierPressed( event ) ) { - if ( event.keyCode === VK.SPACEBAR ) { - space(); - } else if ( event.keyCode === VK.ENTER ) { - enter(); - } + if ( event.keyCode === VK.SPACEBAR && ! event.ctrlKey && ! event.metaKey && ! event.altKey ) { + space(); + } else if ( event.keyCode === VK.ENTER && ! VK.modifierPressed( event ) ) { + enter(); } } ); diff --git a/wp-includes/js/tinymce/plugins/wptextpattern/plugin.min.js b/wp-includes/js/tinymce/plugins/wptextpattern/plugin.min.js index 08f990bedc..d376e54989 100644 --- a/wp-includes/js/tinymce/plugins/wptextpattern/plugin.min.js +++ b/wp-includes/js/tinymce/plugins/wptextpattern/plugin.min.js @@ -1 +1 @@ -!function(a,b){a.PluginManager.add("wptextpattern",function(c){function d(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 e(){var e,f,g=c.selection.getRng(),i=g.startContainer;i&&d(i)===i&&(e=i.parentNode,f=i.data,a.each(l,function(a){var d=f.match(a.regExp);if(d&&g.startOffset===d[0].length)return c.undoManager.add(),c.undoManager.transact(function(){i.deleteData(0,d[0].length),e.innerHTML||e.appendChild(document.createElement("br")),c.selection.setCursorLocation(e),c.execCommand(a.cmd)}),b(function(){h="space"}),!1}))}function f(){var b,e,f=c.selection.getRng(),g=f.startContainer,h=d(g),k=m.length;if(h){for(b=h.data;k--;)if(0===b.indexOf(m[k].start)){e=m[k];break}e&&(h!==g||a.trim(b)!==e.start)&&(i=h,j=e)}}function g(){i&&(c.undoManager.add(),c.undoManager.transact(function(){c.formatter.apply(j.format,{},i),i.replaceData(0,i.data.length,a.trim(i.data.slice(j.start.length)))}),b(function(){h="enter"})),i=null,j=null}var h,i,j,k=a.util.VK,l=[{regExp:/^[*-]\s/,cmd:"InsertUnorderedList"},{regExp:/^1[.)]\s/,cmd:"InsertOrderedList"}],m=[{start:"##",format:"h2"},{start:"###",format:"h3"},{start:"####",format:"h4"},{start:"#####",format:"h5"},{start:"######",format:"h6"},{start:">",format:"blockquote"}];c.on("selectionchange",function(){h=null}),c.on("keydown",function(a){(h&&27===a.keyCode||"space"===h&&a.keyCode===k.BACKSPACE)&&(c.undoManager.undo(),a.preventDefault(),a.stopImmediatePropagation()),a.keyCode!==k.ENTER||k.modifierPressed(a)||f()},!0),c.on("keyup",function(a){k.modifierPressed(a)||(a.keyCode===k.SPACEBAR?e():a.keyCode===k.ENTER&&g())})})}(window.tinymce,window.setTimeout); \ No newline at end of file +!function(a,b){a.PluginManager.add("wptextpattern",function(c){function d(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 e(){var e,f,g=c.selection.getRng(),i=g.startContainer;i&&d(i)===i&&(e=i.parentNode,f=i.data,a.each(l,function(a){var d=f.match(a.regExp);if(d&&g.startOffset===d[0].length)return c.undoManager.add(),c.undoManager.transact(function(){i.deleteData(0,d[0].length),e.innerHTML||e.appendChild(document.createElement("br")),c.selection.setCursorLocation(e),c.execCommand(a.cmd)}),b(function(){h="space"}),!1}))}function f(){var b,e,f=c.selection.getRng(),g=f.startContainer,h=d(g),k=m.length;if(h){for(b=h.data;k--;)if(0===b.indexOf(m[k].start)){e=m[k];break}e&&(h!==g||a.trim(b)!==e.start)&&(i=h,j=e)}}function g(){i&&(c.undoManager.add(),c.undoManager.transact(function(){c.formatter.apply(j.format,{},i),i.replaceData(0,i.data.length,a.trim(i.data.slice(j.start.length)))}),b(function(){h="enter"})),i=null,j=null}var h,i,j,k=a.util.VK,l=[{regExp:/^[*-]\s/,cmd:"InsertUnorderedList"},{regExp:/^1[.)]\s/,cmd:"InsertOrderedList"}],m=[{start:"##",format:"h2"},{start:"###",format:"h3"},{start:"####",format:"h4"},{start:"#####",format:"h5"},{start:"######",format:"h6"},{start:">",format:"blockquote"}];c.on("selectionchange",function(){h=null}),c.on("keydown",function(a){(h&&27===a.keyCode||"space"===h&&a.keyCode===k.BACKSPACE)&&(c.undoManager.undo(),a.preventDefault(),a.stopImmediatePropagation()),a.keyCode!==k.ENTER||k.modifierPressed(a)||f()},!0),c.on("keyup",function(a){a.keyCode!==k.SPACEBAR||a.ctrlKey||a.metaKey||a.altKey?a.keyCode!==k.ENTER||k.modifierPressed(a)||g():e()})})}(window.tinymce,window.setTimeout); \ No newline at end of file diff --git a/wp-includes/js/tinymce/wp-tinymce.js.gz b/wp-includes/js/tinymce/wp-tinymce.js.gz index 894b53af3edff272f8df10f278ae6c6505ae3868..1bb6ed9643ff109c0ec963a394728e03061dc0df 100644 GIT binary patch delta 2414 zcmV-!36b{8`v}qd2!MnEv;u=Pf85Hrr_aydUr%~sTNtU8bs;=75_&S{nYE(F|#BTHI0bah9g-(Xx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