Commit 06fb7b72 authored by Fabian Galinski's avatar Fabian Galinski

[TASK] Upgrade of the TinyMce

parent 8bcff201
......@@ -2,6 +2,6 @@
"name": "sg_tinymce",
"description": "",
"dependencies": {
"tinymce": "^4.4.1"
"tinymce": "^4.6.5"
}
}
This diff is collapsed.
{
"name": "tinymce/tinymce",
"version": "4.4.1",
"version": "4.6.5",
"description": "Web based JavaScript HTML WYSIWYG editor control.",
"license": [
"LGPL-2.1"
......
/**
* jquery.tinymce.js
*
* 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
*/
/*global tinymce:true, jQuery */
(function($) {
var undef,
lazyLoading,
patchApplied,
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) {
applyPatch();
patchApplied = true;
}
// Create an editor instance for each matched node
self.each(function(i, node) {
var ed, id = node.id, oninit = settings.oninit;
// Generate unique id for target element if needed
if (!id) {
node.id = id = tinymce.DOM.uniqueId();
}
// Only init the editor once
if (tinymce.get(id)) {
return;
}
// Create editor instance and render it
ed = new tinymce.Editor(id, settings, tinymce.EditorManager);
editors.push(ed);
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) {
ed.render();
});
}
// 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) {
tinymce.ScriptLoader.markDone(tinymce.baseURI.toAbsolute(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) {
settings.script_loaded();
}
init();
$.each(delayedInits, function(i, init) {
init();
});
}
};
script.src = url;
document.body.appendChild(script);
} else {
// Delay the init call until tinymce is loaded
if (lazyLoading === 1) {
delayedInits.push(init);
} else {
init();
}
}
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 (e.id && "tinymce" in window) {
editor = tinymce.get(e.id);
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) {
ed.remove();
}
});
}
this.find("span.mceEditor,div.mceEditor").each(function(i, node) {
var ed = tinymce.get(node.id.replace(/_parent$/, ""));
if (ed) {
ed.remove();
}
});
}
// 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) {
removeEditors.call(self);
// Saves the contents before get/set value of textarea/div
self.each(function(i, node) {
var ed;
if ((ed = tinymce.get(node.id))) {
ed.setContent(value);
}
});
} 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 && element.id && win.tinymce) {
ed = tinymce.get(element.id);
}
return ed;
}
// Checks if the specified set contains tinymce instances
function containsTinyMCE(matchedSet) {
return !!((matchedSet) && (matchedSet.length) && (win.tinymce) && (matchedSet.is(":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) {
loadOrSave.call(self.filter(":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);
}
if (value !== undef) {
if (typeof value === "string") {
self.filter(":tinymce").each(function(i, node) {
var ed = tinyMCEInstance(node);
if (ed) {
ed.setContent(prepend ? value + ed.getContent() : ed.getContent() + value);
}
});
}
origFn.apply(self.not(":tinymce"), arguments);
return self; // return original set for chaining
}
};
});
// Makes sure that the editor instance gets properly destroyed when the parent element is removed
$.each(["remove", "replaceWith", "replaceAll", "empty"], function(i, name) {
var origFn = jQueryFn[name] = $.fn[name];
$.fn[name] = function() {
removeEditors.call(this, name);
return origFn.apply(this, arguments);
};
});
jQueryFn.attr = $.fn.attr;
// Makes sure that $('#tinymce_id').attr('value') gets the editors current HTML contents
$.fn.attr = function(name, value) {
var self = this, args = arguments;
if ((!name) || (name !== "value") || (!containsTinyMCE(self))) {
if (value !== undef) {
return jQueryFn.attr.apply(self, args);
}
return jQueryFn.attr.apply(self, args);
}
if (value !== undef) {
loadOrSave.call(self.filter(":tinymce"), value);
jQueryFn.attr.apply(self.not(":tinymce"), args);
return self; // return original set for chaining
}
var node = self[0], ed = tinyMCEInstance(node);
return ed ? ed.getContent({save: true}) : jQueryFn.attr.apply($(node), args);
};
}
})(jQuery);
!function(){var a={},b=function(b){for(var c=a[b],e=c.deps,f=c.defn,g=e.length,h=new Array(g),i=0;i<g;++i)h[i]=d(e[i]);var j=f.apply(null,h);if(void 0===j)throw"module ["+b+"] returned undefined";c.instance=j},c=function(b,c,d){if("string"!=typeof b)throw"module id must be a string";if(void 0===c)throw"no dependencies for "+b;if(void 0===d)throw"no definition function for "+b;a[b]={deps:c,defn:d,instance:void 0}},d=function(c){var d=a[c];if(void 0===d)throw"module ["+c+"] was undefined";return void 0===d.instance&&b(c),d.instance},e=function(a,b){for(var c=a.length,e=new Array(c),f=0;f<c;++f)e.push(d(a[f]));b.apply(null,b)},f={};f.bolt={module:{api:{define:c,require:e,demand:d}}};var g=c;g("0",[],function(){return function(a){function b(){function a(a){"remove"===a&&this.each(function(a,b){var c=d(b);c&&c.remove()}),this.find("span.mceEditor,div.mceEditor").each(function(a,b){var c=i().get(b.id.replace(/_parent$/,""));c&&c.remove()})}function b(b){var c,d=this;if(null!=b)a.call(d),d.each(function(a,c){var d;(d=i().get(c.id))&&d.setContent(b)});else if(d.length>0&&(c=i().get(d[0].id)))return c.getContent()}function d(a){var b=null;return a&&a.id&&g.tinymce&&(b=i().get(a.id)),b}function e(a){return!!(a&&a.length&&g.tinymce&&a.is(":tinymce"))}var h={};f.each(["text","html","val"],function(a,g){var i=h[g]=f.fn[g],j="text"===g;f.fn[g]=function(a){var g=this;if(!e(g))return i.apply(g,arguments);if(a!==c)return b.call(g.filter(":tinymce"),a),i.apply(g.not(":tinymce"),arguments),g;var h="",k=arguments;return(j?g:g.eq(0)).each(function(a,b){var c=d(b);h+=c?j?c.getContent().replace(/<(?:"[^"]*"|'[^']*'|[^'">])*>/g,""):c.getContent({save:!0}):i.apply(f(b),k)}),h}}),f.each(["append","prepend"],function(a,b){var g=h[b]=f.fn[b],i="prepend"===b;f.fn[b]=function(a){var b=this;return e(b)?a!==c?("string"==typeof a&&b.filter(":tinymce").each(function(b,c){var e=d(c);e&&e.setContent(i?a+e.getContent():e.getContent()+a)}),g.apply(b.not(":tinymce"),arguments),b):void 0:g.apply(b,arguments)}}),f.each(["remove","replaceWith","replaceAll","empty"],function(b,c){var d=h[c]=f.fn[c];f.fn[c]=function(){return a.call(this,c),d.apply(this,arguments)}}),h.attr=f.fn.attr,f.fn.attr=function(a,g){var i=this,j=arguments;if(!a||"value"!==a||!e(i))return g!==c?h.attr.apply(i,j):h.attr.apply(i,j);if(g!==c)return b.call(i.filter(":tinymce"),g),h.attr.apply(i.not(":tinymce"),j),i;var k=i[0],l=d(k);return l?l.getContent({save:!0}):h.attr.apply(f(k),j)}}var c,d,e,f,g,h=[];g=a?a:window,f=g.jQuery;var i=function(){return g.tinymce};f.fn.tinymce=function(a){function c(){var c=[],d=0;e||(b(),e=!0),m.each(function(b,e){var f,g=e.id,h=a.oninit;g||(e.id=g=i().DOM.uniqueId()),i().get(g)||(f=i().createEditor(g,a),c.push(f),f.on("init",function(){var a,b=h;m.css("visibility",""),h&&++d==c.length&&("string"==typeof b&&(a=b.indexOf(".")===-1?null:i().resolve(b.replace(/\.\w+$/,"")),b=i().resolve(b)),b.apply(a||i(),c))}))}),f.each(c,function(a,b){b.render()})}var j,k,l,m=this,n="";if(!m.length)return m;if(!a)return i()?i().get(m[0].id):null;if(m.css("visibility","hidden"),g.tinymce||d||!(j=a.script_url))1===d?h.push(c):c();else{d=1,k=j.substring(0,j.lastIndexOf("/")),j.indexOf(".min")!=-1&&(n=".min"),g.tinymce=g.tinyMCEPreInit||{base:k,suffix:n},j.indexOf("gzip")!=-1&&(l=a.language||"en",j=j+(/\?/.test(j)?"&":"?")+"js=true&core=true&suffix="+escape(n)+"&themes="+escape(a.theme||"modern")+"&plugins="+escape(a.plugins||"")+"&languages="+(l||""),g.tinyMCE_GZ||(g.tinyMCE_GZ={start:function(){function b(a){i().ScriptLoader.markDone(i().baseURI.toAbsolute(a))}b("langs/"+l+".js"),b("themes/"+a.theme+"/theme"+n+".js"),b("themes/"+a.theme+"/langs/"+l+".js"),f.each(a.plugins.split(","),function(a,c){c&&(b("plugins/"+c+"/plugin"+n+".js"),b("plugins/"+c+"/langs/"+l+".js"))})},end:function(){}}));var o=document.createElement("script");o.type="text/javascript",o.onload=o.onreadystatechange=function(b){b=b||window.event,2===d||"load"!=b.type&&!/complete|loaded/.test(o.readyState)||(i().dom.Event.domLoaded=1,d=2,a.script_loaded&&a.script_loaded(),c(),f.each(h,function(a,b){b()}))},o.src=j,document.body.appendChild(o)}return m},f.extend(f.expr[":"],{tinymce:function(a){var b;return!!(a.id&&"tinymce"in g&&(b=i().get(a.id),b&&b.editorManager===i()))}})}}),d("0")()}();
\ No newline at end of file
!function(a){function b(){function b(a){"remove"===a&&this.each(function(a,b){var c=e(b);c&&c.remove()}),this.find("span.mceEditor,div.mceEditor").each(function(a,b){var c=tinymce.get(b.id.replace(/_parent$/,""));c&&c.remove()})}function d(a){var c,d=this;if(null!=a)b.call(d),d.each(function(b,c){var d;(d=tinymce.get(c.id))&&d.setContent(a)});else if(d.length>0&&(c=tinymce.get(d[0].id)))return c.getContent()}function e(a){var b=null;return a&&a.id&&g.tinymce&&(b=tinymce.get(a.id)),b}function f(a){return!!(a&&a.length&&g.tinymce&&a.is(":tinymce"))}var h={};a.each(["text","html","val"],function(b,g){var i=h[g]=a.fn[g],j="text"===g;a.fn[g]=function(b){var g=this;if(!f(g))return i.apply(g,arguments);if(b!==c)return d.call(g.filter(":tinymce"),b),i.apply(g.not(":tinymce"),arguments),g;var h="",k=arguments;return(j?g:g.eq(0)).each(function(b,c){var d=e(c);h+=d?j?d.getContent().replace(/<(?:"[^"]*"|'[^']*'|[^'">])*>/g,""):d.getContent({save:!0}):i.apply(a(c),k)}),h}}),a.each(["append","prepend"],function(b,d){var g=h[d]=a.fn[d],i="prepend"===d;a.fn[d]=function(a){var b=this;return f(b)?a!==c?("string"==typeof a&&b.filter(":tinymce").each(function(b,c){var d=e(c);d&&d.setContent(i?a+d.getContent():d.getContent()+a)}),g.apply(b.not(":tinymce"),arguments),b):void 0:g.apply(b,arguments)}}),a.each(["remove","replaceWith","replaceAll","empty"],function(c,d){var e=h[d]=a.fn[d];a.fn[d]=function(){return b.call(this,d),e.apply(this,arguments)}}),h.attr=a.fn.attr,a.fn.attr=function(b,g){var i=this,j=arguments;if(!b||"value"!==b||!f(i))return g!==c?h.attr.apply(i,j):h.attr.apply(i,j);if(g!==c)return d.call(i.filter(":tinymce"),g),h.attr.apply(i.not(":tinymce"),j),i;var k=i[0],l=e(k);return l?l.getContent({save:!0}):h.attr.apply(a(k),j)}}var c,d,e,f=[],g=window;a.fn.tinymce=function(c){function h(){var d=[],f=0;e||(b(),e=!0),l.each(function(a,b){var e,g=b.id,h=c.oninit;g||(b.id=g=tinymce.DOM.uniqueId()),tinymce.get(g)||(e=new tinymce.Editor(g,c,tinymce.EditorManager),d.push(e),e.on("init",function(){var a,b=h;l.css("visibility",""),h&&++f==d.length&&("string"==typeof b&&(a=-1===b.indexOf(".")?null:tinymce.resolve(b.replace(/\.\w+$/,"")),b=tinymce.resolve(b)),b.apply(a||tinymce,d))}))}),a.each(d,function(a,b){b.render()})}var i,j,k,l=this,m="";if(!l.length)return l;if(!c)return window.tinymce?tinymce.get(l[0].id):null;if(l.css("visibility","hidden"),g.tinymce||d||!(i=c.script_url))1===d?f.push(h):h();else{d=1,j=i.substring(0,i.lastIndexOf("/")),-1!=i.indexOf(".min")&&(m=".min"),g.tinymce=g.tinyMCEPreInit||{base:j,suffix:m},-1!=i.indexOf("gzip")&&(k=c.language||"en",i=i+(/\?/.test(i)?"&":"?")+"js=true&core=true&suffix="+escape(m)+"&themes="+escape(c.theme||"modern")+"&plugins="+escape(c.plugins||"")+"&languages="+(k||""),g.tinyMCE_GZ||(g.tinyMCE_GZ={start:function(){function b(a){tinymce.ScriptLoader.markDone(tinymce.baseURI.toAbsolute(a))}b("langs/"+k+".js"),b("themes/"+c.theme+"/theme"+m+".js"),b("themes/"+c.theme+"/langs/"+k+".js"),a.each(c.plugins.split(","),function(a,c){c&&(b("plugins/"+c+"/plugin"+m+".js"),b("plugins/"+c+"/langs/"+k+".js"))})},end:function(){}}));var n=document.createElement("script");n.type="text/javascript",n.onload=n.onreadystatechange=function(b){b=b||window.event,2===d||"load"!=b.type&&!/complete|loaded/.test(n.readyState)||(tinymce.dom.Event.domLoaded=1,d=2,c.script_loaded&&c.script_loaded(),h(),a.each(f,function(a,b){b()}))},n.src=i,document.body.appendChild(n)}return l},a.extend(a.expr[":"],{tinymce:function(a){var b;return!!(a.id&&"tinymce"in window&&(b=tinymce.get(a.id),b&&b.editorManager===tinymce))}})}(jQuery);
\ No newline at end of file
tinymce.addI18n('af_ZA',{
"Cut": "Sny",
"Heading 5": "Opskrif 5",
"Header 2": "Hooflyn 2",
"Your browser doesn't support direct access to the clipboard. Please use the Ctrl+X\/C\/V keyboard shortcuts instead.": "Jou webblaaier ondersteun nie toegang tot die knipbord nie. Gebruik asb. Ctrl+X\/C\/V",
"Heading 4": "Opskrif 4",
"Div": "Div",
"Heading 2": "Opskrif 2",
"Paste": "Plak",
"Close": "Sluit",
"Font Family": "Font Familie",
"Pre": "Pre",
"Align right": "Regsgerig",
"New document": "Nuwe Dokument",
"Blockquote": "Aanhaling",
"Numbered list": "Genommerde lys",
"Heading 1": "Opskrif 1",
"Headings": "Opskrifte",
"Increase indent": "Inkeping vergroot",
"Formats": "Formate",
"Headers": "Hooflyn-tekste",
"Select all": "Alles selekteer",
"Header 3": "Hooflyn 3",
"Blocks": "Blokke",
"Undo": "Ongedaan maak",
"Strikethrough": "Deurhaal",
"Bullet list": "Opsommingsteken-lys",
"Header 1": "Hooflyn 1",
"Superscript": "Superskrif",
"Clear formatting": "Herstel Formateering",
"Font Sizes": "Font Groote",
"Subscript": "Subskrif",
"Header 6": "Hooflyn 6",
"Redo": "Herdoen",
"Paragraph": "Paragraaf",
"Ok": "OK",
"Bold": "Vetdruk",
"Code": "Kode",
"Italic": "Kursief",
"Align center": "Senteer",
"Header 5": "Hooflyn 5",
"Heading 6": "Opskrif 6",
"Heading 3": "Opskrif 3",
"Decrease indent": "Inkeping verklein",
"Header 4": "Hooflyn 4",
"Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off.": "Die plak funksie is nou in plat-teks modus. Teks word ingevoeg sonder enige formateering, todat jy hierdie opsie wissel.",
"Underline": "Onderlyn",
"Cancel": "Kanselleer",
"Justify": "Gerigstelling",
"Inline": "Inlyn",
"Copy": "Kopieer",
"Align left": "Linksgerig",
"Visual aids": "Hulpmiddels",
"Lower Greek": "Griekse letters",
"Square": "Vierkantjie",
"Default": "Verstek",
"Lower Alpha": "Klein letters",
"Circle": "Sirkeltjie",
"Disc": "Balletjie",
"Upper Alpha": "Hoofletters",
"Upper Roman": "Romeinse syfers groot",
"Lower Roman": "Romeinse syfers klein",
"Id should start with a letter, followed only by letters, numbers, dashes, dots, colons or underscores.": "Id moet met 'n letter begin en kan slegs deur letters, koppeltekens, syfers, punte en onderstreep-karakters gevolg word.",
"Name": "Geen",
"Anchor": "Anker",
"Id": "Id",
"You have unsaved changes are you sure you want to navigate away?": "Jy het ongestoorde wysigings op hierdier bladsy - is jy seker dat jy die bladsy wil verlaat?",
"Restore last draft": "Herstel die laatste konsep",
"Special character": "Spesiaale karakter",
"Source code": "Bron kode",
"Language": "Taal",
"Insert\/Edit code sample": "Voeg\/Redigeer voorbeeld-kode",
"B": "Blou",
"R": "Rooi",
"G": "Groen",
"Color": "Kleur",
"Right to left": "Regs na links",
"Left to right": "Links na regs",
"Emoticons": "Emoticons",
"Robots": "Robotte",
"Document properties": "Dokument eienskappe",
"Title": "Titel",
"Keywords": "Sleutelwoorde",
"Encoding": "Enkodeering",
"Description": "Beskrywing",
"Author": "Outeur",
"Fullscreen": "Volskerm",
"Horizontal line": "Horisontale lyn",
"Horizontal space": "Horisontale Spasie",
"Insert\/edit image": "Afbeelding invoeg\/bewerk",