Fixes #34331.
Built from https://develop.svn.wordpress.org/trunk@35306


git-svn-id: http://core.svn.wordpress.org/trunk@35272 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2015-10-20 22:06:24 +00:00
parent c77bb38b3d
commit 3451251548
13 changed files with 104 additions and 33 deletions

View File

@ -218,6 +218,7 @@ tinymce.PluginManager.add('image', function(editor) {
dom.setAttrib(imgElm, 'id', null); dom.setAttrib(imgElm, 'id', null);
} else { } else {
dom.setAttribs(imgElm, data); dom.setAttribs(imgElm, data);
editor.editorUpload.uploadImagesAuto();
} }
waitLoad(imgElm); waitLoad(imgElm);

File diff suppressed because one or more lines are too long

View File

@ -33,6 +33,16 @@ tinymce.PluginManager.add('lists', function(editor) {
editor.on('init', function() { editor.on('init', function() {
var dom = editor.dom, selection = editor.selection; var dom = editor.dom, selection = editor.selection;
function isEmpty(elm, keepBookmarks) {
var empty = dom.isEmpty(elm);
if (keepBookmarks && dom.select('span[data-mce-type=bookmark]').length > 0) {
return false;
}
return empty;
}
/** /**
* Returns a range bookmark. This will convert indexed bookmarks into temporary span elements with * Returns a range bookmark. This will convert indexed bookmarks into temporary span elements with
* index 0 so that they can be restored properly after the DOM has been modified. Text bookmarks will not have spans * index 0 so that they can be restored properly after the DOM has been modified. Text bookmarks will not have spans
@ -237,13 +247,13 @@ tinymce.PluginManager.add('lists', function(editor) {
dom.insertAfter(newBlock, ul); dom.insertAfter(newBlock, ul);
if (dom.isEmpty(li.parentNode)) { if (isEmpty(li.parentNode)) {
removeAndKeepBookmarks(li.parentNode); removeAndKeepBookmarks(li.parentNode);
} }
dom.remove(li); dom.remove(li);
if (dom.isEmpty(ul)) { if (isEmpty(ul)) {
dom.remove(ul); dom.remove(ul);
} }
} }
@ -283,7 +293,7 @@ tinymce.PluginManager.add('lists', function(editor) {
if (sibling && sibling.nodeName == 'LI') { if (sibling && sibling.nodeName == 'LI') {
sibling.appendChild(ul); sibling.appendChild(ul);
if (dom.isEmpty(parentNode)) { if (isEmpty(parentNode)) {
dom.remove(parentNode); dom.remove(parentNode);
} }
} }
@ -303,7 +313,7 @@ tinymce.PluginManager.add('lists', function(editor) {
var ul = li.parentNode, ulParent = ul.parentNode, newBlock; var ul = li.parentNode, ulParent = ul.parentNode, newBlock;
function removeEmptyLi(li) { function removeEmptyLi(li) {
if (dom.isEmpty(li)) { if (isEmpty(li)) {
dom.remove(li); dom.remove(li);
} }
} }
@ -592,7 +602,7 @@ tinymce.PluginManager.add('lists', function(editor) {
tinymce.each(getSelectedListItems(), function(li) { tinymce.each(getSelectedListItems(), function(li) {
var node, rootList; var node, rootList;
if (dom.isEmpty(li)) { if (isEmpty(li)) {
outdent(li); outdent(li);
return; return;
} }
@ -672,11 +682,11 @@ tinymce.PluginManager.add('lists', function(editor) {
dom.remove(node); dom.remove(node);
} }
if (dom.isEmpty(toElm)) { if (isEmpty(toElm, true)) {
dom.$(toElm).empty(); dom.$(toElm).empty();
} }
if (!dom.isEmpty(fromElm)) { if (!isEmpty(fromElm, true)) {
while ((node = fromElm.firstChild)) { while ((node = fromElm.firstChild)) {
toElm.appendChild(node); toElm.appendChild(node);
} }
@ -688,7 +698,7 @@ tinymce.PluginManager.add('lists', function(editor) {
dom.remove(fromElm); dom.remove(fromElm);
if (dom.isEmpty(ul)) { if (isEmpty(ul)) {
dom.remove(ul); dom.remove(ul);
} }
} }

File diff suppressed because one or more lines are too long

View File

@ -789,5 +789,7 @@ tinymce.PluginManager.add('media', function(editor, url) {
prependToContext: true prependToContext: true
}); });
editor.addCommand('mceMedia', showDialog);
this.showDialog = showDialog; this.showDialog = showDialog;
}); });

File diff suppressed because one or more lines are too long

View File

@ -512,6 +512,56 @@ define("tinymce/pasteplugin/Clipboard", [
return html; return html;
} }
/**
* Some Windows 10/Edge versions will return a double encoded string. This checks if the
* content has this odd encoding and decodes it.
*/
function decodeEdgeData(data) {
var i, out, fingerprint, code;
// Check if data is encoded
fingerprint = [25942, 29554, 28521, 14958];
for (i = 0; i < fingerprint.length; i++) {
if (data.charCodeAt(i) != fingerprint[i]) {
return data;
}
}
// Decode UTF-16 to UTF-8
out = '';
for (i = 0; i < data.length; i++) {
code = data.charCodeAt(i);
/*eslint no-bitwise:0*/
out += String.fromCharCode((code & 0x00FF));
out += String.fromCharCode((code & 0xFF00) >> 8);
}
// Decode UTF-8
return decodeURIComponent(escape(out));
}
/**
* Extracts HTML contents from within a fragment.
*/
function extractFragment(data) {
var idx, startFragment, endFragment;
startFragment = '<!--StartFragment-->';
idx = data.indexOf(startFragment);
if (idx !== -1) {
data = data.substr(idx + startFragment.length);
}
endFragment = '<!--EndFragment-->';
idx = data.indexOf(endFragment);
if (idx !== -1) {
data = data.substr(0, idx);
}
return data;
}
/** /**
* Gets various content types out of a datatransfer object. * Gets various content types out of a datatransfer object.
* *
@ -519,7 +569,7 @@ define("tinymce/pasteplugin/Clipboard", [
* @return {Object} Object with mime types and data for those mime types. * @return {Object} Object with mime types and data for those mime types.
*/ */
function getDataTransferItems(dataTransfer) { function getDataTransferItems(dataTransfer) {
var data = {}; var items = {};
if (dataTransfer) { if (dataTransfer) {
// Use old WebKit/IE API // Use old WebKit/IE API
@ -527,20 +577,26 @@ define("tinymce/pasteplugin/Clipboard", [
var legacyText = dataTransfer.getData('Text'); var legacyText = dataTransfer.getData('Text');
if (legacyText && legacyText.length > 0) { if (legacyText && legacyText.length > 0) {
if (legacyText.indexOf(mceInternalUrlPrefix) == -1) { if (legacyText.indexOf(mceInternalUrlPrefix) == -1) {
data['text/plain'] = legacyText; items['text/plain'] = legacyText;
} }
} }
} }
if (dataTransfer.types) { if (dataTransfer.types) {
for (var i = 0; i < dataTransfer.types.length; i++) { for (var i = 0; i < dataTransfer.types.length; i++) {
var contentType = dataTransfer.types[i]; var contentType = dataTransfer.types[i],
data[contentType] = dataTransfer.getData(contentType); data = dataTransfer.getData(contentType);
if (contentType == 'text/html') {
data = extractFragment(decodeEdgeData(data));
}
items[contentType] = data;
} }
} }
} }
return data; return items;
} }
/** /**

File diff suppressed because one or more lines are too long

View File

@ -552,7 +552,7 @@ tinymce.ThemeManager.add('modern', function(editor) {
return null; return null;
} }
editor.on('click keyup blur', function() { editor.on('click keyup', function() {
// Needs to be delayed to avoid Chrome img focus out bug // Needs to be delayed to avoid Chrome img focus out bug
window.setTimeout(function() { window.setTimeout(function() {
var match; var match;
@ -570,6 +570,8 @@ tinymce.ThemeManager.add('modern', function(editor) {
}, 0); }, 0);
}); });
editor.on('blur hide', hideAllContextToolbars);
editor.on('ObjectResizeStart', function() { editor.on('ObjectResizeStart', function() {
var match = findFrontMostMatch(editor.selection.getNode()); var match = findFrontMostMatch(editor.selection.getNode());

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.4-alpha-35305'; $wp_version = '4.4-alpha-35306';
/** /**
* 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 = 34978;
* *
* @global string $tinymce_version * @global string $tinymce_version
*/ */
$tinymce_version = '4205-20150908'; $tinymce_version = '4206-20151020';
/** /**
* Holds the required PHP version * Holds the required PHP version