From a2a82e6683cb11fb403673a1b0151a729d3d8c0c Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Fri, 26 Feb 2016 01:56:25 +0000 Subject: [PATCH] TinyMCE textpattern: fix error when inserting `
` if the new paragraph is not direct child of the body. See #33300. Built from https://develop.svn.wordpress.org/trunk@36720 git-svn-id: http://core.svn.wordpress.org/trunk@36687 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- .../tinymce/plugins/wptextpattern/plugin.js | 8 ++++++-- .../plugins/wptextpattern/plugin.min.js | 2 +- wp-includes/js/tinymce/wp-tinymce.js.gz | Bin 165705 -> 165717 bytes wp-includes/version.php | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/wp-includes/js/tinymce/plugins/wptextpattern/plugin.js b/wp-includes/js/tinymce/plugins/wptextpattern/plugin.js index 375dd849e2..4123fdf1e9 100644 --- a/wp-includes/js/tinymce/plugins/wptextpattern/plugin.js +++ b/wp-includes/js/tinymce/plugins/wptextpattern/plugin.js @@ -235,7 +235,7 @@ start = rng.startContainer, node = firstTextNode( start ), i = enterPatterns.length, - text, pattern; + text, pattern, parent; if ( ! node ) { return; @@ -273,7 +273,11 @@ editor.formatter.apply( pattern.format, {}, node ); node.replaceData( 0, node.data.length, ltrim( node.data.slice( pattern.start.length ) ) ); } else if ( pattern.element ) { - editor.getBody().replaceChild( document.createElement( pattern.element ), node.parentNode ); + parent = node.parentNode && node.parentNode.parentNode; + + if ( parent ) { + parent.replaceChild( document.createElement( pattern.element ), node.parentNode ); + } } } ); diff --git a/wp-includes/js/tinymce/plugins/wptextpattern/plugin.min.js b/wp-includes/js/tinymce/plugins/wptextpattern/plugin.min.js index 3568256c40..91fa54901b 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(){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=c.selection.getRng(),j=g.startContainer,k=e(j),m=l.length;if(k){for(d=k.data;m--;)if(l[m].start){if(0===d.indexOf(l[m].start)){f=l[m];break}}else if(l[m].regExp&&l[m].regExp.test(d)){f=l[m];break}f&&(k!==j||a.trim(d)!==f.start)&&c.once("keyup",function(){c.undoManager.add(),c.undoManager.transact(function(){f.format?(c.formatter.apply(f.format,{},k),k.replaceData(0,k.data.length,h(k.data.slice(f.start.length)))):f.element&&c.getBody().replaceChild(document.createElement(f.element),k.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); \ No newline at end of file +!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); \ 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 c715c65822d33cda12b8b038aa56e01a994e087b..966bc574a5611343ae39bb3b96141af687f5e1d5 100644 GIT binary patch delta 2974 zcmV;P3t{xhjtbR|3V?(Gv;y3Ff7CgI6yoTf+wQ0+I450-?nU-XA-NGyhX-B?;v9RY zGZn&od^x@53`i9?q(de-8H|VUdKWJ{w3KeQGQ5bAa4&*L))&&^Q+N-BDH2BBqDQkZ z521_|UqLSwp1wsVT-5)+rsw-YvLO0gQR?&!sWU+YNny$oqhw;rvvBB7e@s!|w&p1ZVt@cZTS#`V?mfE6jW+kKo8hijI;!(HGu)QMY{&7he27c(sq z5nSF=JGQ+iPoTHOf$s1Ke=|}K%qK7GC+4G%hu<0xPxO5<2Yg!3V6SLa ziy2ek-_`S4FSvgZZZ~joWBhK2-w0as^dOXc-msU#I!|<+pL-$58v0*;G+)6!JuwRO zTqQD6#jwRP(%gt7H#_pVQHgFU^ZBnx@?V_-?XOtsY4`HFBSiYde>(OTH_=Xvx$MWJ zLP@-QFR&6f*fC$LXfe$BDMN9`rYHBVJq$O4GH=VaQqOO*!+5CJ$E_SQz{bDwc1}y!_iXc8v#}81bD{P0Gus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iB+H0?mrTsgtsjKK;+JWeU^&_HPgmuB(X$jdm)Q z{SjP&eD*8@Af}-v1YAp)>H<_RbnJf+#wg~?C13JF-_62%@f@jm+v?&KqW1nDuL#a4 I1g4z_0GjB#-~a#s diff --git a/wp-includes/version.php b/wp-includes/version.php index 68371110f3..7d82e231b6 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.5-beta1-36719'; +$wp_version = '4.5-beta1-36720'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.