From c6c8c1c6d14e16497f9d0e777edcb2b2e7ad61ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor?= Date: Thu, 10 May 2018 09:21:17 +0200 Subject: [PATCH 1/5] Update e_footer.php --- e107_plugins/tinymce4/e_footer.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/e107_plugins/tinymce4/e_footer.php b/e107_plugins/tinymce4/e_footer.php index 3c131bbd0..3ac55d28a 100644 --- a/e107_plugins/tinymce4/e_footer.php +++ b/e107_plugins/tinymce4/e_footer.php @@ -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"); @@ -180,4 +180,4 @@ if((e107::wysiwyg() === true && check_class($pref['post_html'])) || strpos(e_SEL } -?> \ No newline at end of file +?> From 301cf9bc563fbbc0b0aaea4852fb3bf1b21ea794 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor?= Date: Thu, 10 May 2018 09:24:58 +0200 Subject: [PATCH 2/5] Add files via upload --- e107_plugins/tinymce4/langs/en_GB.js | 230 +++++++++++++++++++++++++++ 1 file changed, 230 insertions(+) create mode 100644 e107_plugins/tinymce4/langs/en_GB.js diff --git a/e107_plugins/tinymce4/langs/en_GB.js b/e107_plugins/tinymce4/langs/en_GB.js new file mode 100644 index 000000000..0f388fd7b --- /dev/null +++ b/e107_plugins/tinymce4/langs/en_GB.js @@ -0,0 +1,230 @@ +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", +"Pre": "Pre", +"Align right": "Align right", +"New document": "New document", +"Blockquote": "Blockquote", +"Numbered list": "Numbered list", +"Heading 1": "Heading 1", +"Headings": "Headings", +"Increase indent": "Increase indent", +"Formats": "Formats", +"Headers": "Headers", +"Select all": "Select all", +"Header 3": "Header 3", +"Blocks": "Blocks", +"Undo": "Undo", +"Strikethrough": "Strike-through", +"Bullet list": "Bullet list", +"Header 1": "Header 1", +"Superscript": "Superscript", +"Clear formatting": "Clear formatting", +"Font Sizes": "Font Sizes", +"Subscript": "Subscript", +"Header 6": "Header 6", +"Redo": "Redo", +"Paragraph": "Paragraph", +"Ok": "Ok", +"Bold": "Bold", +"Code": "Code", +"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.", +"Underline": "Underline", +"Cancel": "Cancel", +"Justify": "Justify", +"Inline": "Inline", +"Copy": "Copy", +"Align left": "Align left", +"Visual aids": "Visual aids", +"Lower Greek": "Lower Greek", +"Square": "Square", +"Default": "Default", +"Lower Alpha": "Lower Alpha", +"Circle": "Circle", +"Disc": "Disc", +"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", +"Robots": "Robots", +"Document properties": "Document properties", +"Title": "Title", +"Keywords": "Keywords", +"Encoding": "Encoding", +"Description": "Description", +"Author": "Author", +"Fullscreen": "Full-screen", +"Horizontal line": "Horizontal line", +"Horizontal space": "Horizontal space", +"Insert\/edit image": "Insert\/edit image", +"General": "General", +"Advanced": "Advanced", +"Source": "Source", +"Border": "Border", +"Constrain proportions": "Constrain proportions", +"Vertical space": "Vertical space", +"Image description": "Image description", +"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", +"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", +"Paste as text": "Paste as text", +"Preview": "Preview", +"Print": "Print", +"Save": "Save", +"Could not find the specified string.": "Could not find the specified string.", +"Replace": "Replace", +"Next": "Next", +"Whole words": "Whole words", +"Find and replace": "Find and replace", +"Replace with": "Replace with", +"Find": "Find", +"Replace all": "Replace all", +"Match case": "Match case", +"Prev": "Prev", +"Spellcheck": "Spell-check", +"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", +"Split cell": "Split cell", +"Cell padding": "Cell padding", +"Cell spacing": "Cell spacing", +"Row type": "Row type", +"Insert table": "Insert table", +"Body": "Body", +"Caption": "Caption", +"Footer": "Footer", +"Delete row": "Delete row", +"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", +"Middle": "Middle", +"Cell type": "Cell type", +"Copy row": "Copy row", +"Row properties": "Row properties", +"Table properties": "Table properties", +"Bottom": "Bottom", +"V Align": "V Align", +"Header": "Header", +"Right": "Right", +"Insert column after": "Insert column after", +"Cols": "Cols", +"Insert row after": "Insert row after", +"Width": "Width", +"Cell properties": "Cell properties", +"Left": "Left", +"Cut row": "Cut row", +"Delete column": "Delete column", +"Center": "Centre", +"Merge cells": "Merge cells", +"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}", +"Insert": "Insert", +"File": "File", +"Edit": "Edit", +"Rich Text Area. Press ALT-F9 for menu. Press ALT-F10 for toolbar. Press ALT-0 for help": "Rich Text Area. Press ALT-F9 for menu. Press ALT-F10 for toolbar. Press ALT-0 for help", +"Tools": "Tools", +"View": "View", +"Table": "Table", +"Format": "Format" +}); \ No newline at end of file From 88de1b38c811fa84e1a986df21725a1ae3de0495 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor?= Date: Thu, 10 May 2018 09:25:59 +0200 Subject: [PATCH 3/5] Add files via upload --- .../tinymce4/plugins/bbcode/plugin.js | 212 ++++++++---------- .../tinymce4/plugins/bbcode/plugin.min.js | 2 +- 2 files changed, 96 insertions(+), 118 deletions(-) diff --git a/e107_plugins/tinymce4/plugins/bbcode/plugin.js b/e107_plugins/tinymce4/plugins/bbcode/plugin.js index b3ac04b80..10bb7cb9f 100644 --- a/e107_plugins/tinymce4/plugins/bbcode/plugin.js +++ b/e107_plugins/tinymce4/plugins/bbcode/plugin.js @@ -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); - }); + var html2bbcode = function (s) { + s = global$1.trim(s); + var rep = function (re, str) { + s = s.replace(re, str); + }; + rep(/(.*?)<\/a>/gi, '[url=$1]$2[/url]'); + rep(/(.*?)<\/font>/gi, '[code][color=$1]$2[/color][/code]'); + rep(/(.*?)<\/font>/gi, '[quote][color=$1]$2[/color][/quote]'); + rep(/(.*?)<\/font>/gi, '[code][color=$1]$2[/color][/code]'); + rep(/(.*?)<\/font>/gi, '[quote][color=$1]$2[/color][/quote]'); + rep(/(.*?)<\/span>/gi, '[color=$1]$2[/color]'); + rep(/(.*?)<\/font>/gi, '[color=$1]$2[/color]'); + rep(/(.*?)<\/span>/gi, '[size=$1]$2[/size]'); + rep(/(.*?)<\/font>/gi, '$1'); + rep(//gi, '[img]$1[/img]'); + rep(/(.*?)<\/span>/gi, '[code]$1[/code]'); + rep(/(.*?)<\/span>/gi, '[quote]$1[/quote]'); + rep(/(.*?)<\/strong>/gi, '[code][b]$1[/b][/code]'); + rep(/(.*?)<\/strong>/gi, '[quote][b]$1[/b][/quote]'); + rep(/(.*?)<\/em>/gi, '[code][i]$1[/i][/code]'); + rep(/(.*?)<\/em>/gi, '[quote][i]$1[/i][/quote]'); + rep(/(.*?)<\/u>/gi, '[code][u]$1[/u][/code]'); + rep(/(.*?)<\/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>/gi, '[u]$1[/u]'); + rep(//gi, '[u]'); + rep(/]*>/gi, '[quote]'); + rep(/<\/blockquote>/gi, '[/quote]'); + rep(/
/gi, '\n'); + rep(//gi, '\n'); + rep(/
/gi, '\n'); + rep(/

/gi, ''); + rep(/<\/p>/gi, '\n'); + rep(/ |\u00a0/gi, ' '); + rep(/"/gi, '"'); + rep(/</gi, '<'); + rep(/>/gi, '>'); + rep(/&/gi, '&'); + return s; + }; + var bbcode2html = function (s) { + s = global$1.trim(s); + var rep = function (re, str) { + s = s.replace(re, str); + }; + rep(/\n/gi, '
'); + rep(/\[b\]/gi, ''); + rep(/\[\/b\]/gi, ''); + rep(/\[i\]/gi, ''); + rep(/\[\/i\]/gi, ''); + rep(/\[u\]/gi, ''); + rep(/\[\/u\]/gi, ''); + rep(/\[url=([^\]]+)\](.*?)\[\/url\]/gi, '$2'); + rep(/\[url\](.*?)\[\/url\]/gi, '$1'); + rep(/\[img\](.*?)\[\/img\]/gi, ''); + rep(/\[color=(.*?)\](.*?)\[\/color\]/gi, '$2'); + rep(/\[code\](.*?)\[\/code\]/gi, '$1 '); + rep(/\[quote.*?\](.*?)\[\/quote\]/gi, '$1 '); + return s; + }; + var $_36akuw96jgqkwz4e = { + html2bbcode: html2bbcode, + bbcode2html: bbcode2html + }; - ed.on('postProcess', function(e) { - if (e.set) { - e.content = t['_' + dialect + '_bbcode2html'](e.content); - } + 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 () { + } - if (e.get) { - e.content = t['_' + dialect + '_html2bbcode'](e.content); - } - }); - }, + return Plugin; - getInfo: function() { - return { - longname: 'BBCode Plugin', - author: 'Moxiecode Systems AB', - authorurl: 'http://www.tinymce.com', - infourl: 'http://www.tinymce.com/wiki.php/Plugin:bbcode' - }; - }, - - // 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: to [b] - rep(/(.*?)<\/a>/gi,"[url=$1]$2[/url]"); - rep(/(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]"); - rep(/(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]"); - rep(/(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]"); - rep(/(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]"); - rep(/(.*?)<\/span>/gi,"[color=$1]$2[/color]"); - rep(/(.*?)<\/font>/gi,"[color=$1]$2[/color]"); - rep(/(.*?)<\/span>/gi,"[size=$1]$2[/size]"); - rep(/(.*?)<\/font>/gi,"$1"); - rep(//gi,"[img]$1[/img]"); - rep(/(.*?)<\/span>/gi,"[code]$1[/code]"); - rep(/(.*?)<\/span>/gi,"[quote]$1[/quote]"); - rep(/(.*?)<\/strong>/gi,"[code][b]$1[/b][/code]"); - rep(/(.*?)<\/strong>/gi,"[quote][b]$1[/b][/quote]"); - rep(/(.*?)<\/em>/gi,"[code][i]$1[/i][/code]"); - rep(/(.*?)<\/em>/gi,"[quote][i]$1[/i][/quote]"); - rep(/(.*?)<\/u>/gi,"[code][u]$1[/u][/code]"); - rep(/(.*?)<\/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>/gi,"[u]$1[/u]"); - rep(//gi,"[u]"); - rep(/]*>/gi,"[quote]"); - rep(/<\/blockquote>/gi,"[/quote]"); - rep(/
/gi,"\n"); - rep(//gi,"\n"); - rep(/
/gi,"\n"); - rep(/

/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) { - s = s.replace(re, str); - } - - // example: [b] to - rep(/\n/gi,"
"); - rep(/\[b\]/gi,""); - rep(/\[\/b\]/gi,""); - rep(/\[i\]/gi,""); - rep(/\[\/i\]/gi,""); - rep(/\[u\]/gi,""); - rep(/\[\/u\]/gi,""); - rep(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,"$2"); - rep(/\[url\](.*?)\[\/url\]/gi,"$1"); - rep(/\[img\](.*?)\[\/img\]/gi,""); - rep(/\[color=(.*?)\](.*?)\[\/color\]/gi,"$2"); - rep(/\[code\](.*?)\[\/code\]/gi,"$1 "); - rep(/\[quote.*?\](.*?)\[\/quote\]/gi,"$1 "); - - return s; - } - }); - - // Register plugin - tinymce.PluginManager.add('bbcode', tinymce.plugins.BBCodePlugin); -})(); \ No newline at end of file +}()); +})(); diff --git a/e107_plugins/tinymce4/plugins/bbcode/plugin.min.js b/e107_plugins/tinymce4/plugins/bbcode/plugin.min.js index 70a88a7d6..b2b9d701c 100644 --- a/e107_plugins/tinymce4/plugins/bbcode/plugin.min.js +++ b/e107_plugins/tinymce4/plugins/bbcode/plugin.min.js @@ -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>/gi,"[url=$1]$2[/url]"),t(/(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]"),t(/(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]"),t(/(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]"),t(/(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]"),t(/(.*?)<\/span>/gi,"[color=$1]$2[/color]"),t(/(.*?)<\/font>/gi,"[color=$1]$2[/color]"),t(/(.*?)<\/span>/gi,"[size=$1]$2[/size]"),t(/(.*?)<\/font>/gi,"$1"),t(//gi,"[img]$1[/img]"),t(/(.*?)<\/span>/gi,"[code]$1[/code]"),t(/(.*?)<\/span>/gi,"[quote]$1[/quote]"),t(/(.*?)<\/strong>/gi,"[code][b]$1[/b][/code]"),t(/(.*?)<\/strong>/gi,"[quote][b]$1[/b][/quote]"),t(/(.*?)<\/em>/gi,"[code][i]$1[/i][/code]"),t(/(.*?)<\/em>/gi,"[quote][i]$1[/i][/quote]"),t(/(.*?)<\/u>/gi,"[code][u]$1[/u][/code]"),t(/(.*?)<\/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>/gi,"[u]$1[/u]"),t(//gi,"[u]"),t(/]*>/gi,"[quote]"),t(/<\/blockquote>/gi,"[/quote]"),t(/
/gi,"\n"),t(//gi,"\n"),t(/
/gi,"\n"),t(/

/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,"
"),t(/\[b\]/gi,""),t(/\[\/b\]/gi,""),t(/\[i\]/gi,""),t(/\[\/i\]/gi,""),t(/\[u\]/gi,""),t(/\[\/u\]/gi,""),t(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,'$2'),t(/\[url\](.*?)\[\/url\]/gi,'$1'),t(/\[img\](.*?)\[\/img\]/gi,''),t(/\[color=(.*?)\](.*?)\[\/color\]/gi,'$2'),t(/\[code\](.*?)\[\/code\]/gi,'$1 '),t(/\[quote.*?\](.*?)\[\/quote\]/gi,'$1 '),e}}),tinymce.PluginManager.add("bbcode",tinymce.plugins.BBCodePlugin)}(); \ No newline at end of file +!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>/gi,"[url=$1]$2[/url]"),o(/(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]"),o(/(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]"),o(/(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]"),o(/(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]"),o(/(.*?)<\/span>/gi,"[color=$1]$2[/color]"),o(/(.*?)<\/font>/gi,"[color=$1]$2[/color]"),o(/(.*?)<\/span>/gi,"[size=$1]$2[/size]"),o(/(.*?)<\/font>/gi,"$1"),o(//gi,"[img]$1[/img]"),o(/(.*?)<\/span>/gi,"[code]$1[/code]"),o(/(.*?)<\/span>/gi,"[quote]$1[/quote]"),o(/(.*?)<\/strong>/gi,"[code][b]$1[/b][/code]"),o(/(.*?)<\/strong>/gi,"[quote][b]$1[/b][/quote]"),o(/(.*?)<\/em>/gi,"[code][i]$1[/i][/code]"),o(/(.*?)<\/em>/gi,"[quote][i]$1[/i][/quote]"),o(/(.*?)<\/u>/gi,"[code][u]$1[/u][/code]"),o(/(.*?)<\/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>/gi,"[u]$1[/u]"),o(//gi,"[u]"),o(/]*>/gi,"[quote]"),o(/<\/blockquote>/gi,"[/quote]"),o(/
/gi,"\n"),o(//gi,"\n"),o(/
/gi,"\n"),o(/

/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,"
"),o(/\[b\]/gi,""),o(/\[\/b\]/gi,""),o(/\[i\]/gi,""),o(/\[\/i\]/gi,""),o(/\[u\]/gi,""),o(/\[\/u\]/gi,""),o(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,'$2'),o(/\[url\](.*?)\[\/url\]/gi,'$1'),o(/\[img\](.*?)\[\/img\]/gi,''),o(/\[color=(.*?)\](.*?)\[\/color\]/gi,'$2'),o(/\[code\](.*?)\[\/code\]/gi,'$1 '),o(/\[quote.*?\](.*?)\[\/quote\]/gi,'$1 '),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))})}}})}(); \ No newline at end of file From a7646f0c4b9732c74dc5609279e80a629079956a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor?= Date: Thu, 10 May 2018 09:28:26 +0200 Subject: [PATCH 4/5] Add files via upload --- .../tinymce4/plugins/compat3x/plugin.js | 467 ++++---- .../tinymce4/plugins/compat3x/plugin.min.js | 2 +- .../plugins/compat3x/tiny_mce_popup.js | 1010 ++++++++--------- .../compat3x/utils/editable_selects.js | 96 +- .../plugins/compat3x/utils/form_utils.js | 250 ++-- .../tinymce4/plugins/compat3x/utils/mctabs.js | 224 ++-- .../plugins/compat3x/utils/validate.js | 379 ++++--- 7 files changed, 1243 insertions(+), 1185 deletions(-) diff --git a/e107_plugins/tinymce4/plugins/compat3x/plugin.js b/e107_plugins/tinymce4/plugins/compat3x/plugin.js index 85b2e0578..92d433edc 100644 --- a/e107_plugins/tinymce4/plugins/compat3x/plugin.js +++ b/e107_plugins/tinymce4/plugins/compat3x/plugin.js @@ -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,279 +19,304 @@ * - No editor.onEvent * - Can't cancel execCommands with beforeExecCommand */ -(function(tinymce) { - var reported; +(function (tinymce) { + var reported; - function noop() { - } + function noop() { + } - function log(apiCall) { - if (!reported && window && window.console) { - reported = true; - console.log("Deprecated TinyMCE API call: " + apiCall); - } - } + function log(apiCall) { + if (!reported && window && window.console) { + reported = true; + console.log("Deprecated TinyMCE API call: " + apiCall); + } + } - function Dispatcher(target, newEventName, argsMap, defaultScope) { - target = target || this; + function Dispatcher(target, newEventName, argsMap, defaultScope) { + target = target || this; + var cbs = []; - if (!newEventName) { - this.add = this.addToTop = this.remove = this.dispatch = noop; - return; - } + if (!newEventName) { + this.add = this.addToTop = this.remove = this.dispatch = noop; + return; + } - this.add = function(callback, scope, prepend) { - log('.on' + newEventName + ".add(..)"); + this.add = function (callback, scope, prepend) { + log('.on' + newEventName + ".add(..)"); - // Convert callback({arg1:x, arg2:x}) -> callback(arg1, arg2) - function patchedEventCallback(e) { - var callbackArgs = []; + // Convert callback({arg1:x, arg2:x}) -> callback(arg1, arg2) + function patchedEventCallback(e) { + var callbackArgs = []; - if (typeof argsMap == "string") { - argsMap = argsMap.split(" "); - } + if (typeof argsMap == "string") { + argsMap = argsMap.split(" "); + } - if (argsMap && typeof argsMap != "function") { - for (var i = 0; i < argsMap.length; i++) { - callbackArgs.push(e[argsMap[i]]); - } - } + if (argsMap && typeof argsMap !== "function") { + for (var i = 0; i < argsMap.length; i++) { + callbackArgs.push(e[argsMap[i]]); + } + } - if (typeof argsMap == "function") { - callbackArgs = argsMap(newEventName, e, target); - if (!callbackArgs) { - return; - } - } + if (typeof argsMap == "function") { + callbackArgs = argsMap(newEventName, e, target); + if (!callbackArgs) { + return; + } + } - if (!argsMap) { - callbackArgs = [e]; - } + if (!argsMap) { + callbackArgs = [e]; + } - callbackArgs.unshift(defaultScope || target); + callbackArgs.unshift(defaultScope || target); - if (callback.apply(scope || defaultScope || target, callbackArgs) === false) { - e.stopImmediatePropagation(); - } - } + if (callback.apply(scope || defaultScope || target, callbackArgs) === false) { + e.stopImmediatePropagation(); + } + } - target.on(newEventName, patchedEventCallback, prepend); + target.on(newEventName, patchedEventCallback, prepend); - return patchedEventCallback; - }; + var handlers = { + original: callback, + patched: patchedEventCallback + }; - this.addToTop = function(callback, scope) { - this.add(callback, scope, true); - }; + cbs.push(handlers); + return patchedEventCallback; + }; - this.remove = function(callback) { - return target.off(newEventName, callback); - }; + this.addToTop = function (callback, scope) { + this.add(callback, scope, true); + }; - this.dispatch = function() { - target.fire(newEventName); + this.remove = function (callback) { + cbs.forEach(function (item, i) { + if (item.original === callback) { + cbs.splice(i, 1); + return target.off(newEventName, item.patched); + } + }); - return true; - }; - } + return target.off(newEventName, callback); + }; - tinymce.util.Dispatcher = Dispatcher; - tinymce.onBeforeUnload = new Dispatcher(tinymce, "BeforeUnload"); - tinymce.onAddEditor = new Dispatcher(tinymce, "AddEditor", "editor"); - tinymce.onRemoveEditor = new Dispatcher(tinymce, "RemoveEditor", "editor"); + this.dispatch = function () { + target.fire(newEventName); + return true; + }; + } - tinymce.util.Cookie = { - get: noop, getHash: noop, remove: noop, set: noop, setHash: noop - }; + tinymce.util.Dispatcher = Dispatcher; + tinymce.onBeforeUnload = new Dispatcher(tinymce, "BeforeUnload"); + tinymce.onAddEditor = new Dispatcher(tinymce, "AddEditor", "editor"); + tinymce.onRemoveEditor = new Dispatcher(tinymce, "RemoveEditor", "editor"); - function patchEditor(editor) { - function patchEditorEvents(oldEventNames, argsMap) { - tinymce.each(oldEventNames.split(" "), function(oldName) { - editor["on" + oldName] = new Dispatcher(editor, oldName, argsMap); - }); - } + tinymce.util.Cookie = { + get: noop, getHash: noop, remove: noop, set: noop, setHash: noop + }; - function convertUndoEventArgs(type, event, target) { - return [ - event.level, - target - ]; - } + function patchEditor(editor) { - function filterSelectionEvents(needsSelection) { - return function(type, e) { - if ((!e.selection && !needsSelection) || e.selection == needsSelection) { - return [e]; - } - }; - } + function translate(str) { + var prefix = editor.settings.language || "en"; + var prefixedStr = [prefix, str].join('.'); + var translatedStr = tinymce.i18n.translate(prefixedStr); - if (editor.controlManager) { - return; - } + return prefixedStr !== translatedStr ? translatedStr : tinymce.i18n.translate(str); + } - function cmNoop() { - var obj = {}, methods = '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'; + function patchEditorEvents(oldEventNames, argsMap) { + tinymce.each(oldEventNames.split(" "), function (oldName) { + editor["on" + oldName] = new Dispatcher(editor, oldName, argsMap); + }); + } - log('editor.controlManager.*'); + function convertUndoEventArgs(type, event, target) { + return [ + event.level, + target + ]; + } - function _noop() { - return cmNoop(); - } + function filterSelectionEvents(needsSelection) { + return function (type, e) { + if ((!e.selection && !needsSelection) || e.selection == needsSelection) { + return [e]; + } + }; + } - tinymce.each(methods.split(' '), function(method) { - obj[method] = _noop; - }); + if (editor.controlManager) { + return; + } - return obj; - } + function cmNoop() { + var obj = {}, methods = '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'; - editor.controlManager = { - buttons: {}, + log('editor.controlManager.*'); - setDisabled: function(name, state) { - log("controlManager.setDisabled(..)"); + function _noop() { + return cmNoop(); + } - if (this.buttons[name]) { - this.buttons[name].disabled(state); - } - }, + tinymce.each(methods.split(' '), function (method) { + obj[method] = _noop; + }); - setActive: function(name, state) { - log("controlManager.setActive(..)"); + return obj; + } - if (this.buttons[name]) { - this.buttons[name].active(state); - } - }, + editor.controlManager = { + buttons: {}, - onAdd: new Dispatcher(), - onPostRender: new Dispatcher(), + setDisabled: function (name, state) { + log("controlManager.setDisabled(..)"); - add: function(obj) { - return obj; - }, - createButton: cmNoop, - createColorSplitButton: cmNoop, - createControl: cmNoop, - createDropMenu: cmNoop, - createListBox: cmNoop, - createMenuButton: cmNoop, - createSeparator: cmNoop, - createSplitButton: cmNoop, - createToolbar: cmNoop, - createToolbarGroup: cmNoop, - destroy: noop, - get: noop, - setControlType: cmNoop - }; + if (this.buttons[name]) { + this.buttons[name].disabled(state); + } + }, - patchEditorEvents("PreInit BeforeRenderUI PostRender Load Init Remove Activate Deactivate", "editor"); - patchEditorEvents("Click MouseUp MouseDown DblClick KeyDown KeyUp KeyPress ContextMenu Paste Submit Reset"); - patchEditorEvents("BeforeExecCommand ExecCommand", "command ui value args"); // args.terminate not supported - patchEditorEvents("PreProcess PostProcess LoadContent SaveContent Change"); - patchEditorEvents("BeforeSetContent BeforeGetContent SetContent GetContent", filterSelectionEvents(false)); - patchEditorEvents("SetProgressState", "state time"); - patchEditorEvents("VisualAid", "element hasVisual"); - patchEditorEvents("Undo Redo", convertUndoEventArgs); + setActive: function (name, state) { + log("controlManager.setActive(..)"); - patchEditorEvents("NodeChange", function(type, e) { - return [ - editor.controlManager, - e.element, - editor.selection.isCollapsed(), - e - ]; - }); + if (this.buttons[name]) { + this.buttons[name].active(state); + } + }, - var originalAddButton = editor.addButton; - editor.addButton = function(name, settings) { - var originalOnPostRender; + onAdd: new Dispatcher(), + onPostRender: new Dispatcher(), - function patchedPostRender() { - editor.controlManager.buttons[name] = this; + add: function (obj) { + return obj; + }, + createButton: cmNoop, + createColorSplitButton: cmNoop, + createControl: cmNoop, + createDropMenu: cmNoop, + createListBox: cmNoop, + createMenuButton: cmNoop, + createSeparator: cmNoop, + createSplitButton: cmNoop, + createToolbar: cmNoop, + createToolbarGroup: cmNoop, + destroy: noop, + get: noop, + setControlType: cmNoop + }; - if (originalOnPostRender) { - return originalOnPostRender.call(this); - } - } + patchEditorEvents("PreInit BeforeRenderUI PostRender Load Init Remove Activate Deactivate", "editor"); + patchEditorEvents("Click MouseUp MouseDown DblClick KeyDown KeyUp KeyPress ContextMenu Paste Submit Reset"); + patchEditorEvents("BeforeExecCommand ExecCommand", "command ui value args"); // args.terminate not supported + patchEditorEvents("PreProcess PostProcess LoadContent SaveContent Change"); + patchEditorEvents("BeforeSetContent BeforeGetContent SetContent GetContent", filterSelectionEvents(false)); + patchEditorEvents("SetProgressState", "state time"); + patchEditorEvents("VisualAid", "element hasVisual"); + patchEditorEvents("Undo Redo", convertUndoEventArgs); - for (var key in settings) { - if (key.toLowerCase() === "onpostrender") { - originalOnPostRender = settings[key]; - settings.onPostRender = patchedPostRender; - } - } + patchEditorEvents("NodeChange", function (type, e) { + return [ + editor.controlManager, + e.element, + editor.selection.isCollapsed(), + e + ]; + }); - if (!originalOnPostRender) { - settings.onPostRender = patchedPostRender; - } + var originalAddButton = editor.addButton; + editor.addButton = function (name, settings) { + var originalOnPostRender; - if (settings.title) { - settings.title = tinymce.i18n.translate((editor.settings.language || "en") + "." + settings.title); - } + function patchedPostRender() { + editor.controlManager.buttons[name] = this; - return originalAddButton.call(this, name, settings); - }; + if (originalOnPostRender) { + return originalOnPostRender.apply(this, arguments); + } + } - editor.on('init', function() { - var undoManager = editor.undoManager, selection = editor.selection; + for (var key in settings) { + if (key.toLowerCase() === "onpostrender") { + originalOnPostRender = settings[key]; + settings.onPostRender = patchedPostRender; + } + } - undoManager.onUndo = new Dispatcher(editor, "Undo", convertUndoEventArgs, null, undoManager); - undoManager.onRedo = new Dispatcher(editor, "Redo", convertUndoEventArgs, null, undoManager); - undoManager.onBeforeAdd = new Dispatcher(editor, "BeforeAddUndo", null, undoManager); - undoManager.onAdd = new Dispatcher(editor, "AddUndo", null, undoManager); + if (!originalOnPostRender) { + settings.onPostRender = patchedPostRender; + } - selection.onBeforeGetContent = new Dispatcher(editor, "BeforeGetContent", filterSelectionEvents(true), selection); - selection.onGetContent = new Dispatcher(editor, "GetContent", filterSelectionEvents(true), selection); - selection.onBeforeSetContent = new Dispatcher(editor, "BeforeSetContent", filterSelectionEvents(true), selection); - selection.onSetContent = new Dispatcher(editor, "SetContent", filterSelectionEvents(true), selection); - }); + if (settings.title) { + settings.title = translate(settings.title); + } - editor.on('BeforeRenderUI', function() { - var windowManager = editor.windowManager; + return originalAddButton.call(this, name, settings); + }; - windowManager.onOpen = new Dispatcher(); - windowManager.onClose = new Dispatcher(); - windowManager.createInstance = function(className, a, b, c, d, e) { - log("windowManager.createInstance(..)"); + editor.on('init', function () { + var undoManager = editor.undoManager, selection = editor.selection; - var constr = tinymce.resolve(className); - return new constr(a, b, c, d, e); - }; - }); - } + undoManager.onUndo = new Dispatcher(editor, "Undo", convertUndoEventArgs, null, undoManager); + undoManager.onRedo = new Dispatcher(editor, "Redo", convertUndoEventArgs, null, undoManager); + undoManager.onBeforeAdd = new Dispatcher(editor, "BeforeAddUndo", null, undoManager); + undoManager.onAdd = new Dispatcher(editor, "AddUndo", null, undoManager); - tinymce.on('SetupEditor', patchEditor); - tinymce.PluginManager.add("compat3x", patchEditor); + selection.onBeforeGetContent = new Dispatcher(editor, "BeforeGetContent", filterSelectionEvents(true), selection); + selection.onGetContent = new Dispatcher(editor, "GetContent", filterSelectionEvents(true), selection); + selection.onBeforeSetContent = new Dispatcher(editor, "BeforeSetContent", filterSelectionEvents(true), selection); + selection.onSetContent = new Dispatcher(editor, "SetContent", filterSelectionEvents(true), selection); + }); - tinymce.addI18n = function(prefix, o) { - var I18n = tinymce.util.I18n, each = tinymce.each; + editor.on('BeforeRenderUI', function () { + var windowManager = editor.windowManager; - if (typeof prefix == "string" && prefix.indexOf('.') === -1) { - I18n.add(prefix, o); - return; - } + windowManager.onOpen = new Dispatcher(); + windowManager.onClose = new Dispatcher(); + windowManager.createInstance = function (className, a, b, c, d, e) { + log("windowManager.createInstance(..)"); - if (!tinymce.is(prefix, 'string')) { - each(prefix, function(o, lc) { - each(o, function(o, g) { - each(o, function(o, k) { - if (g === 'common') { - I18n.data[lc + '.' + k] = o; - } else { - I18n.data[lc + '.' + g + '.' + k] = o; - } - }); - }); - }); - } else { - each(o, function(o, k) { - I18n.data[prefix + '.' + k] = o; - }); - } - }; + var constr = tinymce.resolve(className); + return new constr(a, b, c, d, e); + }; + }); + } + + tinymce.on('SetupEditor', function (e) { + patchEditor(e.editor); + }); + + tinymce.PluginManager.add("compat3x", patchEditor); + + tinymce.addI18n = function (prefix, o) { + var I18n = tinymce.util.I18n, each = tinymce.each; + + if (typeof prefix == "string" && prefix.indexOf('.') === -1) { + I18n.add(prefix, o); + return; + } + + if (!tinymce.is(prefix, 'string')) { + each(prefix, function (o, lc) { + each(o, function (o, g) { + each(o, function (o, k) { + if (g === 'common') { + I18n.data[lc + '.' + k] = o; + } else { + I18n.data[lc + '.' + g + '.' + k] = o; + } + }); + }); + }); + } else { + each(o, function (o, k) { + I18n.data[prefix + '.' + k] = o; + }); + } + }; })(tinymce); diff --git a/e107_plugins/tinymce4/plugins/compat3x/plugin.min.js b/e107_plugins/tinymce4/plugins/compat3x/plugin.min.js index d9fee4629..8562cb7c7 100644 --- a/e107_plugins/tinymce4/plugins/compat3x/plugin.min.js +++ b/e107_plugins/tinymce4/plugins/compat3x/plugin.min.js @@ -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.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); \ No newline at end of file +!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.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); \ No newline at end of file diff --git a/e107_plugins/tinymce4/plugins/compat3x/tiny_mce_popup.js b/e107_plugins/tinymce4/plugins/compat3x/tiny_mce_popup.js index 733f4397e..92e87effe 100644 --- a/e107_plugins/tinymce4/plugins/compat3x/tiny_mce_popup.js +++ b/e107_plugins/tinymce4/plugins/compat3x/tiny_mce_popup.js @@ -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 @@ -19,524 +19,524 @@ var tinymce, tinyMCE; * @class tinyMCEPopup */ var tinyMCEPopup = { - /** - * Initializes the popup this will be called automatically. - * - * @method init - */ - init: function() { - var self = this, parentWin, settings, uiWindow; - - // Find window & API - parentWin = self.getWin(); - tinymce = tinyMCE = parentWin.tinymce; - self.editor = tinymce.EditorManager.activeEditor; - self.params = self.editor.windowManager.getParams(); - - uiWindow = self.editor.windowManager.windows[self.editor.windowManager.windows.length - 1]; - self.features = uiWindow.features; - self.uiWindow = uiWindow; - - settings = self.editor.settings; - - // Setup popup CSS path(s) - if (settings.popup_css !== false) { - if (settings.popup_css) { - settings.popup_css = self.editor.documentBaseURI.toAbsolute(settings.popup_css); - } else { - settings.popup_css = self.editor.baseURI.toAbsolute("plugins/compat3x/css/dialog.css"); - } - } - - if (settings.popup_css_add) { - settings.popup_css += ',' + self.editor.documentBaseURI.toAbsolute(settings.popup_css_add); - } - - // Setup local DOM - self.dom = self.editor.windowManager.createInstance('tinymce.dom.DOMUtils', document, { - ownEvents: true, - proxy: tinyMCEPopup._eventProxy - }); - - self.dom.bind(window, 'ready', self._onDOMLoaded, self); - - // Enables you to skip loading the default css - if (self.features.popup_css !== false) { - self.dom.loadCSS(self.features.popup_css || self.editor.settings.popup_css); - } - - // Setup on init listeners - self.listeners = []; - - /** - * Fires when the popup is initialized. - * - * @event onInit - * @param {tinymce.Editor} editor Editor instance. - * @example - * // Alerts the selected contents when the dialog is loaded - * tinyMCEPopup.onInit.add(function(ed) { - * alert(ed.selection.getContent()); - * }); - * - * // Executes the init method on page load in some object using the SomeObject scope - * tinyMCEPopup.onInit.add(SomeObject.init, SomeObject); - */ - self.onInit = { - add: function(func, scope) { - self.listeners.push({func : func, scope : scope}); - } - }; - - self.isWindow = !self.getWindowArg('mce_inline'); - self.id = self.getWindowArg('mce_window_id'); - }, - - /** - * Returns the reference to the parent window that opened the dialog. - * - * @method getWin - * @return {Window} Reference to the parent window that opened the dialog. - */ - getWin: function() { - // Added frameElement check to fix bug: #2817583 - return (!window.frameElement && window.dialogArguments) || opener || parent || top; - }, - - /** - * Returns a window argument/parameter by name. - * - * @method getWindowArg - * @param {String} name Name of the window argument to retrive. - * @param {String} defaultValue Optional default value to return. - * @return {String} Argument value or default value if it wasn't found. - */ - getWindowArg : function(name, defaultValue) { - var value = this.params[name]; - - return tinymce.is(value) ? value : defaultValue; - }, - - /** - * Returns a editor parameter/config option value. - * - * @method getParam - * @param {String} name Name of the editor config option to retrive. - * @param {String} defaultValue Optional default value to return. - * @return {String} Parameter value or default value if it wasn't found. - */ - getParam : function(name, defaultValue) { - return this.editor.getParam(name, defaultValue); - }, - - /** - * Returns a language item by key. - * - * @method getLang - * @param {String} name Language item like mydialog.something. - * @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) { - return this.editor.getLang(name, defaultValue); - }, - - /** - * Executed a command on editor that opened the dialog/popup. - * - * @method execCommand - * @param {String} cmd Command to execute. - * @param {Boolean} ui Optional boolean value if the UI for the command should be presented or not. - * @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) { - args = args || {}; - args.skip_focus = 1; - - this.restoreSelection(); - return this.editor.execCommand(cmd, ui, val, args); - }, - - /** - * Resizes the dialog to the inner size of the window. This is needed since various browsers - * have different border sizes on windows. - * - * @method resizeToInnerSize - */ - resizeToInnerSize : function() { - /*var self = this; - - // Detach it to workaround a Chrome specific bug - // https://sourceforge.net/tracker/?func=detail&atid=635682&aid=2926339&group_id=103281 - setTimeout(function() { - var vp = self.dom.getViewPort(window); - - self.editor.windowManager.resizeBy( - self.getWindowArg('mce_width') - vp.w, - self.getWindowArg('mce_height') - vp.h, - self.id || window - ); - }, 10);*/ - }, - - /** - * Will executed the specified string when the page has been loaded. This function - * was added for compatibility with the 2.x branch. - * - * @method executeOnLoad - * @param {String} evil String to evalutate on init. - */ - executeOnLoad : function(evil) { - this.onInit.add(function() { - eval(evil); - }); - }, - - /** - * Stores the current editor selection for later restoration. This can be useful since some browsers - * looses it's selection if a control element is selected/focused inside the dialogs. - * - * @method storeSelection - */ - storeSelection : function() { - this.editor.windowManager.bookmark = tinyMCEPopup.editor.selection.getBookmark(1); - }, - - /** - * Restores any stored selection. This can be useful since some browsers - * looses it's selection if a control element is selected/focused inside the dialogs. - * - * @method restoreSelection - */ - restoreSelection : function() { - var self = tinyMCEPopup; - - if (!self.isWindow && tinymce.isIE) { - self.editor.selection.moveToBookmark(self.editor.windowManager.bookmark); - } - }, - - /** - * Loads a specific dialog language pack. If you pass in plugin_url as a argument - * when you open the window it will load the /langs/_dlg.js lang pack file. - * - * @method requireLangPack - */ - requireLangPack : function() { - var self = this, url = self.getWindowArg('plugin_url') || self.getWindowArg('theme_url'), settings = self.editor.settings, lang; - - if (settings.language !== false) { - lang = settings.language || "en"; - } - - if (url && lang && self.features.translate_i18n !== false && settings.language_load !== false) { - url += '/langs/' + lang + '_dlg.js'; - - if (!tinymce.ScriptLoader.isDone(url)) { - document.write(''); - tinymce.ScriptLoader.markDone(url); - } - } - }, - - /** - * Executes a color picker on the specified element id. When the user - * then selects a color it will be set as the value of the specified element. - * - * @method pickColor - * @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) { - var el = document.getElementById(element_id), colorPickerCallback = this.editor.settings.color_picker_callback; - if (colorPickerCallback) { - colorPickerCallback.call( - this.editor, - function (value) { - el.value = value; - try { - el.onchange(); - } catch (ex) { - // Try fire event, ignore errors - } - }, - el.value - ); - } - }, - - /** - * Opens a filebrowser/imagebrowser this will set the output value from - * the browser as a value on the specified element. - * - * @method openBrowser - * @param {string} element_id Id of the element to set value in. - * @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) { - tinyMCEPopup.restoreSelection(); - this.editor.execCallback('file_browser_callback', element_id, document.getElementById(element_id).value, type, window); - }, - - /** - * Creates a confirm dialog. Please don't use the blocking behavior of this - * native version use the callback method instead then it can be extended. - * - * @method confirm - * @param {String} t Title for the new confirm dialog. - * @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) { - this.editor.windowManager.confirm(t, cb, s, window); - }, - - /** - * Creates a alert dialog. Please don't use the blocking behavior of this - * native version use the callback method instead then it can be extended. - * - * @method alert - * @param {String} tx Title for the new alert dialog. - * @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) { - this.editor.windowManager.alert(tx, cb, s, window); - }, - - /** - * Closes the current window. - * - * @method close - */ - close : function() { - var t = this; - - // To avoid domain relaxing issue in Opera - function close() { - t.editor.windowManager.close(window); - tinymce = tinyMCE = t.editor = t.params = t.dom = t.dom.doc = null; // Cleanup - } - - if (tinymce.isOpera) { - t.getWin().setTimeout(close, 0); - } else { - close(); - } - }, - - // Internal functions - - _restoreSelection : function() { - var e = window.event.srcElement; - - if (e.nodeName == 'INPUT' && (e.type == 'submit' || e.type == 'button')) { - tinyMCEPopup.restoreSelection(); - } - }, - -/* _restoreSelection : function() { - var e = window.event.srcElement; - - // If user focus a non text input or textarea - if ((e.nodeName != 'INPUT' && e.nodeName != 'TEXTAREA') || e.type != 'text') - tinyMCEPopup.restoreSelection(); - },*/ - - _onDOMLoaded : function() { - var t = tinyMCEPopup, ti = document.title, h, nv; - - // Translate page - if (t.features.translate_i18n !== false) { - var map = { - "update": "Ok", - "insert": "Ok", - "cancel": "Cancel", - "not_set": "--", - "class_name": "Class name", - "browse": "Browse" - }; - - var langCode = tinymce.settings.language || 'en'; - for (var key in map) { - tinymce.i18n.data[langCode + "." + key] = tinymce.i18n.translate(map[key]); - } - - h = document.body.innerHTML; - - // Replace a=x with a="x" in IE - if (tinymce.isIE) { - h = h.replace(/ (value|title|alt)=([^"][^\s>]+)/gi, ' $1="$2"'); - } - - document.dir = t.editor.getParam('directionality',''); - - if ((nv = t.editor.translate(h)) && nv != h) { - document.body.innerHTML = nv; - } - - if ((nv = t.editor.translate(ti)) && nv != ti) { - document.title = ti = nv; - } - } - - if (!t.editor.getParam('browser_preferred_colors', false) || !t.isWindow) { - t.dom.addClass(document.body, 'forceColors'); - } - - document.body.style.display = ''; - - // Restore selection in IE when focus is placed on a non textarea or input element of the type text - if (tinymce.Env.ie) { - if (tinymce.Env.ie < 11) { - 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'}); - } else { - document.addEventListener('mouseup', tinyMCEPopup._restoreSelection, false); - } - } - - t.restoreSelection(); - t.resizeToInnerSize(); - - // Set inline title - if (!t.isWindow) { - t.editor.windowManager.setTitle(window, ti); - } else { - window.focus(); - } - - if (!tinymce.isIE && !t.isWindow) { - t.dom.bind(document, 'focus', function() { - t.editor.windowManager.focus(t.id); - }); - } - - // Patch for accessibility - 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) { - o.func.call(o.scope, t.editor); - }); - - // Move focus to window - if (t.getWindowArg('mce_auto_focus', true)) { - window.focus(); - - // Focus element with mceFocus class - 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 - } - }); - }); - } - - document.onkeyup = tinyMCEPopup._closeWinKeyHandler; - - if ('textContent' in document) { - t.uiWindow.getEl('head').firstChild.textContent = document.title; - } else { - t.uiWindow.getEl('head').firstChild.innerText = document.title; - } - }, - - _accessHandler : function(e) { - e = e || window.event; - - if (e.keyCode == 13 || e.keyCode == 32) { - var elm = e.target || e.srcElement; - - if (elm.onchange) { - elm.onchange(); - } - - return tinymce.dom.Event.cancel(e); - } - }, - - _closeWinKeyHandler : function(e) { - e = e || window.event; - - if (e.keyCode == 27) { - tinyMCEPopup.close(); - } - }, - - _eventProxy: function(id) { - return function(evt) { - tinyMCEPopup.dom.events.callNativeHandler(id, evt); - }; - } + /** + * Initializes the popup this will be called automatically. + * + * @method init + */ + init: function () { + var self = this, parentWin, settings, uiWindow; + + // Find window & API + parentWin = self.getWin(); + tinymce = tinyMCE = parentWin.tinymce; + self.editor = tinymce.EditorManager.activeEditor; + self.params = self.editor.windowManager.getParams(); + + uiWindow = self.editor.windowManager.windows[self.editor.windowManager.windows.length - 1]; + self.features = uiWindow.features; + self.uiWindow = uiWindow; + + settings = self.editor.settings; + + // Setup popup CSS path(s) + if (settings.popup_css !== false) { + if (settings.popup_css) { + settings.popup_css = self.editor.documentBaseURI.toAbsolute(settings.popup_css); + } else { + settings.popup_css = self.editor.baseURI.toAbsolute("plugins/compat3x/css/dialog.css"); + } + } + + if (settings.popup_css_add) { + settings.popup_css += ',' + self.editor.documentBaseURI.toAbsolute(settings.popup_css_add); + } + + // Setup local DOM + self.dom = self.editor.windowManager.createInstance('tinymce.dom.DOMUtils', document, { + ownEvents: true, + proxy: tinyMCEPopup._eventProxy + }); + + self.dom.bind(window, 'ready', self._onDOMLoaded, self); + + // Enables you to skip loading the default css + if (self.features.popup_css !== false) { + self.dom.loadCSS(self.features.popup_css || self.editor.settings.popup_css); + } + + // Setup on init listeners + self.listeners = []; + + /** + * Fires when the popup is initialized. + * + * @event onInit + * @param {tinymce.Editor} editor Editor instance. + * @example + * // Alerts the selected contents when the dialog is loaded + * tinyMCEPopup.onInit.add(function(ed) { + * alert(ed.selection.getContent()); + * }); + * + * // Executes the init method on page load in some object using the SomeObject scope + * tinyMCEPopup.onInit.add(SomeObject.init, SomeObject); + */ + self.onInit = { + add: function (func, scope) { + self.listeners.push({ func: func, scope: scope }); + } + }; + + self.isWindow = !self.getWindowArg('mce_inline'); + self.id = self.getWindowArg('mce_window_id'); + }, + + /** + * Returns the reference to the parent window that opened the dialog. + * + * @method getWin + * @return {Window} Reference to the parent window that opened the dialog. + */ + getWin: function () { + // Added frameElement check to fix bug: #2817583 + return (!window.frameElement && window.dialogArguments) || opener || parent || top; + }, + + /** + * Returns a window argument/parameter by name. + * + * @method getWindowArg + * @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) { + var value = this.params[name]; + + return tinymce.is(value) ? value : defaultValue; + }, + + /** + * Returns a editor parameter/config option value. + * + * @method getParam + * @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) { + return this.editor.getParam(name, defaultValue); + }, + + /** + * Returns a language item by key. + * + * @method getLang + * @param {String} name Language item like mydialog.something. + * @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) { + return this.editor.getLang(name, defaultValue); + }, + + /** + * Executed a command on editor that opened the dialog/popup. + * + * @method execCommand + * @param {String} cmd Command to execute. + * @param {Boolean} ui Optional boolean value if the UI for the command should be presented or not. + * @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) { + args = args || {}; + args.skip_focus = 1; + + this.restoreSelection(); + return this.editor.execCommand(cmd, ui, val, args); + }, + + /** + * Resizes the dialog to the inner size of the window. This is needed since various browsers + * have different border sizes on windows. + * + * @method resizeToInnerSize + */ + resizeToInnerSize: function () { + /*var self = this; + + // Detach it to workaround a Chrome specific bug + // https://sourceforge.net/tracker/?func=detail&atid=635682&aid=2926339&group_id=103281 + setTimeout(function() { + var vp = self.dom.getViewPort(window); + + self.editor.windowManager.resizeBy( + self.getWindowArg('mce_width') - vp.w, + self.getWindowArg('mce_height') - vp.h, + self.id || window + ); + }, 10);*/ + }, + + /** + * Will executed the specified string when the page has been loaded. This function + * was added for compatibility with the 2.x branch. + * + * @method executeOnLoad + * @param {String} evil String to evalutate on init. + */ + executeOnLoad: function (evil) { + this.onInit.add(function () { + eval(evil); + }); + }, + + /** + * Stores the current editor selection for later restoration. This can be useful since some browsers + * looses it's selection if a control element is selected/focused inside the dialogs. + * + * @method storeSelection + */ + storeSelection: function () { + this.editor.windowManager.bookmark = tinyMCEPopup.editor.selection.getBookmark(1); + }, + + /** + * Restores any stored selection. This can be useful since some browsers + * looses it's selection if a control element is selected/focused inside the dialogs. + * + * @method restoreSelection + */ + restoreSelection: function () { + var self = tinyMCEPopup; + + if (!self.isWindow && tinymce.isIE) { + self.editor.selection.moveToBookmark(self.editor.windowManager.bookmark); + } + }, + + /** + * Loads a specific dialog language pack. If you pass in plugin_url as a argument + * when you open the window it will load the /langs/_dlg.js lang pack file. + * + * @method requireLangPack + */ + requireLangPack: function () { + var self = this, url = self.getWindowArg('plugin_url') || self.getWindowArg('theme_url'), settings = self.editor.settings, lang; + + if (settings.language !== false) { + lang = settings.language || "en"; + } + + if (url && lang && self.features.translate_i18n !== false && settings.language_load !== false) { + url += '/langs/' + lang + '_dlg.js'; + + if (!tinymce.ScriptLoader.isDone(url)) { + document.write(''); + tinymce.ScriptLoader.markDone(url); + } + } + }, + + /** + * Executes a color picker on the specified element id. When the user + * then selects a color it will be set as the value of the specified element. + * + * @method pickColor + * @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) { + var el = document.getElementById(element_id), colorPickerCallback = this.editor.settings.color_picker_callback; + if (colorPickerCallback) { + colorPickerCallback.call( + this.editor, + function (value) { + el.value = value; + try { + el.onchange(); + } catch (ex) { + // Try fire event, ignore errors + } + }, + el.value + ); + } + }, + + /** + * Opens a filebrowser/imagebrowser this will set the output value from + * the browser as a value on the specified element. + * + * @method openBrowser + * @param {string} element_id Id of the element to set value in. + * @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) { + tinyMCEPopup.restoreSelection(); + this.editor.execCallback('file_browser_callback', element_id, document.getElementById(element_id).value, type, window); + }, + + /** + * Creates a confirm dialog. Please don't use the blocking behavior of this + * native version use the callback method instead then it can be extended. + * + * @method confirm + * @param {String} t Title for the new confirm dialog. + * @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) { + this.editor.windowManager.confirm(t, cb, s, window); + }, + + /** + * Creates a alert dialog. Please don't use the blocking behavior of this + * native version use the callback method instead then it can be extended. + * + * @method alert + * @param {String} tx Title for the new alert dialog. + * @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) { + this.editor.windowManager.alert(tx, cb, s, window); + }, + + /** + * Closes the current window. + * + * @method close + */ + close: function () { + var t = this; + + // To avoid domain relaxing issue in Opera + function close() { + t.editor.windowManager.close(window); + tinymce = tinyMCE = t.editor = t.params = t.dom = t.dom.doc = null; // Cleanup + } + + if (tinymce.isOpera) { + t.getWin().setTimeout(close, 0); + } else { + close(); + } + }, + + // Internal functions + + _restoreSelection: function () { + var e = window.event.srcElement; + + if (e.nodeName == 'INPUT' && (e.type == 'submit' || e.type == 'button')) { + tinyMCEPopup.restoreSelection(); + } + }, + + /* _restoreSelection : function() { + var e = window.event.srcElement; + + // If user focus a non text input or textarea + if ((e.nodeName != 'INPUT' && e.nodeName != 'TEXTAREA') || e.type != 'text') + tinyMCEPopup.restoreSelection(); + },*/ + + _onDOMLoaded: function () { + var t = tinyMCEPopup, ti = document.title, h, nv; + + // Translate page + if (t.features.translate_i18n !== false) { + var map = { + "update": "Ok", + "insert": "Ok", + "cancel": "Cancel", + "not_set": "--", + "class_name": "Class name", + "browse": "Browse" + }; + + 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]); + } + + h = document.body.innerHTML; + + // Replace a=x with a="x" in IE + if (tinymce.isIE) { + h = h.replace(/ (value|title|alt)=([^"][^\s>]+)/gi, ' $1="$2"'); + } + + document.dir = t.editor.getParam('directionality', ''); + + if ((nv = t.editor.translate(h)) && nv != h) { + document.body.innerHTML = nv; + } + + if ((nv = t.editor.translate(ti)) && nv != ti) { + document.title = ti = nv; + } + } + + if (!t.editor.getParam('browser_preferred_colors', false) || !t.isWindow) { + t.dom.addClass(document.body, 'forceColors'); + } + + document.body.style.display = ''; + + // Restore selection in IE when focus is placed on a non textarea or input element of the type text + if (tinymce.Env.ie) { + if (tinymce.Env.ie < 11) { + 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' }); + } else { + document.addEventListener('mouseup', tinyMCEPopup._restoreSelection, false); + } + } + + t.restoreSelection(); + t.resizeToInnerSize(); + + // Set inline title + if (!t.isWindow) { + t.editor.windowManager.setTitle(window, ti); + } else { + window.focus(); + } + + if (!tinymce.isIE && !t.isWindow) { + t.dom.bind(document, 'focus', function () { + t.editor.windowManager.focus(t.id); + }); + } + + // Patch for accessibility + 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) { + o.func.call(o.scope, t.editor); + }); + + // Move focus to window + if (t.getWindowArg('mce_auto_focus', true)) { + window.focus(); + + // Focus element with mceFocus class + 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 + } + }); + }); + } + + document.onkeyup = tinyMCEPopup._closeWinKeyHandler; + + if ('textContent' in document) { + t.uiWindow.getEl('head').firstChild.textContent = document.title; + } else { + t.uiWindow.getEl('head').firstChild.innerText = document.title; + } + }, + + _accessHandler: function (e) { + e = e || window.event; + + if (e.keyCode == 13 || e.keyCode == 32) { + var elm = e.target || e.srcElement; + + if (elm.onchange) { + elm.onchange(); + } + + return tinymce.dom.Event.cancel(e); + } + }, + + _closeWinKeyHandler: function (e) { + e = e || window.event; + + if (e.keyCode == 27) { + tinyMCEPopup.close(); + } + }, + + _eventProxy: function (id) { + return function (evt) { + tinyMCEPopup.dom.events.callNativeHandler(id, evt); + }; + } }; tinyMCEPopup.init(); -tinymce.util.Dispatcher = function(scope) { - this.scope = scope || this; - this.listeners = []; +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; - }; + 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) { - self.listeners = [listener].concat(self.listeners); - } else { - self.listeners.unshift(listener); - } + // Create new listeners if addToTop is executed in a dispatch loop + if (self.inDispatch) { + self.listeners = [listener].concat(self.listeners); + } else { + self.listeners.unshift(listener); + } - return callback; - }; + return callback; + }; - this.remove = function(callback) { - var listeners = this.listeners, output = null; + this.remove = function (callback) { + var listeners = this.listeners, output = null; - tinymce.each(listeners, function(listener, i) { - if (callback == listener.cb) { - output = listener; - listeners.splice(i, 1); - return false; - } - }); + tinymce.each(listeners, function (listener, i) { + if (callback == listener.cb) { + output = listener; + listeners.splice(i, 1); + return false; + } + }); - return output; - }; + return output; + }; - this.dispatch = function() { - var self = this, returnValue, args = arguments, i, listeners = self.listeners, listener; + this.dispatch = function () { + var self = this, returnValue, args = arguments, i, listeners = self.listeners, listener; - self.inDispatch = true; - - // Needs to be a real loop since the listener count might change while looping - // And this is also more efficient - for (i = 0; i < listeners.length; i++) { - listener = listeners[i]; - returnValue = listener.cb.apply(listener.scope, args.length > 0 ? args : [listener.scope]); + self.inDispatch = true; - if (returnValue === false) { - break; - } - } + // Needs to be a real loop since the listener count might change while looping + // And this is also more efficient + for (i = 0; i < listeners.length; i++) { + listener = listeners[i]; + returnValue = listener.cb.apply(listener.scope, args.length > 0 ? args : [listener.scope]); - self.inDispatch = false; + if (returnValue === false) { + break; + } + } - return returnValue; - }; + self.inDispatch = false; + + return returnValue; + }; }; diff --git a/e107_plugins/tinymce4/plugins/compat3x/utils/editable_selects.js b/e107_plugins/tinymce4/plugins/compat3x/utils/editable_selects.js index 8d30787d5..3dd44a8f1 100644 --- a/e107_plugins/tinymce4/plugins/compat3x/utils/editable_selects.js +++ b/e107_plugins/tinymce4/plugins/compat3x/utils/editable_selects.js @@ -1,70 +1,72 @@ /** * 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 */ var TinyMCE_EditableSelects = { - editSelectElm : null, + editSelectElm : null, - init : function() { - var nl = document.getElementsByTagName("select"), i, d = document, o; + init : function () { + var nl = document.getElementsByTagName("select"), i, d = document, o; - for (i=0; i'; - h += ' '; + h += ''; + h += ' '; - return h; + return h; } function updateColor(img_id, form_element_id) { - document.getElementById(img_id).style.backgroundColor = document.forms[0].elements[form_element_id].value; + document.getElementById(img_id).style.backgroundColor = document.forms[0].elements[form_element_id].value; } function setBrowserDisabled(id, state) { - var img = document.getElementById(id); - var lnk = document.getElementById(id + "_link"); + var img = document.getElementById(id); + var lnk = document.getElementById(id + "_link"); - if (lnk) { - if (state) { - lnk.setAttribute("realhref", lnk.getAttribute("href")); - lnk.removeAttribute("href"); - tinyMCEPopup.dom.addClass(img, 'disabled'); - } else { - if (lnk.getAttribute("realhref")) - lnk.setAttribute("href", lnk.getAttribute("realhref")); + if (lnk) { + if (state) { + lnk.setAttribute("realhref", lnk.getAttribute("href")); + lnk.removeAttribute("href"); + tinyMCEPopup.dom.addClass(img, 'disabled'); + } else { + if (lnk.getAttribute("realhref")) { + lnk.setAttribute("href", lnk.getAttribute("realhref")); + } - tinyMCEPopup.dom.removeClass(img, 'disabled'); - } - } + tinyMCEPopup.dom.removeClass(img, 'disabled'); + } + } } function getBrowserHTML(id, target_form_element, type, prefix) { - var option = prefix + "_" + type + "_browser_callback", cb, html; + var option = prefix + "_" + type + "_browser_callback", cb, html; - cb = tinyMCEPopup.getParam(option, tinyMCEPopup.getParam("file_browser_callback")); + cb = tinyMCEPopup.getParam(option, tinyMCEPopup.getParam("file_browser_callback")); - if (!cb) - return ""; + if (!cb) { + return ""; + } - html = ""; - html += ''; - html += ' '; + html = ""; + html += ''; + html += ' '; - return html; + return html; } function openBrowser(img_id, target_form_element, type, option) { - var img = document.getElementById(img_id); + var img = document.getElementById(img_id); - if (img.className != "mceButtonDisabled") - tinyMCEPopup.openBrowser(target_form_element, type, option); + 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]) - return; + if (!form_obj || !form_obj.elements[field_name]) { + return; + } - if (!value) - value = ""; + if (!value) { + value = ""; + } - var sel = form_obj.elements[field_name]; + var sel = form_obj.elements[field_name]; - var found = false; - for (var i=0; i parseInt(v)) - st = this.mark(f, n); - } - } + if (isNaN(v) || parseInt(n.value) < parseInt(v)) { + st = this.mark(f, n); + } + } - return st; - }, + if (this.hasClass(n, s.max_cls, true)) { + v = this.getNum(n, s.max_cls); - hasClass : function(n, c, d) { - return new RegExp('\\b' + c + (d ? '[0-9]+' : '') + '\\b', 'g').test(n.className); - }, + if (isNaN(v) || parseInt(n.value) > parseInt(v)) { + st = this.mark(f, n); + } + } + } - getNum : function(n, c) { - c = n.className.match(new RegExp('\\b' + c + '([0-9]+)\\b', 'g'))[0]; - c = c.replace(/[^0-9]/g, ''); + return st; + }, - return c; - }, + hasClass : function (n, c, d) { + return new RegExp('\\b' + c + (d ? '[0-9]+' : '') + '\\b', 'g').test(n.className); + }, - addClass : function(n, c, b) { - var o = this.removeClass(n, c); - n.className = b ? c + (o != '' ? (' ' + o) : '') : (o != '' ? (o + ' ') : '') + c; - }, + getNum : function (n, c) { + c = n.className.match(new RegExp('\\b' + c + '([0-9]+)\\b', 'g'))[0]; + c = c.replace(/[^0-9]/g, ''); - removeClass : function(n, c) { - c = n.className.replace(new RegExp("(^|\\s+)" + c + "(\\s+|$)"), ' '); - return n.className = c != ' ' ? c : ''; - }, + return c; + }, - tags : function(f, s) { - return f.getElementsByTagName(s); - }, + addClass : function (n, c, b) { + var o = this.removeClass(n, c); + n.className = b ? c + (o !== '' ? (' ' + o) : '') : (o !== '' ? (o + ' ') : '') + c; + }, - mark : function(f, n) { - var s = this.settings; + removeClass : function (n, c) { + c = n.className.replace(new RegExp("(^|\\s+)" + c + "(\\s+|$)"), ' '); + return n.className = c !== ' ' ? c : ''; + }, - this.addClass(n, s.invalid_cls); - n.setAttribute('aria-invalid', 'true'); - this.markLabels(f, n, s.invalid_cls); + tags : function (f, s) { + return f.getElementsByTagName(s); + }, - return false; - }, + mark : function (f, n) { + var s = this.settings; - markLabels : function(f, n, ic) { - var nl, i; + this.addClass(n, s.invalid_cls); + n.setAttribute('aria-invalid', 'true'); + this.markLabels(f, n, s.invalid_cls); - nl = this.tags(f, "label"); - for (i=0; i Date: Thu, 10 May 2018 09:29:51 +0200 Subject: [PATCH 5/5] Delete en.js --- e107_plugins/tinymce4/langs/en.js | 179 ------------------------------ 1 file changed, 179 deletions(-) delete mode 100644 e107_plugins/tinymce4/langs/en.js diff --git a/e107_plugins/tinymce4/langs/en.js b/e107_plugins/tinymce4/langs/en.js deleted file mode 100644 index a588b8874..000000000 --- a/e107_plugins/tinymce4/langs/en.js +++ /dev/null @@ -1,179 +0,0 @@ -tinymce.addI18n('en_GB',{ -"Cut": "Cut", -"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.", -"Div": "Div", -"Paste": "Paste", -"Close": "Close", -"Font Family": "Font Family", -"Pre": "Pre", -"Align right": "Align right", -"New document": "New document", -"Blockquote": "Blockquote", -"Numbered list": "Numbered list", -"Increase indent": "Increase indent", -"Formats": "Formats", -"Headers": "Headers", -"Select all": "Select all", -"Header 3": "Header 3", -"Blocks": "Blocks", -"Undo": "Undo", -"Strikethrough": "Strike-through", -"Bullet list": "Bullet list", -"Header 1": "Header 1", -"Superscript": "Superscript", -"Clear formatting": "Clear formatting", -"Font Sizes": "Font Sizes", -"Subscript": "Subscript", -"Header 6": "Header 6", -"Redo": "Redo", -"Paragraph": "Paragraph", -"Ok": "Ok", -"Bold": "Bold", -"Code": "Code", -"Italic": "Italic", -"Align center": "Align centre", -"Header 5": "Header 5", -"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.", -"Underline": "Underline", -"Cancel": "Cancel", -"Justify": "Justify", -"Inline": "Inline", -"Copy": "Copy", -"Align left": "Align left", -"Visual aids": "Visual aids", -"Lower Greek": "Lower Greek", -"Square": "Square", -"Default": "Default", -"Lower Alpha": "Lower Alpha", -"Circle": "Circle", -"Disc": "Disc", -"Upper Alpha": "Upper Alpha", -"Upper Roman": "Upper Roman", -"Lower Roman": "Lower Roman", -"Name": "Name", -"Anchor": "Anchor", -"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", -"Right to left": "Right to left", -"Left to right": "Left to right", -"Emoticons": "Emoticons", -"Robots": "Robots", -"Document properties": "Document properties", -"Title": "Title", -"Keywords": "Keywords", -"Encoding": "Encoding", -"Description": "Description", -"Author": "Author", -"Fullscreen": "Full-screen", -"Horizontal line": "Horizontal line", -"Horizontal space": "Horizontal space", -"Insert\/edit image": "Insert\/edit image", -"General": "General", -"Advanced": "Advanced", -"Source": "Source", -"Border": "Border", -"Constrain proportions": "Constrain proportions", -"Vertical space": "Vertical space", -"Image description": "Image description", -"Style": "Style", -"Dimensions": "Dimensions", -"Insert image": "Insert image", -"Insert date\/time": "Insert date\/time", -"Remove link": "Remove link", -"Url": "URL", -"Text to display": "Text to display", -"Anchors": "Anchors", -"Insert link": "Insert 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?", -"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", -"Alternative source": "Alternative source", -"Paste your embed code below:": "Paste your embed code below:", -"Insert video": "Insert video", -"Embed": "Embed", -"Nonbreaking space": "Non-breaking space", -"Page break": "Page break", -"Paste as text": "Paste as text", -"Preview": "Preview", -"Print": "Print", -"Save": "Save", -"Could not find the specified string.": "Could not find the specified string.", -"Replace": "Replace", -"Next": "Next", -"Whole words": "Whole words", -"Find and replace": "Find and replace", -"Replace with": "Replace with", -"Find": "Find", -"Replace all": "Replace all", -"Match case": "Match case", -"Prev": "Prev", -"Spellcheck": "Spell-check", -"Finish": "Finish", -"Ignore all": "Ignore all", -"Ignore": "Ignore", -"Insert row before": "Insert row before", -"Rows": "Rows", -"Height": "Height", -"Paste row after": "Paste row after", -"Alignment": "Alignment", -"Column group": "Column group", -"Row": "Row", -"Insert column before": "Insert column before", -"Split cell": "Split cell", -"Cell padding": "Cell padding", -"Cell spacing": "Cell spacing", -"Row type": "Row type", -"Insert table": "Insert table", -"Body": "Body", -"Caption": "Caption", -"Footer": "Footer", -"Delete row": "Delete row", -"Paste row before": "Paste row before", -"Scope": "Scope", -"Delete table": "Delete table", -"Header cell": "Header cell", -"Column": "Column", -"Cell": "Cell", -"Header": "Header", -"Cell type": "Cell type", -"Copy row": "Copy row", -"Row properties": "Row properties", -"Table properties": "Table properties", -"Row group": "Row group", -"Right": "Right", -"Insert column after": "Insert column after", -"Cols": "Cols", -"Insert row after": "Insert row after", -"Width": "Width", -"Cell properties": "Cell properties", -"Left": "Left", -"Cut row": "Cut row", -"Delete column": "Delete column", -"Center": "Centre", -"Merge cells": "Merge cells", -"Insert template": "Insert template", -"Templates": "Templates", -"Background color": "Background colour", -"Text color": "Text colour", -"Show blocks": "Show blocks", -"Show invisible characters": "Show invisible characters", -"Words: {0}": "Words: {0}", -"Insert": "Insert", -"File": "File", -"Edit": "Edit", -"Rich Text Area. Press ALT-F9 for menu. Press ALT-F10 for toolbar. Press ALT-0 for help": "Rich Text Area. Press ALT-F9 for menu. Press ALT-F10 for toolbar. Press ALT-0 for help", -"Tools": "Tools", -"View": "View", -"Table": "Table", -"Format": "Format" -}); \ No newline at end of file