TinyMCE:
- Update to 4.1.2, changelog: https://github.com/tinymce/tinymce/blob/master/changelog.txt - Update the tests to 4.1.2. Fixes #28576. Built from https://develop.svn.wordpress.org/trunk@29203 git-svn-id: http://core.svn.wordpress.org/trunk@28987 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
d74a2a9f07
commit
95735cf298
|
@ -216,20 +216,28 @@ tinymce.PluginManager.add('image', function(editor) {
|
|||
return value;
|
||||
}
|
||||
|
||||
function srcChange() {
|
||||
function srcChange(e) {
|
||||
var meta = e.meta || {};
|
||||
|
||||
if (imageListCtrl) {
|
||||
imageListCtrl.value(editor.convertURL(this.value(), 'src'));
|
||||
}
|
||||
|
||||
getImageSize(this.value(), function(data) {
|
||||
if (data.width && data.height && imageDimensions) {
|
||||
width = data.width;
|
||||
height = data.height;
|
||||
|
||||
win.find('#width').value(width);
|
||||
win.find('#height').value(height);
|
||||
}
|
||||
tinymce.each(meta, function(value, key) {
|
||||
win.find('#' + key).value(value);
|
||||
});
|
||||
|
||||
if (!meta.width && !meta.height) {
|
||||
getImageSize(this.value(), function(data) {
|
||||
if (data.width && data.height && imageDimensions) {
|
||||
width = data.width;
|
||||
height = data.height;
|
||||
|
||||
win.find('#width').value(width);
|
||||
win.find('#height').value(height);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
width = dom.getAttrib(imgElm, 'width');
|
||||
|
@ -297,7 +305,14 @@ tinymce.PluginManager.add('image', function(editor) {
|
|||
|
||||
// General settings shared between simple and advanced dialogs
|
||||
var generalFormItems = [
|
||||
{name: 'src', type: 'filepicker', filetype: 'image', label: 'Source', autofocus: true, onchange: srcChange},
|
||||
{
|
||||
name: 'src',
|
||||
type: 'filepicker',
|
||||
filetype: 'image',
|
||||
label: 'Source',
|
||||
autofocus: true,
|
||||
onchange: srcChange
|
||||
},
|
||||
imageListCtrl
|
||||
];
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -20,6 +20,8 @@ tinymce.PluginManager.add('media', function(editor, url) {
|
|||
{regex: /maps\.google\.([a-z]{2,3})\/maps\/(.+)msid=(.+)/, type: 'iframe', w: 425, h: 350, url: '//maps.google.com/maps/ms?msid=$2&output=embed"'}
|
||||
];
|
||||
|
||||
var embedChange = (tinymce.Env.ie && tinymce.Env.ie <= 8) ? 'onChange' : 'onInput';
|
||||
|
||||
function guessMime(url) {
|
||||
if (url.indexOf('.mp3') != -1) {
|
||||
return 'audio/mpeg';
|
||||
|
@ -62,8 +64,21 @@ tinymce.PluginManager.add('media', function(editor, url) {
|
|||
|
||||
function showDialog() {
|
||||
var win, width, height, data;
|
||||
|
||||
var generalFormItems = [
|
||||
{name: 'source1', type: 'filepicker', filetype: 'media', size: 40, autofocus: true, label: 'Source'}
|
||||
{
|
||||
name: 'source1',
|
||||
type: 'filepicker',
|
||||
filetype: 'media',
|
||||
size: 40,
|
||||
autofocus: true,
|
||||
label: 'Source',
|
||||
onchange: function(e) {
|
||||
tinymce.each(e.meta, function(value, key) {
|
||||
win.find('#' + key).value(value);
|
||||
});
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
function recalcSize(e) {
|
||||
|
@ -117,6 +132,23 @@ tinymce.PluginManager.add('media', function(editor, url) {
|
|||
width = data.width;
|
||||
height = data.height;
|
||||
|
||||
var embedTextBox = {
|
||||
id: 'mcemediasource',
|
||||
type: 'textbox',
|
||||
flex: 1,
|
||||
name: 'embed',
|
||||
value: getSource(),
|
||||
multiline: true,
|
||||
label: 'Source'
|
||||
};
|
||||
|
||||
function updateValueOnChange() {
|
||||
data = htmlToData( this.value() );
|
||||
this.parent().parent().fromJSON(data);
|
||||
}
|
||||
|
||||
embedTextBox[embedChange] = updateValueOnChange;
|
||||
|
||||
win = editor.windowManager.open({
|
||||
title: 'Insert/edit video',
|
||||
data: data,
|
||||
|
@ -149,15 +181,7 @@ tinymce.PluginManager.add('media', function(editor, url) {
|
|||
text: 'Paste your embed code below:',
|
||||
forId: 'mcemediasource'
|
||||
},
|
||||
{
|
||||
id: 'mcemediasource',
|
||||
type: 'textbox',
|
||||
flex: 1,
|
||||
name: 'embed',
|
||||
value: getSource(),
|
||||
multiline: true,
|
||||
label: 'Source'
|
||||
}
|
||||
embedTextBox
|
||||
]
|
||||
}
|
||||
],
|
||||
|
@ -420,7 +444,7 @@ tinymce.PluginManager.add('media', function(editor, url) {
|
|||
width: data.width,
|
||||
height: data.height
|
||||
});
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
if (updateAll) {
|
||||
|
@ -436,13 +460,13 @@ tinymce.PluginManager.add('media', function(editor, url) {
|
|||
src: ""
|
||||
});
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case "iframe":
|
||||
setAttributes(attrs, {
|
||||
src: data.source1
|
||||
});
|
||||
break;
|
||||
break;
|
||||
|
||||
case "source":
|
||||
sourceCount++;
|
||||
|
@ -457,7 +481,7 @@ tinymce.PluginManager.add('media', function(editor, url) {
|
|||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case "img":
|
||||
if (!data.poster) {
|
||||
|
@ -523,7 +547,7 @@ tinymce.PluginManager.add('media', function(editor, url) {
|
|||
// Make sure that any messy HTML is retained inside these
|
||||
var specialElements = editor.schema.getSpecialElements();
|
||||
tinymce.each('video audio iframe object'.split(' '), function(name) {
|
||||
specialElements[name] = new RegExp('<\/' + name + '[^>]*>','gi');
|
||||
specialElements[name] = new RegExp('<\/' + name + '[^>]*>', 'gi');
|
||||
});
|
||||
|
||||
// Allow elements
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -170,6 +170,10 @@ define("tinymce/pasteplugin/Utils", [
|
|||
}
|
||||
}
|
||||
|
||||
html = filter(html, [
|
||||
/<!\[[^\]]+\]>/g // Conditional comments
|
||||
]);
|
||||
|
||||
walk(domParser.parse(html));
|
||||
|
||||
return text;
|
||||
|
@ -182,15 +186,15 @@ define("tinymce/pasteplugin/Utils", [
|
|||
* @return {String} Html contents that got trimmed.
|
||||
*/
|
||||
function trimHtml(html) {
|
||||
var trimSpaces = function(all, s1, s2) {
|
||||
function trimSpaces(all, s1, s2) {
|
||||
// WebKit meant to preserve multiple spaces but instead inserted around all inline tags,
|
||||
// including the spans with inline stypes created on paste
|
||||
// including the spans with inline styles created on paste
|
||||
if (!s1 && !s2) {
|
||||
return ' ';
|
||||
}
|
||||
|
||||
return '\u00a0';
|
||||
};
|
||||
}
|
||||
|
||||
html = filter(html, [
|
||||
/^[\s\S]*<body[^>]*>\s*|\s*<\/body[^>]*>[\s\S]*$/g, // Remove anything but the contents within the BODY element
|
||||
|
@ -535,15 +539,25 @@ define("tinymce/pasteplugin/Clipboard", [
|
|||
}
|
||||
|
||||
function getCaretRangeFromEvent(e) {
|
||||
var doc = editor.getDoc(), rng;
|
||||
var doc = editor.getDoc(), rng, point;
|
||||
|
||||
if (doc.caretPositionFromPoint) {
|
||||
var point = doc.caretPositionFromPoint(e.clientX, e.clientY);
|
||||
point = doc.caretPositionFromPoint(e.clientX, e.clientY);
|
||||
rng = doc.createRange();
|
||||
rng.setStart(point.offsetNode, point.offset);
|
||||
rng.collapse(true);
|
||||
} else if (doc.caretRangeFromPoint) {
|
||||
rng = doc.caretRangeFromPoint(e.clientX, e.clientY);
|
||||
} else if (doc.body.createTextRange) {
|
||||
rng = doc.body.createTextRange();
|
||||
|
||||
try {
|
||||
rng.moveToPoint(e.clientX, e.clientY);
|
||||
rng.collapse(true);
|
||||
} catch (ex) {
|
||||
// Append to top or bottom depending on drop location
|
||||
rng.collapse(e.clientY < doc.body.clientHeight);
|
||||
}
|
||||
}
|
||||
|
||||
return rng;
|
||||
|
@ -835,7 +849,55 @@ define("tinymce/pasteplugin/WordFilter", [
|
|||
function convertFakeListsToProperLists(node) {
|
||||
var currentListNode, prevListNode, lastLevel = 1;
|
||||
|
||||
function convertParagraphToLi(paragraphNode, listStartTextNode, listName, start) {
|
||||
function getText(node) {
|
||||
var txt = '';
|
||||
|
||||
if (node.type === 3) {
|
||||
return node.value;
|
||||
}
|
||||
|
||||
if ((node = node.firstChild)) {
|
||||
do {
|
||||
txt += getText(node);
|
||||
} while ((node = node.next));
|
||||
}
|
||||
|
||||
return txt;
|
||||
}
|
||||
|
||||
function trimListStart(node, regExp) {
|
||||
if (node.type === 3) {
|
||||
if (regExp.test(node.value)) {
|
||||
node.value = node.value.replace(regExp, '');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if ((node = node.firstChild)) {
|
||||
do {
|
||||
if (!trimListStart(node, regExp)) {
|
||||
return false;
|
||||
}
|
||||
} while ((node = node.next));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function removeIgnoredNodes(node) {
|
||||
if (node._listIgnore) {
|
||||
node.remove();
|
||||
return;
|
||||
}
|
||||
|
||||
if ((node = node.firstChild)) {
|
||||
do {
|
||||
removeIgnoredNodes(node);
|
||||
} while ((node = node.next));
|
||||
}
|
||||
}
|
||||
|
||||
function convertParagraphToLi(paragraphNode, listName, start) {
|
||||
var level = paragraphNode._listLevel || lastLevel;
|
||||
|
||||
// Handle list nesting
|
||||
|
@ -866,12 +928,6 @@ define("tinymce/pasteplugin/WordFilter", [
|
|||
}
|
||||
|
||||
paragraphNode.name = 'li';
|
||||
listStartTextNode.value = '';
|
||||
|
||||
var nextNode = listStartTextNode.next;
|
||||
if (nextNode && nextNode.type == 3) {
|
||||
nextNode.value = nextNode.value.replace(/^\u00a0+/, '');
|
||||
}
|
||||
|
||||
// Append list to previous list if it exists
|
||||
if (level > lastLevel && prevListNode) {
|
||||
|
@ -879,6 +935,12 @@ define("tinymce/pasteplugin/WordFilter", [
|
|||
}
|
||||
|
||||
lastLevel = level;
|
||||
|
||||
// Remove start of list item "1. " or "· " etc
|
||||
removeIgnoredNodes(paragraphNode);
|
||||
trimListStart(paragraphNode, /^\u00a0+/);
|
||||
trimListStart(paragraphNode, /^\s*([\u2022\u00b7\u00a7\u00d8\u25CF]|\w+\.)/);
|
||||
trimListStart(paragraphNode, /^\u00a0+/);
|
||||
}
|
||||
|
||||
var paragraphs = node.getAll('p');
|
||||
|
@ -888,26 +950,17 @@ define("tinymce/pasteplugin/WordFilter", [
|
|||
|
||||
if (node.name == 'p' && node.firstChild) {
|
||||
// Find first text node in paragraph
|
||||
var nodeText = '';
|
||||
var nodeText = getText(node);
|
||||
var listStartTextNode = node.firstChild;
|
||||
|
||||
while (listStartTextNode) {
|
||||
nodeText = listStartTextNode.value;
|
||||
if (nodeText) {
|
||||
break;
|
||||
}
|
||||
|
||||
listStartTextNode = listStartTextNode.firstChild;
|
||||
}
|
||||
|
||||
// Detect unordered lists look for bullets
|
||||
if (/^\s*[\u2022\u00b7\u00a7\u00d8\u25CF]\s*$/.test(nodeText)) {
|
||||
convertParagraphToLi(node, listStartTextNode, 'ul');
|
||||
if (/^[\s\u00a0]*[\u2022\u00b7\u00a7\u00d8\u25CF]\s*/.test(nodeText)) {
|
||||
convertParagraphToLi(node, 'ul');
|
||||
continue;
|
||||
}
|
||||
|
||||
// Detect ordered lists 1., a. or ixv.
|
||||
if (/^\s*\w+\.$/.test(nodeText)) {
|
||||
if (/^[\s\u00a0]*\w+\./.test(nodeText) && !/^[\s\u00a0]*\w+\.\s*[^\s]+/.test(listStartTextNode.value)) {
|
||||
// Parse OL start number
|
||||
var matches = /([0-9])\./.exec(nodeText);
|
||||
var start = 1;
|
||||
|
@ -915,7 +968,13 @@ define("tinymce/pasteplugin/WordFilter", [
|
|||
start = parseInt(matches[1], 10);
|
||||
}
|
||||
|
||||
convertParagraphToLi(node, listStartTextNode, 'ol', start);
|
||||
convertParagraphToLi(node, 'ol', start);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Convert paragraphs marked as lists but doesn't look like anything
|
||||
if (node._listLevel) {
|
||||
convertParagraphToLi(node, 'ul', 1);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -925,20 +984,27 @@ define("tinymce/pasteplugin/WordFilter", [
|
|||
}
|
||||
|
||||
function filterStyles(node, styleValue) {
|
||||
var outputStyles = {}, styles = editor.dom.parseStyle(styleValue);
|
||||
|
||||
// Parse out list indent level for lists
|
||||
if (node.name === 'p') {
|
||||
var matches = /mso-list:\w+ \w+([0-9]+)/.exec(styleValue);
|
||||
|
||||
if (matches) {
|
||||
node._listLevel = parseInt(matches[1], 10);
|
||||
}
|
||||
}
|
||||
var outputStyles = {}, matches, styles = editor.dom.parseStyle(styleValue);
|
||||
|
||||
Tools.each(styles, function(value, name) {
|
||||
// Convert various MS styles to W3C styles
|
||||
switch (name) {
|
||||
case 'mso-list':
|
||||
// Parse out list indent level for lists
|
||||
matches = /\w+ \w+([0-9]+)/i.exec(styleValue);
|
||||
if (matches) {
|
||||
node._listLevel = parseInt(matches[1], 10);
|
||||
}
|
||||
|
||||
// Remove these nodes <span style="mso-list:Ignore">o</span>
|
||||
// Since the span gets removed we mark the text node and the span
|
||||
if (/Ignore/i.test(value) && node.firstChild) {
|
||||
node._listIgnore = true;
|
||||
node.firstChild._listIgnore = true;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case "horiz-align":
|
||||
name = "text-align";
|
||||
break;
|
||||
|
@ -1096,7 +1162,7 @@ define("tinymce/pasteplugin/WordFilter", [
|
|||
node = nodes[i];
|
||||
|
||||
className = node.attr('class');
|
||||
if (/^(MsoCommentReference|MsoCommentText|msoDel)$/i.test(className)) {
|
||||
if (/^(MsoCommentReference|MsoCommentText|msoDel|MsoCaption)$/i.test(className)) {
|
||||
node.remove();
|
||||
}
|
||||
|
||||
|
@ -1304,7 +1370,7 @@ define("tinymce/pasteplugin/Quirks", [
|
|||
return before + ' style="' + outputStyles + '"' + after;
|
||||
}
|
||||
|
||||
return '';
|
||||
return before + after;
|
||||
});
|
||||
} else {
|
||||
// Remove all external styles
|
||||
|
@ -1443,5 +1509,5 @@ define("tinymce/pasteplugin/Plugin", [
|
|||
});
|
||||
});
|
||||
|
||||
expose(["tinymce/pasteplugin/Utils","tinymce/pasteplugin/Clipboard","tinymce/pasteplugin/WordFilter","tinymce/pasteplugin/Quirks","tinymce/pasteplugin/Plugin"]);
|
||||
expose(["tinymce/pasteplugin/Utils","tinymce/pasteplugin/WordFilter"]);
|
||||
})(this);
|
File diff suppressed because one or more lines are too long
|
@ -12,7 +12,24 @@
|
|||
/*eslint consistent-this:0 */
|
||||
|
||||
tinymce.PluginManager.add('textcolor', function(editor) {
|
||||
var VK = tinymce.util.VK;
|
||||
var cols, rows;
|
||||
|
||||
rows = editor.settings.textcolor_rows || 5;
|
||||
cols = editor.settings.textcolor_cols || 8;
|
||||
|
||||
function getCurrentColor(format) {
|
||||
var color;
|
||||
|
||||
editor.dom.getParents(editor.selection.getStart(), function(elm) {
|
||||
var value;
|
||||
|
||||
if ((value = elm.style[format == 'forecolor' ? 'color' : 'background-color'])) {
|
||||
color = value;
|
||||
}
|
||||
});
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
function mapColors() {
|
||||
var i, colors = [], colorMap;
|
||||
|
@ -49,21 +66,20 @@ tinymce.PluginManager.add('textcolor', function(editor) {
|
|||
"00FFFF", "Aqua",
|
||||
"00CCFF", "Sky blue",
|
||||
"993366", "Red violet",
|
||||
"C0C0C0", "Silver",
|
||||
"FFFFFF", "White",
|
||||
"FF99CC", "Pink",
|
||||
"FFCC99", "Peach",
|
||||
"FFFF99", "Light yellow",
|
||||
"CCFFCC", "Pale green",
|
||||
"CCFFFF", "Pale cyan",
|
||||
"99CCFF", "Light sky blue",
|
||||
"CC99FF", "Plum",
|
||||
"FFFFFF", "White"
|
||||
"CC99FF", "Plum"
|
||||
];
|
||||
|
||||
for (i = 0; i < colorMap.length; i += 2) {
|
||||
colors.push({
|
||||
text: colorMap[i + 1],
|
||||
color: colorMap[i]
|
||||
color: '#' + colorMap[i]
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -71,14 +87,33 @@ tinymce.PluginManager.add('textcolor', function(editor) {
|
|||
}
|
||||
|
||||
function renderColorPicker() {
|
||||
var ctrl = this, colors, color, html, last, rows, cols, x, y, i;
|
||||
var ctrl = this, colors, color, html, last, x, y, i, id = ctrl._id, count = 0;
|
||||
|
||||
function getColorCellHtml(color, title) {
|
||||
var isNoColor = color == 'transparent';
|
||||
|
||||
return (
|
||||
'<td class="mce-grid-cell' + (isNoColor ? ' mce-colorbtn-trans' : '') + '">' +
|
||||
'<div id="' + id + '-' + (count++) + '"' +
|
||||
' data-mce-color="' + (color ? color : '') + '"' +
|
||||
' role="option"' +
|
||||
' tabIndex="-1"' +
|
||||
' style="' + (color ? 'background-color: ' + color : '') + '"' +
|
||||
' title="' + tinymce.translate(title) + '">' +
|
||||
(isNoColor ? '×' : '') +
|
||||
'</div>' +
|
||||
'</td>'
|
||||
);
|
||||
}
|
||||
|
||||
colors = mapColors();
|
||||
colors.push({
|
||||
text: tinymce.translate("No color"),
|
||||
color: "transparent"
|
||||
});
|
||||
|
||||
html = '<table class="mce-grid mce-grid-border mce-colorbutton-grid" role="list" cellspacing="0"><tbody>';
|
||||
last = colors.length - 1;
|
||||
rows = editor.settings.textcolor_rows || 5;
|
||||
cols = editor.settings.textcolor_cols || 8;
|
||||
|
||||
for (y = 0; y < rows; y++) {
|
||||
html += '<tr>';
|
||||
|
@ -90,44 +125,32 @@ tinymce.PluginManager.add('textcolor', function(editor) {
|
|||
html += '<td></td>';
|
||||
} else {
|
||||
color = colors[i];
|
||||
html += (
|
||||
'<td>' +
|
||||
'<div id="' + ctrl._id + '-' + i + '"' +
|
||||
' data-mce-color="' + color.color + '"' +
|
||||
' role="option"' +
|
||||
' tabIndex="-1"' +
|
||||
' style="' + (color ? 'background-color: #' + color.color : '') + '"' +
|
||||
' title="' + color.text + '">' +
|
||||
'</div>' +
|
||||
'</td>'
|
||||
);
|
||||
html += getColorCellHtml(color.color, color.text);
|
||||
}
|
||||
}
|
||||
|
||||
html += '</tr>';
|
||||
}
|
||||
|
||||
if (editor.settings.textcolor_enable_hex) {
|
||||
var hexIdN = last + 1;
|
||||
var hexInputColSpan = cols - 1;
|
||||
if (editor.settings.color_picker_callback) {
|
||||
html += (
|
||||
'<tr>' +
|
||||
'<td>' +
|
||||
'<div id="' + ctrl._id + '-' + hexIdN + '"' +
|
||||
'data-mce-color=""' +
|
||||
'style="background-color: #FFFFFF"' +
|
||||
'data-mce-hex-picker="true"' +
|
||||
'role="option" ' +
|
||||
'>' +
|
||||
'<td colspan="' + cols + '" class="mce-custom-color-btn">' +
|
||||
'<div id="' + id + '-c" class="mce-widget mce-btn mce-btn-small mce-btn-flat" ' +
|
||||
'role="button" tabindex="-1" aria-labelledby="' + id + '-c" style="width: 100%">' +
|
||||
'<button type="button" role="presentation" tabindex="-1">' + tinymce.translate('Custom...') + '</button>' +
|
||||
'</div>' +
|
||||
'</td>' +
|
||||
'<td colspan="' + hexInputColSpan + '">' +
|
||||
'# <input type="text" class="mce-textcolor-hexpicker"' +
|
||||
'role="textbox" name="mce-hexcolorpicker"' +
|
||||
'id="' + ctrl._id + '-hexcolorpicker" maxlength="6" >' +
|
||||
'</td>' +
|
||||
'</tr>'
|
||||
);
|
||||
|
||||
html += '<tr>';
|
||||
|
||||
for (x = 0; x < cols; x++) {
|
||||
html += getColorCellHtml('', 'Custom color');
|
||||
}
|
||||
|
||||
html += '</tr>';
|
||||
}
|
||||
|
||||
html += '</tbody></table>';
|
||||
|
@ -135,13 +158,65 @@ tinymce.PluginManager.add('textcolor', function(editor) {
|
|||
return html;
|
||||
}
|
||||
|
||||
function applyFormat(format, value) {
|
||||
editor.focus();
|
||||
editor.formatter.apply(format, {value: value});
|
||||
editor.nodeChanged();
|
||||
}
|
||||
|
||||
function removeFormat(format) {
|
||||
editor.focus();
|
||||
editor.formatter.remove(format, {value: null}, null, true);
|
||||
editor.nodeChanged();
|
||||
}
|
||||
|
||||
function onPanelClick(e) {
|
||||
var buttonCtrl = this.parent(), value;
|
||||
|
||||
if (e.target.getAttribute('disabled')) {
|
||||
return;
|
||||
|
||||
function selectColor(value) {
|
||||
buttonCtrl.hidePanel();
|
||||
buttonCtrl.color(value);
|
||||
applyFormat(buttonCtrl.settings.format, value);
|
||||
}
|
||||
if ((value = e.target.getAttribute('data-mce-color'))) {
|
||||
|
||||
function setDivColor(div, value) {
|
||||
div.style.background = value;
|
||||
div.setAttribute('data-mce-color', value);
|
||||
}
|
||||
|
||||
if (tinymce.DOM.getParent(e.target, '.mce-custom-color-btn')) {
|
||||
buttonCtrl.hidePanel();
|
||||
|
||||
editor.settings.color_picker_callback.call(editor, function(value) {
|
||||
var tableElm = buttonCtrl.panel.getEl().getElementsByTagName('table')[0];
|
||||
var customColorCells, div, i;
|
||||
|
||||
customColorCells = tinymce.map(tableElm.rows[tableElm.rows.length - 1].childNodes, function(elm) {
|
||||
return elm.firstChild;
|
||||
});
|
||||
|
||||
for (i = 0; i < customColorCells.length; i++) {
|
||||
div = customColorCells[i];
|
||||
if (!div.getAttribute('data-mce-color')) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Shift colors to the right
|
||||
// TODO: Might need to be the left on RTL
|
||||
if (i == cols) {
|
||||
for (i = 0; i < cols - 1; i++) {
|
||||
setDivColor(customColorCells[i], customColorCells[i + 1].getAttribute('data-mce-color'));
|
||||
}
|
||||
}
|
||||
|
||||
setDivColor(div, value);
|
||||
selectColor(value);
|
||||
}, getCurrentColor(buttonCtrl.settings.format));
|
||||
}
|
||||
|
||||
value = e.target.getAttribute('data-mce-color');
|
||||
if (value) {
|
||||
if (this.lastId) {
|
||||
document.getElementById(this.lastId).setAttribute('aria-selected', false);
|
||||
}
|
||||
|
@ -149,10 +224,15 @@ tinymce.PluginManager.add('textcolor', function(editor) {
|
|||
e.target.setAttribute('aria-selected', true);
|
||||
this.lastId = e.target.id;
|
||||
|
||||
if (value == 'transparent') {
|
||||
removeFormat(buttonCtrl.settings.format);
|
||||
buttonCtrl.hidePanel();
|
||||
return;
|
||||
}
|
||||
|
||||
selectColor(value);
|
||||
} else if (value !== null) {
|
||||
buttonCtrl.hidePanel();
|
||||
value = '#' + value;
|
||||
buttonCtrl.color(value);
|
||||
editor.execCommand(buttonCtrl.settings.selectcmd, false, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -160,109 +240,19 @@ tinymce.PluginManager.add('textcolor', function(editor) {
|
|||
var self = this;
|
||||
|
||||
if (self._color) {
|
||||
editor.execCommand(self.settings.selectcmd, false, self._color);
|
||||
applyFormat(self.settings.format, self._color);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* isValidHex checks if the provided string is valid hex color string
|
||||
*
|
||||
* @param {string} hexString 3 or 6 chars string representing a color.
|
||||
* @return {Boolean} [true] the string is valid hex color
|
||||
* [false] the string is not valid hex color
|
||||
*/
|
||||
function isValidHex(hexString) {
|
||||
return /(^[0-9A-F]{3,6}$)/i.test(hexString);
|
||||
}
|
||||
|
||||
/**
|
||||
* isSpecialStroke checks if the keyCode is currently a special one:
|
||||
* backspace, delete, arrow keys (left/right)
|
||||
* or if it's a special ctrl+x/c/v
|
||||
*
|
||||
* @param {string} keyCode
|
||||
* @return {Boolean}
|
||||
*/
|
||||
function isSpecialStroke(e) {
|
||||
var keyCode = e.keyCode;
|
||||
// Allow delete and backspace
|
||||
if (keyCode === VK.BACKSPACE || keyCode === VK.DELETE ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Allow arrow movements
|
||||
if (keyCode === VK.LEFT || keyCode === VK.RIGHT) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Allow CTRL/CMD + C/V/X
|
||||
if ((tinymce.isMac ? e.metaKey : e.ctrlKey) && (keyCode == 67 || keyCode == 88 || keyCode == 86)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function initHexPicker(e) {
|
||||
if (!editor.settings.textcolor_enable_hex) {
|
||||
return;
|
||||
}
|
||||
|
||||
var wrapper = document.querySelector('#' + e.target._id);
|
||||
var input = wrapper.querySelector('[name="mce-hexcolorpicker"]');
|
||||
var hexcolorDiv = wrapper.querySelector('[data-mce-hex-picker]');
|
||||
var inputEvent = 'input';
|
||||
|
||||
editor.dom.events.bind(input, 'keydown', function(e){
|
||||
var keyCode = e.keyCode;
|
||||
|
||||
if (isSpecialStroke(e)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Look for anything which is not A-Z or 0-9 and it is not a special char.
|
||||
if (!((keyCode >= 48 && keyCode <= 57) || (keyCode >= 65 && keyCode <= 70) || (keyCode >= 96 && keyCode <= 105)) ) {
|
||||
e.preventDefault();
|
||||
}
|
||||
|
||||
// On Enter, take it like a click on the hexcolorDiv
|
||||
if ( (keyCode === VK.ENTER && isValidHex(input.value) ) ) {
|
||||
hexcolorDiv.click();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// If IE8 we can't use the input event, so we have to
|
||||
// listen for keypress and paste events.
|
||||
// In IE9 the input implementation is buggy so
|
||||
// we use the same events as we'd like on IE8
|
||||
if (tinymce.Env.ie && tinymce.Env.ie <= 9) {
|
||||
inputEvent = 'keypress paste blur keydown keyup propertychange';
|
||||
}
|
||||
|
||||
editor.dom.events.bind(input, inputEvent, function(){
|
||||
if (isValidHex(input.value)) {
|
||||
hexcolorDiv.setAttribute('data-mce-color', input.value);
|
||||
hexcolorDiv.setAttribute('style', 'background-color:#' + input.value);
|
||||
hexcolorDiv.removeAttribute('disabled');
|
||||
} else {
|
||||
hexcolorDiv.setAttribute('disabled', 'disabled');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
editor.addButton('forecolor', {
|
||||
type: 'colorbutton',
|
||||
tooltip: 'Text color',
|
||||
selectcmd: 'ForeColor',
|
||||
format: 'forecolor',
|
||||
panel: {
|
||||
role: 'application',
|
||||
ariaRemember: true,
|
||||
html: renderColorPicker,
|
||||
onclick: onPanelClick,
|
||||
onPostRender: initHexPicker
|
||||
onclick: onPanelClick
|
||||
},
|
||||
onclick: onButtonClick
|
||||
});
|
||||
|
@ -270,13 +260,12 @@ tinymce.PluginManager.add('textcolor', function(editor) {
|
|||
editor.addButton('backcolor', {
|
||||
type: 'colorbutton',
|
||||
tooltip: 'Background color',
|
||||
selectcmd: 'HiliteColor',
|
||||
format: 'hilitecolor',
|
||||
panel: {
|
||||
role: 'application',
|
||||
ariaRemember: true,
|
||||
html: renderColorPicker,
|
||||
onclick: onPanelClick,
|
||||
onPostRender: initHexPicker
|
||||
onclick: onPanelClick
|
||||
},
|
||||
onclick: onButtonClick
|
||||
});
|
||||
|
|
|
@ -1 +1 @@
|
|||
tinymce.PluginManager.add("textcolor",function(e){function t(){var t,o,r=[];for(o=e.settings.textcolor_map||["000000","Black","993300","Burnt orange","333300","Dark olive","003300","Dark green","003366","Dark azure","000080","Navy Blue","333399","Indigo","333333","Very dark gray","800000","Maroon","FF6600","Orange","808000","Olive","008000","Green","008080","Teal","0000FF","Blue","666699","Grayish blue","808080","Gray","FF0000","Red","FF9900","Amber","99CC00","Yellow green","339966","Sea green","33CCCC","Turquoise","3366FF","Royal blue","800080","Purple","999999","Medium gray","FF00FF","Magenta","FFCC00","Gold","FFFF00","Yellow","00FF00","Lime","00FFFF","Aqua","00CCFF","Sky blue","993366","Red violet","C0C0C0","Silver","FF99CC","Pink","FFCC99","Peach","FFFF99","Light yellow","CCFFCC","Pale green","CCFFFF","Pale cyan","99CCFF","Light sky blue","CC99FF","Plum","FFFFFF","White"],t=0;t<o.length;t+=2)r.push({text:o[t+1],color:o[t]});return r}function o(){var o,r,l,c,i,a,n,d,s,u=this;for(o=t(),l='<table class="mce-grid mce-grid-border mce-colorbutton-grid" role="list" cellspacing="0"><tbody>',c=o.length-1,i=e.settings.textcolor_rows||5,a=e.settings.textcolor_cols||8,d=0;i>d;d++){for(l+="<tr>",n=0;a>n;n++)s=d*a+n,s>c?l+="<td></td>":(r=o[s],l+='<td><div id="'+u._id+"-"+s+'" data-mce-color="'+r.color+'" role="option" tabIndex="-1" style="'+(r?"background-color: #"+r.color:"")+'" title="'+r.text+'"></div></td>');l+="</tr>"}if(e.settings.textcolor_enable_hex){var F=c+1,m=a-1;l+='<tr><td><div id="'+u._id+"-"+F+'"data-mce-color=""style="background-color: #FFFFFF"data-mce-hex-picker="true"role="option" ></div></td><td colspan="'+m+'"># <input type="text" class="mce-textcolor-hexpicker"role="textbox" name="mce-hexcolorpicker"id="'+u._id+'-hexcolorpicker" maxlength="6" ></td></tr>'}return l+="</tbody></table>"}function r(t){var o,r=this.parent();t.target.getAttribute("disabled")||(o=t.target.getAttribute("data-mce-color"))&&(this.lastId&&document.getElementById(this.lastId).setAttribute("aria-selected",!1),t.target.setAttribute("aria-selected",!0),this.lastId=t.target.id,r.hidePanel(),o="#"+o,r.color(o),e.execCommand(r.settings.selectcmd,!1,o))}function l(){var t=this;t._color&&e.execCommand(t.settings.selectcmd,!1,t._color)}function c(e){return/(^[0-9A-F]{3,6}$)/i.test(e)}function i(e){var t=e.keyCode;return t===n.BACKSPACE||t===n.DELETE?!0:t===n.LEFT||t===n.RIGHT?!0:(tinymce.isMac?e.metaKey:e.ctrlKey)&&(67==t||88==t||86==t)?!0:!1}function a(t){if(e.settings.textcolor_enable_hex){var o=document.querySelector("#"+t.target._id),r=o.querySelector('[name="mce-hexcolorpicker"]'),l=o.querySelector("[data-mce-hex-picker]"),a="input";e.dom.events.bind(r,"keydown",function(e){var t=e.keyCode;i(e)||(t>=48&&57>=t||t>=65&&70>=t||t>=96&&105>=t||e.preventDefault(),t===n.ENTER&&c(r.value)&&l.click())}),tinymce.Env.ie&&tinymce.Env.ie<=9&&(a="keypress paste blur keydown keyup propertychange"),e.dom.events.bind(r,a,function(){c(r.value)?(l.setAttribute("data-mce-color",r.value),l.setAttribute("style","background-color:#"+r.value),l.removeAttribute("disabled")):l.setAttribute("disabled","disabled")})}}var n=tinymce.util.VK;e.addButton("forecolor",{type:"colorbutton",tooltip:"Text color",selectcmd:"ForeColor",panel:{role:"application",ariaRemember:!0,html:o,onclick:r,onPostRender:a},onclick:l}),e.addButton("backcolor",{type:"colorbutton",tooltip:"Background color",selectcmd:"HiliteColor",panel:{role:"application",ariaRemember:!0,html:o,onclick:r,onPostRender:a},onclick:l})});
|
||||
tinymce.PluginManager.add("textcolor",function(t){function e(e){var o;return t.dom.getParents(t.selection.getStart(),function(t){var r;(r=t.style["forecolor"==e?"color":"background-color"])&&(o=r)}),o}function o(){var e,o,r=[];for(o=t.settings.textcolor_map||["000000","Black","993300","Burnt orange","333300","Dark olive","003300","Dark green","003366","Dark azure","000080","Navy Blue","333399","Indigo","333333","Very dark gray","800000","Maroon","FF6600","Orange","808000","Olive","008000","Green","008080","Teal","0000FF","Blue","666699","Grayish blue","808080","Gray","FF0000","Red","FF9900","Amber","99CC00","Yellow green","339966","Sea green","33CCCC","Turquoise","3366FF","Royal blue","800080","Purple","999999","Medium gray","FF00FF","Magenta","FFCC00","Gold","FFFF00","Yellow","00FF00","Lime","00FFFF","Aqua","00CCFF","Sky blue","993366","Red violet","FFFFFF","White","FF99CC","Pink","FFCC99","Peach","FFFF99","Light yellow","CCFFCC","Pale green","CCFFFF","Pale cyan","99CCFF","Light sky blue","CC99FF","Plum"],e=0;e<o.length;e+=2)r.push({text:o[e+1],color:"#"+o[e]});return r}function r(){function e(t,e){var o="transparent"==t;return'<td class="mce-grid-cell'+(o?" mce-colorbtn-trans":"")+'"><div id="'+m+"-"+F++ +'" data-mce-color="'+(t?t:"")+'" role="option" tabIndex="-1" style="'+(t?"background-color: "+t:"")+'" title="'+tinymce.translate(e)+'">'+(o?"×":"")+"</div></td>"}var r,l,a,n,c,d,u,g=this,m=g._id,F=0;for(r=o(),r.push({text:tinymce.translate("No color"),color:"transparent"}),a='<table class="mce-grid mce-grid-border mce-colorbutton-grid" role="list" cellspacing="0"><tbody>',n=r.length-1,d=0;s>d;d++){for(a+="<tr>",c=0;i>c;c++)u=d*i+c,u>n?a+="<td></td>":(l=r[u],a+=e(l.color,l.text));a+="</tr>"}if(t.settings.color_picker_callback){for(a+='<tr><td colspan="'+i+'" class="mce-custom-color-btn"><div id="'+m+'-c" class="mce-widget mce-btn mce-btn-small mce-btn-flat" role="button" tabindex="-1" aria-labelledby="'+m+'-c" style="width: 100%"><button type="button" role="presentation" tabindex="-1">'+tinymce.translate("Custom...")+"</button></div></td></tr>",a+="<tr>",c=0;i>c;c++)a+=e("","Custom color");a+="</tr>"}return a+="</tbody></table>"}function l(e,o){t.focus(),t.formatter.apply(e,{value:o}),t.nodeChanged()}function a(e){t.focus(),t.formatter.remove(e,{value:null},null,!0),t.nodeChanged()}function n(o){function r(t){s.hidePanel(),s.color(t),l(s.settings.format,t)}function n(t,e){t.style.background=e,t.setAttribute("data-mce-color",e)}var c,s=this.parent();if(tinymce.DOM.getParent(o.target,".mce-custom-color-btn")&&(s.hidePanel(),t.settings.color_picker_callback.call(t,function(t){var e,o,l,a=s.panel.getEl().getElementsByTagName("table")[0];for(e=tinymce.map(a.rows[a.rows.length-1].childNodes,function(t){return t.firstChild}),l=0;l<e.length&&(o=e[l],o.getAttribute("data-mce-color"));l++);if(l==i)for(l=0;i-1>l;l++)n(e[l],e[l+1].getAttribute("data-mce-color"));n(o,t),r(t)},e(s.settings.format))),c=o.target.getAttribute("data-mce-color")){if(this.lastId&&document.getElementById(this.lastId).setAttribute("aria-selected",!1),o.target.setAttribute("aria-selected",!0),this.lastId=o.target.id,"transparent"==c)return a(s.settings.format),void s.hidePanel();r(c)}else null!==c&&s.hidePanel()}function c(){var t=this;t._color&&l(t.settings.format,t._color)}var i,s;s=t.settings.textcolor_rows||5,i=t.settings.textcolor_cols||8,t.addButton("forecolor",{type:"colorbutton",tooltip:"Text color",format:"forecolor",panel:{role:"application",ariaRemember:!0,html:r,onclick:n},onclick:c}),t.addButton("backcolor",{type:"colorbutton",tooltip:"Background color",format:"hilitecolor",panel:{role:"application",ariaRemember:!0,html:r,onclick:n},onclick:c})});
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -342,13 +342,13 @@ tinymce.ThemeManager.add('modern', function(editor) {
|
|||
width = Math.max(settings.min_width || 100, width);
|
||||
width = Math.min(settings.max_width || 0xFFFF, width);
|
||||
|
||||
DOM.css(containerElm, 'width', width + (containerSize.width - iframeSize.width));
|
||||
DOM.css(iframeElm, 'width', width);
|
||||
DOM.setStyle(containerElm, 'width', width + (containerSize.width - iframeSize.width));
|
||||
DOM.setStyle(iframeElm, 'width', width);
|
||||
}
|
||||
|
||||
height = Math.max(settings.min_height || 100, height);
|
||||
height = Math.min(settings.max_height || 0xFFFF, height);
|
||||
DOM.css(iframeElm, 'height', height);
|
||||
DOM.setStyle(iframeElm, 'height', height);
|
||||
|
||||
editor.fire('ResizeEditor');
|
||||
}
|
||||
|
@ -383,7 +383,7 @@ tinymce.ThemeManager.add('modern', function(editor) {
|
|||
deltaY = Math.max(0, scrollContainerPos.y - bodyPos.y);
|
||||
}
|
||||
|
||||
panel.fixed(false).moveRel(body, editor.rtl ? ['tr-br', 'br-tr'] : ['tl-bl', 'bl-tl']).moveBy(deltaX, deltaY);
|
||||
panel.fixed(false).moveRel(body, editor.rtl ? ['tr-br', 'br-tr'] : ['tl-bl', 'bl-tl', 'tr-br']).moveBy(deltaX, deltaY);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
|
@ -18,7 +18,7 @@ $wp_db_version = 29188;
|
|||
*
|
||||
* @global string $tinymce_version
|
||||
*/
|
||||
$tinymce_version = '4028-20140706';
|
||||
$tinymce_version = '4102-20140716';
|
||||
|
||||
/**
|
||||
* Holds the required PHP version
|
||||
|
|
Loading…
Reference in New Issue