TinyMCE: update to 4.1.7, changelog: https://github.com/tinymce/tinymce/blob/master/changelog.txt. Fixes #30560.
git-svn-id: https://develop.svn.wordpress.org/trunk@30675 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
0632a3de68
commit
45f4403dd0
@ -228,6 +228,15 @@ tinymce.PluginManager.add('image', function(editor) {
|
||||
});
|
||||
|
||||
if (!meta.width && !meta.height) {
|
||||
var srcURL = this.value(),
|
||||
absoluteURLPattern = new RegExp('^(?:[a-z]+:)?//', 'i'),
|
||||
baseURL = editor.settings.document_base_url;
|
||||
|
||||
//Pattern test the src url and make sure we haven't already prepended the url
|
||||
if (baseURL && !absoluteURLPattern.test(srcURL) && srcURL.substring(0, baseURL.length) !== baseURL) {
|
||||
this.value(baseURL + srcURL);
|
||||
}
|
||||
|
||||
getImageSize(this.value(), function(data) {
|
||||
if (data.width && data.height && imageDimensions) {
|
||||
width = data.width;
|
||||
|
File diff suppressed because one or more lines are too long
@ -1331,7 +1331,9 @@ define("tinymce/pasteplugin/WordFilter", [
|
||||
var rootNode = domParser.parse(content);
|
||||
|
||||
// Process DOM
|
||||
convertFakeListsToProperLists(rootNode);
|
||||
if (settings.paste_convert_word_fake_lists !== false) {
|
||||
convertFakeListsToProperLists(rootNode);
|
||||
}
|
||||
|
||||
// Serialize DOM back to HTML
|
||||
e.content = new Serializer({}, schema).serialize(rootNode);
|
||||
|
File diff suppressed because one or more lines are too long
@ -1,4 +1,4 @@
|
||||
// 4.1.6 (2014-11-19)
|
||||
// 4.1.7 (2014-11-27)
|
||||
|
||||
/**
|
||||
* Compiled inline version. (Library mode)
|
||||
@ -2996,18 +2996,18 @@ define("tinymce/util/Tools", [
|
||||
* one array list into another.
|
||||
*
|
||||
* @method map
|
||||
* @param {Array} a Array of items to iterate.
|
||||
* @param {function} f Function to call for each item. It's return value will be the new value.
|
||||
* @param {Array} array Array of items to iterate.
|
||||
* @param {function} callback Function to call for each item. It's return value will be the new value.
|
||||
* @return {Array} Array with new values based on function return values.
|
||||
*/
|
||||
function map(a, f) {
|
||||
var o = [];
|
||||
function map(array, callback) {
|
||||
var out = [];
|
||||
|
||||
each(a, function(v) {
|
||||
o.push(f(v));
|
||||
each(array, function(item) {
|
||||
out.push(callback(item));
|
||||
});
|
||||
|
||||
return o;
|
||||
return out;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -13700,7 +13700,7 @@ define("tinymce/util/VK", [
|
||||
UP: 38,
|
||||
|
||||
modifierPressed: function(e) {
|
||||
return e.shiftKey || e.ctrlKey || e.altKey;
|
||||
return e.shiftKey || e.ctrlKey || e.altKey || this.metaKeyPressed(e);
|
||||
},
|
||||
|
||||
metaKeyPressed: function(e) {
|
||||
@ -18298,10 +18298,11 @@ define("tinymce/Formatter", [
|
||||
* @class tinymce.UndoManager
|
||||
*/
|
||||
define("tinymce/UndoManager", [
|
||||
"tinymce/util/VK",
|
||||
"tinymce/Env",
|
||||
"tinymce/util/Tools",
|
||||
"tinymce/html/SaxParser"
|
||||
], function(Env, Tools, SaxParser) {
|
||||
], function(VK, Env, Tools, SaxParser) {
|
||||
var trim = Tools.trim, trimContentRegExp;
|
||||
|
||||
trimContentRegExp = new RegExp([
|
||||
@ -18426,7 +18427,8 @@ define("tinymce/UndoManager", [
|
||||
}
|
||||
|
||||
// If key isn't shift,ctrl,alt,capslock,metakey
|
||||
if ((keyCode < 16 || keyCode > 20) && keyCode != 224 && keyCode != 91 && !self.typing) {
|
||||
var modKey = VK.modifierPressed(e);
|
||||
if ((keyCode < 16 || keyCode > 20) && keyCode != 224 && keyCode != 91 && !self.typing && !modKey) {
|
||||
self.beforeChange();
|
||||
self.typing = true;
|
||||
self.add({}, e);
|
||||
@ -30750,7 +30752,7 @@ define("tinymce/EditorManager", [
|
||||
* @property minorVersion
|
||||
* @type String
|
||||
*/
|
||||
minorVersion: '1.6',
|
||||
minorVersion: '1.7',
|
||||
|
||||
/**
|
||||
* Release date of TinyMCE build.
|
||||
@ -30758,7 +30760,7 @@ define("tinymce/EditorManager", [
|
||||
* @property releaseDate
|
||||
* @type String
|
||||
*/
|
||||
releaseDate: '2014-11-19',
|
||||
releaseDate: '2014-11-27',
|
||||
|
||||
/**
|
||||
* Collection of editor instances.
|
||||
|
16
src/wp-includes/js/tinymce/tinymce.min.js
vendored
16
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 = 30133;
|
||||
*
|
||||
* @global string $tinymce_version
|
||||
*/
|
||||
$tinymce_version = '4106-20141119';
|
||||
$tinymce_version = '4107-20141130';
|
||||
|
||||
/**
|
||||
* Holds the required PHP version
|
||||
|
@ -360,6 +360,18 @@
|
||||
}
|
||||
}
|
||||
|
||||
function triggerElementChange(element){
|
||||
var evt;
|
||||
|
||||
if ("createEvent" in document) {
|
||||
evt = document.createEvent("HTMLEvents");
|
||||
evt.initEvent("change", false, true);
|
||||
element.dispatchEvent(evt);
|
||||
} else {
|
||||
element.fireEvent("onchange");
|
||||
}
|
||||
}
|
||||
|
||||
window.Utils = {
|
||||
fontFace: fontFace,
|
||||
findContainer: findContainer,
|
||||
@ -379,6 +391,7 @@
|
||||
pressEnter: pressEnter,
|
||||
trimBrsOnIE: trimBrsOnIE,
|
||||
patch: patch,
|
||||
unpatch: unpatch
|
||||
unpatch: unpatch,
|
||||
triggerElementChange: triggerElementChange
|
||||
};
|
||||
})();
|
||||
|
@ -21,6 +21,7 @@
|
||||
delete editor.settings.file_browser_callback;
|
||||
delete editor.settings.image_list;
|
||||
delete editor.settings.image_class_list;
|
||||
delete editor.settings.document_base_url;
|
||||
|
||||
var win = Utils.getFontmostWindow();
|
||||
|
||||
@ -125,4 +126,64 @@
|
||||
'<p><img class="class1" src="src" alt="alt" width="100" height="200" /></p>'
|
||||
);
|
||||
});
|
||||
|
||||
test("Image recognizes relative src url and prepends relative document_base_url setting.", function () {
|
||||
var win, elementId, element;
|
||||
|
||||
editor.settings.document_base_url = 'testing/images/';
|
||||
editor.setContent('');
|
||||
editor.execCommand('mceImage', true);
|
||||
|
||||
var data = {
|
||||
"src": "src",
|
||||
"alt": "alt"
|
||||
};
|
||||
|
||||
win = Utils.getFontmostWindow();
|
||||
elementId = win.find('#src')[0]._id;
|
||||
element = document.getElementById(elementId).childNodes[0];
|
||||
|
||||
win.fromJSON(data);
|
||||
Utils.triggerElementChange(element);
|
||||
|
||||
win.find('form')[0].submit();
|
||||
win.close();
|
||||
|
||||
equal(
|
||||
cleanHtml(editor.getContent()),
|
||||
'<p><img src="' + editor.settings.document_base_url + 'src" alt="alt" /></p>'
|
||||
);
|
||||
|
||||
|
||||
});
|
||||
|
||||
test("Image recognizes relative src url and prepends absolute document_base_url setting.", function () {
|
||||
var win, elementId, element;
|
||||
|
||||
editor.settings.document_base_url = 'http://testing.com/images/';
|
||||
editor.setContent('');
|
||||
editor.execCommand('mceImage', true);
|
||||
|
||||
var data = {
|
||||
"src": "src",
|
||||
"alt": "alt"
|
||||
};
|
||||
|
||||
win = Utils.getFontmostWindow();
|
||||
elementId = win.find('#src')[0]._id;
|
||||
element = document.getElementById(elementId).childNodes[0];
|
||||
|
||||
win.fromJSON(data);
|
||||
Utils.triggerElementChange(element);
|
||||
|
||||
win.find('form')[0].submit();
|
||||
win.close();
|
||||
|
||||
equal(
|
||||
cleanHtml(editor.getContent()),
|
||||
'<p><img src="' + editor.settings.document_base_url + 'src" alt="alt" /></p>'
|
||||
);
|
||||
|
||||
|
||||
});
|
||||
})();
|
@ -161,4 +161,4 @@ test("XSS content", function() {
|
||||
testXss('<video><img src="x" onload="alert(1)"></video>', '<p><video width="300" height=\"150\"></video></p>');
|
||||
testXss('<video><img src="x"></video>', '<p><video width="300" height="150"><img src="x" /></video></p>');
|
||||
testXss('<video><!--[if IE]><img src="x"><![endif]--></video>', '<p><video width="300" height="150"><!-- [if IE]><img src="x"><![endif]--></video></p>');
|
||||
});
|
||||
});
|
@ -151,6 +151,20 @@ test("Paste list like paragraph and list", function() {
|
||||
equal(editor.getContent(), '<p>ABC. X</p><ol><li>Y</li></ol>');
|
||||
});
|
||||
|
||||
test("Paste list like paragraph and list (disabled)", function() {
|
||||
editor.setContent('');
|
||||
|
||||
editor.settings.paste_convert_word_fake_lists = false;
|
||||
|
||||
editor.execCommand('mceInsertClipboardContent', false, {
|
||||
content: '<p class=MsoNormal><span style=\'font-size:10.0pt;line-height:115%;font-family:"Trebuchet MS","sans-serif";color:#666666\'>ABC. X<o:p></o:p></span></p><p class=MsoListParagraph style=\'text-indent:-.25in;mso-list:l0 level1 lfo1\'><![if !supportLists]><span style=\'mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:Calibri;mso-bidi-theme-font:minor-latin\'><span style=\'mso-list:Ignore\'>1.<span style=\'font:7.0pt "Times New Roman"\'> </span></span></span><![endif]>Y</p>'
|
||||
});
|
||||
|
||||
delete editor.settings.paste_convert_word_fake_lists;
|
||||
|
||||
equal(editor.getContent(), '<p>ABC. X</p><p>1. Y</p>');
|
||||
});
|
||||
|
||||
test("Paste Word table", function() {
|
||||
var rng = editor.dom.createRng();
|
||||
|
||||
@ -758,4 +772,4 @@ if (tinymce.Env.webkit) {
|
||||
|
||||
equal(editor.getContent(), '<p style="color: #ff0000;">abc</p>');
|
||||
});
|
||||
}
|
||||
}
|
@ -1616,4 +1616,4 @@ test('Bug #6518 - Apply div blocks to inline editor paragraph', function() {
|
||||
});
|
||||
inlineEditor.formatter.apply('format');
|
||||
equal(inlineEditor.getContent(), '<div>a</div><p>b</p>');
|
||||
});
|
||||
});
|
@ -90,13 +90,26 @@ test('Typing state', function() {
|
||||
editor.undoManager.clear();
|
||||
editor.setContent('test');
|
||||
|
||||
expect(2);
|
||||
expect(4);
|
||||
|
||||
ok(!editor.undoManager.typing);
|
||||
|
||||
editor.dom.fire(editor.getBody(), 'keydown', {keyCode: 65});
|
||||
ok(editor.undoManager.typing);
|
||||
|
||||
editor.dom.fire(editor.getBody(), 'keyup', {keyCode: 13});
|
||||
ok(!editor.undoManager.typing);
|
||||
|
||||
selectAllFlags = {keyCode: 65, ctrlKey: false, altKey: false, shiftKey: false};
|
||||
|
||||
if (tinymce.Env.mac) {
|
||||
selectAllFlags.metaKey = true;
|
||||
} else {
|
||||
selectAllFlags.ctrlKey = true;
|
||||
}
|
||||
|
||||
editor.dom.fire(editor.getBody(), 'keydown', selectAllFlags);
|
||||
ok(!editor.undoManager.typing);
|
||||
});
|
||||
|
||||
test('Undo and add new level', function() {
|
||||
@ -317,4 +330,4 @@ test('BeforeAddUndo event', function() {
|
||||
equal(Utils.cleanHtml(lastEvt.level.content), "<p>c</p>");
|
||||
equal(lastEvt.originalEvent.data, 1);
|
||||
ok(!addUndoEvt, "Event level produced when it should be blocked");
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue
Block a user