mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-17 02:54:31 +00:00
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:
@@ -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");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user