mirror of
https://github.com/e107inc/e107.git
synced 2025-08-05 14:17:49 +02:00
@@ -23,7 +23,7 @@ if((e107::wysiwyg() === true && check_class($pref['post_html'])) || strpos(e_SEL
|
||||
|
||||
// e107::js('footer', 'https://cdnjs.cloudflare.com/ajax/libs/tinymce/4.5.3/tinymce.min.js');
|
||||
|
||||
e107::js('footer', 'https://cdnjs.cloudflare.com/ajax/libs/tinymce/4.5.8/tinymce.min.js');
|
||||
e107::js('footer', 'https://cdnjs.cloudflare.com/ajax/libs/tinymce/4.7.12/tinymce.min.js');
|
||||
|
||||
// e107::js('footer', "//cdn.tinymce.com/4/tinymce.min.js");
|
||||
|
||||
|
@@ -1,8 +1,11 @@
|
||||
tinymce.addI18n('en_GB',{
|
||||
"Cut": "Cut",
|
||||
"Heading 5": "Heading 5",
|
||||
"Header 2": "Header 2",
|
||||
"Your browser doesn't support direct access to the clipboard. Please use the Ctrl+X\/C\/V keyboard shortcuts instead.": "Your browser doesn't support direct access to the clipboard. Please use the Ctrl+X\/C\/V keyboard shortcuts instead.",
|
||||
"Heading 4": "Heading 4",
|
||||
"Div": "Div",
|
||||
"Heading 2": "Heading 2",
|
||||
"Paste": "Paste",
|
||||
"Close": "Close",
|
||||
"Font Family": "Font Family",
|
||||
@@ -11,6 +14,8 @@ tinymce.addI18n('en_GB',{
|
||||
"New document": "New document",
|
||||
"Blockquote": "Blockquote",
|
||||
"Numbered list": "Numbered list",
|
||||
"Heading 1": "Heading 1",
|
||||
"Headings": "Headings",
|
||||
"Increase indent": "Increase indent",
|
||||
"Formats": "Formats",
|
||||
"Headers": "Headers",
|
||||
@@ -34,6 +39,8 @@ tinymce.addI18n('en_GB',{
|
||||
"Italic": "Italic",
|
||||
"Align center": "Align centre",
|
||||
"Header 5": "Header 5",
|
||||
"Heading 6": "Heading 6",
|
||||
"Heading 3": "Heading 3",
|
||||
"Decrease indent": "Decrease indent",
|
||||
"Header 4": "Header 4",
|
||||
"Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off.": "Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off.",
|
||||
@@ -53,12 +60,20 @@ tinymce.addI18n('en_GB',{
|
||||
"Upper Alpha": "Upper Alpha",
|
||||
"Upper Roman": "Upper Roman",
|
||||
"Lower Roman": "Lower Roman",
|
||||
"Id should start with a letter, followed only by letters, numbers, dashes, dots, colons or underscores.": "ID should start with a letter, followed only by letters, numbers, dashes, dots, colons or underscores.",
|
||||
"Name": "Name",
|
||||
"Anchor": "Anchor",
|
||||
"Id": "ID",
|
||||
"You have unsaved changes are you sure you want to navigate away?": "You have unsaved changes are you sure you want to navigate away?",
|
||||
"Restore last draft": "Restore last draft",
|
||||
"Special character": "Special character",
|
||||
"Source code": "Source code",
|
||||
"Language": "Language",
|
||||
"Insert\/Edit code sample": "Insert\/Edit code sample",
|
||||
"B": "B",
|
||||
"R": "R",
|
||||
"G": "G",
|
||||
"Color": "Colour",
|
||||
"Right to left": "Right to left",
|
||||
"Left to right": "Left to right",
|
||||
"Emoticons": "Emoticons",
|
||||
@@ -83,23 +98,48 @@ tinymce.addI18n('en_GB',{
|
||||
"Style": "Style",
|
||||
"Dimensions": "Dimensions",
|
||||
"Insert image": "Insert image",
|
||||
"Image": "Image",
|
||||
"Zoom in": "Zoom in",
|
||||
"Contrast": "Contrast",
|
||||
"Back": "Back",
|
||||
"Gamma": "Gamma",
|
||||
"Flip horizontally": "Flip horizontally",
|
||||
"Resize": "Resize",
|
||||
"Sharpen": "Sharpen",
|
||||
"Zoom out": "Zoom out",
|
||||
"Image options": "Image options",
|
||||
"Apply": "Apply",
|
||||
"Brightness": "Brightness",
|
||||
"Rotate clockwise": "Rotate clockwise",
|
||||
"Rotate counterclockwise": "Rotate counterclockwise",
|
||||
"Edit image": "Edit image",
|
||||
"Color levels": "Colour levels",
|
||||
"Crop": "Crop",
|
||||
"Orientation": "Orientation",
|
||||
"Flip vertically": "Flip vertically",
|
||||
"Invert": "Invert",
|
||||
"Date\/time": "Date\/time",
|
||||
"Insert date\/time": "Insert date\/time",
|
||||
"Remove link": "Remove link",
|
||||
"Url": "URL",
|
||||
"Text to display": "Text to display",
|
||||
"Anchors": "Anchors",
|
||||
"Insert link": "Insert link",
|
||||
"Link": "Link",
|
||||
"New window": "New window",
|
||||
"None": "None",
|
||||
"The URL you entered seems to be an external link. Do you want to add the required http:\/\/ prefix?": "The URL you entered seems to be an external link. Do you want to add the required http:\/\/ prefix?",
|
||||
"Paste or type a link": "Paste or type a link",
|
||||
"Target": "Target",
|
||||
"The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?": "The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?",
|
||||
"Insert\/edit link": "Insert\/edit link",
|
||||
"Insert\/edit video": "Insert\/edit video",
|
||||
"Poster": "Poster",
|
||||
"Media": "Media",
|
||||
"Alternative source": "Alternative source",
|
||||
"Paste your embed code below:": "Paste your embed code below:",
|
||||
"Insert video": "Insert video",
|
||||
"Poster": "Poster",
|
||||
"Insert\/edit media": "Insert\/edit media",
|
||||
"Embed": "Embed",
|
||||
"Nonbreaking space": "Non-breaking space",
|
||||
"Page break": "Page break",
|
||||
@@ -121,11 +161,13 @@ tinymce.addI18n('en_GB',{
|
||||
"Finish": "Finish",
|
||||
"Ignore all": "Ignore all",
|
||||
"Ignore": "Ignore",
|
||||
"Add to Dictionary": "Add to Dictionary",
|
||||
"Insert row before": "Insert row before",
|
||||
"Rows": "Rows",
|
||||
"Height": "Height",
|
||||
"Paste row after": "Paste row after",
|
||||
"Alignment": "Alignment",
|
||||
"Border color": "Border colour",
|
||||
"Column group": "Column group",
|
||||
"Row": "Row",
|
||||
"Insert column before": "Insert column before",
|
||||
@@ -141,15 +183,20 @@ tinymce.addI18n('en_GB',{
|
||||
"Paste row before": "Paste row before",
|
||||
"Scope": "Scope",
|
||||
"Delete table": "Delete table",
|
||||
"H Align": "H Align",
|
||||
"Top": "Top",
|
||||
"Header cell": "Header cell",
|
||||
"Column": "Column",
|
||||
"Row group": "Row group",
|
||||
"Cell": "Cell",
|
||||
"Header": "Header",
|
||||
"Middle": "Middle",
|
||||
"Cell type": "Cell type",
|
||||
"Copy row": "Copy row",
|
||||
"Row properties": "Row properties",
|
||||
"Table properties": "Table properties",
|
||||
"Row group": "Row group",
|
||||
"Bottom": "Bottom",
|
||||
"V Align": "V Align",
|
||||
"Header": "Header",
|
||||
"Right": "Right",
|
||||
"Insert column after": "Insert column after",
|
||||
"Cols": "Cols",
|
||||
@@ -164,7 +211,11 @@ tinymce.addI18n('en_GB',{
|
||||
"Insert template": "Insert template",
|
||||
"Templates": "Templates",
|
||||
"Background color": "Background colour",
|
||||
"Custom...": "Custom...",
|
||||
"Custom color": "Custom colour",
|
||||
"No color": "No colour",
|
||||
"Text color": "Text colour",
|
||||
"Table of Contents": "Table of Contents",
|
||||
"Show blocks": "Show blocks",
|
||||
"Show invisible characters": "Show invisible characters",
|
||||
"Words: {0}": "Words: {0}",
|
@@ -1,123 +1,101 @@
|
||||
/**
|
||||
* plugin.js
|
||||
*
|
||||
* Copyright, Moxiecode Systems AB
|
||||
* Released under LGPL License.
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
*/
|
||||
(function () {
|
||||
var bbcode = (function () {
|
||||
'use strict';
|
||||
|
||||
/*global tinymce:true */
|
||||
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
(function() {
|
||||
tinymce.create('tinymce.plugins.BBCodePlugin', {
|
||||
init : function(ed) {
|
||||
var t = this, dialect = ed.getParam('bbcode_dialect', 'punbb').toLowerCase();
|
||||
var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools');
|
||||
|
||||
ed.on('beforeSetContent', function(e) {
|
||||
e.content = t['_' + dialect + '_bbcode2html'](e.content);
|
||||
});
|
||||
|
||||
ed.on('postProcess', function(e) {
|
||||
if (e.set) {
|
||||
e.content = t['_' + dialect + '_bbcode2html'](e.content);
|
||||
}
|
||||
|
||||
if (e.get) {
|
||||
e.content = t['_' + dialect + '_html2bbcode'](e.content);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
getInfo: function() {
|
||||
return {
|
||||
longname: 'BBCode Plugin',
|
||||
author: 'Moxiecode Systems AB',
|
||||
authorurl: 'http://www.tinymce.com',
|
||||
infourl: 'http://www.tinymce.com/wiki.php/Plugin:bbcode'
|
||||
var html2bbcode = function (s) {
|
||||
s = global$1.trim(s);
|
||||
var rep = function (re, str) {
|
||||
s = s.replace(re, str);
|
||||
};
|
||||
},
|
||||
|
||||
// Private methods
|
||||
|
||||
// HTML -> BBCode in PunBB dialect
|
||||
_punbb_html2bbcode : function(s) {
|
||||
s = tinymce.trim(s);
|
||||
|
||||
function rep(re, str) {
|
||||
s = s.replace(re, str);
|
||||
}
|
||||
|
||||
// example: <strong> to [b]
|
||||
rep(/<a.*?href=\"(.*?)\".*?>(.*?)<\/a>/gi,"[url=$1]$2[/url]");
|
||||
rep(/<font.*?color=\"(.*?)\".*?class=\"codeStyle\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]");
|
||||
rep(/<font.*?color=\"(.*?)\".*?class=\"quoteStyle\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]");
|
||||
rep(/<font.*?class=\"codeStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]");
|
||||
rep(/<font.*?class=\"quoteStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]");
|
||||
rep(/<span style=\"color: ?(.*?);\">(.*?)<\/span>/gi,"[color=$1]$2[/color]");
|
||||
rep(/<font.*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[color=$1]$2[/color]");
|
||||
rep(/<span style=\"font-size:(.*?);\">(.*?)<\/span>/gi,"[size=$1]$2[/size]");
|
||||
rep(/<font>(.*?)<\/font>/gi,"$1");
|
||||
rep(/<img.*?src=\"(.*?)\".*?\/>/gi,"[img]$1[/img]");
|
||||
rep(/<span class=\"codeStyle\">(.*?)<\/span>/gi,"[code]$1[/code]");
|
||||
rep(/<span class=\"quoteStyle\">(.*?)<\/span>/gi,"[quote]$1[/quote]");
|
||||
rep(/<strong class=\"codeStyle\">(.*?)<\/strong>/gi,"[code][b]$1[/b][/code]");
|
||||
rep(/<strong class=\"quoteStyle\">(.*?)<\/strong>/gi,"[quote][b]$1[/b][/quote]");
|
||||
rep(/<em class=\"codeStyle\">(.*?)<\/em>/gi,"[code][i]$1[/i][/code]");
|
||||
rep(/<em class=\"quoteStyle\">(.*?)<\/em>/gi,"[quote][i]$1[/i][/quote]");
|
||||
rep(/<u class=\"codeStyle\">(.*?)<\/u>/gi,"[code][u]$1[/u][/code]");
|
||||
rep(/<u class=\"quoteStyle\">(.*?)<\/u>/gi,"[quote][u]$1[/u][/quote]");
|
||||
rep(/<\/(strong|b)>/gi,"[/b]");
|
||||
rep(/<(strong|b)>/gi,"[b]");
|
||||
rep(/<\/(em|i)>/gi,"[/i]");
|
||||
rep(/<(em|i)>/gi,"[i]");
|
||||
rep(/<\/u>/gi,"[/u]");
|
||||
rep(/<span style=\"text-decoration: ?underline;\">(.*?)<\/span>/gi,"[u]$1[/u]");
|
||||
rep(/<u>/gi,"[u]");
|
||||
rep(/<blockquote[^>]*>/gi,"[quote]");
|
||||
rep(/<\/blockquote>/gi,"[/quote]");
|
||||
rep(/<br \/>/gi,"\n");
|
||||
rep(/<br\/>/gi,"\n");
|
||||
rep(/<br>/gi,"\n");
|
||||
rep(/<p>/gi,"");
|
||||
rep(/<\/p>/gi,"\n");
|
||||
rep(/ |\u00a0/gi," ");
|
||||
rep(/"/gi,"\"");
|
||||
rep(/</gi,"<");
|
||||
rep(/>/gi,">");
|
||||
rep(/&/gi,"&");
|
||||
|
||||
rep(/<a.*?href=\"(.*?)\".*?>(.*?)<\/a>/gi, '[url=$1]$2[/url]');
|
||||
rep(/<font.*?color=\"(.*?)\".*?class=\"codeStyle\".*?>(.*?)<\/font>/gi, '[code][color=$1]$2[/color][/code]');
|
||||
rep(/<font.*?color=\"(.*?)\".*?class=\"quoteStyle\".*?>(.*?)<\/font>/gi, '[quote][color=$1]$2[/color][/quote]');
|
||||
rep(/<font.*?class=\"codeStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi, '[code][color=$1]$2[/color][/code]');
|
||||
rep(/<font.*?class=\"quoteStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi, '[quote][color=$1]$2[/color][/quote]');
|
||||
rep(/<span style=\"color: ?(.*?);\">(.*?)<\/span>/gi, '[color=$1]$2[/color]');
|
||||
rep(/<font.*?color=\"(.*?)\".*?>(.*?)<\/font>/gi, '[color=$1]$2[/color]');
|
||||
rep(/<span style=\"font-size:(.*?);\">(.*?)<\/span>/gi, '[size=$1]$2[/size]');
|
||||
rep(/<font>(.*?)<\/font>/gi, '$1');
|
||||
rep(/<img.*?src=\"(.*?)\".*?\/>/gi, '[img]$1[/img]');
|
||||
rep(/<span class=\"codeStyle\">(.*?)<\/span>/gi, '[code]$1[/code]');
|
||||
rep(/<span class=\"quoteStyle\">(.*?)<\/span>/gi, '[quote]$1[/quote]');
|
||||
rep(/<strong class=\"codeStyle\">(.*?)<\/strong>/gi, '[code][b]$1[/b][/code]');
|
||||
rep(/<strong class=\"quoteStyle\">(.*?)<\/strong>/gi, '[quote][b]$1[/b][/quote]');
|
||||
rep(/<em class=\"codeStyle\">(.*?)<\/em>/gi, '[code][i]$1[/i][/code]');
|
||||
rep(/<em class=\"quoteStyle\">(.*?)<\/em>/gi, '[quote][i]$1[/i][/quote]');
|
||||
rep(/<u class=\"codeStyle\">(.*?)<\/u>/gi, '[code][u]$1[/u][/code]');
|
||||
rep(/<u class=\"quoteStyle\">(.*?)<\/u>/gi, '[quote][u]$1[/u][/quote]');
|
||||
rep(/<\/(strong|b)>/gi, '[/b]');
|
||||
rep(/<(strong|b)>/gi, '[b]');
|
||||
rep(/<\/(em|i)>/gi, '[/i]');
|
||||
rep(/<(em|i)>/gi, '[i]');
|
||||
rep(/<\/u>/gi, '[/u]');
|
||||
rep(/<span style=\"text-decoration: ?underline;\">(.*?)<\/span>/gi, '[u]$1[/u]');
|
||||
rep(/<u>/gi, '[u]');
|
||||
rep(/<blockquote[^>]*>/gi, '[quote]');
|
||||
rep(/<\/blockquote>/gi, '[/quote]');
|
||||
rep(/<br \/>/gi, '\n');
|
||||
rep(/<br\/>/gi, '\n');
|
||||
rep(/<br>/gi, '\n');
|
||||
rep(/<p>/gi, '');
|
||||
rep(/<\/p>/gi, '\n');
|
||||
rep(/ |\u00a0/gi, ' ');
|
||||
rep(/"/gi, '"');
|
||||
rep(/</gi, '<');
|
||||
rep(/>/gi, '>');
|
||||
rep(/&/gi, '&');
|
||||
return s;
|
||||
},
|
||||
|
||||
// BBCode -> HTML from PunBB dialect
|
||||
_punbb_bbcode2html : function(s) {
|
||||
s = tinymce.trim(s);
|
||||
|
||||
function rep(re, str) {
|
||||
};
|
||||
var bbcode2html = function (s) {
|
||||
s = global$1.trim(s);
|
||||
var rep = function (re, str) {
|
||||
s = s.replace(re, str);
|
||||
}
|
||||
|
||||
// example: [b] to <strong>
|
||||
rep(/\n/gi,"<br />");
|
||||
rep(/\[b\]/gi,"<strong>");
|
||||
rep(/\[\/b\]/gi,"</strong>");
|
||||
rep(/\[i\]/gi,"<em>");
|
||||
rep(/\[\/i\]/gi,"</em>");
|
||||
rep(/\[u\]/gi,"<u>");
|
||||
rep(/\[\/u\]/gi,"</u>");
|
||||
rep(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,"<a href=\"$1\">$2</a>");
|
||||
rep(/\[url\](.*?)\[\/url\]/gi,"<a href=\"$1\">$1</a>");
|
||||
rep(/\[img\](.*?)\[\/img\]/gi,"<img src=\"$1\" />");
|
||||
rep(/\[color=(.*?)\](.*?)\[\/color\]/gi,"<font color=\"$1\">$2</font>");
|
||||
rep(/\[code\](.*?)\[\/code\]/gi,"<span class=\"codeStyle\">$1</span> ");
|
||||
rep(/\[quote.*?\](.*?)\[\/quote\]/gi,"<span class=\"quoteStyle\">$1</span> ");
|
||||
|
||||
};
|
||||
rep(/\n/gi, '<br />');
|
||||
rep(/\[b\]/gi, '<strong>');
|
||||
rep(/\[\/b\]/gi, '</strong>');
|
||||
rep(/\[i\]/gi, '<em>');
|
||||
rep(/\[\/i\]/gi, '</em>');
|
||||
rep(/\[u\]/gi, '<u>');
|
||||
rep(/\[\/u\]/gi, '</u>');
|
||||
rep(/\[url=([^\]]+)\](.*?)\[\/url\]/gi, '<a href="$1">$2</a>');
|
||||
rep(/\[url\](.*?)\[\/url\]/gi, '<a href="$1">$1</a>');
|
||||
rep(/\[img\](.*?)\[\/img\]/gi, '<img src="$1" />');
|
||||
rep(/\[color=(.*?)\](.*?)\[\/color\]/gi, '<font color="$1">$2</font>');
|
||||
rep(/\[code\](.*?)\[\/code\]/gi, '<span class="codeStyle">$1</span> ');
|
||||
rep(/\[quote.*?\](.*?)\[\/quote\]/gi, '<span class="quoteStyle">$1</span> ');
|
||||
return s;
|
||||
};
|
||||
var $_36akuw96jgqkwz4e = {
|
||||
html2bbcode: html2bbcode,
|
||||
bbcode2html: bbcode2html
|
||||
};
|
||||
|
||||
global.add('bbcode', function () {
|
||||
return {
|
||||
init: function (editor) {
|
||||
editor.on('beforeSetContent', function (e) {
|
||||
e.content = $_36akuw96jgqkwz4e.bbcode2html(e.content);
|
||||
});
|
||||
editor.on('postProcess', function (e) {
|
||||
if (e.set) {
|
||||
e.content = $_36akuw96jgqkwz4e.bbcode2html(e.content);
|
||||
}
|
||||
if (e.get) {
|
||||
e.content = $_36akuw96jgqkwz4e.html2bbcode(e.content);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
function Plugin () {
|
||||
}
|
||||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('bbcode', tinymce.plugins.BBCodePlugin);
|
||||
return Plugin;
|
||||
|
||||
}());
|
||||
})();
|
@@ -1 +1 @@
|
||||
!function(){tinymce.create("tinymce.plugins.BBCodePlugin",{init:function(e){var t=this,n=e.getParam("bbcode_dialect","punbb").toLowerCase();e.on("beforeSetContent",function(e){e.content=t["_"+n+"_bbcode2html"](e.content)}),e.on("postProcess",function(e){e.set&&(e.content=t["_"+n+"_bbcode2html"](e.content)),e.get&&(e.content=t["_"+n+"_html2bbcode"](e.content))})},getInfo:function(){return{longname:"BBCode Plugin",author:"Moxiecode Systems AB",authorurl:"http://www.tinymce.com",infourl:"http://www.tinymce.com/wiki.php/Plugin:bbcode"}},_punbb_html2bbcode:function(e){function t(t,n){e=e.replace(t,n)}return e=tinymce.trim(e),t(/<a.*?href=\"(.*?)\".*?>(.*?)<\/a>/gi,"[url=$1]$2[/url]"),t(/<font.*?color=\"(.*?)\".*?class=\"codeStyle\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]"),t(/<font.*?color=\"(.*?)\".*?class=\"quoteStyle\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]"),t(/<font.*?class=\"codeStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]"),t(/<font.*?class=\"quoteStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]"),t(/<span style=\"color: ?(.*?);\">(.*?)<\/span>/gi,"[color=$1]$2[/color]"),t(/<font.*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[color=$1]$2[/color]"),t(/<span style=\"font-size:(.*?);\">(.*?)<\/span>/gi,"[size=$1]$2[/size]"),t(/<font>(.*?)<\/font>/gi,"$1"),t(/<img.*?src=\"(.*?)\".*?\/>/gi,"[img]$1[/img]"),t(/<span class=\"codeStyle\">(.*?)<\/span>/gi,"[code]$1[/code]"),t(/<span class=\"quoteStyle\">(.*?)<\/span>/gi,"[quote]$1[/quote]"),t(/<strong class=\"codeStyle\">(.*?)<\/strong>/gi,"[code][b]$1[/b][/code]"),t(/<strong class=\"quoteStyle\">(.*?)<\/strong>/gi,"[quote][b]$1[/b][/quote]"),t(/<em class=\"codeStyle\">(.*?)<\/em>/gi,"[code][i]$1[/i][/code]"),t(/<em class=\"quoteStyle\">(.*?)<\/em>/gi,"[quote][i]$1[/i][/quote]"),t(/<u class=\"codeStyle\">(.*?)<\/u>/gi,"[code][u]$1[/u][/code]"),t(/<u class=\"quoteStyle\">(.*?)<\/u>/gi,"[quote][u]$1[/u][/quote]"),t(/<\/(strong|b)>/gi,"[/b]"),t(/<(strong|b)>/gi,"[b]"),t(/<\/(em|i)>/gi,"[/i]"),t(/<(em|i)>/gi,"[i]"),t(/<\/u>/gi,"[/u]"),t(/<span style=\"text-decoration: ?underline;\">(.*?)<\/span>/gi,"[u]$1[/u]"),t(/<u>/gi,"[u]"),t(/<blockquote[^>]*>/gi,"[quote]"),t(/<\/blockquote>/gi,"[/quote]"),t(/<br \/>/gi,"\n"),t(/<br\/>/gi,"\n"),t(/<br>/gi,"\n"),t(/<p>/gi,""),t(/<\/p>/gi,"\n"),t(/ |\u00a0/gi," "),t(/"/gi,'"'),t(/</gi,"<"),t(/>/gi,">"),t(/&/gi,"&"),e},_punbb_bbcode2html:function(e){function t(t,n){e=e.replace(t,n)}return e=tinymce.trim(e),t(/\n/gi,"<br />"),t(/\[b\]/gi,"<strong>"),t(/\[\/b\]/gi,"</strong>"),t(/\[i\]/gi,"<em>"),t(/\[\/i\]/gi,"</em>"),t(/\[u\]/gi,"<u>"),t(/\[\/u\]/gi,"</u>"),t(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,'<a href="$1">$2</a>'),t(/\[url\](.*?)\[\/url\]/gi,'<a href="$1">$1</a>'),t(/\[img\](.*?)\[\/img\]/gi,'<img src="$1" />'),t(/\[color=(.*?)\](.*?)\[\/color\]/gi,'<font color="$1">$2</font>'),t(/\[code\](.*?)\[\/code\]/gi,'<span class="codeStyle">$1</span> '),t(/\[quote.*?\](.*?)\[\/quote\]/gi,'<span class="quoteStyle">$1</span> '),e}}),tinymce.PluginManager.add("bbcode",tinymce.plugins.BBCodePlugin)}();
|
||||
!function(){"use strict";var o=tinymce.util.Tools.resolve("tinymce.PluginManager"),t=tinymce.util.Tools.resolve("tinymce.util.Tools"),e=function(e){e=t.trim(e);var o=function(o,t){e=e.replace(o,t)};return o(/<a.*?href=\"(.*?)\".*?>(.*?)<\/a>/gi,"[url=$1]$2[/url]"),o(/<font.*?color=\"(.*?)\".*?class=\"codeStyle\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]"),o(/<font.*?color=\"(.*?)\".*?class=\"quoteStyle\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]"),o(/<font.*?class=\"codeStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]"),o(/<font.*?class=\"quoteStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]"),o(/<span style=\"color: ?(.*?);\">(.*?)<\/span>/gi,"[color=$1]$2[/color]"),o(/<font.*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[color=$1]$2[/color]"),o(/<span style=\"font-size:(.*?);\">(.*?)<\/span>/gi,"[size=$1]$2[/size]"),o(/<font>(.*?)<\/font>/gi,"$1"),o(/<img.*?src=\"(.*?)\".*?\/>/gi,"[img]$1[/img]"),o(/<span class=\"codeStyle\">(.*?)<\/span>/gi,"[code]$1[/code]"),o(/<span class=\"quoteStyle\">(.*?)<\/span>/gi,"[quote]$1[/quote]"),o(/<strong class=\"codeStyle\">(.*?)<\/strong>/gi,"[code][b]$1[/b][/code]"),o(/<strong class=\"quoteStyle\">(.*?)<\/strong>/gi,"[quote][b]$1[/b][/quote]"),o(/<em class=\"codeStyle\">(.*?)<\/em>/gi,"[code][i]$1[/i][/code]"),o(/<em class=\"quoteStyle\">(.*?)<\/em>/gi,"[quote][i]$1[/i][/quote]"),o(/<u class=\"codeStyle\">(.*?)<\/u>/gi,"[code][u]$1[/u][/code]"),o(/<u class=\"quoteStyle\">(.*?)<\/u>/gi,"[quote][u]$1[/u][/quote]"),o(/<\/(strong|b)>/gi,"[/b]"),o(/<(strong|b)>/gi,"[b]"),o(/<\/(em|i)>/gi,"[/i]"),o(/<(em|i)>/gi,"[i]"),o(/<\/u>/gi,"[/u]"),o(/<span style=\"text-decoration: ?underline;\">(.*?)<\/span>/gi,"[u]$1[/u]"),o(/<u>/gi,"[u]"),o(/<blockquote[^>]*>/gi,"[quote]"),o(/<\/blockquote>/gi,"[/quote]"),o(/<br \/>/gi,"\n"),o(/<br\/>/gi,"\n"),o(/<br>/gi,"\n"),o(/<p>/gi,""),o(/<\/p>/gi,"\n"),o(/ |\u00a0/gi," "),o(/"/gi,'"'),o(/</gi,"<"),o(/>/gi,">"),o(/&/gi,"&"),e},i=function(e){e=t.trim(e);var o=function(o,t){e=e.replace(o,t)};return o(/\n/gi,"<br />"),o(/\[b\]/gi,"<strong>"),o(/\[\/b\]/gi,"</strong>"),o(/\[i\]/gi,"<em>"),o(/\[\/i\]/gi,"</em>"),o(/\[u\]/gi,"<u>"),o(/\[\/u\]/gi,"</u>"),o(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,'<a href="$1">$2</a>'),o(/\[url\](.*?)\[\/url\]/gi,'<a href="$1">$1</a>'),o(/\[img\](.*?)\[\/img\]/gi,'<img src="$1" />'),o(/\[color=(.*?)\](.*?)\[\/color\]/gi,'<font color="$1">$2</font>'),o(/\[code\](.*?)\[\/code\]/gi,'<span class="codeStyle">$1</span> '),o(/\[quote.*?\](.*?)\[\/quote\]/gi,'<span class="quoteStyle">$1</span> '),e};o.add("bbcode",function(){return{init:function(o){o.on("beforeSetContent",function(o){o.content=i(o.content)}),o.on("postProcess",function(o){o.set&&(o.content=i(o.content)),o.get&&(o.content=e(o.content))})}}})}();
|
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
* plugin.js
|
||||
*
|
||||
* Copyright, Moxiecode Systems AB
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
@@ -19,7 +19,7 @@
|
||||
* - No editor.onEvent
|
||||
* - Can't cancel execCommands with beforeExecCommand
|
||||
*/
|
||||
(function(tinymce) {
|
||||
(function (tinymce) {
|
||||
var reported;
|
||||
|
||||
function noop() {
|
||||
@@ -34,13 +34,14 @@
|
||||
|
||||
function Dispatcher(target, newEventName, argsMap, defaultScope) {
|
||||
target = target || this;
|
||||
var cbs = [];
|
||||
|
||||
if (!newEventName) {
|
||||
this.add = this.addToTop = this.remove = this.dispatch = noop;
|
||||
return;
|
||||
}
|
||||
|
||||
this.add = function(callback, scope, prepend) {
|
||||
this.add = function (callback, scope, prepend) {
|
||||
log('<target>.on' + newEventName + ".add(..)");
|
||||
|
||||
// Convert callback({arg1:x, arg2:x}) -> callback(arg1, arg2)
|
||||
@@ -51,7 +52,7 @@
|
||||
argsMap = argsMap.split(" ");
|
||||
}
|
||||
|
||||
if (argsMap && typeof argsMap != "function") {
|
||||
if (argsMap && typeof argsMap !== "function") {
|
||||
for (var i = 0; i < argsMap.length; i++) {
|
||||
callbackArgs.push(e[argsMap[i]]);
|
||||
}
|
||||
@@ -77,20 +78,32 @@
|
||||
|
||||
target.on(newEventName, patchedEventCallback, prepend);
|
||||
|
||||
var handlers = {
|
||||
original: callback,
|
||||
patched: patchedEventCallback
|
||||
};
|
||||
|
||||
cbs.push(handlers);
|
||||
return patchedEventCallback;
|
||||
};
|
||||
|
||||
this.addToTop = function(callback, scope) {
|
||||
this.addToTop = function (callback, scope) {
|
||||
this.add(callback, scope, true);
|
||||
};
|
||||
|
||||
this.remove = function(callback) {
|
||||
this.remove = function (callback) {
|
||||
cbs.forEach(function (item, i) {
|
||||
if (item.original === callback) {
|
||||
cbs.splice(i, 1);
|
||||
return target.off(newEventName, item.patched);
|
||||
}
|
||||
});
|
||||
|
||||
return target.off(newEventName, callback);
|
||||
};
|
||||
|
||||
this.dispatch = function() {
|
||||
this.dispatch = function () {
|
||||
target.fire(newEventName);
|
||||
|
||||
return true;
|
||||
};
|
||||
}
|
||||
@@ -105,8 +118,17 @@
|
||||
};
|
||||
|
||||
function patchEditor(editor) {
|
||||
|
||||
function translate(str) {
|
||||
var prefix = editor.settings.language || "en";
|
||||
var prefixedStr = [prefix, str].join('.');
|
||||
var translatedStr = tinymce.i18n.translate(prefixedStr);
|
||||
|
||||
return prefixedStr !== translatedStr ? translatedStr : tinymce.i18n.translate(str);
|
||||
}
|
||||
|
||||
function patchEditorEvents(oldEventNames, argsMap) {
|
||||
tinymce.each(oldEventNames.split(" "), function(oldName) {
|
||||
tinymce.each(oldEventNames.split(" "), function (oldName) {
|
||||
editor["on" + oldName] = new Dispatcher(editor, oldName, argsMap);
|
||||
});
|
||||
}
|
||||
@@ -119,7 +141,7 @@
|
||||
}
|
||||
|
||||
function filterSelectionEvents(needsSelection) {
|
||||
return function(type, e) {
|
||||
return function (type, e) {
|
||||
if ((!e.selection && !needsSelection) || e.selection == needsSelection) {
|
||||
return [e];
|
||||
}
|
||||
@@ -142,7 +164,7 @@
|
||||
return cmNoop();
|
||||
}
|
||||
|
||||
tinymce.each(methods.split(' '), function(method) {
|
||||
tinymce.each(methods.split(' '), function (method) {
|
||||
obj[method] = _noop;
|
||||
});
|
||||
|
||||
@@ -152,7 +174,7 @@
|
||||
editor.controlManager = {
|
||||
buttons: {},
|
||||
|
||||
setDisabled: function(name, state) {
|
||||
setDisabled: function (name, state) {
|
||||
log("controlManager.setDisabled(..)");
|
||||
|
||||
if (this.buttons[name]) {
|
||||
@@ -160,7 +182,7 @@
|
||||
}
|
||||
},
|
||||
|
||||
setActive: function(name, state) {
|
||||
setActive: function (name, state) {
|
||||
log("controlManager.setActive(..)");
|
||||
|
||||
if (this.buttons[name]) {
|
||||
@@ -171,7 +193,7 @@
|
||||
onAdd: new Dispatcher(),
|
||||
onPostRender: new Dispatcher(),
|
||||
|
||||
add: function(obj) {
|
||||
add: function (obj) {
|
||||
return obj;
|
||||
},
|
||||
createButton: cmNoop,
|
||||
@@ -198,7 +220,7 @@
|
||||
patchEditorEvents("VisualAid", "element hasVisual");
|
||||
patchEditorEvents("Undo Redo", convertUndoEventArgs);
|
||||
|
||||
patchEditorEvents("NodeChange", function(type, e) {
|
||||
patchEditorEvents("NodeChange", function (type, e) {
|
||||
return [
|
||||
editor.controlManager,
|
||||
e.element,
|
||||
@@ -208,14 +230,14 @@
|
||||
});
|
||||
|
||||
var originalAddButton = editor.addButton;
|
||||
editor.addButton = function(name, settings) {
|
||||
editor.addButton = function (name, settings) {
|
||||
var originalOnPostRender;
|
||||
|
||||
function patchedPostRender() {
|
||||
editor.controlManager.buttons[name] = this;
|
||||
|
||||
if (originalOnPostRender) {
|
||||
return originalOnPostRender.call(this);
|
||||
return originalOnPostRender.apply(this, arguments);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -231,13 +253,13 @@
|
||||
}
|
||||
|
||||
if (settings.title) {
|
||||
settings.title = tinymce.i18n.translate((editor.settings.language || "en") + "." + settings.title);
|
||||
settings.title = translate(settings.title);
|
||||
}
|
||||
|
||||
return originalAddButton.call(this, name, settings);
|
||||
};
|
||||
|
||||
editor.on('init', function() {
|
||||
editor.on('init', function () {
|
||||
var undoManager = editor.undoManager, selection = editor.selection;
|
||||
|
||||
undoManager.onUndo = new Dispatcher(editor, "Undo", convertUndoEventArgs, null, undoManager);
|
||||
@@ -251,12 +273,12 @@
|
||||
selection.onSetContent = new Dispatcher(editor, "SetContent", filterSelectionEvents(true), selection);
|
||||
});
|
||||
|
||||
editor.on('BeforeRenderUI', function() {
|
||||
editor.on('BeforeRenderUI', function () {
|
||||
var windowManager = editor.windowManager;
|
||||
|
||||
windowManager.onOpen = new Dispatcher();
|
||||
windowManager.onClose = new Dispatcher();
|
||||
windowManager.createInstance = function(className, a, b, c, d, e) {
|
||||
windowManager.createInstance = function (className, a, b, c, d, e) {
|
||||
log("windowManager.createInstance(..)");
|
||||
|
||||
var constr = tinymce.resolve(className);
|
||||
@@ -265,10 +287,13 @@
|
||||
});
|
||||
}
|
||||
|
||||
tinymce.on('SetupEditor', patchEditor);
|
||||
tinymce.on('SetupEditor', function (e) {
|
||||
patchEditor(e.editor);
|
||||
});
|
||||
|
||||
tinymce.PluginManager.add("compat3x", patchEditor);
|
||||
|
||||
tinymce.addI18n = function(prefix, o) {
|
||||
tinymce.addI18n = function (prefix, o) {
|
||||
var I18n = tinymce.util.I18n, each = tinymce.each;
|
||||
|
||||
if (typeof prefix == "string" && prefix.indexOf('.') === -1) {
|
||||
@@ -277,9 +302,9 @@
|
||||
}
|
||||
|
||||
if (!tinymce.is(prefix, 'string')) {
|
||||
each(prefix, function(o, lc) {
|
||||
each(o, function(o, g) {
|
||||
each(o, function(o, k) {
|
||||
each(prefix, function (o, lc) {
|
||||
each(o, function (o, g) {
|
||||
each(o, function (o, k) {
|
||||
if (g === 'common') {
|
||||
I18n.data[lc + '.' + k] = o;
|
||||
} else {
|
||||
@@ -289,7 +314,7 @@
|
||||
});
|
||||
});
|
||||
} else {
|
||||
each(o, function(o, k) {
|
||||
each(o, function (o, k) {
|
||||
I18n.data[prefix + '.' + k] = o;
|
||||
});
|
||||
}
|
||||
|
@@ -1 +1 @@
|
||||
!function(a){function b(){}function c(a){!f&&window&&window.console&&(f=!0,console.log("Deprecated TinyMCE API call: "+a))}function d(a,d,e,f){return a=a||this,d?(this.add=function(b,g,h){function i(c){var h=[];if("string"==typeof e&&(e=e.split(" ")),e&&"function"!=typeof e)for(var i=0;i<e.length;i++)h.push(c[e[i]]);("function"!=typeof e||(h=e(d,c,a)))&&(e||(h=[c]),h.unshift(f||a),b.apply(g||f||a,h)===!1&&c.stopImmediatePropagation())}return c("<target>.on"+d+".add(..)"),a.on(d,i,h),i},this.addToTop=function(a,b){this.add(a,b,!0)},this.remove=function(b){return a.off(d,b)},void(this.dispatch=function(){return a.fire(d),!0})):void(this.add=this.addToTop=this.remove=this.dispatch=b)}function e(e){function f(b,c){a.each(b.split(" "),function(a){e["on"+a]=new d(e,a,c)})}function g(a,b,c){return[b.level,c]}function h(a){return function(b,c){return!c.selection&&!a||c.selection==a?[c]:void 0}}function i(){function b(){return i()}var d={},e="add addMenu addSeparator collapse createMenu destroy displayColor expand focus getLength hasMenus hideMenu isActive isCollapsed isDisabled isRendered isSelected mark postRender remove removeAll renderHTML renderMenu renderNode renderTo select selectByIndex setActive setAriaProperty setColor setDisabled setSelected setState showMenu update";return c("editor.controlManager.*"),a.each(e.split(" "),function(a){d[a]=b}),d}if(!e.controlManager){e.controlManager={buttons:{},setDisabled:function(a,b){c("controlManager.setDisabled(..)"),this.buttons[a]&&this.buttons[a].disabled(b)},setActive:function(a,b){c("controlManager.setActive(..)"),this.buttons[a]&&this.buttons[a].active(b)},onAdd:new d,onPostRender:new d,add:function(a){return a},createButton:i,createColorSplitButton:i,createControl:i,createDropMenu:i,createListBox:i,createMenuButton:i,createSeparator:i,createSplitButton:i,createToolbar:i,createToolbarGroup:i,destroy:b,get:b,setControlType:i},f("PreInit BeforeRenderUI PostRender Load Init Remove Activate Deactivate","editor"),f("Click MouseUp MouseDown DblClick KeyDown KeyUp KeyPress ContextMenu Paste Submit Reset"),f("BeforeExecCommand ExecCommand","command ui value args"),f("PreProcess PostProcess LoadContent SaveContent Change"),f("BeforeSetContent BeforeGetContent SetContent GetContent",h(!1)),f("SetProgressState","state time"),f("VisualAid","element hasVisual"),f("Undo Redo",g),f("NodeChange",function(a,b){return[e.controlManager,b.element,e.selection.isCollapsed(),b]});var j=e.addButton;e.addButton=function(b,c){function d(){return e.controlManager.buttons[b]=this,f?f.call(this):void 0}var f;for(var g in c)"onpostrender"===g.toLowerCase()&&(f=c[g],c.onPostRender=d);return f||(c.onPostRender=d),c.title&&(c.title=a.i18n.translate((e.settings.language||"en")+"."+c.title)),j.call(this,b,c)},e.on("init",function(){var a=e.undoManager,b=e.selection;a.onUndo=new d(e,"Undo",g,null,a),a.onRedo=new d(e,"Redo",g,null,a),a.onBeforeAdd=new d(e,"BeforeAddUndo",null,a),a.onAdd=new d(e,"AddUndo",null,a),b.onBeforeGetContent=new d(e,"BeforeGetContent",h(!0),b),b.onGetContent=new d(e,"GetContent",h(!0),b),b.onBeforeSetContent=new d(e,"BeforeSetContent",h(!0),b),b.onSetContent=new d(e,"SetContent",h(!0),b)}),e.on("BeforeRenderUI",function(){var b=e.windowManager;b.onOpen=new d,b.onClose=new d,b.createInstance=function(b,d,e,f,g,h){c("windowManager.createInstance(..)");var i=a.resolve(b);return new i(d,e,f,g,h)}})}}var f;a.util.Dispatcher=d,a.onBeforeUnload=new d(a,"BeforeUnload"),a.onAddEditor=new d(a,"AddEditor","editor"),a.onRemoveEditor=new d(a,"RemoveEditor","editor"),a.util.Cookie={get:b,getHash:b,remove:b,set:b,setHash:b},a.on("SetupEditor",e),a.PluginManager.add("compat3x",e),a.addI18n=function(b,c){var d=a.util.I18n,e=a.each;return"string"==typeof b&&-1===b.indexOf(".")?void d.add(b,c):void(a.is(b,"string")?e(c,function(a,c){d.data[b+"."+c]=a}):e(b,function(a,b){e(a,function(a,c){e(a,function(a,e){"common"===c?d.data[b+"."+e]=a:d.data[b+"."+c+"."+e]=a})})}))}}(tinymce);
|
||||
!function(u){var t;function l(){}function f(e){!t&&window&&window.console&&(t=!0,console.log("Deprecated TinyMCE API call: "+e))}function i(i,a,d,s){i=i||this;var c=[];a?(this.add=function(o,r,e){function t(e){var t=[];if("string"==typeof d&&(d=d.split(" ")),d&&"function"!=typeof d)for(var n=0;n<d.length;n++)t.push(e[d[n]]);("function"!=typeof d||(t=d(a,e,i)))&&(d||(t=[e]),t.unshift(s||i),!1===o.apply(r||s||i,t)&&e.stopImmediatePropagation())}f("<target>.on"+a+".add(..)"),i.on(a,t,e);var n={original:o,patched:t};return c.push(n),t},this.addToTop=function(e,t){this.add(e,t,!0)},this.remove=function(n){return c.forEach(function(e,t){if(e.original===n)return c.splice(t,1),i.off(a,e.patched)}),i.off(a,n)},this.dispatch=function(){return i.fire(a),!0}):this.add=this.addToTop=this.remove=this.dispatch=l}function n(s){function e(e,t){u.each(e.split(" "),function(e){s["on"+e]=new i(s,e,t)})}function n(e,t,n){return[t.level,n]}function o(n){return function(e,t){if(!t.selection&&!n||t.selection==n)return[t]}}if(!s.controlManager){s.controlManager={buttons:{},setDisabled:function(e,t){f("controlManager.setDisabled(..)"),this.buttons[e]&&this.buttons[e].disabled(t)},setActive:function(e,t){f("controlManager.setActive(..)"),this.buttons[e]&&this.buttons[e].active(t)},onAdd:new i,onPostRender:new i,add:function(e){return e},createButton:r,createColorSplitButton:r,createControl:r,createDropMenu:r,createListBox:r,createMenuButton:r,createSeparator:r,createSplitButton:r,createToolbar:r,createToolbarGroup:r,destroy:l,get:l,setControlType:r},e("PreInit BeforeRenderUI PostRender Load Init Remove Activate Deactivate","editor"),e("Click MouseUp MouseDown DblClick KeyDown KeyUp KeyPress ContextMenu Paste Submit Reset"),e("BeforeExecCommand ExecCommand","command ui value args"),e("PreProcess PostProcess LoadContent SaveContent Change"),e("BeforeSetContent BeforeGetContent SetContent GetContent",o(!1)),e("SetProgressState","state time"),e("VisualAid","element hasVisual"),e("Undo Redo",n),e("NodeChange",function(e,t){return[s.controlManager,t.element,s.selection.isCollapsed(),t]});var c=s.addButton;s.addButton=function(e,t){var n,o,r,i;function a(){if(s.controlManager.buttons[e]=this,n)return n.apply(this,arguments)}for(var d in t)"onpostrender"===d.toLowerCase()&&(n=t[d],t.onPostRender=a);return n||(t.onPostRender=a),t.title&&(t.title=(o=t.title,r=[s.settings.language||"en",o].join("."),i=u.i18n.translate(r),r!==i?i:u.i18n.translate(o))),c.call(this,e,t)},s.on("init",function(){var e=s.undoManager,t=s.selection;e.onUndo=new i(s,"Undo",n,null,e),e.onRedo=new i(s,"Redo",n,null,e),e.onBeforeAdd=new i(s,"BeforeAddUndo",null,e),e.onAdd=new i(s,"AddUndo",null,e),t.onBeforeGetContent=new i(s,"BeforeGetContent",o(!0),t),t.onGetContent=new i(s,"GetContent",o(!0),t),t.onBeforeSetContent=new i(s,"BeforeSetContent",o(!0),t),t.onSetContent=new i(s,"SetContent",o(!0),t)}),s.on("BeforeRenderUI",function(){var e=s.windowManager;e.onOpen=new i,e.onClose=new i,e.createInstance=function(e,t,n,o,r,i){return f("windowManager.createInstance(..)"),new(u.resolve(e))(t,n,o,r,i)}})}function r(){var t={};function n(){return r()}return f("editor.controlManager.*"),u.each("add addMenu addSeparator collapse createMenu destroy displayColor expand focus getLength hasMenus hideMenu isActive isCollapsed isDisabled isRendered isSelected mark postRender remove removeAll renderHTML renderMenu renderNode renderTo select selectByIndex setActive setAriaProperty setColor setDisabled setSelected setState showMenu update".split(" "),function(e){t[e]=n}),t}}u.util.Dispatcher=i,u.onBeforeUnload=new i(u,"BeforeUnload"),u.onAddEditor=new i(u,"AddEditor","editor"),u.onRemoveEditor=new i(u,"RemoveEditor","editor"),u.util.Cookie={get:l,getHash:l,remove:l,set:l,setHash:l},u.on("SetupEditor",function(e){n(e.editor)}),u.PluginManager.add("compat3x",n),u.addI18n=function(n,e){var r=u.util.I18n,t=u.each;"string"!=typeof n||-1!==n.indexOf(".")?u.is(n,"string")?t(e,function(e,t){r.data[n+"."+t]=e}):t(n,function(e,o){t(e,function(e,n){t(e,function(e,t){"common"===n?r.data[o+"."+t]=e:r.data[o+"."+n+"."+t]=e})})}):r.add(n,e)}}(tinymce);
|
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
* Popup.js
|
||||
* tinymce_mce_popup.js
|
||||
*
|
||||
* Copyright, Moxiecode Systems AB
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
@@ -24,7 +24,7 @@ var tinyMCEPopup = {
|
||||
*
|
||||
* @method init
|
||||
*/
|
||||
init: function() {
|
||||
init: function () {
|
||||
var self = this, parentWin, settings, uiWindow;
|
||||
|
||||
// Find window & API
|
||||
@@ -83,8 +83,8 @@ var tinyMCEPopup = {
|
||||
* tinyMCEPopup.onInit.add(SomeObject.init, SomeObject);
|
||||
*/
|
||||
self.onInit = {
|
||||
add: function(func, scope) {
|
||||
self.listeners.push({func : func, scope : scope});
|
||||
add: function (func, scope) {
|
||||
self.listeners.push({ func: func, scope: scope });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -98,7 +98,7 @@ var tinyMCEPopup = {
|
||||
* @method getWin
|
||||
* @return {Window} Reference to the parent window that opened the dialog.
|
||||
*/
|
||||
getWin: function() {
|
||||
getWin: function () {
|
||||
// Added frameElement check to fix bug: #2817583
|
||||
return (!window.frameElement && window.dialogArguments) || opener || parent || top;
|
||||
},
|
||||
@@ -107,11 +107,11 @@ var tinyMCEPopup = {
|
||||
* Returns a window argument/parameter by name.
|
||||
*
|
||||
* @method getWindowArg
|
||||
* @param {String} name Name of the window argument to retrive.
|
||||
* @param {String} name Name of the window argument to retrieve.
|
||||
* @param {String} defaultValue Optional default value to return.
|
||||
* @return {String} Argument value or default value if it wasn't found.
|
||||
*/
|
||||
getWindowArg : function(name, defaultValue) {
|
||||
getWindowArg: function (name, defaultValue) {
|
||||
var value = this.params[name];
|
||||
|
||||
return tinymce.is(value) ? value : defaultValue;
|
||||
@@ -121,11 +121,11 @@ var tinyMCEPopup = {
|
||||
* Returns a editor parameter/config option value.
|
||||
*
|
||||
* @method getParam
|
||||
* @param {String} name Name of the editor config option to retrive.
|
||||
* @param {String} name Name of the editor config option to retrieve.
|
||||
* @param {String} defaultValue Optional default value to return.
|
||||
* @return {String} Parameter value or default value if it wasn't found.
|
||||
*/
|
||||
getParam : function(name, defaultValue) {
|
||||
getParam: function (name, defaultValue) {
|
||||
return this.editor.getParam(name, defaultValue);
|
||||
},
|
||||
|
||||
@@ -137,7 +137,7 @@ var tinyMCEPopup = {
|
||||
* @param {String} defaultValue Optional default value to return.
|
||||
* @return {String} Language value for the item like "my string" or the default value if it wasn't found.
|
||||
*/
|
||||
getLang : function(name, defaultValue) {
|
||||
getLang: function (name, defaultValue) {
|
||||
return this.editor.getLang(name, defaultValue);
|
||||
},
|
||||
|
||||
@@ -150,7 +150,7 @@ var tinyMCEPopup = {
|
||||
* @param {Object} val Optional value to pass with the comman like an URL.
|
||||
* @param {Object} a Optional arguments object.
|
||||
*/
|
||||
execCommand : function(cmd, ui, val, args) {
|
||||
execCommand: function (cmd, ui, val, args) {
|
||||
args = args || {};
|
||||
args.skip_focus = 1;
|
||||
|
||||
@@ -164,7 +164,7 @@ var tinyMCEPopup = {
|
||||
*
|
||||
* @method resizeToInnerSize
|
||||
*/
|
||||
resizeToInnerSize : function() {
|
||||
resizeToInnerSize: function () {
|
||||
/*var self = this;
|
||||
|
||||
// Detach it to workaround a Chrome specific bug
|
||||
@@ -187,8 +187,8 @@ var tinyMCEPopup = {
|
||||
* @method executeOnLoad
|
||||
* @param {String} evil String to evalutate on init.
|
||||
*/
|
||||
executeOnLoad : function(evil) {
|
||||
this.onInit.add(function() {
|
||||
executeOnLoad: function (evil) {
|
||||
this.onInit.add(function () {
|
||||
eval(evil);
|
||||
});
|
||||
},
|
||||
@@ -199,7 +199,7 @@ var tinyMCEPopup = {
|
||||
*
|
||||
* @method storeSelection
|
||||
*/
|
||||
storeSelection : function() {
|
||||
storeSelection: function () {
|
||||
this.editor.windowManager.bookmark = tinyMCEPopup.editor.selection.getBookmark(1);
|
||||
},
|
||||
|
||||
@@ -209,7 +209,7 @@ var tinyMCEPopup = {
|
||||
*
|
||||
* @method restoreSelection
|
||||
*/
|
||||
restoreSelection : function() {
|
||||
restoreSelection: function () {
|
||||
var self = tinyMCEPopup;
|
||||
|
||||
if (!self.isWindow && tinymce.isIE) {
|
||||
@@ -223,7 +223,7 @@ var tinyMCEPopup = {
|
||||
*
|
||||
* @method requireLangPack
|
||||
*/
|
||||
requireLangPack : function() {
|
||||
requireLangPack: function () {
|
||||
var self = this, url = self.getWindowArg('plugin_url') || self.getWindowArg('theme_url'), settings = self.editor.settings, lang;
|
||||
|
||||
if (settings.language !== false) {
|
||||
@@ -248,7 +248,7 @@ var tinyMCEPopup = {
|
||||
* @param {DOMEvent} e DOM event object.
|
||||
* @param {string} element_id Element id to be filled with the color value from the picker.
|
||||
*/
|
||||
pickColor : function(e, element_id) {
|
||||
pickColor: function (e, element_id) {
|
||||
var el = document.getElementById(element_id), colorPickerCallback = this.editor.settings.color_picker_callback;
|
||||
if (colorPickerCallback) {
|
||||
colorPickerCallback.call(
|
||||
@@ -275,7 +275,7 @@ var tinyMCEPopup = {
|
||||
* @param {string} type Type of browser to open image/file/flash.
|
||||
* @param {string} option Option name to get the file_broswer_callback function name from.
|
||||
*/
|
||||
openBrowser : function(element_id, type) {
|
||||
openBrowser: function (element_id, type) {
|
||||
tinyMCEPopup.restoreSelection();
|
||||
this.editor.execCallback('file_browser_callback', element_id, document.getElementById(element_id).value, type, window);
|
||||
},
|
||||
@@ -289,7 +289,7 @@ var tinyMCEPopup = {
|
||||
* @param {function} cb Callback function to be executed after the user has selected ok or cancel.
|
||||
* @param {Object} s Optional scope to execute the callback in.
|
||||
*/
|
||||
confirm : function(t, cb, s) {
|
||||
confirm: function (t, cb, s) {
|
||||
this.editor.windowManager.confirm(t, cb, s, window);
|
||||
},
|
||||
|
||||
@@ -302,7 +302,7 @@ var tinyMCEPopup = {
|
||||
* @param {function} cb Callback function to be executed after the user has selected ok.
|
||||
* @param {Object} s Optional scope to execute the callback in.
|
||||
*/
|
||||
alert : function(tx, cb, s) {
|
||||
alert: function (tx, cb, s) {
|
||||
this.editor.windowManager.alert(tx, cb, s, window);
|
||||
},
|
||||
|
||||
@@ -311,7 +311,7 @@ var tinyMCEPopup = {
|
||||
*
|
||||
* @method close
|
||||
*/
|
||||
close : function() {
|
||||
close: function () {
|
||||
var t = this;
|
||||
|
||||
// To avoid domain relaxing issue in Opera
|
||||
@@ -329,7 +329,7 @@ var tinyMCEPopup = {
|
||||
|
||||
// Internal functions
|
||||
|
||||
_restoreSelection : function() {
|
||||
_restoreSelection: function () {
|
||||
var e = window.event.srcElement;
|
||||
|
||||
if (e.nodeName == 'INPUT' && (e.type == 'submit' || e.type == 'button')) {
|
||||
@@ -337,7 +337,7 @@ var tinyMCEPopup = {
|
||||
}
|
||||
},
|
||||
|
||||
/* _restoreSelection : function() {
|
||||
/* _restoreSelection : function() {
|
||||
var e = window.event.srcElement;
|
||||
|
||||
// If user focus a non text input or textarea
|
||||
@@ -345,7 +345,7 @@ var tinyMCEPopup = {
|
||||
tinyMCEPopup.restoreSelection();
|
||||
},*/
|
||||
|
||||
_onDOMLoaded : function() {
|
||||
_onDOMLoaded: function () {
|
||||
var t = tinyMCEPopup, ti = document.title, h, nv;
|
||||
|
||||
// Translate page
|
||||
@@ -359,7 +359,7 @@ var tinyMCEPopup = {
|
||||
"browse": "Browse"
|
||||
};
|
||||
|
||||
var langCode = tinymce.settings.language || 'en';
|
||||
var langCode = (tinymce.settings ? tinymce.settings : t.editor.settings).language || 'en';
|
||||
for (var key in map) {
|
||||
tinymce.i18n.data[langCode + "." + key] = tinymce.i18n.translate(map[key]);
|
||||
}
|
||||
@@ -371,7 +371,7 @@ var tinyMCEPopup = {
|
||||
h = h.replace(/ (value|title|alt)=([^"][^\s>]+)/gi, ' $1="$2"');
|
||||
}
|
||||
|
||||
document.dir = t.editor.getParam('directionality','');
|
||||
document.dir = t.editor.getParam('directionality', '');
|
||||
|
||||
if ((nv = t.editor.translate(h)) && nv != h) {
|
||||
document.body.innerHTML = nv;
|
||||
@@ -394,7 +394,7 @@ var tinyMCEPopup = {
|
||||
document.attachEvent('onmouseup', tinyMCEPopup._restoreSelection);
|
||||
|
||||
// Add base target element for it since it would fail with modal dialogs
|
||||
t.dom.add(t.dom.select('head')[0], 'base', {target: '_self'});
|
||||
t.dom.add(t.dom.select('head')[0], 'base', { target: '_self' });
|
||||
} else {
|
||||
document.addEventListener('mouseup', tinyMCEPopup._restoreSelection, false);
|
||||
}
|
||||
@@ -411,19 +411,19 @@ var tinyMCEPopup = {
|
||||
}
|
||||
|
||||
if (!tinymce.isIE && !t.isWindow) {
|
||||
t.dom.bind(document, 'focus', function() {
|
||||
t.dom.bind(document, 'focus', function () {
|
||||
t.editor.windowManager.focus(t.id);
|
||||
});
|
||||
}
|
||||
|
||||
// Patch for accessibility
|
||||
tinymce.each(t.dom.select('select'), function(e) {
|
||||
tinymce.each(t.dom.select('select'), function (e) {
|
||||
e.onkeydown = tinyMCEPopup._accessHandler;
|
||||
});
|
||||
|
||||
// Call onInit
|
||||
// Init must be called before focus so the selection won't get lost by the focus call
|
||||
tinymce.each(t.listeners, function(o) {
|
||||
tinymce.each(t.listeners, function (o) {
|
||||
o.func.call(o.scope, t.editor);
|
||||
});
|
||||
|
||||
@@ -432,8 +432,8 @@ var tinyMCEPopup = {
|
||||
window.focus();
|
||||
|
||||
// Focus element with mceFocus class
|
||||
tinymce.each(document.forms, function(f) {
|
||||
tinymce.each(f.elements, function(e) {
|
||||
tinymce.each(document.forms, function (f) {
|
||||
tinymce.each(f.elements, function (e) {
|
||||
if (t.dom.hasClass(e, 'mceFocus') && !e.disabled) {
|
||||
e.focus();
|
||||
return false; // Break loop
|
||||
@@ -451,7 +451,7 @@ var tinyMCEPopup = {
|
||||
}
|
||||
},
|
||||
|
||||
_accessHandler : function(e) {
|
||||
_accessHandler: function (e) {
|
||||
e = e || window.event;
|
||||
|
||||
if (e.keyCode == 13 || e.keyCode == 32) {
|
||||
@@ -465,7 +465,7 @@ var tinyMCEPopup = {
|
||||
}
|
||||
},
|
||||
|
||||
_closeWinKeyHandler : function(e) {
|
||||
_closeWinKeyHandler: function (e) {
|
||||
e = e || window.event;
|
||||
|
||||
if (e.keyCode == 27) {
|
||||
@@ -473,8 +473,8 @@ var tinyMCEPopup = {
|
||||
}
|
||||
},
|
||||
|
||||
_eventProxy: function(id) {
|
||||
return function(evt) {
|
||||
_eventProxy: function (id) {
|
||||
return function (evt) {
|
||||
tinyMCEPopup.dom.events.callNativeHandler(id, evt);
|
||||
};
|
||||
}
|
||||
@@ -482,18 +482,18 @@ var tinyMCEPopup = {
|
||||
|
||||
tinyMCEPopup.init();
|
||||
|
||||
tinymce.util.Dispatcher = function(scope) {
|
||||
tinymce.util.Dispatcher = function (scope) {
|
||||
this.scope = scope || this;
|
||||
this.listeners = [];
|
||||
|
||||
this.add = function(callback, scope) {
|
||||
this.listeners.push({cb : callback, scope : scope || this.scope});
|
||||
this.add = function (callback, scope) {
|
||||
this.listeners.push({ cb: callback, scope: scope || this.scope });
|
||||
|
||||
return callback;
|
||||
};
|
||||
|
||||
this.addToTop = function(callback, scope) {
|
||||
var self = this, listener = {cb : callback, scope : scope || self.scope};
|
||||
this.addToTop = function (callback, scope) {
|
||||
var self = this, listener = { cb: callback, scope: scope || self.scope };
|
||||
|
||||
// Create new listeners if addToTop is executed in a dispatch loop
|
||||
if (self.inDispatch) {
|
||||
@@ -505,10 +505,10 @@ tinymce.util.Dispatcher = function(scope) {
|
||||
return callback;
|
||||
};
|
||||
|
||||
this.remove = function(callback) {
|
||||
this.remove = function (callback) {
|
||||
var listeners = this.listeners, output = null;
|
||||
|
||||
tinymce.each(listeners, function(listener, i) {
|
||||
tinymce.each(listeners, function (listener, i) {
|
||||
if (callback == listener.cb) {
|
||||
output = listener;
|
||||
listeners.splice(i, 1);
|
||||
@@ -519,7 +519,7 @@ tinymce.util.Dispatcher = function(scope) {
|
||||
return output;
|
||||
};
|
||||
|
||||
this.dispatch = function() {
|
||||
this.dispatch = function () {
|
||||
var self = this, returnValue, args = arguments, i, listeners = self.listeners, listener;
|
||||
|
||||
self.inDispatch = true;
|
||||
|
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
* editable_selects.js
|
||||
*
|
||||
* Copyright, Moxiecode Systems AB
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
@@ -11,10 +11,10 @@
|
||||
var TinyMCE_EditableSelects = {
|
||||
editSelectElm : null,
|
||||
|
||||
init : function() {
|
||||
init : function () {
|
||||
var nl = document.getElementsByTagName("select"), i, d = document, o;
|
||||
|
||||
for (i=0; i<nl.length; i++) {
|
||||
for (i = 0; i < nl.length; i++) {
|
||||
if (nl[i].className.indexOf('mceEditableSelect') != -1) {
|
||||
o = new Option(tinyMCEPopup.editor.translate('value'), '__mce_add_custom__');
|
||||
|
||||
@@ -26,7 +26,7 @@ var TinyMCE_EditableSelects = {
|
||||
}
|
||||
},
|
||||
|
||||
onChangeEditableSelect : function(e) {
|
||||
onChangeEditableSelect : function (e) {
|
||||
var d = document, ne, se = window.event ? window.event.srcElement : e.target;
|
||||
|
||||
if (se.options[se.selectedIndex].value == '__mce_add_custom__') {
|
||||
@@ -45,15 +45,16 @@ var TinyMCE_EditableSelects = {
|
||||
}
|
||||
},
|
||||
|
||||
onBlurEditableSelectInput : function() {
|
||||
onBlurEditableSelectInput : function () {
|
||||
var se = TinyMCE_EditableSelects.editSelectElm;
|
||||
|
||||
if (se) {
|
||||
if (se.previousSibling.value != '') {
|
||||
addSelectValue(document.forms[0], se.id, se.previousSibling.value, se.previousSibling.value);
|
||||
selectByValue(document.forms[0], se.id, se.previousSibling.value);
|
||||
} else
|
||||
} else {
|
||||
selectByValue(document.forms[0], se.id, '');
|
||||
}
|
||||
|
||||
se.style.display = 'inline';
|
||||
se.parentNode.removeChild(se.previousSibling);
|
||||
@@ -61,10 +62,11 @@ var TinyMCE_EditableSelects = {
|
||||
}
|
||||
},
|
||||
|
||||
onKeyDown : function(e) {
|
||||
onKeyDown : function (e) {
|
||||
e = e || window.event;
|
||||
|
||||
if (e.keyCode == 13)
|
||||
if (e.keyCode == 13) {
|
||||
TinyMCE_EditableSelects.onBlurEditableSelectInput();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
* form_utils.js
|
||||
*
|
||||
* Copyright, Moxiecode Systems AB
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
@@ -17,7 +17,7 @@ function getColorPickerHTML(id, target_form_element) {
|
||||
label.id = label.id || dom.uniqueId();
|
||||
}
|
||||
|
||||
h += '<a role="button" aria-labelledby="' + id + '_label" id="' + id + '_link" href="javascript:;" onclick="tinyMCEPopup.pickColor(event,\'' + target_form_element +'\');" onmousedown="return false;" class="pickcolor">';
|
||||
h += '<a role="button" aria-labelledby="' + id + '_label" id="' + id + '_link" href="javascript:;" onclick="tinyMCEPopup.pickColor(event,\'' + target_form_element + '\');" onmousedown="return false;" class="pickcolor">';
|
||||
h += '<span id="' + id + '" title="' + tinyMCEPopup.getLang('browse') + '"> <span id="' + id + '_label" class="mceVoiceLabel mceIconOnly" style="display:none;">' + tinyMCEPopup.getLang('browse') + '</span></span></a>';
|
||||
|
||||
return h;
|
||||
@@ -37,8 +37,9 @@ function setBrowserDisabled(id, state) {
|
||||
lnk.removeAttribute("href");
|
||||
tinyMCEPopup.dom.addClass(img, 'disabled');
|
||||
} else {
|
||||
if (lnk.getAttribute("realhref"))
|
||||
if (lnk.getAttribute("realhref")) {
|
||||
lnk.setAttribute("href", lnk.getAttribute("realhref"));
|
||||
}
|
||||
|
||||
tinyMCEPopup.dom.removeClass(img, 'disabled');
|
||||
}
|
||||
@@ -50,8 +51,9 @@ function getBrowserHTML(id, target_form_element, type, prefix) {
|
||||
|
||||
cb = tinyMCEPopup.getParam(option, tinyMCEPopup.getParam("file_browser_callback"));
|
||||
|
||||
if (!cb)
|
||||
if (!cb) {
|
||||
return "";
|
||||
}
|
||||
|
||||
html = "";
|
||||
html += '<a id="' + id + '_link" href="javascript:openBrowser(\'' + id + '\',\'' + target_form_element + '\', \'' + type + '\',\'' + option + '\');" onmousedown="return false;" class="browse">';
|
||||
@@ -63,29 +65,33 @@ function getBrowserHTML(id, target_form_element, type, prefix) {
|
||||
function openBrowser(img_id, target_form_element, type, option) {
|
||||
var img = document.getElementById(img_id);
|
||||
|
||||
if (img.className != "mceButtonDisabled")
|
||||
if (img.className != "mceButtonDisabled") {
|
||||
tinyMCEPopup.openBrowser(target_form_element, type, option);
|
||||
}
|
||||
}
|
||||
|
||||
function selectByValue(form_obj, field_name, value, add_custom, ignore_case) {
|
||||
if (!form_obj || !form_obj.elements[field_name])
|
||||
if (!form_obj || !form_obj.elements[field_name]) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!value)
|
||||
if (!value) {
|
||||
value = "";
|
||||
}
|
||||
|
||||
var sel = form_obj.elements[field_name];
|
||||
|
||||
var found = false;
|
||||
for (var i=0; i<sel.options.length; i++) {
|
||||
for (var i = 0; i < sel.options.length; i++) {
|
||||
var option = sel.options[i];
|
||||
|
||||
if (option.value == value || (ignore_case && option.value.toLowerCase() == value.toLowerCase())) {
|
||||
option.selected = true;
|
||||
found = true;
|
||||
} else
|
||||
} else {
|
||||
option.selected = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found && add_custom && value != '') {
|
||||
var option = new Option(value, value);
|
||||
@@ -100,8 +106,9 @@ function selectByValue(form_obj, field_name, value, add_custom, ignore_case) {
|
||||
function getSelectValue(form_obj, field_name) {
|
||||
var elm = form_obj.elements[field_name];
|
||||
|
||||
if (elm == null || elm.options == null || elm.selectedIndex === -1)
|
||||
if (elm == null || elm.options == null || elm.selectedIndex === -1) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return elm.options[elm.selectedIndex].value;
|
||||
}
|
||||
@@ -121,7 +128,7 @@ function addClassesToList(list_id, specific_option) {
|
||||
if (styles) {
|
||||
var stylesAr = styles.split(';');
|
||||
|
||||
for (var i=0; i<stylesAr.length; i++) {
|
||||
for (var i = 0; i < stylesAr.length; i++) {
|
||||
if (stylesAr != "") {
|
||||
var key, value;
|
||||
|
||||
@@ -184,15 +191,18 @@ function trimSize(size) {
|
||||
function getCSSSize(size) {
|
||||
size = trimSize(size);
|
||||
|
||||
if (size == "")
|
||||
if (size == "") {
|
||||
return "";
|
||||
}
|
||||
|
||||
// Add px
|
||||
if (/^[0-9]+$/.test(size))
|
||||
if (/^[0-9]+$/.test(size)) {
|
||||
size += 'px';
|
||||
}
|
||||
// Sanity check, IE doesn't like broken values
|
||||
else if (!(/^[0-9\.]+(px|%|in|cm|mm|em|ex|pt|pc)$/i.test(size)))
|
||||
else if (!(/^[0-9\.]+(px|%|in|cm|mm|em|ex|pt|pc)$/i.test(size))) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
@@ -200,11 +210,13 @@ function getCSSSize(size) {
|
||||
function getStyle(elm, attrib, style) {
|
||||
var val = tinyMCEPopup.dom.getAttrib(elm, attrib);
|
||||
|
||||
if (val != '')
|
||||
if (val != '') {
|
||||
return '' + val;
|
||||
}
|
||||
|
||||
if (typeof(style) == 'undefined')
|
||||
if (typeof (style) == 'undefined') {
|
||||
style = attrib;
|
||||
}
|
||||
|
||||
return tinyMCEPopup.dom.getStyle(elm, style);
|
||||
}
|
||||
|
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
* mctabs.js
|
||||
*
|
||||
* Copyright, Moxiecode Systems AB
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
@@ -13,33 +13,34 @@
|
||||
function MCTabs() {
|
||||
this.settings = [];
|
||||
this.onChange = tinyMCEPopup.editor.windowManager.createInstance('tinymce.util.Dispatcher');
|
||||
};
|
||||
}
|
||||
|
||||
MCTabs.prototype.init = function(settings) {
|
||||
MCTabs.prototype.init = function (settings) {
|
||||
this.settings = settings;
|
||||
};
|
||||
|
||||
MCTabs.prototype.getParam = function(name, default_value) {
|
||||
MCTabs.prototype.getParam = function (name, default_value) {
|
||||
var value = null;
|
||||
|
||||
value = (typeof(this.settings[name]) == "undefined") ? default_value : this.settings[name];
|
||||
value = (typeof (this.settings[name]) == "undefined") ? default_value : this.settings[name];
|
||||
|
||||
// Fix bool values
|
||||
if (value == "true" || value == "false")
|
||||
if (value == "true" || value == "false") {
|
||||
return (value == "true");
|
||||
}
|
||||
|
||||
return value;
|
||||
};
|
||||
|
||||
MCTabs.prototype.showTab =function(tab){
|
||||
MCTabs.prototype.showTab = function (tab) {
|
||||
tab.className = 'current';
|
||||
tab.setAttribute("aria-selected", true);
|
||||
tab.setAttribute("aria-expanded", true);
|
||||
tab.tabIndex = 0;
|
||||
};
|
||||
|
||||
MCTabs.prototype.hideTab =function(tab){
|
||||
var t=this;
|
||||
MCTabs.prototype.hideTab = function (tab) {
|
||||
var t = this;
|
||||
|
||||
tab.className = '';
|
||||
tab.setAttribute("aria-selected", false);
|
||||
@@ -47,21 +48,21 @@ MCTabs.prototype.hideTab =function(tab){
|
||||
tab.tabIndex = -1;
|
||||
};
|
||||
|
||||
MCTabs.prototype.showPanel = function(panel) {
|
||||
MCTabs.prototype.showPanel = function (panel) {
|
||||
panel.className = 'current';
|
||||
panel.setAttribute("aria-hidden", false);
|
||||
};
|
||||
|
||||
MCTabs.prototype.hidePanel = function(panel) {
|
||||
MCTabs.prototype.hidePanel = function (panel) {
|
||||
panel.className = 'panel';
|
||||
panel.setAttribute("aria-hidden", true);
|
||||
};
|
||||
|
||||
MCTabs.prototype.getPanelForTab = function(tabElm) {
|
||||
MCTabs.prototype.getPanelForTab = function (tabElm) {
|
||||
return tinyMCEPopup.dom.getAttrib(tabElm, "aria-controls");
|
||||
};
|
||||
|
||||
MCTabs.prototype.displayTab = function(tab_id, panel_id, avoid_focus) {
|
||||
MCTabs.prototype.displayTab = function (tab_id, panel_id, avoid_focus) {
|
||||
var panelElm, panelContainerElm, tabElm, tabContainerElm, selectionClass, nodes, i, t = this;
|
||||
|
||||
tabElm = document.getElementById(tab_id);
|
||||
@@ -70,7 +71,7 @@ MCTabs.prototype.displayTab = function(tab_id, panel_id, avoid_focus) {
|
||||
panel_id = t.getPanelForTab(tabElm);
|
||||
}
|
||||
|
||||
panelElm= document.getElementById(panel_id);
|
||||
panelElm = document.getElementById(panel_id);
|
||||
panelContainerElm = panelElm ? panelElm.parentNode : null;
|
||||
tabContainerElm = tabElm ? tabElm.parentNode : null;
|
||||
selectionClass = t.getParam('selection_class', 'current');
|
||||
@@ -94,9 +95,10 @@ MCTabs.prototype.displayTab = function(tab_id, panel_id, avoid_focus) {
|
||||
|
||||
// Hide all other panels
|
||||
for (i = 0; i < nodes.length; i++) {
|
||||
if (nodes[i].nodeName == "DIV")
|
||||
if (nodes[i].nodeName == "DIV") {
|
||||
t.hidePanel(nodes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (!avoid_focus) {
|
||||
tabElm.focus();
|
||||
@@ -107,11 +109,12 @@ MCTabs.prototype.displayTab = function(tab_id, panel_id, avoid_focus) {
|
||||
}
|
||||
};
|
||||
|
||||
MCTabs.prototype.getAnchor = function() {
|
||||
MCTabs.prototype.getAnchor = function () {
|
||||
var pos, url = document.location.href;
|
||||
|
||||
if ((pos = url.lastIndexOf('#')) != -1)
|
||||
if ((pos = url.lastIndexOf('#')) != -1) {
|
||||
return url.substring(pos + 1);
|
||||
}
|
||||
|
||||
return "";
|
||||
};
|
||||
@@ -120,35 +123,35 @@ MCTabs.prototype.getAnchor = function() {
|
||||
//Global instance
|
||||
var mcTabs = new MCTabs();
|
||||
|
||||
tinyMCEPopup.onInit.add(function() {
|
||||
tinyMCEPopup.onInit.add(function () {
|
||||
var tinymce = tinyMCEPopup.getWin().tinymce, dom = tinyMCEPopup.dom, each = tinymce.each;
|
||||
|
||||
each(dom.select('div.tabs'), function(tabContainerElm) {
|
||||
each(dom.select('div.tabs'), function (tabContainerElm) {
|
||||
//var keyNav;
|
||||
|
||||
dom.setAttrib(tabContainerElm, "role", "tablist");
|
||||
|
||||
var items = tinyMCEPopup.dom.select('li', tabContainerElm);
|
||||
var action = function(id) {
|
||||
var action = function (id) {
|
||||
mcTabs.displayTab(id, mcTabs.getPanelForTab(id));
|
||||
mcTabs.onChange.dispatch(id);
|
||||
};
|
||||
|
||||
each(items, function(item) {
|
||||
each(items, function (item) {
|
||||
dom.setAttrib(item, 'role', 'tab');
|
||||
dom.bind(item, 'click', function(evt) {
|
||||
dom.bind(item, 'click', function (evt) {
|
||||
action(item.id);
|
||||
});
|
||||
});
|
||||
|
||||
dom.bind(dom.getRoot(), 'keydown', function(evt) {
|
||||
dom.bind(dom.getRoot(), 'keydown', function (evt) {
|
||||
if (evt.keyCode === 9 && evt.ctrlKey && !evt.altKey) { // Tab
|
||||
//keyNav.moveFocus(evt.shiftKey ? -1 : 1);
|
||||
tinymce.dom.Event.cancel(evt);
|
||||
}
|
||||
});
|
||||
|
||||
each(dom.select('a', tabContainerElm), function(a) {
|
||||
each(dom.select('a', tabContainerElm), function (a) {
|
||||
dom.setAttrib(a, 'tabindex', '-1');
|
||||
});
|
||||
|
||||
@@ -160,5 +163,6 @@ tinyMCEPopup.onInit.add(function() {
|
||||
enableLeftRight: true,
|
||||
enableUpDown: true
|
||||
}, tinyMCEPopup.dom);*/
|
||||
});
|
||||
}
|
||||
);
|
||||
});
|
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
* validate.js
|
||||
*
|
||||
* Copyright, Moxiecode Systems AB
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
@@ -23,36 +23,39 @@
|
||||
*/
|
||||
|
||||
var Validator = {
|
||||
isEmail : function(s) {
|
||||
isEmail : function (s) {
|
||||
return this.test(s, '^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+@[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$');
|
||||
},
|
||||
|
||||
isAbsUrl : function(s) {
|
||||
isAbsUrl : function (s) {
|
||||
return this.test(s, '^(news|telnet|nttp|file|http|ftp|https)://[-A-Za-z0-9\\.]+\\/?.*$');
|
||||
},
|
||||
|
||||
isSize : function(s) {
|
||||
isSize : function (s) {
|
||||
return this.test(s, '^[0-9.]+(%|in|cm|mm|em|ex|pt|pc|px)?$');
|
||||
},
|
||||
|
||||
isId : function(s) {
|
||||
isId : function (s) {
|
||||
return this.test(s, '^[A-Za-z_]([A-Za-z0-9_])*$');
|
||||
},
|
||||
|
||||
isEmpty : function(s) {
|
||||
isEmpty : function (s) {
|
||||
var nl, i;
|
||||
|
||||
if (s.nodeName == 'SELECT' && s.selectedIndex < 1)
|
||||
if (s.nodeName == 'SELECT' && s.selectedIndex < 1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (s.type == 'checkbox' && !s.checked)
|
||||
if (s.type == 'checkbox' && !s.checked) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (s.type == 'radio') {
|
||||
for (i=0, nl = s.form.elements; i<nl.length; i++) {
|
||||
if (nl[i].type == "radio" && nl[i].name == s.name && nl[i].checked)
|
||||
for (i = 0, nl = s.form.elements; i < nl.length; i++) {
|
||||
if (nl[i].type == "radio" && nl[i].name == s.name && nl[i].checked) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -60,11 +63,11 @@ var Validator = {
|
||||
return new RegExp('^\\s*$').test(s.nodeType == 1 ? s.value : s);
|
||||
},
|
||||
|
||||
isNumber : function(s, d) {
|
||||
isNumber : function (s, d) {
|
||||
return !isNaN(s.nodeType == 1 ? s.value : s) && (!d || !this.test(s, '^-?[0-9]*\\.[0-9]*$'));
|
||||
},
|
||||
|
||||
test : function(s, p) {
|
||||
test : function (s, p) {
|
||||
s = s.nodeType == 1 ? s.value : s;
|
||||
|
||||
return s == '' || new RegExp(p).test(s);
|
||||
@@ -85,18 +88,19 @@ var AutoValidator = {
|
||||
max_cls : 'max'
|
||||
},
|
||||
|
||||
init : function(s) {
|
||||
init : function (s) {
|
||||
var n;
|
||||
|
||||
for (n in s)
|
||||
for (n in s) {
|
||||
this.settings[n] = s[n];
|
||||
}
|
||||
},
|
||||
|
||||
validate : function(f) {
|
||||
validate : function (f) {
|
||||
var i, nl, s = this.settings, c = 0;
|
||||
|
||||
nl = this.tags(f, 'label');
|
||||
for (i=0; i<nl.length; i++) {
|
||||
for (i = 0; i < nl.length; i++) {
|
||||
this.removeClass(nl[i], s.invalid_cls);
|
||||
nl[i].setAttribute('aria-invalid', false);
|
||||
}
|
||||
@@ -108,14 +112,14 @@ var AutoValidator = {
|
||||
return c == 3;
|
||||
},
|
||||
|
||||
invalidate : function(n) {
|
||||
invalidate : function (n) {
|
||||
this.mark(n.form, n);
|
||||
},
|
||||
|
||||
getErrorMessages : function(f) {
|
||||
getErrorMessages : function (f) {
|
||||
var nl, i, s = this.settings, field, msg, values, messages = [], ed = tinyMCEPopup.editor;
|
||||
nl = this.tags(f, "label");
|
||||
for (i=0; i<nl.length; i++) {
|
||||
for (i = 0; i < nl.length; i++) {
|
||||
if (this.hasClass(nl[i], s.invalid_cls)) {
|
||||
field = document.getElementById(nl[i].getAttribute("for"));
|
||||
values = { field: nl[i].textContent };
|
||||
@@ -130,7 +134,7 @@ var AutoValidator = {
|
||||
message = ed.getLang('invalid_data');
|
||||
}
|
||||
|
||||
message = message.replace(/{\#([^}]+)\}/g, function(a, b) {
|
||||
message = message.replace(/{\#([^}]+)\}/g, function (a, b) {
|
||||
return values[b] || '{#' + b + '}';
|
||||
});
|
||||
messages.push(message);
|
||||
@@ -139,96 +143,106 @@ var AutoValidator = {
|
||||
return messages;
|
||||
},
|
||||
|
||||
reset : function(e) {
|
||||
reset : function (e) {
|
||||
var t = ['label', 'input', 'select', 'textarea'];
|
||||
var i, j, nl, s = this.settings;
|
||||
|
||||
if (e == null)
|
||||
if (e == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (i=0; i<t.length; i++) {
|
||||
for (i = 0; i < t.length; i++) {
|
||||
nl = this.tags(e.form ? e.form : e, t[i]);
|
||||
for (j=0; j<nl.length; j++) {
|
||||
for (j = 0; j < nl.length; j++) {
|
||||
this.removeClass(nl[j], s.invalid_cls);
|
||||
nl[j].setAttribute('aria-invalid', false);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
validateElms : function(f, e) {
|
||||
validateElms : function (f, e) {
|
||||
var nl, i, n, s = this.settings, st = true, va = Validator, v;
|
||||
|
||||
nl = this.tags(f, e);
|
||||
for (i=0; i<nl.length; i++) {
|
||||
for (i = 0; i < nl.length; i++) {
|
||||
n = nl[i];
|
||||
|
||||
this.removeClass(n, s.invalid_cls);
|
||||
|
||||
if (this.hasClass(n, s.required_cls) && va.isEmpty(n))
|
||||
if (this.hasClass(n, s.required_cls) && va.isEmpty(n)) {
|
||||
st = this.mark(f, n);
|
||||
}
|
||||
|
||||
if (this.hasClass(n, s.number_cls) && !va.isNumber(n))
|
||||
if (this.hasClass(n, s.number_cls) && !va.isNumber(n)) {
|
||||
st = this.mark(f, n);
|
||||
}
|
||||
|
||||
if (this.hasClass(n, s.int_cls) && !va.isNumber(n, true))
|
||||
if (this.hasClass(n, s.int_cls) && !va.isNumber(n, true)) {
|
||||
st = this.mark(f, n);
|
||||
}
|
||||
|
||||
if (this.hasClass(n, s.url_cls) && !va.isAbsUrl(n))
|
||||
if (this.hasClass(n, s.url_cls) && !va.isAbsUrl(n)) {
|
||||
st = this.mark(f, n);
|
||||
}
|
||||
|
||||
if (this.hasClass(n, s.email_cls) && !va.isEmail(n))
|
||||
if (this.hasClass(n, s.email_cls) && !va.isEmail(n)) {
|
||||
st = this.mark(f, n);
|
||||
}
|
||||
|
||||
if (this.hasClass(n, s.size_cls) && !va.isSize(n))
|
||||
if (this.hasClass(n, s.size_cls) && !va.isSize(n)) {
|
||||
st = this.mark(f, n);
|
||||
}
|
||||
|
||||
if (this.hasClass(n, s.id_cls) && !va.isId(n))
|
||||
if (this.hasClass(n, s.id_cls) && !va.isId(n)) {
|
||||
st = this.mark(f, n);
|
||||
}
|
||||
|
||||
if (this.hasClass(n, s.min_cls, true)) {
|
||||
v = this.getNum(n, s.min_cls);
|
||||
|
||||
if (isNaN(v) || parseInt(n.value) < parseInt(v))
|
||||
if (isNaN(v) || parseInt(n.value) < parseInt(v)) {
|
||||
st = this.mark(f, n);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.hasClass(n, s.max_cls, true)) {
|
||||
v = this.getNum(n, s.max_cls);
|
||||
|
||||
if (isNaN(v) || parseInt(n.value) > parseInt(v))
|
||||
if (isNaN(v) || parseInt(n.value) > parseInt(v)) {
|
||||
st = this.mark(f, n);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return st;
|
||||
},
|
||||
|
||||
hasClass : function(n, c, d) {
|
||||
hasClass : function (n, c, d) {
|
||||
return new RegExp('\\b' + c + (d ? '[0-9]+' : '') + '\\b', 'g').test(n.className);
|
||||
},
|
||||
|
||||
getNum : function(n, c) {
|
||||
getNum : function (n, c) {
|
||||
c = n.className.match(new RegExp('\\b' + c + '([0-9]+)\\b', 'g'))[0];
|
||||
c = c.replace(/[^0-9]/g, '');
|
||||
|
||||
return c;
|
||||
},
|
||||
|
||||
addClass : function(n, c, b) {
|
||||
addClass : function (n, c, b) {
|
||||
var o = this.removeClass(n, c);
|
||||
n.className = b ? c + (o != '' ? (' ' + o) : '') : (o != '' ? (o + ' ') : '') + c;
|
||||
n.className = b ? c + (o !== '' ? (' ' + o) : '') : (o !== '' ? (o + ' ') : '') + c;
|
||||
},
|
||||
|
||||
removeClass : function(n, c) {
|
||||
removeClass : function (n, c) {
|
||||
c = n.className.replace(new RegExp("(^|\\s+)" + c + "(\\s+|$)"), ' ');
|
||||
return n.className = c != ' ' ? c : '';
|
||||
return n.className = c !== ' ' ? c : '';
|
||||
},
|
||||
|
||||
tags : function(f, s) {
|
||||
tags : function (f, s) {
|
||||
return f.getElementsByTagName(s);
|
||||
},
|
||||
|
||||
mark : function(f, n) {
|
||||
mark : function (f, n) {
|
||||
var s = this.settings;
|
||||
|
||||
this.addClass(n, s.invalid_cls);
|
||||
@@ -238,14 +252,15 @@ var AutoValidator = {
|
||||
return false;
|
||||
},
|
||||
|
||||
markLabels : function(f, n, ic) {
|
||||
markLabels : function (f, n, ic) {
|
||||
var nl, i;
|
||||
|
||||
nl = this.tags(f, "label");
|
||||
for (i=0; i<nl.length; i++) {
|
||||
if (nl[i].getAttribute("for") == n.id || nl[i].htmlFor == n.id)
|
||||
for (i = 0; i < nl.length; i++) {
|
||||
if (nl[i].getAttribute("for") == n.id || nl[i].htmlFor == n.id) {
|
||||
this.addClass(nl[i], ic);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
Reference in New Issue
Block a user