Fixes #38081, #38245, #37507, #37808 and #38000.
Built from https://develop.svn.wordpress.org/trunk@38773


git-svn-id: http://core.svn.wordpress.org/trunk@38716 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2016-10-11 00:10:32 +00:00
parent c69916d57d
commit cb966db094
14 changed files with 386 additions and 185 deletions

View File

@ -1257,14 +1257,6 @@ final class _WP_Editors {
var init, id, $wrap;
if ( typeof tinymce !== 'undefined' ) {
// Fix RTL
tinymce.on( 'addeditor', function( event ) {
event.editor.rtl = event.editor.settings.rtl_ui ||
( event.editor.editorManager &&
event.editor.editorManager.i18n &&
event.editor.editorManager.i18n.rtl );
}, true );
for ( id in tinyMCEPreInit.mceInit ) {
init = tinyMCEPreInit.mceInit[id];
$wrap = tinymce.$( '#wp-' + id + '-wrap' );

View File

@ -135,7 +135,7 @@ tinymce.PluginManager.add('fullscreen', function(editor) {
editor.addButton('fullscreen', {
tooltip: 'Fullscreen',
shortcut: 'Ctrl+Alt+F',
shortcut: 'Ctrl+Shift+F',
onClick: toggleFullscreen,
onPostRender: function() {
var self = this;

View File

@ -1 +1 @@
tinymce.PluginManager.add("fullscreen",function(a){function b(){var a,b,c=window,d=document,e=d.body;return e.offsetWidth&&(a=e.offsetWidth,b=e.offsetHeight),c.innerWidth&&c.innerHeight&&(a=c.innerWidth,b=c.innerHeight),{w:a,h:b}}function c(){var a=tinymce.DOM.getViewPort();return{x:a.x,y:a.y}}function d(a){scrollTo(a.x,a.y)}function e(){function e(){m.setStyle(p,"height",b().h-(o.clientHeight-p.clientHeight))}var n,o,p,q,r=document.body,s=document.documentElement;l=!l,o=a.getContainer(),n=o.style,p=a.getContentAreaContainer().firstChild,q=p.style,l?(k=c(),f=q.width,g=q.height,q.width=q.height="100%",i=n.width,j=n.height,n.width=n.height="",m.addClass(r,"mce-fullscreen"),m.addClass(s,"mce-fullscreen"),m.addClass(o,"mce-fullscreen"),m.bind(window,"resize",e),e(),h=e):(q.width=f,q.height=g,i&&(n.width=i),j&&(n.height=j),m.removeClass(r,"mce-fullscreen"),m.removeClass(s,"mce-fullscreen"),m.removeClass(o,"mce-fullscreen"),m.unbind(window,"resize",h),d(k)),a.fire("FullscreenStateChanged",{state:l})}var f,g,h,i,j,k,l=!1,m=tinymce.DOM;return a.settings.inline?void 0:(a.on("init",function(){a.addShortcut("Ctrl+Shift+F","",e)}),a.on("remove",function(){h&&m.unbind(window,"resize",h)}),a.addCommand("mceFullScreen",e),a.addMenuItem("fullscreen",{text:"Fullscreen",shortcut:"Ctrl+Shift+F",selectable:!0,onClick:function(){e(),a.focus()},onPostRender:function(){var b=this;a.on("FullscreenStateChanged",function(a){b.active(a.state)})},context:"view"}),a.addButton("fullscreen",{tooltip:"Fullscreen",shortcut:"Ctrl+Alt+F",onClick:e,onPostRender:function(){var b=this;a.on("FullscreenStateChanged",function(a){b.active(a.state)})}}),{isFullscreen:function(){return l}})});
tinymce.PluginManager.add("fullscreen",function(a){function b(){var a,b,c=window,d=document,e=d.body;return e.offsetWidth&&(a=e.offsetWidth,b=e.offsetHeight),c.innerWidth&&c.innerHeight&&(a=c.innerWidth,b=c.innerHeight),{w:a,h:b}}function c(){var a=tinymce.DOM.getViewPort();return{x:a.x,y:a.y}}function d(a){scrollTo(a.x,a.y)}function e(){function e(){m.setStyle(p,"height",b().h-(o.clientHeight-p.clientHeight))}var n,o,p,q,r=document.body,s=document.documentElement;l=!l,o=a.getContainer(),n=o.style,p=a.getContentAreaContainer().firstChild,q=p.style,l?(k=c(),f=q.width,g=q.height,q.width=q.height="100%",i=n.width,j=n.height,n.width=n.height="",m.addClass(r,"mce-fullscreen"),m.addClass(s,"mce-fullscreen"),m.addClass(o,"mce-fullscreen"),m.bind(window,"resize",e),e(),h=e):(q.width=f,q.height=g,i&&(n.width=i),j&&(n.height=j),m.removeClass(r,"mce-fullscreen"),m.removeClass(s,"mce-fullscreen"),m.removeClass(o,"mce-fullscreen"),m.unbind(window,"resize",h),d(k)),a.fire("FullscreenStateChanged",{state:l})}var f,g,h,i,j,k,l=!1,m=tinymce.DOM;return a.settings.inline?void 0:(a.on("init",function(){a.addShortcut("Ctrl+Shift+F","",e)}),a.on("remove",function(){h&&m.unbind(window,"resize",h)}),a.addCommand("mceFullScreen",e),a.addMenuItem("fullscreen",{text:"Fullscreen",shortcut:"Ctrl+Shift+F",selectable:!0,onClick:function(){e(),a.focus()},onPostRender:function(){var b=this;a.on("FullscreenStateChanged",function(a){b.active(a.state)})},context:"view"}),a.addButton("fullscreen",{tooltip:"Fullscreen",shortcut:"Ctrl+Shift+F",onClick:e,onPostRender:function(){var b=this;a.on("FullscreenStateChanged",function(a){b.active(a.state)})}}),{isFullscreen:function(){return l}})});

View File

@ -26,6 +26,10 @@ tinymce.PluginManager.add('lists', function(editor) {
return node && (/^(OL|UL|DL)$/).test(node.nodeName) && isChildOfBody(node);
}
function isListItemNode(node) {
return node && /^(LI|DT|DD)$/.test(node.nodeName);
}
function isFirstChild(node) {
return node.parentNode.firstChild == node;
}
@ -42,6 +46,33 @@ tinymce.PluginManager.add('lists', function(editor) {
return elm === editor.getBody();
}
function isTextNode(node) {
return node && node.nodeType === 3;
}
function getNormalizedEndPoint(container, offset) {
var node = tinymce.dom.RangeUtils.getNode(container, offset);
if (isListItemNode(container) && isTextNode(node)) {
var textNodeOffset = offset >= container.childNodes.length ? node.data.length : 0;
return {container: node, offset: textNodeOffset};
}
return {container: container, offset: offset};
}
function normalizeRange(rng) {
var outRng = rng.cloneRange();
var rangeStart = getNormalizedEndPoint(rng.startContainer, rng.startOffset);
outRng.setStart(rangeStart.container, rangeStart.offset);
var rangeEnd = getNormalizedEndPoint(rng.endContainer, rng.endOffset);
outRng.setEnd(rangeEnd.container, rangeEnd.offset);
return outRng;
}
editor.on('init', function() {
var dom = editor.dom, selection = editor.selection;
@ -163,7 +194,7 @@ tinymce.PluginManager.add('lists', function(editor) {
rng.setEnd(bookmark.endContainer, bookmark.endOffset);
}
selection.setRng(rng);
selection.setRng(normalizeRange(rng));
}
function createNewTextBlock(contentNode, blockName) {
@ -224,7 +255,7 @@ tinymce.PluginManager.add('lists', function(editor) {
function getSelectedListItems() {
return tinymce.grep(selection.getSelectedBlocks(), function(block) {
return /^(LI|DT|DD)$/.test(block.nodeName);
return isListItemNode(block);
});
}
@ -298,33 +329,34 @@ tinymce.PluginManager.add('lists', function(editor) {
}
}
/**
* Normalizes the all lists in the specified element.
*/
function normalizeList(element) {
tinymce.each(tinymce.grep(dom.select('ol,ul', element)), function(ul) {
var sibling, parentNode = ul.parentNode;
function normalizeLists(element) {
tinymce.each(tinymce.grep(dom.select('ol,ul', element)), normalizeList);
}
// Move UL/OL to previous LI if it's the only child of a LI
if (parentNode.nodeName == 'LI' && parentNode.firstChild == ul) {
sibling = parentNode.previousSibling;
if (sibling && sibling.nodeName == 'LI') {
sibling.appendChild(ul);
function normalizeList(ul) {
var sibling, parentNode = ul.parentNode;
if (isEmpty(parentNode)) {
dom.remove(parentNode);
}
// Move UL/OL to previous LI if it's the only child of a LI
if (parentNode.nodeName == 'LI' && parentNode.firstChild == ul) {
sibling = parentNode.previousSibling;
if (sibling && sibling.nodeName == 'LI') {
sibling.appendChild(ul);
if (isEmpty(parentNode)) {
dom.remove(parentNode);
}
} else {
dom.setStyle(parentNode, 'listStyleType', 'none');
}
}
// Append OL/UL to previous LI if it's in a parent OL/UL i.e. old HTML4
if (isListNode(parentNode)) {
sibling = parentNode.previousSibling;
if (sibling && sibling.nodeName == 'LI') {
sibling.appendChild(ul);
}
// Append OL/UL to previous LI if it's in a parent OL/UL i.e. old HTML4
if (isListNode(parentNode)) {
sibling = parentNode.previousSibling;
if (sibling && sibling.nodeName == 'LI') {
sibling.appendChild(ul);
}
});
}
}
function outdent(li) {
@ -394,7 +426,7 @@ tinymce.PluginManager.add('lists', function(editor) {
}
splitList(ul, li, newBlock);
normalizeList(ul.parentNode);
normalizeLists(ul.parentNode);
return true;
}
@ -664,6 +696,7 @@ tinymce.PluginManager.add('lists', function(editor) {
}
splitList(rootList, li);
normalizeLists(rootList.parentNode);
});
moveToBookmark(bookmark);
@ -711,118 +744,135 @@ tinymce.PluginManager.add('lists', function(editor) {
return false;
}
self.backspaceDelete = function(isForward) {
function findNextCaretContainer(rng, isForward) {
var node = rng.startContainer, offset = rng.startOffset;
var nonEmptyBlocks, walker;
function findNextCaretContainer(rng, isForward) {
var node = rng.startContainer, offset = rng.startOffset;
var nonEmptyBlocks, walker;
if (node.nodeType == 3 && (isForward ? offset < node.data.length : offset > 0)) {
if (node.nodeType == 3 && (isForward ? offset < node.data.length : offset > 0)) {
return node;
}
nonEmptyBlocks = editor.schema.getNonEmptyElements();
if (node.nodeType == 1) {
node = tinymce.dom.RangeUtils.getNode(node, offset);
}
walker = new tinymce.dom.TreeWalker(node, editor.getBody());
// Delete at <li>|<br></li> then jump over the bogus br
if (isForward) {
if (isBogusBr(node)) {
walker.next();
}
}
while ((node = walker[isForward ? 'next' : 'prev2']())) {
if (node.nodeName == 'LI' && !node.hasChildNodes()) {
return node;
}
nonEmptyBlocks = editor.schema.getNonEmptyElements();
if (node.nodeType == 1) {
node = tinymce.dom.RangeUtils.getNode(node, offset);
if (nonEmptyBlocks[node.nodeName]) {
return node;
}
walker = new tinymce.dom.TreeWalker(node, editor.getBody());
// Delete at <li>|<br></li> then jump over the bogus br
if (isForward) {
if (isBogusBr(node)) {
walker.next();
}
if (node.nodeType == 3 && node.data.length > 0) {
return node;
}
}
}
while ((node = walker[isForward ? 'next' : 'prev2']())) {
if (node.nodeName == 'LI' && !node.hasChildNodes()) {
return node;
}
function mergeLiElements(fromElm, toElm) {
var node, listNode, ul = fromElm.parentNode;
if (nonEmptyBlocks[node.nodeName]) {
return node;
}
if (!isChildOfBody(fromElm) || !isChildOfBody(toElm)) {
return;
}
if (node.nodeType == 3 && node.data.length > 0) {
return node;
}
if (isListNode(toElm.lastChild)) {
listNode = toElm.lastChild;
}
if (ul == toElm.lastChild) {
if (isBr(ul.previousSibling)) {
dom.remove(ul.previousSibling);
}
}
function mergeLiElements(fromElm, toElm) {
var node, listNode, ul = fromElm.parentNode;
node = toElm.lastChild;
if (node && isBr(node) && fromElm.hasChildNodes()) {
dom.remove(node);
}
if (!isChildOfBody(fromElm) || !isChildOfBody(toElm)) {
return;
}
if (isEmpty(toElm, true)) {
dom.$(toElm).empty();
}
if (isListNode(toElm.lastChild)) {
listNode = toElm.lastChild;
}
if (ul == toElm.lastChild) {
if (isBr(ul.previousSibling)) {
dom.remove(ul.previousSibling);
}
}
node = toElm.lastChild;
if (node && isBr(node) && fromElm.hasChildNodes()) {
dom.remove(node);
}
if (isEmpty(toElm, true)) {
dom.$(toElm).empty();
}
if (!isEmpty(fromElm, true)) {
while ((node = fromElm.firstChild)) {
toElm.appendChild(node);
}
}
if (listNode) {
toElm.appendChild(listNode);
}
dom.remove(fromElm);
if (isEmpty(ul) && !isEditorBody(ul)) {
dom.remove(ul);
if (!isEmpty(fromElm, true)) {
while ((node = fromElm.firstChild)) {
toElm.appendChild(node);
}
}
if (selection.isCollapsed()) {
var li = dom.getParent(selection.getStart(), 'LI'), ul, rng, otherLi;
if (listNode) {
toElm.appendChild(listNode);
}
if (li) {
ul = li.parentNode;
if (isEditorBody(ul) && dom.isEmpty(ul)) {
dom.remove(fromElm);
if (isEmpty(ul) && !isEditorBody(ul)) {
dom.remove(ul);
}
}
function backspaceDeleteCaret(isForward) {
var li = dom.getParent(selection.getStart(), 'LI'), ul, rng, otherLi;
if (li) {
ul = li.parentNode;
if (isEditorBody(ul) && dom.isEmpty(ul)) {
return true;
}
rng = normalizeRange(selection.getRng(true));
otherLi = dom.getParent(findNextCaretContainer(rng, isForward), 'LI');
if (otherLi && otherLi != li) {
var bookmark = createBookmark(rng);
if (isForward) {
mergeLiElements(otherLi, li);
} else {
mergeLiElements(li, otherLi);
}
moveToBookmark(bookmark);
return true;
} else if (!otherLi) {
if (!isForward && removeList(ul.nodeName)) {
return true;
}
rng = selection.getRng(true);
otherLi = dom.getParent(findNextCaretContainer(rng, isForward), 'LI');
if (otherLi && otherLi != li) {
var bookmark = createBookmark(rng);
if (isForward) {
mergeLiElements(otherLi, li);
} else {
mergeLiElements(li, otherLi);
}
moveToBookmark(bookmark);
return true;
} else if (!otherLi) {
if (!isForward && removeList(ul.nodeName)) {
return true;
}
}
}
}
}
function backspaceDeleteRange() {
var startListParent = editor.dom.getParent(editor.selection.getStart(), 'LI,DT,DD');
if (startListParent || getSelectedListItems().length > 0) {
editor.undoManager.transact(function() {
editor.execCommand('Delete');
normalizeLists(editor.getBody());
});
return true;
}
return false;
}
self.backspaceDelete = function(isForward) {
return selection.isCollapsed() ? backspaceDeleteCaret(isForward) : backspaceDeleteRange();
};
editor.on('BeforeExecCommand', function(e) {

File diff suppressed because one or more lines are too long

View File

@ -264,7 +264,7 @@ define("tinymce/pasteplugin/SmartPaste", [
"tinymce/util/Tools"
], function (Tools) {
var isAbsoluteUrl = function (url) {
return /^https?:\/\/[\w\?\-\/+=.&%]+$/i.test(url);
return /^https?:\/\/[\w\?\-\/+=.&%@~#]+$/i.test(url);
};
var isImageUrl = function (url) {
@ -1766,6 +1766,15 @@ define("tinymce/pasteplugin/Plugin", [
editor.focus();
}
// draw back if power version is requested and registered
if (/(^|[ ,])powerpaste([, ]|$)/.test(settings.plugins) && PluginManager.get('powerpaste')) {
/*eslint no-console:0 */
if (typeof console !== "undefined" && console.log) {
console.log("PowerPaste is incompatible with Paste plugin! Remove 'paste' from the 'plugins' option.");
}
return;
}
self.clipboard = clipboard = new Clipboard(editor);
self.quirks = new Quirks(editor);
self.wordFilter = new WordFilter(editor);

File diff suppressed because one or more lines are too long

View File

@ -124,7 +124,7 @@
editor.undoManager.add();
editor.undoManager.transact( function() {
node.insertData( offset, '\u200b' );
node.insertData( offset, '\uFEFF' );
node = node.splitText( startOffset );
zero = node.splitText( offset - startOffset );
@ -145,7 +145,7 @@
var offset;
if ( zero ) {
offset = zero.data.indexOf( '\u200b' );
offset = zero.data.indexOf( '\uFEFF' );
if ( offset !== -1 ) {
zero.deleteData( offset, offset + 1 );

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:/^(-){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(),a.keyCode!==j.SPACEBAR||a.ctrlKey||a.metaKey||a.altKey?a.keyCode>47&&!(a.keyCode>=91&&a.keyCode<=93)&&b(d):b(f)},!0)})}(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,"\ufeff"),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("\ufeff"),-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(),a.keyCode!==j.SPACEBAR||a.ctrlKey||a.metaKey||a.altKey?a.keyCode>47&&!(a.keyCode>=91&&a.keyCode<=93)&&b(d):b(f)},!0)})}(window.tinymce,window.setTimeout);

View File

@ -81,13 +81,56 @@ var defineGlobal = function (id, ref) {
define(id, [], function () { return ref; });
};
/*jsc
["tinymce/inlite/Theme","global!tinymce.ThemeManager","global!tinymce.util.Delay","tinymce/inlite/ui/Panel","tinymce/inlite/ui/Buttons","tinymce/inlite/core/SkinLoader","tinymce/inlite/core/SelectionMatcher","tinymce/inlite/core/ElementMatcher","tinymce/inlite/core/Matcher","tinymce/inlite/alien/Arr","tinymce/inlite/core/PredicateId","global!tinymce.util.Tools","global!tinymce.ui.Factory","global!tinymce.DOM","tinymce/inlite/ui/Toolbar","tinymce/inlite/ui/Forms","tinymce/inlite/core/Measure","tinymce/inlite/core/Layout","tinymce/inlite/file/Conversions","tinymce/inlite/file/Picker","tinymce/inlite/core/Actions","global!tinymce.EditorManager","global!tinymce.util.Promise","tinymce/inlite/alien/Uuid","tinymce/inlite/alien/Unlink","tinymce/inlite/core/UrlType","global!tinymce.geom.Rect","tinymce/inlite/core/Convert","tinymce/inlite/alien/Bookmark","global!tinymce.dom.TreeWalker","global!tinymce.dom.RangeUtils"]
["tinymce/inlite/Theme","global!tinymce.ThemeManager","global!tinymce.util.Delay","tinymce/inlite/ui/Panel","tinymce/inlite/ui/Buttons","tinymce/inlite/core/SkinLoader","tinymce/inlite/core/SelectionMatcher","tinymce/inlite/core/ElementMatcher","tinymce/inlite/core/Matcher","tinymce/inlite/alien/Arr","tinymce/inlite/alien/EditorSettings","tinymce/inlite/core/PredicateId","global!tinymce.util.Tools","global!tinymce.ui.Factory","global!tinymce.DOM","tinymce/inlite/ui/Toolbar","tinymce/inlite/ui/Forms","tinymce/inlite/core/Measure","tinymce/inlite/core/Layout","tinymce/inlite/alien/Type","tinymce/inlite/file/Conversions","tinymce/inlite/file/Picker","tinymce/inlite/core/Actions","global!tinymce.EditorManager","global!tinymce.util.Promise","tinymce/inlite/alien/Uuid","tinymce/inlite/alien/Unlink","tinymce/inlite/core/UrlType","global!tinymce.geom.Rect","tinymce/inlite/core/Convert","tinymce/inlite/alien/Bookmark","global!tinymce.dom.TreeWalker","global!tinymce.dom.RangeUtils"]
jsc*/
defineGlobal("global!tinymce.ThemeManager", tinymce.ThemeManager);
defineGlobal("global!tinymce.util.Delay", tinymce.util.Delay);
defineGlobal("global!tinymce.util.Tools", tinymce.util.Tools);
defineGlobal("global!tinymce.ui.Factory", tinymce.ui.Factory);
defineGlobal("global!tinymce.DOM", tinymce.DOM);
/**
* Type.js
*
* Released under LGPL License.
* Copyright (c) 1999-2016 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
define('tinymce/inlite/alien/Type', [
], function () {
var isType = function (type) {
return function (value) {
return typeof value === type;
};
};
var isArray = function (value) {
return Array.isArray(value);
};
var isNull = function (value) {
return value === null;
};
var isObject = function (predicate) {
return function (value) {
return !isNull(value) && !isArray(value) && predicate(value);
};
};
return {
isString: isType("string"),
isNumber: isType("number"),
isBoolean: isType("boolean"),
isFunction: isType("function"),
isObject: isObject(isType("object")),
isNull: isNull,
isArray: isArray
};
});
/**
* Toolbar.js
*
@ -100,8 +143,9 @@ defineGlobal("global!tinymce.DOM", tinymce.DOM);
define('tinymce/inlite/ui/Toolbar', [
'global!tinymce.util.Tools',
'global!tinymce.ui.Factory'
], function (Tools, Factory) {
'global!tinymce.ui.Factory',
'tinymce/inlite/alien/Type'
], function (Tools, Factory, Type) {
var setActiveItem = function (item, name) {
return function(state, args) {
var nodeName, i = args.parents.length;
@ -161,6 +205,16 @@ define('tinymce/inlite/ui/Toolbar', [
};
};
var itemsToArray = function (items) {
if (Type.isArray(items)) {
return items;
} else if (Type.isString(items)) {
return items.split(/[ ,]/);
}
return [];
};
var create = function (editor, name, items) {
var toolbarItems = [], buttonGroup;
@ -168,7 +222,7 @@ define('tinymce/inlite/ui/Toolbar', [
return;
}
Tools.each(items.split(/[ ,]/), function(item) {
Tools.each(itemsToArray(items), function(item) {
var itemName;
if (item == '|') {
@ -179,12 +233,12 @@ define('tinymce/inlite/ui/Toolbar', [
toolbarItems.push(item);
buttonGroup = null;
} else {
if (!buttonGroup) {
buttonGroup = {type: 'buttongroup', items: []};
toolbarItems.push(buttonGroup);
}
if (editor.buttons[item]) {
if (!buttonGroup) {
buttonGroup = {type: 'buttongroup', items: []};
toolbarItems.push(buttonGroup);
}
itemName = item;
item = editor.buttons[itemName];
@ -897,10 +951,88 @@ define('tinymce/inlite/core/Layout', [
return panelRect;
};
var defaultHandler = function (rects) {
return rects.panelRect;
};
return {
calcInsert: calcInsert,
calc: calc,
userConstrain: userConstrain
userConstrain: userConstrain,
defaultHandler: defaultHandler
};
});
/**
* EditorSettings.js
*
* Released under LGPL License.
* Copyright (c) 1999-2016 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
define('tinymce/inlite/alien/EditorSettings', [
'tinymce/inlite/alien/Type'
], function (Type) {
var validDefaultOrDie = function (value, predicate) {
if (predicate(value)) {
return true;
}
throw new Error('Default value doesn\'t match requested type.');
};
var getByTypeOr = function (predicate) {
return function (editor, name, defaultValue) {
var settings = editor.settings;
validDefaultOrDie(defaultValue, predicate);
return name in settings && predicate(settings[name]) ? settings[name] : defaultValue;
};
};
var splitNoEmpty = function (str, delim) {
return str.split(delim).filter(function (item) {
return item.length > 0;
});
};
var itemsToArray = function (value, defaultValue) {
var stringToItemsArray = function (value) {
return typeof value === 'string' ? splitNoEmpty(value, /[ ,]/) : value;
};
var boolToItemsArray = function (value, defaultValue) {
return value === false ? [ ] : defaultValue;
};
if (Type.isArray(value)) {
return value;
} else if (Type.isString(value)) {
return stringToItemsArray(value);
} else if (Type.isBoolean(value)) {
return boolToItemsArray(value, defaultValue);
}
return defaultValue;
};
var getToolbarItemsOr = function (predicate) {
return function (editor, name, defaultValue) {
var value = name in editor.settings ? editor.settings[name] : defaultValue;
validDefaultOrDie(defaultValue, predicate);
return itemsToArray(value, defaultValue);
};
};
return {
// TODO: Add Option based getString, getBool if merged with core
getStringOr: getByTypeOr(Type.isString),
getBoolOr: getByTypeOr(Type.isBoolean),
getNumberOr: getByTypeOr(Type.isNumber),
getHandlerOr: getByTypeOr(Type.isFunction),
getToolbarItemsOr: getToolbarItemsOr(Type.isArray)
};
});
@ -921,11 +1053,12 @@ define('tinymce/inlite/ui/Panel', [
'tinymce/inlite/ui/Toolbar',
'tinymce/inlite/ui/Forms',
'tinymce/inlite/core/Measure',
'tinymce/inlite/core/Layout'
], function (Tools, Factory, DOM, Toolbar, Forms, Measure, Layout) {
'tinymce/inlite/core/Layout',
'tinymce/inlite/alien/EditorSettings'
], function (Tools, Factory, DOM, Toolbar, Forms, Measure, Layout, EditorSettings) {
return function () {
var DEFAULT_TEXT_SELECTION_ITEMS = 'bold italic | quicklink h2 h3 blockquote';
var DEFAULT_INSERT_TOOLBAR_ITEMS = 'quickimage quicktable';
var DEFAULT_TEXT_SELECTION_ITEMS = ['bold', 'italic', '|', 'quicklink', 'h2', 'h3', 'blockquote'];
var DEFAULT_INSERT_TOOLBAR_ITEMS = ['quickimage', 'quicktable'];
var panel, currentRect;
var createToolbars = function (editor, toolbars) {
@ -934,23 +1067,22 @@ define('tinymce/inlite/ui/Panel', [
});
};
var getTextSelectionToolbarItems = function (settings) {
var value = settings.selection_toolbar;
return value ? value : DEFAULT_TEXT_SELECTION_ITEMS;
var getTextSelectionToolbarItems = function (editor) {
return EditorSettings.getToolbarItemsOr(editor, 'selection_toolbar', DEFAULT_TEXT_SELECTION_ITEMS);
};
var getInsertToolbarItems = function (settings) {
var value = settings.insert_toolbar;
return value ? value : DEFAULT_INSERT_TOOLBAR_ITEMS;
var getInsertToolbarItems = function (editor) {
return EditorSettings.getToolbarItemsOr(editor, 'insert_toolbar', DEFAULT_INSERT_TOOLBAR_ITEMS);
};
var hasToolbarItems = function (toolbar) {
return toolbar.items().length > 0;
};
var create = function (editor, toolbars) {
var items, settings = editor.settings;
items = createToolbars(editor, toolbars);
items = items.concat([
Toolbar.create(editor, 'text', getTextSelectionToolbarItems(settings)),
Toolbar.create(editor, 'insert', getInsertToolbarItems(settings)),
var items = createToolbars(editor, toolbars).concat([
Toolbar.create(editor, 'text', getTextSelectionToolbarItems(editor)),
Toolbar.create(editor, 'insert', getInsertToolbarItems(editor)),
Forms.createQuickLinkForm(editor, hide)
]);
@ -966,7 +1098,7 @@ define('tinymce/inlite/ui/Panel', [
autofix: true,
fixed: true,
border: 1,
items: items,
items: Tools.grep(items, hasToolbarItems),
oncancel: function() {
editor.focus();
}
@ -1016,7 +1148,10 @@ define('tinymce/inlite/ui/Panel', [
if (toolbars.length > 0) {
toolbars[0].show();
panel.reflow();
return true;
}
return false;
};
var showPanelAt = function (panel, id, editor, targetRect) {
@ -1024,9 +1159,13 @@ define('tinymce/inlite/ui/Panel', [
showPanel(panel);
panel.items().hide();
showToolbar(panel, id);
userConstainHandler = editor.settings.inline_toolbar_position_handler;
if (!showToolbar(panel, id)) {
hide(panel);
return;
}
userConstainHandler = EditorSettings.getHandlerOr(editor, 'inline_toolbar_position_handler', Layout.defaultHandler);
contentAreaRect = Measure.getContentAreaRect(editor);
panelRect = DOM.getRect(panel.getEl());
@ -1040,7 +1179,6 @@ define('tinymce/inlite/ui/Panel', [
panelRect = result.rect;
currentRect = targetRect;
movePanelTo(panel, Layout.userConstrain(userConstainHandler, targetRect, contentAreaRect, panelRect));
togglePositionClass(panel, result.position);
} else {
hide(panel);
@ -1054,7 +1192,11 @@ define('tinymce/inlite/ui/Panel', [
var showForm = function (editor, id) {
if (panel) {
panel.items().hide();
showToolbar(panel, id);
if (!showToolbar(panel, id)) {
hide(panel);
return;
}
var contentAreaRect, panelRect, result, userConstainHandler;
@ -1062,7 +1204,7 @@ define('tinymce/inlite/ui/Panel', [
panel.items().hide();
showToolbar(panel, id);
userConstainHandler = editor.settings.inline_toolbar_position_handler;
userConstainHandler = EditorSettings.getHandlerOr(editor, 'inline_toolbar_position_handler', Layout.defaultHandler);
contentAreaRect = Measure.getContentAreaRect(editor);
panelRect = DOM.getRect(panel.getEl());
@ -1071,7 +1213,6 @@ define('tinymce/inlite/ui/Panel', [
if (result) {
panelRect = result.rect;
movePanelTo(panel, Layout.userConstrain(userConstainHandler, currentRect, contentAreaRect, panelRect));
togglePositionClass(panel, result.position);
}
}
@ -1305,9 +1446,18 @@ define('tinymce/inlite/core/SkinLoader', [
}
};
var load = function (editor, skin, callback) {
var baseUrl = EditorManager.baseURL;
var skinUrl = baseUrl + '/skins/' + skin;
var urlFromName = function (name) {
var prefix = EditorManager.baseURL + '/skins/';
return name ? prefix + name : prefix + 'lightgray';
};
var toAbsoluteUrl = function (editor, url) {
return editor.documentBaseURI.toAbsolute(url);
};
var load = function (editor, callback) {
var settings = editor.settings;
var skinUrl = settings.skin_url ? toAbsoluteUrl(editor, settings.skin_url) : urlFromName(settings.skin);
var done = function () {
fireSkinLoaded(editor, callback);
@ -1544,8 +1694,9 @@ define('tinymce/inlite/Theme', [
'tinymce/inlite/core/ElementMatcher',
'tinymce/inlite/core/Matcher',
'tinymce/inlite/alien/Arr',
'tinymce/inlite/alien/EditorSettings',
'tinymce/inlite/core/PredicateId'
], function(ThemeManager, Delay, Panel, Buttons, SkinLoader, SelectionMatcher, ElementMatcher, Matcher, Arr, PredicateId) {
], function(ThemeManager, Delay, Panel, Buttons, SkinLoader, SelectionMatcher, ElementMatcher, Matcher, Arr, EditorSettings, PredicateId) {
var getSelectionElements = function (editor) {
var node = editor.selection.getNode();
var elms = editor.dom.getParents(node);
@ -1644,9 +1795,7 @@ define('tinymce/inlite/Theme', [
};
var renderInlineUI = function (editor, panel) {
var skinName = editor.settings.skin || 'lightgray';
SkinLoader.load(editor, skinName, function () {
SkinLoader.load(editor, function () {
bindContextualToolbarsEvents(editor, panel);
overrideLinkShortcut(editor, panel);
});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.7-alpha-38772';
$wp_version = '4.7-alpha-38773';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
@ -18,7 +18,7 @@ $wp_db_version = 38590;
*
* @global string $tinymce_version
*/
$tinymce_version = '4401-20160726';
$tinymce_version = '4403-20160901';
/**
* Holds the required PHP version