- Update to 4.1.2, changelog: https://github.com/tinymce/tinymce/blob/master/changelog.txt
- Update the tests to 4.1.2.
Fixes #28576.

git-svn-id: https://develop.svn.wordpress.org/trunk@29203 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2014-07-17 00:58:41 +00:00
parent 50f7313fdd
commit db9a148b34
30 changed files with 6444 additions and 3644 deletions

View File

@ -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

View File

@ -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

View File

@ -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 &nbsp; 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 "&middot; " 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

View File

@ -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 ? '&#215;' : '') +
'</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
});

View File

@ -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?"&#215;":"")+"</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

View File

@ -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 it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -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

View File

@ -133,18 +133,18 @@ tinymce.PluginManager.add('noneditable', function(editor) {
var rng, child, currentCaretContainer, lastContainer;
if (caretContainer) {
rng = selection.getRng(true);
rng.setStartBefore(caretContainer);
rng.setEndBefore(caretContainer);
rng = selection.getRng(true);
rng.setStartBefore(caretContainer);
rng.setEndBefore(caretContainer);
child = findFirstTextNode(caretContainer);
if (child && child.nodeValue.charAt(0) == invisibleChar) {
child = child.deleteData(0, 1);
}
child = findFirstTextNode(caretContainer);
if (child && child.nodeValue.charAt(0) == invisibleChar) {
child = child.deleteData(0, 1);
}
dom.remove(caretContainer, true);
dom.remove(caretContainer, true);
selection.setRng(rng);
selection.setRng(rng);
} else {
currentCaretContainer = getParentCaretContainer(selection.getStart());
while ((caretContainer = dom.get(caretContainerId)) && caretContainer !== lastContainer) {

View File

@ -26,6 +26,7 @@
<script src="js/init.js"></script>
<!-- tinymce.dom.* -->
<script src="tinymce/dom/DomQuery.js"></script>
<script src="tinymce/dom/DOMUtils.js"></script>
<script src="tinymce/dom/EventUtils.js"></script>
<script src="tinymce/dom/Range.js"></script>
@ -61,6 +62,7 @@
<script src="tinymce/ui/Window.js"></script>
<!-- tinymce.util.* -->
<script src="tinymce/util/Color.js"></script>
<script src="tinymce/util/EventDispatcher.js"></script>
<script src="tinymce/util/JSON.js"></script>
<script src="tinymce/util/JSONRequest.js"></script>
@ -84,21 +86,22 @@
<script src="tinymce/UndoManager.js"></script>
<!-- tinymce.plugins.* -->
<!--<script src="plugins/autosave.js"></script>
<!--<script src="plugins/autolink.js"></script>
<script src="plugins/autosave.js"></script>
<script src="plugins/fullpage.js"></script> -->
<script src="plugins/image.js"></script>
<!--<script src="plugins/importcss.js"></script>
<script src="plugins/jquery_plugin.js"></script>
<script src="plugins/legacyoutput.js"></script>
<script src="plugins/lists.js"></script>
<script src="plugins/lists.js"></script> -->
<script src="plugins/link.js"></script>
<script src="plugins/lists.js"></script>-->
<script src="plugins/media.js"></script>
<!--<script src="plugins/noneditable.js"></script> -->
<script src="plugins/paste.js"></script>
<!--<script src="plugins/searchreplace.js"></script>
<script src="plugins/spellchecker.js"></script>
<script src="plugins/table.js"></script>
<script src="plugins/wordcount.js"></script> -->
<script src="plugins/textpattern.js"></script>
<script src="plugins/wordcount.js"></script>-->
</body>
</html>

View File

@ -4,6 +4,8 @@
QUnit.config.reorder = false;
QUnit.config.hidepassed = true;
window.editor = window.inlineEditor = null;
var oldModule = module;
QUnit.moduleStart(function(details) {

View File

@ -49,32 +49,32 @@
}
test("Urls ended with space", function() {
equal(typeUrl('http://www.tinymce.com'), '<p><a href="http://www.tinymce.com">http://www.tinymce.com</a></p>');
equal(typeUrl('https://www.tinymce.com'), '<p><a href="https://www.tinymce.com">https://www.tinymce.com</a></p>');
equal(typeUrl('ssh://www.tinymce.com'), '<p><a href="ssh://www.tinymce.com">ssh://www.tinymce.com</a></p>');
equal(typeUrl('ftp://www.tinymce.com'), '<p><a href="ftp://www.tinymce.com">ftp://www.tinymce.com</a></p>');
equal(typeUrl('www.tinymce.com'), '<p><a href="http://www.tinymce.com">www.tinymce.com</a></p>');
equal(typeUrl('www.tinymce.com.'), '<p><a href="http://www.tinymce.com">www.tinymce.com</a>.</p>');
equal(typeUrl('http://www.domain.com'), '<p><a href="http://www.domain.com">http://www.domain.com</a></p>');
equal(typeUrl('https://www.domain.com'), '<p><a href="https://www.domain.com">https://www.domain.com</a></p>');
equal(typeUrl('ssh://www.domain.com'), '<p><a href="ssh://www.domain.com">ssh://www.domain.com</a></p>');
equal(typeUrl('ftp://www.domain.com'), '<p><a href="ftp://www.domain.com">ftp://www.domain.com</a></p>');
equal(typeUrl('www.domain.com'), '<p><a href="http://www.domain.com">www.domain.com</a></p>');
equal(typeUrl('www.domain.com.'), '<p><a href="http://www.domain.com">www.domain.com</a>.</p>');
equal(typeUrl('user@domain.com'), '<p><a href="mailto:user@domain.com">user@domain.com</a></p>');
equal(typeUrl('mailto:user@domain.com'), '<p><a href="mailto:user@domain.com">mailto:user@domain.com</a></p>');
equal(typeUrl('first-last@domain.com'), '<p><a href="mailto:first-last@domain.com">first-last@domain.com</a></p>');
});
test("Urls ended with )", function() {
equal(typeAnEclipsedURL('http://www.tinymce.com'), '<p>(<a href="http://www.tinymce.com">http://www.tinymce.com</a>)</p>');
equal(typeAnEclipsedURL('https://www.tinymce.com'), '<p>(<a href="https://www.tinymce.com">https://www.tinymce.com</a>)</p>');
equal(typeAnEclipsedURL('ssh://www.tinymce.com'), '<p>(<a href="ssh://www.tinymce.com">ssh://www.tinymce.com</a>)</p>');
equal(typeAnEclipsedURL('ftp://www.tinymce.com'), '<p>(<a href="ftp://www.tinymce.com">ftp://www.tinymce.com</a>)</p>');
equal(typeAnEclipsedURL('www.tinymce.com'), '<p>(<a href="http://www.tinymce.com">www.tinymce.com</a>)</p>');
equal(typeAnEclipsedURL('www.tinymce.com.'), '<p>(<a href="http://www.tinymce.com">www.tinymce.com</a>.)</p>');
equal(typeAnEclipsedURL('http://www.domain.com'), '<p>(<a href="http://www.domain.com">http://www.domain.com</a>)</p>');
equal(typeAnEclipsedURL('https://www.domain.com'), '<p>(<a href="https://www.domain.com">https://www.domain.com</a>)</p>');
equal(typeAnEclipsedURL('ssh://www.domain.com'), '<p>(<a href="ssh://www.domain.com">ssh://www.domain.com</a>)</p>');
equal(typeAnEclipsedURL('ftp://www.domain.com'), '<p>(<a href="ftp://www.domain.com">ftp://www.domain.com</a>)</p>');
equal(typeAnEclipsedURL('www.domain.com'), '<p>(<a href="http://www.domain.com">www.domain.com</a>)</p>');
equal(typeAnEclipsedURL('www.domain.com.'), '<p>(<a href="http://www.domain.com">www.domain.com</a>.)</p>');
});
test("Urls ended with new line", function() {
equal(typeNewlineURL('http://www.tinymce.com'), '<p><a href="http://www.tinymce.com">http://www.tinymce.com</a></p><p>&nbsp;</p>');
equal(typeNewlineURL('https://www.tinymce.com'), '<p><a href="https://www.tinymce.com">https://www.tinymce.com</a></p><p>&nbsp;</p>');
equal(typeNewlineURL('ssh://www.tinymce.com'), '<p><a href="ssh://www.tinymce.com">ssh://www.tinymce.com</a></p><p>&nbsp;</p>');
equal(typeNewlineURL('ftp://www.tinymce.com'), '<p><a href="ftp://www.tinymce.com">ftp://www.tinymce.com</a></p><p>&nbsp;</p>');
equal(typeNewlineURL('www.tinymce.com'), '<p><a href="http://www.tinymce.com">www.tinymce.com</a></p><p>&nbsp;</p>');
equal(typeNewlineURL('www.tinymce.com.'), '<p><a href="http://www.tinymce.com">www.tinymce.com</a>.</p><p>&nbsp;</p>');
equal(typeNewlineURL('http://www.domain.com'), '<p><a href="http://www.domain.com">http://www.domain.com</a></p><p>&nbsp;</p>');
equal(typeNewlineURL('https://www.domain.com'), '<p><a href="https://www.domain.com">https://www.domain.com</a></p><p>&nbsp;</p>');
equal(typeNewlineURL('ssh://www.domain.com'), '<p><a href="ssh://www.domain.com">ssh://www.domain.com</a></p><p>&nbsp;</p>');
equal(typeNewlineURL('ftp://www.domain.com'), '<p><a href="ftp://www.domain.com">ftp://www.domain.com</a></p><p>&nbsp;</p>');
equal(typeNewlineURL('www.domain.com'), '<p><a href="http://www.domain.com">www.domain.com</a></p><p>&nbsp;</p>');
equal(typeNewlineURL('www.domain.com.'), '<p><a href="http://www.domain.com">www.domain.com</a>.</p><p>&nbsp;</p>');
});
})();

View File

@ -204,9 +204,9 @@ test("Paste Word links", function() {
'<a href="#_ftnref238571849" name="_ftn238571849">[5]</a>' +
'<a href="#_edn238571849" name="_ednref238571849">[6]</a>' +
'<a href="#_ednref238571849" name="_edn238571849">[7]</a>' +
'<a href="http://www.tinymce.com/someurl">8</a>' +
'<a href="http://domain.tinymce.com/someurl">8</a>' +
'<a name="#unknown">9</a>' +
'<a href="http://www.tinymce.com/someurl" name="named_link">named_link</a>' +
'<a href="http://domain.tinymce.com/someurl" name="named_link">named_link</a>' +
'<a>5</a>' +
'</p>'
)
@ -222,7 +222,7 @@ test("Paste Word links", function() {
'<a href="#_ftnref238571849" name="_ftn238571849">[5]</a>' +
'<a href="#_edn238571849" name="_ednref238571849">[6]</a>' +
'<a href="#_ednref238571849" name="_edn238571849">[7]</a>' +
'<a href="http://www.tinymce.com/someurl">8</a>' +
'<a href="http://domain.tinymce.com/someurl">8</a>' +
'9' +
'named_link' +
'5' +
@ -279,6 +279,82 @@ test('paste track changes comment', function() {
equal(editor.getContent(), '<p>1</p>');
});
test('paste nested (UL) word list', function() {
editor.setContent('');
editor.execCommand('mceInsertClipboardContent', false, {
content: (
"<p class=MsoListParagraphCxSpFirst style='text-indent:-18.0pt;mso-list:l0 level1 lfo1'>" +
"<![if !supportLists]><span style='font-family:Symbol;mso-fareast-font-family:Symbol;mso-bidi-font-family:Symbol'>" +
"<span style='mso-list:Ignore'>·<span style='font:7.0pt \"Times New Roman\"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" +
"</span></span></span><![endif]>a</p>" +
"<p class=MsoListParagraphCxSpMiddle style='margin-left:72.0pt;mso-add-space:auto;text-indent:-18.0pt;mso-list:l0 level2 lfo1'>" +
"<![if !supportLists]><span style='font-family:\"Courier New\";mso-fareast-font-family:\"Courier New\"'>" +
"<span style='mso-list:Ignore'>o<span style='font:7.0pt \"Times New Roman\"'>&nbsp;&nbsp;</span></span></span><![endif]>b</p>" +
"<p class=MsoListParagraphCxSpLast style='margin-left:108.0pt;mso-add-space:auto;text-indent:-18.0pt;mso-list:l0 level3 lfo1'>" +
"<![if !supportLists]><span style='font-family:Wingdings;mso-fareast-font-family:Wingdings;mso-bidi-font-family:Wingdings'>" +
"<span style='mso-list:Ignore'>§<span style='font:7.0pt \"Times New Roman\"'>&nbsp;</span></span></span><![endif]>c 1. x</p>"
)
});
equal(
editor.getContent(),
'<ul>'+
'<li>a' +
'<ul>' +
'<li>b' +
'<ul>' +
'<li>c 1. x</li>' +
'</ul>' +
'</li>' +
'</ul>' +
'</li>' +
'</ul>'
);
});
test('paste nested (OL) word list', function() {
editor.setContent('');
editor.execCommand('mceInsertClipboardContent', false, {
content: (
"<p class=MsoListParagraphCxSpFirst style='text-indent:-18.0pt;mso-list:l0 level1 lfo1'>" +
"<![if !supportLists]><span style='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\"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>" +
"</span></span><![endif]>a</p>" +
"<p class=MsoListParagraphCxSpMiddle style='margin-left:72.0pt;mso-add-space:auto;text-indent:-18.0pt;mso-list:l0 level2 lfo1'>" +
"<![if !supportLists]><span style='mso-bidi-font-family:Calibri;mso-bidi-theme-font:minor-latin'><span style='mso-list:Ignore'>a." +
"<span style='font:7.0pt \"Times New Roman\"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span></span><![endif]>b</p>" +
"<p class=MsoListParagraphCxSpLast style='margin-left:108.0pt;mso-add-space:auto;text-indent:-108.0pt;mso-text-indent-alt:-9.0pt;mso-list:l0 level3 lfo1'>" +
"<![if !supportLists]><span style='mso-bidi-font-family:Calibri;mso-bidi-theme-font:minor-latin'><span style='mso-list:Ignore'>" +
"<span style='font:7.0pt \"Times New Roman\"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" +
"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" +
"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" +
"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>i.<span style='font:7.0pt \"Times New Roman\"'>" +
"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span></span><![endif]>c</p>"
)
});
equal(
editor.getContent(),
'<ol>'+
'<li>a' +
'<ol>' +
'<li>b' +
'<ol>' +
'<li>c</li>' +
'</ol>' +
'</li>' +
'</ol>' +
'</li>' +
'</ol>'
);
});
test("Paste paste_merge_formats: true", function() {
editor.settings.paste_merge_formats = true;
@ -464,6 +540,10 @@ test('paste post process (event)', function() {
equal(editor.getContent(), '<p><em>c</em></p>');
});
test('paste innerText of conditional comments', function() {
equal(tinymce.pasteplugin.Utils.innerText('<![if !supportLists]>X<![endif]>'), 'X');
});
test('paste innerText of single P', function() {
editor.setContent('<p>a</p>');
equal(tinymce.pasteplugin.Utils.innerText(editor.getBody().innerHTML), 'a');
@ -509,6 +589,10 @@ test('trim html from clipboard fragments', function() {
equal(tinymce.pasteplugin.Utils.trimHtml('a\n<body>\n<!--StartFragment-->\nb\n<!--EndFragment-->\n</body>\nc'), '\nb\n');
equal(tinymce.pasteplugin.Utils.trimHtml('a<!--StartFragment-->b<!--EndFragment-->c'), 'abc');
equal(tinymce.pasteplugin.Utils.trimHtml('a<body>b</body>c'), 'b');
equal(tinymce.pasteplugin.Utils.trimHtml('a<span class="Apple-converted-space">\u00a0<\/span>b'), 'a b');
equal(tinymce.pasteplugin.Utils.trimHtml('<span class="Apple-converted-space">\u00a0<\/span>b'), ' b');
equal(tinymce.pasteplugin.Utils.trimHtml('a<span class="Apple-converted-space">\u00a0<\/span>'), 'a ');
equal(tinymce.pasteplugin.Utils.trimHtml('<span class="Apple-converted-space">\u00a0<\/span>'), ' ');
});
if (tinymce.Env.webkit) {
@ -568,8 +652,15 @@ if (tinymce.Env.webkit) {
test('paste webkit remove runtime styles (font-family)', function() {
editor.settings.paste_webkit_styles = 'font-family';
editor.setContent('');
editor.execCommand('mceInsertClipboardContent', false, {content: '<span style="font-family:arial; text-indent: 10px">Test</span>'});
equal(editor.getContent(), '<p><span style="font-family: arial;">Test</span></p>');
editor.execCommand('mceInsertClipboardContent', false, {content: '<span style="font-family:serif; text-indent: 10px">Test</span>'});
equal(editor.getContent(), '<p><span style="font-family: serif;">Test</span></p>');
});
test('paste webkit remove runtime styles font-family allowed but not specified', function() {
editor.settings.paste_webkit_styles = 'font-family';
editor.setContent('');
editor.execCommand('mceInsertClipboardContent', false, {content: '<p title="x" style="text-indent: 10px">Test</p>'});
equal(editor.getContent(), '<p title="x">Test</p>');
});
test('paste webkit remove runtime styles (custom styles)', function() {

View File

@ -10,13 +10,26 @@
indent: false,
plugins: 'table',
valid_styles: {
'*' : 'width,height,vertical-align,text-align,float'
'*' : 'width,height,vertical-align,text-align,float,border-color,background-color'
},
init_instance_callback: function(ed) {
window.editor = ed;
QUnit.start();
}
});
},
teardown: function() {
var win = Utils.getFontmostWindow();
if (win) {
win.close();
}
delete editor.settings.table_adv_tab;
delete editor.settings.table_cell_adv_tab;
delete editor.settings.table_class_list;
delete editor.settings.table_cell_class_list;
delete editor.settings.table_row_class_list;
}
});
@ -35,7 +48,28 @@
test("Table properties dialog (get data from plain table)", function() {
editor.setContent('<table><tr><td>X</td></tr></table>');
Utils.setSelection('td', 0);
editor.execCommand('mceInsertTable');
editor.execCommand('mceTableProps');
deepEqual(Utils.getFontmostWindow().toJSON(), {
"align": "",
"border": "",
"caption": false,
"cellpadding": "",
"cellspacing": "",
"height": "",
"width": "",
"backgroundColor": "",
"borderColor": "",
"style": ""
});
});
test("Table properties dialog (get/set data from/to plain table, no adv tab)", function() {
editor.settings.table_adv_tab = false;
editor.setContent('<table><tr><td>X</td></tr></table>');
Utils.setSelection('td', 0);
editor.execCommand('mceTableProps');
deepEqual(Utils.getFontmostWindow().toJSON(), {
"align": "",
@ -47,7 +81,47 @@
"width": ""
});
Utils.getFontmostWindow().close();
fillAndSubmitWindowForm({
width: "100",
height: "101"
});
equal(
cleanTableHtml(editor.getContent()),
'<table style="width: 100px; height: 101px;"><tbody><tr><td>x</td></tr></tbody></table>'
);
});
test("Table properties dialog (get/set data from/to plain table, class list)", function() {
editor.settings.table_class_list = [{title: 'Class1', value: 'class1'}];
editor.setContent('<table><tr><td>X</td></tr></table>');
Utils.setSelection('td', 0);
editor.execCommand('mceTableProps');
deepEqual(Utils.getFontmostWindow().toJSON(), {
"align": "",
"border": "",
"caption": false,
"cellpadding": "",
"cellspacing": "",
"height": "",
"width": "",
"backgroundColor": "",
"borderColor": "",
"style": "",
"class": ""
});
fillAndSubmitWindowForm({
width: "100",
height: "101"
});
equal(
cleanTableHtml(editor.getContent()),
'<table style="width: 100px; height: 101px;"><tbody><tr><td>x</td></tr></tbody></table>'
);
});
test("Table properties dialog (get data from full table)", function() {
@ -63,7 +137,7 @@
);
Utils.setSelection('td', 0);
editor.execCommand('mceInsertTable');
editor.execCommand('mceTableProps');
deepEqual(Utils.getFontmostWindow().toJSON(), {
"align": "",
@ -72,16 +146,17 @@
"cellpadding": "3",
"cellspacing": "2",
"height": "101",
"width": "100"
"width": "100",
"backgroundColor": "",
"borderColor": "",
"style": "width: 100px; height: 101px;"
});
Utils.getFontmostWindow().close();
});
test("Table properties dialog (add caption)", function() {
editor.setContent('<table><tr><td>X</td></tr></table>');
Utils.setSelection('td', 0);
editor.execCommand('mceInsertTable');
editor.execCommand('mceTableProps');
fillAndSubmitWindowForm({
caption: true
});
@ -95,7 +170,7 @@
test("Table properties dialog (remove caption)", function() {
editor.setContent('<table><caption>&nbsp;</caption><tr><td>X</td></tr></table>');
Utils.setSelection('td', 0);
editor.execCommand('mceInsertTable');
editor.execCommand('mceTableProps');
fillAndSubmitWindowForm({
caption: false
});
@ -109,7 +184,7 @@
test("Table properties dialog (change size in pixels)", function() {
editor.setContent('<table><tr><td>X</td></tr></table>');
Utils.setSelection('td', 0);
editor.execCommand('mceInsertTable');
editor.execCommand('mceTableProps');
fillAndSubmitWindowForm({
width: 100,
height: 101
@ -124,7 +199,7 @@
test("Table properties dialog (change size in %)", function() {
editor.setContent('<table><tr><td>X</td></tr></table>');
Utils.setSelection('td', 0);
editor.execCommand('mceInsertTable');
editor.execCommand('mceTableProps');
fillAndSubmitWindowForm({
width: "100%",
height: "101%"
@ -136,10 +211,10 @@
);
});
test("Table properties dialog (change: border,cellpadding,cellspacing,align)", function() {
editor.setContent('<table><tr><td>X</td></tr></table>');
test("Table properties dialog (change: border,cellpadding,cellspacing,align,backgroundColor,borderColor)", function() {
editor.setContent('<table style="border-color: red; background-color: blue"><tr><td>X</td></tr></table>');
Utils.setSelection('td', 0);
editor.execCommand('mceInsertTable');
editor.execCommand('mceTableProps');
fillAndSubmitWindowForm({
border: "1",
cellpadding: "2",
@ -149,7 +224,7 @@
equal(
cleanTableHtml(editor.getContent()),
'<table style="float: right;" border="1" cellspacing="3" cellpadding="2"><tbody><tr><td>x</td></tr></tbody></table>'
'<table style="float: right; border-color: red; background-color: blue;" border="1" cellspacing="3" cellpadding="2"><tbody><tr><td>x</td></tr></tbody></table>'
);
});
@ -158,6 +233,26 @@
Utils.setSelection('td', 0);
editor.execCommand('mceTableCellProps');
deepEqual(Utils.getFontmostWindow().toJSON(), {
"align": "",
"valign": "",
"height": "",
"scope": "",
"type": "td",
"width": "",
"backgroundColor": "",
"borderColor": "",
"style": ""
});
});
test("Table cell properties dialog (get/set data from/to plain cell, no adv tab)", function() {
editor.settings.table_cell_adv_tab = false;
editor.setContent('<table><tr><td>X</td></tr></table>');
Utils.setSelection('td', 0);
editor.execCommand('mceTableCellProps');
deepEqual(Utils.getFontmostWindow().toJSON(), {
"align": "",
"valign": "",
@ -167,11 +262,19 @@
"width": ""
});
Utils.getFontmostWindow().close();
fillAndSubmitWindowForm({
width: 100,
height: 101
});
equal(
cleanTableHtml(editor.getContent()),
'<table><tbody><tr><td style="width: 100px; height: 101px;">x</td></tr></tbody></table>'
);
});
test("Table cell properties dialog (get data from complex cell)", function() {
editor.setContent('<table><tr><th style="text-align: right; vertical-align: top; width: 10px; height: 11px" scope="row">X</th></tr></table>');
editor.setContent('<table><tr><th style="text-align: right; vertical-align: top; width: 10px; height: 11px; border-color: red; background-color: blue" scope="row">X</th></tr></table>');
Utils.setSelection('th', 0);
editor.execCommand('mceTableCellProps');
@ -181,10 +284,11 @@
"height": "11",
"scope": "row",
"type": "th",
"width": "10"
"width": "10",
"backgroundColor": "blue",
"borderColor": "red",
"style": "width: 10px; height: 11px; vertical-align: top; text-align: right; border-color: red; background-color: blue;"
});
Utils.getFontmostWindow().close();
});
test("Table cell properties dialog (update all)", function() {
@ -214,24 +318,26 @@
deepEqual(Utils.getFontmostWindow().toJSON(), {
"align": "",
"height": "",
"type": "tbody"
"type": "tbody",
"backgroundColor": "",
"borderColor": "",
"style": ""
});
Utils.getFontmostWindow().close();
});
test("Table row properties dialog (get data from complex cell)", function() {
editor.setContent('<table><thead><tr style="height: 10px; text-align: right"><td>X</td></tr></thead></table>');
test("Table row properties dialog (get data from complex row)", function() {
editor.setContent('<table><thead><tr style="height: 10px; text-align: right; border-color: red; background-color: blue"><td>X</td></tr></thead></table>');
Utils.setSelection('td', 0);
editor.execCommand('mceTableRowProps');
deepEqual(Utils.getFontmostWindow().toJSON(), {
"align": "right",
"height": "10",
"type": "thead"
"type": "thead",
"backgroundColor": "blue",
"borderColor": "red",
"style": "height: 10px; text-align: right; border-color: red; background-color: blue;"
});
Utils.getFontmostWindow().close();
});
test("Table row properties dialog (update all)", function() {
@ -301,7 +407,7 @@
});
test("mceTableMergeCells command with cell selection", function() {
editor.setContent('<table><tr><td class="mce-item-selected">1</td><td class="mce-item-selected">2</td></tr></table>');
editor.getBody().innerHTML = '<table><tr><td class="mce-item-selected">1</td><td class="mce-item-selected">2</td></tr></table>';
Utils.setSelection('td', 0);
editor.execCommand('mceTableMergeCells');
equal(cleanTableHtml(editor.getContent()), '<table><tbody><tr><td colspan="2">12</td></tr></tbody></table>');

View File

@ -0,0 +1,126 @@
(function() {
module("tinymce.plugins.TextPattern", {
setupModule: function() {
QUnit.stop();
tinymce.init({
selector: 'textarea',
add_unload_trigger: false,
skin: false,
indent: false,
plugins: "textpattern",
init_instance_callback: function(ed) {
window.editor = ed;
QUnit.start();
}
});
},
teardown: function() {
delete editor.settings.textpattern_patterns;
}
});
test('Italic format on single word using space', function() {
editor.setContent('<p>*abc*\u00a0</p>');
Utils.setSelection('p', 6);
editor.fire('keyup', {keyCode: 32});
equal(
editor.getContent(),
'<p><em>abc</em>&nbsp;</p>'
);
});
test('Bold format on single word using space', function() {
editor.setContent('<p>**abc**\u00a0</p>');
Utils.setSelection('p', 8);
editor.fire('keyup', {keyCode: 32});
equal(
editor.getContent(),
'<p><strong>abc</strong>&nbsp;</p>'
);
});
test('Bold format on multiple words using space', function() {
editor.setContent('<p>**abc 123**\u00a0</p>');
Utils.setSelection('p', 12);
editor.fire('keyup', {keyCode: 32});
equal(
editor.getContent(),
'<p><strong>abc 123</strong>&nbsp;</p>'
);
});
test('Bold format on single word using enter', function() {
editor.setContent('<p>**abc**</p>');
Utils.setSelection('p', 7);
editor.fire('keydown', {keyCode: 13});
equal(
editor.getContent(),
'<p><strong>abc</strong></p><p>&nbsp;</p>'
);
});
test('H1 format on single word node using enter', function() {
editor.setContent('<p>#abc</p>');
Utils.setSelection('p', 4);
editor.fire('keydown', {keyCode: 13});
equal(
editor.getContent(),
'<h1>abc</h1><p>&nbsp;</p>'
);
});
test('OL format on single word node using enter', function() {
editor.setContent('<p>1. abc</p>');
Utils.setSelection('p', 6);
editor.fire('keydown', {keyCode: 13});
equal(
editor.getContent(),
'<ol><li>abc</li><li></li></ol>'
);
});
test('UL format on single word node using enter', function() {
editor.setContent('<p>* abc</p>');
Utils.setSelection('p', 5);
editor.fire('keydown', {keyCode: 13});
equal(
editor.getContent(),
'<ul><li>abc</li><li></li></ul>'
);
});
test('getPatterns/setPatterns', function() {
editor.plugins.textpattern.setPatterns([
{start: '#', format: 'h1'},
{start: '##', format: 'h2'},
{start: '###', format: 'h3'}
]);
deepEqual(
editor.plugins.textpattern.getPatterns(),
[
{
"format": "h3",
"start": "###"
},
{
"format": "h2",
"start": "##"
},
{
"format": "h1",
"start": "#"
}
]
);
});
})();

View File

@ -324,10 +324,10 @@ asyncTest('remove editor', function() {
});
test('insertContent', function() {
editor.setContent('<p>a</p>');
editor.setContent('<p>ab</p>');
Utils.setSelection('p', 1);
editor.insertContent('b');
equal(editor.getContent(), '<p>ab</p>');
editor.insertContent('c');
equal(editor.getContent(), '<p>acb</p>');
});
test('insertContent merge', function() {

View File

@ -72,9 +72,14 @@ test('Remove empty root text nodes', function() {
editor.settings.forced_root_block = 'div';
editor.getBody().innerHTML = 'abcd<div>abcd</div>';
Utils.setSelection('body', 2);
body.insertBefore(editor.getDoc().createTextNode(''), body.firstChild);
body.appendChild(editor.getDoc().createTextNode(''));
var rng = editor.dom.createRng();
rng.setStart(editor.getBody().childNodes[1], 1);
rng.setEnd(editor.getBody().childNodes[1], 1);
editor.selection.setRng(rng);
Utils.pressArrowKey();
equal(Utils.cleanHtml(body.innerHTML), '<div>abcd</div><div>abcd</div>');
equal(editor.selection.getNode().nodeName, 'DIV');

View File

@ -20,7 +20,7 @@ module("tinymce.Formatter - Apply", {
init_instance_callback: function(ed) {
window.editor = ed;
if (window.inlineEditor) {
if (inlineEditor) {
QUnit.start();
}
}
@ -41,7 +41,7 @@ module("tinymce.Formatter - Apply", {
init_instance_callback: function(ed) {
window.inlineEditor = ed;
if (window.editor) {
if (editor) {
QUnit.start();
}
}
@ -1086,6 +1086,17 @@ test("Applying formats in lists", function() {
equal(editor.getContent(), '<ul><li><h1>text</h1><ul><li>nested</li></ul></li></ul>', "heading should not automatically apply to sublists");
});
test("Applying formats on a list including child nodes", function(){
editor.formatter.register('format', {inline: 'strong'});
editor.setContent('<ol><li>a</li><li>b<ul><li>c</li><li>d<br /><ol><li>e</li><li>f</li></ol></li></ul></li><li>g</li></ol>');
rng = editor.dom.createRng();
rng.setStart(editor.dom.select('li')[0].firstChild, 0);
rng.setEnd(editor.dom.select('li')[6].firstChild, 1);
editor.selection.setRng(rng);
editor.formatter.apply("format");
equal(editor.getContent(), '<ol><li><strong>a</strong></li><li><strong>b</strong><ul><li><strong>c</strong></li><li><strong>d</strong><br /><ol><li><strong>e</strong></li><li><strong>f</strong></li></ol></li></ul></li><li><strong>g</strong></li></ol>', "should be applied to all sublists");
});
test('Block format on li element', function() {
editor.setContent('<ul><li>text<ul><li>nested</li></ul></li></ul>');
var rng = editor.dom.createRng();
@ -1595,4 +1606,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>');
});
});

View File

@ -62,17 +62,13 @@
DOM.remove('test');
});
test('addClass', 10, function() {
test('addClass', function() {
DOM.add(document.body, 'div', {id : 'test'});
DOM.get('test').className = '';
DOM.addClass('test', 'abc');
equal(DOM.get('test').className, 'abc');
DOM.get('test').className = '';
equal(DOM.addClass('test', 'abc'), 'abc');
equal(DOM.addClass(null, 'abc'), false);
DOM.addClass('test', '123');
equal(DOM.get('test').className, 'abc 123');
@ -83,17 +79,10 @@
equal(DOM.get('test4').className, 'abc');
DOM.get('test').innerHTML = '';
DOM.get('test').innerHTML = '<span id="test2"></span><span id="test3"></span><span id="test4"></span>';
DOM.addClass(['test2', 'test3', 'test4'], 'abc');
equal(DOM.get('test2').className, 'abc');
equal(DOM.get('test3').className, 'abc');
equal(DOM.get('test4').className, 'abc');
DOM.get('test').innerHTML = '';
DOM.remove('test');
});
test('removeClass', 4, function() {
test('removeClass', 5, function() {
DOM.add(document.body, 'div', {id : 'test'});
DOM.get('test').className = 'abc 123 xyz';
@ -105,7 +94,10 @@
equal(DOM.get('test2').className, '');
equal(DOM.get('test3').className, 'test test');
equal(DOM.get('test4').className, 'test');
DOM.get('test').innerHTML = '';
DOM.get('test').innerHTML = '<span id="test2" class="test"></span>';
DOM.removeClass('test2', 'test');
equal(Utils.normalizeHtml(DOM.get('test').innerHTML), '<span id="test2"></span>');
DOM.remove('test');
});
@ -185,29 +177,17 @@
equal(DOM.uniqueId(), 'mce_2');
});
test('showHide', 10, function() {
test('showHide', function() {
DOM.add(document.body, 'div', {id : 'test'});
DOM.show('test');
equal(DOM.get('test').style.display, 'block');
equal(DOM.get('test').style.display, '');
ok(!DOM.isHidden('test'));
DOM.hide('test');
equal(DOM.get('test').style.display, 'none');
ok(DOM.isHidden('test'));
DOM.get('test').innerHTML = '<span id="test2"></span><span id="test3"></span><span id="test4"></span>';
DOM.hide(['test2', 'test3', 'test4'], 'test');
equal(DOM.get('test2').style.display, 'none');
equal(DOM.get('test3').style.display, 'none');
equal(DOM.get('test4').style.display, 'none');
DOM.get('test').innerHTML = '<span id="test2"></span><span id="test3"></span><span id="test4"></span>';
DOM.show(['test2', 'test3', 'test4'], 'test');
equal(DOM.get('test2').style.display, 'block');
equal(DOM.get('test3').style.display, 'block');
equal(DOM.get('test4').style.display, 'block');
// Cleanup
DOM.setAttrib('test', 'style', '');
@ -246,7 +226,7 @@
equal(DOM.encode('abc<>"&\'\u00e5\u00e4\u00f6'), 'abc&lt;&gt;&quot;&amp;&#39;\u00e5\u00e4\u00f6');
});
test('setGetAttrib', 16, function() {
test('setGetAttrib', function() {
var dom;
DOM.add(document.body, 'div', {id : 'test'});
@ -275,12 +255,6 @@
equal(DOM.getAttrib('test', 'src'), '&<>"123&<>"src');
equal(DOM.getAttrib('test', 'href'), '&<>"abc&<>"href');
DOM.get('test').innerHTML = '<span id="test2"></span><span id="test3"></span><span id="test4"></span>';
DOM.setAttribs(['test2', 'test3', 'test4'], {test1 : "1", test2 : "2"});
equal(DOM.getAttrib('test2', 'test1'), '1');
equal(DOM.getAttrib('test3', 'test2'), '2');
equal(DOM.getAttrib('test4', 'test1'), '1');
equal(DOM.getAttrib(document, 'test'), false);
equal(DOM.getAttrib(document, 'test', ''), '');
equal(DOM.getAttrib(document, 'test', 'x'), 'x');
@ -314,32 +288,32 @@
DOM.remove('test');
});
test('setGetStyles', 9, function() {
test('setGetStyles', function() {
DOM.add(document.body, 'div', {id : 'test'});
DOM.setStyle('test', 'font-size', '20px');
equal(DOM.getStyle('test', 'font-size'), '20px', null, tinymce.isWebKit);
equal(DOM.getStyle('test', 'font-size'), '20px');
DOM.setStyle('test', 'fontSize', '21px');
equal(DOM.getStyle('test', 'fontSize'), '21px', null, tinymce.isWebKit);
equal(DOM.getStyle('test', 'fontSize'), '21px');
DOM.setStyles('test', {fontSize : '22px', display : 'inline'});
equal(DOM.getStyle('test', 'fontSize'), '22px', null, tinymce.isWebKit);
equal(DOM.getStyle('test', 'display'), 'inline', null, tinymce.isWebKit);
DOM.get('test').innerHTML = '<span id="test2"></span><span id="test3"></span><span id="test4"></span>';
DOM.setStyles(['test2', 'test3', 'test4'], {fontSize : "22px"});
equal(DOM.getStyle('test2', 'fontSize'), '22px');
equal(DOM.getStyle('test3', 'fontSize'), '22px');
equal(DOM.getStyle('test4', 'fontSize'), '22px');
equal(DOM.getStyle('test', 'fontSize'), '22px');
equal(DOM.getStyle('test', 'display'), 'inline');
DOM.setStyle('test', 'fontSize', 23);
equal(DOM.getStyle('test', 'fontSize'), '23px', null, tinymce.isWebKit);
equal(DOM.getStyle('test', 'fontSize'), '23px');
DOM.setStyle('test', 'fontSize', '24');
equal(DOM.getStyle('test', 'fontSize'), '24px', null, tinymce.isWebKit);
DOM.setStyle('test', 'fontSize', 23);
DOM.setStyle('test', 'fontSize', '');
equal(DOM.getStyle('test', 'fontSize'), '');
DOM.setStyle('test', 'fontSize', 23);
DOM.setStyle('test', 'fontSize', null);
equal(DOM.getStyle('test', 'fontSize'), '');
DOM.setAttrib('test', 'style', '');
equal(typeof DOM.getStyle(null, 'fontSize'), 'undefined');
DOM.remove('test');
});
@ -503,7 +477,7 @@
ok(DOM.isBlock('div'));
});
test('remove', 3, function() {
test('remove', 2, function() {
DOM.add(document.body, 'div', {id : 'test'});
DOM.setHTML('test', '<span id="test2"><span>test</span><span>test2</span></span>');
@ -513,10 +487,6 @@
DOM.setHTML('test', '<span id="test2"><span>test</span><span>test2</span></span>');
equal(DOM.remove('test2').nodeName, 'SPAN');
DOM.get('test').innerHTML = '<span id="test2"></span><span id="test3"></span><span id="test4"></span>';
DOM.remove(['test2', 'test4']);
equal(DOM.select('span', 'test').length, 1);
DOM.remove('test');
});

File diff suppressed because it is too large Load Diff

View File

@ -84,7 +84,7 @@
test('Parse elements', function() {
var counter, parser;
expect(46);
expect(48);
counter = createCounter(writer);
parser = new tinymce.html.SaxParser(counter, schema);
@ -163,6 +163,13 @@
equal(writer.getContent(), '<myns-mytag>text</myns-mytag>', 'Parse element with dash name.');
deepEqual(counter.counts, {start:1, text:1, end:1}, 'Parse element with dash name counts.');
counter = createCounter(writer);
parser = new tinymce.html.SaxParser(counter, schema);
writer.reset();
parser.parse('<myns_mytag>text</myns_mytag>');
equal(writer.getContent(), '<myns_mytag>text</myns_mytag>', 'Parse element with underscore name.');
deepEqual(counter.counts, {start:1, text:1, end:1}, 'Parse element with underscore name counts.');
counter = createCounter(writer);
parser = new tinymce.html.SaxParser(counter, schema);
writer.reset();

View File

@ -224,7 +224,7 @@ test('getNonEmptyElements', function() {
"embed": {}, "param": {}, "meta": {}, "link": {}, "isindex": {},
"input": {}, "img": {}, "hr": {}, "frame": {}, "col": {}, "br": {},
"basefont": {}, "base": {}, "area": {}, "source" : {},
"td": {}, "th": {}, "iframe": {}, "video": {}, "audio": {}, "object": {}, "wbr" : {}, "track" : {}, "script" : {},
"td": {}, "th": {}, "iframe": {}, "video": {}, "audio": {}, "object": {}, "wbr" : {}, "track" : {}, "script" : {}
});
});

View File

@ -0,0 +1,36 @@
(function() {
module("tinymce.util.Color");
var Color = tinymce.util.Color;
test("Constructor", function() {
equal(new Color().toHex(), '#000000');
equal(new Color('#faebcd').toHex(), '#faebcd');
});
test("parse method", function() {
var color = new Color();
equal(color.parse('#faebcd').toHex(), '#faebcd');
equal(color.parse('#ccc').toHex(), '#cccccc');
equal(color.parse(' #faebcd ').toHex(), '#faebcd');
equal(color.parse('rgb(255,254,253)').toHex(), '#fffefd');
equal(color.parse(' rgb ( 255 , 254 , 253 ) ').toHex(), '#fffefd');
equal(color.parse({r: 255, g: 254, b: 253}).toHex(), '#fffefd');
equal(color.parse({h: 359, s: 50, v: 50}).toHex(), '#804041');
equal(color.parse({r: 700, g: 700, b: 700}).toHex(), '#ffffff');
equal(color.parse({r: -1, g: -10, b: -20}).toHex(), '#000000');
});
test("toRgb method", function() {
deepEqual(new Color('#faebcd').toRgb(), {r: 250, g: 235, b: 205});
});
test("toHsv method", function() {
deepEqual(new Color('#804041').toHsv(), {h: 359, s: 50, v: 50});
});
test("toHex method", function() {
equal(new Color({r: 255, g: 254, b: 253}).toHex(), '#fffefd');
});
})();