mirror of
git://develop.git.wordpress.org/
synced 2025-01-17 21:08:44 +01:00
TinyMCE: upgrade to 4.4.1, changelog: https://www.tinymce.com/docs/changelog/#version441-july262016.
See #37427. Fixes #37476. git-svn-id: https://develop.svn.wordpress.org/trunk@38155 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
86b5cfcb83
commit
52ea1c53ac
@ -117,7 +117,7 @@ tinymce.PluginManager.add('fullscreen', function(editor) {
|
||||
|
||||
editor.addMenuItem('fullscreen', {
|
||||
text: 'Fullscreen',
|
||||
shortcut: 'Meta+Alt+F',
|
||||
shortcut: 'Ctrl+Shift+F',
|
||||
selectable: true,
|
||||
onClick: function() {
|
||||
toggleFullscreen();
|
||||
@ -135,7 +135,7 @@ tinymce.PluginManager.add('fullscreen', function(editor) {
|
||||
|
||||
editor.addButton('fullscreen', {
|
||||
tooltip: 'Fullscreen',
|
||||
shortcut: 'Meta+Alt+F',
|
||||
shortcut: 'Ctrl+Alt+F',
|
||||
onClick: toggleFullscreen,
|
||||
onPostRender: function() {
|
||||
var self = this;
|
||||
|
@ -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:"Meta+Alt+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:"Meta+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+Alt+F",onClick:e,onPostRender:function(){var b=this;a.on("FullscreenStateChanged",function(a){b.active(a.state)})}}),{isFullscreen:function(){return l}})});
|
@ -613,6 +613,9 @@ tinymce.PluginManager.add('lists', function(editor) {
|
||||
var hasCompatibleStyle = function (sib) {
|
||||
var sibStyle = dom.getStyle(sib, 'list-style-type');
|
||||
var detailStyle = detail ? detail['list-style-type'] : '';
|
||||
|
||||
detailStyle = detailStyle === null ? '' : detailStyle;
|
||||
|
||||
return sibStyle === detailStyle;
|
||||
};
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@ -268,12 +268,12 @@ define("tinymce/pasteplugin/SmartPaste", [
|
||||
};
|
||||
|
||||
var isImageUrl = function (url) {
|
||||
return isAbsoluteUrl(url) && /.(gif|jpe?g|jpng)$/.test(url);
|
||||
return isAbsoluteUrl(url) && /.(gif|jpe?g|png)$/.test(url);
|
||||
};
|
||||
|
||||
var createImage = function (editor, url, pasteHtml) {
|
||||
editor.undoManager.extra(function () {
|
||||
pasteHtml(url);
|
||||
pasteHtml(editor, url);
|
||||
}, function () {
|
||||
editor.insertContent('<img src="' + url + '">');
|
||||
});
|
||||
@ -283,7 +283,7 @@ define("tinymce/pasteplugin/SmartPaste", [
|
||||
|
||||
var createLink = function (editor, url, pasteHtml) {
|
||||
editor.undoManager.extra(function () {
|
||||
pasteHtml(url);
|
||||
pasteHtml(editor, url);
|
||||
}, function () {
|
||||
editor.execCommand('mceInsertLink', false, url);
|
||||
});
|
||||
@ -299,29 +299,33 @@ define("tinymce/pasteplugin/SmartPaste", [
|
||||
return isImageUrl(html) ? createImage(editor, html, pasteHtml) : false;
|
||||
};
|
||||
|
||||
var insertContent = function (editor, html) {
|
||||
var pasteHtml = function (html) {
|
||||
editor.insertContent(html, {
|
||||
merge: editor.settings.paste_merge_formats !== false,
|
||||
paste: true
|
||||
});
|
||||
var pasteHtml = function (editor, html) {
|
||||
editor.insertContent(html, {
|
||||
merge: editor.settings.paste_merge_formats !== false,
|
||||
paste: true
|
||||
});
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
var fallback = function (editor, html) {
|
||||
pasteHtml(html);
|
||||
};
|
||||
return true;
|
||||
};
|
||||
|
||||
var smartInsertContent = function (editor, html) {
|
||||
Tools.each([
|
||||
linkSelection,
|
||||
insertImage,
|
||||
fallback
|
||||
pasteHtml
|
||||
], function (action) {
|
||||
return action(editor, html, pasteHtml) !== true;
|
||||
});
|
||||
};
|
||||
|
||||
var insertContent = function (editor, html) {
|
||||
if (editor.settings.smart_paste === false) {
|
||||
pasteHtml(editor, html);
|
||||
} else {
|
||||
smartInsertContent(editor, html);
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
isImageUrl: isImageUrl,
|
||||
isAbsoluteUrl: isAbsoluteUrl,
|
||||
|
File diff suppressed because one or more lines are too long
@ -592,8 +592,13 @@ define('tinymce/inlite/core/UrlType', [
|
||||
return /^www\.|\.(com|org|edu|gov|uk|net|ca|de|jp|fr|au|us|ru|ch|it|nl|se|no|es|mil)$/i.test(href.trim());
|
||||
};
|
||||
|
||||
var isAbsolute = function (href) {
|
||||
return /^https?:\/\//.test(href.trim());
|
||||
};
|
||||
|
||||
return {
|
||||
isDomainLike: isDomainLike
|
||||
isDomainLike: isDomainLike,
|
||||
isAbsolute: isAbsolute
|
||||
};
|
||||
});
|
||||
|
||||
@ -658,7 +663,7 @@ define('tinymce/inlite/ui/Forms', [
|
||||
};
|
||||
|
||||
var convertLinkToAbsolute = function (editor, href) {
|
||||
return UrlType.isDomainLike(href) ? askAboutPrefix(editor, href) : Promise.resolve(href);
|
||||
return !UrlType.isAbsolute(href) && UrlType.isDomainLike(href) ? askAboutPrefix(editor, href) : Promise.resolve(href);
|
||||
};
|
||||
|
||||
var createQuickLinkForm = function (editor, hide) {
|
||||
@ -767,36 +772,27 @@ define('tinymce/inlite/core/Measure', [
|
||||
};
|
||||
};
|
||||
|
||||
var measureElement = function (elm) {
|
||||
var clientRect = elm.getBoundingClientRect();
|
||||
|
||||
return toAbsolute({
|
||||
x: clientRect.left,
|
||||
y: clientRect.top,
|
||||
w: Math.max(elm.clientWidth, elm.offsetWidth),
|
||||
h: Math.max(elm.clientHeight, elm.offsetHeight)
|
||||
});
|
||||
};
|
||||
|
||||
var getElementRect = function (editor, elm) {
|
||||
var pos, targetRect, root;
|
||||
|
||||
pos = DOM.getPos(editor.getContentAreaContainer());
|
||||
targetRect = editor.dom.getRect(elm);
|
||||
root = editor.dom.getRoot();
|
||||
|
||||
// Adjust targetPos for scrolling in the editor
|
||||
if (root.nodeName == 'BODY') {
|
||||
targetRect.x -= root.ownerDocument.documentElement.scrollLeft || root.scrollLeft;
|
||||
targetRect.y -= root.ownerDocument.documentElement.scrollTop || root.scrollTop;
|
||||
}
|
||||
|
||||
targetRect.x += pos.x;
|
||||
targetRect.y += pos.y;
|
||||
|
||||
// We need to use these instead of the rect values since the style
|
||||
// size properites might not be the same as the real size for a table
|
||||
targetRect.w = elm.clientWidth > 0 ? elm.clientWidth : elm.offsetWidth;
|
||||
targetRect.h = elm.clientHeight > 0 ? elm.clientHeight : elm.offsetHeight;
|
||||
|
||||
return targetRect;
|
||||
return measureElement(elm);
|
||||
};
|
||||
|
||||
var getPageAreaRect = function (editor) {
|
||||
return DOM.getRect(editor.getElement().ownerDocument.body);
|
||||
return measureElement(editor.getElement().ownerDocument.body);
|
||||
};
|
||||
|
||||
var getContentAreaRect = function (editor) {
|
||||
return toAbsolute(DOM.getRect(editor.getContentAreaContainer() || editor.getBody()));
|
||||
return measureElement(editor.getContentAreaContainer() || editor.getBody());
|
||||
};
|
||||
|
||||
var getSelectionRect = function (editor) {
|
||||
@ -927,138 +923,103 @@ define('tinymce/inlite/ui/Panel', [
|
||||
'tinymce/inlite/core/Measure',
|
||||
'tinymce/inlite/core/Layout'
|
||||
], function (Tools, Factory, DOM, Toolbar, Forms, Measure, Layout) {
|
||||
var DEFAULT_TEXT_SELECTION_ITEMS = 'bold italic | quicklink h2 h3 blockquote';
|
||||
var DEFAULT_INSERT_TOOLBAR_ITEMS = 'quickimage quicktable';
|
||||
var panel, currentRect;
|
||||
return function () {
|
||||
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) {
|
||||
return Tools.map(toolbars, function (toolbar) {
|
||||
return Toolbar.create(editor, toolbar.id, toolbar.items);
|
||||
});
|
||||
};
|
||||
|
||||
var getTextSelectionToolbarItems = function (settings) {
|
||||
var value = settings.selection_toolbar;
|
||||
return value ? value : DEFAULT_TEXT_SELECTION_ITEMS;
|
||||
};
|
||||
|
||||
var getInsertToolbarItems = function (settings) {
|
||||
var value = settings.insert_toolbar;
|
||||
return value ? value : DEFAULT_INSERT_TOOLBAR_ITEMS;
|
||||
};
|
||||
|
||||
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)),
|
||||
Forms.createQuickLinkForm(editor, hide)
|
||||
]);
|
||||
|
||||
return Factory.create({
|
||||
type: 'floatpanel',
|
||||
role: 'dialog',
|
||||
classes: 'tinymce tinymce-inline arrow',
|
||||
ariaLabel: 'Inline toolbar',
|
||||
layout: 'flex',
|
||||
direction: 'column',
|
||||
align: 'stretch',
|
||||
autohide: false,
|
||||
autofix: true,
|
||||
fixed: true,
|
||||
border: 1,
|
||||
items: items,
|
||||
oncancel: function() {
|
||||
editor.focus();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
var showPanel = function (panel) {
|
||||
if (panel) {
|
||||
panel.show();
|
||||
}
|
||||
};
|
||||
|
||||
var movePanelTo = function (panel, pos) {
|
||||
panel.moveTo(pos.x, pos.y);
|
||||
};
|
||||
|
||||
var togglePositionClass = function (panel, relPos) {
|
||||
relPos = relPos ? relPos.substr(0, 2) : '';
|
||||
|
||||
Tools.each({
|
||||
t: 'down',
|
||||
b: 'up',
|
||||
c: 'center'
|
||||
}, function(cls, pos) {
|
||||
panel.classes.toggle('arrow-' + cls, pos === relPos.substr(0, 1));
|
||||
});
|
||||
|
||||
if (relPos === 'cr') {
|
||||
panel.classes.toggle('arrow-left', true);
|
||||
panel.classes.toggle('arrow-right', false);
|
||||
} else if (relPos === 'cl') {
|
||||
panel.classes.toggle('arrow-left', true);
|
||||
panel.classes.toggle('arrow-right', true);
|
||||
} else {
|
||||
Tools.each({
|
||||
l: 'left',
|
||||
r: 'right'
|
||||
}, function(cls, pos) {
|
||||
panel.classes.toggle('arrow-' + cls, pos === relPos.substr(1, 1));
|
||||
var createToolbars = function (editor, toolbars) {
|
||||
return Tools.map(toolbars, function (toolbar) {
|
||||
return Toolbar.create(editor, toolbar.id, toolbar.items);
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
var showToolbar = function (panel, id) {
|
||||
var toolbars = panel.items().filter('#' + id);
|
||||
var getTextSelectionToolbarItems = function (settings) {
|
||||
var value = settings.selection_toolbar;
|
||||
return value ? value : DEFAULT_TEXT_SELECTION_ITEMS;
|
||||
};
|
||||
|
||||
if (toolbars.length > 0) {
|
||||
toolbars[0].show();
|
||||
panel.reflow();
|
||||
}
|
||||
};
|
||||
var getInsertToolbarItems = function (settings) {
|
||||
var value = settings.insert_toolbar;
|
||||
return value ? value : DEFAULT_INSERT_TOOLBAR_ITEMS;
|
||||
};
|
||||
|
||||
var showPanelAt = function (panel, id, editor, targetRect) {
|
||||
var contentAreaRect, panelRect, result, userConstainHandler;
|
||||
var create = function (editor, toolbars) {
|
||||
var items, settings = editor.settings;
|
||||
|
||||
showPanel(panel);
|
||||
panel.items().hide();
|
||||
showToolbar(panel, id);
|
||||
items = createToolbars(editor, toolbars);
|
||||
items = items.concat([
|
||||
Toolbar.create(editor, 'text', getTextSelectionToolbarItems(settings)),
|
||||
Toolbar.create(editor, 'insert', getInsertToolbarItems(settings)),
|
||||
Forms.createQuickLinkForm(editor, hide)
|
||||
]);
|
||||
|
||||
userConstainHandler = editor.settings.inline_toolbar_position_handler;
|
||||
contentAreaRect = Measure.getContentAreaRect(editor);
|
||||
panelRect = DOM.getRect(panel.getEl());
|
||||
return Factory.create({
|
||||
type: 'floatpanel',
|
||||
role: 'dialog',
|
||||
classes: 'tinymce tinymce-inline arrow',
|
||||
ariaLabel: 'Inline toolbar',
|
||||
layout: 'flex',
|
||||
direction: 'column',
|
||||
align: 'stretch',
|
||||
autohide: false,
|
||||
autofix: true,
|
||||
fixed: true,
|
||||
border: 1,
|
||||
items: items,
|
||||
oncancel: function() {
|
||||
editor.focus();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
if (id === 'insert') {
|
||||
result = Layout.calcInsert(targetRect, contentAreaRect, panelRect);
|
||||
} else {
|
||||
result = Layout.calc(targetRect, contentAreaRect, panelRect);
|
||||
}
|
||||
var showPanel = function (panel) {
|
||||
if (panel) {
|
||||
panel.show();
|
||||
}
|
||||
};
|
||||
|
||||
if (result) {
|
||||
panelRect = result.rect;
|
||||
currentRect = targetRect;
|
||||
movePanelTo(panel, Layout.userConstrain(userConstainHandler, targetRect, contentAreaRect, panelRect));
|
||||
var movePanelTo = function (panel, pos) {
|
||||
panel.moveTo(pos.x, pos.y);
|
||||
};
|
||||
|
||||
togglePositionClass(panel, result.position);
|
||||
} else {
|
||||
hide(panel);
|
||||
}
|
||||
};
|
||||
var togglePositionClass = function (panel, relPos) {
|
||||
relPos = relPos ? relPos.substr(0, 2) : '';
|
||||
|
||||
var hasFormVisible = function () {
|
||||
return panel.items().filter('form:visible').length > 0;
|
||||
};
|
||||
Tools.each({
|
||||
t: 'down',
|
||||
b: 'up',
|
||||
c: 'center'
|
||||
}, function(cls, pos) {
|
||||
panel.classes.toggle('arrow-' + cls, pos === relPos.substr(0, 1));
|
||||
});
|
||||
|
||||
var showForm = function (editor, id) {
|
||||
if (panel) {
|
||||
panel.items().hide();
|
||||
showToolbar(panel, id);
|
||||
if (relPos === 'cr') {
|
||||
panel.classes.toggle('arrow-left', true);
|
||||
panel.classes.toggle('arrow-right', false);
|
||||
} else if (relPos === 'cl') {
|
||||
panel.classes.toggle('arrow-left', true);
|
||||
panel.classes.toggle('arrow-right', true);
|
||||
} else {
|
||||
Tools.each({
|
||||
l: 'left',
|
||||
r: 'right'
|
||||
}, function(cls, pos) {
|
||||
panel.classes.toggle('arrow-' + cls, pos === relPos.substr(1, 1));
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
var showToolbar = function (panel, id) {
|
||||
var toolbars = panel.items().filter('#' + id);
|
||||
|
||||
if (toolbars.length > 0) {
|
||||
toolbars[0].show();
|
||||
panel.reflow();
|
||||
}
|
||||
};
|
||||
|
||||
var showPanelAt = function (panel, id, editor, targetRect) {
|
||||
var contentAreaRect, panelRect, result, userConstainHandler;
|
||||
|
||||
showPanel(panel);
|
||||
@ -1069,59 +1030,96 @@ define('tinymce/inlite/ui/Panel', [
|
||||
contentAreaRect = Measure.getContentAreaRect(editor);
|
||||
panelRect = DOM.getRect(panel.getEl());
|
||||
|
||||
result = Layout.calc(currentRect, contentAreaRect, panelRect);
|
||||
if (id === 'insert') {
|
||||
result = Layout.calcInsert(targetRect, contentAreaRect, panelRect);
|
||||
} else {
|
||||
result = Layout.calc(targetRect, contentAreaRect, panelRect);
|
||||
}
|
||||
|
||||
if (result) {
|
||||
panelRect = result.rect;
|
||||
movePanelTo(panel, Layout.userConstrain(userConstainHandler, currentRect, contentAreaRect, panelRect));
|
||||
currentRect = targetRect;
|
||||
movePanelTo(panel, Layout.userConstrain(userConstainHandler, targetRect, contentAreaRect, panelRect));
|
||||
|
||||
togglePositionClass(panel, result.position);
|
||||
} else {
|
||||
hide(panel);
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
var show = function (editor, id, targetRect, toolbars) {
|
||||
if (!panel) {
|
||||
panel = create(editor, toolbars);
|
||||
panel.renderTo(document.body).reflow().moveTo(targetRect.x, targetRect.y);
|
||||
editor.nodeChanged();
|
||||
}
|
||||
var hasFormVisible = function () {
|
||||
return panel.items().filter('form:visible').length > 0;
|
||||
};
|
||||
|
||||
showPanelAt(panel, id, editor, targetRect);
|
||||
};
|
||||
var showForm = function (editor, id) {
|
||||
if (panel) {
|
||||
panel.items().hide();
|
||||
showToolbar(panel, id);
|
||||
|
||||
var hide = function () {
|
||||
if (panel) {
|
||||
panel.hide();
|
||||
}
|
||||
};
|
||||
var contentAreaRect, panelRect, result, userConstainHandler;
|
||||
|
||||
var focus = function () {
|
||||
if (panel) {
|
||||
panel.find('toolbar:visible').eq(0).each(function (item) {
|
||||
item.focus(true);
|
||||
});
|
||||
}
|
||||
};
|
||||
showPanel(panel);
|
||||
panel.items().hide();
|
||||
showToolbar(panel, id);
|
||||
|
||||
var remove = function () {
|
||||
if (panel) {
|
||||
panel.remove();
|
||||
panel = null;
|
||||
}
|
||||
};
|
||||
userConstainHandler = editor.settings.inline_toolbar_position_handler;
|
||||
contentAreaRect = Measure.getContentAreaRect(editor);
|
||||
panelRect = DOM.getRect(panel.getEl());
|
||||
|
||||
var inForm = function () {
|
||||
return panel && panel.visible() && hasFormVisible();
|
||||
};
|
||||
result = Layout.calc(currentRect, contentAreaRect, panelRect);
|
||||
|
||||
return {
|
||||
show: show,
|
||||
showForm: showForm,
|
||||
inForm: inForm,
|
||||
hide: hide,
|
||||
focus: focus,
|
||||
remove: remove
|
||||
if (result) {
|
||||
panelRect = result.rect;
|
||||
movePanelTo(panel, Layout.userConstrain(userConstainHandler, currentRect, contentAreaRect, panelRect));
|
||||
|
||||
togglePositionClass(panel, result.position);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var show = function (editor, id, targetRect, toolbars) {
|
||||
if (!panel) {
|
||||
panel = create(editor, toolbars);
|
||||
panel.renderTo(document.body).reflow().moveTo(targetRect.x, targetRect.y);
|
||||
editor.nodeChanged();
|
||||
}
|
||||
|
||||
showPanelAt(panel, id, editor, targetRect);
|
||||
};
|
||||
|
||||
var hide = function () {
|
||||
if (panel) {
|
||||
panel.hide();
|
||||
}
|
||||
};
|
||||
|
||||
var focus = function () {
|
||||
if (panel) {
|
||||
panel.find('toolbar:visible').eq(0).each(function (item) {
|
||||
item.focus(true);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
var remove = function () {
|
||||
if (panel) {
|
||||
panel.remove();
|
||||
panel = null;
|
||||
}
|
||||
};
|
||||
|
||||
var inForm = function () {
|
||||
return panel && panel.visible() && hasFormVisible();
|
||||
};
|
||||
|
||||
return {
|
||||
show: show,
|
||||
showForm: showForm,
|
||||
inForm: inForm,
|
||||
hide: hide,
|
||||
focus: focus,
|
||||
remove: remove
|
||||
};
|
||||
};
|
||||
});
|
||||
|
||||
@ -1238,13 +1236,13 @@ define('tinymce/inlite/ui/Buttons', [
|
||||
}
|
||||
};
|
||||
|
||||
var addToEditor = function (editor) {
|
||||
var addToEditor = function (editor, panel) {
|
||||
editor.addButton('quicklink', {
|
||||
icon: 'link',
|
||||
tooltip: 'Insert/Edit link',
|
||||
stateSelector: 'a[href]',
|
||||
onclick: function () {
|
||||
Panel.showForm(editor, 'quicklink');
|
||||
panel.showForm(editor, 'quicklink');
|
||||
}
|
||||
});
|
||||
|
||||
@ -1266,7 +1264,7 @@ define('tinymce/inlite/ui/Buttons', [
|
||||
icon: 'table',
|
||||
tooltip: 'Insert table',
|
||||
onclick: function () {
|
||||
Panel.hide();
|
||||
panel.hide();
|
||||
Actions.insertTable(editor, 2, 2);
|
||||
}
|
||||
});
|
||||
@ -1591,11 +1589,16 @@ define('tinymce/inlite/Theme', [
|
||||
return result && result.rect ? result : null;
|
||||
};
|
||||
|
||||
var togglePanel = function (editor) {
|
||||
var togglePanel = function (editor, panel) {
|
||||
var toggle = function () {
|
||||
var toolbars = getToolbars(editor);
|
||||
var result = findMatchResult(editor, toolbars);
|
||||
result ? Panel.show(editor, result.id, result.rect, toolbars) : Panel.hide();
|
||||
|
||||
if (result) {
|
||||
panel.show(editor, result.id, result.rect, toolbars);
|
||||
} else {
|
||||
panel.hide();
|
||||
}
|
||||
};
|
||||
|
||||
return function () {
|
||||
@ -1605,28 +1608,28 @@ define('tinymce/inlite/Theme', [
|
||||
};
|
||||
};
|
||||
|
||||
var ignoreWhenFormIsVisible = function (f) {
|
||||
var ignoreWhenFormIsVisible = function (panel, f) {
|
||||
return function () {
|
||||
if (!Panel.inForm()) {
|
||||
if (!panel.inForm()) {
|
||||
f();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
var bindContextualToolbarsEvents = function (editor) {
|
||||
var throttledTogglePanel = Delay.throttle(togglePanel(editor), 0);
|
||||
var throttledTogglePanelWhenNotInForm = Delay.throttle(ignoreWhenFormIsVisible(togglePanel(editor)), 0);
|
||||
var bindContextualToolbarsEvents = function (editor, panel) {
|
||||
var throttledTogglePanel = Delay.throttle(togglePanel(editor, panel), 0);
|
||||
var throttledTogglePanelWhenNotInForm = Delay.throttle(ignoreWhenFormIsVisible(panel, togglePanel(editor, panel)), 0);
|
||||
|
||||
editor.on('blur hide ObjectResizeStart', Panel.hide);
|
||||
editor.on('blur hide ObjectResizeStart', panel.hide);
|
||||
editor.on('click', throttledTogglePanel);
|
||||
editor.on('nodeChange mouseup', throttledTogglePanelWhenNotInForm);
|
||||
editor.on('ResizeEditor ResizeWindow keyup', throttledTogglePanel);
|
||||
editor.on('remove', Panel.remove);
|
||||
editor.on('remove', panel.remove);
|
||||
|
||||
editor.shortcuts.add('Alt+F10', '', Panel.focus);
|
||||
editor.shortcuts.add('Alt+F10', '', panel.focus);
|
||||
};
|
||||
|
||||
var overrideLinkShortcut = function (editor) {
|
||||
var overrideLinkShortcut = function (editor, panel) {
|
||||
editor.shortcuts.remove('meta+k');
|
||||
editor.shortcuts.add('meta+k', '', function () {
|
||||
var toolbars = getToolbars(editor);
|
||||
@ -1635,17 +1638,17 @@ define('tinymce/inlite/Theme', [
|
||||
]);
|
||||
|
||||
if (result) {
|
||||
Panel.show(editor, result.id, result.rect, toolbars);
|
||||
panel.show(editor, result.id, result.rect, toolbars);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
var renderInlineUI = function (editor) {
|
||||
var renderInlineUI = function (editor, panel) {
|
||||
var skinName = editor.settings.skin || 'lightgray';
|
||||
|
||||
SkinLoader.load(editor, skinName, function () {
|
||||
bindContextualToolbarsEvents(editor);
|
||||
overrideLinkShortcut(editor);
|
||||
bindContextualToolbarsEvents(editor, panel);
|
||||
overrideLinkShortcut(editor, panel);
|
||||
});
|
||||
|
||||
return {};
|
||||
@ -1656,10 +1659,12 @@ define('tinymce/inlite/Theme', [
|
||||
};
|
||||
|
||||
ThemeManager.add('inlite', function (editor) {
|
||||
Buttons.addToEditor(editor);
|
||||
var panel = new Panel();
|
||||
|
||||
Buttons.addToEditor(editor, panel);
|
||||
|
||||
var renderUI = function () {
|
||||
return editor.inline ? renderInlineUI(editor) : fail('inlite theme only supports inline mode.');
|
||||
return editor.inline ? renderInlineUI(editor, panel) : fail('inlite theme only supports inline mode.');
|
||||
};
|
||||
|
||||
return {
|
||||
|
File diff suppressed because one or more lines are too long
@ -848,7 +848,7 @@ tinymce.ThemeManager.add('modern', function(editor) {
|
||||
// Add statusbar if needed
|
||||
if (settings.statusbar !== false) {
|
||||
panel.add({type: 'panel', name: 'statusbar', classes: 'statusbar', layout: 'flow', border: '1 0 0 0', ariaRoot: true, items: [
|
||||
{type: 'elementpath'},
|
||||
{type: 'elementpath', editor: editor},
|
||||
resizeHandleCtrl
|
||||
]});
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
@ -1,4 +1,4 @@
|
||||
// 4.4.0 (2016-06-30)
|
||||
// 4.4.1 (2016-07-26)
|
||||
|
||||
/**
|
||||
* Compiled inline version. (Library mode)
|
||||
@ -569,7 +569,7 @@ define("tinymce/util/Delay", [
|
||||
|
||||
function wrappedSetInterval(callback, time) {
|
||||
if (typeof time != 'number') {
|
||||
time = 0;
|
||||
time = 1; // IE 8 needs it to be > 0
|
||||
}
|
||||
|
||||
return setInterval(callback, time);
|
||||
@ -10202,8 +10202,9 @@ define("tinymce/dom/RangeUtils", [
|
||||
"tinymce/util/Tools",
|
||||
"tinymce/dom/TreeWalker",
|
||||
"tinymce/dom/NodeType",
|
||||
"tinymce/dom/Range",
|
||||
"tinymce/caret/CaretContainer"
|
||||
], function(Tools, TreeWalker, NodeType, CaretContainer) {
|
||||
], function(Tools, TreeWalker, NodeType, Range, CaretContainer) {
|
||||
var each = Tools.each,
|
||||
isContentEditableFalse = NodeType.isContentEditableFalse,
|
||||
isCaretContainer = CaretContainer.isCaretContainer;
|
||||
@ -15236,6 +15237,19 @@ define("tinymce/dom/ControlSelection", [
|
||||
"tinymce/dom/NodeType"
|
||||
], function(VK, Tools, Delay, Env, NodeType) {
|
||||
var isContentEditableFalse = NodeType.isContentEditableFalse;
|
||||
var isContentEditableTrue = NodeType.isContentEditableTrue;
|
||||
|
||||
function getContentEditableRoot(root, node) {
|
||||
while (node && node != root) {
|
||||
if (isContentEditableTrue(node) || isContentEditableFalse(node)) {
|
||||
return node;
|
||||
}
|
||||
|
||||
node = node.parentNode;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
return function(selection, editor) {
|
||||
var dom = editor.dom, each = Tools.each;
|
||||
@ -15675,10 +15689,14 @@ define("tinymce/dom/ControlSelection", [
|
||||
}
|
||||
}
|
||||
|
||||
function isWithinContentEditableFalse(elm) {
|
||||
return isContentEditableFalse(getContentEditableRoot(editor.getBody(), elm));
|
||||
}
|
||||
|
||||
function nativeControlSelect(e) {
|
||||
var target = e.srcElement;
|
||||
|
||||
if (isContentEditableFalse(target)) {
|
||||
if (isWithinContentEditableFalse(target)) {
|
||||
preventDefault(e);
|
||||
return;
|
||||
}
|
||||
@ -15765,10 +15783,10 @@ define("tinymce/dom/ControlSelection", [
|
||||
// Needs to be mousedown for drag/drop to work on IE 11
|
||||
// Needs to be click on Edge to properly select images
|
||||
editor.on('mousedown click', function(e) {
|
||||
var nodeName = e.target.nodeName;
|
||||
var target = e.target, nodeName = target.nodeName;
|
||||
|
||||
if (!resizeStarted && /^(TABLE|IMG|HR)$/.test(nodeName)) {
|
||||
editor.selection.select(e.target, nodeName == 'TABLE');
|
||||
if (!resizeStarted && /^(TABLE|IMG|HR)$/.test(nodeName) && !isWithinContentEditableFalse(target)) {
|
||||
editor.selection.select(target, nodeName == 'TABLE');
|
||||
|
||||
// Only fire once since nodeChange is expensive
|
||||
if (e.type == 'mousedown') {
|
||||
@ -15784,7 +15802,7 @@ define("tinymce/dom/ControlSelection", [
|
||||
});
|
||||
}
|
||||
|
||||
if (isContentEditableFalse(e.target)) {
|
||||
if (isWithinContentEditableFalse(e.target)) {
|
||||
e.preventDefault();
|
||||
delayedSelect(e.target);
|
||||
return;
|
||||
@ -16264,6 +16282,10 @@ define("tinymce/caret/CaretPosition", [
|
||||
nodeIndex = DOMUtils.nodeIndex,
|
||||
resolveIndex = RangeUtils.getNode;
|
||||
|
||||
function createRange(doc) {
|
||||
return "createRange" in doc ? doc.createRange() : DOMUtils.DOM.createRng();
|
||||
}
|
||||
|
||||
function isWhiteSpace(chr) {
|
||||
return chr && /[\r\n\t ]/.test(chr);
|
||||
}
|
||||
@ -16291,7 +16313,7 @@ define("tinymce/caret/CaretPosition", [
|
||||
// support getBoundingClientRect on BR elements
|
||||
function getBrClientRect(brNode) {
|
||||
var doc = brNode.ownerDocument,
|
||||
rng = doc.createRange(),
|
||||
rng = createRange(doc),
|
||||
nbsp = doc.createTextNode('\u00a0'),
|
||||
parentNode = brNode.parentNode,
|
||||
clientRect;
|
||||
@ -16345,7 +16367,7 @@ define("tinymce/caret/CaretPosition", [
|
||||
}
|
||||
|
||||
function addCharacterOffset(container, offset) {
|
||||
var range = container.ownerDocument.createRange();
|
||||
var range = createRange(container.ownerDocument);
|
||||
|
||||
if (offset < container.data.length) {
|
||||
if (ExtendingChar.isExtendingChar(container.data[offset])) {
|
||||
@ -16454,7 +16476,7 @@ define("tinymce/caret/CaretPosition", [
|
||||
function toRange() {
|
||||
var range;
|
||||
|
||||
range = container.ownerDocument.createRange();
|
||||
range = createRange(container.ownerDocument);
|
||||
range.setStart(container, offset);
|
||||
range.setEnd(container, offset);
|
||||
|
||||
@ -23322,8 +23344,8 @@ define("tinymce/InsertContent", [
|
||||
fragment = parser.parse(value, parserArgs);
|
||||
|
||||
// Custom handling of lists
|
||||
if (InsertList.isListFragment(fragment) && InsertList.isParentBlockLi(dom, parentNode)) {
|
||||
rng = InsertList.insertAtCaret(serializer, dom, editor.selection.getRng(), fragment);
|
||||
if (details.paste === true && InsertList.isListFragment(fragment) && InsertList.isParentBlockLi(dom, parentNode)) {
|
||||
rng = InsertList.insertAtCaret(serializer, dom, editor.selection.getRng(true), fragment);
|
||||
editor.selection.setRng(rng);
|
||||
editor.fire('SetContent', args);
|
||||
return;
|
||||
@ -24834,7 +24856,7 @@ define("tinymce/util/EventDispatcher", [
|
||||
"focus blur focusin focusout click dblclick mousedown mouseup mousemove mouseover beforepaste paste cut copy selectionchange " +
|
||||
"mouseout mouseenter mouseleave wheel keydown keypress keyup input contextmenu dragstart dragend dragover " +
|
||||
"draggesture dragdrop drop drag submit " +
|
||||
"compositionstart compositionend compositionupdate touchstart touchend",
|
||||
"compositionstart compositionend compositionupdate touchstart touchmove touchend",
|
||||
' '
|
||||
);
|
||||
|
||||
@ -33643,7 +33665,7 @@ define("tinymce/EditorObservable", [
|
||||
|
||||
// Need to bind mousedown/mouseup etc to document not body in iframe mode
|
||||
// Since the user might click on the HTML element not the BODY
|
||||
if (!editor.inline && /^mouse|click|contextmenu|drop|dragover|dragend/.test(eventName)) {
|
||||
if (!editor.inline && /^mouse|touch|click|contextmenu|drop|dragover|dragend/.test(eventName)) {
|
||||
return editor.getDoc().documentElement;
|
||||
}
|
||||
|
||||
@ -36364,6 +36386,31 @@ define("tinymce/SelectionOverrides", [
|
||||
}
|
||||
});
|
||||
|
||||
function handleTouchSelect(editor) {
|
||||
var moved = false;
|
||||
|
||||
editor.on('touchstart', function () {
|
||||
moved = false;
|
||||
});
|
||||
|
||||
editor.on('touchmove', function () {
|
||||
moved = true;
|
||||
});
|
||||
|
||||
editor.on('touchend', function (e) {
|
||||
var contentEditableRoot = getContentEditableRoot(e.target);
|
||||
|
||||
if (isContentEditableFalse(contentEditableRoot)) {
|
||||
if (!moved) {
|
||||
e.preventDefault();
|
||||
setContentEditableSelection(selectNode(contentEditableRoot));
|
||||
}
|
||||
} else {
|
||||
clearContentEditableSelection();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var hasNormalCaretPosition = function (elm) {
|
||||
var caretWalker = new CaretWalker(elm);
|
||||
|
||||
@ -36393,6 +36440,8 @@ define("tinymce/SelectionOverrides", [
|
||||
return targetBlock && !isInSameBlock(targetBlock, caretBlock) && hasNormalCaretPosition(targetBlock);
|
||||
};
|
||||
|
||||
handleTouchSelect(editor);
|
||||
|
||||
editor.on('mousedown', function(e) {
|
||||
var contentEditableRoot;
|
||||
|
||||
@ -36739,7 +36788,8 @@ define("tinymce/util/Uuid", [
|
||||
return Math.round(Math.random() * 0xFFFFFFFF).toString(36);
|
||||
};
|
||||
|
||||
return 's' + Date.now().toString(36) + rnd() + rnd() + rnd();
|
||||
var now = new Date().getTime();
|
||||
return 's' + now.toString(36) + rnd() + rnd() + rnd();
|
||||
};
|
||||
|
||||
var uuid = function (prefix) {
|
||||
@ -39470,7 +39520,7 @@ define("tinymce/EditorManager", [
|
||||
* @property minorVersion
|
||||
* @type String
|
||||
*/
|
||||
minorVersion: '4.0',
|
||||
minorVersion: '4.1',
|
||||
|
||||
/**
|
||||
* Release date of TinyMCE build.
|
||||
@ -39478,7 +39528,7 @@ define("tinymce/EditorManager", [
|
||||
* @property releaseDate
|
||||
* @type String
|
||||
*/
|
||||
releaseDate: '2016-06-30',
|
||||
releaseDate: '2016-07-26',
|
||||
|
||||
/**
|
||||
* Collection of editor instances.
|
||||
@ -42717,9 +42767,8 @@ define("tinymce/ui/Path", [
|
||||
* @extends tinymce.ui.Path
|
||||
*/
|
||||
define("tinymce/ui/ElementPath", [
|
||||
"tinymce/ui/Path",
|
||||
"tinymce/EditorManager"
|
||||
], function(Path, EditorManager) {
|
||||
"tinymce/ui/Path"
|
||||
], function(Path) {
|
||||
return Path.extend({
|
||||
/**
|
||||
* Post render method. Called after the control has been rendered to the target.
|
||||
@ -42728,7 +42777,7 @@ define("tinymce/ui/ElementPath", [
|
||||
* @return {tinymce.ui.ElementPath} Current combobox instance.
|
||||
*/
|
||||
postRender: function() {
|
||||
var self = this, editor = EditorManager.activeEditor;
|
||||
var self = this, editor = self.settings.editor;
|
||||
|
||||
function isHidden(elm) {
|
||||
if (elm.nodeType === 1) {
|
||||
|
26
src/wp-includes/js/tinymce/tinymce.min.js
vendored
26
src/wp-includes/js/tinymce/tinymce.min.js
vendored
File diff suppressed because one or more lines are too long
@ -18,7 +18,7 @@ $wp_db_version = 37965;
|
||||
*
|
||||
* @global string $tinymce_version
|
||||
*/
|
||||
$tinymce_version = '4400-20160711';
|
||||
$tinymce_version = '4401-20160726';
|
||||
|
||||
/**
|
||||
* Holds the required PHP version
|
||||
|
@ -60,7 +60,7 @@ ModuleLoader.require([
|
||||
valid_styles: {
|
||||
'*': 'color,font-size,font-family,background-color,font-weight,font-style,text-decoration,float,margin,margin-top,margin-right,margin-bottom,margin-left,display,position,top,left,list-style-type'
|
||||
},
|
||||
|
||||
|
||||
});
|
||||
|
||||
tinymce.init({
|
||||
@ -77,7 +77,7 @@ ModuleLoader.require([
|
||||
valid_styles: {
|
||||
'*': 'color,font-size,font-family,background-color,font-weight,font-style,text-decoration,float,margin,margin-top,margin-right,margin-bottom,margin-left,display,position,top,left,list-style-type'
|
||||
},
|
||||
|
||||
|
||||
});
|
||||
},
|
||||
|
||||
@ -451,7 +451,7 @@ ModuleLoader.require([
|
||||
'<li>c</li>' +
|
||||
'</ol>'
|
||||
);
|
||||
|
||||
|
||||
editor.focus();
|
||||
Utils.setSelection('ul li', 1);
|
||||
execCommand('InsertOrderedList');
|
||||
@ -478,7 +478,7 @@ ModuleLoader.require([
|
||||
'<li>c</li>' +
|
||||
'</ol>'
|
||||
);
|
||||
|
||||
|
||||
editor.focus();
|
||||
Utils.setSelection('ul li', 1);
|
||||
execCommand('InsertOrderedList', false, { 'list-style-type': 'upper-roman' });
|
||||
@ -503,7 +503,7 @@ ModuleLoader.require([
|
||||
'<li>c</li>' +
|
||||
'</ol>'
|
||||
);
|
||||
|
||||
|
||||
editor.focus();
|
||||
Utils.setSelection('ul li', 1);
|
||||
execCommand('InsertOrderedList', false, { 'list-style-type': 'lower-roman' });
|
||||
@ -530,7 +530,7 @@ ModuleLoader.require([
|
||||
'<li>c</li>' +
|
||||
'</ol>'
|
||||
);
|
||||
|
||||
|
||||
editor.focus();
|
||||
Utils.setSelection('ul li', 1);
|
||||
execCommand('InsertOrderedList', false, { 'list-style-type': 'lower-roman' });
|
||||
@ -2443,4 +2443,18 @@ ModuleLoader.require([
|
||||
equal(editor.getContent(), '<ul><li>a</li></ul>');
|
||||
equal(editor.selection.getNode().nodeName, 'LI');
|
||||
});
|
||||
|
||||
test('Apply UL list to more than two paragraphs', function() {
|
||||
editor.getBody().innerHTML = trimBrs(
|
||||
'<p>a</p>' +
|
||||
'<p>b</p>' +
|
||||
'<p>c</p>'
|
||||
);
|
||||
|
||||
editor.focus();
|
||||
Utils.setSelection('p:nth-child(1)', 0, 'p:nth-child(3)', 1);
|
||||
execCommand('InsertUnorderedList', false, {'list-style-type': null});
|
||||
|
||||
equal(editor.getContent(), '<ul><li>a</li><li>b</li><li>c</li></ul>');
|
||||
});
|
||||
});
|
||||
|
@ -15,6 +15,7 @@ ModuleLoader.require([
|
||||
ed.on('NodeChange', false);
|
||||
},
|
||||
init_instance_callback: function(ed) {
|
||||
delete ed.settings.smart_paste;
|
||||
window.editor = ed;
|
||||
QUnit.start();
|
||||
}
|
||||
@ -34,6 +35,9 @@ ModuleLoader.require([
|
||||
test('isImageUrl', function() {
|
||||
equal(SmartPaste.isImageUrl('http://www.site.com'), false);
|
||||
equal(SmartPaste.isImageUrl('https://www.site.com'), false);
|
||||
equal(SmartPaste.isImageUrl('http://www.site.com/dir-name/file.jpeg'), true);
|
||||
equal(SmartPaste.isImageUrl('http://www.site.com/dir-name/file.jpg'), true);
|
||||
equal(SmartPaste.isImageUrl('http://www.site.com/dir-name/file.png'), true);
|
||||
equal(SmartPaste.isImageUrl('http://www.site.com/dir-name/file.gif'), true);
|
||||
equal(SmartPaste.isImageUrl('https://www.site.com/dir-name/file.gif'), true);
|
||||
equal(SmartPaste.isImageUrl('https://www.site.com/dir-name/file.gif?query=%42'), false);
|
||||
@ -65,4 +69,17 @@ ModuleLoader.require([
|
||||
equal(editor.getContent(), '<p>a<img src="http://www.site.com/my.jpg" />bc</p>');
|
||||
equal(editor.undoManager.data.length, 3);
|
||||
});
|
||||
|
||||
test('smart paste option disabled', function() {
|
||||
editor.focus();
|
||||
editor.undoManager.clear();
|
||||
editor.setContent('<p>abc</p>');
|
||||
Utils.setSelection('p', 1);
|
||||
editor.undoManager.add();
|
||||
editor.settings.smart_paste = false;
|
||||
|
||||
editor.execCommand('mceInsertClipboardContent', false, {content: 'http://www.site.com/my.jpg'});
|
||||
equal(editor.getContent(), '<p>ahttp://www.site.com/my.jpgbc</p>');
|
||||
equal(editor.undoManager.data.length, 2);
|
||||
});
|
||||
});
|
||||
|
@ -618,6 +618,16 @@
|
||||
test("row clipboard api", function() {
|
||||
var clipboardRows;
|
||||
|
||||
function createRow(cellContents) {
|
||||
var tr = editor.dom.create('tr');
|
||||
|
||||
tinymce.each(cellContents, function (html) {
|
||||
tr.appendChild(editor.dom.create('td', null, html));
|
||||
});
|
||||
|
||||
return tr;
|
||||
}
|
||||
|
||||
editor.setContent(
|
||||
'<table>' +
|
||||
'<tr><td>1</td><td>2</td></tr>' +
|
||||
@ -634,8 +644,8 @@
|
||||
equal(clipboardRows[0].tagName, 'TR');
|
||||
|
||||
editor.plugins.table.setClipboardRows(clipboardRows.concat([
|
||||
editor.dom.create('tr', {}, '<td>a</td><td>b</td>'),
|
||||
editor.dom.create('tr', {}, '<td>c</td><td>d</td>')
|
||||
createRow(['a', 'b']),
|
||||
createRow(['c', 'd'])
|
||||
]));
|
||||
|
||||
Utils.setSelection('tr:nth-child(2) td', 0);
|
||||
|
@ -41,7 +41,7 @@ ModuleLoader.require([
|
||||
editor.setContent('<ul><li>12</li></ul>');
|
||||
editor.focus();
|
||||
Utils.setSelection('li', 0);
|
||||
InsertContent.insertAtCaret(editor, '<ul><li>a</li></ul>');
|
||||
InsertContent.insertAtCaret(editor, {content: '<ul><li>a</li></ul>', paste: true});
|
||||
equal(editor.getContent(), '<ul><li>a</li><li>12</li></ul>');
|
||||
assertSelection('li:nth-child(2)', 0);
|
||||
});
|
||||
@ -50,7 +50,7 @@ ModuleLoader.require([
|
||||
editor.setContent('<ul><li>12</li></ul>');
|
||||
editor.focus();
|
||||
Utils.setSelection('li', 0);
|
||||
InsertContent.insertAtCaret(editor, '<ul><li>a</li><li>b</li></ul>');
|
||||
InsertContent.insertAtCaret(editor, {content: '<ul><li>a</li><li>b</li></ul>', paste: true});
|
||||
equal(editor.getContent(), '<ul><li>a</li><li>b</li><li>12</li></ul>');
|
||||
assertSelection('li:nth-child(3)', 0);
|
||||
});
|
||||
@ -59,7 +59,7 @@ ModuleLoader.require([
|
||||
editor.setContent('<ul><li>12</li></ul>');
|
||||
editor.focus();
|
||||
Utils.setSelection('li', 2);
|
||||
InsertContent.insertAtCaret(editor, '<ul><li>a</li></ul>');
|
||||
InsertContent.insertAtCaret(editor, {content: '<ul><li>a</li></ul>', paste: true});
|
||||
equal(editor.getContent(), '<ul><li>12</li><li>a</li></ul>');
|
||||
assertSelection('li:nth-child(2)', 1);
|
||||
});
|
||||
@ -68,7 +68,7 @@ ModuleLoader.require([
|
||||
editor.setContent('<ul><li>12</li></ul>');
|
||||
editor.focus();
|
||||
Utils.setSelection('li', 2);
|
||||
InsertContent.insertAtCaret(editor, '<ul><li>a</li><li>b</li><li>c</li></ul>');
|
||||
InsertContent.insertAtCaret(editor, {content: '<ul><li>a</li><li>b</li><li>c</li></ul>', paste: true});
|
||||
equal(editor.getContent(), '<ul><li>12</li><li>a</li><li>b</li><li>c</li></ul>');
|
||||
assertSelection('li:nth-child(4)', 1);
|
||||
});
|
||||
@ -77,7 +77,7 @@ ModuleLoader.require([
|
||||
editor.setContent('<ul><li>12</li></ul>');
|
||||
editor.focus();
|
||||
Utils.setSelection('li', 1);
|
||||
InsertContent.insertAtCaret(editor, '<ul><li>a</li><li>b</li></ul>');
|
||||
InsertContent.insertAtCaret(editor, {content: '<ul><li>a</li><li>b</li></ul>', paste: true});
|
||||
equal(editor.getContent(), '<ul><li>1</li><li>a</li><li>b</li><li>2</li></ul>');
|
||||
assertSelection('li:nth-child(4)', 1);
|
||||
});
|
||||
@ -86,7 +86,7 @@ ModuleLoader.require([
|
||||
editor.setContent('<ul><li><em><strong>12</strong></em></li></ul>');
|
||||
editor.focus();
|
||||
Utils.setSelection('strong', 1);
|
||||
InsertContent.insertAtCaret(editor, '<ul><li>a</li></ul>');
|
||||
InsertContent.insertAtCaret(editor, {content: '<ul><li>a</li></ul>', paste: true});
|
||||
equal(editor.getContent(), '<ul><li><em><strong>1</strong></em></li><li>a</li><li><em><strong>2</strong></em></li></ul>');
|
||||
assertSelection('li:nth-child(3) strong', 1);
|
||||
});
|
||||
@ -95,7 +95,7 @@ ModuleLoader.require([
|
||||
editor.setContent('<ul><li>12</li></ul>');
|
||||
editor.focus();
|
||||
Utils.setSelection('li', 0);
|
||||
InsertContent.insertAtCaret(editor, '<ul><li>a</li><li></li></ul>');
|
||||
InsertContent.insertAtCaret(editor, {content: '<ul><li>a</li><li></li></ul>', paste: true});
|
||||
equal(editor.getContent(), '<ul><li>a</li><li>12</li></ul>');
|
||||
assertSelection('li:nth-child(2)', 0);
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user