- Remove `***` and `___` text pattern and support for spaces in `---`. The only `<hr>` text pattern is 3 or more dashes, no spaces.
- Remove the `*`, `**`, `_`, and `__` text patterns for bold and italic.

Fixes #33300;
Built from https://develop.svn.wordpress.org/trunk@37023


git-svn-id: http://core.svn.wordpress.org/trunk@36990 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2016-03-16 23:00:28 +00:00
parent 5330f669f2
commit cb0565b33a
6 changed files with 4 additions and 17 deletions

View File

@ -291,15 +291,6 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) {
tr({ '#####': 'Heading 5' }) +
tr({ '######': 'Heading 6' }) +
tr({ '---': 'Horizontal line' }) +
tr({ '***': 'Horizontal line' }) +
'</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>';
}

File diff suppressed because one or more lines are too long

View File

@ -30,14 +30,10 @@
{ start: '#####', format: 'h5' },
{ start: '######', format: 'h6' },
{ start: '>', format: 'blockquote' },
{ regExp: /^\s*(?:(?:\* ?){3,}|(?:_ ?){3,}|(?:- ?){3,})\s*$/, element: 'hr' }
{ regExp: /^(-){3,}$/, element: 'hr' }
];
var inlinePatterns = [
{ start: '*', end: '*', format: 'italic' },
{ start: '**', end: '**', format: 'bold' },
{ start: '_', end: '_', format: 'italic' },
{ start: '__', end: '__', format: 'bold' },
{ start: '`', end: '`', format: 'code' }
];

View File

@ -1 +1 @@
!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);
!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:/^(-){3,}$/,element:"hr"}],m=[{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);

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.5-beta3-37022';
$wp_version = '4.5-beta3-37023';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.