Fixes #41996 #40956
Built from https://develop.svn.wordpress.org/trunk@41604


git-svn-id: http://core.svn.wordpress.org/trunk@41439 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2017-09-26 21:15:47 +00:00
parent cb8173e053
commit b32256701a
19 changed files with 2052 additions and 1457 deletions

View File

@ -81,7 +81,7 @@ var defineGlobal = function (id, ref) {
define(id, [], function () { return ref; }); define(id, [], function () { return ref; });
}; };
/*jsc /*jsc
["tinymce.plugins.image.Plugin","tinymce.core.Env","tinymce.core.PluginManager","tinymce.core.util.JSON","tinymce.core.util.Tools","tinymce.core.util.XHR","global!tinymce.util.Tools.resolve"] ["tinymce.plugins.image.Plugin","tinymce.core.PluginManager","tinymce.core.util.Tools","tinymce.plugins.image.ui.Dialog","global!tinymce.util.Tools.resolve","global!document","global!Math","global!RegExp","tinymce.core.Env","tinymce.core.ui.Factory","tinymce.core.util.JSON","tinymce.core.util.XHR","tinymce.plugins.image.core.Uploader","tinymce.plugins.image.core.Utils","tinymce.core.util.Promise"]
jsc*/ jsc*/
defineGlobal("global!tinymce.util.Tools.resolve", tinymce.util.Tools.resolve); defineGlobal("global!tinymce.util.Tools.resolve", tinymce.util.Tools.resolve);
/** /**
@ -94,6 +94,49 @@ defineGlobal("global!tinymce.util.Tools.resolve", tinymce.util.Tools.resolve);
* Contributing: http://www.tinymce.com/contributing * Contributing: http://www.tinymce.com/contributing
*/ */
define(
'tinymce.core.PluginManager',
[
'global!tinymce.util.Tools.resolve'
],
function (resolve) {
return resolve('tinymce.PluginManager');
}
);
/**
* ResolveGlobal.js
*
* Released under LGPL License.
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
define(
'tinymce.core.util.Tools',
[
'global!tinymce.util.Tools.resolve'
],
function (resolve) {
return resolve('tinymce.util.Tools');
}
);
defineGlobal("global!document", document);
defineGlobal("global!Math", Math);
defineGlobal("global!RegExp", RegExp);
/**
* ResolveGlobal.js
*
* Released under LGPL License.
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
define( define(
'tinymce.core.Env', 'tinymce.core.Env',
[ [
@ -115,12 +158,12 @@ define(
*/ */
define( define(
'tinymce.core.PluginManager', 'tinymce.core.ui.Factory',
[ [
'global!tinymce.util.Tools.resolve' 'global!tinymce.util.Tools.resolve'
], ],
function (resolve) { function (resolve) {
return resolve('tinymce.PluginManager'); return resolve('tinymce.ui.Factory');
} }
); );
@ -155,12 +198,12 @@ define(
*/ */
define( define(
'tinymce.core.util.Tools', 'tinymce.core.util.XHR',
[ [
'global!tinymce.util.Tools.resolve' 'global!tinymce.util.Tools.resolve'
], ],
function (resolve) { function (resolve) {
return resolve('tinymce.util.Tools'); return resolve('tinymce.util.XHR');
} }
); );
@ -175,17 +218,17 @@ define(
*/ */
define( define(
'tinymce.core.util.XHR', 'tinymce.core.util.Promise',
[ [
'global!tinymce.util.Tools.resolve' 'global!tinymce.util.Tools.resolve'
], ],
function (resolve) { function (resolve) {
return resolve('tinymce.util.XHR'); return resolve('tinymce.util.Promise');
} }
); );
/** /**
* Plugin.js * Uploader.js
* *
* Released under LGPL License. * Released under LGPL License.
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
@ -195,23 +238,123 @@ define(
*/ */
/** /**
* This class contains all core logic for the image plugin. * This is basically cut down version of tinymce.core.file.Uploader, which we could use directly
* if it wasn't marked as private.
* *
* @class tinymce.image.Plugin * @class tinymce.image.core.Uploader
* @private * @private
*/ */
define( define(
'tinymce.plugins.image.Plugin', 'tinymce.plugins.image.core.Uploader',
[ [
'tinymce.core.Env', 'tinymce.core.util.Promise',
'tinymce.core.PluginManager',
'tinymce.core.util.JSON',
'tinymce.core.util.Tools', 'tinymce.core.util.Tools',
'tinymce.core.util.XHR' 'global!document'
], ],
function (Env, PluginManager, JSON, Tools, XHR) { function (Promise, Tools, document) {
PluginManager.add('image', function (editor) { return function (settings) {
function getImageSize(url, callback) { var noop = function () {};
function pathJoin(path1, path2) {
if (path1) {
return path1.replace(/\/$/, '') + '/' + path2.replace(/^\//, '');
}
return path2;
}
function defaultHandler(blobInfo, success, failure, progress) {
var xhr, formData;
xhr = new XMLHttpRequest();
xhr.open('POST', settings.url);
xhr.withCredentials = settings.credentials;
xhr.upload.onprogress = function (e) {
progress(e.loaded / e.total * 100);
};
xhr.onerror = function () {
failure("Image upload failed due to a XHR Transport error. Code: " + xhr.status);
};
xhr.onload = function () {
var json;
if (xhr.status < 200 || xhr.status >= 300) {
failure("HTTP Error: " + xhr.status);
return;
}
json = JSON.parse(xhr.responseText);
if (!json || typeof json.location != "string") {
failure("Invalid JSON: " + xhr.responseText);
return;
}
success(pathJoin(settings.basePath, json.location));
};
formData = new FormData();
formData.append('file', blobInfo.blob(), blobInfo.filename());
xhr.send(formData);
}
function uploadBlob(blobInfo, handler) {
return new Promise(function (resolve, reject) {
try {
handler(blobInfo, resolve, reject, noop);
} catch (ex) {
reject(ex.message);
}
});
}
function isDefaultHandler(handler) {
return handler === defaultHandler;
}
function upload(blobInfo) {
return (!settings.url && isDefaultHandler(settings.handler)) ? Promise.reject("Upload url missng from the settings.") : uploadBlob(blobInfo, settings.handler);
}
settings = Tools.extend({
credentials: false,
handler: defaultHandler
}, settings);
return {
upload: upload
};
};
}
);
/**
* Utils.js
*
* Released under LGPL License.
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
/**
* @class tinymce.image.core.Utils
* @private
*/
define(
'tinymce.plugins.image.core.Utils',
[
'tinymce.core.util.Tools',
'global!Math',
'global!document'
],
function (Tools, Math, document) {
var getImageSize = function (url, callback) {
var img = document.createElement('img'); var img = document.createElement('img');
function done(width, height) { function done(width, height) {
@ -238,9 +381,10 @@ define(
document.body.appendChild(img); document.body.appendChild(img);
img.src = url; img.src = url;
} };
function buildListItems(inputList, itemCallback, startItems) {
var buildListItems = function (inputList, itemCallback, startItems) {
function appendItems(values, output) { function appendItems(values, output) {
output = output || []; output = output || [];
@ -261,10 +405,99 @@ define(
} }
return appendItems(inputList, startItems || []); return appendItems(inputList, startItems || []);
} };
var removePixelSuffix = function (value) {
if (value) {
value = value.replace(/px$/, '');
}
return value;
};
var addPixelSuffix = function (value) {
if (value.length > 0 && /^[0-9]+$/.test(value)) {
value += 'px';
}
return value;
};
var mergeMargins = function (css) {
if (css.margin) {
var splitMargin = css.margin.split(" ");
switch (splitMargin.length) {
case 1: //margin: toprightbottomleft;
css['margin-top'] = css['margin-top'] || splitMargin[0];
css['margin-right'] = css['margin-right'] || splitMargin[0];
css['margin-bottom'] = css['margin-bottom'] || splitMargin[0];
css['margin-left'] = css['margin-left'] || splitMargin[0];
break;
case 2: //margin: topbottom rightleft;
css['margin-top'] = css['margin-top'] || splitMargin[0];
css['margin-right'] = css['margin-right'] || splitMargin[1];
css['margin-bottom'] = css['margin-bottom'] || splitMargin[0];
css['margin-left'] = css['margin-left'] || splitMargin[1];
break;
case 3: //margin: top rightleft bottom;
css['margin-top'] = css['margin-top'] || splitMargin[0];
css['margin-right'] = css['margin-right'] || splitMargin[1];
css['margin-bottom'] = css['margin-bottom'] || splitMargin[2];
css['margin-left'] = css['margin-left'] || splitMargin[1];
break;
case 4: //margin: top right bottom left;
css['margin-top'] = css['margin-top'] || splitMargin[0];
css['margin-right'] = css['margin-right'] || splitMargin[1];
css['margin-bottom'] = css['margin-bottom'] || splitMargin[2];
css['margin-left'] = css['margin-left'] || splitMargin[3];
}
delete css.margin;
}
return css;
};
return {
getImageSize: getImageSize,
buildListItems: buildListItems,
removePixelSuffix: removePixelSuffix,
addPixelSuffix: addPixelSuffix,
mergeMargins: mergeMargins
};
}
);
/**
* Dialog.js
*
* Released under LGPL License.
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
/**
* @class tinymce.image.ui.Dialog
* @private
*/
define(
'tinymce.plugins.image.ui.Dialog',
[
'global!document',
'global!Math',
'global!RegExp',
'tinymce.core.Env',
'tinymce.core.ui.Factory',
'tinymce.core.util.JSON',
'tinymce.core.util.Tools',
'tinymce.core.util.XHR',
'tinymce.plugins.image.core.Uploader',
'tinymce.plugins.image.core.Utils'
],
function (document, Math, RegExp, Env, Factory, JSON, Tools, XHR, Uploader, Utils) {
return function (editor) {
function createImageList(callback) { function createImageList(callback) {
return function () {
var imageList = editor.settings.image_list; var imageList = editor.settings.image_list;
if (typeof imageList == "string") { if (typeof imageList == "string") {
@ -279,12 +512,55 @@ define(
} else { } else {
callback(imageList); callback(imageList);
} }
};
} }
function showDialog(imageList) { function showDialog(imageList) {
var win, data = {}, dom = editor.dom, imgElm, figureElm; var win, data = {}, imgElm, figureElm, dom = editor.dom, settings = editor.settings;
var width, height, imageListCtrl, classListCtrl, imageDimensions = editor.settings.image_dimensions !== false; var width, height, imageListCtrl, classListCtrl, imageDimensions = settings.image_dimensions !== false;
function onFileInput() {
var Throbber = Factory.get('Throbber');
var throbber = new Throbber(win.getEl());
var file = this.value();
var uploader = new Uploader({
url: settings.images_upload_url,
basePath: settings.images_upload_base_path,
credentials: settings.images_upload_credentials,
handler: settings.images_upload_handler
});
// we do not need to add this to editors blobCache, so we fake bare minimum
var blobInfo = editor.editorUpload.blobCache.create({
blob: file,
name: file.name ? file.name.replace(/\.[^\.]+$/, '') : null, // strip extension
base64: 'data:image/fake;base64,=' // without this create() will throw exception
});
var finalize = function () {
throbber.hide();
URL.revokeObjectURL(blobInfo.blobUri()); // in theory we could fake blobUri too, but until it's legitimate, we have too revoke it manually
};
throbber.show();
return uploader.upload(blobInfo).then(function (url) {
var src = win.find('#src');
src.value(url);
win.find('tabpanel')[0].activateTab(0); // switch to General tab
src.fire('change'); // this will invoke onSrcChange (and any other handlers, if any).
finalize();
return url;
}, function (err) {
editor.windowManager.alert(err);
finalize();
});
}
function isTextBlock(node) {
return editor.schema.getTextBlockElements()[node.nodeName];
}
function recalcSize() { function recalcSize() {
var widthCtrl, heightCtrl, newWidth, newHeight; var widthCtrl, heightCtrl, newWidth, newHeight;
@ -319,8 +595,63 @@ define(
height = newHeight; height = newHeight;
} }
function onSubmitForm() { function updateStyle() {
var figureElm, oldImg; if (!editor.settings.image_advtab) {
return;
}
var data = win.toJSON(),
css = dom.parseStyle(data.style);
css = Utils.mergeMargins(css);
if (data.vspace) {
css['margin-top'] = css['margin-bottom'] = Utils.addPixelSuffix(data.vspace);
}
if (data.hspace) {
css['margin-left'] = css['margin-right'] = Utils.addPixelSuffix(data.hspace);
}
if (data.border) {
css['border-width'] = Utils.addPixelSuffix(data.border);
}
win.find('#style').value(dom.serializeStyle(dom.parseStyle(dom.serializeStyle(css))));
}
function updateVSpaceHSpaceBorder() {
if (!editor.settings.image_advtab) {
return;
}
var data = win.toJSON(),
css = dom.parseStyle(data.style);
win.find('#vspace').value("");
win.find('#hspace').value("");
css = Utils.mergeMargins(css);
//Move opposite equal margins to vspace/hspace field
if ((css['margin-top'] && css['margin-bottom']) || (css['margin-right'] && css['margin-left'])) {
if (css['margin-top'] === css['margin-bottom']) {
win.find('#vspace').value(Utils.removePixelSuffix(css['margin-top']));
} else {
win.find('#vspace').value('');
}
if (css['margin-right'] === css['margin-left']) {
win.find('#hspace').value(Utils.removePixelSuffix(css['margin-right']));
} else {
win.find('#hspace').value('');
}
}
//Move border-width
if (css['border-width']) {
win.find('#border').value(Utils.removePixelSuffix(css['border-width']));
}
win.find('#style').value(dom.serializeStyle(dom.parseStyle(dom.serializeStyle(css))));
}
function waitLoad(imgElm) { function waitLoad(imgElm) {
function selectImage() { function selectImage() {
@ -346,6 +677,9 @@ define(
imgElm.onerror = selectImage; imgElm.onerror = selectImage;
} }
function onSubmitForm() {
var figureElm, oldImg;
updateStyle(); updateStyle();
recalcSize(); recalcSize();
@ -387,9 +721,15 @@ define(
editor.undoManager.transact(function () { editor.undoManager.transact(function () {
if (!data.src) { if (!data.src) {
if (imgElm) { if (imgElm) {
dom.remove(imgElm); var elm = dom.is(imgElm.parentNode, 'figure.image') ? imgElm.parentNode : imgElm;
dom.remove(elm);
editor.focus(); editor.focus();
editor.nodeChanged(); editor.nodeChanged();
if (dom.isEmpty(editor.getBody())) {
editor.setContent('');
editor.selection.setCursorLocation();
}
} }
return; return;
@ -414,19 +754,19 @@ define(
if (data.caption === false) { if (data.caption === false) {
if (dom.is(imgElm.parentNode, 'figure.image')) { if (dom.is(imgElm.parentNode, 'figure.image')) {
figureElm = imgElm.parentNode; figureElm = imgElm.parentNode;
dom.setAttrib(imgElm, 'contenteditable', null);
dom.insertAfter(imgElm, figureElm); dom.insertAfter(imgElm, figureElm);
dom.remove(figureElm); dom.remove(figureElm);
editor.selection.select(imgElm);
editor.nodeChanged();
} }
} }
function isTextBlock(node) {
return editor.schema.getTextBlockElements()[node.nodeName];
}
if (data.caption === true) { if (data.caption === true) {
if (!dom.is(imgElm.parentNode, 'figure.image')) { if (!dom.is(imgElm.parentNode, 'figure.image')) {
oldImg = imgElm; oldImg = imgElm;
imgElm = imgElm.cloneNode(true); imgElm = imgElm.cloneNode(true);
imgElm.contentEditable = true;
figureElm = dom.create('figure', { 'class': 'image' }); figureElm = dom.create('figure', { 'class': 'image' });
figureElm.appendChild(imgElm); figureElm.appendChild(imgElm);
figureElm.appendChild(dom.create('figcaption', { contentEditable: true }, 'Caption')); figureElm.appendChild(dom.create('figcaption', { contentEditable: true }, 'Caption'));
@ -449,15 +789,7 @@ define(
}); });
} }
function removePixelSuffix(value) { function onSrcChange(e) {
if (value) {
value = value.replace(/px$/, '');
}
return value;
}
function srcChange(e) {
var srcURL, prependURL, absoluteURLPattern, meta = e.meta || {}; var srcURL, prependURL, absoluteURLPattern, meta = e.meta || {};
if (imageListCtrl) { if (imageListCtrl) {
@ -480,7 +812,7 @@ define(
this.value(srcURL); this.value(srcURL);
getImageSize(editor.documentBaseURI.toAbsolute(this.value()), function (data) { Utils.getImageSize(editor.documentBaseURI.toAbsolute(this.value()), function (data) {
if (data.width && data.height && imageDimensions) { if (data.width && data.height && imageDimensions) {
width = data.width; width = data.width;
height = data.height; height = data.height;
@ -528,7 +860,7 @@ define(
imageListCtrl = { imageListCtrl = {
type: 'listbox', type: 'listbox',
label: 'Image list', label: 'Image list',
values: buildListItems( values: Utils.buildListItems(
imageList, imageList,
function (item) { function (item) {
item.value = editor.convertURL(item.value || item.url, 'src'); item.value = editor.convertURL(item.value || item.url, 'src');
@ -557,7 +889,7 @@ define(
name: 'class', name: 'class',
type: 'listbox', type: 'listbox',
label: 'Class', label: 'Class',
values: buildListItems( values: Utils.buildListItems(
editor.settings.image_class_list, editor.settings.image_class_list,
function (item) { function (item) {
if (item.value) { if (item.value) {
@ -578,7 +910,7 @@ define(
filetype: 'image', filetype: 'image',
label: 'Source', label: 'Source',
autofocus: true, autofocus: true,
onchange: srcChange, onchange: onSrcChange,
onbeforecall: onBeforeCall onbeforecall: onBeforeCall
}, },
imageListCtrl imageListCtrl
@ -615,137 +947,32 @@ define(
generalFormItems.push({ name: 'caption', type: 'checkbox', label: 'Caption' }); generalFormItems.push({ name: 'caption', type: 'checkbox', label: 'Caption' });
} }
function mergeMargins(css) { if (editor.settings.image_advtab || editor.settings.images_upload_url) {
if (css.margin) { var body = [
{
var splitMargin = css.margin.split(" "); title: 'General',
type: 'form',
switch (splitMargin.length) { items: generalFormItems
case 1: //margin: toprightbottomleft;
css['margin-top'] = css['margin-top'] || splitMargin[0];
css['margin-right'] = css['margin-right'] || splitMargin[0];
css['margin-bottom'] = css['margin-bottom'] || splitMargin[0];
css['margin-left'] = css['margin-left'] || splitMargin[0];
break;
case 2: //margin: topbottom rightleft;
css['margin-top'] = css['margin-top'] || splitMargin[0];
css['margin-right'] = css['margin-right'] || splitMargin[1];
css['margin-bottom'] = css['margin-bottom'] || splitMargin[0];
css['margin-left'] = css['margin-left'] || splitMargin[1];
break;
case 3: //margin: top rightleft bottom;
css['margin-top'] = css['margin-top'] || splitMargin[0];
css['margin-right'] = css['margin-right'] || splitMargin[1];
css['margin-bottom'] = css['margin-bottom'] || splitMargin[2];
css['margin-left'] = css['margin-left'] || splitMargin[1];
break;
case 4: //margin: top right bottom left;
css['margin-top'] = css['margin-top'] || splitMargin[0];
css['margin-right'] = css['margin-right'] || splitMargin[1];
css['margin-bottom'] = css['margin-bottom'] || splitMargin[2];
css['margin-left'] = css['margin-left'] || splitMargin[3];
}
delete css.margin;
}
return css;
}
function updateStyle() {
function addPixelSuffix(value) {
if (value.length > 0 && /^[0-9]+$/.test(value)) {
value += 'px';
}
return value;
}
if (!editor.settings.image_advtab) {
return;
}
var data = win.toJSON(),
css = dom.parseStyle(data.style);
css = mergeMargins(css);
if (data.vspace) {
css['margin-top'] = css['margin-bottom'] = addPixelSuffix(data.vspace);
}
if (data.hspace) {
css['margin-left'] = css['margin-right'] = addPixelSuffix(data.hspace);
}
if (data.border) {
css['border-width'] = addPixelSuffix(data.border);
}
win.find('#style').value(dom.serializeStyle(dom.parseStyle(dom.serializeStyle(css))));
}
function updateVSpaceHSpaceBorder() {
if (!editor.settings.image_advtab) {
return;
}
var data = win.toJSON(),
css = dom.parseStyle(data.style);
win.find('#vspace').value("");
win.find('#hspace').value("");
css = mergeMargins(css);
//Move opposite equal margins to vspace/hspace field
if ((css['margin-top'] && css['margin-bottom']) || (css['margin-right'] && css['margin-left'])) {
if (css['margin-top'] === css['margin-bottom']) {
win.find('#vspace').value(removePixelSuffix(css['margin-top']));
} else {
win.find('#vspace').value('');
}
if (css['margin-right'] === css['margin-left']) {
win.find('#hspace').value(removePixelSuffix(css['margin-right']));
} else {
win.find('#hspace').value('');
}
}
//Move border-width
if (css['border-width']) {
win.find('#border').value(removePixelSuffix(css['border-width']));
}
win.find('#style').value(dom.serializeStyle(dom.parseStyle(dom.serializeStyle(css))));
} }
];
if (editor.settings.image_advtab) { if (editor.settings.image_advtab) {
// Parse styles from img // Parse styles from img
if (imgElm) { if (imgElm) {
if (imgElm.style.marginLeft && imgElm.style.marginRight && imgElm.style.marginLeft === imgElm.style.marginRight) { if (imgElm.style.marginLeft && imgElm.style.marginRight && imgElm.style.marginLeft === imgElm.style.marginRight) {
data.hspace = removePixelSuffix(imgElm.style.marginLeft); data.hspace = Utils.removePixelSuffix(imgElm.style.marginLeft);
} }
if (imgElm.style.marginTop && imgElm.style.marginBottom && imgElm.style.marginTop === imgElm.style.marginBottom) { if (imgElm.style.marginTop && imgElm.style.marginBottom && imgElm.style.marginTop === imgElm.style.marginBottom) {
data.vspace = removePixelSuffix(imgElm.style.marginTop); data.vspace = Utils.removePixelSuffix(imgElm.style.marginTop);
} }
if (imgElm.style.borderWidth) { if (imgElm.style.borderWidth) {
data.border = removePixelSuffix(imgElm.style.borderWidth); data.border = Utils.removePixelSuffix(imgElm.style.borderWidth);
} }
data.style = editor.dom.serializeStyle(editor.dom.parseStyle(editor.dom.getAttrib(imgElm, 'style'))); data.style = editor.dom.serializeStyle(editor.dom.parseStyle(editor.dom.getAttrib(imgElm, 'style')));
} }
// Advanced dialog shows general+advanced tabs body.push({
win = editor.windowManager.open({
title: 'Insert/edit image',
data: data,
bodyType: 'tabpanel',
body: [
{
title: 'General',
type: 'form',
items: generalFormItems
},
{
title: 'Advanced', title: 'Advanced',
type: 'form', type: 'form',
pack: 'start', pack: 'start',
@ -775,8 +1002,58 @@ define(
] ]
} }
] ]
});
} }
],
if (editor.settings.images_upload_url) {
var acceptExts = '.jpg,.jpeg,.png,.gif';
var uploadTab = {
title: 'Upload',
type: 'form',
layout: 'flex',
direction: 'column',
align: 'stretch',
padding: '20 20 20 20',
items: [
{
type: 'container',
layout: 'flex',
direction: 'column',
align: 'center',
spacing: 10,
items: [
{
text: "Browse for an image",
type: 'browsebutton',
accept: acceptExts,
onchange: onFileInput
},
{
text: 'OR',
type: 'label'
}
]
},
{
text: "Drop an image here",
type: 'dropzone',
accept: acceptExts,
height: 100,
onchange: onFileInput
}
]
};
body.push(uploadTab);
}
// Advanced dialog shows general+advanced tabs
win = editor.windowManager.open({
title: 'Insert/edit image',
data: data,
bodyType: 'tabpanel',
body: body,
onSubmit: onSubmitForm onSubmit: onSubmitForm
}); });
} else { } else {
@ -790,6 +1067,43 @@ define(
} }
} }
function open() {
createImageList(showDialog);
}
return {
open: open
};
};
}
);
/**
* Plugin.js
*
* Released under LGPL License.
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
/**
* This class contains all core logic for the image plugin.
*
* @class tinymce.image.Plugin
* @private
*/
define(
'tinymce.plugins.image.Plugin',
[
'tinymce.core.PluginManager',
'tinymce.core.util.Tools',
'tinymce.plugins.image.ui.Dialog'
],
function (PluginManager, Tools, Dialog) {
PluginManager.add('image', function (editor) {
editor.on('preInit', function () { editor.on('preInit', function () {
function hasImageClass(node) { function hasImageClass(node) {
var className = node.attr('class'); var className = node.attr('class');
@ -810,6 +1124,7 @@ define(
if (hasImageClass(node)) { if (hasImageClass(node)) {
node.attr('contenteditable', state ? 'false' : null); node.attr('contenteditable', state ? 'false' : null);
Tools.each(node.getAll('figcaption'), toggleContentEditable); Tools.each(node.getAll('figcaption'), toggleContentEditable);
Tools.each(node.getAll('img'), toggleContentEditable);
} }
} }
}; };
@ -822,19 +1137,19 @@ define(
editor.addButton('image', { editor.addButton('image', {
icon: 'image', icon: 'image',
tooltip: 'Insert/edit image', tooltip: 'Insert/edit image',
onclick: createImageList(showDialog), onclick: Dialog(editor).open,
stateSelector: 'img:not([data-mce-object],[data-mce-placeholder]),figure.image' stateSelector: 'img:not([data-mce-object],[data-mce-placeholder]),figure.image'
}); });
editor.addMenuItem('image', { editor.addMenuItem('image', {
icon: 'image', icon: 'image',
text: 'Image', text: 'Image',
onclick: createImageList(showDialog), onclick: Dialog(editor).open,
context: 'insert', context: 'insert',
prependToContext: true prependToContext: true
}); });
editor.addCommand('mceImage', createImageList(showDialog)); editor.addCommand('mceImage', Dialog(editor).open);
}); });
return function () { }; return function () { };

File diff suppressed because one or more lines are too long

View File

@ -286,22 +286,26 @@ define(
function (Tools, Settings, RegExp) { function (Tools, Settings, RegExp) {
var toggleTargetRules = function (rel, isUnsafe) { var toggleTargetRules = function (rel, isUnsafe) {
var rules = 'noopener'; var rules = ['noopener'];
var newRel = rel ? rel.split(/\s+/) : [];
var toString = function (rel) {
return Tools.trim(rel.sort().join(' '));
};
var addTargetRules = function (rel) { var addTargetRules = function (rel) {
rel = removeTargetRules(rel); rel = removeTargetRules(rel);
return rel ? [rel, rules].join(' ') : rules; return rel.length ? rel.concat(rules) : rules;
}; };
var removeTargetRules = function (rel) { var removeTargetRules = function (rel) {
var regExp = new RegExp('(' + rules.replace(' ', '|') + ')', 'g'); return rel.filter(function (val) {
if (rel) { return Tools.inArray(rules, val) === -1;
rel = Tools.trim(rel.replace(regExp, '')); });
}
return rel ? rel : null;
}; };
return isUnsafe ? addTargetRules(rel) : removeTargetRules(rel); newRel = isUnsafe ? addTargetRules(newRel) : removeTargetRules(newRel);
return newRel.length ? toString(newRel) : null;
}; };
@ -365,7 +369,7 @@ define(
title: data.title ? data.title : null title: data.title ? data.title : null
}; };
if (Settings.allowUnsafeLinkTarget(editor.settings) === false) { if (!Settings.hasRelList(editor.settings) && Settings.allowUnsafeLinkTarget(editor.settings) === false) {
linkAttrs.rel = toggleTargetRules(linkAttrs.rel, linkAttrs.target == '_blank'); linkAttrs.rel = toggleTargetRules(linkAttrs.rel, linkAttrs.target == '_blank');
} }
@ -447,7 +451,8 @@ define(
hasLinks: hasLinks, hasLinks: hasLinks,
isOnlyTextSelected: isOnlyTextSelected, isOnlyTextSelected: isOnlyTextSelected,
getAnchorElement: getAnchorElement, getAnchorElement: getAnchorElement,
getAnchorText: getAnchorText getAnchorText: getAnchorText,
toggleTargetRules: toggleTargetRules
}; };
} }
); );
@ -691,7 +696,14 @@ define(
name: 'rel', name: 'rel',
type: 'listbox', type: 'listbox',
label: 'Rel', label: 'Rel',
values: buildListItems(Settings.getRelList(editor.settings)) values: buildListItems(
Settings.getRelList(editor.settings),
function (item) {
if (Settings.allowUnsafeLinkTarget(editor.settings) === false) {
item.value = Utils.toggleTargetRules(item.value, data.target === '_blank');
}
}
)
}; };
} }

File diff suppressed because one or more lines are too long

View File

@ -81,7 +81,7 @@ var defineGlobal = function (id, ref) {
define(id, [], function () { return ref; }); define(id, [], function () { return ref; });
}; };
/*jsc /*jsc
["tinymce.plugins.lists.Plugin","tinymce.core.PluginManager","tinymce.core.util.Tools","tinymce.core.util.VK","tinymce.plugins.lists.actions.Indent","tinymce.plugins.lists.actions.Outdent","tinymce.plugins.lists.actions.ToggleList","tinymce.plugins.lists.core.Delete","tinymce.plugins.lists.core.NodeType","global!tinymce.util.Tools.resolve","tinymce.core.dom.DOMUtils","tinymce.plugins.lists.core.Bookmark","tinymce.plugins.lists.core.Selection","tinymce.plugins.lists.core.NormalizeLists","tinymce.plugins.lists.core.SplitList","tinymce.plugins.lists.core.TextBlock","tinymce.core.dom.BookmarkManager","tinymce.core.dom.RangeUtils","tinymce.core.dom.TreeWalker","tinymce.plugins.lists.core.Range","tinymce.core.Env"] ["tinymce.plugins.lists.Plugin","tinymce.core.PluginManager","tinymce.core.util.Tools","tinymce.core.util.VK","tinymce.plugins.lists.actions.Indent","tinymce.plugins.lists.actions.Outdent","tinymce.plugins.lists.actions.ToggleList","tinymce.plugins.lists.core.Delete","tinymce.plugins.lists.core.NodeType","tinymce.plugins.lists.core.Selection","global!tinymce.util.Tools.resolve","tinymce.core.dom.DOMUtils","tinymce.plugins.lists.core.Bookmark","tinymce.core.dom.DomQuery","tinymce.plugins.lists.core.NormalizeLists","tinymce.plugins.lists.core.SplitList","tinymce.plugins.lists.core.TextBlock","tinymce.core.dom.BookmarkManager","tinymce.core.dom.RangeUtils","tinymce.core.dom.TreeWalker","tinymce.plugins.lists.core.Range","tinymce.core.Env"]
jsc*/ jsc*/
defineGlobal("global!tinymce.util.Tools.resolve", tinymce.util.Tools.resolve); defineGlobal("global!tinymce.util.Tools.resolve", tinymce.util.Tools.resolve);
/** /**
@ -207,6 +207,10 @@ define(
return node && !!editor.schema.getTextBlockElements()[node.nodeName]; return node && !!editor.schema.getTextBlockElements()[node.nodeName];
}; };
var isBlock = function (node, blockElements) {
return node && node.nodeName in blockElements;
};
var isBogusBr = function (dom, node) { var isBogusBr = function (dom, node) {
if (!isBr(node)) { if (!isBr(node)) {
return false; return false;
@ -241,6 +245,7 @@ define(
isFirstChild: isFirstChild, isFirstChild: isFirstChild,
isLastChild: isLastChild, isLastChild: isLastChild,
isTextBlock: isTextBlock, isTextBlock: isTextBlock,
isBlock: isBlock,
isBogusBr: isBogusBr, isBogusBr: isBogusBr,
isEmpty: isEmpty, isEmpty: isEmpty,
isChildOfBody: isChildOfBody isChildOfBody: isChildOfBody
@ -451,6 +456,26 @@ define(
); );
/**
* ResolveGlobal.js
*
* Released under LGPL License.
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
define(
'tinymce.core.dom.DomQuery',
[
'global!tinymce.util.Tools.resolve'
],
function (resolve) {
return resolve('tinymce.dom.DomQuery');
}
);
/** /**
* Selection.js * Selection.js
* *
@ -464,17 +489,42 @@ define(
define( define(
'tinymce.plugins.lists.core.Selection', 'tinymce.plugins.lists.core.Selection',
[ [
'tinymce.core.dom.DomQuery',
'tinymce.core.util.Tools', 'tinymce.core.util.Tools',
'tinymce.plugins.lists.core.NodeType' 'tinymce.plugins.lists.core.NodeType'
], ],
function (Tools, NodeType) { function (DomQuery, Tools, NodeType) {
var getParentList = function (editor) {
return editor.dom.getParent(editor.selection.getStart(true), 'OL,UL,DL');
};
var getSelectedSubLists = function (editor) {
var parentList = getParentList(editor);
return Tools.grep(editor.selection.getSelectedBlocks(), function (elm) {
return NodeType.isListNode(elm) && parentList !== elm;
});
};
var findParentListItemsNodes = function (editor, elms) {
var listItemsElms = Tools.map(elms, function (elm) {
var parentLi = editor.dom.getParent(elm, 'li,dd,dt', editor.getBody());
return parentLi ? parentLi : elm;
});
return DomQuery.unique(listItemsElms);
};
var getSelectedListItems = function (editor) { var getSelectedListItems = function (editor) {
return Tools.grep(editor.selection.getSelectedBlocks(), function (block) { var selectedBlocks = editor.selection.getSelectedBlocks();
return Tools.grep(findParentListItemsNodes(editor, selectedBlocks), function (block) {
return NodeType.isListItemNode(block); return NodeType.isListItemNode(block);
}); });
}; };
return { return {
getParentList: getParentList,
getSelectedSubLists: getSelectedSubLists,
getSelectedListItems: getSelectedListItems getSelectedListItems: getSelectedListItems
}; };
} }
@ -682,9 +732,10 @@ define(
'tinymce.plugins.lists.core.TextBlock', 'tinymce.plugins.lists.core.TextBlock',
[ [
'tinymce.core.dom.DOMUtils', 'tinymce.core.dom.DOMUtils',
'tinymce.core.Env' 'tinymce.core.Env',
'tinymce.plugins.lists.core.NodeType'
], ],
function (DOMUtils, Env) { function (DOMUtils, Env, NodeType) {
var DOM = DOMUtils.DOM; var DOM = DOMUtils.DOM;
var createNewTextBlock = function (editor, contentNode, blockName) { var createNewTextBlock = function (editor, contentNode, blockName) {
@ -702,8 +753,10 @@ define(
DOM.setAttribs(textBlock, editor.settings.forced_root_block_attrs); DOM.setAttribs(textBlock, editor.settings.forced_root_block_attrs);
} }
if (!NodeType.isBlock(contentNode.firstChild, blockElements)) {
fragment.appendChild(textBlock); fragment.appendChild(textBlock);
} }
}
if (contentNode) { if (contentNode) {
while ((node = contentNode.firstChild)) { while ((node = contentNode.firstChild)) {
@ -713,7 +766,7 @@ define(
hasContentNode = true; hasContentNode = true;
} }
if (blockElements[nodeName]) { if (NodeType.isBlock(node, blockElements)) {
fragment.appendChild(node); fragment.appendChild(node);
textBlock = null; textBlock = null;
} else { } else {
@ -1230,17 +1283,40 @@ define(
} }
}; };
var toggleList = function (editor, listName, detail) { var updateList = function (dom, list, listName, detail) {
var parentList = editor.dom.getParent(editor.selection.getStart(), 'OL,UL,DL'); if (list.nodeName !== listName) {
var newList = dom.rename(list, listName);
updateListWithDetails(dom, newList, detail);
} else {
updateListWithDetails(dom, list, detail);
}
};
detail = detail ? detail : {}; var toggleMultipleLists = function (editor, parentList, lists, listName, detail) {
if (parentList.nodeName === listName && !hasListStyleDetail(detail)) {
removeList(editor, listName);
} else {
var bookmark = Bookmark.createBookmark(editor.selection.getRng(true));
Tools.each([parentList].concat(lists), function (elm) {
updateList(editor.dom, elm, listName, detail);
});
editor.selection.setRng(Bookmark.resolveBookmark(bookmark));
}
};
var hasListStyleDetail = function (detail) {
return 'list-style-type' in detail;
};
var toggleSingleList = function (editor, parentList, listName, detail) {
if (parentList === editor.getBody()) { if (parentList === editor.getBody()) {
return; return;
} }
if (parentList) { if (parentList) {
if (parentList.nodeName === listName) { if (parentList.nodeName === listName && !hasListStyleDetail(detail)) {
removeList(editor, listName); removeList(editor, listName);
} else { } else {
var bookmark = Bookmark.createBookmark(editor.selection.getRng(true)); var bookmark = Bookmark.createBookmark(editor.selection.getRng(true));
@ -1253,6 +1329,19 @@ define(
} }
}; };
var toggleList = function (editor, listName, detail) {
var parentList = Selection.getParentList(editor);
var selectedSubLists = Selection.getSelectedSubLists(editor);
detail = detail ? detail : {};
if (parentList && selectedSubLists.length > 0) {
toggleMultipleLists(editor, parentList, selectedSubLists, listName, detail);
} else {
toggleSingleList(editor, parentList, listName, detail);
}
};
return { return {
toggleList: toggleList, toggleList: toggleList,
removeList: removeList, removeList: removeList,
@ -1343,6 +1432,30 @@ define(
} }
}; };
var hasOnlyOneBlockChild = function (dom, elm) {
var childNodes = elm.childNodes;
return childNodes.length === 1 && !NodeType.isListNode(childNodes[0]) && dom.isBlock(childNodes[0]);
};
var unwrapSingleBlockChild = function (dom, elm) {
if (hasOnlyOneBlockChild(dom, elm)) {
dom.remove(elm.firstChild, true);
}
};
var moveChildren = function (dom, fromElm, toElm) {
var node, targetElm;
targetElm = hasOnlyOneBlockChild(dom, toElm) ? toElm.firstChild : toElm;
unwrapSingleBlockChild(dom, fromElm);
if (!NodeType.isEmpty(dom, fromElm, true)) {
while ((node = fromElm.firstChild)) {
targetElm.appendChild(node);
}
}
};
var mergeLiElements = function (dom, fromElm, toElm) { var mergeLiElements = function (dom, fromElm, toElm) {
var node, listNode, ul = fromElm.parentNode; var node, listNode, ul = fromElm.parentNode;
@ -1369,11 +1482,7 @@ define(
dom.$(toElm).empty(); dom.$(toElm).empty();
} }
if (!NodeType.isEmpty(dom, fromElm, true)) { moveChildren(dom, fromElm, toElm);
while ((node = fromElm.firstChild)) {
toElm.appendChild(node);
}
}
if (listNode) { if (listNode) {
toElm.appendChild(listNode); toElm.appendChild(listNode);
@ -1386,6 +1495,30 @@ define(
} }
}; };
var mergeIntoEmptyLi = function (editor, fromLi, toLi) {
editor.dom.$(toLi).empty();
mergeLiElements(editor.dom, fromLi, toLi);
editor.selection.setCursorLocation(toLi);
};
var mergeForward = function (editor, rng, fromLi, toLi) {
var dom = editor.dom;
if (dom.isEmpty(toLi)) {
mergeIntoEmptyLi(editor, fromLi, toLi);
} else {
var bookmark = Bookmark.createBookmark(rng);
mergeLiElements(dom, fromLi, toLi);
editor.selection.setRng(Bookmark.resolveBookmark(bookmark));
}
};
var mergeBackward = function (editor, rng, fromLi, toLi) {
var bookmark = Bookmark.createBookmark(rng);
mergeLiElements(editor.dom, fromLi, toLi);
editor.selection.setRng(Bookmark.resolveBookmark(bookmark));
};
var backspaceDeleteFromListToListCaret = function (editor, isForward) { var backspaceDeleteFromListToListCaret = function (editor, isForward) {
var dom = editor.dom, selection = editor.selection; var dom = editor.dom, selection = editor.selection;
var li = dom.getParent(selection.getStart(), 'LI'), ul, rng, otherLi; var li = dom.getParent(selection.getStart(), 'LI'), ul, rng, otherLi;
@ -1400,16 +1533,12 @@ define(
otherLi = dom.getParent(findNextCaretContainer(editor, rng, isForward), 'LI'); otherLi = dom.getParent(findNextCaretContainer(editor, rng, isForward), 'LI');
if (otherLi && otherLi !== li) { if (otherLi && otherLi !== li) {
var bookmark = Bookmark.createBookmark(rng);
if (isForward) { if (isForward) {
mergeLiElements(dom, otherLi, li); mergeForward(editor, rng, otherLi, li);
} else { } else {
mergeLiElements(dom, li, otherLi); mergeBackward(editor, rng, li, otherLi);
} }
editor.selection.setRng(Bookmark.resolveBookmark(bookmark));
return true; return true;
} else if (!otherLi) { } else if (!otherLi) {
if (!isForward && ToggleList.removeList(editor, ul.nodeName)) { if (!isForward && ToggleList.removeList(editor, ul.nodeName)) {
@ -1421,6 +1550,15 @@ define(
return false; return false;
}; };
var removeBlock = function (dom, block) {
var parentBlock = dom.getParent(block.parentNode, dom.isBlock);
dom.remove(block);
if (parentBlock && dom.isEmpty(parentBlock)) {
dom.remove(parentBlock);
}
};
var backspaceDeleteIntoListCaret = function (editor, isForward) { var backspaceDeleteIntoListCaret = function (editor, isForward) {
var dom = editor.dom; var dom = editor.dom;
var block = dom.getParent(editor.selection.getStart(), dom.isBlock); var block = dom.getParent(editor.selection.getStart(), dom.isBlock);
@ -1431,7 +1569,7 @@ define(
if (otherLi) { if (otherLi) {
editor.undoManager.transact(function () { editor.undoManager.transact(function () {
dom.remove(block); removeBlock(dom, block);
ToggleList.mergeWithAdjacentLists(dom, otherLi.parentNode); ToggleList.mergeWithAdjacentLists(dom, otherLi.parentNode);
editor.selection.select(otherLi, true); editor.selection.select(otherLi, true);
editor.selection.collapse(isForward); editor.selection.collapse(isForward);
@ -1509,9 +1647,10 @@ define(
'tinymce.plugins.lists.actions.Outdent', 'tinymce.plugins.lists.actions.Outdent',
'tinymce.plugins.lists.actions.ToggleList', 'tinymce.plugins.lists.actions.ToggleList',
'tinymce.plugins.lists.core.Delete', 'tinymce.plugins.lists.core.Delete',
'tinymce.plugins.lists.core.NodeType' 'tinymce.plugins.lists.core.NodeType',
'tinymce.plugins.lists.core.Selection'
], ],
function (PluginManager, Tools, VK, Indent, Outdent, ToggleList, Delete, NodeType) { function (PluginManager, Tools, VK, Indent, Outdent, ToggleList, Delete, NodeType, Selection) {
var queryListCommandState = function (editor, listName) { var queryListCommandState = function (editor, listName) {
return function () { return function () {
var parentList = editor.dom.getParent(editor.selection.getStart(), 'UL,OL,DL'); var parentList = editor.dom.getParent(editor.selection.getStart(), 'UL,OL,DL');
@ -1617,15 +1756,8 @@ define(
var ctrl = e.control; var ctrl = e.control;
editor.on('nodechange', function () { editor.on('nodechange', function () {
var blocks = editor.selection.getSelectedBlocks(); var listItemBlocks = Selection.getSelectedListItems(editor);
var disable = false; var disable = listItemBlocks.length > 0 && NodeType.isFirstChild(listItemBlocks[0]);
for (var i = 0, l = blocks.length; !disable && i < l; i++) {
var tag = blocks[i].nodeName;
disable = (tag === 'LI' && NodeType.isFirstChild(blocks[i]) || tag === 'UL' || tag === 'OL' || tag === 'DD');
}
ctrl.disabled(disable); ctrl.disabled(disable);
}); });
} }

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
.mce-content-body .mce-reset{margin:0;padding:0;border:0;outline:0;vertical-align:top;background:transparent;text-decoration:none;color:black;font-family:Arial;font-size:11px;text-shadow:none;float:none;position:static;width:auto;height:auto;white-space:nowrap;cursor:inherit;line-height:normal;font-weight:normal;text-align:left;-webkit-tap-highlight-color:transparent;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box;direction:ltr;max-width:none}.mce-object{border:1px dotted #3A3A3A;background:#D5D5D5 url(img/object.gif) no-repeat center}.mce-preview-object{display:inline-block;position:relative;margin:0 2px 0 2px;line-height:0;border:1px solid gray}.mce-preview-object[data-mce-selected="2"] .mce-shim{display:none}.mce-preview-object .mce-shim{position:absolute;top:0;left:0;width:100%;height:100%;background:url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)}figure.align-left{float:left}figure.align-right{float:right}figure.image.align-center{display:table;margin-left:auto;margin-right:auto}figure.image{display:inline-block;border:1px solid gray;margin:0 2px 0 1px;background:#f5f2f0}figure.image img{margin:8px 8px 0 8px}figure.image figcaption{margin:6px 8px 6px 8px;text-align:center}.mce-toc{border:1px solid gray}.mce-toc h2{margin:4px}.mce-toc li{list-style-type:none}.mce-pagebreak{cursor:default;display:block;border:0;width:100%;height:5px;border:1px dashed #666;margin-top:15px;page-break-before:always}@media print{.mce-pagebreak{border:0}}.mce-item-anchor{cursor:default;display:inline-block;-webkit-user-select:all;-webkit-user-modify:read-only;-moz-user-select:all;-moz-user-modify:read-only;user-select:all;user-modify:read-only;width:9px !important;height:9px !important;border:1px dotted #3A3A3A;background:#D5D5D5 url(img/anchor.gif) no-repeat center}.mce-nbsp,.mce-shy{background:#AAA}.mce-shy::after{content:'-'}.mce-match-marker{background:#AAA;color:#fff}.mce-match-marker-selected{background:#3399ff;color:#fff}.mce-spellchecker-word{border-bottom:2px solid #F00;cursor:default}.mce-spellchecker-grammar{border-bottom:2px solid #008000;cursor:default}.mce-item-table,.mce-item-table td,.mce-item-table th,.mce-item-table caption{border:1px dashed #BBB}td[data-mce-selected],th[data-mce-selected]{background-color:#3399ff !important}.mce-edit-focus{outline:1px dotted #333}.mce-resize-bar-dragging{background-color:blue;opacity:.25;filter:alpha(opacity=25);zoom:1}.mce-content-body p,.mce-content-body div,.mce-content-body h1,.mce-content-body h2,.mce-content-body h3,.mce-content-body h4,.mce-content-body h5,.mce-content-body h6{line-height:1.2em}.mce-content-body *[contentEditable=false] *[contentEditable=true]:focus{outline:2px solid #2d8ac7}.mce-content-body *[contentEditable=false] *[contentEditable=true]:hover{outline:2px solid #7ACAFF}.mce-content-body *[contentEditable=false][data-mce-selected]{outline:2px solid #2d8ac7}.mce-content-body a[data-mce-selected],.mce-content-body code[data-mce-selected]{background:#bfe6ff}.mce-content-body hr{cursor:default} .word-wrap{word-wrap:break-word;-ms-word-break:break-all;word-break:break-all;word-break:break-word;-ms-hyphens:auto;-moz-hyphens:auto;-webkit-hyphens:auto;hyphens:auto}.mce-content-body .mce-reset{margin:0;padding:0;border:0;outline:0;vertical-align:top;background:transparent;text-decoration:none;color:black;font-family:Arial;font-size:11px;text-shadow:none;float:none;position:static;width:auto;height:auto;white-space:nowrap;cursor:inherit;line-height:normal;font-weight:normal;text-align:left;-webkit-tap-highlight-color:transparent;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box;direction:ltr;max-width:none}.mce-object{border:1px dotted #3A3A3A;background:#D5D5D5 url(img/object.gif) no-repeat center}.mce-preview-object{display:inline-block;position:relative;margin:0 2px 0 2px;line-height:0;border:1px solid gray}.mce-preview-object[data-mce-selected="2"] .mce-shim{display:none}.mce-preview-object .mce-shim{position:absolute;top:0;left:0;width:100%;height:100%;background:url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)}figure.align-left{float:left}figure.align-right{float:right}figure.image.align-center{display:table;margin-left:auto;margin-right:auto}figure.image{display:inline-block;border:1px solid gray;margin:0 2px 0 1px;background:#f5f2f0}figure.image img{margin:8px 8px 0 8px}figure.image figcaption{margin:6px 8px 6px 8px;text-align:center}.mce-toc{border:1px solid gray}.mce-toc h2{margin:4px}.mce-toc li{list-style-type:none}.mce-pagebreak{cursor:default;display:block;border:0;width:100%;height:5px;border:1px dashed #666;margin-top:15px;page-break-before:always}@media print{.mce-pagebreak{border:0}}.mce-item-anchor{cursor:default;display:inline-block;-webkit-user-select:all;-webkit-user-modify:read-only;-moz-user-select:all;-moz-user-modify:read-only;user-select:all;user-modify:read-only;width:9px !important;height:9px !important;border:1px dotted #3A3A3A;background:#D5D5D5 url(img/anchor.gif) no-repeat center}.mce-nbsp,.mce-shy{background:#AAA}.mce-shy::after{content:'-'}.mce-match-marker{background:#AAA;color:#fff}.mce-match-marker-selected{background:#3399ff;color:#fff}.mce-spellchecker-word{border-bottom:2px solid #F00;cursor:default}.mce-spellchecker-grammar{border-bottom:2px solid #008000;cursor:default}.mce-item-table,.mce-item-table td,.mce-item-table th,.mce-item-table caption{border:1px dashed #BBB}td[data-mce-selected],th[data-mce-selected]{background-color:#3399ff !important}.mce-edit-focus{outline:1px dotted #333}.mce-resize-bar-dragging{background-color:blue;opacity:.25;filter:alpha(opacity=25);zoom:1}.mce-content-body *[contentEditable=false] *[contentEditable=true]:focus{outline:2px solid #2d8ac7}.mce-content-body *[contentEditable=false] *[contentEditable=true]:hover{outline:2px solid #7ACAFF}.mce-content-body *[contentEditable=false][data-mce-selected]{outline:2px solid #2d8ac7}.mce-content-body a[data-mce-selected],.mce-content-body code[data-mce-selected],.mce-content-body b[data-mce-selected],.mce-content-body i[data-mce-selected],.mce-content-body em[data-mce-selected],.mce-content-body strong[data-mce-selected],.mce-content-body sup[data-mce-selected],.mce-content-body sub[data-mce-selected]{background:#bfe6ff}.mce-content-body hr{cursor:default}.mce-content-body{line-height:1.3}

View File

@ -1 +1 @@
body{background-color:#FFFFFF;color:#000000;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:14px;scrollbar-3dlight-color:#F0F0EE;scrollbar-arrow-color:#676662;scrollbar-base-color:#F0F0EE;scrollbar-darkshadow-color:#DDDDDD;scrollbar-face-color:#E0E0DD;scrollbar-highlight-color:#F0F0EE;scrollbar-shadow-color:#F0F0EE;scrollbar-track-color:#F5F5F5}td,th{font-family:Verdana,Arial,Helvetica,sans-serif;font-size:14px}.mce-content-body .mce-reset{margin:0;padding:0;border:0;outline:0;vertical-align:top;background:transparent;text-decoration:none;color:black;font-family:Arial;font-size:11px;text-shadow:none;float:none;position:static;width:auto;height:auto;white-space:nowrap;cursor:inherit;line-height:normal;font-weight:normal;text-align:left;-webkit-tap-highlight-color:transparent;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box;direction:ltr;max-width:none}.mce-object{border:1px dotted #3A3A3A;background:#D5D5D5 url(img/object.gif) no-repeat center}.mce-preview-object{display:inline-block;position:relative;margin:0 2px 0 2px;line-height:0;border:1px solid gray}.mce-preview-object[data-mce-selected="2"] .mce-shim{display:none}.mce-preview-object .mce-shim{position:absolute;top:0;left:0;width:100%;height:100%;background:url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)}figure.align-left{float:left}figure.align-right{float:right}figure.image.align-center{display:table;margin-left:auto;margin-right:auto}figure.image{display:inline-block;border:1px solid gray;margin:0 2px 0 1px;background:#f5f2f0}figure.image img{margin:8px 8px 0 8px}figure.image figcaption{margin:6px 8px 6px 8px;text-align:center}.mce-toc{border:1px solid gray}.mce-toc h2{margin:4px}.mce-toc li{list-style-type:none}.mce-pagebreak{cursor:default;display:block;border:0;width:100%;height:5px;border:1px dashed #666;margin-top:15px;page-break-before:always}@media print{.mce-pagebreak{border:0}}.mce-item-anchor{cursor:default;display:inline-block;-webkit-user-select:all;-webkit-user-modify:read-only;-moz-user-select:all;-moz-user-modify:read-only;user-select:all;user-modify:read-only;width:9px !important;height:9px !important;border:1px dotted #3A3A3A;background:#D5D5D5 url(img/anchor.gif) no-repeat center}.mce-nbsp,.mce-shy{background:#AAA}.mce-shy::after{content:'-'}.mce-match-marker{background:#AAA;color:#fff}.mce-match-marker-selected{background:#3399ff;color:#fff}.mce-spellchecker-word{border-bottom:2px solid #F00;cursor:default}.mce-spellchecker-grammar{border-bottom:2px solid #008000;cursor:default}.mce-item-table,.mce-item-table td,.mce-item-table th,.mce-item-table caption{border:1px dashed #BBB}td[data-mce-selected],th[data-mce-selected]{background-color:#3399ff !important}.mce-edit-focus{outline:1px dotted #333}.mce-resize-bar-dragging{background-color:blue;opacity:.25;filter:alpha(opacity=25);zoom:1}.mce-content-body p,.mce-content-body div,.mce-content-body h1,.mce-content-body h2,.mce-content-body h3,.mce-content-body h4,.mce-content-body h5,.mce-content-body h6{line-height:1.2em}.mce-content-body *[contentEditable=false] *[contentEditable=true]:focus{outline:2px solid #2d8ac7}.mce-content-body *[contentEditable=false] *[contentEditable=true]:hover{outline:2px solid #7ACAFF}.mce-content-body *[contentEditable=false][data-mce-selected]{outline:2px solid #2d8ac7}.mce-content-body a[data-mce-selected],.mce-content-body code[data-mce-selected]{background:#bfe6ff}.mce-content-body hr{cursor:default} body{background-color:#FFFFFF;color:#000000;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:14px;line-height:1.3;scrollbar-3dlight-color:#F0F0EE;scrollbar-arrow-color:#676662;scrollbar-base-color:#F0F0EE;scrollbar-darkshadow-color:#DDDDDD;scrollbar-face-color:#E0E0DD;scrollbar-highlight-color:#F0F0EE;scrollbar-shadow-color:#F0F0EE;scrollbar-track-color:#F5F5F5}td,th{font-family:Verdana,Arial,Helvetica,sans-serif;font-size:14px}.word-wrap{word-wrap:break-word;-ms-word-break:break-all;word-break:break-all;word-break:break-word;-ms-hyphens:auto;-moz-hyphens:auto;-webkit-hyphens:auto;hyphens:auto}.mce-content-body .mce-reset{margin:0;padding:0;border:0;outline:0;vertical-align:top;background:transparent;text-decoration:none;color:black;font-family:Arial;font-size:11px;text-shadow:none;float:none;position:static;width:auto;height:auto;white-space:nowrap;cursor:inherit;line-height:normal;font-weight:normal;text-align:left;-webkit-tap-highlight-color:transparent;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box;direction:ltr;max-width:none}.mce-object{border:1px dotted #3A3A3A;background:#D5D5D5 url(img/object.gif) no-repeat center}.mce-preview-object{display:inline-block;position:relative;margin:0 2px 0 2px;line-height:0;border:1px solid gray}.mce-preview-object[data-mce-selected="2"] .mce-shim{display:none}.mce-preview-object .mce-shim{position:absolute;top:0;left:0;width:100%;height:100%;background:url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)}figure.align-left{float:left}figure.align-right{float:right}figure.image.align-center{display:table;margin-left:auto;margin-right:auto}figure.image{display:inline-block;border:1px solid gray;margin:0 2px 0 1px;background:#f5f2f0}figure.image img{margin:8px 8px 0 8px}figure.image figcaption{margin:6px 8px 6px 8px;text-align:center}.mce-toc{border:1px solid gray}.mce-toc h2{margin:4px}.mce-toc li{list-style-type:none}.mce-pagebreak{cursor:default;display:block;border:0;width:100%;height:5px;border:1px dashed #666;margin-top:15px;page-break-before:always}@media print{.mce-pagebreak{border:0}}.mce-item-anchor{cursor:default;display:inline-block;-webkit-user-select:all;-webkit-user-modify:read-only;-moz-user-select:all;-moz-user-modify:read-only;user-select:all;user-modify:read-only;width:9px !important;height:9px !important;border:1px dotted #3A3A3A;background:#D5D5D5 url(img/anchor.gif) no-repeat center}.mce-nbsp,.mce-shy{background:#AAA}.mce-shy::after{content:'-'}.mce-match-marker{background:#AAA;color:#fff}.mce-match-marker-selected{background:#3399ff;color:#fff}.mce-spellchecker-word{border-bottom:2px solid #F00;cursor:default}.mce-spellchecker-grammar{border-bottom:2px solid #008000;cursor:default}.mce-item-table,.mce-item-table td,.mce-item-table th,.mce-item-table caption{border:1px dashed #BBB}td[data-mce-selected],th[data-mce-selected]{background-color:#3399ff !important}.mce-edit-focus{outline:1px dotted #333}.mce-resize-bar-dragging{background-color:blue;opacity:.25;filter:alpha(opacity=25);zoom:1}.mce-content-body *[contentEditable=false] *[contentEditable=true]:focus{outline:2px solid #2d8ac7}.mce-content-body *[contentEditable=false] *[contentEditable=true]:hover{outline:2px solid #7ACAFF}.mce-content-body *[contentEditable=false][data-mce-selected]{outline:2px solid #2d8ac7}.mce-content-body a[data-mce-selected],.mce-content-body code[data-mce-selected],.mce-content-body b[data-mce-selected],.mce-content-body i[data-mce-selected],.mce-content-body em[data-mce-selected],.mce-content-body strong[data-mce-selected],.mce-content-body sup[data-mce-selected],.mce-content-body sub[data-mce-selected]{background:#bfe6ff}.mce-content-body hr{cursor:default}

File diff suppressed because one or more lines are too long

View File

@ -21,18 +21,6 @@ body {
word-wrap: break-word; /* Old syntax */ word-wrap: break-word; /* Old syntax */
} }
/* Changed in 4.6.0, see https://core.trac.wordpress.org/ticket/40743 */
.mce-content-body p,
.mce-content-body div,
.mce-content-body h1,
.mce-content-body h2,
.mce-content-body h3,
.mce-content-body h4,
.mce-content-body h5,
.mce-content-body h6 {
line-height: inherit;
}
body.rtl { body.rtl {
font-family: Tahoma, "Times New Roman", "Bitstream Charter", Times, serif; font-family: Tahoma, "Times New Roman", "Bitstream Charter", Times, serif;
} }

View File

@ -81,7 +81,7 @@ var defineGlobal = function (id, ref) {
define(id, [], function () { return ref; }); define(id, [], function () { return ref; });
}; };
/*jsc /*jsc
["tinymce.themes.inlite.Theme","tinymce.core.ThemeManager","tinymce.core.ui.Api","tinymce.core.util.Delay","tinymce.themes.inlite.alien.Arr","tinymce.themes.inlite.alien.EditorSettings","tinymce.themes.inlite.core.ElementMatcher","tinymce.themes.inlite.core.Matcher","tinymce.themes.inlite.core.PredicateId","tinymce.themes.inlite.core.SelectionMatcher","tinymce.themes.inlite.core.SkinLoader","tinymce.themes.inlite.ui.Buttons","tinymce.themes.inlite.ui.Panel","global!tinymce.util.Tools.resolve","tinymce.themes.inlite.alien.Type","tinymce.themes.inlite.core.Measure","tinymce.core.util.Tools","tinymce.core.EditorManager","tinymce.core.dom.DOMUtils","tinymce.core.ui.Factory","tinymce.themes.inlite.ui.Toolbar","tinymce.themes.inlite.ui.Forms","tinymce.themes.inlite.core.Layout","tinymce.themes.inlite.file.Conversions","tinymce.themes.inlite.file.Picker","tinymce.themes.inlite.core.Actions","tinymce.core.geom.Rect","tinymce.themes.inlite.core.Convert","tinymce.core.util.Promise","tinymce.themes.inlite.alien.Uuid","tinymce.themes.inlite.alien.Unlink","tinymce.themes.inlite.core.UrlType","tinymce.themes.inlite.alien.Bookmark","tinymce.core.dom.TreeWalker","tinymce.core.dom.RangeUtils"] ["tinymce.themes.inlite.Theme","tinymce.core.ThemeManager","tinymce.core.ui.Api","tinymce.core.util.Delay","tinymce.themes.inlite.alien.Arr","tinymce.themes.inlite.alien.EditorSettings","tinymce.themes.inlite.core.ElementMatcher","tinymce.themes.inlite.core.Matcher","tinymce.themes.inlite.core.PredicateId","tinymce.themes.inlite.core.SelectionMatcher","tinymce.themes.inlite.core.SkinLoader","tinymce.themes.inlite.ui.Buttons","tinymce.themes.inlite.ui.Panel","global!tinymce.util.Tools.resolve","tinymce.themes.inlite.alien.Type","tinymce.themes.inlite.core.Measure","tinymce.core.util.Tools","tinymce.core.EditorManager","tinymce.core.dom.DOMUtils","tinymce.core.ui.Factory","tinymce.themes.inlite.ui.Toolbar","tinymce.themes.inlite.ui.Forms","tinymce.themes.inlite.core.Layout","tinymce.themes.inlite.file.Conversions","tinymce.themes.inlite.file.Picker","tinymce.themes.inlite.core.Actions","tinymce.themes.inlite.core.Convert","tinymce.core.util.Promise","tinymce.themes.inlite.alien.Uuid","tinymce.themes.inlite.alien.Unlink","tinymce.themes.inlite.core.UrlType","tinymce.core.geom.Rect","tinymce.themes.inlite.alien.Bookmark","tinymce.core.dom.TreeWalker","tinymce.core.dom.RangeUtils"]
jsc*/ jsc*/
defineGlobal("global!tinymce.util.Tools.resolve", tinymce.util.Tools.resolve); defineGlobal("global!tinymce.util.Tools.resolve", tinymce.util.Tools.resolve);
/** /**
@ -359,26 +359,6 @@ define(
} }
); );
/**
* ResolveGlobal.js
*
* Released under LGPL License.
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
define(
'tinymce.core.geom.Rect',
[
'global!tinymce.util.Tools.resolve'
],
function (resolve) {
return resolve('tinymce.geom.Rect');
}
);
/** /**
* Convert.js * Convert.js
* *
@ -435,10 +415,9 @@ define(
'tinymce.themes.inlite.core.Measure', 'tinymce.themes.inlite.core.Measure',
[ [
'tinymce.core.dom.DOMUtils', 'tinymce.core.dom.DOMUtils',
'tinymce.core.geom.Rect',
'tinymce.themes.inlite.core.Convert' 'tinymce.themes.inlite.core.Convert'
], ],
function (DOMUtils, Rect, Convert) { function (DOMUtils, Convert) {
var toAbsolute = function (rect) { var toAbsolute = function (rect) {
var vp = DOMUtils.DOM.getViewPort(); var vp = DOMUtils.DOM.getViewPort();
@ -1468,6 +1447,26 @@ define(
} }
); );
/**
* ResolveGlobal.js
*
* Released under LGPL License.
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
define(
'tinymce.core.geom.Rect',
[
'global!tinymce.util.Tools.resolve'
],
function (resolve) {
return resolve('tinymce.geom.Rect');
}
);
/** /**
* Layout.js * Layout.js
* *
@ -1499,8 +1498,15 @@ define(
var calcByPositions = function (testPositions1, testPositions2, targetRect, contentAreaRect, panelRect) { var calcByPositions = function (testPositions1, testPositions2, targetRect, contentAreaRect, panelRect) {
var relPos, relRect, outputPanelRect; var relPos, relRect, outputPanelRect;
relPos = Rect.findBestRelativePosition(panelRect, targetRect, contentAreaRect, testPositions1); var paddedContentRect = {
targetRect = Rect.clamp(targetRect, contentAreaRect); x: contentAreaRect.x,
y: contentAreaRect.y,
w: contentAreaRect.w + (contentAreaRect.w < (panelRect.w + targetRect.w) ? panelRect.w : 0),
h: contentAreaRect.h + (contentAreaRect.h < (panelRect.h + targetRect.h) ? panelRect.h : 0)
};
relPos = Rect.findBestRelativePosition(panelRect, targetRect, paddedContentRect, testPositions1);
targetRect = Rect.clamp(targetRect, paddedContentRect);
if (relPos) { if (relPos) {
relRect = Rect.relativePosition(panelRect, targetRect, relPos); relRect = Rect.relativePosition(panelRect, targetRect, relPos);
@ -1508,9 +1514,10 @@ define(
return result(outputPanelRect, relPos); return result(outputPanelRect, relPos);
} }
targetRect = Rect.intersect(contentAreaRect, targetRect); targetRect = Rect.intersect(paddedContentRect, targetRect);
if (targetRect) { if (targetRect) {
relPos = Rect.findBestRelativePosition(panelRect, targetRect, contentAreaRect, testPositions2); relPos = Rect.findBestRelativePosition(panelRect, targetRect, paddedContentRect, testPositions2);
if (relPos) { if (relPos) {
relRect = Rect.relativePosition(panelRect, targetRect, relPos); relRect = Rect.relativePosition(panelRect, targetRect, relPos);
outputPanelRect = moveTo(panelRect, relRect); outputPanelRect = moveTo(panelRect, relRect);
@ -1536,8 +1543,8 @@ define(
var calc = function (targetRect, contentAreaRect, panelRect) { var calc = function (targetRect, contentAreaRect, panelRect) {
return calcByPositions( return calcByPositions(
['tc-bc', 'bc-tc', 'tl-bl', 'bl-tl', 'tr-br', 'br-tr'], ['tc-bc', 'bc-tc', 'tl-bl', 'bl-tl', 'tr-br', 'br-tr', 'cr-cl', 'cl-cr'],
['bc-tc', 'bl-tl', 'br-tr'], ['bc-tc', 'bl-tl', 'br-tr', 'cr-cl'],
targetRect, targetRect,
contentAreaRect, contentAreaRect,
panelRect panelRect

File diff suppressed because one or more lines are too long

View File

@ -53,7 +53,7 @@ var tinyMCEPopup = {
} }
// Setup local DOM // Setup local DOM
self.dom = self.editor.windowManager.createInstance('tinymce.plugins.dom.DOMUtils', document, { self.dom = self.editor.windowManager.createInstance('tinymce.dom.DOMUtils', document, {
ownEvents: true, ownEvents: true,
proxy: tinyMCEPopup._eventProxy proxy: tinyMCEPopup._eventProxy
}); });

File diff suppressed because one or more lines are too long

View File

@ -12,7 +12,7 @@
function MCTabs() { function MCTabs() {
this.settings = []; this.settings = [];
this.onChange = tinyMCEPopup.editor.windowManager.createInstance('tinymce.plugins.util.Dispatcher'); this.onChange = tinyMCEPopup.editor.windowManager.createInstance('tinymce.util.Dispatcher');
} }
MCTabs.prototype.init = function (settings) { MCTabs.prototype.init = function (settings) {
@ -155,7 +155,7 @@ tinyMCEPopup.onInit.add(function () {
dom.setAttrib(a, 'tabindex', '-1'); dom.setAttrib(a, 'tabindex', '-1');
}); });
/*keyNav = tinyMCEPopup.editor.windowManager.createInstance('tinymce.plugins.ui.KeyboardNavigation', { /*keyNav = tinyMCEPopup.editor.windowManager.createInstance('tinymce.ui.KeyboardNavigation', {
root: tabContainerElm, root: tabContainerElm,
items: items, items: items,
onAction: action, onAction: action,

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.9-alpha-41603'; $wp_version = '4.9-alpha-41604';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * 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 * @global string $tinymce_version
*/ */
$tinymce_version = '4603-20170530'; $tinymce_version = '4607-20170918';
/** /**
* Holds the required PHP version * Holds the required PHP version