From 8595d45e1dfde79518db8777e5a66836e33ffd46 Mon Sep 17 00:00:00 2001 From: ephox Date: Tue, 6 Aug 2019 02:06:07 +0000 Subject: [PATCH] Added version 5.0.13 release. --- changelog.txt | 16 + composer.json | 2 +- package.json | 2 +- plugins/advlist/plugin.js | 2 +- plugins/advlist/plugin.min.js | 2 +- plugins/anchor/plugin.js | 2 +- plugins/anchor/plugin.min.js | 2 +- plugins/autolink/plugin.js | 6 +- plugins/autolink/plugin.min.js | 4 +- plugins/autoresize/plugin.js | 2 +- plugins/autoresize/plugin.min.js | 2 +- plugins/autosave/plugin.js | 2 +- plugins/autosave/plugin.min.js | 2 +- plugins/bbcode/plugin.js | 2 +- plugins/bbcode/plugin.min.js | 2 +- plugins/charmap/plugin.js | 2 +- plugins/charmap/plugin.min.js | 2 +- plugins/code/plugin.js | 2 +- plugins/code/plugin.min.js | 2 +- plugins/codesample/plugin.js | 2 +- plugins/codesample/plugin.min.js | 2 +- plugins/colorpicker/plugin.js | 2 +- plugins/colorpicker/plugin.min.js | 2 +- plugins/contextmenu/plugin.js | 2 +- plugins/contextmenu/plugin.min.js | 2 +- plugins/directionality/plugin.js | 2 +- plugins/directionality/plugin.min.js | 2 +- plugins/emoticons/js/emojis.js | 4 +- plugins/emoticons/js/emojis.min.js | 2 +- plugins/emoticons/plugin.js | 231 +---- plugins/emoticons/plugin.min.js | 4 +- plugins/fullpage/plugin.js | 2 +- plugins/fullpage/plugin.min.js | 2 +- plugins/fullscreen/plugin.js | 2 +- plugins/fullscreen/plugin.min.js | 2 +- plugins/help/plugin.js | 2 +- plugins/help/plugin.min.js | 2 +- plugins/hr/plugin.js | 2 +- plugins/hr/plugin.min.js | 2 +- plugins/image/plugin.js | 641 ++++++++++-- plugins/image/plugin.min.js | 4 +- plugins/imagetools/plugin.js | 99 +- plugins/imagetools/plugin.min.js | 4 +- plugins/importcss/plugin.js | 2 +- plugins/importcss/plugin.min.js | 2 +- plugins/insertdatetime/plugin.js | 2 +- plugins/insertdatetime/plugin.min.js | 2 +- plugins/legacyoutput/plugin.js | 2 +- plugins/legacyoutput/plugin.min.js | 2 +- plugins/link/plugin.js | 758 +++++++++++--- plugins/link/plugin.min.js | 4 +- plugins/lists/plugin.js | 796 +++++++-------- plugins/lists/plugin.min.js | 4 +- plugins/media/plugin.js | 2 +- plugins/media/plugin.min.js | 2 +- plugins/nonbreaking/plugin.js | 42 +- plugins/nonbreaking/plugin.min.js | 4 +- plugins/noneditable/plugin.js | 2 +- plugins/noneditable/plugin.min.js | 2 +- plugins/pagebreak/plugin.js | 2 +- plugins/pagebreak/plugin.min.js | 2 +- plugins/paste/plugin.js | 657 ++++++++++-- plugins/paste/plugin.min.js | 4 +- plugins/preview/plugin.js | 2 +- plugins/preview/plugin.min.js | 2 +- plugins/print/plugin.js | 2 +- plugins/print/plugin.min.js | 2 +- plugins/quickbars/plugin.js | 43 +- plugins/quickbars/plugin.min.js | 4 +- plugins/save/plugin.js | 2 +- plugins/save/plugin.min.js | 2 +- plugins/searchreplace/plugin.js | 105 +- plugins/searchreplace/plugin.min.js | 4 +- plugins/spellchecker/plugin.js | 2 +- plugins/spellchecker/plugin.min.js | 2 +- plugins/tabfocus/plugin.js | 2 +- plugins/tabfocus/plugin.min.js | 2 +- plugins/table/plugin.js | 36 +- plugins/table/plugin.min.js | 4 +- plugins/template/plugin.js | 2 +- plugins/template/plugin.min.js | 2 +- plugins/textcolor/plugin.js | 2 +- plugins/textcolor/plugin.min.js | 2 +- plugins/textpattern/plugin.js | 2 +- plugins/textpattern/plugin.min.js | 2 +- plugins/toc/plugin.js | 2 +- plugins/toc/plugin.min.js | 2 +- plugins/visualblocks/plugin.js | 2 +- plugins/visualblocks/plugin.min.js | 2 +- plugins/visualchars/plugin.js | 227 +++-- plugins/visualchars/plugin.min.js | 4 +- plugins/wordcount/plugin.js | 2 +- plugins/wordcount/plugin.min.js | 2 +- skins/ui/oxide-dark/skin.css | 54 +- skins/ui/oxide-dark/skin.min.css | 2 +- skins/ui/oxide/skin.css | 54 +- skins/ui/oxide/skin.min.css | 2 +- themes/mobile/theme.js | 707 ++++++++++--- themes/mobile/theme.min.js | 4 +- themes/silver/theme.js | 1404 ++++++++++++++++++-------- themes/silver/theme.min.js | 4 +- tinymce.js | 845 +++++++++++++--- tinymce.min.js | 4 +- 103 files changed, 4945 insertions(+), 1978 deletions(-) diff --git a/changelog.txt b/changelog.txt index e41668c2..f92324e3 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,19 @@ +Version 5.0.13 (2019-08-06) + Changed modal dialogs to prevent dragging by default and added new `draggable_modal` setting to restore dragging #TINY-3873 + Changed the nonbreaking plugin to insert nbsp characters wrapped in spans to aid in filtering. This can be disabled using the `nonbreaking_wrap` setting #TINY-3647 + Changed backspace behaviour in lists to outdent nested list items when the cursor is at the start of the list item #TINY-3651 + Fixed sidebar growing beyond editor bounds in IE 11 #TINY-3937 + Fixed issue with being unable to keyboard navigate disabled toolbar buttons #TINY-3350 + Fixed issues with backspace and delete in nested contenteditable true and false elements #TINY-3868 + Fixed issue with losing keyboard navigation in dialogs due to disabled buttons #TINY-3914 + Fixed `MouseEvent.mozPressure is deprecated` warning in Firefox #TINY-3919 + Fixed `default_link_target` not being respected when `target_list` is disabled #TINY-3757 + Fixed mobile plugin filter to only apply to the mobile theme, rather than all mobile platforms #TINY-3405 + Fixed focus switching to another editor during mode changes #TINY-3852 + Fixed an exception being thrown when clicking on an uninitialized inline editor #TINY-3925 + Fixed unable to keyboard navigate to dialog menu buttons #TINY-3933 + Fixed dialogs being able to be dragged outside the window viewport #TINY-3787 + Fixed inline dialogs appearing above modal dialogs #TINY-3932 Version 5.0.12 (2019-07-18) Added ability to utilize UI dialog panels inside other panels #TINY-3305 Added help dialog tab explaining keyboard navigation of the editor #TINY-3603 diff --git a/composer.json b/composer.json index 8546075e..0dbb2c21 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "tinymce/tinymce", - "version": "5.0.12", + "version": "5.0.13", "description": "Web based JavaScript HTML WYSIWYG editor control.", "license": [ "LGPL-2.1-only" diff --git a/package.json b/package.json index 30f2fd0a..f03db3f3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tinymce", - "version": "5.0.12", + "version": "5.0.13", "repository": { "type": "git", "url": "/~https://github.com/tinymce/tinymce-dist.git" diff --git a/plugins/advlist/plugin.js b/plugins/advlist/plugin.js index a39428a0..fa750e6c 100644 --- a/plugins/advlist/plugin.js +++ b/plugins/advlist/plugin.js @@ -4,7 +4,7 @@ * For LGPL see License.txt in the project root for license information. * For commercial licenses see https://www.tiny.cloud/ * - * Version: 5.0.12 (2019-07-18) + * Version: 5.0.13 (2019-08-06) */ (function () { 'use strict'; diff --git a/plugins/advlist/plugin.min.js b/plugins/advlist/plugin.min.js index 750cbc32..219f91d6 100644 --- a/plugins/advlist/plugin.min.js +++ b/plugins/advlist/plugin.min.js @@ -4,6 +4,6 @@ * For LGPL see License.txt in the project root for license information. * For commercial licenses see https://www.tiny.cloud/ * - * Version: 5.0.12 (2019-07-18) + * Version: 5.0.13 (2019-08-06) */ !function(){"use strict";var n,t,e,r,u=tinymce.util.Tools.resolve("tinymce.PluginManager"),v=tinymce.util.Tools.resolve("tinymce.util.Tools"),O=function(n,t,e){var r="UL"===t?"InsertUnorderedList":"InsertOrderedList";n.execCommand(r,!1,!1===e?null:{"list-style-type":e})},o=function(e){e.addCommand("ApplyUnorderedListStyle",function(n,t){O(e,"UL",t["list-style-type"])}),e.addCommand("ApplyOrderedListStyle",function(n,t){O(e,"OL",t["list-style-type"])})},i=function(n){var t=n.getParam("advlist_number_styles","default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman");return t?t.split(/[ ,]/):[]},l=function(n){var t=n.getParam("advlist_bullet_styles","default,circle,square");return t?t.split(/[ ,]/):[]},c=function(n){return function(){return n}},s=c(!1),f=c(!0),a=s,d=f,g=function(){return p},p=(r={fold:function(n,t){return n()},is:a,isSome:a,isNone:d,getOr:e=function(n){return n},getOrThunk:t=function(n){return n()},getOrDie:function(n){throw new Error(n||"error: getOrDie called on none.")},getOrNull:function(){return null},getOrUndefined:function(){return undefined},or:e,orThunk:t,map:g,ap:g,each:function(){},bind:g,flatten:g,exists:a,forall:d,filter:g,equals:n=function(n){return n.isNone()},equals_:n,toArray:function(){return[]},toString:c("none()")},Object.freeze&&Object.freeze(r),r),m=function(e){var n=function(){return e},t=function(){return u},r=function(n){return n(e)},u={fold:function(n,t){return t(e)},is:function(n){return e===n},isSome:d,isNone:a,getOr:n,getOrThunk:n,getOrDie:n,getOrNull:n,getOrUndefined:n,or:t,orThunk:t,map:function(n){return m(n(e))},ap:function(n){return n.fold(g,function(n){return m(n(e))})},each:function(n){n(e)},bind:r,flatten:n,exists:r,forall:r,filter:function(n){return n(e)?u:p},equals:function(n){return n.is(e)},equals_:function(n,t){return n.fold(a,function(n){return t(e,n)})},toArray:function(){return[e]},toString:function(){return"some("+e+")"}};return u},y=function(n){return null===n||n===undefined?p:m(n)},h=function(n){return n&&/^(TH|TD)$/.test(n.nodeName)},L=function(r){return function(n){return n&&/^(OL|UL|DL)$/.test(n.nodeName)&&(e=n,(t=r).$.contains(t.getBody(),e));var t,e}},N=function(n){var t=n.dom.getParent(n.selection.getNode(),"ol,ul"),e=n.dom.getStyle(t,"listStyleType");return y(e)},S=function(n,t,e){var r=function(n,t){for(var e=0;ev(e)&&(i=o+l);var m=y(e);m&&m]*>((\xa0| |[ \t]|]*>)+?|)|
$","i").test(e)},f=function(t){var e=parseInt(a.getItem(s(t)+"time"),10)||0;return!((new Date).getTime()-e>u(t.settings.autosave_retention,"20m"))||(l(t,!1),!1)},l=function(t,e){var r=s(t);a.removeItem(r+"draft"),a.removeItem(r+"time"),!1!==e&&t.fire("RemoveDraft")},m=function(t){var e=s(t);!c(t)&&t.isDirty()&&(a.setItem(e+"draft",t.getContent({format:"raw",no_events:!0})),a.setItem(e+"time",(new Date).getTime().toString()),t.fire("StoreDraft"))},v=function(t){var e=s(t);f(t)&&(t.setContent(a.getItem(e+"draft"),{format:"raw"}),t.fire("RestoreDraft"))},d=function(t,e){var r=u(t.settings.autosave_interval,"30s");e.get()||(n.setInterval(function(){t.removed||m(t)},r),e.set(!0))},g=function(t){t.undoManager.transact(function(){v(t),l(t)}),t.focus()};function y(n){for(var o=[],t=1;t(.*?)<\/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,"&"),t},i=function(t){t=e.trim(t);var o=function(o,e){t=t.replace(o,e)};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 '),t};!function n(){o.add("bbcode",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=t(o.content))})})}()}(); \ No newline at end of file diff --git a/plugins/charmap/plugin.js b/plugins/charmap/plugin.js index 1b0ad9ec..7c8c271f 100644 --- a/plugins/charmap/plugin.js +++ b/plugins/charmap/plugin.js @@ -4,7 +4,7 @@ * For LGPL see License.txt in the project root for license information. * For commercial licenses see https://www.tiny.cloud/ * - * Version: 5.0.12 (2019-07-18) + * Version: 5.0.13 (2019-08-06) */ (function (domGlobals) { 'use strict'; diff --git a/plugins/charmap/plugin.min.js b/plugins/charmap/plugin.min.js index 6c42066e..6907f763 100644 --- a/plugins/charmap/plugin.min.js +++ b/plugins/charmap/plugin.min.js @@ -4,6 +4,6 @@ * For LGPL see License.txt in the project root for license information. * For commercial licenses see https://www.tiny.cloud/ * - * Version: 5.0.12 (2019-07-18) + * Version: 5.0.13 (2019-08-06) */ !function(l){"use strict";var n,e,r,t,a=tinymce.util.Tools.resolve("tinymce.PluginManager"),i=function(n,e){return n.fire("insertCustomChar",{chr:e})},f=function(n,e){var r=i(n,e).chr;n.execCommand("mceInsertContent",!1,r)},o=tinymce.util.Tools.resolve("tinymce.util.Tools"),c=function(n){return n.settings.charmap},u=function(n){return n.settings.charmap_append},s=function(n){return function(){return n}},g=s(!1),m=s(!0),h=g,d=m,p=function(){return y},y=(t={fold:function(n,e){return n()},is:h,isSome:h,isNone:d,getOr:r=function(n){return n},getOrThunk:e=function(n){return n()},getOrDie:function(n){throw new Error(n||"error: getOrDie called on none.")},getOrNull:function(){return null},getOrUndefined:function(){return undefined},or:r,orThunk:e,map:p,ap:p,each:function(){},bind:p,flatten:p,exists:h,forall:d,filter:p,equals:n=function(n){return n.isNone()},equals_:n,toArray:function(){return[]},toString:s("none()")},Object.freeze&&Object.freeze(t),t),w=function(r){var n=function(){return r},e=function(){return a},t=function(n){return n(r)},a={fold:function(n,e){return e(r)},is:function(n){return r===n},isSome:d,isNone:h,getOr:n,getOrThunk:n,getOrDie:n,getOrNull:n,getOrUndefined:n,or:e,orThunk:e,map:function(n){return w(n(r))},ap:function(n){return n.fold(p,function(n){return w(n(r))})},each:function(n){n(r)},bind:t,flatten:n,exists:t,forall:t,filter:function(n){return n(r)?a:y},equals:function(n){return n.is(r)},equals_:function(n,e){return n.fold(h,function(n){return e(r,n)})},toArray:function(){return[r]},toString:function(){return"some("+r+")"}};return a},b={some:w,none:p,from:function(n){return null===n||n===undefined?y:w(n)}},v=function(e){return function(n){return function(n){if(null===n)return"null";var e=typeof n;return"object"===e&&(Array.prototype.isPrototypeOf(n)||n.constructor&&"Array"===n.constructor.name)?"array":"object"===e&&(String.prototype.isPrototypeOf(n)||n.constructor&&"String"===n.constructor.name)?"string":e}(n)===e}},k=v("array"),C=v("function"),A=Array.prototype.slice,O=function(n,e){for(var r=n.length,t=new Array(r),a=0;ae.length)break e;if(!(h instanceof a)){u.lastIndex=0;var m=u.exec(h);if(m){g&&(d=m[1].length);var b=m.index-1+d,y=b+(m=m[0].slice(d)).length,v=h.slice(0,b+1),k=h.slice(y+1),w=[f,1];v&&w.push(v);var x=new a(o,c?S.tokenize(m,c):m,p);w.push(x),k&&w.push(k),Array.prototype.splice.apply(r,w)}}}}}return r},hooks:{all:{},add:function(e,t){var n=S.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=S.hooks.all[e];if(n&&n.length)for(var a=0,r=void 0;r=n[a++];)r(t)}}},s=S.Token=function(e,t,n){this.type=e,this.content=t,this.alias=n};if(s.stringify=function(t,n,e){if("string"==typeof t)return t;if("Array"===S.util.type(t))return t.map(function(e){return s.stringify(e,n,t)}).join("");var a={type:t.type,content:s.stringify(t.content,n,e),tag:"span",classes:["token",t.type],attributes:{},language:n,parent:e};if("comment"===a.type&&(a.attributes.spellcheck="true"),t.alias){var r="Array"===S.util.type(t.alias)?t.alias:[t.alias];Array.prototype.push.apply(a.classes,r)}S.hooks.run("wrap",a);var i="";for(var o in a.attributes)i+=(i?" ":"")+o+'="'+(a.attributes[o]||"")+'"';return"<"+a.tag+' class="'+a.classes.join(" ")+'" '+i+">"+a.content+""},!g.document)return g.addEventListener&&g.addEventListener("message",function(e){var t=JSON.parse(e.data),n=t.language,a=t.code,r=t.immediateClose;g.postMessage(S.highlight(a,S.languages[n],n)),r&&g.close()},!1),g.Prism}();void 0!==n&&(n.Prism=i),i.languages.markup={comment://,prolog:/<\?[\w\W]+?\?>/,doctype://,cdata://i,tag:{pattern:/<\/?[^\s>\/=.]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\\1|\\?(?!\1)[\w\W])*\1|[^\s'">=]+))?)*\s*\/?>/i,inside:{tag:{pattern:/^<\/?[^\s>\/]+/i,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"attr-value":{pattern:/=(?:('|")[\w\W]*?(\1)|[^\s>]+)/i,inside:{punctuation:/[=>"']/}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:/&#?[\da-z]{1,8};/i},i.hooks.add("wrap",function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&/,"&"))}),i.languages.xml=i.languages.markup,i.languages.html=i.languages.markup,i.languages.mathml=i.languages.markup,i.languages.svg=i.languages.markup,i.languages.css={comment:/\/\*[\w\W]*?\*\//,atrule:{pattern:/@[\w-]+?.*?(;|(?=\s*\{))/i,inside:{rule:/@[\w-]+/}},url:/url\((?:(["'])(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1|.*?)\)/i,selector:/[^\{\}\s][^\{\};]*?(?=\s*\{)/,string:/("|')(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1/,property:/(\b|\B)[\w-]+(?=\s*:)/i,important:/\B!important\b/i,"function":/[-a-z0-9]+(?=\()/i,punctuation:/[(){};:]/},i.languages.css.atrule.inside.rest=i.util.clone(i.languages.css),i.languages.markup&&(i.languages.insertBefore("markup","tag",{style:{pattern:/[\w\W]*?<\/style>/i,inside:{tag:{pattern:/|<\/style>/i,inside:i.languages.markup.tag.inside},rest:i.languages.css},alias:"language-css"}}),i.languages.insertBefore("inside","attr-value",{"style-attr":{pattern:/\s*style=("|').*?\1/i,inside:{"attr-name":{pattern:/^\s*style/i,inside:i.languages.markup.tag.inside},punctuation:/^\s*=\s*['"]|['"]\s*$/,"attr-value":{pattern:/.+/i,inside:i.languages.css}},alias:"language-css"}},i.languages.markup.tag)),i.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\w\W]*?\*\//,lookbehind:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0}],string:/(["'])(\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,"class-name":{pattern:/((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[a-z0-9_\.\\]+/i,lookbehind:!0,inside:{punctuation:/(\.|\\)/}},keyword:/\b(if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,"boolean":/\b(true|false)\b/,"function":/[a-z0-9_]+(?=\()/i,number:/\b-?(?:0x[\da-f]+|\d*\.?\d+(?:e[+-]?\d+)?)\b/i,operator:/--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/,punctuation:/[{}[\];(),.:]/},i.languages.javascript=i.languages.extend("clike",{keyword:/\b(as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|false|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|true|try|typeof|var|void|while|with|yield)\b/,number:/\b-?(0x[\dA-Fa-f]+|0b[01]+|0o[0-7]+|\d*\.?\d+([Ee][+-]?\d+)?|NaN|Infinity)\b/,"function":/[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*(?=\()/i}),i.languages.insertBefore("javascript","keyword",{regex:{pattern:/(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\\\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})]))/,lookbehind:!0}}),i.languages.insertBefore("javascript","class-name",{"template-string":{pattern:/`(?:\\`|\\?[^`])*`/,inside:{interpolation:{pattern:/\$\{[^}]+\}/,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:i.languages.javascript}},string:/[\s\S]+/}}}),i.languages.markup&&i.languages.insertBefore("markup","tag",{script:{pattern:/[\w\W]*?<\/script>/i,inside:{tag:{pattern:/|<\/script>/i,inside:i.languages.markup.tag.inside},rest:i.languages.javascript},alias:"language-javascript"}}),i.languages.js=i.languages.javascript,i.languages.c=i.languages.extend("clike",{keyword:/\b(asm|typeof|inline|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|union|unsigned|void|volatile|while)\b/,operator:/\-[>-]?|\+\+?|!=?|<>?=?|==?|&&?|\|?\||[~^%?*\/]/,number:/\b-?(?:0x[\da-f]+|\d*\.?\d+(?:e[+-]?\d+)?)[ful]*\b/i}),i.languages.insertBefore("c","string",{macro:{pattern:/(^\s*)#\s*[a-z]+([^\r\n\\]|\\.|\\(?:\r\n?|\n))*/im,lookbehind:!0,alias:"property",inside:{string:{pattern:/(#\s*include\s*)(<.+?>|("|')(\\?.)+?\3)/,lookbehind:!0}}}}),delete i.languages.c["class-name"],delete i.languages.c["boolean"],i.languages.csharp=i.languages.extend("clike",{keyword:/\b(abstract|as|async|await|base|bool|break|byte|case|catch|char|checked|class|const|continue|decimal|default|delegate|do|double|else|enum|event|explicit|extern|false|finally|fixed|float|for|foreach|goto|if|implicit|in|int|interface|internal|is|lock|long|namespace|new|null|object|operator|out|override|params|private|protected|public|readonly|ref|return|sbyte|sealed|short|sizeof|stackalloc|static|string|struct|switch|this|throw|true|try|typeof|uint|ulong|unchecked|unsafe|ushort|using|virtual|void|volatile|while|add|alias|ascending|async|await|descending|dynamic|from|get|global|group|into|join|let|orderby|partial|remove|select|set|value|var|where|yield)\b/,string:[/@("|')(\1\1|\\\1|\\?(?!\1)[\s\S])*\1/,/("|')(\\?.)*?\1/],number:/\b-?(0x[\da-f]+|\d*\.?\d+)\b/i}),i.languages.insertBefore("csharp","keyword",{preprocessor:{pattern:/(^\s*)#.*/m,lookbehind:!0}}),i.languages.cpp=i.languages.extend("c",{keyword:/\b(alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|class|compl|const|constexpr|const_cast|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|float|for|friend|goto|if|inline|int|long|mutable|namespace|new|noexcept|nullptr|operator|private|protected|public|register|reinterpret_cast|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,"boolean":/\b(true|false)\b/,operator:/[-+]{1,2}|!=?|<{1,2}=?|>{1,2}=?|\->|:{1,2}|={1,2}|\^|~|%|&{1,2}|\|?\||\?|\*|\/|\b(and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/}),i.languages.insertBefore("cpp","keyword",{"class-name":{pattern:/(class\s+)[a-z0-9_]+/i,lookbehind:!0}}),i.languages.java=i.languages.extend("clike",{keyword:/\b(abstract|continue|for|new|switch|assert|default|goto|package|synchronized|boolean|do|if|private|this|break|double|implements|protected|throw|byte|else|import|public|throws|case|enum|instanceof|return|transient|catch|extends|int|short|try|char|final|interface|static|void|class|finally|long|strictfp|volatile|const|float|native|super|while)\b/,number:/\b0b[01]+\b|\b0x[\da-f]*\.?[\da-fp\-]+\b|\b\d*\.?\d+(?:e[+-]?\d+)?[df]?\b/i,operator:{pattern:/(^|[^.])(?:\+[+=]?|-[-=]?|!=?|<>?>?=?|==?|&[&=]?|\|[|=]?|\*=?|\/=?|%=?|\^=?|[?:~])/m,lookbehind:!0}}),i.languages.php=i.languages.extend("clike",{keyword:/\b(and|or|xor|array|as|break|case|cfunction|class|const|continue|declare|default|die|do|else|elseif|enddeclare|endfor|endforeach|endif|endswitch|endwhile|extends|for|foreach|function|include|include_once|global|if|new|return|static|switch|use|require|require_once|var|while|abstract|interface|public|implements|private|protected|parent|throw|null|echo|print|trait|namespace|final|yield|goto|instanceof|finally|try|catch)\b/i,constant:/\b[A-Z0-9_]{2,}\b/,comment:{pattern:/(^|[^\\])(?:\/\*[\w\W]*?\*\/|\/\/.*)/,lookbehind:!0}}),i.languages.insertBefore("php","class-name",{"shell-comment":{pattern:/(^|[^\\])#.*/,lookbehind:!0,alias:"comment"}}),i.languages.insertBefore("php","keyword",{delimiter:/\?>|<\?(?:php)?/i,variable:/\$\w+\b/i,"package":{pattern:/(\\|namespace\s+|use\s+)[\w\\]+/,lookbehind:!0,inside:{punctuation:/\\/}}}),i.languages.insertBefore("php","operator",{property:{pattern:/(->)[\w]+/,lookbehind:!0}}),i.languages.markup&&(i.hooks.add("before-highlight",function(t){"php"===t.language&&(t.tokenStack=[],t.backupCode=t.code,t.code=t.code.replace(/(?:<\?php|<\?)[\w\W]*?(?:\?>)/gi,function(e){return t.tokenStack.push(e),"{{{PHP"+t.tokenStack.length+"}}}"}))}),i.hooks.add("before-insert",function(e){"php"===e.language&&(e.code=e.backupCode,delete e.backupCode)}),i.hooks.add("after-highlight",function(e){if("php"===e.language){for(var t=0,n=void 0;n=e.tokenStack[t];t++)e.highlightedCode=e.highlightedCode.replace("{{{PHP"+(t+1)+"}}}",i.highlight(n,e.grammar,"php").replace(/\$/g,"$$$$"));e.element.innerHTML=e.highlightedCode}}),i.hooks.add("wrap",function(e){"php"===e.language&&"markup"===e.type&&(e.content=e.content.replace(/(\{\{\{PHP[0-9]+\}\}\})/g,'$1'))}),i.languages.insertBefore("php","comment",{markup:{pattern:/<[^?]\/?(.*?)>/,inside:i.languages.markup},php:/\{\{\{PHP[0-9]+\}\}\}/})),i.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0},string:/"""[\s\S]+?"""|'''[\s\S]+?'''|("|')(?:\\?.)*?\1/,"function":{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_][a-zA-Z0-9_]*(?=\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)[a-z0-9_]+/i,lookbehind:!0},keyword:/\b(?:as|assert|async|await|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|pass|print|raise|return|try|while|with|yield)\b/,"boolean":/\b(?:True|False)\b/,number:/\b-?(?:0[bo])?(?:(?:\d|0x[\da-f])[\da-f]*\.?\d*|\.\d+)(?:e[+-]?\d+)?j?\b/i,operator:/[-+%=]=?|!=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]|\b(?:or|and|not)\b/,punctuation:/[{}[\];(),.:]/},function(e){e.languages.ruby=e.languages.extend("clike",{comment:/#(?!\{[^\r\n]*?\}).*/,keyword:/\b(alias|and|BEGIN|begin|break|case|class|def|define_method|defined|do|each|else|elsif|END|end|ensure|false|for|if|in|module|new|next|nil|not|or|raise|redo|require|rescue|retry|return|self|super|then|throw|true|undef|unless|until|when|while|yield)\b/});var t={pattern:/#\{[^}]+\}/,inside:{delimiter:{pattern:/^#\{|\}$/,alias:"tag"},rest:e.util.clone(e.languages.ruby)}};e.languages.insertBefore("ruby","keyword",{regex:[{pattern:/%r([^a-zA-Z0-9\s\{\(\[<])(?:[^\\]|\\[\s\S])*?\1[gim]{0,3}/,inside:{interpolation:t}},{pattern:/%r\((?:[^()\\]|\\[\s\S])*\)[gim]{0,3}/,inside:{interpolation:t}},{pattern:/%r\{(?:[^#{}\\]|#(?:\{[^}]+\})?|\\[\s\S])*\}[gim]{0,3}/,inside:{interpolation:t}},{pattern:/%r\[(?:[^\[\]\\]|\\[\s\S])*\][gim]{0,3}/,inside:{interpolation:t}},{pattern:/%r<(?:[^<>\\]|\\[\s\S])*>[gim]{0,3}/,inside:{interpolation:t}},{pattern:/(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/,lookbehind:!0}],variable:/[@$]+[a-zA-Z_][a-zA-Z_0-9]*(?:[?!]|\b)/,symbol:/:[a-zA-Z_][a-zA-Z_0-9]*(?:[?!]|\b)/}),e.languages.insertBefore("ruby","number",{builtin:/\b(Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Stat|File|Fixnum|Fload|Hash|Integer|IO|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|String|Struct|TMS|Symbol|ThreadGroup|Thread|Time|TrueClass)\b/,constant:/\b[A-Z][a-zA-Z_0-9]*(?:[?!]|\b)/}),e.languages.ruby.string=[{pattern:/%[qQiIwWxs]?([^a-zA-Z0-9\s\{\(\[<])(?:[^\\]|\\[\s\S])*?\1/,inside:{interpolation:t}},{pattern:/%[qQiIwWxs]?\((?:[^()\\]|\\[\s\S])*\)/,inside:{interpolation:t}},{pattern:/%[qQiIwWxs]?\{(?:[^#{}\\]|#(?:\{[^}]+\})?|\\[\s\S])*\}/,inside:{interpolation:t}},{pattern:/%[qQiIwWxs]?\[(?:[^\[\]\\]|\\[\s\S])*\]/,inside:{interpolation:t}},{pattern:/%[qQiIwWxs]?<(?:[^<>\\]|\\[\s\S])*>/,inside:{interpolation:t}},{pattern:/("|')(#\{[^}]+\}|\\(?:\r?\n|\r)|\\?.)*?\1/,inside:{interpolation:t}}]}(i);var a,o,s,l,u,d={isCodeSample:function M(e){return e&&"PRE"===e.nodeName&&-1!==e.className.indexOf("language-")},trimArg:function F(n){return function(e,t){return n(t)}}},p=function(e){return function(){return e}},f=p(!1),h=p(!0),m=f,b=h,y=function(){return v},v=(l={fold:function(e,t){return e()},is:m,isSome:m,isNone:b,getOr:s=function(e){return e},getOrThunk:o=function(e){return e()},getOrDie:function(e){throw new Error(e||"error: getOrDie called on none.")},getOrNull:function(){return null},getOrUndefined:function(){return undefined},or:s,orThunk:o,map:y,ap:y,each:function(){},bind:y,flatten:y,exists:m,forall:b,filter:y,equals:a=function(e){return e.isNone()},equals_:a,toArray:function(){return[]},toString:p("none()")},Object.freeze&&Object.freeze(l),l),k=function(n){var e=function(){return n},t=function(){return r},a=function(e){return e(n)},r={fold:function(e,t){return t(n)},is:function(e){return n===e},isSome:b,isNone:m,getOr:e,getOrThunk:e,getOrDie:e,getOrNull:e,getOrUndefined:e,or:t,orThunk:t,map:function(e){return k(e(n))},ap:function(e){return e.fold(y,function(e){return k(e(n))})},each:function(e){e(n)},bind:a,flatten:e,exists:a,forall:a,filter:function(e){return e(n)?r:v},equals:function(e){return e.is(n)},equals_:function(e,t){return e.fold(m,function(e){return t(n,e)})},toArray:function(){return[n]},toString:function(){return"some("+n+")"}};return r},w={some:k,none:y,from:function(e){return null===e||e===undefined?v:k(e)}},x=function(e){var t=e.selection?e.selection.getNode():null;return d.isCodeSample(t)?w.some(t):w.none()},S=x,A=function(t,n,a){t.undoManager.transact(function(){var e=x(t);return a=r.DOM.encode(a),e.fold(function(){t.insertContent('

'+a+"
"),t.selection.select(t.$("#__new").removeAttr("id")[0])},function(e){t.dom.setAttrib(e,"class","language-"+n),e.innerHTML=a,i.highlightElement(e),t.selection.select(e)})})},C=function(e){return x(e).fold(function(){return""},function(e){return e.textContent})},_=function(e){return e.settings.codesample_languages},N=function(e){var t=_(e);return t||[{text:"HTML/XML",value:"markup"},{text:"JavaScript",value:"javascript"},{text:"CSS",value:"css"},{text:"PHP",value:"php"},{text:"Ruby",value:"ruby"},{text:"Python",value:"python"},{text:"Java",value:"java"},{text:"C",value:"c"},{text:"C#",value:"csharp"},{text:"C++",value:"cpp"}]},O=function(e,n){return S(e).fold(function(){return n},function(e){var t=e.className.match(/language-(\w+)/);return t?t[1]:n})},z=(u="function",function(e){return function(e){if(null===e)return"null";var t=typeof e;return"object"===t&&(Array.prototype.isPrototypeOf(e)||e.constructor&&"Array"===e.constructor.name)?"array":"object"===t&&(String.prototype.isPrototypeOf(e)||e.constructor&&"String"===e.constructor.name)?"string":t}(e)===u}),P=Array.prototype.slice,W=(z(Array.from)&&Array.from,function(n){var e,t=N(n),a=(e=t,0===e.length?w.none():w.some(e[0])).fold(function(){return""},function(e){return e.value}),r=O(n,a),i=C(n);n.windowManager.open({title:"Insert/Edit Code Sample",size:"large",body:{type:"panel",items:[{type:"selectbox",name:"language",label:"Language",items:t},{type:"textarea",name:"code",label:"Code view"}]},buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:{language:r,code:i},onSubmit:function(e){var t=e.getData();A(n,t.language,t.code),e.close()}})}),j=function(t){t.addCommand("codesample",function(){var e=t.selection.getNode();t.selection.isCollapsed()||d.isCodeSample(e)?W(t):t.formatter.toggle("code")})},T=function(n){var r=n.$;n.on("PreProcess",function(e){r("pre[contenteditable=false]",e.node).filter(d.trimArg(d.isCodeSample)).each(function(e,t){var n=r(t),a=t.textContent;n.attr("class",r.trim(n.attr("class"))),n.removeAttr("contentEditable"),n.empty().append(r("").each(function(){this.textContent=a}))})}),n.on("SetContent",function(){var e=r("pre").filter(d.trimArg(d.isCodeSample)).filter(function(e,t){return"false"!==t.contentEditable});e.length&&n.undoManager.transact(function(){e.each(function(e,t){r(t).find("br").each(function(e,t){t.parentNode.replaceChild(n.getDoc().createTextNode("\n"),t)}),t.contentEditable="false",t.innerHTML=n.dom.encode(t.textContent),i.highlightElement(t),t.className=r.trim(t.className)})})})},B=function(a){a.ui.registry.addToggleButton("codesample",{icon:"code-sample",tooltip:"Insert/edit code sample",onAction:function(){return W(a)},onSetup:function(n){var e=function(){var e,t;n.setActive((t=(e=a).selection.getStart(),e.dom.is(t,"pre.language-markup")))};return a.on("NodeChange",e),function(){return a.off("NodeChange",e)}}}),a.ui.registry.addMenuItem("codesample",{text:"Code sample...",icon:"code-sample",onAction:function(){return W(a)}})};!function $(){e.add("codesample",function(t){T(t),B(t),j(t),t.on("dblclick",function(e){d.isCodeSample(e.target)&&W(t)})})}()}(window); \ No newline at end of file diff --git a/plugins/colorpicker/plugin.js b/plugins/colorpicker/plugin.js index 475ffcea..1d2c7c32 100644 --- a/plugins/colorpicker/plugin.js +++ b/plugins/colorpicker/plugin.js @@ -4,7 +4,7 @@ * For LGPL see License.txt in the project root for license information. * For commercial licenses see https://www.tiny.cloud/ * - * Version: 5.0.12 (2019-07-18) + * Version: 5.0.13 (2019-08-06) */ (function (domGlobals) { 'use strict'; diff --git a/plugins/colorpicker/plugin.min.js b/plugins/colorpicker/plugin.min.js index 8c8ca4dd..7dd70ef1 100644 --- a/plugins/colorpicker/plugin.min.js +++ b/plugins/colorpicker/plugin.min.js @@ -4,6 +4,6 @@ * For LGPL see License.txt in the project root for license information. * For commercial licenses see https://www.tiny.cloud/ * - * Version: 5.0.12 (2019-07-18) + * Version: 5.0.13 (2019-08-06) */ !function(o){"use strict";var i=tinymce.util.Tools.resolve("tinymce.PluginManager");!function n(){i.add("colorpicker",function(){o.console.warn("Color picker plugin is now built in to the core editor, please remove it from your editor configuration")})}()}(window); \ No newline at end of file diff --git a/plugins/contextmenu/plugin.js b/plugins/contextmenu/plugin.js index 4208567a..245f7f2d 100644 --- a/plugins/contextmenu/plugin.js +++ b/plugins/contextmenu/plugin.js @@ -4,7 +4,7 @@ * For LGPL see License.txt in the project root for license information. * For commercial licenses see https://www.tiny.cloud/ * - * Version: 5.0.12 (2019-07-18) + * Version: 5.0.13 (2019-08-06) */ (function (domGlobals) { 'use strict'; diff --git a/plugins/contextmenu/plugin.min.js b/plugins/contextmenu/plugin.min.js index 40b6506e..5a9c7130 100644 --- a/plugins/contextmenu/plugin.min.js +++ b/plugins/contextmenu/plugin.min.js @@ -4,6 +4,6 @@ * For LGPL see License.txt in the project root for license information. * For commercial licenses see https://www.tiny.cloud/ * - * Version: 5.0.12 (2019-07-18) + * Version: 5.0.13 (2019-08-06) */ !function(n){"use strict";var o=tinymce.util.Tools.resolve("tinymce.PluginManager");!function e(){o.add("contextmenu",function(){n.console.warn("Context menu plugin is now built in to the core editor, please remove it from your editor configuration")})}()}(window); \ No newline at end of file diff --git a/plugins/directionality/plugin.js b/plugins/directionality/plugin.js index 57c5db77..a0acfa29 100644 --- a/plugins/directionality/plugin.js +++ b/plugins/directionality/plugin.js @@ -4,7 +4,7 @@ * For LGPL see License.txt in the project root for license information. * For commercial licenses see https://www.tiny.cloud/ * - * Version: 5.0.12 (2019-07-18) + * Version: 5.0.13 (2019-08-06) */ (function (domGlobals) { 'use strict'; diff --git a/plugins/directionality/plugin.min.js b/plugins/directionality/plugin.min.js index f3b61e50..ba77b789 100644 --- a/plugins/directionality/plugin.min.js +++ b/plugins/directionality/plugin.min.js @@ -4,6 +4,6 @@ * For LGPL see License.txt in the project root for license information. * For commercial licenses see https://www.tiny.cloud/ * - * Version: 5.0.12 (2019-07-18) + * Version: 5.0.13 (2019-08-06) */ !function(c){"use strict";var n,t,e,r,o,u,i=tinymce.util.Tools.resolve("tinymce.PluginManager"),f=tinymce.util.Tools.resolve("tinymce.util.Tools"),d=function(n,t){var e,r=n.dom,o=n.selection.getSelectedBlocks();o.length&&(e=r.getAttrib(o[0],"dir"),f.each(o,function(n){r.getParent(n.parentNode,'*[dir="'+t+'"]',r.getRoot())||r.setAttrib(n,"dir",e!==t?t:null)}),n.nodeChanged())},l=function(n){n.addCommand("mceDirectionLTR",function(){d(n,"ltr")}),n.addCommand("mceDirectionRTL",function(){d(n,"rtl")})},a=function(n){return function(){return n}},m=a(!1),N=a(!0),s=m,g=N,T=function(){return E},E=(r={fold:function(n,t){return n()},is:s,isSome:s,isNone:g,getOr:e=function(n){return n},getOrThunk:t=function(n){return n()},getOrDie:function(n){throw new Error(n||"error: getOrDie called on none.")},getOrNull:function(){return null},getOrUndefined:function(){return undefined},or:e,orThunk:t,map:T,ap:T,each:function(){},bind:T,flatten:T,exists:s,forall:g,filter:T,equals:n=function(n){return n.isNone()},equals_:n,toArray:function(){return[]},toString:a("none()")},Object.freeze&&Object.freeze(r),r),O=function(e){var n=function(){return e},t=function(){return o},r=function(n){return n(e)},o={fold:function(n,t){return t(e)},is:function(n){return e===n},isSome:g,isNone:s,getOr:n,getOrThunk:n,getOrDie:n,getOrNull:n,getOrUndefined:n,or:t,orThunk:t,map:function(n){return O(n(e))},ap:function(n){return n.fold(T,function(n){return O(n(e))})},each:function(n){n(e)},bind:r,flatten:n,exists:r,forall:r,filter:function(n){return n(e)?o:E},equals:function(n){return n.is(e)},equals_:function(n,t){return n.fold(s,function(n){return t(e,n)})},toArray:function(){return[e]},toString:function(){return"some("+e+")"}};return o},y=function(n){return null===n||n===undefined?E:O(n)},D=function(n){if(null===n||n===undefined)throw new Error("Node cannot be null or undefined");return{dom:a(n)}},p={fromHtml:function(n,t){var e=(t||c.document).createElement("div");if(e.innerHTML=n,!e.hasChildNodes()||1Could not load emoticons

"}]},buttons:[{type:"cancel",text:"Close",primary:!0}],initialData:{pattern:"",results:[]}}),s.focus(K),s.unblock()}))},W=function(n,t){var r=function(){return Q(n,t)};n.ui.registry.addButton("emoticons",{tooltip:"Emoticons",icon:"emoji",onAction:r}),n.ui.registry.addMenuItem("emoticons",{text:"Emoticons...",icon:"emoji",onAction:r})};!function X(){i.add("emoticons",function(n,t){var e,o,r=U(n,t),i=J(n,r);W(n,i),o=i,(e=n).ui.registry.addAutocompleter("emoticons",{ch:":",columns:"auto",minChars:2,fetch:function(t,r){return o.waitForLoad().then(function(){var n=o.listAll();return T(n,t,v.some(r))})},onAction:function(n,t,r){e.selection.setRng(t),e.insertContent(r),n.hide()}})})}()}(window); \ No newline at end of file +!function(m){"use strict";var n,t,e,r,o,u,i=tinymce.util.Tools.resolve("tinymce.PluginManager"),c=function(n){return function(){return n}},a=c(!1),l=c(!0),s=a,f=l,g=function(){return d},d=(r={fold:function(n,t){return n()},is:s,isSome:s,isNone:f,getOr:e=function(n){return n},getOrThunk:t=function(n){return n()},getOrDie:function(n){throw new Error(n||"error: getOrDie called on none.")},getOrNull:function(){return null},getOrUndefined:function(){return undefined},or:e,orThunk:t,map:g,ap:g,each:function(){},bind:g,flatten:g,exists:s,forall:f,filter:g,equals:n=function(n){return n.isNone()},equals_:n,toArray:function(){return[]},toString:c("none()")},Object.freeze&&Object.freeze(r),r),y=function(e){var n=function(){return e},t=function(){return o},r=function(n){return n(e)},o={fold:function(n,t){return t(e)},is:function(n){return e===n},isSome:f,isNone:s,getOr:n,getOrThunk:n,getOrDie:n,getOrNull:n,getOrUndefined:n,or:t,orThunk:t,map:function(n){return y(n(e))},ap:function(n){return n.fold(g,function(n){return y(n(e))})},each:function(n){n(e)},bind:r,flatten:n,exists:r,forall:r,filter:function(n){return n(e)?o:d},equals:function(n){return n.is(e)},equals_:function(n,t){return n.fold(s,function(n){return t(e,n)})},toArray:function(){return[e]},toString:function(){return"some("+e+")"}};return o},p={some:y,none:g,from:function(n){return null===n||n===undefined?d:y(n)}},v=(o="function",function(n){return function(n){if(null===n)return"null";var t=typeof n;return"object"===t&&(Array.prototype.isPrototypeOf(n)||n.constructor&&"Array"===n.constructor.name)?"array":"object"===t&&(String.prototype.isPrototypeOf(n)||n.constructor&&"String"===n.constructor.name)?"string":t}(n)===o}),h=Array.prototype.slice,b=function(n,t){for(var e=0,r=n.length;eCould not load emoticons

"}]},buttons:[{type:"cancel",text:"Close",primary:!0}],initialData:{pattern:"",results:[]}}),f.focus(R),f.unblock()}))},G=function(n,t){var e=function(){return B(n,t)};n.ui.registry.addButton("emoticons",{tooltip:"Emoticons",icon:"emoji",onAction:e}),n.ui.registry.addMenuItem("emoticons",{text:"Emoticons...",icon:"emoji",onAction:e})};!function H(){i.add("emoticons",function(n,t){var r,o,e=N(n,t),i=E(n),u=U(n,e,i);G(n,u),o=u,(r=n).ui.registry.addAutocompleter("emoticons",{ch:":",columns:"auto",minChars:2,fetch:function(t,e){return o.waitForLoad().then(function(){var n=o.listAll();return A(n,t,p.some(e))})},onAction:function(n,t,e){r.selection.setRng(t),r.insertContent(e),n.hide()}})})}()}(window); \ No newline at end of file diff --git a/plugins/fullpage/plugin.js b/plugins/fullpage/plugin.js index b387c14e..c0800323 100644 --- a/plugins/fullpage/plugin.js +++ b/plugins/fullpage/plugin.js @@ -4,7 +4,7 @@ * For LGPL see License.txt in the project root for license information. * For commercial licenses see https://www.tiny.cloud/ * - * Version: 5.0.12 (2019-07-18) + * Version: 5.0.13 (2019-08-06) */ (function (domGlobals) { 'use strict'; diff --git a/plugins/fullpage/plugin.min.js b/plugins/fullpage/plugin.min.js index 0ed0b766..a239f3b3 100644 --- a/plugins/fullpage/plugin.min.js +++ b/plugins/fullpage/plugin.min.js @@ -4,6 +4,6 @@ * For LGPL see License.txt in the project root for license information. * For commercial licenses see https://www.tiny.cloud/ * - * Version: 5.0.12 (2019-07-18) + * Version: 5.0.13 (2019-08-06) */ !function(m){"use strict";var o,i=function(e){var t=e,n=function(){return t};return{get:n,set:function(e){t=e},clone:function(){return i(n())}}},e=tinymce.util.Tools.resolve("tinymce.PluginManager"),g=tinymce.util.Tools.resolve("tinymce.util.Tools"),t=tinymce.util.Tools.resolve("tinymce.html.DomParser"),f=tinymce.util.Tools.resolve("tinymce.html.Node"),p=tinymce.util.Tools.resolve("tinymce.html.Serializer"),h=function(e){return e.getParam("fullpage_hide_in_source_view")},l=function(e){return e.getParam("fullpage_default_xml_pi")},a=function(e){return e.getParam("fullpage_default_encoding")},c=function(e){return e.getParam("fullpage_default_font_family")},s=function(e){return e.getParam("fullpage_default_font_size")},u=function(e){return e.getParam("fullpage_default_text_color")},d=function(e){return e.getParam("fullpage_default_title")},y=function(e){return e.getParam("fullpage_default_doctype","")},v=function(e){return t({validate:!1,root_name:"#document"}).parse(e)},_=v,n=function(e,t){var n,i,r=v(t),l={};function o(e,t){return e.attr(t)||""}return l.fontface=c(e),l.fontsize=s(e),7===(n=r.firstChild).type&&(l.xml_pi=!0,(i=/encoding="([^"]+)"/.exec(n.value))&&(l.docencoding=i[1])),(n=r.getAll("#doctype")[0])&&(l.doctype=""),(n=r.getAll("title")[0])&&n.firstChild&&(l.title=n.firstChild.value),g.each(r.getAll("meta"),function(e){var t,n=e.attr("name"),i=e.attr("http-equiv");n?l[n.toLowerCase()]=e.attr("content"):"Content-Type"===i&&(t=/charset\s*=\s*(.*)\s*/gi.exec(e.attr("content")))&&(l.docencoding=t[1])}),(n=r.getAll("html")[0])&&(l.langcode=o(n,"lang")||o(n,"xml:lang")),l.stylesheets=[],g.each(r.getAll("link"),function(e){"stylesheet"===e.attr("rel")&&l.stylesheets.push(e.attr("href"))}),(n=r.getAll("body")[0])&&(l.langdir=o(n,"dir"),l.style=o(n,"style"),l.visited_color=o(n,"vlink"),l.link_color=o(n,"link"),l.active_color=o(n,"alink")),l},b=function(e,l,t){var o,n,i,a,r,c=e.dom;function s(e,t,n){e.attr(t,n||undefined)}function u(e){n.firstChild?n.insert(e,n.firstChild):n.append(e)}o=v(t),(n=o.getAll("head")[0])||(a=o.getAll("html")[0],n=new f("head",1),a.firstChild?a.insert(n,a.firstChild,!0):a.append(n)),a=o.firstChild,l.xml_pi?(r='version="1.0"',l.docencoding&&(r+=' encoding="'+l.docencoding+'"'),7!==a.type&&(a=new f("xml",7),o.insert(a,o.firstChild,!0)),a.value=r):a&&7===a.type&&a.remove(),a=o.getAll("#doctype")[0],l.doctype?(a||(a=new f("#doctype",10),l.xml_pi?o.insert(a,o.firstChild):u(a)),a.value=l.doctype.substring(9,l.doctype.length-1)):a&&a.remove(),a=null,g.each(o.getAll("meta"),function(e){"Content-Type"===e.attr("http-equiv")&&(a=e)}),l.docencoding?(a||((a=new f("meta",1)).attr("http-equiv","Content-Type"),a.shortEnded=!0,u(a)),a.attr("content","text/html; charset="+l.docencoding)):a&&a.remove(),a=o.getAll("title")[0],l.title?(a?a.empty():u(a=new f("title",1)),a.append(new f("#text",3)).value=l.title):a&&a.remove(),g.each("keywords,description,author,copyright,robots".split(","),function(e){var t,n,i=o.getAll("meta"),r=l[e];for(t=0;t"))},x=Object.prototype.hasOwnProperty,C=(o=function(e,t){return t},function(){for(var e=new Array(arguments.length),t=0;t/g,function(e,t){return unescape(t)})},P=g.each,T=function(e){return e.replace(/<\/?[A-Z]+/g,function(e){return e.toLowerCase()})},O=function(e){var t,n="",i="";if(l(e)){var r=a(e);n+='\n'}return n+=y(e),n+="\n\n\n",(t=d(e))&&(n+=""+t+"\n"),(t=a(e))&&(n+='\n'),(t=c(e))&&(i+="font-family: "+t+";"),(t=s(e))&&(i+="font-size: "+t+";"),(t=u(e))&&(i+="color: "+t+";"),n+="\n\n"},D=function(l,o,a){l.on("BeforeSetContent",function(e){!function(e,t,n,i){var r,l,o,a,c="",s=e.dom;if(!(i.selection||(o=w(e.settings.protect,i.content),"raw"===i.format&&t.get()||i.source_view&&h(e)))){0!==o.length||i.source_view||(o=g.trim(t.get())+"\n"+g.trim(o)+"\n"+g.trim(n.get())),-1!==(r=(o=o.replace(/<(\/?)BODY/gi,"<$1body")).indexOf("",r),t.set(T(o.substring(0,r+1))),-1===(l=o.indexOf("\n")),a=_(t.get()),P(a.getAll("style"),function(e){e.firstChild&&(c+=e.firstChild.value)});var u=a.getAll("body")[0];u&&s.setAttribs(e.getBody(),{style:u.attr("style")||"",dir:u.attr("dir")||"",vLink:u.attr("vlink")||"",link:u.attr("link")||"",aLink:u.attr("alink")||""}),s.remove("fullpage_styles");var d=e.getDoc().getElementsByTagName("head")[0];c&&s.add(d,"style",{id:"fullpage_styles"}).appendChild(m.document.createTextNode(c));var f={};g.each(d.getElementsByTagName("link"),function(e){"stylesheet"===e.rel&&e.getAttribute("data-mce-fullpage")&&(f[e.href]=e)}),g.each(a.getAll("link"),function(e){var t=e.attr("href");if(!t)return!0;f[t]||"stylesheet"!==e.attr("rel")||s.add(d,"link",{rel:"stylesheet",text:"text/css",href:t,"data-mce-fullpage":"1"}),delete f[t]}),g.each(f,function(e){e.parentNode.removeChild(e)})}}(l,o,a,e)}),l.on("GetContent",function(e){var t,n,i,r;t=l,n=o.get(),i=a.get(),(r=e).selection||r.source_view&&h(t)||(r.content=A(g.trim(n)+"\n"+g.trim(r.content)+"\n"+g.trim(i)))})},E=function(e){e.ui.registry.addButton("fullpage",{tooltip:"Metadata and document properties",icon:"document-properties",onAction:function(){e.execCommand("mceFullPageProperties")}}),e.ui.registry.addMenuItem("fullpage",{text:"Metadata and document properties",icon:"document-properties",onAction:function(){e.execCommand("mceFullPageProperties")}})};!function z(){e.add("fullpage",function(e){var t=i(""),n=i("");k(e,t),E(e),D(e,t,n)})}()}(window); \ No newline at end of file diff --git a/plugins/fullscreen/plugin.js b/plugins/fullscreen/plugin.js index 9ce751c3..d0e8ae1c 100644 --- a/plugins/fullscreen/plugin.js +++ b/plugins/fullscreen/plugin.js @@ -4,7 +4,7 @@ * For LGPL see License.txt in the project root for license information. * For commercial licenses see https://www.tiny.cloud/ * - * Version: 5.0.12 (2019-07-18) + * Version: 5.0.13 (2019-08-06) */ (function (domGlobals) { 'use strict'; diff --git a/plugins/fullscreen/plugin.min.js b/plugins/fullscreen/plugin.min.js index 9515334b..74378fa8 100644 --- a/plugins/fullscreen/plugin.min.js +++ b/plugins/fullscreen/plugin.min.js @@ -4,6 +4,6 @@ * For LGPL see License.txt in the project root for license information. * For commercial licenses see https://www.tiny.cloud/ * - * Version: 5.0.12 (2019-07-18) + * Version: 5.0.13 (2019-08-06) */ !function(d){"use strict";var e,n,r,t,o,i,u,s,c,a,f=function(e){var n=e,r=function(){return n};return{get:r,set:function(e){n=e},clone:function(){return f(r())}}},l=tinymce.util.Tools.resolve("tinymce.PluginManager"),m=function(e){return{isFullscreen:function(){return null!==e.get()}}},h=function(){},v=function(e){return function(){return e}},g=v(!1),O=v(!0),S=g,p=O,x=function(){return E},E=(t={fold:function(e,n){return e()},is:S,isSome:S,isNone:p,getOr:r=function(e){return e},getOrThunk:n=function(e){return e()},getOrDie:function(e){throw new Error(e||"error: getOrDie called on none.")},getOrNull:function(){return null},getOrUndefined:function(){return undefined},or:r,orThunk:n,map:x,ap:x,each:function(){},bind:x,flatten:x,exists:S,forall:p,filter:x,equals:e=function(e){return e.isNone()},equals_:e,toArray:function(){return[]},toString:v("none()")},Object.freeze&&Object.freeze(t),t),w=function(r){var e=function(){return r},n=function(){return o},t=function(e){return e(r)},o={fold:function(e,n){return n(r)},is:function(e){return r===e},isSome:p,isNone:S,getOr:e,getOrThunk:e,getOrDie:e,getOrNull:e,getOrUndefined:e,or:n,orThunk:n,map:function(e){return w(e(r))},ap:function(e){return e.fold(x,function(e){return w(e(r))})},each:function(e){e(r)},bind:t,flatten:e,exists:t,forall:t,filter:function(e){return e(r)?o:E},equals:function(e){return e.is(r)},equals_:function(e,n){return e.fold(S,function(e){return n(r,e)})},toArray:function(){return[r]},toString:function(){return"some("+r+")"}};return o},N={some:w,none:x,from:function(e){return null===e||e===undefined?E:w(e)}},T=function(n){return function(e){return function(e){if(null===e)return"null";var n=typeof e;return"object"===n&&(Array.prototype.isPrototypeOf(e)||e.constructor&&"Array"===e.constructor.name)?"array":"object"===n&&(String.prototype.isPrototypeOf(e)||e.constructor&&"String"===e.constructor.name)?"string":n}(e)===n}},y=T("string"),C=T("function"),b=Array.prototype.slice,A=(C(Array.from)&&Array.from,Object.keys),D=function(e,n){return-1!==e.indexOf(n)},_=function(e){if(null===e||e===undefined)throw new Error("Node cannot be null or undefined");return{dom:v(e)}},F={fromHtml:function(e,n){var r=(n||d.document).createElement("div");if(r.innerHTML=e,!r.hasChildNodes()||1${name}'),a=function(t,n){return function(e,t){for(var n=0,o=e.length;n'+(r=n,c=M((i=r).plugins),l=i.settings.forced_plugins===undefined?c:function(e,t){for(var n=[],o=0,a=e.length;o"+a(r,e)+""}),h=u.length,m=u.join(""),"

"+H.translate(["Plugins installed ({0}):",h])+"

    "+m+"
")+""),(t=x(["Accessibility Checker","Advanced Code Editor","Case Change","Checklist","Tiny Comments","Tiny Drive","Enhanced Media Embed","Format Painter","Link Checker","Mentions","MoxieManager","Page Embed","Permanent Pen","PowerPaste","Spell Checker Pro"],function(e){return"
  • "+H.translate(e)+"
  • "}).join(""),'

    '+H.translate("Premium plugins:")+"

    ")].join("")}]};var r,i,s,c,l,u,h,m},D=tinymce.util.Tools.resolve("tinymce.EditorManager"),N=function(){var e,t,n='TinyMCE '+(e=D.majorVersion,t=D.minorVersion,0===e.indexOf("@")?"X.X.X":e+"."+t)+"";return{name:"versions",title:"Version",items:[{type:"htmlpanel",html:"

    "+H.translate(["You are using {0}",n])+"

    ",presets:"document"}]}},L=function(){return{name:"keyboardnav",title:"Keyboard Navigation",items:[{type:"htmlpanel",html:"

    Editor UI keyboard navigation

    \n\n

    Activating keyboard navigation

    \n\n

    The sections of the outer UI of the editor - the menubar, toolbar, sidebar and footer - are all keyboard navigable. As such, there are multiple ways to activate keyboard navigation:

    \n
      \n
    • Focus the menubar: Alt + F9 (Windows) or ⌥F9 (MacOS)
    • \n
    • Focus the toolbar: Alt + F10 (Windows) or ⌥F10 (MacOS)
    • \n
    • Focus the footer: Alt + F11 (Windows) or ⌥F11 (MacOS)
    • \n
    \n\n

    Focusing the menubar or toolbar will start keyboard navigation at the first item in the menubar or toolbar, which will be highlighted with a gray background. Focusing the footer will start keyboard navigation at the first item in the element path, which will be highlighted with an underline.

    \n\n

    Moving between UI sections

    \n\n

    When keyboard navigation is active, pressing tab will move the focus to the next major section of the UI, where applicable. These sections are:

    \n
      \n
    • the menubar
    • \n
    • each group of the toolbar
    • \n
    • the sidebar
    • \n
    • the element path in the footer
    • \n
    • the wordcount toggle button in the footer
    • \n
    • the branding link in the footer
    • \n
    \n\n

    Pressing shift + tab will move backwards through the same sections, except when moving from the footer to the toolbar. Focusing the element path then pressing shift + tab will move focus to the first toolbar group, not the last.

    \n\n

    Moving within UI sections

    \n\n

    Keyboard navigation within UI sections can usually be achieved using the left and right arrow keys. This includes:

    \n
      \n
    • moving between menus in the menubar
    • \n
    • moving between buttons in a toolbar group
    • \n
    • moving between items in the element path
    • \n
    \n\n

    In all these UI sections, keyboard navigation will cycle within the section. For example, focusing the last button in a toolbar group then pressing right arrow will move focus to the first item in the same toolbar group.

    \n\n

    Executing buttons

    \n\n

    To execute a button, navigate the selection to the desired button and hit space or enter.

    \n\n

    Opening, navigating and closing menus

    \n\n

    When focusing a menubar button or a toolbar button with a menu, pressing space, enter or down arrow will open the menu. When the menu opens the first item will be selected. To move up or down the menu, press the up or down arrow key respectively. This is the same for submenus, which can also be opened and closed using the left and right arrow keys.

    \n\n

    To close any active menu, hit the escape key. When a menu is closed the selection will be restored to its previous selection. This also works for closing submenus.

    \n\n

    Context toolbars and menus

    \n\n

    To focus an open context toolbar such as the table context toolbar, press Ctrl + F9 (Windows) or ⌃F9 (MacOS).

    \n\n

    Context toolbar navigation is the same as toolbar navigation, and context menu navigation is the same as standard menu navigation.

    \n\n

    Dialog navigation

    \n\n

    There are two types of dialog UIs in TinyMCE: tabbed dialogs and non-tabbed dialogs.

    \n\n

    When a non-tabbed dialog is opened, the first interactive component in the dialog will be focused. Users can navigate between interactive components by pressing tab. This includes any footer buttons. Navigation will cycle back to the first dialog component if tab is pressed while focusing the last component in the dialog. Pressing shift + tab will navigate backwards.

    \n\n

    When a tabbed dialog is opened, the first button in the tab menu is focused. Pressing tab will navigate to the first interactive component in that tab, and will cycle through the tab\u2019s components, the footer buttons, then back to the tab button. To switch to another tab, focus the tab button for the current tab, then use the arrow keys to cycle through the tab buttons.

    "}]}},B=function(e){var t,n=M(e);return(-1===(t=C(n,"versions"))?v.none():v.some(t)).each(function(e){n.splice(e,1),n.push("versions")}),{tabs:e,names:n}},z=function(e,t){var n,o,a=_(),r=L(),i=W(e),s=N(),c=l(((n={})[a.name]=a,n[r.name]=r,n[i.name]=i,n[s.name]=s,n),t.get());return(o=e,v.from(o.getParam("help_tabs"))).fold(function(){return B(c)},function(e){return t=c,n={},o=x(e,function(e){return"string"==typeof e?(F(t,e)&&(n[e]=t[e]),e):(n[e.name]=e).name}),{tabs:n,names:o};var t,n,o})},V=function(a,r){return function(){var e=z(a,r),o=e.tabs,t=e.names,n={type:"tabpanel",tabs:function(e){for(var t=[],n=function(e){t.push(e)},o=0;o")})},t=function(n){n.ui.registry.addButton("hr",{icon:"horizontal-rule",tooltip:"Horizontal line",onAction:function(){return n.execCommand("InsertHorizontalRule")}}),n.ui.registry.addMenuItem("hr",{icon:"horizontal-rule",text:"Horizontal line",onAction:function(){return n.execCommand("InsertHorizontalRule")}})};!function e(){n.add("hr",function(n){o(n),t(n)})}()}(); \ No newline at end of file diff --git a/plugins/image/plugin.js b/plugins/image/plugin.js index 6d735208..25c24548 100644 --- a/plugins/image/plugin.js +++ b/plugins/image/plugin.js @@ -4,12 +4,12 @@ * For LGPL see License.txt in the project root for license information. * For commercial licenses see https://www.tiny.cloud/ * - * Version: 5.0.12 (2019-07-18) + * Version: 5.0.13 (2019-08-06) */ (function (domGlobals) { 'use strict'; - var global = tinymce.util.Tools.resolve('tinymce.PluginManager'); + var global$1 = tinymce.util.Tools.resolve('tinymce.PluginManager'); var noop = function () { }; @@ -221,6 +221,503 @@ return __assign.apply(this, arguments); }; + var exports$1 = {}, module = { exports: exports$1 }; + (function (define, exports, module, require) { + (function (f) { + if (typeof exports === 'object' && typeof module !== 'undefined') { + module.exports = f(); + } else if (typeof define === 'function' && define.amd) { + define([], f); + } else { + var g; + if (typeof window !== 'undefined') { + g = window; + } else if (typeof global !== 'undefined') { + g = global; + } else if (typeof self !== 'undefined') { + g = self; + } else { + g = this; + } + g.EphoxContactWrapper = f(); + } + }(function () { + return function () { + function r(e, n, t) { + function o(i, f) { + if (!n[i]) { + if (!e[i]) { + var c = 'function' == typeof require && require; + if (!f && c) + return c(i, !0); + if (u) + return u(i, !0); + var a = new Error('Cannot find module \'' + i + '\''); + throw a.code = 'MODULE_NOT_FOUND', a; + } + var p = n[i] = { exports: {} }; + e[i][0].call(p.exports, function (r) { + var n = e[i][1][r]; + return o(n || r); + }, p, p.exports, r, e, n, t); + } + return n[i].exports; + } + for (var u = 'function' == typeof require && require, i = 0; i < t.length; i++) + o(t[i]); + return o; + } + return r; + }()({ + 1: [ + function (require, module, exports) { + var process = module.exports = {}; + var cachedSetTimeout; + var cachedClearTimeout; + function defaultSetTimout() { + throw new Error('setTimeout has not been defined'); + } + function defaultClearTimeout() { + throw new Error('clearTimeout has not been defined'); + } + (function () { + try { + if (typeof setTimeout === 'function') { + cachedSetTimeout = setTimeout; + } else { + cachedSetTimeout = defaultSetTimout; + } + } catch (e) { + cachedSetTimeout = defaultSetTimout; + } + try { + if (typeof clearTimeout === 'function') { + cachedClearTimeout = clearTimeout; + } else { + cachedClearTimeout = defaultClearTimeout; + } + } catch (e) { + cachedClearTimeout = defaultClearTimeout; + } + }()); + function runTimeout(fun) { + if (cachedSetTimeout === setTimeout) { + return setTimeout(fun, 0); + } + if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { + cachedSetTimeout = setTimeout; + return setTimeout(fun, 0); + } + try { + return cachedSetTimeout(fun, 0); + } catch (e) { + try { + return cachedSetTimeout.call(null, fun, 0); + } catch (e) { + return cachedSetTimeout.call(this, fun, 0); + } + } + } + function runClearTimeout(marker) { + if (cachedClearTimeout === clearTimeout) { + return clearTimeout(marker); + } + if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { + cachedClearTimeout = clearTimeout; + return clearTimeout(marker); + } + try { + return cachedClearTimeout(marker); + } catch (e) { + try { + return cachedClearTimeout.call(null, marker); + } catch (e) { + return cachedClearTimeout.call(this, marker); + } + } + } + var queue = []; + var draining = false; + var currentQueue; + var queueIndex = -1; + function cleanUpNextTick() { + if (!draining || !currentQueue) { + return; + } + draining = false; + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; + } + if (queue.length) { + drainQueue(); + } + } + function drainQueue() { + if (draining) { + return; + } + var timeout = runTimeout(cleanUpNextTick); + draining = true; + var len = queue.length; + while (len) { + currentQueue = queue; + queue = []; + while (++queueIndex < len) { + if (currentQueue) { + currentQueue[queueIndex].run(); + } + } + queueIndex = -1; + len = queue.length; + } + currentQueue = null; + draining = false; + runClearTimeout(timeout); + } + process.nextTick = function (fun) { + var args = new Array(arguments.length - 1); + if (arguments.length > 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } + } + queue.push(new Item(fun, args)); + if (queue.length === 1 && !draining) { + runTimeout(drainQueue); + } + }; + function Item(fun, array) { + this.fun = fun; + this.array = array; + } + Item.prototype.run = function () { + this.fun.apply(null, this.array); + }; + process.title = 'browser'; + process.browser = true; + process.env = {}; + process.argv = []; + process.version = ''; + process.versions = {}; + function noop() { + } + process.on = noop; + process.addListener = noop; + process.once = noop; + process.off = noop; + process.removeListener = noop; + process.removeAllListeners = noop; + process.emit = noop; + process.prependListener = noop; + process.prependOnceListener = noop; + process.listeners = function (name) { + return []; + }; + process.binding = function (name) { + throw new Error('process.binding is not supported'); + }; + process.cwd = function () { + return '/'; + }; + process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); + }; + process.umask = function () { + return 0; + }; + }, + {} + ], + 2: [ + function (require, module, exports) { + (function (setImmediate) { + (function (root) { + var setTimeoutFunc = setTimeout; + function noop() { + } + function bind(fn, thisArg) { + return function () { + fn.apply(thisArg, arguments); + }; + } + function Promise(fn) { + if (typeof this !== 'object') + throw new TypeError('Promises must be constructed via new'); + if (typeof fn !== 'function') + throw new TypeError('not a function'); + this._state = 0; + this._handled = false; + this._value = undefined; + this._deferreds = []; + doResolve(fn, this); + } + function handle(self, deferred) { + while (self._state === 3) { + self = self._value; + } + if (self._state === 0) { + self._deferreds.push(deferred); + return; + } + self._handled = true; + Promise._immediateFn(function () { + var cb = self._state === 1 ? deferred.onFulfilled : deferred.onRejected; + if (cb === null) { + (self._state === 1 ? resolve : reject)(deferred.promise, self._value); + return; + } + var ret; + try { + ret = cb(self._value); + } catch (e) { + reject(deferred.promise, e); + return; + } + resolve(deferred.promise, ret); + }); + } + function resolve(self, newValue) { + try { + if (newValue === self) + throw new TypeError('A promise cannot be resolved with itself.'); + if (newValue && (typeof newValue === 'object' || typeof newValue === 'function')) { + var then = newValue.then; + if (newValue instanceof Promise) { + self._state = 3; + self._value = newValue; + finale(self); + return; + } else if (typeof then === 'function') { + doResolve(bind(then, newValue), self); + return; + } + } + self._state = 1; + self._value = newValue; + finale(self); + } catch (e) { + reject(self, e); + } + } + function reject(self, newValue) { + self._state = 2; + self._value = newValue; + finale(self); + } + function finale(self) { + if (self._state === 2 && self._deferreds.length === 0) { + Promise._immediateFn(function () { + if (!self._handled) { + Promise._unhandledRejectionFn(self._value); + } + }); + } + for (var i = 0, len = self._deferreds.length; i < len; i++) { + handle(self, self._deferreds[i]); + } + self._deferreds = null; + } + function Handler(onFulfilled, onRejected, promise) { + this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null; + this.onRejected = typeof onRejected === 'function' ? onRejected : null; + this.promise = promise; + } + function doResolve(fn, self) { + var done = false; + try { + fn(function (value) { + if (done) + return; + done = true; + resolve(self, value); + }, function (reason) { + if (done) + return; + done = true; + reject(self, reason); + }); + } catch (ex) { + if (done) + return; + done = true; + reject(self, ex); + } + } + Promise.prototype['catch'] = function (onRejected) { + return this.then(null, onRejected); + }; + Promise.prototype.then = function (onFulfilled, onRejected) { + var prom = new this.constructor(noop); + handle(this, new Handler(onFulfilled, onRejected, prom)); + return prom; + }; + Promise.all = function (arr) { + var args = Array.prototype.slice.call(arr); + return new Promise(function (resolve, reject) { + if (args.length === 0) + return resolve([]); + var remaining = args.length; + function res(i, val) { + try { + if (val && (typeof val === 'object' || typeof val === 'function')) { + var then = val.then; + if (typeof then === 'function') { + then.call(val, function (val) { + res(i, val); + }, reject); + return; + } + } + args[i] = val; + if (--remaining === 0) { + resolve(args); + } + } catch (ex) { + reject(ex); + } + } + for (var i = 0; i < args.length; i++) { + res(i, args[i]); + } + }); + }; + Promise.resolve = function (value) { + if (value && typeof value === 'object' && value.constructor === Promise) { + return value; + } + return new Promise(function (resolve) { + resolve(value); + }); + }; + Promise.reject = function (value) { + return new Promise(function (resolve, reject) { + reject(value); + }); + }; + Promise.race = function (values) { + return new Promise(function (resolve, reject) { + for (var i = 0, len = values.length; i < len; i++) { + values[i].then(resolve, reject); + } + }); + }; + Promise._immediateFn = typeof setImmediate === 'function' ? function (fn) { + setImmediate(fn); + } : function (fn) { + setTimeoutFunc(fn, 0); + }; + Promise._unhandledRejectionFn = function _unhandledRejectionFn(err) { + if (typeof console !== 'undefined' && console) { + console.warn('Possible Unhandled Promise Rejection:', err); + } + }; + Promise._setImmediateFn = function _setImmediateFn(fn) { + Promise._immediateFn = fn; + }; + Promise._setUnhandledRejectionFn = function _setUnhandledRejectionFn(fn) { + Promise._unhandledRejectionFn = fn; + }; + if (typeof module !== 'undefined' && module.exports) { + module.exports = Promise; + } else if (!root.Promise) { + root.Promise = Promise; + } + }(this)); + }.call(this, require('timers').setImmediate)); + }, + { 'timers': 3 } + ], + 3: [ + function (require, module, exports) { + (function (setImmediate, clearImmediate) { + var nextTick = require('process/browser.js').nextTick; + var apply = Function.prototype.apply; + var slice = Array.prototype.slice; + var immediateIds = {}; + var nextImmediateId = 0; + exports.setTimeout = function () { + return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout); + }; + exports.setInterval = function () { + return new Timeout(apply.call(setInterval, window, arguments), clearInterval); + }; + exports.clearTimeout = exports.clearInterval = function (timeout) { + timeout.close(); + }; + function Timeout(id, clearFn) { + this._id = id; + this._clearFn = clearFn; + } + Timeout.prototype.unref = Timeout.prototype.ref = function () { + }; + Timeout.prototype.close = function () { + this._clearFn.call(window, this._id); + }; + exports.enroll = function (item, msecs) { + clearTimeout(item._idleTimeoutId); + item._idleTimeout = msecs; + }; + exports.unenroll = function (item) { + clearTimeout(item._idleTimeoutId); + item._idleTimeout = -1; + }; + exports._unrefActive = exports.active = function (item) { + clearTimeout(item._idleTimeoutId); + var msecs = item._idleTimeout; + if (msecs >= 0) { + item._idleTimeoutId = setTimeout(function onTimeout() { + if (item._onTimeout) + item._onTimeout(); + }, msecs); + } + }; + exports.setImmediate = typeof setImmediate === 'function' ? setImmediate : function (fn) { + var id = nextImmediateId++; + var args = arguments.length < 2 ? false : slice.call(arguments, 1); + immediateIds[id] = true; + nextTick(function onNextTick() { + if (immediateIds[id]) { + if (args) { + fn.apply(null, args); + } else { + fn.call(null); + } + exports.clearImmediate(id); + } + }); + return id; + }; + exports.clearImmediate = typeof clearImmediate === 'function' ? clearImmediate : function (id) { + delete immediateIds[id]; + }; + }.call(this, require('timers').setImmediate, require('timers').clearImmediate)); + }, + { + 'process/browser.js': 1, + 'timers': 3 + } + ], + 4: [ + function (require, module, exports) { + var promisePolyfill = require('promise-polyfill'); + var Global = function () { + if (typeof window !== 'undefined') { + return window; + } else { + return Function('return this;')(); + } + }(); + module.exports = { boltExport: Global.Promise || promisePolyfill }; + }, + { 'promise-polyfill': 2 } + ] + }, {}, [4])(4); + })); + }(undefined, exports$1, module, undefined)); + var Promise = module.exports.boltExport; + var nu = function (baseFn) { var data = Option.none(); var callbacks = []; @@ -273,42 +770,31 @@ pure: pure }; - var bounce = function (f) { - return function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - var me = this; - domGlobals.setTimeout(function () { - f.apply(me, args); - }, 0); - }; + var errorReporter = function (err) { + domGlobals.setTimeout(function () { + throw err; + }, 0); }; - - var nu$1 = function (baseFn) { + var make = function (run) { var get = function (callback) { - baseFn(bounce(callback)); + run().then(callback, errorReporter); }; var map = function (fab) { - return nu$1(function (callback) { - get(function (a) { - var value = fab(a); - callback(value); - }); + return make(function () { + return run().then(fab); }); }; var bind = function (aFutureB) { - return nu$1(function (callback) { - get(function (a) { - aFutureB(a).get(callback); + return make(function () { + return run().then(function (v) { + return aFutureB(v).toPromise(); }); }); }; var anonBind = function (futureB) { - return nu$1(function (callback) { - get(function (a) { - futureB.get(callback); + return make(function () { + return run().then(function () { + return futureB.toPromise(); }); }); }; @@ -317,25 +803,32 @@ }; var toCached = function () { var cache = null; - return nu$1(function (callback) { + return make(function () { if (cache === null) { - cache = toLazy(); + cache = run(); } - cache.get(callback); + return cache; }); }; + var toPromise = run; return { map: map, bind: bind, anonBind: anonBind, toLazy: toLazy, toCached: toCached, + toPromise: toPromise, get: get }; }; + var nu$1 = function (baseFn) { + return make(function () { + return new Promise(baseFn); + }); + }; var pure$1 = function (a) { - return nu$1(function (callback) { - callback(a); + return make(function () { + return Promise.resolve(a); }); }; var Future = { @@ -576,46 +1069,6 @@ var deepMerge = baseMerge(deep); var merge = baseMerge(shallow); - var Global = typeof domGlobals.window !== 'undefined' ? domGlobals.window : Function('return this;')(); - - var path = function (parts, scope) { - var o = scope !== undefined && scope !== null ? scope : Global; - for (var i = 0; i < parts.length && o !== undefined && o !== null; ++i) { - o = o[parts[i]]; - } - return o; - }; - var resolve = function (p, scope) { - var parts = p.split('.'); - return path(parts, scope); - }; - - var unsafe = function (name, scope) { - return resolve(name, scope); - }; - var getOrDie = function (name, scope) { - var actual = unsafe(name, scope); - if (actual === undefined || actual === null) { - throw new Error(name + ' not available on this browser'); - } - return actual; - }; - var Global$1 = { getOrDie: getOrDie }; - - var url = function () { - return Global$1.getOrDie('URL'); - }; - var createObjectURL = function (blob) { - return url().createObjectURL(blob); - }; - var revokeObjectURL = function (u) { - url().revokeObjectURL(u); - }; - var URL = { - createObjectURL: createObjectURL, - revokeObjectURL: revokeObjectURL - }; - var makeItems = function (info) { var imageUrl = { name: 'src', @@ -690,16 +1143,11 @@ makeItems: makeItems }; - var global$1 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils'); + var global$2 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils'); - function FileReader () { - var f = Global$1.getOrDie('FileReader'); - return new f(); - } - - var global$2 = tinymce.util.Tools.resolve('tinymce.util.Promise'); + var global$3 = tinymce.util.Tools.resolve('tinymce.util.Promise'); - var global$3 = tinymce.util.Tools.resolve('tinymce.util.XHR'); + var global$4 = tinymce.util.Tools.resolve('tinymce.util.XHR'); var hasDimensions = function (editor) { return editor.getParam('image_dimensions', true, 'boolean'); @@ -842,7 +1290,7 @@ var createImageList = function (editor, callback) { var imageList = Settings.getImageList(editor); if (typeof imageList === 'string') { - global$3.send({ + global$4.send({ url: imageList, success: function (text) { callback(JSON.parse(text)); @@ -874,8 +1322,8 @@ imgElm.onerror = selectImage; }; var blobToDataUri = function (blob) { - return new global$2(function (resolve, reject) { - var reader = FileReader(); + return new global$3(function (resolve, reject) { + var reader = new domGlobals.FileReader(); reader.onload = function () { resolve(reader.result); }; @@ -899,7 +1347,7 @@ isPlaceholderImage: isPlaceholderImage }; - var DOM = global$1.DOM; + var DOM = global$2.DOM; var getHspace = function (image) { if (image.style.marginLeft && image.style.marginRight && image.style.marginLeft === image.style.marginRight) { return Utils.removePixelSuffix(image.style.marginLeft); @@ -1206,14 +1654,14 @@ return Option.none(); }; - var global$4 = tinymce.util.Tools.resolve('tinymce.util.Tools'); + var global$5 = tinymce.util.Tools.resolve('tinymce.util.Tools'); var getValue = function (item) { return isString(item.value) ? item.value : ''; }; var sanitizeList = function (list, extractValue) { var out = []; - global$4.each(list, function (item) { + global$5.each(list, function (item) { var text = isString(item.text) ? item.text : isString(item.title) ? item.title : ''; if (item.menu !== undefined) { var items = sanitizeList(item.menu, extractValue); @@ -1273,11 +1721,6 @@ findEntry: findEntry }; - function XMLHttpRequest () { - var f = Global$1.getOrDie('XMLHttpRequest'); - return new f(); - } - var pathJoin = function (path1, path2) { if (path1) { return path1.replace(/\/$/, '') + '/' + path2.replace(/^\//, ''); @@ -1287,7 +1730,7 @@ function Uploader (settings) { var defaultHandler = function (blobInfo, success, failure, progress) { var xhr, formData; - xhr = XMLHttpRequest(); + xhr = new domGlobals.XMLHttpRequest(); xhr.open('POST', settings.url); xhr.withCredentials = settings.credentials; xhr.upload.onprogress = function (e) { @@ -1314,7 +1757,7 @@ xhr.send(formData); }; var uploadBlob = function (blobInfo, handler) { - return new global$2(function (resolve, reject) { + return new global$3(function (resolve, reject) { try { handler(blobInfo, resolve, reject, noop); } catch (ex) { @@ -1326,9 +1769,9 @@ return handler === defaultHandler; }; var upload = function (blobInfo) { - return !settings.url && isDefaultHandler(settings.handler) ? global$2.reject('Upload url missing from the settings.') : uploadBlob(blobInfo, settings.handler); + return !settings.url && isDefaultHandler(settings.handler) ? global$3.reject('Upload url missing from the settings.') : uploadBlob(blobInfo, settings.handler); }; - settings = global$4.extend({ + settings = global$5.extend({ credentials: false, handler: defaultHandler }, settings); @@ -1707,7 +2150,7 @@ head(data.fileinput).fold(function () { api.unblock(); }, function (file) { - var blobUri = URL.createObjectURL(file); + var blobUri = domGlobals.URL.createObjectURL(file); var uploader = Uploader({ url: info.url, basePath: info.basePath, @@ -1716,7 +2159,7 @@ }); var finalize = function () { api.unblock(); - URL.revokeObjectURL(blobUri); + domGlobals.URL.revokeObjectURL(blobUri); }; Utils.blobToDataUri(file).then(function (dataUrl) { var blobInfo = helpers.createBlobCache(file, blobUri, dataUrl); @@ -1899,7 +2342,7 @@ var node = nodes[i]; if (hasImageClass(node)) { node.attr('contenteditable', state ? 'false' : null); - global$4.each(node.getAll('figcaption'), toggleContentEditable); + global$5.each(node.getAll('figcaption'), toggleContentEditable); } } }; @@ -1935,7 +2378,7 @@ var Buttons = { register: register$1 }; function Plugin () { - global.add('image', function (editor) { + global$1.add('image', function (editor) { FilterContent.setup(editor); Buttons.register(editor); Commands.register(editor); diff --git a/plugins/image/plugin.min.js b/plugins/image/plugin.min.js index e216ed0a..083ebb3e 100644 --- a/plugins/image/plugin.min.js +++ b/plugins/image/plugin.min.js @@ -4,6 +4,6 @@ * For LGPL see License.txt in the project root for license information. * For commercial licenses see https://www.tiny.cloud/ * - * Version: 5.0.12 (2019-07-18) + * Version: 5.0.13 (2019-08-06) */ -!function(l){"use strict";var t,e,n,r,i=tinymce.util.Tools.resolve("tinymce.PluginManager"),a=function(){},o=function(t){return function(){return t}},u=function(t){return t},c=o(!1),s=o(!0),f=c,m=s,d=function(){return g},g=(r={fold:function(t,e){return t()},is:f,isSome:f,isNone:m,getOr:n=function(t){return t},getOrThunk:e=function(t){return t()},getOrDie:function(t){throw new Error(t||"error: getOrDie called on none.")},getOrNull:function(){return null},getOrUndefined:function(){return undefined},or:n,orThunk:e,map:d,ap:d,each:function(){},bind:d,flatten:d,exists:f,forall:m,filter:d,equals:t=function(t){return t.isNone()},equals_:t,toArray:function(){return[]},toString:o("none()")},Object.freeze&&Object.freeze(r),r),p=function(n){var t=function(){return n},e=function(){return i},r=function(t){return t(n)},i={fold:function(t,e){return e(n)},is:function(t){return n===t},isSome:m,isNone:f,getOr:t,getOrThunk:t,getOrDie:t,getOrNull:t,getOrUndefined:t,or:e,orThunk:e,map:function(t){return p(t(n))},ap:function(t){return t.fold(d,function(t){return p(t(n))})},each:function(t){t(n)},bind:r,flatten:t,exists:r,forall:r,filter:function(t){return t(n)?i:g},equals:function(t){return t.is(n)},equals_:function(t,e){return t.fold(f,function(t){return e(n,t)})},toArray:function(){return[n]},toString:function(){return"some("+n+")"}};return i},w={some:p,none:d,from:function(t){return null===t||t===undefined?g:p(t)}},h=function(e){return function(t){return function(t){if(null===t)return"null";var e=typeof t;return"object"===e&&(Array.prototype.isPrototypeOf(t)||t.constructor&&"Array"===t.constructor.name)?"array":"object"===e&&(String.prototype.isPrototypeOf(t)||t.constructor&&"String"===t.constructor.name)?"string":e}(t)===e}},U=h("string"),b=h("object"),v=h("array"),y=h("boolean"),S=h("function"),D=Array.prototype.slice,T=Array.prototype.push,A=function(t){for(var e=[],n=0,r=t.length;n'+n+"")}else e.insertContent(f(e,t));var i,o,u,c,m},g=f,y=function(e){e.addCommand("mceInsertDate",function(){p(e,t(e))}),e.addCommand("mceInsertTime",function(){p(e,a(e))})},M=tinymce.util.Tools.resolve("tinymce.util.Tools"),S=function(e){var t=e,n=function(){return t};return{get:n,set:function(e){t=e},clone:function(){return S(n())}}},v=function(n){var t=i(n),r=S(o(n));n.ui.registry.addSplitButton("insertdatetime",{icon:"insert-time",tooltip:"Insert date/time",select:function(e){return e===r.get()},fetch:function(e){e(M.map(t,function(e){return{type:"choiceitem",text:g(n,e),value:e}}))},onAction:function(){for(var e=[],t=0;t 10) { + if (!global$4.ie || global$4.ie > 10) { var link = domGlobals.document.createElement('a'); link.target = '_blank'; link.href = url; @@ -106,7 +109,7 @@ win.opener = null; var doc = win.document; doc.open(); - doc.write(''); + doc.write(''); doc.close(); } } @@ -253,28 +256,6 @@ from: from }; - var typeOf = function (x) { - if (x === null) { - return 'null'; - } - var t = typeof x; - if (t === 'object' && (Array.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'Array')) { - return 'array'; - } - if (t === 'object' && (String.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'String')) { - return 'string'; - } - return t; - }; - var isType = function (type) { - return function (value) { - return typeOf(value) === type; - }; - }; - var isString = isType('string'); - var isArray = isType('array'); - var isFunction = isType('function'); - var slice = Array.prototype.slice; var rawIndexOf = function () { var pIndexOf = Array.prototype.indexOf; @@ -337,7 +318,7 @@ return slice.call(x); }; - var global$4 = tinymce.util.Tools.resolve('tinymce.util.Tools'); + var global$5 = tinymce.util.Tools.resolve('tinymce.util.Tools'); var hasProtocol = function (url) { return /^\w+:/i.test(url); @@ -350,7 +331,7 @@ var rules = ['noopener']; var rels = rel ? rel.split(/\s+/) : []; var toString = function (rels) { - return global$4.trim(rels.sort().join(' ')); + return global$5.trim(rels.sort().join(' ')); }; var addTargetRules = function (rels) { rels = removeTargetRules(rels); @@ -358,7 +339,7 @@ }; var removeTargetRules = function (rels) { return rels.filter(function (val) { - return global$4.inArray(rules, val) === -1; + return global$5.inArray(rules, val) === -1; }); }; var newRels = isUnsafe ? addTargetRules(rels) : removeTargetRules(rels); @@ -383,7 +364,7 @@ return elm && elm.nodeName === 'A' && !!elm.href; }; var hasLinks = function (elements) { - return global$4.grep(elements, isLink).length > 0; + return global$5.grep(elements, isLink).length > 0; }; var isOnlyTextSelected = function (html) { if (/]+>[^<]+<\/a>$/.test(html) || html.indexOf('href=') === -1)) { @@ -440,11 +421,14 @@ var selectedElm = editor.selection.getNode(); var anchorElm = getAnchorElement(editor, selectedElm); var linkAttrs = getLinkAttrs(data); - if (!Settings.hasRelList(editor.settings) && Settings.allowUnsafeLinkTarget(editor.settings) === false) { + if (!(Settings.getRelList(editor).length > 0) && Settings.allowUnsafeLinkTarget(editor) === false) { var newRel = applyRelTargetRules(linkAttrs.rel, linkAttrs.target === '_blank'); linkAttrs.rel = newRel ? newRel : null; } - linkAttrs.href = handleExternalTargets(linkAttrs.href, Settings.assumeExternalTargets(editor.settings)); + if (Option.from(linkAttrs.target).isNone()) { + linkAttrs.target = Settings.getDefaultLinkTarget(editor); + } + linkAttrs.href = handleExternalTargets(linkAttrs.href, Settings.assumeExternalTargets(editor)); if (data.href === attachState.href) { attachState.attach(); } @@ -526,7 +510,7 @@ }; var sanitizeList = function (list, extractValue) { var out = []; - global$4.each(list, function (item) { + global$5.each(list, function (item) { var text = isString(item.text) ? item.text : isString(item.title) ? item.title : ''; if (item.menu !== undefined) ; else { var value = extractValue(item); @@ -667,6 +651,503 @@ return __assign.apply(this, arguments); }; + var exports$1 = {}, module = { exports: exports$1 }; + (function (define, exports, module, require) { + (function (f) { + if (typeof exports === 'object' && typeof module !== 'undefined') { + module.exports = f(); + } else if (typeof define === 'function' && define.amd) { + define([], f); + } else { + var g; + if (typeof window !== 'undefined') { + g = window; + } else if (typeof global !== 'undefined') { + g = global; + } else if (typeof self !== 'undefined') { + g = self; + } else { + g = this; + } + g.EphoxContactWrapper = f(); + } + }(function () { + return function () { + function r(e, n, t) { + function o(i, f) { + if (!n[i]) { + if (!e[i]) { + var c = 'function' == typeof require && require; + if (!f && c) + return c(i, !0); + if (u) + return u(i, !0); + var a = new Error('Cannot find module \'' + i + '\''); + throw a.code = 'MODULE_NOT_FOUND', a; + } + var p = n[i] = { exports: {} }; + e[i][0].call(p.exports, function (r) { + var n = e[i][1][r]; + return o(n || r); + }, p, p.exports, r, e, n, t); + } + return n[i].exports; + } + for (var u = 'function' == typeof require && require, i = 0; i < t.length; i++) + o(t[i]); + return o; + } + return r; + }()({ + 1: [ + function (require, module, exports) { + var process = module.exports = {}; + var cachedSetTimeout; + var cachedClearTimeout; + function defaultSetTimout() { + throw new Error('setTimeout has not been defined'); + } + function defaultClearTimeout() { + throw new Error('clearTimeout has not been defined'); + } + (function () { + try { + if (typeof setTimeout === 'function') { + cachedSetTimeout = setTimeout; + } else { + cachedSetTimeout = defaultSetTimout; + } + } catch (e) { + cachedSetTimeout = defaultSetTimout; + } + try { + if (typeof clearTimeout === 'function') { + cachedClearTimeout = clearTimeout; + } else { + cachedClearTimeout = defaultClearTimeout; + } + } catch (e) { + cachedClearTimeout = defaultClearTimeout; + } + }()); + function runTimeout(fun) { + if (cachedSetTimeout === setTimeout) { + return setTimeout(fun, 0); + } + if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { + cachedSetTimeout = setTimeout; + return setTimeout(fun, 0); + } + try { + return cachedSetTimeout(fun, 0); + } catch (e) { + try { + return cachedSetTimeout.call(null, fun, 0); + } catch (e) { + return cachedSetTimeout.call(this, fun, 0); + } + } + } + function runClearTimeout(marker) { + if (cachedClearTimeout === clearTimeout) { + return clearTimeout(marker); + } + if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { + cachedClearTimeout = clearTimeout; + return clearTimeout(marker); + } + try { + return cachedClearTimeout(marker); + } catch (e) { + try { + return cachedClearTimeout.call(null, marker); + } catch (e) { + return cachedClearTimeout.call(this, marker); + } + } + } + var queue = []; + var draining = false; + var currentQueue; + var queueIndex = -1; + function cleanUpNextTick() { + if (!draining || !currentQueue) { + return; + } + draining = false; + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; + } + if (queue.length) { + drainQueue(); + } + } + function drainQueue() { + if (draining) { + return; + } + var timeout = runTimeout(cleanUpNextTick); + draining = true; + var len = queue.length; + while (len) { + currentQueue = queue; + queue = []; + while (++queueIndex < len) { + if (currentQueue) { + currentQueue[queueIndex].run(); + } + } + queueIndex = -1; + len = queue.length; + } + currentQueue = null; + draining = false; + runClearTimeout(timeout); + } + process.nextTick = function (fun) { + var args = new Array(arguments.length - 1); + if (arguments.length > 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } + } + queue.push(new Item(fun, args)); + if (queue.length === 1 && !draining) { + runTimeout(drainQueue); + } + }; + function Item(fun, array) { + this.fun = fun; + this.array = array; + } + Item.prototype.run = function () { + this.fun.apply(null, this.array); + }; + process.title = 'browser'; + process.browser = true; + process.env = {}; + process.argv = []; + process.version = ''; + process.versions = {}; + function noop() { + } + process.on = noop; + process.addListener = noop; + process.once = noop; + process.off = noop; + process.removeListener = noop; + process.removeAllListeners = noop; + process.emit = noop; + process.prependListener = noop; + process.prependOnceListener = noop; + process.listeners = function (name) { + return []; + }; + process.binding = function (name) { + throw new Error('process.binding is not supported'); + }; + process.cwd = function () { + return '/'; + }; + process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); + }; + process.umask = function () { + return 0; + }; + }, + {} + ], + 2: [ + function (require, module, exports) { + (function (setImmediate) { + (function (root) { + var setTimeoutFunc = setTimeout; + function noop() { + } + function bind(fn, thisArg) { + return function () { + fn.apply(thisArg, arguments); + }; + } + function Promise(fn) { + if (typeof this !== 'object') + throw new TypeError('Promises must be constructed via new'); + if (typeof fn !== 'function') + throw new TypeError('not a function'); + this._state = 0; + this._handled = false; + this._value = undefined; + this._deferreds = []; + doResolve(fn, this); + } + function handle(self, deferred) { + while (self._state === 3) { + self = self._value; + } + if (self._state === 0) { + self._deferreds.push(deferred); + return; + } + self._handled = true; + Promise._immediateFn(function () { + var cb = self._state === 1 ? deferred.onFulfilled : deferred.onRejected; + if (cb === null) { + (self._state === 1 ? resolve : reject)(deferred.promise, self._value); + return; + } + var ret; + try { + ret = cb(self._value); + } catch (e) { + reject(deferred.promise, e); + return; + } + resolve(deferred.promise, ret); + }); + } + function resolve(self, newValue) { + try { + if (newValue === self) + throw new TypeError('A promise cannot be resolved with itself.'); + if (newValue && (typeof newValue === 'object' || typeof newValue === 'function')) { + var then = newValue.then; + if (newValue instanceof Promise) { + self._state = 3; + self._value = newValue; + finale(self); + return; + } else if (typeof then === 'function') { + doResolve(bind(then, newValue), self); + return; + } + } + self._state = 1; + self._value = newValue; + finale(self); + } catch (e) { + reject(self, e); + } + } + function reject(self, newValue) { + self._state = 2; + self._value = newValue; + finale(self); + } + function finale(self) { + if (self._state === 2 && self._deferreds.length === 0) { + Promise._immediateFn(function () { + if (!self._handled) { + Promise._unhandledRejectionFn(self._value); + } + }); + } + for (var i = 0, len = self._deferreds.length; i < len; i++) { + handle(self, self._deferreds[i]); + } + self._deferreds = null; + } + function Handler(onFulfilled, onRejected, promise) { + this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null; + this.onRejected = typeof onRejected === 'function' ? onRejected : null; + this.promise = promise; + } + function doResolve(fn, self) { + var done = false; + try { + fn(function (value) { + if (done) + return; + done = true; + resolve(self, value); + }, function (reason) { + if (done) + return; + done = true; + reject(self, reason); + }); + } catch (ex) { + if (done) + return; + done = true; + reject(self, ex); + } + } + Promise.prototype['catch'] = function (onRejected) { + return this.then(null, onRejected); + }; + Promise.prototype.then = function (onFulfilled, onRejected) { + var prom = new this.constructor(noop); + handle(this, new Handler(onFulfilled, onRejected, prom)); + return prom; + }; + Promise.all = function (arr) { + var args = Array.prototype.slice.call(arr); + return new Promise(function (resolve, reject) { + if (args.length === 0) + return resolve([]); + var remaining = args.length; + function res(i, val) { + try { + if (val && (typeof val === 'object' || typeof val === 'function')) { + var then = val.then; + if (typeof then === 'function') { + then.call(val, function (val) { + res(i, val); + }, reject); + return; + } + } + args[i] = val; + if (--remaining === 0) { + resolve(args); + } + } catch (ex) { + reject(ex); + } + } + for (var i = 0; i < args.length; i++) { + res(i, args[i]); + } + }); + }; + Promise.resolve = function (value) { + if (value && typeof value === 'object' && value.constructor === Promise) { + return value; + } + return new Promise(function (resolve) { + resolve(value); + }); + }; + Promise.reject = function (value) { + return new Promise(function (resolve, reject) { + reject(value); + }); + }; + Promise.race = function (values) { + return new Promise(function (resolve, reject) { + for (var i = 0, len = values.length; i < len; i++) { + values[i].then(resolve, reject); + } + }); + }; + Promise._immediateFn = typeof setImmediate === 'function' ? function (fn) { + setImmediate(fn); + } : function (fn) { + setTimeoutFunc(fn, 0); + }; + Promise._unhandledRejectionFn = function _unhandledRejectionFn(err) { + if (typeof console !== 'undefined' && console) { + console.warn('Possible Unhandled Promise Rejection:', err); + } + }; + Promise._setImmediateFn = function _setImmediateFn(fn) { + Promise._immediateFn = fn; + }; + Promise._setUnhandledRejectionFn = function _setUnhandledRejectionFn(fn) { + Promise._unhandledRejectionFn = fn; + }; + if (typeof module !== 'undefined' && module.exports) { + module.exports = Promise; + } else if (!root.Promise) { + root.Promise = Promise; + } + }(this)); + }.call(this, require('timers').setImmediate)); + }, + { 'timers': 3 } + ], + 3: [ + function (require, module, exports) { + (function (setImmediate, clearImmediate) { + var nextTick = require('process/browser.js').nextTick; + var apply = Function.prototype.apply; + var slice = Array.prototype.slice; + var immediateIds = {}; + var nextImmediateId = 0; + exports.setTimeout = function () { + return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout); + }; + exports.setInterval = function () { + return new Timeout(apply.call(setInterval, window, arguments), clearInterval); + }; + exports.clearTimeout = exports.clearInterval = function (timeout) { + timeout.close(); + }; + function Timeout(id, clearFn) { + this._id = id; + this._clearFn = clearFn; + } + Timeout.prototype.unref = Timeout.prototype.ref = function () { + }; + Timeout.prototype.close = function () { + this._clearFn.call(window, this._id); + }; + exports.enroll = function (item, msecs) { + clearTimeout(item._idleTimeoutId); + item._idleTimeout = msecs; + }; + exports.unenroll = function (item) { + clearTimeout(item._idleTimeoutId); + item._idleTimeout = -1; + }; + exports._unrefActive = exports.active = function (item) { + clearTimeout(item._idleTimeoutId); + var msecs = item._idleTimeout; + if (msecs >= 0) { + item._idleTimeoutId = setTimeout(function onTimeout() { + if (item._onTimeout) + item._onTimeout(); + }, msecs); + } + }; + exports.setImmediate = typeof setImmediate === 'function' ? setImmediate : function (fn) { + var id = nextImmediateId++; + var args = arguments.length < 2 ? false : slice.call(arguments, 1); + immediateIds[id] = true; + nextTick(function onNextTick() { + if (immediateIds[id]) { + if (args) { + fn.apply(null, args); + } else { + fn.call(null); + } + exports.clearImmediate(id); + } + }); + return id; + }; + exports.clearImmediate = typeof clearImmediate === 'function' ? clearImmediate : function (id) { + delete immediateIds[id]; + }; + }.call(this, require('timers').setImmediate, require('timers').clearImmediate)); + }, + { + 'process/browser.js': 1, + 'timers': 3 + } + ], + 4: [ + function (require, module, exports) { + var promisePolyfill = require('promise-polyfill'); + var Global = function () { + if (typeof window !== 'undefined') { + return window; + } else { + return Function('return this;')(); + } + }(); + module.exports = { boltExport: Global.Promise || promisePolyfill }; + }, + { 'promise-polyfill': 2 } + ] + }, {}, [4])(4); + })); + }(undefined, exports$1, module, undefined)); + var Promise = module.exports.boltExport; + var nu = function (baseFn) { var data = Option.none(); var callbacks = []; @@ -719,42 +1200,31 @@ pure: pure }; - var bounce = function (f) { - return function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - var me = this; - domGlobals.setTimeout(function () { - f.apply(me, args); - }, 0); - }; + var errorReporter = function (err) { + domGlobals.setTimeout(function () { + throw err; + }, 0); }; - - var nu$1 = function (baseFn) { + var make = function (run) { var get = function (callback) { - baseFn(bounce(callback)); + run().then(callback, errorReporter); }; var map = function (fab) { - return nu$1(function (callback) { - get(function (a) { - var value = fab(a); - callback(value); - }); + return make(function () { + return run().then(fab); }); }; var bind = function (aFutureB) { - return nu$1(function (callback) { - get(function (a) { - aFutureB(a).get(callback); + return make(function () { + return run().then(function (v) { + return aFutureB(v).toPromise(); }); }); }; var anonBind = function (futureB) { - return nu$1(function (callback) { - get(function (a) { - futureB.get(callback); + return make(function () { + return run().then(function () { + return futureB.toPromise(); }); }); }; @@ -763,25 +1233,32 @@ }; var toCached = function () { var cache = null; - return nu$1(function (callback) { + return make(function () { if (cache === null) { - cache = toLazy(); + cache = run(); } - cache.get(callback); + return cache; }); }; + var toPromise = run; return { map: map, bind: bind, anonBind: anonBind, toLazy: toLazy, toCached: toCached, + toPromise: toPromise, get: get }; }; + var nu$1 = function (baseFn) { + return make(function () { + return new Promise(baseFn); + }); + }; var pure$1 = function (a) { - return nu$1(function (callback) { - callback(a); + return make(function () { + return Promise.resolve(a); }); }; var Future = { @@ -789,11 +1266,11 @@ pure: pure$1 }; - var global$5 = tinymce.util.Tools.resolve('tinymce.util.Delay'); + var global$6 = tinymce.util.Tools.resolve('tinymce.util.Delay'); var delayedConfirm = function (editor, message, callback) { var rng = editor.selection.getRng(); - global$5.setEditorTimeout(editor, function () { + global$6.setEditorTimeout(editor, function () { editor.windowManager.confirm(message, function (state) { editor.selection.setRng(rng); callback(state); @@ -857,15 +1334,15 @@ var AnchorListOptions = { getAnchors: getAnchors }; var getClasses = function (editor) { - if (Settings.hasLinkClassList(editor.settings)) { - var list = Settings.getLinkClassList(editor.settings); + var list = Settings.getLinkClassList(editor); + if (list.length > 0) { return ListOptions.sanitize(list); } return Option.none(); }; var ClassListOptions = { getClasses: getClasses }; - var global$6 = tinymce.util.Tools.resolve('tinymce.util.XHR'); + var global$7 = tinymce.util.Tools.resolve('tinymce.util.XHR'); var parseJson = function (text) { try { @@ -878,10 +1355,10 @@ var extractor = function (item) { return editor.convertURL(item.value || item.url, 'href'); }; - var linkList = Settings.getLinkList(editor.settings); + var linkList = Settings.getLinkList(editor); return Future.nu(function (callback) { - if (typeof linkList === 'string') { - global$6.send({ + if (isString(linkList)) { + global$7.send({ url: linkList, success: function (text) { return callback(parseJson(text)); @@ -890,7 +1367,7 @@ return callback(Option.none()); } }); - } else if (typeof linkList === 'function') { + } else if (isFunction(linkList)) { linkList(function (output) { return callback(Option.some(output)); }); @@ -913,10 +1390,10 @@ var LinkListOptions = { getLinks: getLinks }; var getRels = function (editor, initialTarget) { - if (Settings.hasRelList(editor.settings)) { - var list = Settings.getRelList(editor.settings); + var list = Settings.getRelList(editor); + if (list.length > 0) { var isTargetBlank_1 = initialTarget.is('_blank'); - var enforceSafe = Settings.allowUnsafeLinkTarget(editor.settings) === false; + var enforceSafe = Settings.allowUnsafeLinkTarget(editor) === false; var safeRelExtractor = function (item) { return Utils.applyRelTargetRules(ListOptions.getValue(item), isTargetBlank_1); }; @@ -938,13 +1415,15 @@ } ]; var getTargets = function (editor) { - if (Settings.shouldShowTargetList(editor.settings)) { - var list = Settings.getTargetList(editor.settings); + var list = Settings.getTargetList(editor); + if (isArray(list)) { return ListOptions.sanitize(list).orThunk(function () { return Option.some(fallbacks); }); + } else if (list === false) { + return Option.none(); } - return Option.none(); + return Option.some(fallbacks); }; var TargetOptions = { getTargets: getTargets }; @@ -952,10 +1431,10 @@ var val = dom.getAttrib(elem, name); return val !== null && val.length > 0 ? Option.some(val) : Option.none(); }; - var extractFromAnchor = function (editor, settings, anchor, selection) { + var extractFromAnchor = function (editor, anchor) { var dom = editor.dom; - var onlyText = Utils.isOnlyTextSelected(selection.getContent()); - var text = onlyText ? Option.some(Utils.getAnchorText(selection, anchor)) : Option.none(); + var onlyText = Utils.isOnlyTextSelected(editor.selection.getContent()); + var text = onlyText ? Option.some(Utils.getAnchorText(editor.selection, anchor)) : Option.none(); var url = anchor ? Option.some(dom.getAttrib(anchor, 'href')) : Option.none(); var target = anchor ? Option.from(dom.getAttrib(anchor, 'target')) : Option.none(); var rel = nonEmptyAttr(dom, anchor, 'rel'); @@ -970,9 +1449,9 @@ linkClass: linkClass }; }; - var collect = function (editor, settings, linkNode) { + var collect = function (editor, linkNode) { return LinkListOptions.getLinks(editor).map(function (links) { - var anchor = extractFromAnchor(editor, settings, linkNode, editor.selection); + var anchor = extractFromAnchor(editor, linkNode); return { anchor: anchor, catalogs: { @@ -983,7 +1462,7 @@ link: links }, optNode: Option.from(linkNode), - flags: { titleEnabled: Settings.shouldShowLinkTitle(settings) } + flags: { titleEnabled: Settings.shouldShowLinkTitle(editor) } }; }); }; @@ -1022,9 +1501,8 @@ }; }; var collectData = function (editor) { - var settings = editor.settings; var anchorNode = Utils.getAnchorElement(editor); - return DialogInfo.collect(editor, settings, anchorNode); + return DialogInfo.collect(editor, anchorNode); }; var getInitialData = function (info, defaultTarget) { return { @@ -1050,7 +1528,7 @@ linkClass: info.anchor.linkClass.getOr('') }; }; - var makeDialog = function (settings, onSubmit, editorSettings) { + var makeDialog = function (settings, onSubmit, editor) { var urlInput = [{ name: 'url', type: 'urlinput', @@ -1069,7 +1547,7 @@ type: 'input', label: 'Title' }] : []; - var defaultTarget = Settings.hasDefaultLinkTarget(editorSettings) ? Option.some(Settings.getDefaultLinkTarget(editorSettings)) : Option.none(); + var defaultTarget = Option.from(Settings.getDefaultLinkTarget(editor)); var initialData = getInitialData(settings, defaultTarget); var dialogDelta = DialogChanges.init(initialData, settings); var catalogs = settings.catalogs; @@ -1118,8 +1596,8 @@ var open$1 = function (editor) { var data = collectData(editor); data.map(function (info) { - var onSubmit = handleSubmit(editor, info, Settings.assumeExternalTargets(editor.settings)); - return makeDialog(info, onSubmit, editor.settings); + var onSubmit = handleSubmit(editor, info, Settings.assumeExternalTargets(editor)); + return makeDialog(info, onSubmit, editor); }).get(function (spec) { editor.windowManager.open(spec); }); @@ -1161,7 +1639,7 @@ var leftClickedOnAHref = function (editor) { return function (elm) { var sel, rng, node; - if (Settings.hasContextToolbar(editor.settings) && Utils.isLink(elm)) { + if (Settings.hasContextToolbar(editor) && Utils.isLink(elm)) { sel = editor.selection; rng = sel.getRng(); node = rng.startContainer; @@ -1175,7 +1653,7 @@ var setupGotoLinks = function (editor) { editor.on('click', function (e) { var link = getLink(editor, e.target); - if (link && global$1.metaKeyPressed(e)) { + if (link && global$2.metaKeyPressed(e)) { e.preventDefault(); gotoLink(editor, link); } @@ -1222,7 +1700,7 @@ var register = function (editor) { editor.addCommand('mceLink', function () { - if (Settings.useQuickLink(editor.settings)) { + if (Settings.useQuickLink(editor)) { editor.fire('contexttoolbar-show', { toolbarKey: 'quicklink' }); } else { Actions.openDialog(editor)(); @@ -1304,7 +1782,7 @@ }, label: 'Link', predicate: function (node) { - return !!Utils.getAnchorElement(editor, node) && Settings.hasContextToolbar(editor.settings); + return !!Utils.getAnchorElement(editor, node) && Settings.hasContextToolbar(editor); }, initValue: function () { var elm = Utils.getAnchorElement(editor); @@ -1381,7 +1859,7 @@ }; function Plugin () { - global.add('link', function (editor) { + global$1.add('link', function (editor) { Controls.setupButtons(editor); Controls.setupMenuItems(editor); Controls.setupContextMenu(editor); diff --git a/plugins/link/plugin.min.js b/plugins/link/plugin.min.js index 5b6d64ad..242abddc 100644 --- a/plugins/link/plugin.min.js +++ b/plugins/link/plugin.min.js @@ -4,6 +4,6 @@ * For LGPL see License.txt in the project root for license information. * For commercial licenses see https://www.tiny.cloud/ * - * Version: 5.0.12 (2019-07-18) + * Version: 5.0.13 (2019-08-06) */ -!function(a){"use strict";var n,t,e,r,o,i=tinymce.util.Tools.resolve("tinymce.PluginManager"),u=tinymce.util.Tools.resolve("tinymce.util.VK"),c=function(n){return n.target_list},l=function(n){return n.rel_list},f=function(n){return n.link_class_list},v=function(n){var t=n.link_assume_external_targets;return"boolean"==typeof t&&t?1:"string"!=typeof t||"http"!==t&&"https"!==t?0:t},s=function(n){return"boolean"==typeof n.link_context_toolbar&&n.link_context_toolbar},g=function(n){return n.link_list},y=function(n){return"string"==typeof n.default_link_target},k=function(n){return n.default_link_target},m=c,d=function(n){return!1!==c(n)},h=l,x=function(n){return l(n)!==undefined},p=f,b=function(n){return f(n)!==undefined},O=function(n){return!1!==n.link_title},w=function(n){return"boolean"==typeof n.allow_unsafe_link_target&&n.allow_unsafe_link_target},A=function(n){return!0===n.link_quicklink},C=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),_=tinymce.util.Tools.resolve("tinymce.Env"),T=function(n){if(!_.ie||10<_.ie){var t=a.document.createElement("a");t.target="_blank",t.href=n,t.rel="noreferrer noopener";var e=a.document.createEvent("MouseEvents");e.initMouseEvent("click",!0,!0,a.window,0,0,0,0,0,!1,!1,!1,!1,0,null),i=t,u=e,a.document.body.appendChild(i),i.dispatchEvent(u),a.document.body.removeChild(i)}else{var r=a.window.open("","_blank");if(r){r.opener=null;var o=r.document;o.open(),o.write(''),o.close()}}var i,u},N=function(){},S=function(n){return function(){return n}},D=S(!1),M=S(!0),L=D,E=M,U=function(){return R},R=(r={fold:function(n,t){return n()},is:L,isSome:L,isNone:E,getOr:e=function(n){return n},getOrThunk:t=function(n){return n()},getOrDie:function(n){throw new Error(n||"error: getOrDie called on none.")},getOrNull:function(){return null},getOrUndefined:function(){return undefined},or:e,orThunk:t,map:U,ap:U,each:function(){},bind:U,flatten:U,exists:L,forall:E,filter:U,equals:n=function(n){return n.isNone()},equals_:n,toArray:function(){return[]},toString:S("none()")},Object.freeze&&Object.freeze(r),r),P=function(e){var n=function(){return e},t=function(){return o},r=function(n){return n(e)},o={fold:function(n,t){return t(e)},is:function(n){return e===n},isSome:E,isNone:L,getOr:n,getOrThunk:n,getOrDie:n,getOrNull:n,getOrUndefined:n,or:t,orThunk:t,map:function(n){return P(n(e))},ap:function(n){return n.fold(U,function(n){return P(n(e))})},each:function(n){n(e)},bind:r,flatten:n,exists:r,forall:r,filter:function(n){return n(e)?o:R},equals:function(n){return n.is(e)},equals_:function(n,t){return n.fold(L,function(n){return t(e,n)})},toArray:function(){return[e]},toString:function(){return"some("+e+")"}};return o},z={some:P,none:U,from:function(n){return null===n||n===undefined?R:P(n)}},q=function(t){return function(n){return function(n){if(null===n)return"null";var t=typeof n;return"object"===t&&(Array.prototype.isPrototypeOf(n)||n.constructor&&"Array"===n.constructor.name)?"array":"object"===t&&(String.prototype.isPrototypeOf(n)||n.constructor&&"String"===n.constructor.name)?"string":t}(n)===t}},K=q("string"),I=q("array"),j=q("function"),B=Array.prototype.slice,V=(o=Array.prototype.indexOf)===undefined?function(n,t){return W(n,t)}:function(n,t){return o.call(n,t)},F=function(n,t){for(var e=0,r=n.length;e]+>[^<]+<\/a>$/.test(n)||-1===n.indexOf("href=")))},fn=Y,sn=function(n,t){var e=t?t.innerText||t.textContent:n.getContent({format:"text"});return e.replace(/\uFEFF/g,"")},gn=Q,mn=X,dn=function(n,t){for(var e=0;e'),o.close()}}var i,u},E=function(){},I=function(n){return function(){return n}},j=I(!1),S=I(!0),F=j,L=S,R=function(){return D},D=(r={fold:function(n,t){return n()},is:F,isSome:F,isNone:L,getOr:e=function(n){return n},getOrThunk:t=function(n){return n()},getOrDie:function(n){throw new Error(n||"error: getOrDie called on none.")},getOrNull:function(){return null},getOrUndefined:function(){return undefined},or:e,orThunk:t,map:R,ap:R,each:function(){},bind:R,flatten:R,exists:F,forall:L,filter:R,equals:n=function(n){return n.isNone()},equals_:n,toArray:function(){return[]},toString:I("none()")},Object.freeze&&Object.freeze(r),r),U=function(e){var n=function(){return e},t=function(){return o},r=function(n){return n(e)},o={fold:function(n,t){return t(e)},is:function(n){return e===n},isSome:L,isNone:F,getOr:n,getOrThunk:n,getOrDie:n,getOrNull:n,getOrUndefined:n,or:t,orThunk:t,map:function(n){return U(n(e))},ap:function(n){return n.fold(R,function(n){return U(n(e))})},each:function(n){n(e)},bind:r,flatten:n,exists:r,forall:r,filter:function(n){return n(e)?o:D},equals:function(n){return n.is(e)},equals_:function(n,t){return n.fold(F,function(n){return t(e,n)})},toArray:function(){return[e]},toString:function(){return"some("+e+")"}};return o},M={some:U,none:R,from:function(n){return null===n||n===undefined?D:U(n)}},z=Array.prototype.slice,q=(o=Array.prototype.indexOf)===undefined?function(n,t){return B(n,t)}:function(n,t){return o.call(n,t)},K=function(n,t){for(var e=0,r=n.length;e]+>[^<]+<\/a>$/.test(n)||-1===n.indexOf("href=")))},an=X,ln=function(n,t){var e=t?t.innerText||t.textContent:n.getContent({format:"text"});return e.replace(/\uFEFF/g,"")},fn=J,sn=G,dn=function(n,t){for(var e=0;e 1) { - domGlobals.console.error('HTML does not have a single root node', html); - throw new Error('HTML must have a single root node'); - } - return fromDom(div.childNodes[0]); - }; - var fromTag = function (tag, scope) { - var doc = scope || domGlobals.document; - var node = doc.createElement(tag); - return fromDom(node); - }; - var fromText = function (text, scope) { - var doc = scope || domGlobals.document; - var node = doc.createTextNode(text); - return fromDom(node); - }; - var fromDom = function (node) { - if (node === null || node === undefined) { - throw new Error('Node cannot be null or undefined'); - } - return { dom: constant(node) }; - }; - var fromPoint = function (docElm, x, y) { - var doc = docElm.dom(); - return Option.from(doc.elementFromPoint(x, y)).map(fromDom); - }; - var Element = { - fromHtml: fromHtml, - fromTag: fromTag, - fromText: fromText, - fromDom: fromDom, - fromPoint: fromPoint - }; - - var Global = typeof domGlobals.window !== 'undefined' ? domGlobals.window : Function('return this;')(); - - var path = function (parts, scope) { - var o = scope !== undefined && scope !== null ? scope : Global; - for (var i = 0; i < parts.length && o !== undefined && o !== null; ++i) { - o = o[parts[i]]; - } - return o; - }; - var resolve = function (p, scope) { - var parts = p.split('.'); - return path(parts, scope); - }; - - var unsafe = function (name, scope) { - return resolve(name, scope); - }; - var getOrDie = function (name, scope) { - var actual = unsafe(name, scope); - if (actual === undefined || actual === null) { - throw new Error(name + ' not available on this browser'); - } - return actual; - }; - var Global$1 = { getOrDie: getOrDie }; - - var node = function () { - var f = Global$1.getOrDie('Node'); - return f; - }; var compareDocumentPosition = function (a, b, match) { return (a.compareDocumentPosition(b) & match) !== 0; }; var documentPositionPreceding = function (a, b) { - return compareDocumentPosition(a, b, node().DOCUMENT_POSITION_PRECEDING); + return compareDocumentPosition(a, b, domGlobals.Node.DOCUMENT_POSITION_PRECEDING); }; var documentPositionContainedBy = function (a, b) { - return compareDocumentPosition(a, b, node().DOCUMENT_POSITION_CONTAINED_BY); + return compareDocumentPosition(a, b, domGlobals.Node.DOCUMENT_POSITION_CONTAINED_BY); }; var Node = { documentPositionPreceding: documentPositionPreceding, @@ -685,6 +617,44 @@ }); var PlatformDetection$1 = { detect: detect$3 }; + var fromHtml = function (html, scope) { + var doc = scope || domGlobals.document; + var div = doc.createElement('div'); + div.innerHTML = html; + if (!div.hasChildNodes() || div.childNodes.length > 1) { + domGlobals.console.error('HTML does not have a single root node', html); + throw new Error('HTML must have a single root node'); + } + return fromDom(div.childNodes[0]); + }; + var fromTag = function (tag, scope) { + var doc = scope || domGlobals.document; + var node = doc.createElement(tag); + return fromDom(node); + }; + var fromText = function (text, scope) { + var doc = scope || domGlobals.document; + var node = doc.createTextNode(text); + return fromDom(node); + }; + var fromDom = function (node) { + if (node === null || node === undefined) { + throw new Error('Node cannot be null or undefined'); + } + return { dom: constant(node) }; + }; + var fromPoint = function (docElm, x, y) { + var doc = docElm.dom(); + return Option.from(doc.elementFromPoint(x, y)).map(fromDom); + }; + var Element = { + fromHtml: fromHtml, + fromTag: fromTag, + fromText: fromText, + fromDom: fromDom, + fromPoint: fromPoint + }; + var ATTRIBUTE = domGlobals.Node.ATTRIBUTE_NODE; var CDATA_SECTION = domGlobals.Node.CDATA_SECTION_NODE; var COMMENT = domGlobals.Node.COMMENT_NODE; @@ -737,11 +707,152 @@ var global$3 = tinymce.util.Tools.resolve('tinymce.util.VK'); - var global$4 = tinymce.util.Tools.resolve('tinymce.dom.BookmarkManager'); + var liftN = function (arr, f) { + var r = []; + for (var i = 0; i < arr.length; i++) { + var x = arr[i]; + if (x.isSome()) { + r.push(x.getOrDie()); + } else { + return Option.none(); + } + } + return Option.some(f.apply(null, r)); + }; - var global$5 = tinymce.util.Tools.resolve('tinymce.util.Tools'); + var fromElements = function (elements, scope) { + var doc = scope || domGlobals.document; + var fragment = doc.createDocumentFragment(); + each(elements, function (element) { + fragment.appendChild(element.dom()); + }); + return Element.fromDom(fragment); + }; + + var Immutable = function () { + var fields = []; + for (var _i = 0; _i < arguments.length; _i++) { + fields[_i] = arguments[_i]; + } + return function () { + var values = []; + for (var _i = 0; _i < arguments.length; _i++) { + values[_i] = arguments[_i]; + } + if (fields.length !== values.length) { + throw new Error('Wrong number of arguments to struct. Expected "[' + fields.length + ']", got ' + values.length + ' arguments'); + } + var struct = {}; + each(fields, function (name, i) { + struct[name] = constant(values[i]); + }); + return struct; + }; + }; + + var keys = Object.keys; + var each$1 = function (obj, f) { + var props = keys(obj); + for (var k = 0, len = props.length; k < len; k++) { + var i = props[k]; + var x = obj[i]; + f(x, i, obj); + } + }; + + var parent = function (element) { + var dom = element.dom(); + return Option.from(dom.parentNode).map(Element.fromDom); + }; + var children = function (element) { + var dom = element.dom(); + return map(dom.childNodes, Element.fromDom); + }; + var child = function (element, index) { + var cs = element.dom().childNodes; + return Option.from(cs[index]).map(Element.fromDom); + }; + var firstChild = function (element) { + return child(element, 0); + }; + var lastChild = function (element) { + return child(element, element.dom().childNodes.length - 1); + }; + var spot = Immutable('element', 'offset'); + + var before = function (marker, element) { + var parent$1 = parent(marker); + parent$1.each(function (v) { + v.dom().insertBefore(element.dom(), marker.dom()); + }); + }; + var append = function (parent, element) { + parent.dom().appendChild(element.dom()); + }; + + var before$1 = function (marker, elements) { + each(elements, function (x) { + before(marker, x); + }); + }; + var append$1 = function (parent, elements) { + each(elements, function (x) { + append(parent, x); + }); + }; + + var remove = function (element) { + var dom = element.dom(); + if (dom.parentNode !== null) { + dom.parentNode.removeChild(dom); + } + }; + + var fireListEvent = function (editor, action, element) { + return editor.fire('ListMutation', { + action: action, + element: element + }); + }; + + var Global = typeof domGlobals.window !== 'undefined' ? domGlobals.window : Function('return this;')(); + + var path = function (parts, scope) { + var o = scope !== undefined && scope !== null ? scope : Global; + for (var i = 0; i < parts.length && o !== undefined && o !== null; ++i) { + o = o[parts[i]]; + } + return o; + }; + var resolve = function (p, scope) { + var parts = p.split('.'); + return path(parts, scope); + }; + + var unsafe = function (name, scope) { + return resolve(name, scope); + }; + var getOrDie = function (name, scope) { + var actual = unsafe(name, scope); + if (actual === undefined || actual === null) { + throw new Error(name + ' not available on this browser'); + } + return actual; + }; + var Global$1 = { getOrDie: getOrDie }; + + var htmlElement = function (scope) { + return Global$1.getOrDie('HTMLElement', scope); + }; + var isPrototypeOf = function (x) { + var scope = resolve('ownerDocument.defaultView', x); + return htmlElement(scope).prototype.isPrototypeOf(x); + }; + var HTMLElement = { isPrototypeOf: isPrototypeOf }; - var global$6 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils'); + var global$4 = tinymce.util.Tools.resolve('tinymce.dom.DomQuery'); + + var global$5 = tinymce.util.Tools.resolve('tinymce.util.Tools'); var isTextNode = function (node) { return node && node.nodeType === 3; @@ -812,136 +923,6 @@ isChildOfBody: isChildOfBody }; - var getNormalizedPoint = function (container, offset) { - if (NodeType.isTextNode(container)) { - return { - container: container, - offset: offset - }; - } - var node = global$1.getNode(container, offset); - if (NodeType.isTextNode(node)) { - return { - container: node, - offset: offset >= container.childNodes.length ? node.data.length : 0 - }; - } else if (node.previousSibling && NodeType.isTextNode(node.previousSibling)) { - return { - container: node.previousSibling, - offset: node.previousSibling.data.length - }; - } else if (node.nextSibling && NodeType.isTextNode(node.nextSibling)) { - return { - container: node.nextSibling, - offset: 0 - }; - } - return { - container: container, - offset: offset - }; - }; - var normalizeRange = function (rng) { - var outRng = rng.cloneRange(); - var rangeStart = getNormalizedPoint(rng.startContainer, rng.startOffset); - outRng.setStart(rangeStart.container, rangeStart.offset); - var rangeEnd = getNormalizedPoint(rng.endContainer, rng.endOffset); - outRng.setEnd(rangeEnd.container, rangeEnd.offset); - return outRng; - }; - var Range = { - getNormalizedPoint: getNormalizedPoint, - normalizeRange: normalizeRange - }; - - var DOM = global$6.DOM; - var createBookmark = function (rng) { - var bookmark = {}; - var setupEndPoint = function (start) { - var offsetNode, container, offset; - container = rng[start ? 'startContainer' : 'endContainer']; - offset = rng[start ? 'startOffset' : 'endOffset']; - if (container.nodeType === 1) { - offsetNode = DOM.create('span', { 'data-mce-type': 'bookmark' }); - if (container.hasChildNodes()) { - offset = Math.min(offset, container.childNodes.length - 1); - if (start) { - container.insertBefore(offsetNode, container.childNodes[offset]); - } else { - DOM.insertAfter(offsetNode, container.childNodes[offset]); - } - } else { - container.appendChild(offsetNode); - } - container = offsetNode; - offset = 0; - } - bookmark[start ? 'startContainer' : 'endContainer'] = container; - bookmark[start ? 'startOffset' : 'endOffset'] = offset; - }; - setupEndPoint(true); - if (!rng.collapsed) { - setupEndPoint(); - } - return bookmark; - }; - var resolveBookmark = function (bookmark) { - function restoreEndPoint(start) { - var container, offset, node; - var nodeIndex = function (container) { - var node = container.parentNode.firstChild, idx = 0; - while (node) { - if (node === container) { - return idx; - } - if (node.nodeType !== 1 || node.getAttribute('data-mce-type') !== 'bookmark') { - idx++; - } - node = node.nextSibling; - } - return -1; - }; - container = node = bookmark[start ? 'startContainer' : 'endContainer']; - offset = bookmark[start ? 'startOffset' : 'endOffset']; - if (!container) { - return; - } - if (container.nodeType === 1) { - offset = nodeIndex(container); - container = container.parentNode; - DOM.remove(node); - if (!container.hasChildNodes() && DOM.isBlock(container)) { - container.appendChild(DOM.create('br')); - } - } - bookmark[start ? 'startContainer' : 'endContainer'] = container; - bookmark[start ? 'startOffset' : 'endOffset'] = offset; - } - restoreEndPoint(true); - restoreEndPoint(); - var rng = DOM.createRng(); - rng.setStart(bookmark.startContainer, bookmark.startOffset); - if (bookmark.endContainer) { - rng.setEnd(bookmark.endContainer, bookmark.endOffset); - } - return Range.normalizeRange(rng); - }; - var Bookmark = { - createBookmark: createBookmark, - resolveBookmark: resolveBookmark - }; - - var htmlElement = function (scope) { - return Global$1.getOrDie('HTMLElement', scope); - }; - var isPrototypeOf = function (x) { - var scope = resolve('ownerDocument.defaultView', x); - return htmlElement(scope).prototype.isPrototypeOf(x); - }; - var HTMLElement = { isPrototypeOf: isPrototypeOf }; - - var global$7 = tinymce.util.Tools.resolve('tinymce.dom.DomQuery'); - var getParentList = function (editor) { var selectionStart = editor.selection.getStart(true); return editor.dom.getParent(selectionStart, 'OL,UL,DL', getClosestListRootElm(editor, selectionStart)); @@ -970,7 +951,7 @@ var parentLi = editor.dom.getParent(elm, 'li,dd,dt', getClosestListRootElm(editor, elm)); return parentLi ? parentLi : elm; }); - return global$7.unique(listItemsElms); + return global$4.unique(listItemsElms); }; var getSelectedListItems = function (editor) { var selectedBlocks = editor.selection.getSelectedBlocks(); @@ -990,134 +971,84 @@ var parentLists = editor.dom.getParents(elm, 'ol,ul', getClosestListRootElm(editor, elm)); return last(parentLists); }; - var getSelectedLists = function (editor) { - var firstList = findLastParentListNode(editor, editor.selection.getStart()); - var subsequentLists = filter(editor.selection.getSelectedBlocks(), NodeType.isOlUlNode); - return firstList.toArray().concat(subsequentLists); - }; - var getSelectedListRoots = function (editor) { - var selectedLists = getSelectedLists(editor); - return getUniqueListRoots(editor, selectedLists); - }; - var getUniqueListRoots = function (editor, lists) { - var listRoots = map(lists, function (list) { - return findLastParentListNode(editor, list).getOr(list); - }); - return global$7.unique(listRoots); - }; - var isList = function (editor) { - var list = getParentList(editor); - return HTMLElement.isPrototypeOf(list); - }; - var Selection = { - isList: isList, - getParentList: getParentList, - getSelectedSubLists: getSelectedSubLists, - getSelectedListItems: getSelectedListItems, - getClosestListRootElm: getClosestListRootElm, - getSelectedDlItems: getSelectedDlItems, - getSelectedListRoots: getSelectedListRoots - }; - - var liftN = function (arr, f) { - var r = []; - for (var i = 0; i < arr.length; i++) { - var x = arr[i]; - if (x.isSome()) { - r.push(x.getOrDie()); - } else { - return Option.none(); - } - } - return Option.some(f.apply(null, r)); - }; - - var fromElements = function (elements, scope) { - var doc = scope || domGlobals.document; - var fragment = doc.createDocumentFragment(); - each(elements, function (element) { - fragment.appendChild(element.dom()); - }); - return Element.fromDom(fragment); - }; - - var Immutable = function () { - var fields = []; - for (var _i = 0; _i < arguments.length; _i++) { - fields[_i] = arguments[_i]; - } - return function () { - var values = []; - for (var _i = 0; _i < arguments.length; _i++) { - values[_i] = arguments[_i]; - } - if (fields.length !== values.length) { - throw new Error('Wrong number of arguments to struct. Expected "[' + fields.length + ']", got ' + values.length + ' arguments'); - } - var struct = {}; - each(fields, function (name, i) { - struct[name] = constant(values[i]); - }); - return struct; - }; - }; - - var keys = Object.keys; - var each$1 = function (obj, f) { - var props = keys(obj); - for (var k = 0, len = props.length; k < len; k++) { - var i = props[k]; - var x = obj[i]; - f(x, i, obj); - } - }; - - var parent = function (element) { - var dom = element.dom(); - return Option.from(dom.parentNode).map(Element.fromDom); - }; - var children = function (element) { - var dom = element.dom(); - return map(dom.childNodes, Element.fromDom); - }; - var child = function (element, index) { - var cs = element.dom().childNodes; - return Option.from(cs[index]).map(Element.fromDom); - }; - var firstChild = function (element) { - return child(element, 0); - }; - var lastChild = function (element) { - return child(element, element.dom().childNodes.length - 1); - }; - var spot = Immutable('element', 'offset'); - - var before = function (marker, element) { - var parent$1 = parent(marker); - parent$1.each(function (v) { - v.dom().insertBefore(element.dom(), marker.dom()); - }); + var getSelectedLists = function (editor) { + var firstList = findLastParentListNode(editor, editor.selection.getStart()); + var subsequentLists = filter(editor.selection.getSelectedBlocks(), NodeType.isOlUlNode); + return firstList.toArray().concat(subsequentLists); }; - var append = function (parent, element) { - parent.dom().appendChild(element.dom()); + var getSelectedListRoots = function (editor) { + var selectedLists = getSelectedLists(editor); + return getUniqueListRoots(editor, selectedLists); }; - - var before$1 = function (marker, elements) { - each(elements, function (x) { - before(marker, x); + var getUniqueListRoots = function (editor, lists) { + var listRoots = map(lists, function (list) { + return findLastParentListNode(editor, list).getOr(list); }); + return global$4.unique(listRoots); }; - var append$1 = function (parent, elements) { - each(elements, function (x) { - append(parent, x); - }); + var isList = function (editor) { + var list = getParentList(editor); + return HTMLElement.isPrototypeOf(list); + }; + var Selection = { + isList: isList, + getParentList: getParentList, + getSelectedSubLists: getSelectedSubLists, + getSelectedListItems: getSelectedListItems, + getClosestListRootElm: getClosestListRootElm, + getSelectedDlItems: getSelectedDlItems, + getSelectedListRoots: getSelectedListRoots }; - var remove = function (element) { - var dom = element.dom(); - if (dom.parentNode !== null) { - dom.parentNode.removeChild(dom); + var global$6 = tinymce.util.Tools.resolve('tinymce.Env'); + + var createTextBlock = function (editor, contentNode) { + var dom = editor.dom; + var blockElements = editor.schema.getBlockElements(); + var fragment = dom.createFragment(); + var node, textBlock, blockName, hasContentNode; + if (editor.settings.forced_root_block) { + blockName = editor.settings.forced_root_block; + } + if (blockName) { + textBlock = dom.create(blockName); + if (textBlock.tagName === editor.settings.forced_root_block) { + dom.setAttribs(textBlock, editor.settings.forced_root_block_attrs); + } + if (!NodeType.isBlock(contentNode.firstChild, blockElements)) { + fragment.appendChild(textBlock); + } + } + if (contentNode) { + while (node = contentNode.firstChild) { + var nodeName = node.nodeName; + if (!hasContentNode && (nodeName !== 'SPAN' || node.getAttribute('data-mce-type') !== 'bookmark')) { + hasContentNode = true; + } + if (NodeType.isBlock(node, blockElements)) { + fragment.appendChild(node); + textBlock = null; + } else { + if (blockName) { + if (!textBlock) { + textBlock = dom.create(blockName); + fragment.appendChild(textBlock); + } + textBlock.appendChild(node); + } else { + fragment.appendChild(node); + } + } + } + } + if (!editor.settings.forced_root_block) { + fragment.appendChild(dom.create('br')); + } else { + if (!hasContentNode && (!global$6.ie || global$6.ie > 10)) { + textBlock.appendChild(dom.create('br', { 'data-mce-bogus': '1' })); + } } + return fragment; }; var name = function (element) { @@ -1420,64 +1351,6 @@ }); }; - var global$8 = tinymce.util.Tools.resolve('tinymce.Env'); - - var createTextBlock = function (editor, contentNode) { - var dom = editor.dom; - var blockElements = editor.schema.getBlockElements(); - var fragment = dom.createFragment(); - var node, textBlock, blockName, hasContentNode; - if (editor.settings.forced_root_block) { - blockName = editor.settings.forced_root_block; - } - if (blockName) { - textBlock = dom.create(blockName); - if (textBlock.tagName === editor.settings.forced_root_block) { - dom.setAttribs(textBlock, editor.settings.forced_root_block_attrs); - } - if (!NodeType.isBlock(contentNode.firstChild, blockElements)) { - fragment.appendChild(textBlock); - } - } - if (contentNode) { - while (node = contentNode.firstChild) { - var nodeName = node.nodeName; - if (!hasContentNode && (nodeName !== 'SPAN' || node.getAttribute('data-mce-type') !== 'bookmark')) { - hasContentNode = true; - } - if (NodeType.isBlock(node, blockElements)) { - fragment.appendChild(node); - textBlock = null; - } else { - if (blockName) { - if (!textBlock) { - textBlock = dom.create(blockName); - fragment.appendChild(textBlock); - } - textBlock.appendChild(node); - } else { - fragment.appendChild(node); - } - } - } - } - if (!editor.settings.forced_root_block) { - fragment.appendChild(dom.create('br')); - } else { - if (!hasContentNode && (!global$8.ie || global$8.ie > 10)) { - textBlock.appendChild(dom.create('br', { 'data-mce-bogus': '1' })); - } - } - return fragment; - }; - - var fireListEvent = function (editor, action, element) { - return editor.fire('ListMutation', { - action: action, - element: element - }); - }; - var outdentedComposer = function (editor, entries) { return map(entries, function (entry) { var content = fromElements(entry.content); @@ -1511,7 +1384,7 @@ }; }); }; - var listsIndentation = function (editor, lists, indentation) { + var listIndentation = function (editor, lists, indentation) { var entrySets = parseLists(lists, getItemSelection(editor)); each(entrySets, function (entrySet) { indentSelectedEntries(entrySet.entries, indentation); @@ -1524,37 +1397,39 @@ }); }; - var DOM$1 = global$6.DOM; + var global$7 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils'); + + var DOM = global$7.DOM; var splitList = function (editor, ul, li) { var tmpRng, fragment, bookmarks, node, newBlock; var removeAndKeepBookmarks = function (targetNode) { global$5.each(bookmarks, function (node) { targetNode.parentNode.insertBefore(node, li.parentNode); }); - DOM$1.remove(targetNode); + DOM.remove(targetNode); }; - bookmarks = DOM$1.select('span[data-mce-type="bookmark"]', ul); + bookmarks = DOM.select('span[data-mce-type="bookmark"]', ul); newBlock = createTextBlock(editor, li); - tmpRng = DOM$1.createRng(); + tmpRng = DOM.createRng(); tmpRng.setStartAfter(li); tmpRng.setEndAfter(ul); fragment = tmpRng.extractContents(); for (node = fragment.firstChild; node; node = node.firstChild) { if (node.nodeName === 'LI' && editor.dom.isEmpty(node)) { - DOM$1.remove(node); + DOM.remove(node); break; } } if (!editor.dom.isEmpty(fragment)) { - DOM$1.insertAfter(fragment, ul); + DOM.insertAfter(fragment, ul); } - DOM$1.insertAfter(newBlock, ul); + DOM.insertAfter(newBlock, ul); if (NodeType.isEmpty(editor.dom, li.parentNode)) { removeAndKeepBookmarks(li.parentNode); } - DOM$1.remove(li); + DOM.remove(li); if (NodeType.isEmpty(editor.dom, ul)) { - DOM$1.remove(ul); + DOM.remove(ul); } }; var SplitList = { splitList: splitList }; @@ -1583,13 +1458,55 @@ } }; + var getNormalizedPoint = function (container, offset) { + if (NodeType.isTextNode(container)) { + return { + container: container, + offset: offset + }; + } + var node = global$1.getNode(container, offset); + if (NodeType.isTextNode(node)) { + return { + container: node, + offset: offset >= container.childNodes.length ? node.data.length : 0 + }; + } else if (node.previousSibling && NodeType.isTextNode(node.previousSibling)) { + return { + container: node.previousSibling, + offset: node.previousSibling.data.length + }; + } else if (node.nextSibling && NodeType.isTextNode(node.nextSibling)) { + return { + container: node.nextSibling, + offset: 0 + }; + } + return { + container: container, + offset: offset + }; + }; + var normalizeRange = function (rng) { + var outRng = rng.cloneRange(); + var rangeStart = getNormalizedPoint(rng.startContainer, rng.startOffset); + outRng.setStart(rangeStart.container, rangeStart.offset); + var rangeEnd = getNormalizedPoint(rng.endContainer, rng.endOffset); + outRng.setEnd(rangeEnd.container, rangeEnd.offset); + return outRng; + }; + var Range = { + getNormalizedPoint: getNormalizedPoint, + normalizeRange: normalizeRange + }; + var selectionIndentation = function (editor, indentation) { var lists = map(Selection.getSelectedListRoots(editor), Element.fromDom); var dlItems = map(Selection.getSelectedDlItems(editor), Element.fromDom); var isHandled = false; if (lists.length || dlItems.length) { var bookmark = editor.selection.getBookmark(); - listsIndentation(editor, lists, indentation); + listIndentation(editor, lists, indentation); dlIndentation(editor, indentation, dlItems); editor.selection.moveToBookmark(bookmark); editor.selection.setRng(Range.normalizeRange(editor.selection.getRng())); @@ -1608,6 +1525,85 @@ return selectionIndentation(editor, 'Flatten'); }; + var global$8 = tinymce.util.Tools.resolve('tinymce.dom.BookmarkManager'); + + var DOM$1 = global$7.DOM; + var createBookmark = function (rng) { + var bookmark = {}; + var setupEndPoint = function (start) { + var offsetNode, container, offset; + container = rng[start ? 'startContainer' : 'endContainer']; + offset = rng[start ? 'startOffset' : 'endOffset']; + if (container.nodeType === 1) { + offsetNode = DOM$1.create('span', { 'data-mce-type': 'bookmark' }); + if (container.hasChildNodes()) { + offset = Math.min(offset, container.childNodes.length - 1); + if (start) { + container.insertBefore(offsetNode, container.childNodes[offset]); + } else { + DOM$1.insertAfter(offsetNode, container.childNodes[offset]); + } + } else { + container.appendChild(offsetNode); + } + container = offsetNode; + offset = 0; + } + bookmark[start ? 'startContainer' : 'endContainer'] = container; + bookmark[start ? 'startOffset' : 'endOffset'] = offset; + }; + setupEndPoint(true); + if (!rng.collapsed) { + setupEndPoint(); + } + return bookmark; + }; + var resolveBookmark = function (bookmark) { + function restoreEndPoint(start) { + var container, offset, node; + var nodeIndex = function (container) { + var node = container.parentNode.firstChild, idx = 0; + while (node) { + if (node === container) { + return idx; + } + if (node.nodeType !== 1 || node.getAttribute('data-mce-type') !== 'bookmark') { + idx++; + } + node = node.nextSibling; + } + return -1; + }; + container = node = bookmark[start ? 'startContainer' : 'endContainer']; + offset = bookmark[start ? 'startOffset' : 'endOffset']; + if (!container) { + return; + } + if (container.nodeType === 1) { + offset = nodeIndex(container); + container = container.parentNode; + DOM$1.remove(node); + if (!container.hasChildNodes() && DOM$1.isBlock(container)) { + container.appendChild(DOM$1.create('br')); + } + } + bookmark[start ? 'startContainer' : 'endContainer'] = container; + bookmark[start ? 'startOffset' : 'endOffset'] = offset; + } + restoreEndPoint(true); + restoreEndPoint(); + var rng = DOM$1.createRng(); + rng.setStart(bookmark.startContainer, bookmark.startOffset); + if (bookmark.endContainer) { + rng.setEnd(bookmark.endContainer, bookmark.endOffset); + } + return Range.normalizeRange(rng); + }; + var Bookmark = { + createBookmark: createBookmark, + resolveBookmark: resolveBookmark + }; + var isCustomList = function (list) { return /\btox\-/.test(list.className); }; @@ -1695,7 +1691,7 @@ return; } var nextSibling = node.nextSibling; - if (global$4.isBookmarkNode(node)) { + if (global$8.isBookmarkNode(node)) { if (NodeType.isTextBlock(editor, nextSibling) || !nextSibling && node.parentNode === root) { block = null; return; @@ -1853,7 +1849,7 @@ mergeWithAdjacentLists: mergeWithAdjacentLists }; - var DOM$2 = global$6.DOM; + var DOM$2 = global$7.DOM; var normalizeList = function (dom, ul) { var sibling; var parentNode = ul.parentNode; @@ -2004,7 +2000,11 @@ if (isForward) { mergeForward(editor, rng_1, otherLi_1, li); } else { - mergeBackward(editor, rng_1, li, otherLi_1); + if (NodeType.isFirstChild(li)) { + outdentListSelection(editor); + } else { + mergeBackward(editor, rng_1, li, otherLi_1); + } } }); return true; diff --git a/plugins/lists/plugin.min.js b/plugins/lists/plugin.min.js index 67527925..2c5e2a64 100644 --- a/plugins/lists/plugin.min.js +++ b/plugins/lists/plugin.min.js @@ -4,6 +4,6 @@ * For LGPL see License.txt in the project root for license information. * For commercial licenses see https://www.tiny.cloud/ * - * Version: 5.0.12 (2019-07-18) + * Version: 5.0.13 (2019-08-06) */ -!function(u){"use strict";var e,n,t,r,o,i,a,s,c=tinymce.util.Tools.resolve("tinymce.PluginManager"),v=function(e){return function(){return e}},f=function(t){return function(){for(var e=[],n=0;n=e.childNodes.length?t.data.length:0}:t.previousSibling&&we(t.previousSibling)?{container:t.previousSibling,offset:t.previousSibling.data.length}:t.nextSibling&&we(t.nextSibling)?{container:t.nextSibling,offset:0}:{container:e,offset:n}},He=function(e){var n=e.cloneRange(),t=je(e.startContainer,e.startOffset);n.setStart(t.container,t.offset);var r=je(e.endContainer,e.endOffset);return n.setEnd(r.container,r.offset),n},$e=De.DOM,qe=function(o){var i={},e=function(e){var n,t,r;t=o[e?"startContainer":"endContainer"],r=o[e?"startOffset":"endOffset"],1===t.nodeType&&(n=$e.create("span",{"data-mce-type":"bookmark"}),t.hasChildNodes()?(r=Math.min(r,t.childNodes.length-1),e?t.insertBefore(n,t.childNodes[r]):$e.insertAfter(n,t.childNodes[r])):t.appendChild(n),t=n,r=0),i[e?"startContainer":"endContainer"]=t,i[e?"startOffset":"endOffset"]=r};return e(!0),o.collapsed||e(),i},We=function(o){function e(e){var n,t,r;n=r=o[e?"startContainer":"endContainer"],t=o[e?"startOffset":"endOffset"],n&&(1===n.nodeType&&(t=function(e){for(var n=e.parentNode.firstChild,t=0;n;){if(n===e)return t;1===n.nodeType&&"bookmark"===n.getAttribute("data-mce-type")||t++,n=n.nextSibling}return-1}(n),n=n.parentNode,$e.remove(r),!n.hasChildNodes()&&$e.isBlock(n)&&n.appendChild($e.create("br"))),o[e?"startContainer":"endContainer"]=n,o[e?"startOffset":"endOffset"]=t)}e(!0),e();var n=$e.createRng();return n.setStart(o.startContainer,o.startOffset),o.endContainer&&n.setEnd(o.endContainer,o.endOffset),He(n)},Ve=function(e){var n,t=F("ownerDocument.defaultView",e);return(n=t,j("HTMLElement",n)).prototype.isPrototypeOf(e)},ze=tinymce.util.Tools.resolve("tinymce.dom.DomQuery"),Ke=function(e){var n=e.selection.getStart(!0);return e.dom.getParent(n,"OL,UL,DL",Qe(e,n))},Xe=function(e){var t,n,r,o=e.selection.getSelectedBlocks();return Te.grep((t=e,n=o,r=Te.map(n,function(e){var n=t.dom.getParent(e,"li,dd,dt",Qe(t,e));return n||e}),ze.unique(r)),function(e){return Re(e)})},Qe=function(e,n){var t=e.dom.getParents(n,"TD,TH");return 0e.length?Nn(t,e,n):yn(t,e,n)},[]),_(o).map(function(e){return e.list})).toArray();var t,r,o},Pn=function(e){var n,t,r=E(Je.getSelectedListItems(e),M.fromDom);return Ze([x(r,f(On)),x((n=r,t=D.call(n,0),t.reverse(),t),f(On))],function(e,n){return{start:e,end:n}})},Mn=function(a,e,s){var n,t,r,o=(n=e,t=Pn(a),r=wn(!1),E(n,function(e){return{sourceList:e,entries:An(0,t,r,e)}}));w(o,function(e){var n,t;n=e.entries,t=s,w(k(n,bn),function(e){return function(e,n){switch(e){case"Indent":n.depth++;break;case"Outdent":n.depth--;break;case"Flatten":n.depth=0}}(t,e)});var r,o,i,u=(r=a,o=e.entries,I(function(e,n){if(0===e.length)return[];for(var t=n(e[0]),r=[],o=[],i=0,u=e.length;ie.length?Nn(t,e,n):yn(t,e,n)},[]),_(o).map(function(e){return e.list})).toArray();var t,r,o},In=function(e){var n,t,r=E(sn.getSelectedListItems(e),pe.fromDom);return Le([x(r,f(On)),x((n=r,t=D.call(n,0),t.reverse(),t),f(On))],function(e,n){return{start:e,end:n}})},_n=function(a,e,s){var n,t,r,o=(n=e,t=In(a),r=wn(!1),E(n,function(e){return{sourceList:e,entries:An(0,t,r,e)}}));w(o,function(e){var n,t;n=e.entries,t=s,w(k(n,bn),function(e){return function(e,n){switch(e){case"Indent":n.depth++;break;case"Outdent":n.depth--;break;case"Flatten":n.depth=0}}(t,e)});var r,o,i,u=(r=a,o=e.entries,I(function(e,n){if(0===e.length)return[];for(var t=n(e[0]),r=[],o=[],i=0,u=e.length;i=e.childNodes.length?t.data.length:0}:t.previousSibling&&qe(t.previousSibling)?{container:t.previousSibling,offset:t.previousSibling.data.length}:t.nextSibling&&qe(t.nextSibling)?{container:t.nextSibling,offset:0}:{container:e,offset:n}},Hn=function(e){var n=e.cloneRange(),t=jn(e.startContainer,e.startOffset);n.setStart(t.container,t.offset);var r=jn(e.endContainer,e.endOffset);return n.setEnd(r.container,r.offset),n},$n=function(e,n){var t=E(sn.getSelectedListRoots(e),pe.fromDom),r=E(sn.getSelectedDlItems(e),pe.fromDom),o=!1;if(t.length||r.length){var i=e.selection.getBookmark();_n(e,t,n),Fn(e,n,r),e.selection.moveToBookmark(i),e.selection.setRng(Hn(e.selection.getRng())),e.nodeChanged(),o=!0}return o},qn=function(e){return $n(e,"Indent")},Wn=function(e){return $n(e,"Outdent")},Vn=function(e){return $n(e,"Flatten")},zn=tinymce.util.Tools.resolve("tinymce.dom.BookmarkManager"),Kn=Bn.DOM,Xn=function(o){var i={},e=function(e){var n,t,r;t=o[e?"startContainer":"endContainer"],r=o[e?"startOffset":"endOffset"],1===t.nodeType&&(n=Kn.create("span",{"data-mce-type":"bookmark"}),t.hasChildNodes()?(r=Math.min(r,t.childNodes.length-1),e?t.insertBefore(n,t.childNodes[r]):Kn.insertAfter(n,t.childNodes[r])):t.appendChild(n),t=n,r=0),i[e?"startContainer":"endContainer"]=t,i[e?"startOffset":"endOffset"]=r};return e(!0),o.collapsed||e(),i},Qn=function(o){function e(e){var n,t,r;n=r=o[e?"startContainer":"endContainer"],t=o[e?"startOffset":"endOffset"],n&&(1===n.nodeType&&(t=function(e){for(var n=e.parentNode.firstChild,t=0;n;){if(n===e)return t;1===n.nodeType&&"bookmark"===n.getAttribute("data-mce-type")||t++,n=n.nextSibling}return-1}(n),n=n.parentNode,Kn.remove(r),!n.hasChildNodes()&&Kn.isBlock(n)&&n.appendChild(Kn.create("br"))),o[e?"startContainer":"endContainer"]=n,o[e?"startOffset":"endOffset"]=t)}e(!0),e();var n=Kn.createRng();return n.setStart(o.startContainer,o.startOffset),o.endContainer&&n.setEnd(o.endContainer,o.endOffset),Hn(n)},Yn=function(e){return/\btox\-/.test(e.className)},Gn=function(e){switch(e){case"UL":return"ToggleUlList";case"OL":return"ToggleOlList";case"DL":return"ToggleDLList"}},Jn=function(t,e){He.each(e,function(e,n){t.setAttribute(n,e)})},Zn=function(e,n,t){var r,o,i,u,a,s,c;r=e,o=n,u=(i=t)["list-style-type"]?i["list-style-type"]:null,r.setStyle(o,"list-style-type",u),a=e,Jn(s=n,(c=t)["list-attributes"]),He.each(a.select("li",s),function(e){Jn(e,c["list-item-attributes"])})},et=function(e,n,t,r){var o,i;for(o=n[t?"startContainer":"endContainer"],i=n[t?"startOffset":"endOffset"],1===o.nodeType&&(o=o.childNodes[Math.min(i,o.childNodes.length-1)]||o),!t&&Qe(o.nextSibling)&&(o=o.nextSibling);o.parentNode!==r;){if(Ge(e,o))return o;if(/^(TD|TH)$/.test(o.parentNode.nodeName))return o;o=o.parentNode}return o},nt=function(f,d,l){void 0===l&&(l={});var e,n=f.selection.getRng(!0),m="LI",t=sn.getClosestListRootElm(f,f.selection.getStart(!0)),g=f.dom;"false"!==g.getContentEditable(f.selection.getNode())&&("DL"===(d=d.toUpperCase())&&(m="DT"),e=Xn(n),He.each(function(t,e,r){for(var o,i=[],u=t.dom,n=et(t,e,!0,r),a=et(t,e,!1,r),s=[],c=n;c&&(s.push(c),c!==a);c=c.nextSibling);return He.each(s,function(e){if(Ge(t,e))return i.push(e),void(o=null);if(u.isBlock(e)||Qe(e))return Qe(e)&&u.remove(e),void(o=null);var n=e.nextSibling;zn.isBookmarkNode(e)&&(Ge(t,n)||!n&&e.parentNode===r)?o=null:(o||(o=u.create("p"),e.parentNode.insertBefore(o,e),i.push(o)),o.appendChild(e))}),i}(f,n,t),function(e){var n,t,r,o,i,u,a,s,c;(t=e.previousSibling)&&We(t)&&t.nodeName===d&&(r=t,o=l,i=g.getStyle(r,"list-style-type"),u=o?o["list-style-type"]:"",i===(u=null===u?"":u))?(n=t,e=g.rename(e,m),t.appendChild(e)):(n=g.create(d),e.parentNode.insertBefore(n,e),n.appendChild(e),e=g.rename(e,m)),a=g,s=e,c=["margin","margin-right","margin-bottom","margin-left","margin-top","padding","padding-right","padding-bottom","padding-left","padding-top"],He.each(c,function(e){var n;return a.setStyle(s,((n={})[e]="",n))}),Zn(g,n,l),rt(f.dom,n)}),f.selection.setRng(Qn(e)))},tt=function(e,n,t){return s=t,(a=n)&&s&&We(a)&&a.nodeName===s.nodeName&&(i=n,u=t,(o=e).getStyle(i,"list-style-type",!0)===o.getStyle(u,"list-style-type",!0))&&(r=t,n.className===r.className);var r,o,i,u,a,s},rt=function(e,n){var t,r;if(t=n.nextSibling,tt(e,n,t)){for(;r=t.firstChild;)n.appendChild(r);e.remove(t)}if(t=n.previousSibling,tt(e,n,t)){for(;r=t.lastChild;)n.insertBefore(r,n.firstChild);e.remove(t)}},ot=function(n,e,t,r,o){if(e.nodeName!==r||it(o)){var i=Xn(n.selection.getRng(!0));He.each([e].concat(t),function(e){!function(e,n,t,r){if(n.nodeName!==t){var o=e.dom.rename(n,t);Zn(e.dom,o,r),Be(e,Gn(t),o)}else Zn(e.dom,n,r),Be(e,Gn(t),n)}(n,e,r,o)}),n.selection.setRng(Qn(i))}else Vn(n)},it=function(e){return"list-style-type"in e},ut={toggleList:function(e,n,t){var r=sn.getParentList(e),o=sn.getSelectedSubLists(e);t=t||{},r&&0"):"application/x-shockwave-flash"===n.source1mime?(d='',m.poster&&(d+=''),d+=""):-1!==n.source1mime.indexOf("audio")?(s=n,(l=p)?l(s):'"):"script"===n.type?'