Fixes #32801.

git-svn-id: https://develop.svn.wordpress.org/trunk@33013 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2015-07-01 00:51:22 +00:00
parent f733d8a91d
commit 58f914004d
55 changed files with 4455 additions and 2055 deletions

View File

@ -116,7 +116,7 @@
box-sizing: border-box;
}
.mce-window .mce-wp-help .mce-container-body.mce-undefined {
.mce-window .mce-wp-help > .mce-container-body {
width: auto !important;
}
@ -423,6 +423,10 @@ div.mce-path {
line-height: normal;
}
.mce-toolbar .mce-listbox button {
padding-right: 20px;
}
.mce-toolbar .mce-btn i {
text-shadow: none;
}
@ -472,13 +476,7 @@ div.mce-path {
}
.mce-listbox i.mce-caret {
right: 6px;
}
.mce-panel .mce-btn button.mce-open i.mce-caret,
.mce-panel .mce-btn.mce-listbox i.mce-caret {
margin-left: 0;
margin-right: 0;
right: 4px;
}
.mce-panel .mce-btn:hover i.mce-caret {

View File

@ -1,8 +1,8 @@
/**
* plugin.js
*
* Copyright, Moxiecode Systems AB
* Released under LGPL License.
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing

View File

@ -1,8 +1,8 @@
/**
* plugin.js
*
* Copyright, Moxiecode Systems AB
* Released under LGPL License.
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing

View File

@ -1,8 +1,8 @@
/**
* plugin.js
*
* Copyright, Moxiecode Systems AB
* Released under LGPL License.
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
@ -278,7 +278,7 @@
tinymce.addI18n = function(prefix, o) {
var I18n = tinymce.util.I18n, each = tinymce.each;
if (typeof(prefix) == "string" && prefix.indexOf('.') === -1) {
if (typeof prefix == "string" && prefix.indexOf('.') === -1) {
I18n.add(prefix, o);
return;
}

View File

@ -1,8 +1,8 @@
/**
* plugin.js
*
* Copyright, Moxiecode Systems AB
* Released under LGPL License.
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing

View File

@ -1,8 +1,8 @@
/**
* plugin.js
*
* Copyright, Moxiecode Systems AB
* Released under LGPL License.
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing

View File

@ -1,8 +1,8 @@
/**
* plugin.js
*
* Copyright, Moxiecode Systems AB
* Released under LGPL License.
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing

View File

@ -1,8 +1,8 @@
/**
* plugin.js
*
* Copyright, Moxiecode Systems AB
* Released under LGPL License.
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
@ -23,7 +23,7 @@ tinymce.PluginManager.add('image', function(editor) {
}
img.onload = function() {
done(img.clientWidth, img.clientHeight);
done(Math.max(img.width, img.clientWidth), Math.max(img.height, img.clientHeight));
};
img.onerror = function() {
@ -308,6 +308,7 @@ tinymce.PluginManager.add('image', function(editor) {
win.find('#src').value(e.control.value()).fire('change');
},
onPostRender: function() {
/*eslint consistent-this: 0*/
imageListCtrl = this;
}
};

File diff suppressed because one or more lines are too long

View File

@ -1,8 +1,8 @@
/**
* plugin.js
*
* Copyright, Moxiecode Systems AB
* Released under LGPL License.
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing

View File

@ -1,8 +1,8 @@
/**
* plugin.js
*
* Copyright, Moxiecode Systems AB
* Released under LGPL License.
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
@ -175,7 +175,7 @@ tinymce.PluginManager.add('media', function(editor, url) {
{
title: 'Embed',
type: "panel",
type: "container",
layout: 'flex',
direction: 'column',
align: 'stretch',

File diff suppressed because one or more lines are too long

View File

@ -85,8 +85,8 @@
/**
* Utils.js
*
* Copyright, Moxiecode Systems AB
* Released under LGPL License.
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
@ -217,8 +217,8 @@ define("tinymce/pasteplugin/Utils", [
/**
* Clipboard.js
*
* Copyright, Moxiecode Systems AB
* Released under LGPL License.
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
@ -281,7 +281,7 @@ define("tinymce/pasteplugin/Clipboard", [
}
if (!args.isDefaultPrevented()) {
editor.insertContent(html, {merge: editor.settings.paste_merge_formats !== false});
editor.insertContent(html, {merge: editor.settings.paste_merge_formats !== false, data: {paste: true}});
}
}
}
@ -805,19 +805,40 @@ define("tinymce/pasteplugin/Clipboard", [
// Remove all data images from paste for example from Gecko
// except internal images like video elements
editor.parser.addNodeFilter('img', function(nodes) {
if (!editor.settings.paste_data_images) {
editor.parser.addNodeFilter('img', function(nodes, name, args) {
function isPasteInsert(args) {
return args.data && args.data.paste === true;
}
function remove(node) {
if (!node.attr('data-mce-object') && src !== Env.transparentSrc) {
node.remove();
}
}
function isWebKitFakeUrl(src) {
return src.indexOf("webkit-fake-url") === 0;
}
function isDataUri(src) {
return src.indexOf("data:") === 0;
}
if (!editor.settings.paste_data_images && isPasteInsert(args)) {
var i = nodes.length;
while (i--) {
var src = nodes[i].attributes.map.src;
// Some browsers automatically produce data uris on paste
if (!src) {
continue;
}
// Safari on Mac produces webkit-fake-url see: https://bugs.webkit.org/show_bug.cgi?id=49141
if (src && /^(data:image|webkit\-fake\-url)/.test(src)) {
if (!nodes[i].attr('data-mce-object') && src !== Env.transparentSrc) {
nodes[i].remove();
}
if (isWebKitFakeUrl(src)) {
remove(nodes[i]);
} else if (!editor.settings.allow_html_data_urls && isDataUri(src)) {
remove(nodes[i]);
}
}
}
@ -831,8 +852,8 @@ define("tinymce/pasteplugin/Clipboard", [
/**
* WordFilter.js
*
* Copyright, Moxiecode Systems AB
* Released under LGPL License.
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
@ -1332,8 +1353,8 @@ define("tinymce/pasteplugin/WordFilter", [
/**
* Quirks.js
*
* Copyright, Moxiecode Systems AB
* Released under LGPL License.
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
@ -1494,8 +1515,8 @@ define("tinymce/pasteplugin/Quirks", [
/**
* Plugin.js
*
* Copyright, Moxiecode Systems AB
* Released under LGPL License.
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing

File diff suppressed because one or more lines are too long

View File

@ -1,8 +1,8 @@
/**
* plugin.js
*
* Copyright, Moxiecode Systems AB
* Released under LGPL License.
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing

View File

@ -1,8 +1,8 @@
/**
* plugin.js
*
* Copyright, Moxiecode Systems AB
* Released under LGPL License.
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing

View File

@ -648,6 +648,10 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) {
toolbar.bottom = bottom;
function reposition() {
if ( ! currentSelection ) {
return this;
}
var scrollX = window.pageXOffset || document.documentElement.scrollLeft,
scrollY = window.pageYOffset || document.documentElement.scrollTop,
windowWidth = window.innerWidth,

View File

@ -60,4 +60,24 @@
<glyph unicode="&#xe033;" d="M128 416l288-288 480 480-128 128-352-352-160 160z" />
<glyph unicode="&#xe034;" d="M928 832h-416l-32 64h-352l-64-128h896zM904.34 256h74.86l44.8 448h-1024l64-640h484.080c-104.882 37.776-180.080 138.266-180.080 256 0 149.982 122.018 272 272 272 149.98 0 272-122.018 272-272 0-21.678-2.622-43.15-7.66-64zM1002.996 46.25l-198.496 174.692c17.454 28.92 27.5 62.814 27.5 99.058 0 106.040-85.96 192-192 192s-192-85.96-192-192 85.96-192 192-192c36.244 0 70.138 10.046 99.058 27.5l174.692-198.496c22.962-26.678 62.118-28.14 87.006-3.252l5.492 5.492c24.888 24.888 23.426 64.044-3.252 87.006zM640 196c-68.484 0-124 55.516-124 124s55.516 124 124 124 124-55.516 124-124-55.516-124-124-124z" />
<glyph unicode="&#xe035;" d="M512 448v-128h32l32 64h64v-256h-48v-64h224v64h-48v256h64l32-64h32v128zM832 640v160c0 17.6-14.4 32-32 32h-224v64c0 35.2-28.8 64-64 64h-128c-35.204 0-64-28.8-64-64v-64h-224c-17.602 0-32-14.4-32-32v-640c0-17.6 14.398-32 32-32h288v-192h640v704h-192zM384 895.886c0.034 0.038 0.072 0.078 0.114 0.114h127.768c0.042-0.036 0.082-0.076 0.118-0.114v-63.886h-128v63.886zM192 704v64h512v-64h-512zM960 0h-512v576h512v-576z" />
<glyph unicode="&#xe600;" d="M483.2 320l-147.2 336c-9.6 25.6-19.2 44.8-25.6 54.4s-16 12.8-25.6 12.8c-16 0-25.6-3.2-28.8-3.2v70.4c9.6 6.4 25.6 6.4 38.4 9.6 32 0 57.6-6.4 73.6-22.4 6.4-6.4 12.8-16 19.2-25.6 6.4-12.8 12.8-25.6 16-41.6l121.6-291.2 150.4 371.2h92.8l-198.4-470.4v-224h-86.4v224zM0 960v-1024h1024v1024h-1024zM960 0h-896v896h896v-896z" />
<glyph unicode="&#xe601;" d="M627.2 80h-579.2v396.8h579.2v-396.8zM553.6 406.4h-435.2v-256h435.2v256zM259.2 732.8c176 176 457.6 176 633.6 0s176-457.6 0-633.6c-121.6-121.6-297.6-160-454.4-108.8 121.6-28.8 262.4 9.6 361.6 108.8 150.4 150.4 160 384 22.4 521.6-121.6 121.6-320 128-470.4 19.2l86.4-86.4-294.4-22.4 22.4 294.4 92.8-92.8z" />
<glyph unicode="&#xe602;" d="M892.8-22.4l-89.6 89.6c-70.4-80-172.8-131.2-288-131.2-208 0-380.8 166.4-384 377.6 0 0 0 0 0 0 0 3.2 0 3.2 0 6.4s0 3.2 0 6.4v0c0 0 0 0 0 3.2 0 0 0 3.2 0 3.2 3.2 105.6 48 211.2 105.6 304l-192 192 44.8 44.8 182.4-182.4c0 0 0 0 0 0l569.6-569.6c0 0 0 0 0 0l99.2-99.2-48-44.8zM896 326.4c0 0 0 0 0 0 0 3.2 0 6.4 0 6.4-9.6 316.8-384 627.2-384 627.2s-108.8-89.6-208-220.8l70.4-70.4c6.4 9.6 16 22.4 22.4 32 41.6 51.2 83.2 96 115.2 128v0c32-32 73.6-76.8 115.2-128 108.8-137.6 169.6-265.6 172.8-371.2 0 0 0-3.2 0-3.2v0 0c0-3.2 0-3.2 0-6.4s0-3.2 0-3.2v0 0c0-22.4-3.2-41.6-9.6-64l76.8-76.8c16 41.6 28.8 89.6 28.8 137.6 0 0 0 0 0 0 0 3.2 0 3.2 0 6.4s0 3.2 0 6.4z" />
<glyph unicode="&#xe914;" d="M768 416v-352h-640v640h352l128 128h-512c-52.8 0-96-43.2-96-96v-704c0-52.8 43.2-96 96-96h704c52.798 0 96 43.2 96 96v512l-128-128zM864 960l-608-608v-160h160l608 608c0 96-64 160-160 160zM416 320l-48 48 480 480 48-48-480-480z" />
<glyph unicode="&#xe934;" d="M864.626 486.838c-65.754 183.44-205.11 348.15-352.626 473.162-147.516-125.012-286.87-289.722-352.626-473.162-40.664-113.436-44.682-236.562 12.584-345.4 65.846-125.14 198.632-205.438 340.042-205.438s274.196 80.298 340.040 205.44c57.27 108.838 53.25 231.962 12.586 345.398zM738.764 201.044c-43.802-83.252-132.812-137.044-226.764-137.044-55.12 0-108.524 18.536-152.112 50.652 13.242-1.724 26.632-2.652 40.112-2.652 117.426 0 228.668 67.214 283.402 171.242 44.878 85.292 40.978 173.848 23.882 244.338 14.558-28.15 26.906-56.198 36.848-83.932 22.606-63.062 40.024-156.34-5.368-242.604z" />
<glyph unicode="&#xeaa8;" d="M704 896c-247.424 0-448-200.576-448-448h-224l288-288 288 288h-224c0 176.73 143.27 320 320 320 176.732 0 320-143.27 320-320 0-176.732-143.268-320-320-320v-128c247.424 0 448 200.576 448 448s-200.576 448-448 448z" horiz-adv-x="1152" />
<glyph unicode="&#xeaa9;" d="M448 896c247.424 0 448-200.576 448-448h224l-288-288-288 288h224c0 176.73-143.27 320-320 320-176.732 0-320-143.27-320-320 0-176.732 143.268-320 320-320v-128c-247.424 0-448 200.576-448 448s200.576 448 448 448z" horiz-adv-x="1152" />
<glyph unicode="&#xeaaa;" d="M0 576h1024v384zM1024 0v384h-1024z" />
<glyph unicode="&#xeaac;" d="M576 960v-1024h384zM0-64h384v1024z" />
<glyph unicode="&#xeb35;" d="M992.262 88.604l-242.552 206.294c-25.074 22.566-51.89 32.926-73.552 31.926 57.256 67.068 91.842 154.078 91.842 249.176 0 212.078-171.922 384-384 384-212.076 0-384-171.922-384-384s171.922-384 384-384c95.098 0 182.108 34.586 249.176 91.844-1-21.662 9.36-48.478 31.926-73.552l206.294-242.552c35.322-39.246 93.022-42.554 128.22-7.356s31.892 92.898-7.354 128.22zM384 320c-141.384 0-256 114.616-256 256s114.616 256 256 256 256-114.616 256-256-114.614-256-256-256zM448 768h-128v-128h-128v-128h128v-128h128v128h128v128h-128z" />
<glyph unicode="&#xeb36;" d="M992.262 88.604l-242.552 206.294c-25.074 22.566-51.89 32.926-73.552 31.926 57.256 67.068 91.842 154.078 91.842 249.176 0 212.078-171.922 384-384 384-212.076 0-384-171.922-384-384s171.922-384 384-384c95.098 0 182.108 34.586 249.176 91.844-1-21.662 9.36-48.478 31.926-73.552l206.294-242.552c35.322-39.246 93.022-42.554 128.22-7.356s31.892 92.898-7.354 128.22zM384 320c-141.384 0-256 114.616-256 256s114.616 256 256 256 256-114.616 256-256-114.614-256-256-256zM192 640h384v-128h-384z" />
<glyph unicode="&#xeba7;" d="M768 832h-512l-256-256 512-576 512 576-256 256zM512 181.334v2.666h-2.37l-14.222 16h16.592v16h-30.814l-14.222 16h45.036v16h-59.258l-14.222 16h73.48v16h-87.704l-14.222 16h101.926v16h-116.148l-14.222 16h130.37v16h-144.592l-14.222 16h158.814v16h-173.038l-14.222 16h187.26v16h-201.482l-14.222 16h215.704v16h-229.926l-14.222 16h244.148v16h-258.372l-14.222 16h272.594v16h-286.816l-14.222 16h301.038v16h-315.26l-14.222 16h329.482v16h-343.706l-7.344 8.262 139.072 139.072h211.978v-3.334h215.314l16-16h-231.314v-16h247.314l16-16h-263.314v-16h279.314l16-16h-295.314v-16h311.314l16-16h-327.314v-16h343.312l7.738-7.738-351.050-394.928z" />
<glyph unicode="&#xec6a;" d="M64 768h896v-192h-896zM64 512h896v-192h-896zM64 256h896v-192h-896z" />
<glyph unicode="&#xeccc;" d="M512 128c35.346 0 64-28.654 64-64v-64c0-35.346-28.654-64-64-64s-64 28.654-64 64v64c0 35.346 28.654 64 64 64zM512 768c-35.346 0-64 28.654-64 64v64c0 35.346 28.654 64 64 64s64-28.654 64-64v-64c0-35.346-28.654-64-64-64zM960 512c35.346 0 64-28.654 64-64s-28.654-64-64-64h-64c-35.348 0-64 28.654-64 64s28.652 64 64 64h64zM192 448c0-35.346-28.654-64-64-64h-64c-35.346 0-64 28.654-64 64s28.654 64 64 64h64c35.346 0 64-28.654 64-64zM828.784 221.726l45.256-45.258c24.992-24.99 24.992-65.516 0-90.508-24.994-24.992-65.518-24.992-90.51 0l-45.256 45.256c-24.992 24.99-24.992 65.516 0 90.51 24.994 24.992 65.518 24.992 90.51 0zM195.216 674.274l-45.256 45.256c-24.994 24.994-24.994 65.516 0 90.51s65.516 24.994 90.51 0l45.256-45.256c24.994-24.994 24.994-65.516 0-90.51s-65.516-24.994-90.51 0zM828.784 674.274c-24.992-24.992-65.516-24.992-90.51 0-24.992 24.994-24.992 65.516 0 90.51l45.256 45.254c24.992 24.994 65.516 24.994 90.51 0 24.992-24.994 24.992-65.516 0-90.51l-45.256-45.254zM195.216 221.726c24.992 24.992 65.518 24.992 90.508 0 24.994-24.994 24.994-65.52 0-90.51l-45.254-45.256c-24.994-24.992-65.516-24.992-90.51 0s-24.994 65.518 0 90.508l45.256 45.258zM512 704c-141.384 0-256-114.616-256-256 0-141.382 114.616-256 256-256 141.382 0 256 114.618 256 256 0 141.384-114.616 256-256 256zM512 288c-88.366 0-160 71.634-160 160s71.634 160 160 160 160-71.634 160-160-71.634-160-160-160z" />
<glyph unicode="&#xeccd;" d="M715.812 895.52c-60.25 34.784-124.618 55.904-189.572 64.48 122.936-160.082 144.768-384.762 37.574-570.42-107.2-185.67-312.688-279.112-512.788-252.68 39.898-51.958 90.376-97.146 150.628-131.934 245.908-141.974 560.37-57.72 702.344 188.198 141.988 245.924 57.732 560.372-188.186 702.356z" />
<glyph unicode="&#xecd4;" d="M512 960c-282.77 0-512-229.23-512-512s229.23-512 512-512 512 229.23 512 512-229.23 512-512 512zM128 448c0 212.078 171.922 384 384 384v-768c-212.078 0-384 171.922-384 384z" />
<glyph unicode="&#xed6a;" d="M893.254 738.746l-90.508 90.508-290.746-290.744-290.746 290.744-90.508-90.506 290.746-290.748-290.746-290.746 90.508-90.508 290.746 290.746 290.746-290.746 90.508 90.51-290.744 290.744z" />
<glyph unicode="&#xedc0;" d="M672-64l192 192-320 320 320 320-192 192-512-512z" />
<glyph unicode="&#xedf9;" d="M0 896v-384c0-35.346 28.654-64 64-64s64 28.654 64 64v229.488l677.488-677.488h-229.488c-35.346 0-64-28.652-64-64 0-35.346 28.654-64 64-64h384c35.346 0 64 28.654 64 64v384c0 35.348-28.654 64-64 64s-64-28.652-64-64v-229.488l-677.488 677.488h229.488c35.346 0 64 28.654 64 64s-28.652 64-64 64h-384c-35.346 0-64-28.654-64-64z" />
<glyph unicode="&#xee78;" d="M832 704l192 192-64 64-192-192h-448v192h-128v-192h-192v-128h192v-512h512v-192h128v192h192v128h-192v448zM320 640h320l-320-320v320zM384 256l320 320v-320h-320z" />
</font></defs></svg>

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 29 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,8 +1,8 @@
/**
* theme.js
*
* Copyright, Moxiecode Systems AB
* Released under LGPL License.
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
@ -11,7 +11,8 @@
/*global tinymce:true */
tinymce.ThemeManager.add('modern', function(editor) {
var self = this, settings = editor.settings, Factory = tinymce.ui.Factory, each = tinymce.each, DOM = tinymce.DOM;
var self = this, settings = editor.settings, Factory = tinymce.ui.Factory,
each = tinymce.each, DOM = tinymce.DOM, Rect = tinymce.ui.Rect;
// Default menus
var defaultMenus = {
@ -27,6 +28,115 @@ tinymce.ThemeManager.add('modern', function(editor) {
var defaultToolbar = "undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | " +
"bullist numlist outdent indent | link image";
function createToolbar(items) {
var toolbarItems = [], buttonGroup;
if (!items) {
return;
}
each(items.split(/[ ,]/), function(item) {
var itemName;
function bindSelectorChanged() {
var selection = editor.selection;
if (itemName == "bullist") {
selection.selectorChanged('ul > li', function(state, args) {
var nodeName, i = args.parents.length;
while (i--) {
nodeName = args.parents[i].nodeName;
if (nodeName == "OL" || nodeName == "UL") {
break;
}
}
item.active(state && nodeName == "UL");
});
}
if (itemName == "numlist") {
selection.selectorChanged('ol > li', function(state, args) {
var nodeName, i = args.parents.length;
while (i--) {
nodeName = args.parents[i].nodeName;
if (nodeName == "OL" || nodeName == "UL") {
break;
}
}
item.active(state && nodeName == "OL");
});
}
if (item.settings.stateSelector) {
selection.selectorChanged(item.settings.stateSelector, function(state) {
item.active(state);
}, true);
}
if (item.settings.disabledStateSelector) {
selection.selectorChanged(item.settings.disabledStateSelector, function(state) {
item.disabled(state);
});
}
}
if (item == "|") {
buttonGroup = null;
} else {
if (Factory.has(item)) {
item = {type: item};
if (settings.toolbar_items_size) {
item.size = settings.toolbar_items_size;
}
toolbarItems.push(item);
buttonGroup = null;
} else {
if (!buttonGroup) {
buttonGroup = {type: 'buttongroup', items: []};
toolbarItems.push(buttonGroup);
}
if (editor.buttons[item]) {
// TODO: Move control creation to some UI class
itemName = item;
item = editor.buttons[itemName];
if (typeof item == "function") {
item = item();
}
item.type = item.type || 'button';
if (settings.toolbar_items_size) {
item.size = settings.toolbar_items_size;
}
item = Factory.create(item);
buttonGroup.items.push(item);
if (editor.initialized) {
bindSelectorChanged();
} else {
editor.on('init', bindSelectorChanged);
}
}
}
}
});
return {
type: 'toolbar',
layout: 'flow',
items: toolbarItems
};
}
/**
* Creates the toolbars from config and returns a toolbar array.
*
@ -36,110 +146,10 @@ tinymce.ThemeManager.add('modern', function(editor) {
var toolbars = [];
function addToolbar(items) {
var toolbarItems = [], buttonGroup;
if (!items) {
return;
if (items) {
toolbars.push(createToolbar(items));
return true;
}
each(items.split(/[ ,]/), function(item) {
var itemName;
function bindSelectorChanged() {
var selection = editor.selection;
if (itemName == "bullist") {
selection.selectorChanged('ul > li', function(state, args) {
var nodeName, i = args.parents.length;
while (i--) {
nodeName = args.parents[i].nodeName;
if (nodeName == "OL" || nodeName == "UL") {
break;
}
}
item.active(state && nodeName == "UL");
});
}
if (itemName == "numlist") {
selection.selectorChanged('ol > li', function(state, args) {
var nodeName, i = args.parents.length;
while (i--) {
nodeName = args.parents[i].nodeName;
if (nodeName == "OL" || nodeName == "UL") {
break;
}
}
item.active(state && nodeName == "OL");
});
}
if (item.settings.stateSelector) {
selection.selectorChanged(item.settings.stateSelector, function(state) {
item.active(state);
}, true);
}
if (item.settings.disabledStateSelector) {
selection.selectorChanged(item.settings.disabledStateSelector, function(state) {
item.disabled(state);
});
}
}
if (item == "|") {
buttonGroup = null;
} else {
if (Factory.has(item)) {
item = {type: item};
if (settings.toolbar_items_size) {
item.size = settings.toolbar_items_size;
}
toolbarItems.push(item);
buttonGroup = null;
} else {
if (!buttonGroup) {
buttonGroup = {type: 'buttongroup', items: []};
toolbarItems.push(buttonGroup);
}
if (editor.buttons[item]) {
// TODO: Move control creation to some UI class
itemName = item;
item = editor.buttons[itemName];
if (typeof item == "function") {
item = item();
}
item.type = item.type || 'button';
if (settings.toolbar_items_size) {
item.size = settings.toolbar_items_size;
}
item = Factory.create(item);
buttonGroup.items.push(item);
if (editor.initialized) {
bindSelectorChanged();
} else {
editor.on('init', bindSelectorChanged);
}
}
}
}
});
toolbars.push({type: 'toolbar', layout: 'flow', items: toolbarItems});
return true;
}
// Convert toolbar array to multiple options
@ -358,6 +368,234 @@ tinymce.ThemeManager.add('modern', function(editor) {
self.resizeTo(elm.clientWidth + dw, elm.clientHeight + dh);
}
/**
* Handles contextual toolbars.
*/
function addContextualToolbars() {
var scrollContainer;
function getContextToolbars() {
return editor.contextToolbars || [];
}
function getElementRect(elm) {
var pos, targetRect, root;
pos = tinymce.DOM.getPos(editor.getContentAreaContainer());
targetRect = editor.dom.getRect(elm);
root = editor.dom.getRoot();
// Adjust targetPos for scrolling in the editor
if (root.nodeName == 'BODY') {
targetRect.x -= root.ownerDocument.documentElement.scrollLeft || root.scrollLeft;
targetRect.y -= root.ownerDocument.documentElement.scrollTop || root.scrollTop;
}
targetRect.x += pos.x;
targetRect.y += pos.y;
return targetRect;
}
function hideAllFloatingPanels() {
each(editor.contextToolbars, function(toolbar) {
if (toolbar.panel) {
toolbar.panel.hide();
}
});
}
function reposition(match) {
var relPos, panelRect, elementRect, contentAreaRect, panel, relRect, testPositions;
if (editor.removed) {
return;
}
if (!match || !match.toolbar.panel) {
hideAllFloatingPanels();
return;
}
testPositions = [
'tc-bc', 'bc-tc',
'tl-bl', 'bl-tl',
'tr-br', 'br-tr'
];
panel = match.toolbar.panel;
panel.show();
elementRect = getElementRect(match.element);
panelRect = tinymce.DOM.getRect(panel.getEl());
contentAreaRect = tinymce.DOM.getRect(editor.getContentAreaContainer() || editor.getBody());
if (!editor.inline) {
contentAreaRect.w = editor.getDoc().documentElement.offsetWidth;
}
// Inflate the elementRect so it doesn't get placed above resize handles
if (editor.selection.controlSelection.isResizable(match.element)) {
elementRect = Rect.inflate(elementRect, 0, 7);
}
relPos = Rect.findBestRelativePosition(panelRect, elementRect, contentAreaRect, testPositions);
if (relPos) {
each(testPositions.concat('inside'), function(pos) {
panel.classes.toggle('tinymce-inline-' + pos, pos == relPos);
});
relRect = Rect.relativePosition(panelRect, elementRect, relPos);
panel.moveTo(relRect.x, relRect.y);
} else {
each(testPositions, function(pos) {
panel.classes.toggle('tinymce-inline-' + pos, false);
});
panel.classes.toggle('tinymce-inline-inside', true);
elementRect = Rect.intersect(contentAreaRect, elementRect);
if (elementRect) {
relPos = Rect.findBestRelativePosition(panelRect, elementRect, contentAreaRect, [
'tc-tc', 'tl-tl', 'tr-tr'
]);
if (relPos) {
relRect = Rect.relativePosition(panelRect, elementRect, relPos);
panel.moveTo(relRect.x, relRect.y);
} else {
panel.moveTo(elementRect.x, elementRect.y);
}
} else {
panel.hide();
}
}
//drawRect(contentAreaRect, 'blue');
//drawRect(elementRect, 'red');
//drawRect(panelRect, 'green');
}
function repositionHandler() {
function execute() {
reposition(findFrontMostMatch(editor.selection.getNode()));
}
if (window.requestAnimationFrame) {
window.requestAnimationFrame(execute);
} else {
execute();
}
}
function bindScrollEvent() {
if (!scrollContainer) {
scrollContainer = editor.selection.getScrollContainer() || editor.getWin();
tinymce.$(scrollContainer).on('scroll', repositionHandler);
editor.on('remove', function() {
tinymce.$(scrollContainer).off('scroll');
});
}
}
function showContextToolbar(match) {
var panel;
if (match.toolbar.panel) {
match.toolbar.panel.show();
reposition(match);
return;
}
bindScrollEvent();
panel = Factory.create({
type: 'floatpanel',
role: 'application',
classes: 'tinymce tinymce-inline',
layout: 'flex',
direction: 'column',
align: 'stretch',
autohide: false,
autofix: true,
fixed: true,
border: 1,
items: createToolbar(match.toolbar.items)
});
match.toolbar.panel = panel;
panel.renderTo(document.body).reflow();
reposition(match);
}
function hideAllContextToolbars() {
tinymce.each(getContextToolbars(), function(toolbar) {
if (toolbar.panel) {
toolbar.panel.hide();
}
});
}
function findFrontMostMatch(targetElm) {
var i, y, parentsAndSelf, toolbars = getContextToolbars();
parentsAndSelf = editor.$(targetElm).parents().add(targetElm);
for (i = parentsAndSelf.length - 1; i >= 0; i--) {
for (y = toolbars.length - 1; y >= 0; y--) {
if (toolbars[y].predicate(parentsAndSelf[i])) {
return {
toolbar: toolbars[y],
element: parentsAndSelf[i]
};
}
}
}
return null;
}
editor.on('click keyup blur', function() {
// Needs to be delayed to avoid Chrome img focus out bug
window.setTimeout(function() {
var match;
if (editor.removed) {
return;
}
match = findFrontMostMatch(editor.selection.getNode());
if (match) {
showContextToolbar(match);
} else {
hideAllContextToolbars();
}
}, 0);
});
editor.on('ObjectResizeStart', function() {
var match = findFrontMostMatch(editor.selection.getNode());
if (match && match.toolbar.panel) {
match.toolbar.panel.hide();
}
});
editor.on('nodeChange ResizeEditor ResizeWindow', repositionHandler);
editor.on('remove', function() {
tinymce.each(getContextToolbars(), function(toolbar) {
if (toolbar.panel) {
toolbar.panel.remove();
}
});
editor.contextToolbars = {};
});
}
/**
* Renders the inline editor UI.
*
@ -397,7 +635,15 @@ tinymce.ThemeManager.add('modern', function(editor) {
function hide() {
if (panel) {
// We require two events as the inline float panel based toolbar does not have autohide=true
panel.hide();
// All other autohidden float panels will be closed below.
// Need to check for hideAll since it might be a normal panel
if (panel.hideAll) {
panel.hideAll();
}
DOM.removeClass(editor.getBody(), 'mce-edit-focus');
}
}
@ -441,6 +687,7 @@ tinymce.ThemeManager.add('modern', function(editor) {
addAccessibilityKeys(panel);
show();
addContextualToolbars();
editor.on('nodeChange', reposition);
editor.on('activate', show);
@ -555,8 +802,9 @@ tinymce.ThemeManager.add('modern', function(editor) {
panel = null;
});
// Add accesibility shortkuts
// Add accesibility shortcuts
addAccessibilityKeys(panel);
addContextualToolbars();
return {
iframeContainer: panel.find('#iframe')[0].getEl(),

File diff suppressed because one or more lines are too long

View File

@ -1,8 +1,8 @@
/**
* Popup.js
* tinymce_mce_popup.js
*
* Copyright, Moxiecode Systems AB
* Released under LGPL License.
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1,8 +1,8 @@
/**
* editable_selects.js
*
* Copyright, Moxiecode Systems AB
* Released under LGPL License.
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing

View File

@ -1,8 +1,8 @@
/**
* form_utils.js
*
* Copyright, Moxiecode Systems AB
* Released under LGPL License.
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing

View File

@ -1,8 +1,8 @@
/**
* mctabs.js
*
* Copyright, Moxiecode Systems AB
* Released under LGPL License.
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
@ -48,14 +48,14 @@ MCTabs.prototype.hideTab =function(tab){
};
MCTabs.prototype.showPanel = function(panel) {
panel.className = 'current';
panel.className = 'current';
panel.setAttribute("aria-hidden", false);
};
MCTabs.prototype.hidePanel = function(panel) {
panel.className = 'panel';
panel.setAttribute("aria-hidden", true);
};
};
MCTabs.prototype.getPanelForTab = function(tabElm) {
return tinyMCEPopup.dom.getAttrib(tabElm, "aria-controls");
@ -98,7 +98,7 @@ MCTabs.prototype.displayTab = function(tab_id, panel_id, avoid_focus) {
t.hidePanel(nodes[i]);
}
if (!avoid_focus) {
if (!avoid_focus) {
tabElm.focus();
}

View File

@ -1,8 +1,8 @@
/**
* validate.js
*
* Copyright, Moxiecode Systems AB
* Released under LGPL License.
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
@ -111,7 +111,7 @@ var AutoValidator = {
invalidate : function(n) {
this.mark(n.form, n);
},
getErrorMessages : function(f) {
var nl, i, s = this.settings, field, msg, values, messages = [], ed = tinyMCEPopup.editor;
nl = this.tags(f, "label");
@ -129,7 +129,7 @@ var AutoValidator = {
} else {
message = ed.getLang('invalid_data');
}
message = message.replace(/{\#([^}]+)\}/g, function(a, b) {
return values[b] || '{#' + b + '}';
});

View File

@ -18,7 +18,7 @@ $wp_db_version = 32814;
*
* @global string $tinymce_version
*/
$tinymce_version = '4110-20150505';
$tinymce_version = '4201-20150630';
/**
* Holds the required PHP version

View File

@ -25,6 +25,9 @@
<script src="js/utils.js"></script>
<script src="js/init.js"></script>
<!-- tinymce.file.* -->
<script src="tinymce/file/Conversions.js"></script>
<script>
var wpPlugins = 'charmap colorpicker hr lists media paste tabfocus textcolor ' +
'fullscreen wordpress wpautoresize wpeditimage wpgallery wplink wpdialogs wpview';
@ -50,6 +53,7 @@
<script src="tinymce/html/Obsolete.js"></script>
<script src="tinymce/html/Styles.js"></script>
<script src="tinymce/html/Writer.js"></script>
<script src="tinymce/html/Serializer.js"></script>
<!-- tnymce.ui.* -->
<script src="tinymce/ui/AbsoluteLayout.js"></script>
@ -83,6 +87,7 @@
<!-- tinymce.* -->
<script src="tinymce/AddOnManager.js"></script>
<script src="tinymce/Editor.js"></script>
<script src="tinymce/EditorUpload.js"></script>
<script src="tinymce/EditorCommands.js"></script>
<script src="tinymce/EditorManager.js"></script>
<script src="tinymce/EnterKey.js"></script>
@ -94,23 +99,23 @@
<script src="tinymce/UndoManager.js"></script>
<!-- tinymce.plugins.* -->
<!--<script src="plugins/autolink.js"></script>
<script src="plugins/autosave.js"></script>
<script src="plugins/fullpage.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/jquery_initialization.js"></script>
<script src="plugins/legacyoutput.js"></script>
<script src="plugins/link.js"></script>
<script src="plugins/lists.js"></script>-->
<!--<script src="plugins/importcss.js"></script>-->
<!--<script src="plugins/jquery_plugin.js"></script>-->
<!--<script src="plugins/jquery_initialization.js"></script>-->
<!--<script src="plugins/legacyoutput.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/textpattern.js"></script>
<script src="plugins/wordcount.js"></script>-->
<!--<script src="plugins/searchreplace.js"></script>-->
<!--<script src="plugins/spellchecker.js"></script>-->
<!--<script src="plugins/table.js"></script>-->
<!--<script src="plugins/textpattern.js"></script>-->
<!--<script src="plugins/wordcount.js"></script>-->
</body>
</html>

View File

@ -320,7 +320,7 @@
ok(true);
}
function getFontmostWindow() {
function getFrontmostWindow() {
return editor.windowManager.windows[editor.windowManager.windows.length - 1];
}
@ -414,7 +414,7 @@
size: size,
resetScroll: resetScroll,
nearlyEqualRects: nearlyEqualRects,
getFontmostWindow: getFontmostWindow,
getFrontmostWindow: getFrontmostWindow,
pressArrowKey: pressArrowKey,
pressEnter: pressEnter,
trimBrsOnIE: trimBrsOnIE,

View File

@ -24,7 +24,7 @@
delete editor.settings.document_base_url;
delete editor.settings.image_advtab;
var win = Utils.getFontmostWindow();
var win = Utils.getFrontmostWindow();
if (win) {
win.close();
@ -37,7 +37,7 @@
}
function fillAndSubmitWindowForm(data) {
var win = Utils.getFontmostWindow();
var win = Utils.getFrontmostWindow();
win.fromJSON(data);
win.find('form')[0].submit();
@ -48,7 +48,7 @@
editor.setContent('');
editor.execCommand('mceImage', true);
deepEqual(Utils.getFontmostWindow().toJSON(), {
deepEqual(Utils.getFrontmostWindow().toJSON(), {
"alt": "",
"constrain": true,
"height": "",
@ -74,7 +74,7 @@
editor.setContent('');
editor.execCommand('mceImage', true);
deepEqual(Utils.getFontmostWindow().toJSON(), {
deepEqual(Utils.getFrontmostWindow().toJSON(), {
"alt": "",
"src": ""
});
@ -104,7 +104,7 @@
editor.setContent('');
editor.execCommand('mceImage', true);
deepEqual(Utils.getFontmostWindow().toJSON(), {
deepEqual(Utils.getFrontmostWindow().toJSON(), {
"alt": "",
"class": "class1",
"constrain": true,
@ -140,7 +140,7 @@
"alt": "alt"
};
win = Utils.getFontmostWindow();
win = Utils.getFrontmostWindow();
elementId = win.find('#src')[0]._id;
element = document.getElementById(elementId).childNodes[0];
@ -170,7 +170,7 @@
"alt": "alt"
};
win = Utils.getFontmostWindow();
win = Utils.getFrontmostWindow();
elementId = win.find('#src')[0]._id;
element = document.getElementById(elementId).childNodes[0];
@ -193,7 +193,7 @@
editor.setContent('');
editor.execCommand('mceImage', true);
deepEqual(Utils.getFontmostWindow().toJSON(), {
deepEqual(Utils.getFrontmostWindow().toJSON(), {
"alt": "",
"border": "",
"hspace": "",
@ -221,7 +221,7 @@
editor.setContent('');
editor.execCommand('mceImage', true);
deepEqual(Utils.getFontmostWindow().toJSON(), {
deepEqual(Utils.getFrontmostWindow().toJSON(), {
"alt": "",
"border": "",
"hspace": "",
@ -251,7 +251,7 @@
editor.setContent('');
editor.execCommand('mceImage', true);
deepEqual(Utils.getFontmostWindow().toJSON(), {
deepEqual(Utils.getFrontmostWindow().toJSON(), {
"alt": "",
"border": "",
"hspace": "",
@ -280,7 +280,7 @@
editor.setContent('');
editor.execCommand('mceImage', true);
deepEqual(Utils.getFontmostWindow().toJSON(), {
deepEqual(Utils.getFrontmostWindow().toJSON(), {
"alt": "",
"border": "",
"hspace": "",
@ -309,7 +309,7 @@
editor.setContent('');
editor.execCommand('mceImage', true);
deepEqual(Utils.getFontmostWindow().toJSON(), {
deepEqual(Utils.getFrontmostWindow().toJSON(), {
"alt": "",
"border": "",
"hspace": "",
@ -339,7 +339,7 @@
editor.setContent('');
editor.execCommand('mceImage', true);
deepEqual(Utils.getFontmostWindow().toJSON(), {
deepEqual(Utils.getFrontmostWindow().toJSON(), {
"alt": "",
"border": "",
"hspace": "",
@ -370,7 +370,7 @@
editor.setContent('');
editor.execCommand('mceImage', true);
deepEqual(Utils.getFontmostWindow().toJSON(), {
deepEqual(Utils.getFrontmostWindow().toJSON(), {
"alt": "",
"border": "",
"hspace": "",
@ -379,9 +379,9 @@
"vspace": ""
});
Utils.getFontmostWindow().find('#style').value('margin-left: 15px; margin-right: 15px;').fire('change');
Utils.getFrontmostWindow().find('#style').value('margin-left: 15px; margin-right: 15px;').fire('change');
deepEqual(Utils.getFontmostWindow().toJSON(), {
deepEqual(Utils.getFrontmostWindow().toJSON(), {
"alt": "",
"border": "",
"hspace": "15",
@ -399,7 +399,7 @@
editor.setContent('');
editor.execCommand('mceImage', true);
deepEqual(Utils.getFontmostWindow().toJSON(), {
deepEqual(Utils.getFrontmostWindow().toJSON(), {
"alt": "",
"border": "",
"hspace": "",
@ -408,9 +408,9 @@
"vspace": ""
});
Utils.getFontmostWindow().find('#style').value('margin-top: 15px; margin-bottom: 15px;').fire('change');
Utils.getFrontmostWindow().find('#style').value('margin-top: 15px; margin-bottom: 15px;').fire('change');
deepEqual(Utils.getFontmostWindow().toJSON(), {
deepEqual(Utils.getFrontmostWindow().toJSON(), {
"alt": "",
"border": "",
"hspace": "",
@ -428,7 +428,7 @@
editor.setContent('');
editor.execCommand('mceImage', true);
deepEqual(Utils.getFontmostWindow().toJSON(), {
deepEqual(Utils.getFrontmostWindow().toJSON(), {
"alt": "",
"border": "",
"hspace": "",
@ -437,9 +437,9 @@
"vspace": ""
});
Utils.getFontmostWindow().find('#style').value('margin: 5px;').fire('change');
Utils.getFrontmostWindow().find('#style').value('margin: 5px;').fire('change');
deepEqual(Utils.getFontmostWindow().toJSON(), {
deepEqual(Utils.getFrontmostWindow().toJSON(), {
"alt": "",
"border": "",
"hspace": "5",
@ -457,7 +457,7 @@
editor.setContent('');
editor.execCommand('mceImage', true);
deepEqual(Utils.getFontmostWindow().toJSON(), {
deepEqual(Utils.getFrontmostWindow().toJSON(), {
"alt": "",
"border": "",
"hspace": "",
@ -466,9 +466,9 @@
"vspace": ""
});
Utils.getFontmostWindow().find('#style').value('margin: 5px 10px;').fire('change');
Utils.getFrontmostWindow().find('#style').value('margin: 5px 10px;').fire('change');
deepEqual(Utils.getFontmostWindow().toJSON(), {
deepEqual(Utils.getFrontmostWindow().toJSON(), {
"alt": "",
"border": "",
"hspace": "10",
@ -486,7 +486,7 @@
editor.setContent('');
editor.execCommand('mceImage', true);
deepEqual(Utils.getFontmostWindow().toJSON(), {
deepEqual(Utils.getFrontmostWindow().toJSON(), {
"alt": "",
"border": "",
"hspace": "",
@ -495,9 +495,9 @@
"vspace": ""
});
Utils.getFontmostWindow().find('#style').value('margin: 5px 10px;').fire('change');
Utils.getFrontmostWindow().find('#style').value('margin: 5px 10px;').fire('change');
deepEqual(Utils.getFontmostWindow().toJSON(), {
deepEqual(Utils.getFrontmostWindow().toJSON(), {
"alt": "",
"border": "",
"hspace": "10",
@ -515,7 +515,7 @@
editor.setContent('');
editor.execCommand('mceImage', true);
deepEqual(Utils.getFontmostWindow().toJSON(), {
deepEqual(Utils.getFrontmostWindow().toJSON(), {
"alt": "",
"border": "",
"hspace": "",
@ -524,9 +524,9 @@
"vspace": ""
});
Utils.getFontmostWindow().find('#style').value('margin: 5px 10px 15px;').fire('change');
Utils.getFrontmostWindow().find('#style').value('margin: 5px 10px 15px;').fire('change');
deepEqual(Utils.getFontmostWindow().toJSON(), {
deepEqual(Utils.getFrontmostWindow().toJSON(), {
"alt": "",
"border": "",
"hspace": "10",
@ -544,7 +544,7 @@
editor.setContent('');
editor.execCommand('mceImage', true);
deepEqual(Utils.getFontmostWindow().toJSON(), {
deepEqual(Utils.getFrontmostWindow().toJSON(), {
"alt": "",
"border": "",
"hspace": "",
@ -553,9 +553,9 @@
"vspace": ""
});
Utils.getFontmostWindow().find('#style').value('margin: 5px 10px 15px 20px;').fire('change');
Utils.getFrontmostWindow().find('#style').value('margin: 5px 10px 15px 20px;').fire('change');
deepEqual(Utils.getFontmostWindow().toJSON(), {
deepEqual(Utils.getFrontmostWindow().toJSON(), {
"alt": "",
"border": "",
"hspace": "",
@ -573,7 +573,7 @@
editor.setContent('');
editor.execCommand('mceImage', true);
deepEqual(Utils.getFontmostWindow().toJSON(), {
deepEqual(Utils.getFrontmostWindow().toJSON(), {
"alt": "",
"border": "",
"hspace": "",
@ -582,9 +582,9 @@
"vspace": ""
});
Utils.getFontmostWindow().find('#style').value('margin: 5px 10px 15px 20px; margin-top: 15px;').fire('change');
Utils.getFrontmostWindow().find('#style').value('margin: 5px 10px 15px 20px; margin-top: 15px;').fire('change');
deepEqual(Utils.getFontmostWindow().toJSON(), {
deepEqual(Utils.getFrontmostWindow().toJSON(), {
"alt": "",
"border": "",
"hspace": "",
@ -594,4 +594,4 @@
});
});
})();
})();

View File

@ -26,7 +26,7 @@
delete editor.settings.link_target_list;
delete editor.settings.rel_list;
var win = Utils.getFontmostWindow();
var win = Utils.getFrontmostWindow();
if (win) {
win.close();
@ -39,7 +39,7 @@
}
function fillAndSubmitWindowForm(data) {
var win = Utils.getFontmostWindow();
var win = Utils.getFrontmostWindow();
win.fromJSON(data);
win.find('form')[0].submit();
@ -50,7 +50,7 @@
editor.setContent('');
editor.execCommand('mceLink', true);
deepEqual(Utils.getFontmostWindow().toJSON(), {
deepEqual(Utils.getFrontmostWindow().toJSON(), {
"href": "",
"target": "",
"text": "",
@ -75,7 +75,7 @@
Utils.setSelection('p', 1, 'p', 2);
editor.execCommand('mceLink', true);
deepEqual(Utils.getFontmostWindow().toJSON(), {
deepEqual(Utils.getFrontmostWindow().toJSON(), {
"href": "",
"target": "",
"text": "b",
@ -99,7 +99,7 @@
Utils.setSelection('p:nth-child(1)', 0, 'p:nth-child(2)', 2);
editor.execCommand('mceLink', true);
deepEqual(Utils.getFontmostWindow().toJSON(), {
deepEqual(Utils.getFrontmostWindow().toJSON(), {
"href": "",
"target": "",
"title": ""
@ -142,7 +142,7 @@
editor.setContent('');
editor.execCommand('mceLink', true);
deepEqual(Utils.getFontmostWindow().toJSON(), {
deepEqual(Utils.getFrontmostWindow().toJSON(), {
"class": "class1",
"href": "",
"rel": "rel1",
@ -179,4 +179,4 @@
test('Test new regex for non relative link setting relative base', function() {
equal(nonRelativeRegex.test('/testjpg.jpg'), false);
});
})();
})();

View File

@ -8,6 +8,7 @@ module("tinymce.plugins.Media", {
skin: false,
plugins: wpPlugins,
document_base_url: '/tinymce/tinymce/trunk/tests/',
extended_valid_elements: 'script[src|type]',
media_scripts: [
{filter: 'http://media1.tinymce.com'},
{filter: 'http://media2.tinymce.com', width: 100, height: 200}
@ -18,7 +19,7 @@ module("tinymce.plugins.Media", {
}
});
},
teardown: function() {
delete editor.settings.media_filter_html;
}

View File

@ -52,7 +52,7 @@ test("Paste styled text content", function() {
editor.selection.setRng(rng);
editor.execCommand('mceInsertClipboardContent', false, {content: '<strong><em><span style="color: red;">TEST</span></em></strong>'});
equal(editor.getContent(), '<p>1<strong><em><span style="color: red;">TEST</span></em></strong>4</p>'); // Changed in WordPress
equal(editor.getContent(), '<p>1<strong><em><span style="color: red;">TEST</span></em></strong>4</p>');
});
test("Paste paragraph in paragraph", function() {

View File

@ -19,7 +19,7 @@
});
},
teardown: function() {
var win = Utils.getFontmostWindow();
var win = Utils.getFrontmostWindow();
if (win) {
win.close();
@ -35,7 +35,7 @@
});
function fillAndSubmitWindowForm(data) {
var win = Utils.getFontmostWindow();
var win = Utils.getFrontmostWindow();
win.fromJSON(data);
win.find('form')[0].submit();
@ -51,7 +51,7 @@
Utils.setSelection('td', 0);
editor.execCommand('mceTableProps');
deepEqual(Utils.getFontmostWindow().toJSON(), {
deepEqual(Utils.getFrontmostWindow().toJSON(), {
"align": "",
"border": "",
"caption": false,
@ -72,7 +72,7 @@
Utils.setSelection('td', 0);
editor.execCommand('mceTableProps');
deepEqual(Utils.getFontmostWindow().toJSON(), {
deepEqual(Utils.getFrontmostWindow().toJSON(), {
"align": "",
"border": "",
"caption": false,
@ -100,7 +100,7 @@
Utils.setSelection('td', 0);
editor.execCommand('mceTableProps');
deepEqual(Utils.getFontmostWindow().toJSON(), {
deepEqual(Utils.getFrontmostWindow().toJSON(), {
"align": "",
"border": "",
"caption": false,
@ -140,7 +140,7 @@
Utils.setSelection('td', 0);
editor.execCommand('mceTableProps');
deepEqual(Utils.getFontmostWindow().toJSON(), {
deepEqual(Utils.getFrontmostWindow().toJSON(), {
"align": "",
"border": "4",
"caption": true,
@ -318,7 +318,7 @@
Utils.setSelection('td', 0);
editor.execCommand('mceTableProps');
deepEqual(Utils.getFontmostWindow().toJSON(), {
deepEqual(Utils.getFrontmostWindow().toJSON(), {
"align": "",
"backgroundColor": "",
"border": "",
@ -337,7 +337,7 @@
Utils.setSelection('td', 0);
editor.execCommand('mceTableCellProps');
deepEqual(Utils.getFontmostWindow().toJSON(), {
deepEqual(Utils.getFrontmostWindow().toJSON(), {
"align": "",
"valign": "",
"height": "",
@ -357,7 +357,7 @@
Utils.setSelection('td', 0);
editor.execCommand('mceTableCellProps');
deepEqual(Utils.getFontmostWindow().toJSON(), {
deepEqual(Utils.getFrontmostWindow().toJSON(), {
"align": "",
"valign": "",
"height": "",
@ -382,7 +382,7 @@
Utils.setSelection('th', 0);
editor.execCommand('mceTableCellProps');
deepEqual(Utils.getFontmostWindow().toJSON(), {
deepEqual(Utils.getFrontmostWindow().toJSON(), {
"align": "right",
"valign": "top",
"height": "11",
@ -419,7 +419,7 @@
Utils.setSelection('td', 0);
editor.execCommand('mceTableRowProps');
deepEqual(Utils.getFontmostWindow().toJSON(), {
deepEqual(Utils.getFrontmostWindow().toJSON(), {
"align": "",
"height": "",
"type": "tbody",
@ -434,7 +434,7 @@
Utils.setSelection('td', 0);
editor.execCommand('mceTableRowProps');
deepEqual(Utils.getFontmostWindow().toJSON(), {
deepEqual(Utils.getFrontmostWindow().toJSON(), {
"align": "right",
"height": "10",
"type": "thead",
@ -550,4 +550,57 @@
'<table><tbody><tr><td>A1</td><td>A2</td></tr><tr><td>B1</td><td>B2</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td></tr></tbody></table><p>x</p>'
);
});
})();
test("Delete selected cells", function() {
editor.getBody().innerHTML = (
'<table><tbody>' +
'<tr><td class="mce-item-selected">A1</td><td>A2</td></tr>' +
'<tr><td class="mce-item-selected">B1</td><td>B2</td></tr>' +
'</tbody></table>' +
'<p>x</p>'
);
Utils.setSelection('td', 0, 'td', 2);
editor.fire('keydown', {keyCode: 46});
equal(
editor.getContent(),
'<table><tbody><tr><td>&nbsp;</td><td>A2</td></tr><tr><td>&nbsp;</td><td>B2</td></tr></tbody></table><p>x</p>'
);
});
test("Delete all cells", function() {
editor.getBody().innerHTML = (
'<table><tbody>' +
'<tr><td class="mce-item-selected">A1</td><td class="mce-item-selected">A2</td></tr>' +
'<tr><td class="mce-item-selected">B1</td><td class="mce-item-selected">B2</td></tr>' +
'</tbody></table>' +
'<p>x</p>'
);
Utils.setSelection('td', 0, 'td', 2);
editor.fire('keydown', {keyCode: 46});
equal(
editor.getContent(),
'<p>x</p>'
);
});
test("Delete empty like table cell contents", function() {
editor.getBody().innerHTML = (
'<table><tbody>' +
'<tr><td><p><br></p></td><td><p>a</p></td>' +
'</tbody></table>' +
'<p>x</p>'
);
Utils.setSelection('td', 0);
editor.fire('keydown', {keyCode: 46});
equal(
editor.getContent(),
'<table><tbody><tr><td>&nbsp;</td><td><p>a</p></td></tr></tbody></table><p>x</p>'
);
});
})();

View File

@ -0,0 +1,97 @@
(function() {
var testBlob, testBlobDataUri;
if (!tinymce.Env.fileApi) {
return;
}
module("tinymce.EditorUpload", {
setupModule: function() {
QUnit.stop();
tinymce.init({
selector: "textarea",
add_unload_trigger: false,
disable_nodechange: true,
skin: false,
entities: 'raw',
indent: false,
init_instance_callback: function(ed) {
var canvas, context;
window.editor = ed;
canvas = document.createElement("canvas");
canvas.width = 320;
canvas.height = 200;
context = canvas.getContext("2d");
context.fillStyle = "#ff0000";
context.fillRect(0, 0, 160, 100);
context.fillStyle = "#00ff00";
context.fillRect(160, 0, 160, 100);
context.fillStyle = "#0000ff";
context.fillRect(0, 100, 160, 100);
context.fillStyle = "#ff00ff";
context.fillRect(160, 100, 160, 100);
testBlobDataUri = canvas.toDataURL();
tinymce.file.Conversions.uriToBlob(testBlobDataUri).then(function(blob) {
testBlob = blob;
QUnit.start();
});
}
});
},
teardown: function() {
editor.editorUpload.destroy();
}
});
function imageHtml(uri) {
return tinymce.DOM.createHTML('img', {src: uri});
}
asyncTest('_scanForImages', function() {
editor.setContent(imageHtml(testBlobDataUri));
editor._scanForImages().then(function(result) {
var blobInfo = result[0].blobInfo;
QUnit.equal("data:" + blobInfo.blob().type + ";base64," + blobInfo.base64(), testBlobDataUri);
QUnit.equal('<p><img src="' + blobInfo.blobUri() + '" alt=""></p>', editor.getBody().innerHTML);
QUnit.equal('<p><img src="data:' + blobInfo.blob().type + ';base64,' + blobInfo.base64() + '" alt="" /></p>', editor.getContent());
QUnit.strictEqual(editor.editorUpload.blobCache.get(blobInfo.id()), blobInfo);
}).then(QUnit.start);
});
asyncTest('uploadImages', function() {
var uploadedBlobInfo;
function assertResult(result) {
QUnit.strictEqual(result[0].status, true);
QUnit.ok(result[0].element.src.indexOf(uploadedBlobInfo.id() + '.png') !== -1);
QUnit.equal('<p><img src="' + uploadedBlobInfo.filename() + '" alt="" /></p>', editor.getContent());
return result;
}
editor.setContent(imageHtml(testBlobDataUri));
editor.settings.images_upload_handler = function(data, success) {
uploadedBlobInfo = data;
success(data.id() + '.png');
};
editor.uploadImages(assertResult).then(assertResult).then(function() {
uploadedBlobInfo = null;
return editor.uploadImages(function() {}).then(function(result) {
QUnit.strictEqual(result.length, 0);
QUnit.strictEqual(uploadedBlobInfo, null);
});
}).then(QUnit.start);
});
})();

View File

@ -1642,4 +1642,4 @@ asyncTest('Bug #7412 - valid_styles affects the Bold and Italic buttons, althoug
equal(getContent(), '<p>1 <strong><span style="text-decoration: underline;">1234</span></strong> 1</p>');
}
});
});
});

View File

@ -386,12 +386,26 @@ test('remove format on span with internal class using removeformat format', func
equal(Utils.normalizeHtml(Utils.cleanHtml(editor.getBody().innerHTML)), '<p><span class="mce-item-internal">abc</span></p>');
});
/*
test('Remove format bug 1', function() {
editor.setContent('<p><b>ab<em>cde</em>fgh</b></p>');
editor.setContent('<p><b><i>ab</i>c</b></p>');
editor.formatter.register('format', {inline: 'b'});
Utils.setSelection('em', 0, 'em', 2);
Utils.setSelection('i', 1, 'i', 2);
editor.formatter.remove('format');
equal(editor.getContent(), '<p><b>ab</b><em>cd</em><b><em>e</em>fgh</b></p>');
equal(editor.getContent(), '<p><b><i>a</i></b><i>b</i><b>c</b></p>');
});
test('Remove format bug 2', function() {
editor.setContent('<p>ab<b>c</b></p>');
editor.formatter.register('format', {inline: 'b'});
Utils.setSelection('b', 0, 'b', 1);
editor.formatter.remove('format');
equal(editor.getContent(), '<p>abc</p>');
});
test('Remove format bug 3', function() {
editor.setContent('<p><b><i>ab</i></b></p>');
editor.formatter.register('format', {inline: 'b'});
Utils.setSelection('i', 1, 'i', 2);
editor.formatter.remove('format');
equal(editor.getContent(), '<p><b><i>a</i></b><i>b</i></p>');
});
*/

View File

@ -298,6 +298,10 @@ test('Undo added when typing and losing focus', function() {
test('BeforeAddUndo event', function() {
var lastEvt, addUndoEvt;
function blockEvent(e) {
e.preventDefault();
}
editor.on('BeforeAddUndo', function(e) {
lastEvt = e;
});
@ -315,9 +319,7 @@ test('BeforeAddUndo event', function() {
equal(Utils.cleanHtml(lastEvt.lastLevel.content), "<p>a</p>");
equal(Utils.cleanHtml(lastEvt.level.content), "<p>b</p>");
editor.on('BeforeAddUndo', function(e) {
e.preventDefault();
});
editor.on('BeforeAddUndo', blockEvent);
editor.on('AddUndo', function(e) {
addUndoEvt = e;
@ -330,4 +332,42 @@ test('BeforeAddUndo event', function() {
equal(Utils.cleanHtml(lastEvt.level.content), "<p>c</p>");
equal(lastEvt.originalEvent.data, 1);
ok(!addUndoEvt, "Event level produced when it should be blocked");
});
editor.off('BeforeAddUndo', blockEvent);
});
test('Dirty state type letter', function() {
editor.undoManager.clear();
editor.isNotDirty = true;
editor.setContent("<p>a</p>");
Utils.setSelection('p', 1);
ok(!editor.isDirty(), "Dirty state should be false");
Utils.type('b');
equal(editor.getContent(), "<p>ab</p>");
ok(editor.isDirty(), "Dirty state should be true");
});
test('Dirty state type shift+letter', function() {
editor.undoManager.clear();
editor.isNotDirty = true;
editor.setContent("<p>a</p>");
Utils.setSelection('p', 1);
ok(!editor.isDirty(), "Dirty state should be false");
Utils.type({keyCode: 65, charCode: 66, shiftKey: true});
equal(editor.getContent(), "<p>aB</p>");
ok(editor.isDirty(), "Dirty state should be true");
});
test('Dirty state type AltGr+letter', function() {
editor.undoManager.clear();
editor.isNotDirty = true;
editor.setContent("<p>a</p>");
Utils.setSelection('p', 1);
ok(!editor.isDirty(), "Dirty state should be false");
Utils.type({keyCode: 65, charCode: 66, ctrlKey: true, altKey: true});
equal(editor.getContent(), "<p>aB</p>");
ok(editor.isDirty(), "Dirty state should be true");
});

View File

@ -0,0 +1,17 @@
(function(Conversions) {
module("tinymce.file.Conversions");
if (!tinymce.Env.fileApi) {
test("File API not supported by browser.", function() {
QUnit.ok(true);
});
return;
}
QUnit.asyncTest("uriToBlob", function() {
Conversions.uriToBlob("data:text/plain;base64,SGVsbG8sIFdvcmxkIQ%3D%3D").then(Conversions.blobToDataUri).then(function(dataUri) {
QUnit.equal(dataUri, "data:text/plain;base64,SGVsbG8sIFdvcmxkIQ==");
}).then(QUnit.start);
});
})(tinymce.file.Conversions);

View File

@ -517,4 +517,15 @@
root = parser.parse('a<span> </span>b');
equal(serializer.serialize(root), 'a b');
});
test('Bug #7543 removes whitespace between bogus elements before a block', function() {
var serializer = new tinymce.html.Serializer();
equal(
serializer.serialize(new tinymce.html.DomParser().parse(
'<div><b data-mce-bogus="1">a</b> <b data-mce-bogus="1">b</b><p>c</p></div>')
),
'<div>a b<p>c</p></div>'
);
});
})();

View File

@ -56,9 +56,11 @@ test('getEncodeFunc', function() {
});
test('decode', function() {
expect(3);
equal(tinymce.html.Entities.decode('&lt;&gt;&quot;&#39;&amp;&aring;&auml;&ouml;&unknown;&#039;&#x27;'), '<>"\'&\u00e5\u00e4\u00f6&unknown;\'\'', 'Decode text with various entities');
equal(tinymce.html.Entities.decode('&lt;&gt;&quot;&#39;&amp;&aring;&auml;&ouml;&unknown;'), '<>"\'&\u00e5\u00e4\u00f6&unknown;', 'Decode text with various entities');
equal(tinymce.html.Entities.decode('&#65;&#66;&#039;'), 'AB\'', 'Decode numeric entities');
equal(tinymce.html.Entities.decode('&#x4F;&#X4F;&#x27;'), 'OO\'', 'Decode hexanumeric entities');
equal(tinymce.html.Entities.decode('&#65&#66&#x43'), 'ABC', 'Decode numeric entities with no semicolon');
equal(tinymce.html.Entities.decode('&test'), '&test', 'Dont decode invalid entity name without semicolon');
equal(tinymce.html.Entities.encodeNumeric(tinymce.html.Entities.decode(
'&#130;&#131;&#132;&#133;&#134;&#135;&#136;&#137;&#138;' +

View File

@ -718,4 +718,21 @@
testFindEndTag('<b><!-- </b> --></b>', 3, 20);
testFindEndTag('<span><b><i>a<img>b</i><b>c</b></b></span>', 9, 35);
});
test('parse XSS PI', function() {
var counter, parser;
counter = createCounter(writer);
counter.validate = false;
parser = new tinymce.html.SaxParser(counter, schema);
writer.reset();
parser.parse('<?xml><iframe SRC=&#106&#97&#118&#97&#115&#99&#114&#105&#112&#116&#58&#97&#108&#101&#114&#116&#40&#39&#88&#83&#83&#39&#41>?>');
equal(
writer.getContent(),
'<?xml &gt;&lt;iframe SRC=&amp;#106&amp;#97&amp;#118&amp;#97&amp;#115&amp;#99&amp;#114&amp;#105&amp;#112&amp;' +
'#116&amp;#58&amp;#97&amp;#108&amp;#101&amp;#114&amp;#116&amp;#40&amp;#39&amp;#88&amp;#83&amp;#83&amp;#39&amp;#41&gt;?>'
);
});
})();

View File

@ -31,8 +31,6 @@ test('CDATA', function() {
test('PI', function() {
var writer;
expect(2);
writer = new tinymce.html.Writer();
writer.pi('xml', 'someval');
equal(writer.getContent(), '<?xml someval?>');
@ -40,6 +38,10 @@ test('PI', function() {
writer = new tinymce.html.Writer();
writer.pi('xml');
equal(writer.getContent(), '<?xml?>');
writer = new tinymce.html.Writer();
writer.pi('xml', 'encoding="UTF-8" < >');
equal(writer.getContent(), '<?xml encoding="UTF-8" &lt; &gt;?>');
});
test('Doctype', function() {

View File

@ -18,7 +18,7 @@
test("button text, size default", function() {
var button = createButton({text: 'X'});
Utils.nearlyEqualRects(Utils.rect(button), [0, 0, 34, 30], 4);
Utils.nearlyEqualRects(Utils.rect(button), [0, 0, 27, 30], 4);
});
test("button text, size large", function() {
@ -43,7 +43,7 @@
test("button icon, size default", function() {
var button = createButton({icon: 'test'});
Utils.nearlyEqualRects(Utils.rect(button), [0, 0, 40, 30], 4);
Utils.nearlyEqualRects(Utils.rect(button), [0, 0, 34, 30], 4);
});
test("button icon, size small", function() {
@ -68,7 +68,7 @@
test("button text & icon, size default", function() {
var button = createButton({text: 'X', icon: 'test'});
Utils.nearlyEqualRects(Utils.rect(button), [0, 0, 52, 30], 4);
Utils.nearlyEqualRects(Utils.rect(button), [0, 0, 47, 30], 4);
});
test("button text & icon, size large", function() {

View File

@ -24,13 +24,13 @@
test("colorbutton text, size large", function() {
var colorButton = createColorButton({text: 'X', size: 'large'});
Utils.nearlyEqualRects(Utils.rect(colorButton), [0, 0, 49, 39], 4);
Utils.nearlyEqualRects(Utils.rect(colorButton), [0, 0, 44, 39], 4);
});
test("colorbutton text, size small", function() {
var colorButton = createColorButton({text: 'X', size: 'small'});
Utils.nearlyEqualRects(Utils.rect(colorButton), [0, 0, 34, 23], 4);
Utils.nearlyEqualRects(Utils.rect(colorButton), [0, 0, 39, 23], 4);
});
test("colorbutton text, width 100, height 100", function() {
@ -43,7 +43,7 @@
test("colorbutton icon, size default", function() {
var colorButton = createColorButton({icon: 'test'});
Utils.nearlyEqualRects(Utils.rect(colorButton), [0, 0, 50, 30], 4);
Utils.nearlyEqualRects(Utils.rect(colorButton), [0, 0, 49, 30], 4);
});
test("colorbutton icon, size small", function() {
@ -55,7 +55,7 @@
test("colorbutton icon, size large", function() {
var colorButton = createColorButton({icon: 'test', size: 'large'});
Utils.nearlyEqualRects(Utils.rect(colorButton), [0, 0, 54, 40], 4);
Utils.nearlyEqualRects(Utils.rect(colorButton), [0, 0, 49, 40], 4);
});
test("colorbutton icon, width 100, height 100", function() {
@ -74,13 +74,13 @@
test("colorbutton text & icon, size large", function() {
var colorButton = createColorButton({text: 'X', icon: 'test', size: 'large'});
Utils.nearlyEqualRects(Utils.rect(colorButton), [0, 0, 69, 40], 4);
Utils.nearlyEqualRects(Utils.rect(colorButton), [0, 0, 64, 40], 4);
});
test("colorbutton text & icon, size small", function() {
var colorButton = createColorButton({text: 'X', icon: 'test', size: 'small'});
Utils.nearlyEqualRects(Utils.rect(colorButton), [0, 0, 53, 24], 4);
Utils.nearlyEqualRects(Utils.rect(colorButton), [0, 0, 58, 24], 4);
});
test("colorbutton text & icon, width 100, height 100", function() {

View File

@ -10,11 +10,9 @@
equal(ctrl.disabled(), false);
equal(ctrl.active(), false);
equal(ctrl.visible(), true);
equal(ctrl.text(), "");
equal(ctrl.width(), 0);
equal(ctrl.height(), 0);
equal(ctrl.name(), "");
equal(ctrl.title(), "");
equal(ctrl.text(), undefined);
equal(ctrl.name(), undefined);
equal(ctrl.title(), undefined);
equal(ctrl.parent(), undefined);
deepEqual(ctrl.settings, {});
});
@ -26,8 +24,6 @@
visible: true,
text: 'Text',
title: 'Title',
width: 100,
height: 200,
name: 'Name'
});
@ -36,8 +32,6 @@
equal(ctrl.active(), true);
equal(ctrl.visible(), true);
equal(ctrl.text(), "Text");
equal(ctrl.width(), 100);
equal(ctrl.height(), 200);
equal(ctrl.name(), "Name");
equal(ctrl.title(), "Title");
equal(ctrl.parent(), undefined);
@ -47,8 +41,6 @@
visible: true,
text: 'Text',
title: 'Title',
width: 100,
height: 200,
name: 'Name'
});
});
@ -66,8 +58,6 @@
visible(true).
text("Text").
title("Title").
width(100).
height(200).
name("Name").parent(cont);
// Check states
@ -75,8 +65,6 @@
equal(ctrl.active(), true);
equal(ctrl.visible(), true);
equal(ctrl.text(), "Text");
equal(ctrl.width(), 100);
equal(ctrl.height(), 200);
equal(ctrl.name(), "Name");
equal(ctrl.title(), "Title");
equal(ctrl.parent(), cont);
@ -168,37 +156,37 @@
test("hasClass,addClass,removeClass", function() {
var ctrl = new tinymce.ui.Control({classes: 'class1 class2 class3'});
equal(ctrl.classes(), 'mce-class1 mce-class2 mce-class3');
ok(ctrl.hasClass('class1'));
ok(ctrl.hasClass('class2'));
ok(ctrl.hasClass('class3'));
ok(!ctrl.hasClass('class4'));
equal(ctrl.classes, 'mce-class1 mce-class2 mce-class3');
ok(ctrl.classes.contains('class1'));
ok(ctrl.classes.contains('class2'));
ok(ctrl.classes.contains('class3'));
ok(!ctrl.classes.contains('class4'));
ctrl.addClass('class4');
equal(ctrl.classes(), 'mce-class1 mce-class2 mce-class3 mce-class4');
ok(ctrl.hasClass('class1'));
ok(ctrl.hasClass('class2'));
ok(ctrl.hasClass('class3'));
ok(ctrl.hasClass('class4'));
ctrl.classes.add('class4');
equal(ctrl.classes, 'mce-class1 mce-class2 mce-class3 mce-class4');
ok(ctrl.classes.contains('class1'));
ok(ctrl.classes.contains('class2'));
ok(ctrl.classes.contains('class3'));
ok(ctrl.classes.contains('class4'));
ctrl.removeClass('class4');
equal(ctrl.classes(), 'mce-class1 mce-class2 mce-class3');
ok(ctrl.hasClass('class1'));
ok(ctrl.hasClass('class2'));
ok(ctrl.hasClass('class3'));
ok(!ctrl.hasClass('class4'));
ctrl.classes.remove('class4');
equal(ctrl.classes, 'mce-class1 mce-class2 mce-class3');
ok(ctrl.classes.contains('class1'));
ok(ctrl.classes.contains('class2'));
ok(ctrl.classes.contains('class3'));
ok(!ctrl.classes.contains('class4'));
ctrl.removeClass('class3').removeClass('class2');
equal(ctrl.classes(), 'mce-class1');
ok(ctrl.hasClass('class1'));
ok(!ctrl.hasClass('class2'));
ok(!ctrl.hasClass('class3'));
ctrl.classes.remove('class3').remove('class2');
equal(ctrl.classes, 'mce-class1');
ok(ctrl.classes.contains('class1'));
ok(!ctrl.classes.contains('class2'));
ok(!ctrl.classes.contains('class3'));
ctrl.removeClass('class3').removeClass('class1');
equal(ctrl.classes(), '');
ok(!ctrl.hasClass('class1'));
ok(!ctrl.hasClass('class2'));
ok(!ctrl.hasClass('class3'));
ctrl.classes.remove('class3').remove('class1');
equal(ctrl.classes, '');
ok(!ctrl.classes.contains('class1'));
ok(!ctrl.classes.contains('class2'));
ok(!ctrl.classes.contains('class3'));
});
test("encode", function() {

View File

@ -23,7 +23,7 @@
test("menubutton text, size default", function() {
var menuButton = createMenuButton({text: 'X'});
Utils.nearlyEqualRects(Utils.rect(menuButton), [0, 0, 46, 30], 4);
Utils.nearlyEqualRects(Utils.rect(menuButton), [0, 0, 39, 30], 4);
});
test("menubutton text, size large", function() {
@ -48,7 +48,7 @@
test("menubutton icon, size default", function() {
var menuButton = createMenuButton({icon: 'test'});
Utils.nearlyEqualRects(Utils.rect(menuButton), [0, 0, 52, 30], 4);
Utils.nearlyEqualRects(Utils.rect(menuButton), [0, 0, 46, 30], 4);
});
test("menubutton icon, size small", function() {
@ -73,7 +73,7 @@
test("menubutton text & icon, size default", function() {
var menuButton = createMenuButton({text: 'X', icon: 'test'});
Utils.nearlyEqualRects(Utils.rect(menuButton), [0, 0, 64, 30], 4);
Utils.nearlyEqualRects(Utils.rect(menuButton), [0, 0, 59, 30], 4);
});
test("menubutton text & icon, size large", function() {

View File

@ -24,7 +24,7 @@
test("splitbutton text, size large", function() {
var splitButton = createSplitButton({text: 'X', size: 'large'});
Utils.nearlyEqualRects(Utils.rect(splitButton), [0, 0, 49, 39], 4);
Utils.nearlyEqualRects(Utils.rect(splitButton), [0, 0, 44, 39], 4);
});
test("splitbutton text, size small", function() {
@ -37,7 +37,7 @@
var splitButton = createSplitButton({text: 'X', width: 100, height: 100});
deepEqual(Utils.rect(splitButton), [0, 0, 100, 100]);
deepEqual(Utils.rect(splitButton.getEl().firstChild), [1, 1, 82, 98]);
deepEqual(Utils.rect(splitButton.getEl().firstChild), [1, 1, 83, 98]);
});
test("splitbutton icon, size default", function() {
@ -55,14 +55,14 @@
test("splitbutton icon, size large", function() {
var splitButton = createSplitButton({icon: 'test', size: 'large'});
Utils.nearlyEqualRects(Utils.rect(splitButton), [0, 0, 54, 40], 4);
Utils.nearlyEqualRects(Utils.rect(splitButton), [0, 0, 49, 40], 4);
});
test("splitbutton icon, width 100, height 100", function() {
var splitButton = createSplitButton({icon: 'test', width: 100, height: 100});
deepEqual(Utils.rect(splitButton), [0, 0, 100, 100]);
deepEqual(Utils.rect(splitButton.getEl().firstChild), [1, 1, 82, 98]);
deepEqual(Utils.rect(splitButton.getEl().firstChild), [1, 1, 83, 98]);
});
test("splitbutton text & icon, size default", function() {
@ -74,7 +74,7 @@
test("splitbutton text & icon, size large", function() {
var splitButton = createSplitButton({text: 'X', icon: 'test', size: 'large'});
Utils.nearlyEqualRects(Utils.rect(splitButton), [0, 0, 69, 40], 4);
Utils.nearlyEqualRects(Utils.rect(splitButton), [0, 0, 64, 40], 4);
});
test("splitbutton text & icon, size small", function() {
@ -87,7 +87,7 @@
var splitButton = createSplitButton({text: 'X', icon: 'test', width: 100, height: 100});
deepEqual(Utils.rect(splitButton), [0, 0, 100, 100]);
deepEqual(Utils.rect(splitButton.getEl().firstChild), [1, 1, 82, 98]);
deepEqual(Utils.rect(splitButton.getEl().firstChild), [1, 1, 83, 98]);
});
test("splitbutton click event", function() {

View File

@ -53,6 +53,15 @@ if (tinymce.isWebKit) {
equal(editor.selection.getStart().nodeName, 'H1');
});
*/
test('Delete between empty paragraphs', function() {
editor.getBody().innerHTML = '<p>a</p><p><br></p><p><br></p><p>b</p>';
Utils.setSelection('p:last', 0);
editor.execCommand('Delete');
equal(Utils.normalizeHtml(Utils.cleanHtml(editor.getBody().innerHTML)), '<p>a</p><p><br /></p><p>b<br /></p>');
equal(editor.selection.getStart().nodeName, 'P');
});
test('Delete range from middle of H1 to middle of span in P', function() {
editor.getBody().innerHTML = '<h1>ab</h1><p>b<span style="color:red">cd</span></p>';
Utils.setSelection('h1', 1, 'span', 1);