Commit 06fb7b72 authored by Fabian Galinski's avatar Fabian Galinski 😾
Browse files

[TASK] Upgrade of the TinyMce

parent 8bcff201
......@@ -2,6 +2,6 @@
"name": "sg_tinymce",
"description": "",
"dependencies": {
"tinymce": "^4.4.1"
"tinymce": "^4.6.5"
Version 4.6.5 (2017-08-02)
Added new inline_boundaries_selector that allows you to specify the elements that should have boundaries.
Added new local upload feature this allows the user to upload images directly from the image dialog.
Added a new api for providing meta data for plugins. It will show up in the help dialog if it's provided.
Fixed so that the notifications created by the notification manager are more screen reader accessible.
Fixed bug where changing the list format on multiple selected lists didn't change all of the lists.
Fixed bug where the nonbreaking plugin would insert multiple undo levels when pressing the tab key.
Fixed bug where delete/backspace wouldn't render a caret when all editor contents where deleted.
Fixed bug where delete/backspace wouldn't render a caret if the deleted element was a single contentEditable false element.
Fixed bug where the wordcount plugin wouldn't count words correctly if word where typed after applying a style format.
Fixed bug where the wordcount plugin would count mathematical formulas as multiple words for example 1+1=2.
Fixed bug where formatting of triple clicked blocks on Chrome/Safari would result in styles being added outside the visual selection.
Fixed bug where paste would add the contents to the end of the editor area when inline mode was used.
Fixed bug where toggling off bold formatting on text entered in a new paragraph would add an extra line break.
Fixed bug where autolink plugin would only produce a link on every other consecutive link on Firefox.
Fixed bug where it wasn't possible to select all contents if the content only had one pre element.
Fixed bug where sizzle would produce lagging behavior on some sites due to repaints caused by feature detection.
Fixed bug where toggling off inline formats wouldn't include the space on selected contents with leading or trailing spaces.
Fixed bug where the cut operation in UI wouldn't work in Chrome.
Fixed bug where some legacy editor initialization logic would throw exceptions about editor settings not being defined.
Fixed bug where it wasn't possible to apply text color to links if they where part of a non collapsed selection.
Fixed bug where an exception would be thrown if the user selected a video element and then moved the focus outside the editor.
Fixed bug where list operations didn't work if there where block elements inside the list items.
Fixed bug where applying block formats to lists wrapped in block elements would apply to all elements in that wrapped block.
Version 4.6.4 (2017-06-13)
Fixed bug where the editor would move the caret when clicking on the scrollbar next to a content editable false block.
Fixed bug where the text color select dropdowns wasn't placed correctly when they didn't fit the width of the screen.
Fixed bug where the default editor line height wasn't working for mixed font size contents.
Fixed bug where the content css files for inline editors were loaded multiple times for multiple editor instances.
Fixed bug where the initial value of the font size/font family dropdowns wasn't displayed.
Fixed bug where the I18n api was not supporting arrays as the translation replacement values.
Fixed bug where chrome would display "The given range isn't in document." errors for invalid ranges passed to setRng.
Fixed bug where the compat3x plugin wasn't working since the global tinymce references wasn't resolved correctly.
Fixed bug where the preview plugin wasn't encoding the base url passed into the iframe contents producing a xss bug.
Fixed bug where the dom parser/serializer wasn't handling some special elements like noframes, title and xmp.
Fixed bug where the dom parser/serializer wasn't handling cdata sections with comments inside.
Fixed bug where the editor would scroll to the top of the editable area if a dialog was closed in inline mode.
Fixed bug where the link dialog would not display the right rel value if rel_list was configured.
Fixed bug where the context menu would select images on some platforms but not others.
Fixed bug where the filenames of images were not retained on dragged and drop into the editor from the desktop.
Fixed bug where the paste plugin would misrepresent newlines when pasting plain text and having forced_root_block configured.
Fixed so that the error messages for the imagetools plugin is more human readable.
Fixed so the internal validate setting for the parser/serializer can't be set from editor initialization settings.
Version 4.6.3 (2017-05-30)
Fixed bug where the arrow keys didn't work correctly when navigating on nested inline boundary elements.
Fixed bug where delete/backspace didn't work correctly on nested inline boundary elements.
Fixed bug where image editing didn't work on subsequent edits of the same image.
Fixed bug where charmap descriptions wouldn't properly wrap if they exceeded the width of the box.
Fixed bug where the default image upload handler only accepted 200 as a valid http status code.
Fixed so rel on target=_blank links gets forced with only noopener instead of both noopener and noreferrer.
Version 4.6.2 (2017-05-23)
Fixed bug where the SaxParser would run out of memory on very large documents.
Fixed bug with formatting like font size wasn't applied to del elements.
Fixed bug where various api calls would be throwing exceptions if they where invoked on a removed editor instance.
Fixed bug where the branding position would be incorrect if the editor was inside a hidden tab and then later showed.
Fixed bug where the color levels feature in the imagetools dialog wasn't working properly.
Fixed bug where imagetools dialog wouldn't pre-load images from CORS domains, before trying to prepare them for editing.
Fixed bug where the tab key would move the caret to the next table cell if being pressed inside a list inside a table.
Fixed bug where the cut/copy operations would loose parent context like the current format etc.
Fixed bug with format preview not working on invalid elements excluded by valid_elements.
Fixed bug where blocks would be merged in incorrect order on backspace/delete.
Fixed bug where zero length text nodes would cause issues with the undo logic if there where iframes present.
Fixed bug where the font size/family select lists would throw errors if the first node was a comment.
Fixed bug with csp having to allow local script evaluation since it was used to detect global scope.
Fixed bug where CSP required a relaxed option for javascript: URLs in unsupported legacy browsers.
Fixed bug where a fake caret would be rendered for td with the contenteditable=false.
Fixed bug where typing would be blocked on IE 11 when within a nested contenteditable=true/false structure.
Version 4.6.1 (2017-05-10)
Added configuration option to list plugin to disable tab indentation.
Fixed bug where format change on very specific content could cause the selection to change.
Fixed bug where TinyMCE could not be lazyloaded through jquery integration.
Fixed bug where entities in style attributes weren't decoded correctly on paste in webkit.
Fixed bug where fontsize_formats option had been renamed incorrectly.
Fixed bug with broken backspace/delete behaviour between contenteditable=false blocks.
Fixed bug where it wasn't possible to backspace to the previous line with the inline boundaries functionality turned on.
Fixed bug where is wasn't possible to move caret left and right around a linked image with the inline boundaries functionality turned on.
Fixed bug where pressing enter after/before hr element threw exception. Patch contributed bradleyke.
Fixed so the CSS in the visualblocks plugin doesn't overwrite background color. Patch contributed by Christian Rank.
Fixed bug where multibyte characters weren't encoded correctly. Patch contributed by James Tarkenton.
Fixed bug where shift-click to select within contenteditable=true fields wasn't working.
Version 4.6.0 (2017-05-04)
Dropped support for IE 8-10 due to market share and lack of support from Microsoft. See tinymce docs for details.
Added an inline boundary caret position feature that makes it easier to type at the beginning/end of links/code elements.
Added a help plugin that adds a button and a dialog showing the editor shortcuts and loaded plugins.
Added an inline_boundaries option that allows you to disable the inline boundary feature if it's not desired.
Added a new ScrollIntoView event that allows you to override the default scroll to element behavior.
Added role and aria- attributes as valid elements in the default valid elements config.
Added new internal flag for PastePreProcess/PastePostProcess this is useful to know if the paste was coming from an external source.
Added new ignore function to UndoManager this works similar to transact except that it doesn't add an undo level by default.
Fixed so that urls gets retained for images when being edited. This url is then passed on to the upload handler.
Fixed so that the editors would be initialized on readyState interactive instead of complete.
Fixed so that the init event of the editor gets fired once all contentCSS files have been properly loaded.
Fixed so that width/height of the editor gets taken from the textarea element if it's explicitly specified in styles.
Fixed so that keep_styles set to false no longer clones class/style from the previous paragraph on enter.
Fixed so that the default line-height is 1.2em to avoid zwnbsp characters from producing text rendering glitches on Windows.
Fixed so that loading errors of content css gets presented by a notification message.
Fixed so figure image elements can be linked when selected this wraps the figure image in a anchor element.
Fixed bug where it wasn't possible to copy/paste rows with colspans by using the table copy/paste feature.
Fixed bug where the protect setting wasn't properly applied to header/footer parts when using the fullpage plugin.
Fixed bug where custom formats that specified upper case element names where not applied correctly.
Fixed bug where some screen readers weren't reading buttons due to an aria specific fix for IE 8.
Fixed bug where cut wasn't working correctly on iOS due to it's clipboard API not working correctly.
Fixed bug where Edge would paste div elements instead of paragraphs when pasting plain text.
Fixed bug where the textpattern plugin wasn't dealing with trailing punctuations correctly.
Fixed bug where image editing would some times change the image format from jpg to png.
Fixed bug where some UI elements could be inserted into the toolbar even if they where not registered.
Fixed bug where it was possible to click the TD instead of the character in the character map and that caused an exception.
Fixed bug where the font size/font family dropdowns would sometimes show an incorrect value due to css not being loaded in time.
Fixed bug with the media plugin inserting undefined instead of retaining size when media_dimensions was set to false.
Fixed bug with deleting images when forced_root_blocks where set to false.
Fixed bug where input focus wasn't properly handled on nested content editable elements.
Fixed bug where Chrome/Firefox would throw an exception when selecting images due to recent change of setBaseAndExtent support.
Fixed bug where malformed blobs would throw exceptions now they are simply ignored.
Fixed bug where backspace/delete wouldn't work properly in some cases where all contents was selected in WebKit.
Fixed bug with Angular producing errors since it was expecting events objects to be patched with their custom properties.
Fixed bug where the formatter would apply formatting to spellchecker errors now all bogus elements are excluded.
Fixed bug with backspace/delete inside table caption elements wouldn't behave properly on IE 11.
Fixed bug where typing after a contenteditable false inline element could move the caret to the end of that element.
Fixed bug where backspace before/after contenteditable false blocks wouldn't properly remove the right element.
Fixed bug where backspace before/after contenteditable false inline elements wouldn't properly empty the current block element.
Fixed bug where vertical caret navigation with a custom line-height would sometimes match incorrect positions.
Fixed bug with paste on Edge where character encoding wasn't handled properly due to a browser bug.
Fixed bug with paste on Edge where extra fragment data was inserted into the contents when pasting.
Fixed bug with pasting contents when having a whole block element selected on WebKit could cause WebKit spans to appear.
Fixed bug where the visualchars plugin wasn't working correctly showing invisible nbsp characters.
Fixed bug where browsers would hang if you tried to load some malformed html contents.
Fixed bug where the init call promise wouldn't resolve if the specified selector didn't find any matching elements.
Fixed bug where the Schema isValidChild function was case sensitive.
Version 4.5.3 (2017-02-01)
Added keyboard navigation for menu buttons when the menu is in focus.
Added api to the list plugin for setting custom classes/attributes on lists.
Added validation for the anchor plugin input field according to W3C id naming specifications.
Fixed bug where media placeholders were removed after resize with the forced_root_block setting set to false.
Fixed bug where deleting selections with similar sibling nodes sometimes deleted the whole document.
Fixed bug with inlite theme where several toolbars would appear scrolling when more than one instance of the editor was in use.
Fixed bug where the editor would throw error with the fontselect plugin on hidden editor instances in Firefox.
Fixed bug where the background color would not stretch to the font size.
Fixed bug where font size would be removed when changing background color.
Fixed bug where the undomanager trimmed away whitespace between nodes on undo/redo.
Fixed bug where media_dimensions=false in media plugin caused the editor to throw an error.
Fixed bug where IE was producing font/u elements within links on paste.
Fixed bug where some button tooltips were broken when compat3x was in use.
Fixed bug where backspace/delete/typeover would remove the caption element.
Fixed bug where powerspell failed to function when compat3x was enabled.
Fixed bug where it wasn't possible to apply sub/sup on text with large font size.
Fixed bug where pre tags with spaces weren't treated as content.
Fixed bug where Meta+A would select the entire document instead of all contents in nested ce=true elements.
Version 4.5.2 (2017-01-04)
Added missing keyboard shortcut description for the underline menu item in the format menu.
Fixed bug where external blob urls wasn't properly handled by editor upload logic. Patch contributed by David Oviedo.
Fixed bug where urls wasn't treated as a single word by the wordcount plugin.
Fixed bug where nbsp characters wasn't treated as word delimiters by the wordcount plugin.
Fixed bug where editor instance wasn't properly passed to the format preview logic. Patch contributed by NullQuery.
Fixed bug where the fake caret wasn't hidden when you moved selection to a cE=false element.
Fixed bug where it wasn't possible to edit existing code sample blocks.
Fixed bug where it wasn't possible to delete editor contents if the selection included an empty block.
Fixed bug where the formatter wasn't expanding words on some international characters. Patch contributed by Martin Larochelle.
Fixed bug where the open link feature wasn't working correctly on IE 11.
Fixed bug where enter before/after a cE=false block wouldn't properly padd the paragraph with an br element.
Fixed so font size and font family select boxes always displays a value by using the runtime style as a fallback.
Fixed so missing plugins will be logged to console as warnings rather than halting the initialization of the editor.
Fixed so splitbuttons become normal buttons in advlist plugin if styles are empty. Patch contributed by René Schleusner.
Fixed so you can multi insert rows/cols by selecting table cells and using insert rows/columns.
Version 4.5.1 (2016-12-07)
Fixed bug where the lists plugin wouldn't initialize without the advlist plugins if served from cdn.
Fixed bug where selectors with "*" would cause the style format preview to throw an error.
Fixed bug with toggling lists off on lists with empty list items would throw an error.
Fixed bug where editing images would produce non existing blob uris.
Fixed bug where the offscreen toc selection would be treated as the real toc element.
Fixed bug where the aria level attribute for element path would have an incorrect start index.
Fixed bug where the offscreen selection of cE=false that where very wide would be shown onscreen. Patch contributed by Steven Bufton.
Fixed so the default_link_target gets applied to links created by the autolink plugin.
Fixed so that the name attribute gets removed by the anchor plugin if editing anchors.
Version 4.5.0 (2016-11-23)
Added new toc plugin allows you to insert table of contents based on editor headings.
Added new auto complete menu to all url fields. Adds history, link to anchors etc.
Added new sidebar api that allows you to add custom sidebar panels and buttons to toggle these.
Added new insert menu button that allows you to have multiple insert functions under the same menu button.
Added new open link feature to ctrl+click, alt+enter and context menu.
Added new media_embed_handler option to allow the media plugin to be populated with custom embeds.
Added new support for editing transparent images using the image tools dialog.
Added new images_reuse_filename option to allow filenames of images to be retained for upload.
Added new security feature where links with target="_blank" will by default get rel="noopener noreferrer".
Added new allow_unsafe_link_target to allow you to opt-out of the target="_blank" security feature.
Added new style_formats_autohide option to automatically hide styles based on context.
Added new codesample_content_css option to specify where the code sample prism css is loaded from.
Added new support for Japanese/Chinese word count following the unicode standards on this.
Added new fragmented undo levels this dramatically reduces flicker on contents with iframes.
Added new live previews for complex elements like table or lists.
Fixed bug where it wasn't possible to properly tab between controls in a dialog with a disabled form item control.
Fixed bug where firefox would generate a rectangle on elements produced after/before a cE=false elements.
Fixed bug with advlist plugin not switching list element format properly in some edge cases.
Fixed bug where col/rowspans wasn't correctly computed by the table plugin in some cases.
Fixed bug where the table plugin would thrown an error if object_resizing was disabled.
Fixed bug where some invalid markup would cause issues when running in XHTML mode. Patch contributed by Charles Bourasseau.
Fixed bug where the fullscreen class wouldn't be removed properly when closing dialogs.
Fixed bug where the PastePlainTextToggle event wasn't fired by the paste plugin when the state changed.
Fixed bug where table the row type wasn't properly updated in table row dialog. Patch contributed by Matthias Balmer.
Fixed bug where select all and cut wouldn't place caret focus back to the editor in WebKit. Patch contributed by Daniel Jalkut.
Fixed bug where applying cell/row properties to multiple cells/rows would reset other unchanged properties.
Fixed bug where some elements in the schema would have redundant/incorrect children.
Fixed bug where selector and target options would cause issues if used together.
Fixed bug where drag/drop of images from desktop on chrome would thrown an error.
Fixed bug where cut on WebKit/Blink wouldn't add an undo level.
Fixed bug where IE 11 would scroll to the cE=false elements when they where selected.
Fixed bug where keys like F5 wouldn't work when a cE=false element was selected.
Fixed bug where the undo manager wouldn't stop the typing state when commands where executed.
Fixed bug where unlink on wrapped links wouldn't work properly.
Fixed bug with drag/drop of images on WebKit where the image would be deleted form the source editor.
Fixed bug where the visual characters mode would be disabled when contents was extracted from the editor.
Fixed bug where some browsers would toggle of formats applied to the caret when clicking in the editor toolbar.
Fixed bug where the custom theme function wasn't working correctly.
Fixed bug where image option for custom buttons required you to have icon specified as well.
Fixed bug where the context menu and contextual toolbars would be visible at the same time and sometimes overlapping.
Fixed bug where the noneditable plugin would double wrap elements when using the noneditable_regexp option.
Fixed bug where tables would get padding instead of margin when you used the indent button.
Fixed bug where the charmap plugin wouldn't properly insert non breaking spaces.
Fixed bug where the color previews in color input boxes wasn't properly updated.
Fixed bug where the list items of previous lists wasn't merged in the right order.
Fixed bug where it wasn't possible to drag/drop inline-block cE=false elements on IE 11.
Fixed bug where some table cell merges would produce incorrect rowspan/colspan.
Fixed so the font size of the editor defaults to 14px instead of 11px this can be overridden by custom css.
Fixed so wordcount is debounced to reduce cpu hogging on larger texts.
Fixed so tinymce global gets properly exported as a module when used with some module bundlers.
Fixed so it's possible to specify what css properties you want to preview on specific formats.
Fixed so anchors are contentEditable=false while within the editor.
Fixed so selected contents gets wrapped in a inline code element by the codesample plugin.
Fixed so conditional comments gets properly stripped independent of case. Patch contributed by Georgii Dolzhykov.
Fixed so some escaped css sequences gets properly handled. Patch contributed by Georgii Dolzhykov.
Fixed so notifications with the same message doesn't get displayed at the same time.
Fixed so F10 can be used as an alternative key to focus to the toolbar.
Fixed various api documentation issues and typos.
Removed layer plugin since it wasn't really ported from 3.x and there doesn't seem to be much use for it.
Removed moxieplayer.swf from the media plugin since it wasn't used by the media plugin.
Removed format state from the advlist plugin to be more consistent with common word processors.
Version 4.4.3 (2016-09-01)
Fixed bug where copy would produce an exception on Chrome.
Fixed bug where deleting lists on IE 11 would merge in correct text nodes.
Fixed bug where deleting partial lists with indentation wouldn't cause proper normalization.
Version 4.4.2 (2016-08-25)
Added new importcss_exclusive option to disable unique selectors per group.
Added new group specific selector_converter option to importcss plugin.
Added new codesample_languages option to apply custom languages to codesample plugin.
Added new codesample_dialog_width/codesample_dialog_height options.
Fixed bug where fullscreen button had an incorrect keyboard shortcut.
Fixed bug where backspace/delete wouldn't work correctly from a block to a cE=false element.
Fixed bug where smartpaste wasn't detecting links with special characters in them like tilde.
Fixed bug where the editor wouldn't get proper focus if you clicked on a cE=false element.
Fixed bug where it wasn't possible to copy/paste table rows that had merged cells.
Fixed bug where merging cells could some times produce invalid col/rowspan attibute values.
Fixed bug where getBody would sometimes thrown an exception now it just returns null if the iframe is clobbered.
Fixed bug where drag/drop of cE=false element wasn't properly constrained to viewport.
Fixed bug where contextmenu on Mac would collapse any selection to a caret.
Fixed bug where rtl mode wasn't rendered properly when loading a language pack with the rtl flag.
Fixed bug where Kamer word bounderies would be stripped from contents.
Fixed bug where lists would sometimes render two dots or numbers on the same line.
Fixed bug where the skin_url wasn't used by the inlite theme.
Fixed so data attributes are ignored when comparing formats in the formatter.
Fixed so it's possible to disable inline toolbars in the inlite theme.
Fixed so template dialog gets resized if it doesn't fit the window viewport.
Version 4.4.1 (2016-07-26)
Added smart_paste option to paste plugin to allow disabling the paste behavior if needed.
Fixed bug where png urls wasn't properly detected by the smart paste logic.
"name": "tinymce/tinymce",
"version": "4.4.1",
"version": "4.6.5",
"description": "Web based JavaScript HTML WYSIWYG editor control.",
"license": [
* jquery.tinymce.js
* Released under LGPL License.
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
* License:
* Contributing:
/*global tinymce:true, jQuery */
(function($) {
var undef,
delayedInits = [],
win = window;
$.fn.tinymce = function(settings) {
var self = this, url, base, lang, suffix = "";
// No match then just ignore the call
if (!self.length) {
return self;
// Get editor instance
if (!settings) {
return window.tinymce ? tinymce.get(self[0].id) : null;
self.css('visibility', 'hidden'); // Hide textarea to avoid flicker
function init() {
var editors = [], initCount = 0;
// Apply patches to the jQuery object, only once
if (!patchApplied) {
patchApplied = true;
// Create an editor instance for each matched node
self.each(function(i, node) {
var ed, id =, oninit = settings.oninit;
// Generate unique id for target element if needed
if (!id) { = id = tinymce.DOM.uniqueId();
// Only init the editor once
if (tinymce.get(id)) {
// Create editor instance and render it
ed = new tinymce.Editor(id, settings, tinymce.EditorManager);
ed.on('init', function() {
var scope, func = oninit;
self.css('visibility', '');
// Run this if the oninit setting is defined
// this logic will fire the oninit callback ones each
// matched editor instance is initialized
if (oninit) {
// Fire the oninit event ones each editor instance is initialized
if (++initCount == editors.length) {
if (typeof func === "string") {
scope = (func.indexOf(".") === -1) ? null : tinymce.resolve(func.replace(/\.\w+$/, ""));
func = tinymce.resolve(func);
// Call the oninit function with the object
func.apply(scope || tinymce, editors);
// Render the editor instances in a separate loop since we
// need to have the full editors array used in the onInit calls
$.each(editors, function(i, ed) {
// Load TinyMCE on demand, if we need to
if (!win.tinymce && !lazyLoading && (url = settings.script_url)) {
lazyLoading = 1;
base = url.substring(0, url.lastIndexOf("/"));
// Check if it's a dev/src version they want to load then
// make sure that all plugins, themes etc are loaded in source mode as well
if (url.indexOf('.min') != -1) {
suffix = ".min";
// Setup tinyMCEPreInit object this will later be used by the TinyMCE
// core script to locate other resources like CSS files, dialogs etc
// You can also predefined a tinyMCEPreInit object and then it will use that instead
win.tinymce = win.tinyMCEPreInit || {
base: base,
suffix: suffix
// url contains gzip then we assume it's a compressor
if (url.indexOf('gzip') != -1) {
lang = settings.language || "en";
url = url + (/\?/.test(url) ? '&' : '?') + "js=true&core=true&suffix=" + escape(suffix) +
"&themes=" + escape(settings.theme || 'modern') + "&plugins=" +
escape(settings.plugins || '') + "&languages=" + (lang || '');
// Check if compressor script is already loaded otherwise setup a basic one
if (!win.tinyMCE_GZ) {
win.tinyMCE_GZ = {
start: function() {
function load(url) {
// Add core languages
load("langs/" + lang + ".js");
// Add themes with languages
load("themes/" + settings.theme + "/theme" + suffix + ".js");
load("themes/" + settings.theme + "/langs/" + lang + ".js");
// Add plugins with languages
$.each(settings.plugins.split(","), function(i, name) {
if (name) {
load("plugins/" + name + "/plugin" + suffix + ".js");
load("plugins/" + name + "/langs/" + lang + ".js");
end: function() {
var script = document.createElement('script');
script.type = 'text/javascript';
script.onload = script.onreadystatechange = function(e) {
e = e || window.event;
if (lazyLoading !== 2 && (e.type == 'load' || /complete|loaded/.test(script.readyState))) {
tinymce.dom.Event.domLoaded = 1;
lazyLoading = 2;
// Execute callback after mainscript has been loaded and before the initialization occurs
if (settings.script_loaded) {
$.each(delayedInits, function(i, init) {
script.src = url;
} else {
// Delay the init call until tinymce is loaded
if (lazyLoading === 1) {
} else {
return self;
// Add :tinymce pseudo selector this will select elements that has been converted into editor instances
// it's now possible to use things like $('*:tinymce') to get all TinyMCE bound elements.
$.extend($.expr[":"], {
tinymce: function(e) {
var editor;
if ( && "tinymce" in window) {
editor = tinymce.get(;
if (editor && editor.editorManager === tinymce) {
return true;
return false;
// This function patches internal jQuery functions so that if
// you for example remove an div element containing an editor it's
// automatically destroyed by the TinyMCE API
function applyPatch() {
// Removes any child editor instances by looking for editor wrapper elements
function removeEditors(name) {
// If the function is remove
if (name === "remove") {
this.each(function(i, node) {
var ed = tinyMCEInstance(node);
if (ed) {
this.find("span.mceEditor,div.mceEditor").each(function(i, node) {
var ed = tinymce.get($/, ""));
if (ed) {
// Loads or saves contents from/to textarea if the value
// argument is defined it will set the TinyMCE internal contents
function loadOrSave(value) {
var self = this, ed;
// Handle set value
/*jshint eqnull:true */
if (value != null) {;
// Saves the contents before get/set value of textarea/div
self.each(function(i, node) {
var ed;
if ((ed = tinymce.get( {
} else if (self.length > 0) {
// Handle get value
if ((ed = tinymce.get(self[0].id))) {
return ed.getContent();
// Returns tinymce instance for the specified element or null if it wasn't found
function tinyMCEInstance(element) {
var ed = null;
if (element && && win.tinymce) {
ed = tinymce.get(;
return ed;
// Checks if the specified set contains tinymce instances
function containsTinyMCE(matchedSet) {
return !!((matchedSet) && (matchedSet.length) && (win.tinymce) && (":tinymce")));
// Patch various jQuery functions
var jQueryFn = {};
// Patch some setter/getter functions these will
// now be able to set/get the contents of editor instances for
// example $('#editorid').html('Content'); will update the TinyMCE iframe instance
$.each(["text", "html", "val"], function(i, name) {
var origFn = jQueryFn[name] = $.fn[name],
textProc = (name === "text");
$.fn[name] = function(value) {
var self = this;
if (!containsTinyMCE(self)) {
return origFn.apply(self, arguments);
if (value !== undef) {":tinymce"), value);
origFn.apply(self.not(":tinymce"), arguments);
return self; // return original set for chaining
var ret = "";
var args = arguments;
(textProc ? self : self.eq(0)).each(function(i, node) {
var ed = tinyMCEInstance(node);
if (ed) {
ret += textProc ? ed.getContent().replace(/<(?:"[^"]*"|'[^']*'|[^'">])*>/g, "") : ed.getContent({save: true});
} else {
ret += origFn.apply($(node), args);
return ret;
// Makes it possible to use $('#id').append("content"); to append contents to the TinyMCE editor iframe
$.each(["append", "prepend"], function(i, name) {
var origFn = jQueryFn[name] = $.fn[name],
prepend = (name === "prepend");
$.fn[name] = function(value) {
var self = this;
if (!containsTinyMCE(self)) {
return origFn.apply(self, arguments);