From 4f02f5c1f9c3039827c507815fcc135250048fc6 Mon Sep 17 00:00:00 2001 From: Arkadiy Zamaraev Date: Sat, 17 Mar 2018 13:23:20 +0500 Subject: [PATCH] update change log --- .stylelintrc | 34 +- CHANGELOG.rst | 8 +- bower.json | 4 +- package.json | 60 +- tinymce_4/__init__.py | 2 +- .../static/tinymce_4/css/__tinymce-4.css | 2 +- .../tinymce_4/settings/full/settings.js | 2 + .../static/tinymce_4/tinymce/.bower.json | 10 +- .../tinymce_4/tinymce/jquery.tinymce.js | 2 +- .../tinymce_4/tinymce/jquery.tinymce.min.js | 2 +- .../tinymce/plugins/advlist/plugin.js | 522 +- .../tinymce/plugins/advlist/plugin.min.js | 2 +- .../tinymce/plugins/anchor/plugin.js | 425 +- .../tinymce/plugins/anchor/plugin.min.js | 2 +- .../tinymce/plugins/autolink/plugin.js | 530 +- .../tinymce/plugins/autolink/plugin.min.js | 2 +- .../tinymce/plugins/autoresize/plugin.js | 561 +- .../tinymce/plugins/autoresize/plugin.min.js | 2 +- .../tinymce/plugins/autosave/plugin.js | 775 +- .../tinymce/plugins/autosave/plugin.min.js | 2 +- .../tinymce/plugins/bbcode/plugin.js | 339 +- .../tinymce/plugins/bbcode/plugin.min.js | 2 +- .../tinymce/plugins/charmap/plugin.js | 2055 +- .../tinymce/plugins/charmap/plugin.min.js | 2 +- .../tinymce_4/tinymce/plugins/code/plugin.js | 408 +- .../tinymce/plugins/code/plugin.min.js | 2 +- .../tinymce/plugins/codesample/plugin.js | 2265 +- .../tinymce/plugins/codesample/plugin.min.js | 2 +- .../tinymce/plugins/colorpicker/plugin.js | 368 +- .../tinymce/plugins/colorpicker/plugin.min.js | 2 +- .../tinymce/plugins/contextmenu/plugin.js | 1201 +- .../tinymce/plugins/contextmenu/plugin.min.js | 2 +- .../tinymce/plugins/directionality/plugin.js | 318 +- .../plugins/directionality/plugin.min.js | 2 +- .../tinymce/plugins/emoticons/plugin.js | 325 +- .../tinymce/plugins/emoticons/plugin.min.js | 2 +- .../tinymce/plugins/fullpage/plugin.js | 1369 +- .../tinymce/plugins/fullpage/plugin.min.js | 2 +- .../tinymce/plugins/fullscreen/plugin.js | 576 +- .../tinymce/plugins/fullscreen/plugin.min.js | 2 +- .../tinymce/plugins/help/img/logo.png | Bin 23101 -> 13208 bytes .../tinymce_4/tinymce/plugins/help/plugin.js | 2460 +- .../tinymce/plugins/help/plugin.min.js | 2 +- .../tinymce_4/tinymce/plugins/hr/plugin.js | 214 +- .../tinymce/plugins/hr/plugin.min.js | 2 +- .../tinymce_4/tinymce/plugins/image/plugin.js | 2329 +- .../tinymce/plugins/image/plugin.min.js | 2 +- .../tinymce/plugins/imagetools/plugin.js | 7161 +- .../tinymce/plugins/imagetools/plugin.min.js | 3 +- .../tinymce/plugins/importcss/plugin.js | 773 +- .../tinymce/plugins/importcss/plugin.min.js | 2 +- .../tinymce/plugins/insertdatetime/plugin.js | 611 +- .../plugins/insertdatetime/plugin.min.js | 2 +- .../tinymce/plugins/legacyoutput/plugin.js | 583 +- .../plugins/legacyoutput/plugin.min.js | 2 +- .../tinymce_4/tinymce/plugins/link/plugin.js | 1799 +- .../tinymce/plugins/link/plugin.min.js | 2 +- .../tinymce_4/tinymce/plugins/lists/plugin.js | 2794 +- .../tinymce/plugins/lists/plugin.min.js | 2 +- .../tinymce_4/tinymce/plugins/media/plugin.js | 2990 +- .../tinymce/plugins/media/plugin.min.js | 2 +- .../tinymce/plugins/nonbreaking/plugin.js | 367 +- .../tinymce/plugins/nonbreaking/plugin.min.js | 2 +- .../tinymce/plugins/noneditable/plugin.js | 390 +- .../tinymce/plugins/noneditable/plugin.min.js | 2 +- .../tinymce/plugins/pagebreak/plugin.js | 429 +- .../tinymce/plugins/pagebreak/plugin.min.js | 2 +- .../tinymce_4/tinymce/plugins/paste/plugin.js | 4226 +- .../tinymce/plugins/paste/plugin.min.js | 2 +- .../tinymce/plugins/preview/plugin.js | 482 +- .../tinymce/plugins/preview/plugin.min.js | 2 +- .../tinymce_4/tinymce/plugins/print/plugin.js | 214 +- .../tinymce/plugins/print/plugin.min.js | 2 +- .../tinymce_4/tinymce/plugins/save/plugin.js | 450 +- .../tinymce/plugins/save/plugin.min.js | 2 +- .../tinymce/plugins/searchreplace/plugin.js | 1356 +- .../plugins/searchreplace/plugin.min.js | 2 +- .../tinymce/plugins/spellchecker/plugin.js | 1914 +- .../plugins/spellchecker/plugin.min.js | 2 +- .../tinymce/plugins/tabfocus/plugin.js | 487 +- .../tinymce/plugins/tabfocus/plugin.min.js | 2 +- .../tinymce_4/tinymce/plugins/table/plugin.js | 14417 +++- .../tinymce/plugins/table/plugin.min.js | 3 +- .../tinymce/plugins/template/plugin.js | 1111 +- .../tinymce/plugins/template/plugin.min.js | 2 +- .../tinymce/plugins/textcolor/plugin.js | 911 +- .../tinymce/plugins/textcolor/plugin.min.js | 2 +- .../tinymce/plugins/textpattern/plugin.js | 1000 +- .../tinymce/plugins/textpattern/plugin.min.js | 2 +- .../tinymce_4/tinymce/plugins/toc/plugin.js | 729 +- .../tinymce/plugins/toc/plugin.min.js | 2 +- .../tinymce/plugins/visualblocks/plugin.js | 547 +- .../plugins/visualblocks/plugin.min.js | 2 +- .../tinymce/plugins/visualchars/plugin.js | 1902 +- .../tinymce/plugins/visualchars/plugin.min.js | 2 +- .../tinymce/plugins/wordcount/plugin.js | 981 +- .../tinymce/plugins/wordcount/plugin.min.js | 2 +- .../skins/lightgray/content.inline.min.css | 2 +- .../tinymce/skins/lightgray/content.min.css | 2 +- .../tinymce/skins/lightgray/fonts/tinymce.eot | Bin 17572 -> 18808 bytes .../tinymce/skins/lightgray/fonts/tinymce.svg | 2 +- .../tinymce/skins/lightgray/fonts/tinymce.ttf | Bin 17408 -> 18644 bytes .../skins/lightgray/fonts/tinymce.woff | Bin 17484 -> 18720 bytes .../tinymce/skins/lightgray/skin.min.css | 2 +- .../skins/lightgray/skin.mobile.min.css | 2 +- .../tinymce_4/tinymce/themes/inlite/theme.js | 28310 +++---- .../tinymce/themes/inlite/theme.min.js | 6 +- .../tinymce_4/tinymce/themes/mobile/theme.js | 35970 ++++----- .../tinymce/themes/mobile/theme.min.js | 9 +- .../tinymce_4/tinymce/themes/modern/theme.js | 27588 +++---- .../tinymce/themes/modern/theme.min.js | 6 +- .../tinymce_4/tinymce/tinymce.jquery.js | 43975 ---------- .../tinymce_4/tinymce/tinymce.jquery.min.js | 43975 ---------- tinymce_4/static/tinymce_4/tinymce/tinymce.js | 66960 ++++++---------- .../static/tinymce_4/tinymce/tinymce.min.js | 15 +- 115 files changed, 86020 insertions(+), 226682 deletions(-) delete mode 100644 tinymce_4/static/tinymce_4/tinymce/tinymce.jquery.js delete mode 100644 tinymce_4/static/tinymce_4/tinymce/tinymce.jquery.min.js diff --git a/.stylelintrc b/.stylelintrc index b4d22b7..f941489 100644 --- a/.stylelintrc +++ b/.stylelintrc @@ -1,12 +1,34 @@ { "extends": "stylelint-config-standard", "rules": { - "function-url-quotes" : "single", + "no-descending-specificity": null, + "shorthand-property-no-redundant-values": null, + "at-rule-empty-line-before": ["never", { + except: [ + "blockless-after-same-name-blockless", + "blockless-after-blockless", + ], + ignore: [ + "after-comment", + "blockless-after-blockless" + ] + }], + "function-url-quotes": "always", + "max-nesting-depth": 10, "string-quotes": "single", - "indentation": "null", - "at-rule-empty-line-before": "never", - "rule-nested-empty-line-before": "never-multi-line", - "rule-non-nested-empty-line-before": "always-multi-line", - "shorthand-property-no-redundant-values": "never" + "indentation": null, + "block-no-empty": null, + "comment-empty-line-before": "never", + "rule-empty-line-before": [ + "always", { + except: [ + "first-nested", + "inside-block-and-after-rule" + ], + ignore: [ + "inside-block" + ] + } + ] } } diff --git a/CHANGELOG.rst b/CHANGELOG.rst index c636c2c..0f782e8 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,9 +1,15 @@ Changelog ========= -0.0.20 (development) +0.0.21 (development) -------------------- +0.0.20 +------ +* Update tinymce4 to 4.7.9 +* Update packages +* Add valid_children and disabled force_root_block settings + 0.0.19 ------ * Update tinymce4 to 4.7.1 diff --git a/bower.json b/bower.json index ee33504..5f2b0cf 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "django-tinymce-4", - "version": "0.0.19", + "version": "0.0.20", "homepage": "https://github.com/ITCase-django/django-tinymce-4", "authors": [ "ITCase " @@ -15,6 +15,6 @@ "tests" ], "dependencies": { - "tinymce": "~4.7.1" + "tinymce": "~4.7.9" } } diff --git a/package.json b/package.json index 3ec11be..eb46271 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "django-tinymce-4", "title": "Integrate TinyMCE4 in Django projects", "description": "", - "version": "0.0.19", + "version": "0.0.20", "homepage": "http://www.github.com/ITCase-django/django-tinymce-4/", "author": "ITCase (http://www.itcase.pro/)", "repository": { @@ -14,38 +14,38 @@ "node": ">= 5.0.0" }, "devDependencies": { - "autoprefixer": "^6.5.0", - "eslint": "^3.7.1", - "eslint-config-standard": "^6.2.0", - "eslint-plugin-promise": "^2.0.1", - "eslint-plugin-standard": "^2.0.1", - "gulp": "github:gulpjs/gulp#4.0", + "autoprefixer": "^8.1.0", + "eslint": "^4.18.2", + "eslint-config-standard": "^11.0.0", + "eslint-plugin-promise": "^3.7.0", + "eslint-plugin-standard": "^3.0.1", + "gulp": "^4.0.0", "gulp-batch": "~1.0.5", - "gulp-concat": "^2.6.0", + "gulp-concat": "^2.6.1", "gulp-css-base64": "^1.3.4", "gulp-cssnano": "^2.1.2", - "gulp-filter": "^4.0.0", - "gulp-if": "^2.0.1", - "gulp-load-plugins": "^1.3.0", - "gulp-newer": "^1.2.0", - "gulp-plumber": "^1.1.0", - "gulp-postcss": "^6.2.0", - "gulp-sourcemaps": "^2.0.0-alpha", - "gulp-util": "^3.0.7", - "gulp-watch": "^4.3.10", - "postcss-calc": "^5.3.1", - "postcss-color-function": "^2.0.1", - "postcss-css-variables": "^0.6.0", - "postcss-custom-properties": "^5.0.1", - "postcss-import": "^8.1.2", - "postcss-nested": "^1.0.0", - "postcss-opacity": "^4.0.0", - "postcss-pxtorem": "^3.3.1", - "postcss-reporter": "^1.4.1", - "stylelint": "^7.3.1", - "stylelint-config-standard": "^13.0.2", - "vinyl-map": "^1.0.1", - "yargs": "^6.0.0" + "gulp-filter": "^5.1.0", + "gulp-if": "^2.0.2", + "gulp-load-plugins": "^1.5.0", + "gulp-newer": "^1.4.0", + "gulp-plumber": "^1.2.0", + "gulp-postcss": "^7.0.1", + "gulp-sourcemaps": "^2.6.4", + "gulp-util": "^3.0.8", + "gulp-watch": "^5.0.0", + "postcss-calc": "^6.0.1", + "postcss-color-function": "^4.0.1", + "postcss-css-variables": "^0.8.0", + "postcss-custom-properties": "^7.0.0", + "postcss-import": "^11.1.0", + "postcss-nested": "^3.0.0", + "postcss-opacity": "^5.0.0", + "postcss-pxtorem": "^4.0.1", + "postcss-reporter": "^5.0.0", + "stylelint": "^9.1.3", + "stylelint-config-standard": "^18.2.0", + "vinyl-map": "^1.0.2", + "yargs": "^11.0.0" }, "license": "MIT" } diff --git a/tinymce_4/__init__.py b/tinymce_4/__init__.py index 91121b8..111278c 100644 --- a/tinymce_4/__init__.py +++ b/tinymce_4/__init__.py @@ -1,3 +1,3 @@ # -*- coding: utf-8 -*- -__version__ = '0.0.19' +__version__ = '0.0.20' diff --git a/tinymce_4/static/tinymce_4/css/__tinymce-4.css b/tinymce_4/static/tinymce_4/css/__tinymce-4.css index 1b192f9..47e89e3 100644 --- a/tinymce_4/static/tinymce_4/css/__tinymce-4.css +++ b/tinymce_4/static/tinymce_4/css/__tinymce-4.css @@ -1 +1 @@ -ol{counter-reset:a;padding:0 0 15px 15px}ol li{position:relative;display:block;font:.875rem/1.25rem Arial,Helvetica,sans-serif;color:#444;padding:0 0 15px 24px}ol li:last-child{padding:0}ol li:before{content:counter(a) '.';counter-increment:a;position:absolute;left:0;top:0}ol li * ol{margin:20px 0 0}ol li * ol,ol li * ol li:last-child{padding-bottom:0}ul{padding:0 0 15px 24px;list-style-type:none;text-indent:-24px}ul li{position:relative;display:block;font:.875rem/1.25rem Arial,Helvetica,sans-serif;color:#444;padding:0 0 15px}ul li:last-child{padding:0}ul li:before{content:'\2014\a0';padding:0 8px 0 0}ul li * ul{margin:24px 0 0}ul li * ul,ul li * ul li:last-child{padding-bottom:0}body{background:#fff;padding:0 0 0 15px;font-size:1em!important}table{border-collapse:collapse;margin:0 0 1em}table tr{color:#444}table tr th{text-align:left;padding:5px 15px;background:#eee}table tr th,table tr th p{font:700 .8125rem Arial,Helvetica,sans-serif}table tr th p{padding:0;margin:0}table tr td{font:700 .8125rem/1.25rem Arial,Helvetica,sans-serif;color:#444;padding:5px 15px;vertical-align:top}table tr td p{font:.875rem/1.25rem Arial,Helvetica,sans-serif;color:#444;padding:0;margin:0}a{color:#069}a:hover{color:#ef7f1b}p{font:.875rem/1.25rem Arial,Helvetica,sans-serif;color:#444;margin:0;padding:0 0 8px}em{font-style:italic}strong{font-weight:700}i{font-style:italic}h1{font:1.75rem Arial,Helvetica,sans-serif}h1,h2{color:#444;padding:0 0 5px}h2{font:1.625rem Arial,Helvetica,sans-serif}h3{font:1.5rem Arial,Helvetica,sans-serif}h3,h4{color:#444;padding:0 0 5px}h4{font:1.375rem Arial,Helvetica,sans-serif}h5{font:1.25rem Arial,Helvetica,sans-serif;color:#444;padding:0 0 5px} \ No newline at end of file +ol{counter-reset:list1;padding:0 0 15px 15px}ol li{position:relative;display:block;font:.875rem/1.25rem Arial,Helvetica,sans-serif;color:#444;padding:0 0 15px 24px}ol li:last-child{padding:0}ol li:before{content:counter(list1) ".";counter-increment:list1;position:absolute;left:0;top:0}ol li * ol{margin:20px 0 0}ol li * ol,ol li * ol li:last-child{padding-bottom:0}ul{padding:0 0 15px 24px;list-style-type:none;text-indent:-24px}ul li{position:relative;display:block;font:.875rem/1.25rem Arial,Helvetica,sans-serif;color:#444;padding:0 0 15px}ul li:last-child{padding:0}ul li:before{content:"\2014\a0";padding:0 8px 0 0}ul li * ul{margin:24px 0 0}ul li * ul,ul li * ul li:last-child{padding-bottom:0}body{background:#fff;padding:0 0 0 15px;font-size:1em!important}table{border-collapse:collapse;margin:0 0 1em}table tr{color:#444}table tr th{text-align:left;padding:5px 15px;background:#eee}table tr th,table tr th p{font:700 .8125rem Arial,Helvetica,sans-serif}table tr th p{padding:0;margin:0}table tr td{font:700 .8125rem/1.25rem Arial,Helvetica,sans-serif;color:#444;padding:5px 15px;vertical-align:top}table tr td p{font:.875rem/1.25rem Arial,Helvetica,sans-serif;color:#444;padding:0;margin:0}a{color:#069}a:hover{color:#ef7f1b}p{font:.875rem/1.25rem Arial,Helvetica,sans-serif;color:#444;margin:0;padding:0 0 8px}em{font-style:italic}strong{font-weight:700}i{font-style:italic}h1{font:1.75rem Arial,Helvetica,sans-serif}h1,h2{color:#444;padding:0 0 5px}h2{font:1.625rem Arial,Helvetica,sans-serif}h3{font:1.5rem Arial,Helvetica,sans-serif}h3,h4{color:#444;padding:0 0 5px}h4{font:1.375rem Arial,Helvetica,sans-serif}h5{font:1.25rem Arial,Helvetica,sans-serif;color:#444;padding:0 0 5px}.mce-btn button{border:none!important} \ No newline at end of file diff --git a/tinymce_4/static/tinymce_4/settings/full/settings.js b/tinymce_4/static/tinymce_4/settings/full/settings.js index 1b2e40a..8b5e11c 100644 --- a/tinymce_4/static/tinymce_4/settings/full/settings.js +++ b/tinymce_4/static/tinymce_4/settings/full/settings.js @@ -4,6 +4,8 @@ var tinySettings = { relative_urls: false, convert_urls: false, valid_elements: '*[*]', + valid_children: '+a[h1|h2|h3|h4|h5|h6|p|span|div|img]', + forced_root_block: false, height: '350px', language_url: '', diff --git a/tinymce_4/static/tinymce_4/tinymce/.bower.json b/tinymce_4/static/tinymce_4/tinymce/.bower.json index 445e50b..084ff88 100644 --- a/tinymce_4/static/tinymce_4/tinymce/.bower.json +++ b/tinymce_4/static/tinymce_4/tinymce/.bower.json @@ -18,14 +18,14 @@ ".npmignore", "changelog.txt" ], - "version": "4.7.1", - "_release": "4.7.1", + "version": "4.7.9", + "_release": "4.7.9", "_resolution": { "type": "version", - "tag": "4.7.1", - "commit": "4fd91026d3765fee9b148b5e684b014a8e18ead1" + "tag": "4.7.9", + "commit": "3edc2e2b270fb38e85db083b717ab57a092f77ab" }, "_source": "https://github.com/tinymce/tinymce-dist.git", - "_target": "~4.7.1", + "_target": "~4.7.9", "_originalSource": "tinymce" } \ No newline at end of file diff --git a/tinymce_4/static/tinymce_4/tinymce/jquery.tinymce.js b/tinymce_4/static/tinymce_4/tinymce/jquery.tinymce.js index 1088223..decbda4 100644 --- a/tinymce_4/static/tinymce_4/tinymce/jquery.tinymce.js +++ b/tinymce_4/static/tinymce_4/tinymce/jquery.tinymce.js @@ -1 +1 @@ -!function(){var a={},b=function(b){for(var c=a[b],e=c.deps,f=c.defn,g=e.length,h=new Array(g),i=0;i0&&(c=j().get(d[0].id)))return c.getContent()},c=function(a){var b=null;return a&&a.id&&h.tinymce&&(b=j().get(a.id)),b},e=function(a){return!!(a&&a.length&&h.tinymce&&a.is(":tinymce"))},f={};g.each(["text","html","val"],function(a,h){var i=f[h]=g.fn[h],j="text"===h;g.fn[h]=function(a){var f=this;if(!e(f))return i.apply(f,arguments);if(a!==d)return b.call(f.filter(":tinymce"),a),i.apply(f.not(":tinymce"),arguments),f;var h="",k=arguments;return(j?f:f.eq(0)).each(function(a,b){var d=c(b);h+=d?j?d.getContent().replace(/<(?:"[^"]*"|'[^']*'|[^'">])*>/g,""):d.getContent({save:!0}):i.apply(g(b),k)}),h}}),g.each(["append","prepend"],function(a,b){var h=f[b]=g.fn[b],i="prepend"===b;g.fn[b]=function(a){var b=this;return e(b)?a!==d?("string"==typeof a&&b.filter(":tinymce").each(function(b,d){var e=c(d);e&&e.setContent(i?a+e.getContent():e.getContent()+a)}),h.apply(b.not(":tinymce"),arguments),b):void 0:h.apply(b,arguments)}}),g.each(["remove","replaceWith","replaceAll","empty"],function(b,c){var d=f[c]=g.fn[c];g.fn[c]=function(){return a.call(this,c),d.apply(this,arguments)}}),f.attr=g.fn.attr,g.fn.attr=function(a,h){var i=this,j=arguments;if(!a||"value"!==a||!e(i))return h!==d?f.attr.apply(i,j):f.attr.apply(i,j);if(h!==d)return b.call(i.filter(":tinymce"),h),f.attr.apply(i.not(":tinymce"),j),i;var k=i[0],l=c(k);return l?l.getContent({save:!0}):f.attr.apply(g(k),j)}}}}),d("0")()}(); \ No newline at end of file +!function(){var e,t,n,i,r,a=[];r="undefined"!=typeof global?global:window,i=r.jQuery;var c=function(){return r.tinymce};i.fn.tinymce=function(e){var l,u,s,f=this,p="";if(!f.length)return f;if(!e)return c()?c().get(f[0].id):null;f.css("visibility","hidden");var d=function(){var t=[],r=0;n||(o(),n=!0),f.each(function(n,i){var a,o=i.id,l=e.oninit;o||(i.id=o=c().DOM.uniqueId()),c().get(o)||(a=c().createEditor(o,e),t.push(a),a.on("init",function(){var e,n=l;f.css("visibility",""),l&&++r==t.length&&("string"==typeof n&&(e=-1===n.indexOf(".")?null:c().resolve(n.replace(/\.\w+$/,"")),n=c().resolve(n)),n.apply(e||c(),t))}))}),i.each(t,function(e,t){t.render()})};if(r.tinymce||t||!(l=e.script_url))1===t?a.push(d):d();else{t=1,u=l.substring(0,l.lastIndexOf("/")),-1!=l.indexOf(".min")&&(p=".min"),r.tinymce=r.tinyMCEPreInit||{base:u,suffix:p},-1!=l.indexOf("gzip")&&(s=e.language||"en",l=l+(/\?/.test(l)?"&":"?")+"js=true&core=true&suffix="+escape(p)+"&themes="+escape(e.theme||"modern")+"&plugins="+escape(e.plugins||"")+"&languages="+(s||""),r.tinyMCE_GZ||(r.tinyMCE_GZ={start:function(){var t=function(e){c().ScriptLoader.markDone(c().baseURI.toAbsolute(e))};t("langs/"+s+".js"),t("themes/"+e.theme+"/theme"+p+".js"),t("themes/"+e.theme+"/langs/"+s+".js"),i.each(e.plugins.split(","),function(e,n){n&&(t("plugins/"+n+"/plugin"+p+".js"),t("plugins/"+n+"/langs/"+s+".js"))})},end:function(){}}));var v=document.createElement("script");v.type="text/javascript",v.onload=v.onreadystatechange=function(n){n=n||window.event,2===t||"load"!=n.type&&!/complete|loaded/.test(v.readyState)||(c().dom.Event.domLoaded=1,t=2,e.script_loaded&&e.script_loaded(),d(),i.each(a,function(e,t){t()}))},v.src=l,document.body.appendChild(v)}return f},i.extend(i.expr[":"],{tinymce:function(e){var t;return!!(e.id&&"tinymce"in r&&(t=c().get(e.id))&&t.editorManager===c())}});var o=function(){var t=function(e){"remove"===e&&this.each(function(e,t){var n=a(t);n&&n.remove()}),this.find("span.mceEditor,div.mceEditor").each(function(e,t){var n=c().get(t.id.replace(/_parent$/,""));n&&n.remove()})},n=function(e){var n,i=this;if(null!=e)t.call(i),i.each(function(t,n){var i;(i=c().get(n.id))&&i.setContent(e)});else if(i.length>0&&(n=c().get(i[0].id)))return n.getContent()},a=function(e){var t=null;return e&&e.id&&r.tinymce&&(t=c().get(e.id)),t},o=function(e){return!!(e&&e.length&&r.tinymce&&e.is(":tinymce"))},l={};i.each(["text","html","val"],function(t,r){var c=l[r]=i.fn[r],u="text"===r;i.fn[r]=function(t){var r=this;if(!o(r))return c.apply(r,arguments);if(t!==e)return n.call(r.filter(":tinymce"),t),c.apply(r.not(":tinymce"),arguments),r;var l="",s=arguments;return(u?r:r.eq(0)).each(function(e,t){var n=a(t);l+=n?u?n.getContent().replace(/<(?:"[^"]*"|'[^']*'|[^'">])*>/g,""):n.getContent({save:!0}):c.apply(i(t),s)}),l}}),i.each(["append","prepend"],function(t,n){var r=l[n]=i.fn[n],c="prepend"===n;i.fn[n]=function(t){var n=this;return o(n)?t!==e?("string"==typeof t&&n.filter(":tinymce").each(function(e,n){var i=a(n);i&&i.setContent(c?t+i.getContent():i.getContent()+t)}),r.apply(n.not(":tinymce"),arguments),n):void 0:r.apply(n,arguments)}}),i.each(["remove","replaceWith","replaceAll","empty"],function(e,n){var r=l[n]=i.fn[n];i.fn[n]=function(){return t.call(this,n),r.apply(this,arguments)}}),l.attr=i.fn.attr,i.fn.attr=function(t,r){var c=this,u=arguments;if(!t||"value"!==t||!o(c))return l.attr.apply(c,u);if(r!==e)return n.call(c.filter(":tinymce"),r),l.attr.apply(c.not(":tinymce"),u),c;var s=c[0],f=a(s);return f?f.getContent({save:!0}):l.attr.apply(i(s),u)}}}(); \ No newline at end of file diff --git a/tinymce_4/static/tinymce_4/tinymce/jquery.tinymce.min.js b/tinymce_4/static/tinymce_4/tinymce/jquery.tinymce.min.js index 1088223..decbda4 100644 --- a/tinymce_4/static/tinymce_4/tinymce/jquery.tinymce.min.js +++ b/tinymce_4/static/tinymce_4/tinymce/jquery.tinymce.min.js @@ -1 +1 @@ -!function(){var a={},b=function(b){for(var c=a[b],e=c.deps,f=c.defn,g=e.length,h=new Array(g),i=0;i0&&(c=j().get(d[0].id)))return c.getContent()},c=function(a){var b=null;return a&&a.id&&h.tinymce&&(b=j().get(a.id)),b},e=function(a){return!!(a&&a.length&&h.tinymce&&a.is(":tinymce"))},f={};g.each(["text","html","val"],function(a,h){var i=f[h]=g.fn[h],j="text"===h;g.fn[h]=function(a){var f=this;if(!e(f))return i.apply(f,arguments);if(a!==d)return b.call(f.filter(":tinymce"),a),i.apply(f.not(":tinymce"),arguments),f;var h="",k=arguments;return(j?f:f.eq(0)).each(function(a,b){var d=c(b);h+=d?j?d.getContent().replace(/<(?:"[^"]*"|'[^']*'|[^'">])*>/g,""):d.getContent({save:!0}):i.apply(g(b),k)}),h}}),g.each(["append","prepend"],function(a,b){var h=f[b]=g.fn[b],i="prepend"===b;g.fn[b]=function(a){var b=this;return e(b)?a!==d?("string"==typeof a&&b.filter(":tinymce").each(function(b,d){var e=c(d);e&&e.setContent(i?a+e.getContent():e.getContent()+a)}),h.apply(b.not(":tinymce"),arguments),b):void 0:h.apply(b,arguments)}}),g.each(["remove","replaceWith","replaceAll","empty"],function(b,c){var d=f[c]=g.fn[c];g.fn[c]=function(){return a.call(this,c),d.apply(this,arguments)}}),f.attr=g.fn.attr,g.fn.attr=function(a,h){var i=this,j=arguments;if(!a||"value"!==a||!e(i))return h!==d?f.attr.apply(i,j):f.attr.apply(i,j);if(h!==d)return b.call(i.filter(":tinymce"),h),f.attr.apply(i.not(":tinymce"),j),i;var k=i[0],l=c(k);return l?l.getContent({save:!0}):f.attr.apply(g(k),j)}}}}),d("0")()}(); \ No newline at end of file +!function(){var e,t,n,i,r,a=[];r="undefined"!=typeof global?global:window,i=r.jQuery;var c=function(){return r.tinymce};i.fn.tinymce=function(e){var l,u,s,f=this,p="";if(!f.length)return f;if(!e)return c()?c().get(f[0].id):null;f.css("visibility","hidden");var d=function(){var t=[],r=0;n||(o(),n=!0),f.each(function(n,i){var a,o=i.id,l=e.oninit;o||(i.id=o=c().DOM.uniqueId()),c().get(o)||(a=c().createEditor(o,e),t.push(a),a.on("init",function(){var e,n=l;f.css("visibility",""),l&&++r==t.length&&("string"==typeof n&&(e=-1===n.indexOf(".")?null:c().resolve(n.replace(/\.\w+$/,"")),n=c().resolve(n)),n.apply(e||c(),t))}))}),i.each(t,function(e,t){t.render()})};if(r.tinymce||t||!(l=e.script_url))1===t?a.push(d):d();else{t=1,u=l.substring(0,l.lastIndexOf("/")),-1!=l.indexOf(".min")&&(p=".min"),r.tinymce=r.tinyMCEPreInit||{base:u,suffix:p},-1!=l.indexOf("gzip")&&(s=e.language||"en",l=l+(/\?/.test(l)?"&":"?")+"js=true&core=true&suffix="+escape(p)+"&themes="+escape(e.theme||"modern")+"&plugins="+escape(e.plugins||"")+"&languages="+(s||""),r.tinyMCE_GZ||(r.tinyMCE_GZ={start:function(){var t=function(e){c().ScriptLoader.markDone(c().baseURI.toAbsolute(e))};t("langs/"+s+".js"),t("themes/"+e.theme+"/theme"+p+".js"),t("themes/"+e.theme+"/langs/"+s+".js"),i.each(e.plugins.split(","),function(e,n){n&&(t("plugins/"+n+"/plugin"+p+".js"),t("plugins/"+n+"/langs/"+s+".js"))})},end:function(){}}));var v=document.createElement("script");v.type="text/javascript",v.onload=v.onreadystatechange=function(n){n=n||window.event,2===t||"load"!=n.type&&!/complete|loaded/.test(v.readyState)||(c().dom.Event.domLoaded=1,t=2,e.script_loaded&&e.script_loaded(),d(),i.each(a,function(e,t){t()}))},v.src=l,document.body.appendChild(v)}return f},i.extend(i.expr[":"],{tinymce:function(e){var t;return!!(e.id&&"tinymce"in r&&(t=c().get(e.id))&&t.editorManager===c())}});var o=function(){var t=function(e){"remove"===e&&this.each(function(e,t){var n=a(t);n&&n.remove()}),this.find("span.mceEditor,div.mceEditor").each(function(e,t){var n=c().get(t.id.replace(/_parent$/,""));n&&n.remove()})},n=function(e){var n,i=this;if(null!=e)t.call(i),i.each(function(t,n){var i;(i=c().get(n.id))&&i.setContent(e)});else if(i.length>0&&(n=c().get(i[0].id)))return n.getContent()},a=function(e){var t=null;return e&&e.id&&r.tinymce&&(t=c().get(e.id)),t},o=function(e){return!!(e&&e.length&&r.tinymce&&e.is(":tinymce"))},l={};i.each(["text","html","val"],function(t,r){var c=l[r]=i.fn[r],u="text"===r;i.fn[r]=function(t){var r=this;if(!o(r))return c.apply(r,arguments);if(t!==e)return n.call(r.filter(":tinymce"),t),c.apply(r.not(":tinymce"),arguments),r;var l="",s=arguments;return(u?r:r.eq(0)).each(function(e,t){var n=a(t);l+=n?u?n.getContent().replace(/<(?:"[^"]*"|'[^']*'|[^'">])*>/g,""):n.getContent({save:!0}):c.apply(i(t),s)}),l}}),i.each(["append","prepend"],function(t,n){var r=l[n]=i.fn[n],c="prepend"===n;i.fn[n]=function(t){var n=this;return o(n)?t!==e?("string"==typeof t&&n.filter(":tinymce").each(function(e,n){var i=a(n);i&&i.setContent(c?t+i.getContent():i.getContent()+t)}),r.apply(n.not(":tinymce"),arguments),n):void 0:r.apply(n,arguments)}}),i.each(["remove","replaceWith","replaceAll","empty"],function(e,n){var r=l[n]=i.fn[n];i.fn[n]=function(){return t.call(this,n),r.apply(this,arguments)}}),l.attr=i.fn.attr,i.fn.attr=function(t,r){var c=this,u=arguments;if(!t||"value"!==t||!o(c))return l.attr.apply(c,u);if(r!==e)return n.call(c.filter(":tinymce"),r),l.attr.apply(c.not(":tinymce"),u),c;var s=c[0],f=a(s);return f?f.getContent({save:!0}):l.attr.apply(i(s),u)}}}(); \ No newline at end of file diff --git a/tinymce_4/static/tinymce_4/tinymce/plugins/advlist/plugin.js b/tinymce_4/static/tinymce_4/tinymce/plugins/advlist/plugin.js index 08ac6d9..502062c 100644 --- a/tinymce_4/static/tinymce_4/tinymce/plugins/advlist/plugin.js +++ b/tinymce_4/static/tinymce_4/tinymce/plugins/advlist/plugin.js @@ -1,408 +1,160 @@ (function () { +var advlist = (function () { + 'use strict'; -var defs = {}; // id -> {dependencies, definition, instance (possibly undefined)} + var PluginManager = tinymce.util.Tools.resolve('tinymce.PluginManager'); -// Used when there is no 'main' module. -// The name is probably (hopefully) unique so minification removes for releases. -var register_3795 = function (id) { - var module = dem(id); - var fragments = id.split('.'); - var target = Function('return this;')(); - for (var i = 0; i < fragments.length - 1; ++i) { - if (target[fragments[i]] === undefined) - target[fragments[i]] = {}; - target = target[fragments[i]]; - } - target[fragments[fragments.length - 1]] = module; -}; - -var instantiate = function (id) { - var actual = defs[id]; - var dependencies = actual.deps; - var definition = actual.defn; - var len = dependencies.length; - var instances = new Array(len); - for (var i = 0; i < len; ++i) - instances[i] = dem(dependencies[i]); - var defResult = definition.apply(null, instances); - if (defResult === undefined) - throw 'module [' + id + '] returned undefined'; - actual.instance = defResult; -}; + var Tools = tinymce.util.Tools.resolve('tinymce.util.Tools'); -var def = function (id, dependencies, definition) { - if (typeof id !== 'string') - throw 'module id must be a string'; - else if (dependencies === undefined) - throw 'no dependencies for ' + id; - else if (definition === undefined) - throw 'no definition function for ' + id; - defs[id] = { - deps: dependencies, - defn: definition, - instance: undefined + var applyListFormat = function (editor, listName, styleValue) { + var cmd = listName === 'UL' ? 'InsertUnorderedList' : 'InsertOrderedList'; + editor.execCommand(cmd, false, styleValue === false ? null : { 'list-style-type': styleValue }); }; -}; - -var dem = function (id) { - var actual = defs[id]; - if (actual === undefined) - throw 'module [' + id + '] was undefined'; - else if (actual.instance === undefined) - instantiate(id); - return actual.instance; -}; - -var req = function (ids, callback) { - var len = ids.length; - var instances = new Array(len); - for (var i = 0; i < len; ++i) - instances[i] = dem(ids[i]); - callback.apply(null, instances); -}; - -var ephox = {}; - -ephox.bolt = { - module: { - api: { - define: def, - require: req, - demand: dem - } - } -}; - -var define = def; -var require = req; -var demand = dem; -// this helps with minification when using a lot of global references -var defineGlobal = function (id, ref) { - define(id, [], function () { return ref; }); -}; -/*jsc -["tinymce.plugins.advlist.Plugin","tinymce.core.PluginManager","tinymce.core.util.Tools","tinymce.plugins.advlist.api.Commands","tinymce.plugins.advlist.ui.Buttons","global!tinymce.util.Tools.resolve","tinymce.plugins.advlist.core.Actions","tinymce.plugins.advlist.api.Settings","tinymce.plugins.advlist.core.ListUtils","tinymce.plugins.advlist.ui.ListStyles"] -jsc*/ -defineGlobal("global!tinymce.util.Tools.resolve", tinymce.util.Tools.resolve); -/** - * ResolveGlobal.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.core.PluginManager', - [ - 'global!tinymce.util.Tools.resolve' - ], - function (resolve) { - return resolve('tinymce.PluginManager'); - } -); - -/** - * ResolveGlobal.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.core.util.Tools', - [ - 'global!tinymce.util.Tools.resolve' - ], - function (resolve) { - return resolve('tinymce.util.Tools'); - } -); - -/** - * Actions.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.advlist.core.Actions', - [ - ], - function () { - var applyListFormat = function (editor, listName, styleValue) { - var cmd = listName === 'UL' ? 'InsertUnorderedList' : 'InsertOrderedList'; - editor.execCommand(cmd, false, styleValue === false ? null : { 'list-style-type': styleValue }); - }; - - return { - applyListFormat: applyListFormat - }; - } -); -/** - * Commands.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.advlist.api.Commands', - [ - 'tinymce.plugins.advlist.core.Actions' - ], - function (Actions) { - var register = function (editor) { - editor.addCommand('ApplyUnorderedListStyle', function (ui, value) { - Actions.applyListFormat(editor, 'UL', value['list-style-type']); - }); - - editor.addCommand('ApplyOrderedListStyle', function (ui, value) { - Actions.applyListFormat(editor, 'OL', value['list-style-type']); - }); - }; + var $_f63uci7oje5nvbfi = { applyListFormat: applyListFormat }; - return { - register: register - }; - } -); - - -/** - * Settings.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.advlist.api.Settings', - [ - ], - function () { - var getNumberStyles = function (editor) { - var styles = editor.getParam('advlist_number_styles', 'default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman'); - return styles ? styles.split(/[ ,]/) : []; - }; - - var getBulletStyles = function (editor) { - var styles = editor.getParam('advlist_bullet_styles', 'default,circle,disc,square'); - return styles ? styles.split(/[ ,]/) : []; - }; - - return { - getNumberStyles: getNumberStyles, - getBulletStyles: getBulletStyles - }; - } -); -/** - * ListUtils.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.advlist.core.ListUtils', - [ - ], - function () { - var isChildOfBody = function (editor, elm) { - return editor.$.contains(editor.getBody(), elm); - }; - - var isListNode = function (editor) { - return function (node) { - return node && (/^(OL|UL|DL)$/).test(node.nodeName) && isChildOfBody(editor, node); - }; - }; - - var getSelectedStyleType = function (editor) { - var listElm = editor.dom.getParent(editor.selection.getNode(), 'ol,ul'); - return editor.dom.getStyle(listElm, 'listStyleType') || ''; - }; - - return { - isListNode: isListNode, - getSelectedStyleType: getSelectedStyleType - }; - } -); -/** - * ListStyles.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.advlist.ui.ListStyles', - [ - 'tinymce.core.util.Tools' - ], - function (Tools) { - var styleValueToText = function (styleValue) { - return styleValue.replace(/\-/g, ' ').replace(/\b\w/g, function (chr) { - return chr.toUpperCase(); - }); - }; - - var toMenuItems = function (styles) { - return Tools.map(styles, function (styleValue) { - var text = styleValueToText(styleValue); - var data = styleValue === 'default' ? '' : styleValue; - - return { text: text, data: data }; - }); - }; - - return { - toMenuItems: toMenuItems - }; - } -); -/** - * Buttons.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ + var register = function (editor) { + editor.addCommand('ApplyUnorderedListStyle', function (ui, value) { + $_f63uci7oje5nvbfi.applyListFormat(editor, 'UL', value['list-style-type']); + }); + editor.addCommand('ApplyOrderedListStyle', function (ui, value) { + $_f63uci7oje5nvbfi.applyListFormat(editor, 'OL', value['list-style-type']); + }); + }; + var $_5iz4m37nje5nvbfg = { register: register }; -define( - 'tinymce.plugins.advlist.ui.Buttons', - [ - 'tinymce.core.util.Tools', - 'tinymce.plugins.advlist.api.Settings', - 'tinymce.plugins.advlist.core.Actions', - 'tinymce.plugins.advlist.core.ListUtils', - 'tinymce.plugins.advlist.ui.ListStyles' - ], - function (Tools, Settings, Actions, ListUtils, ListStyles) { - var listState = function (editor, listName) { - return function (e) { - var ctrl = e.control; + var getNumberStyles = function (editor) { + var styles = editor.getParam('advlist_number_styles', 'default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman'); + return styles ? styles.split(/[ ,]/) : []; + }; + var getBulletStyles = function (editor) { + var styles = editor.getParam('advlist_bullet_styles', 'default,circle,disc,square'); + return styles ? styles.split(/[ ,]/) : []; + }; + var $_59ncyo7qje5nvbfn = { + getNumberStyles: getNumberStyles, + getBulletStyles: getBulletStyles + }; - editor.on('NodeChange', function (e) { - var lists = Tools.grep(e.parents, ListUtils.isListNode(editor)); - ctrl.active(lists.length > 0 && lists[0].nodeName === listName); - }); - }; + var isChildOfBody = function (editor, elm) { + return editor.$.contains(editor.getBody(), elm); + }; + var isTableCellNode = function (node) { + return node && /^(TH|TD)$/.test(node.nodeName); + }; + var isListNode = function (editor) { + return function (node) { + return node && /^(OL|UL|DL)$/.test(node.nodeName) && isChildOfBody(editor, node); }; + }; + var getSelectedStyleType = function (editor) { + var listElm = editor.dom.getParent(editor.selection.getNode(), 'ol,ul'); + return editor.dom.getStyle(listElm, 'listStyleType') || ''; + }; + var $_da940p7rje5nvbfo = { + isTableCellNode: isTableCellNode, + isListNode: isListNode, + getSelectedStyleType: getSelectedStyleType + }; - var updateSelection = function (editor) { - return function (e) { - var listStyleType = ListUtils.getSelectedStyleType(editor); - e.control.items().each(function (ctrl) { - ctrl.active(ctrl.settings.data === listStyleType); - }); + var styleValueToText = function (styleValue) { + return styleValue.replace(/\-/g, ' ').replace(/\b\w/g, function (chr) { + return chr.toUpperCase(); + }); + }; + var toMenuItems = function (styles) { + return Tools.map(styles, function (styleValue) { + var text = styleValueToText(styleValue); + var data = styleValue === 'default' ? '' : styleValue; + return { + text: text, + data: data }; - }; + }); + }; + var $_dkyga47sje5nvbfq = { toMenuItems: toMenuItems }; - var addSplitButton = function (editor, id, tooltip, cmd, nodeName, styles) { - editor.addButton(id, { - type: 'splitbutton', - tooltip: tooltip, - menu: ListStyles.toMenuItems(styles), - onPostRender: listState(editor, nodeName), - onshow: updateSelection(editor), - onselect: function (e) { - Actions.applyListFormat(editor, nodeName, e.control.settings.data); - }, - onclick: function () { - editor.execCommand(cmd); - } + var findIndex = function (list, predicate) { + for (var index = 0; index < list.length; index++) { + var element = list[index]; + if (predicate(element)) { + return index; + } + } + return -1; + }; + var listState = function (editor, listName) { + return function (e) { + var ctrl = e.control; + editor.on('NodeChange', function (e) { + var tableCellIndex = findIndex(e.parents, $_da940p7rje5nvbfo.isTableCellNode); + var parents = tableCellIndex !== -1 ? e.parents.slice(0, tableCellIndex) : e.parents; + var lists = Tools.grep(parents, $_da940p7rje5nvbfo.isListNode(editor)); + ctrl.active(lists.length > 0 && lists[0].nodeName === listName); }); }; - - var addButton = function (editor, id, tooltip, cmd, nodeName, styles) { - editor.addButton(id, { - type: 'button', - tooltip: tooltip, - onPostRender: listState(editor, nodeName), - onclick: function () { - editor.execCommand(cmd); - } + }; + var updateSelection = function (editor) { + return function (e) { + var listStyleType = $_da940p7rje5nvbfo.getSelectedStyleType(editor); + e.control.items().each(function (ctrl) { + ctrl.active(ctrl.settings.data === listStyleType); }); }; - - var addControl = function (editor, id, tooltip, cmd, nodeName, styles) { - if (styles.length > 0) { - addSplitButton(editor, id, tooltip, cmd, nodeName, styles); - } else { - addButton(editor, id, tooltip, cmd, nodeName, styles); + }; + var addSplitButton = function (editor, id, tooltip, cmd, nodeName, styles) { + editor.addButton(id, { + active: false, + type: 'splitbutton', + tooltip: tooltip, + menu: $_dkyga47sje5nvbfq.toMenuItems(styles), + onPostRender: listState(editor, nodeName), + onshow: updateSelection(editor), + onselect: function (e) { + $_f63uci7oje5nvbfi.applyListFormat(editor, nodeName, e.control.settings.data); + }, + onclick: function () { + editor.execCommand(cmd); } - }; - - var register = function (editor) { - addControl(editor, 'numlist', 'Numbered list', 'InsertOrderedList', 'OL', Settings.getNumberStyles(editor)); - addControl(editor, 'bullist', 'Bullet list', 'InsertUnorderedList', 'UL', Settings.getBulletStyles(editor)); - }; + }); + }; + var addButton = function (editor, id, tooltip, cmd, nodeName, styles) { + editor.addButton(id, { + active: false, + type: 'button', + tooltip: tooltip, + onPostRender: listState(editor, nodeName), + onclick: function () { + editor.execCommand(cmd); + } + }); + }; + var addControl = function (editor, id, tooltip, cmd, nodeName, styles) { + if (styles.length > 0) { + addSplitButton(editor, id, tooltip, cmd, nodeName, styles); + } else { + addButton(editor, id, tooltip, cmd, nodeName, styles); + } + }; + var register$1 = function (editor) { + addControl(editor, 'numlist', 'Numbered list', 'InsertOrderedList', 'OL', $_59ncyo7qje5nvbfn.getNumberStyles(editor)); + addControl(editor, 'bullist', 'Bullet list', 'InsertUnorderedList', 'UL', $_59ncyo7qje5nvbfn.getBulletStyles(editor)); + }; + var $_akpws47pje5nvbfk = { register: register$1 }; - return { - register: register + PluginManager.add('advlist', function (editor) { + var hasPlugin = function (editor, plugin) { + var plugins = editor.settings.plugins ? editor.settings.plugins : ''; + return Tools.inArray(plugins.split(/[ ,]/), plugin) !== -1; }; + if (hasPlugin(editor, 'lists')) { + $_akpws47pje5nvbfk.register(editor); + $_5iz4m37nje5nvbfg.register(editor); + } + }); + function Plugin () { } -); -/** - * Plugin.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.advlist.Plugin', - [ - 'tinymce.core.PluginManager', - 'tinymce.core.util.Tools', - 'tinymce.plugins.advlist.api.Commands', - 'tinymce.plugins.advlist.ui.Buttons' - ], - function (PluginManager, Tools, Commands, Buttons) { - PluginManager.add('advlist', function (editor) { - var hasPlugin = function (editor, plugin) { - var plugins = editor.settings.plugins ? editor.settings.plugins : ''; - return Tools.inArray(plugins.split(/[ ,]/), plugin) !== -1; - }; - if (hasPlugin(editor, "lists")) { - Buttons.register(editor); - Commands.register(editor); - } - }); + return Plugin; - return function () { }; - } -); -dem('tinymce.plugins.advlist.Plugin')(); +}()); })(); diff --git a/tinymce_4/static/tinymce_4/tinymce/plugins/advlist/plugin.min.js b/tinymce_4/static/tinymce_4/tinymce/plugins/advlist/plugin.min.js index e9bce57..c6e0a89 100644 --- a/tinymce_4/static/tinymce_4/tinymce/plugins/advlist/plugin.min.js +++ b/tinymce_4/static/tinymce_4/tinymce/plugins/advlist/plugin.min.js @@ -1 +1 @@ -!function(){var a={},b=function(b){for(var c=a[b],e=c.deps,f=c.defn,g=e.length,h=new Array(g),i=0;i0&&g[0].nodeName===c)})}},g=function(a){return function(b){var c=d.getSelectedStyleType(a);b.control.items().each(function(a){a.active(a.settings.data===c)})}},h=function(a,b,d,h,i,j){a.addButton(b,{type:"splitbutton",tooltip:d,menu:e.toMenuItems(j),onPostRender:f(a,i),onshow:g(a),onselect:function(b){c.applyListFormat(a,i,b.control.settings.data)},onclick:function(){a.execCommand(h)}})},i=function(a,b,c,d,e,g){a.addButton(b,{type:"button",tooltip:c,onPostRender:f(a,e),onclick:function(){a.execCommand(d)}})},j=function(a,b,c,d,e,f){f.length>0?h(a,b,c,d,e,f):i(a,b,c,d,e,f)},k=function(a){j(a,"numlist","Numbered list","InsertOrderedList","OL",b.getNumberStyles(a)),j(a,"bullist","Bullet list","InsertUnorderedList","UL",b.getBulletStyles(a))};return{register:k}}),g("0",["1","2","3","4"],function(a,b,c,d){return a.add("advlist",function(a){var e=function(a,c){var d=a.settings.plugins?a.settings.plugins:"";return b.inArray(d.split(/[ ,]/),c)!==-1};e(a,"lists")&&(d.register(a),c.register(a))}),function(){}}),d("0")()}(); \ No newline at end of file +!function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager"),e=tinymce.util.Tools.resolve("tinymce.util.Tools"),n=function(t,e,n){var r="UL"===e?"InsertUnorderedList":"InsertOrderedList";t.execCommand(r,!1,!1===n?null:{"list-style-type":n})},r=function(t){t.addCommand("ApplyUnorderedListStyle",function(e,r){n(t,"UL",r["list-style-type"])}),t.addCommand("ApplyOrderedListStyle",function(e,r){n(t,"OL",r["list-style-type"])})},o=function(t){var e=t.getParam("advlist_number_styles","default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman");return e?e.split(/[ ,]/):[]},i=function(t){var e=t.getParam("advlist_bullet_styles","default,circle,disc,square");return e?e.split(/[ ,]/):[]},l=function(t){return t&&/^(TH|TD)$/.test(t.nodeName)},a=function(t){return function(e){return e&&/^(OL|UL|DL)$/.test(e.nodeName)&&(r=e,(n=t).$.contains(n.getBody(),r));var n,r}},s=function(t){var e=t.dom.getParent(t.selection.getNode(),"ol,ul");return t.dom.getStyle(e,"listStyleType")||""},u=function(t){return e.map(t,function(t){return{text:t.replace(/\-/g," ").replace(/\b\w/g,function(t){return t.toUpperCase()}),data:"default"===t?"":t}})},c=function(t,n){return function(r){var o=r.control;t.on("NodeChange",function(r){var i=function(t,e){for(var n=0;n0&&u[0].nodeName===n)})}},d=function(t,e,r,o,i,l){var a;t.addButton(e,{active:!1,type:"splitbutton",tooltip:r,menu:u(l),onPostRender:c(t,i),onshow:(a=t,function(t){var e=s(a);t.control.items().each(function(t){t.active(t.settings.data===e)})}),onselect:function(e){n(t,i,e.control.settings.data)},onclick:function(){t.execCommand(o)}})},p=function(t,e,n,r,o,i){var l,a,s,u,p;i.length>0?d(t,e,n,r,o,i):(a=e,s=n,u=r,p=o,(l=t).addButton(a,{active:!1,type:"button",tooltip:s,onPostRender:c(l,p),onclick:function(){l.execCommand(u)}}))},f=function(t){p(t,"numlist","Numbered list","InsertOrderedList","OL",o(t)),p(t,"bullist","Bullet list","InsertUnorderedList","UL",i(t))};t.add("advlist",function(t){var n,o,i;o="lists",i=(n=t).settings.plugins?n.settings.plugins:"",-1!==e.inArray(i.split(/[ ,]/),o)&&(f(t),r(t))})}(); \ No newline at end of file diff --git a/tinymce_4/static/tinymce_4/tinymce/plugins/anchor/plugin.js b/tinymce_4/static/tinymce_4/tinymce/plugins/anchor/plugin.js index df3b727..391e225 100644 --- a/tinymce_4/static/tinymce_4/tinymce/plugins/anchor/plugin.js +++ b/tinymce_4/static/tinymce_4/tinymce/plugins/anchor/plugin.js @@ -1,338 +1,117 @@ (function () { +var anchor = (function () { + 'use strict'; -var defs = {}; // id -> {dependencies, definition, instance (possibly undefined)} + var PluginManager = tinymce.util.Tools.resolve('tinymce.PluginManager'); -// Used when there is no 'main' module. -// The name is probably (hopefully) unique so minification removes for releases. -var register_3795 = function (id) { - var module = dem(id); - var fragments = id.split('.'); - var target = Function('return this;')(); - for (var i = 0; i < fragments.length - 1; ++i) { - if (target[fragments[i]] === undefined) - target[fragments[i]] = {}; - target = target[fragments[i]]; - } - target[fragments[fragments.length - 1]] = module; -}; - -var instantiate = function (id) { - var actual = defs[id]; - var dependencies = actual.deps; - var definition = actual.defn; - var len = dependencies.length; - var instances = new Array(len); - for (var i = 0; i < len; ++i) - instances[i] = dem(dependencies[i]); - var defResult = definition.apply(null, instances); - if (defResult === undefined) - throw 'module [' + id + '] returned undefined'; - actual.instance = defResult; -}; - -var def = function (id, dependencies, definition) { - if (typeof id !== 'string') - throw 'module id must be a string'; - else if (dependencies === undefined) - throw 'no dependencies for ' + id; - else if (definition === undefined) - throw 'no definition function for ' + id; - defs[id] = { - deps: dependencies, - defn: definition, - instance: undefined + var isValidId = function (id) { + return /^[A-Za-z][A-Za-z0-9\-:._]*$/.test(id); }; -}; - -var dem = function (id) { - var actual = defs[id]; - if (actual === undefined) - throw 'module [' + id + '] was undefined'; - else if (actual.instance === undefined) - instantiate(id); - return actual.instance; -}; - -var req = function (ids, callback) { - var len = ids.length; - var instances = new Array(len); - for (var i = 0; i < len; ++i) - instances[i] = dem(ids[i]); - callback.apply(null, instances); -}; - -var ephox = {}; - -ephox.bolt = { - module: { - api: { - define: def, - require: req, - demand: dem + var getId = function (editor) { + var selectedNode = editor.selection.getNode(); + var isAnchor = selectedNode.tagName === 'A' && editor.dom.getAttrib(selectedNode, 'href') === ''; + return isAnchor ? selectedNode.id || selectedNode.name : ''; + }; + var insert = function (editor, id) { + var selectedNode = editor.selection.getNode(); + var isAnchor = selectedNode.tagName === 'A' && editor.dom.getAttrib(selectedNode, 'href') === ''; + if (isAnchor) { + selectedNode.removeAttribute('name'); + selectedNode.id = id; + } else { + editor.focus(); + editor.selection.collapse(true); + editor.execCommand('mceInsertContent', false, editor.dom.createHTML('a', { id: id })); } - } -}; - -var define = def; -var require = req; -var demand = dem; -// this helps with minification when using a lot of global references -var defineGlobal = function (id, ref) { - define(id, [], function () { return ref; }); -}; -/*jsc -["tinymce.plugins.anchor.Plugin","tinymce.core.PluginManager","tinymce.plugins.anchor.api.Commands","tinymce.plugins.anchor.core.FilterContent","tinymce.plugins.anchor.ui.Buttons","global!tinymce.util.Tools.resolve","tinymce.plugins.anchor.ui.Dialog","tinymce.plugins.anchor.core.Anchor"] -jsc*/ -defineGlobal("global!tinymce.util.Tools.resolve", tinymce.util.Tools.resolve); -/** - * ResolveGlobal.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.core.PluginManager', - [ - 'global!tinymce.util.Tools.resolve' - ], - function (resolve) { - return resolve('tinymce.PluginManager'); - } -); - -/** - * Anchor.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.anchor.core.Anchor', - [ - ], - function () { - var isValidId = function (id) { - // Follows HTML4 rules: https://www.w3.org/TR/html401/types.html#type-id - return /^[A-Za-z][A-Za-z0-9\-:._]*$/.test(id); - }; - - var getId = function (editor) { - var selectedNode = editor.selection.getNode(); - var isAnchor = selectedNode.tagName === 'A' && editor.dom.getAttrib(selectedNode, 'href') === ''; - return isAnchor ? (selectedNode.id || selectedNode.name) : ''; - }; - - var insert = function (editor, id) { - var selectedNode = editor.selection.getNode(); - var isAnchor = selectedNode.tagName === 'A' && editor.dom.getAttrib(selectedNode, 'href') === ''; - - if (isAnchor) { - selectedNode.removeAttribute('name'); - selectedNode.id = id; - } else { - editor.focus(); - editor.selection.collapse(true); - editor.execCommand('mceInsertContent', false, editor.dom.createHTML('a', { - id: id - })); - } - }; - - return { - isValidId: isValidId, - getId: getId, - insert: insert - }; - } -); -/** - * Dialog.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.anchor.ui.Dialog', - [ - 'tinymce.plugins.anchor.core.Anchor' - ], - function (Anchor) { - var insertAnchor = function (editor, newId) { - if (!Anchor.isValidId(newId)) { - editor.windowManager.alert( - 'Id should start with a letter, followed only by letters, numbers, dashes, dots, colons or underscores.' - ); - return true; - } else { - Anchor.insert(editor, newId); - return false; - } - }; - - var open = function (editor) { - var currentId = Anchor.getId(editor); - - editor.windowManager.open({ - title: 'Anchor', - body: { type: 'textbox', name: 'id', size: 40, label: 'Id', value: currentId }, - onsubmit: function (e) { - var newId = e.data.id; + }; + var $_82jdn7xje5nvbg8 = { + isValidId: isValidId, + getId: getId, + insert: insert + }; - if (insertAnchor(editor, newId)) { - e.preventDefault(); - } + var insertAnchor = function (editor, newId) { + if (!$_82jdn7xje5nvbg8.isValidId(newId)) { + editor.windowManager.alert('Id should start with a letter, followed only by letters, numbers, dashes, dots, colons or underscores.'); + return true; + } else { + $_82jdn7xje5nvbg8.insert(editor, newId); + return false; + } + }; + var open = function (editor) { + var currentId = $_82jdn7xje5nvbg8.getId(editor); + editor.windowManager.open({ + title: 'Anchor', + body: { + type: 'textbox', + name: 'id', + size: 40, + label: 'Id', + value: currentId + }, + onsubmit: function (e) { + var newId = e.data.id; + if (insertAnchor(editor, newId)) { + e.preventDefault(); } - }); - }; - - return { - open: open - }; - } -); -/** - * Commands.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.anchor.api.Commands', - [ - 'tinymce.plugins.anchor.ui.Dialog' - ], - function (Dialog) { - var register = function (editor) { - editor.addCommand('mceAnchor', function () { - Dialog.open(editor); - }); - }; - - return { - register: register - }; - } -); -/** - * FilterContent.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ + } + }); + }; + var $_9t23yi7wje5nvbg7 = { open: open }; -define( - 'tinymce.plugins.anchor.core.FilterContent', - [ - ], - function () { - var isAnchorNode = function (node) { - return !node.attr('href') && (node.attr('id') || node.attr('name')) && !node.firstChild; - }; + var register = function (editor) { + editor.addCommand('mceAnchor', function () { + $_9t23yi7wje5nvbg7.open(editor); + }); + }; + var $_emjhn07vje5nvbg6 = { register: register }; - var setContentEditable = function (state) { - return function (nodes) { - for (var i = 0; i < nodes.length; i++) { - if (isAnchorNode(nodes[i])) { - nodes[i].attr('contenteditable', state); - } + var isAnchorNode = function (node) { + return !node.attr('href') && (node.attr('id') || node.attr('name')) && !node.firstChild; + }; + var setContentEditable = function (state) { + return function (nodes) { + for (var i = 0; i < nodes.length; i++) { + if (isAnchorNode(nodes[i])) { + nodes[i].attr('contenteditable', state); } - }; - }; - - var setup = function (editor) { - editor.on('PreInit', function () { - editor.parser.addNodeFilter('a', setContentEditable('false')); - editor.serializer.addNodeFilter('a', setContentEditable(null)); - }); - }; - - return { - setup: setup - }; - } -); -/** - * Buttons.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.anchor.ui.Buttons', - [ - ], - function () { - var register = function (editor) { - editor.addButton('anchor', { - icon: 'anchor', - tooltip: 'Anchor', - cmd: 'mceAnchor', - stateSelector: 'a:not([href])' - }); - - editor.addMenuItem('anchor', { - icon: 'anchor', - text: 'Anchor', - context: 'insert', - cmd: 'mceAnchor' - }); - }; - - return { - register: register + } }; + }; + var setup = function (editor) { + editor.on('PreInit', function () { + editor.parser.addNodeFilter('a', setContentEditable('false')); + editor.serializer.addNodeFilter('a', setContentEditable(null)); + }); + }; + var $_7hsabi7yje5nvbga = { setup: setup }; + + var register$1 = function (editor) { + editor.addButton('anchor', { + icon: 'anchor', + tooltip: 'Anchor', + cmd: 'mceAnchor', + stateSelector: 'a:not([href])' + }); + editor.addMenuItem('anchor', { + icon: 'anchor', + text: 'Anchor', + context: 'insert', + cmd: 'mceAnchor' + }); + }; + var $_a80t3h7zje5nvbgb = { register: register$1 }; + + PluginManager.add('anchor', function (editor) { + $_7hsabi7yje5nvbga.setup(editor); + $_emjhn07vje5nvbg6.register(editor); + $_a80t3h7zje5nvbgb.register(editor); + }); + function Plugin () { } -); -/** - * Plugin.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ -define( - 'tinymce.plugins.anchor.Plugin', - [ - 'tinymce.core.PluginManager', - 'tinymce.plugins.anchor.api.Commands', - 'tinymce.plugins.anchor.core.FilterContent', - 'tinymce.plugins.anchor.ui.Buttons' - ], - function (PluginManager, Commands, FilterContent, Buttons) { - PluginManager.add('anchor', function (editor) { - FilterContent.setup(editor); - Commands.register(editor); - Buttons.register(editor); - }); + return Plugin; - return function () { }; - } -); -dem('tinymce.plugins.anchor.Plugin')(); +}()); })(); diff --git a/tinymce_4/static/tinymce_4/tinymce/plugins/anchor/plugin.min.js b/tinymce_4/static/tinymce_4/tinymce/plugins/anchor/plugin.min.js index ef86762..ed6279d 100644 --- a/tinymce_4/static/tinymce_4/tinymce/plugins/anchor/plugin.min.js +++ b/tinymce_4/static/tinymce_4/tinymce/plugins/anchor/plugin.min.js @@ -1 +1 @@ -!function(){var a={},b=function(b){for(var c=a[b],e=c.deps,f=c.defn,g=e.length,h=new Array(g),i=0;i {dependencies, definition, instance (possibly undefined)} + var PluginManager = tinymce.util.Tools.resolve('tinymce.PluginManager'); -// Used when there is no 'main' module. -// The name is probably (hopefully) unique so minification removes for releases. -var register_3795 = function (id) { - var module = dem(id); - var fragments = id.split('.'); - var target = Function('return this;')(); - for (var i = 0; i < fragments.length - 1; ++i) { - if (target[fragments[i]] === undefined) - target[fragments[i]] = {}; - target = target[fragments[i]]; - } - target[fragments[fragments.length - 1]] = module; -}; - -var instantiate = function (id) { - var actual = defs[id]; - var dependencies = actual.deps; - var definition = actual.defn; - var len = dependencies.length; - var instances = new Array(len); - for (var i = 0; i < len; ++i) - instances[i] = dem(dependencies[i]); - var defResult = definition.apply(null, instances); - if (defResult === undefined) - throw 'module [' + id + '] returned undefined'; - actual.instance = defResult; -}; + var Env = tinymce.util.Tools.resolve('tinymce.Env'); -var def = function (id, dependencies, definition) { - if (typeof id !== 'string') - throw 'module id must be a string'; - else if (dependencies === undefined) - throw 'no dependencies for ' + id; - else if (definition === undefined) - throw 'no definition function for ' + id; - defs[id] = { - deps: dependencies, - defn: definition, - instance: undefined + var getAutoLinkPattern = function (editor) { + return editor.getParam('autolink_pattern', /^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.|(?:mailto:)?[A-Z0-9._%+\-]+@)(.+)$/i); + }; + var getDefaultLinkTarget = function (editor) { + return editor.getParam('default_link_target', ''); + }; + var $_8z9l9384je5nvbgs = { + getAutoLinkPattern: getAutoLinkPattern, + getDefaultLinkTarget: getDefaultLinkTarget }; -}; - -var dem = function (id) { - var actual = defs[id]; - if (actual === undefined) - throw 'module [' + id + '] was undefined'; - else if (actual.instance === undefined) - instantiate(id); - return actual.instance; -}; - -var req = function (ids, callback) { - var len = ids.length; - var instances = new Array(len); - for (var i = 0; i < len; ++i) - instances[i] = dem(ids[i]); - callback.apply(null, instances); -}; - -var ephox = {}; -ephox.bolt = { - module: { - api: { - define: def, - require: req, - demand: dem + var rangeEqualsDelimiterOrSpace = function (rangeString, delimiter) { + return rangeString === delimiter || rangeString === ' ' || rangeString.charCodeAt(0) === 160; + }; + var handleEclipse = function (editor) { + parseCurrentLine(editor, -1, '('); + }; + var handleSpacebar = function (editor) { + parseCurrentLine(editor, 0, ''); + }; + var handleEnter = function (editor) { + parseCurrentLine(editor, -1, ''); + }; + var scopeIndex = function (container, index) { + if (index < 0) { + index = 0; } - } -}; - -var define = def; -var require = req; -var demand = dem; -// this helps with minification when using a lot of global references -var defineGlobal = function (id, ref) { - define(id, [], function () { return ref; }); -}; -/*jsc -["tinymce.plugins.autolink.Plugin","tinymce.core.Env","tinymce.core.PluginManager","tinymce.plugins.autolink.core.Keys","global!tinymce.util.Tools.resolve","tinymce.plugins.autolink.api.Settings"] -jsc*/ -defineGlobal("global!tinymce.util.Tools.resolve", tinymce.util.Tools.resolve); -/** - * ResolveGlobal.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.core.Env', - [ - 'global!tinymce.util.Tools.resolve' - ], - function (resolve) { - return resolve('tinymce.Env'); - } -); - -/** - * ResolveGlobal.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.core.PluginManager', - [ - 'global!tinymce.util.Tools.resolve' - ], - function (resolve) { - return resolve('tinymce.PluginManager'); - } -); - -/** - * Settings.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.autolink.api.Settings', - [ - ], - function () { - var getAutoLinkPattern = function (editor) { - return editor.getParam('autolink_pattern', /^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.|(?:mailto:)?[A-Z0-9._%+\-]+@)(.+)$/i); - }; - - var getDefaultLinkTarget = function (editor) { - return editor.getParam('default_link_target', ''); - }; - - return { - getAutoLinkPattern: getAutoLinkPattern, - getDefaultLinkTarget: getDefaultLinkTarget - }; - } -); -/** - * Keys.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.autolink.core.Keys', - [ - 'tinymce.core.Env', - 'tinymce.core.PluginManager', - 'tinymce.plugins.autolink.api.Settings' - ], - function (Env, PluginManager, Settings) { - var rangeEqualsDelimiterOrSpace = function (rangeString, delimiter) { - return rangeString === delimiter || rangeString === ' ' || rangeString.charCodeAt(0) === 160; - }; - - var handleEclipse = function (editor) { - parseCurrentLine(editor, -1, '(', true); - }; - - var handleSpacebar = function (editor) { - parseCurrentLine(editor, 0, '', true); - }; - - var handleEnter = function (editor) { - parseCurrentLine(editor, -1, '', false); - }; - - var scopeIndex = function (container, index) { - if (index < 0) { - index = 0; + if (container.nodeType === 3) { + var len = container.data.length; + if (index > len) { + index = len; } - - if (container.nodeType === 3) { - var len = container.data.length; - - if (index > len) { - index = len; + } + return index; + }; + var setStart = function (rng, container, offset) { + if (container.nodeType !== 1 || container.hasChildNodes()) { + rng.setStart(container, scopeIndex(container, offset)); + } else { + rng.setStartBefore(container); + } + }; + var setEnd = function (rng, container, offset) { + if (container.nodeType !== 1 || container.hasChildNodes()) { + rng.setEnd(container, scopeIndex(container, offset)); + } else { + rng.setEndAfter(container); + } + }; + var parseCurrentLine = function (editor, endOffset, delimiter) { + var rng, end, start, endContainer, bookmark, text, matches, prev, len, rngText; + var autoLinkPattern = $_8z9l9384je5nvbgs.getAutoLinkPattern(editor); + var defaultLinkTarget = $_8z9l9384je5nvbgs.getDefaultLinkTarget(editor); + if (editor.selection.getNode().tagName === 'A') { + return; + } + rng = editor.selection.getRng(true).cloneRange(); + if (rng.startOffset < 5) { + prev = rng.endContainer.previousSibling; + if (!prev) { + if (!rng.endContainer.firstChild || !rng.endContainer.firstChild.nextSibling) { + return; } + prev = rng.endContainer.firstChild.nextSibling; } - - return index; - }; - - var setStart = function (rng, container, offset) { - if (container.nodeType !== 1 || container.hasChildNodes()) { - rng.setStart(container, scopeIndex(container, offset)); - } else { - rng.setStartBefore(container); - } - }; - - var setEnd = function (rng, container, offset) { - if (container.nodeType !== 1 || container.hasChildNodes()) { - rng.setEnd(container, scopeIndex(container, offset)); - } else { - rng.setEndAfter(container); - } - }; - - var parseCurrentLine = function (editor, endOffset, delimiter) { - var rng, end, start, endContainer, bookmark, text, matches, prev, len, rngText; - var autoLinkPattern = Settings.getAutoLinkPattern(editor); - var defaultLinkTarget = Settings.getDefaultLinkTarget(editor); - - // Never create a link when we are inside a link - if (editor.selection.getNode().tagName === 'A') { + len = prev.length; + setStart(rng, prev, len); + setEnd(rng, prev, len); + if (rng.endOffset < 5) { return; } - - // We need at least five characters to form a URL, - // hence, at minimum, five characters from the beginning of the line. - rng = editor.selection.getRng(true).cloneRange(); - if (rng.startOffset < 5) { - // During testing, the caret is placed between two text nodes. - // The previous text node contains the URL. - prev = rng.endContainer.previousSibling; - if (!prev) { - if (!rng.endContainer.firstChild || !rng.endContainer.firstChild.nextSibling) { - return; - } - - prev = rng.endContainer.firstChild.nextSibling; + end = rng.endOffset; + endContainer = prev; + } else { + endContainer = rng.endContainer; + if (endContainer.nodeType !== 3 && endContainer.firstChild) { + while (endContainer.nodeType !== 3 && endContainer.firstChild) { + endContainer = endContainer.firstChild; } - - len = prev.length; - setStart(rng, prev, len); - setEnd(rng, prev, len); - - if (rng.endOffset < 5) { - return; - } - - end = rng.endOffset; - endContainer = prev; - } else { - endContainer = rng.endContainer; - - // Get a text node - if (endContainer.nodeType !== 3 && endContainer.firstChild) { - while (endContainer.nodeType !== 3 && endContainer.firstChild) { - endContainer = endContainer.firstChild; - } - - // Move range to text node - if (endContainer.nodeType === 3) { - setStart(rng, endContainer, 0); - setEnd(rng, endContainer, endContainer.nodeValue.length); - } - } - - if (rng.endOffset === 1) { - end = 2; - } else { - end = rng.endOffset - 1 - endOffset; + if (endContainer.nodeType === 3) { + setStart(rng, endContainer, 0); + setEnd(rng, endContainer, endContainer.nodeValue.length); } } - - start = end; - - do { - // Move the selection one character backwards. - setStart(rng, endContainer, end >= 2 ? end - 2 : 0); - setEnd(rng, endContainer, end >= 1 ? end - 1 : 0); - end -= 1; - rngText = rng.toString(); - - // Loop until one of the following is found: a blank space,  , delimiter, (end-2) >= 0 - } while (rngText !== ' ' && rngText !== '' && rngText.charCodeAt(0) !== 160 && (end - 2) >= 0 && rngText !== delimiter); - - if (rangeEqualsDelimiterOrSpace(rng.toString(), delimiter)) { - setStart(rng, endContainer, end); - setEnd(rng, endContainer, start); - end += 1; - } else if (rng.startOffset === 0) { - setStart(rng, endContainer, 0); - setEnd(rng, endContainer, start); + if (rng.endOffset === 1) { + end = 2; } else { - setStart(rng, endContainer, end); - setEnd(rng, endContainer, start); + end = rng.endOffset - 1 - endOffset; } - - // Exclude last . from word like "www.site.com." - text = rng.toString(); - if (text.charAt(text.length - 1) === '.') { - setEnd(rng, endContainer, start - 1); + } + start = end; + do { + setStart(rng, endContainer, end >= 2 ? end - 2 : 0); + setEnd(rng, endContainer, end >= 1 ? end - 1 : 0); + end -= 1; + rngText = rng.toString(); + } while (rngText !== ' ' && rngText !== '' && rngText.charCodeAt(0) !== 160 && end - 2 >= 0 && rngText !== delimiter); + if (rangeEqualsDelimiterOrSpace(rng.toString(), delimiter)) { + setStart(rng, endContainer, end); + setEnd(rng, endContainer, start); + end += 1; + } else if (rng.startOffset === 0) { + setStart(rng, endContainer, 0); + setEnd(rng, endContainer, start); + } else { + setStart(rng, endContainer, end); + setEnd(rng, endContainer, start); + } + text = rng.toString(); + if (text.charAt(text.length - 1) === '.') { + setEnd(rng, endContainer, start - 1); + } + text = rng.toString().trim(); + matches = text.match(autoLinkPattern); + if (matches) { + if (matches[1] === 'www.') { + matches[1] = 'http://www.'; + } else if (/@$/.test(matches[1]) && !/^mailto:/.test(matches[1])) { + matches[1] = 'mailto:' + matches[1]; } - - text = rng.toString().trim(); - matches = text.match(autoLinkPattern); - - if (matches) { - if (matches[1] === 'www.') { - matches[1] = 'http://www.'; - } else if (/@$/.test(matches[1]) && !/^mailto:/.test(matches[1])) { - matches[1] = 'mailto:' + matches[1]; - } - - bookmark = editor.selection.getBookmark(); - - editor.selection.setRng(rng); - editor.execCommand('createlink', false, matches[1] + matches[2]); - - if (defaultLinkTarget) { - editor.dom.setAttrib(editor.selection.getNode(), 'target', defaultLinkTarget); - } - - editor.selection.moveToBookmark(bookmark); - editor.nodeChanged(); + bookmark = editor.selection.getBookmark(); + editor.selection.setRng(rng); + editor.execCommand('createlink', false, matches[1] + matches[2]); + if (defaultLinkTarget) { + editor.dom.setAttrib(editor.selection.getNode(), 'target', defaultLinkTarget); } - }; - - var setup = function (editor) { - var autoUrlDetectState; - - editor.on("keydown", function (e) { - if (e.keyCode === 13) { - return handleEnter(editor); - } - }); - - // Internet Explorer has built-in automatic linking for most cases - if (Env.ie) { - editor.on("focus", function () { - if (!autoUrlDetectState) { - autoUrlDetectState = true; - - try { - editor.execCommand('AutoUrlDetect', false, true); - } catch (ex) { - // Ignore - } - } - }); - - return; + editor.selection.moveToBookmark(bookmark); + editor.nodeChanged(); + } + }; + var setup = function (editor) { + var autoUrlDetectState; + editor.on('keydown', function (e) { + if (e.keyCode === 13) { + return handleEnter(editor); } - - editor.on("keypress", function (e) { - if (e.keyCode === 41) { - return handleEclipse(editor); - } - }); - - editor.on("keyup", function (e) { - if (e.keyCode === 32) { - return handleSpacebar(editor); + }); + if (Env.ie) { + editor.on('focus', function () { + if (!autoUrlDetectState) { + autoUrlDetectState = true; + try { + editor.execCommand('AutoUrlDetect', false, true); + } catch (ex) { + } } }); - }; + return; + } + editor.on('keypress', function (e) { + if (e.keyCode === 41) { + return handleEclipse(editor); + } + }); + editor.on('keyup', function (e) { + if (e.keyCode === 32) { + return handleSpacebar(editor); + } + }); + }; + var $_1qreir82je5nvbgn = { setup: setup }; - return { - setup: setup - }; + PluginManager.add('autolink', function (editor) { + $_1qreir82je5nvbgn.setup(editor); + }); + function Plugin () { } -); -/** - * Plugin.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ -define( - 'tinymce.plugins.autolink.Plugin', - [ - 'tinymce.core.Env', - 'tinymce.core.PluginManager', - 'tinymce.plugins.autolink.core.Keys' - ], - function (Env, PluginManager, Keys) { - PluginManager.add('autolink', function (editor) { - Keys.setup(editor); - }); + return Plugin; - return function () { }; - } -); -dem('tinymce.plugins.autolink.Plugin')(); +}()); })(); diff --git a/tinymce_4/static/tinymce_4/tinymce/plugins/autolink/plugin.min.js b/tinymce_4/static/tinymce_4/tinymce/plugins/autolink/plugin.min.js index 5f36fd1..e5fc21e 100644 --- a/tinymce_4/static/tinymce_4/tinymce/plugins/autolink/plugin.min.js +++ b/tinymce_4/static/tinymce_4/tinymce/plugins/autolink/plugin.min.js @@ -1 +1 @@ -!function(){var a={},b=function(b){for(var c=a[b],e=c.deps,f=c.defn,g=e.length,h=new Array(g),i=0;ic&&(b=c)}return b},i=function(a,b,c){1!==b.nodeType||b.hasChildNodes()?a.setStart(b,h(b,c)):a.setStartBefore(b)},j=function(a,b,c){1!==b.nodeType||b.hasChildNodes()?a.setEnd(b,h(b,c)):a.setEndAfter(b)},k=function(a,b,e){var f,g,h,k,l,m,n,o,p,q,r=c.getAutoLinkPattern(a),s=c.getDefaultLinkTarget(a);if("A"!==a.selection.getNode().tagName){if(f=a.selection.getRng(!0).cloneRange(),f.startOffset<5){if(o=f.endContainer.previousSibling,!o){if(!f.endContainer.firstChild||!f.endContainer.firstChild.nextSibling)return;o=f.endContainer.firstChild.nextSibling}if(p=o.length,i(f,o,p),j(f,o,p),f.endOffset<5)return;g=f.endOffset,k=o}else{if(k=f.endContainer,3!==k.nodeType&&k.firstChild){for(;3!==k.nodeType&&k.firstChild;)k=k.firstChild;3===k.nodeType&&(i(f,k,0),j(f,k,k.nodeValue.length))}g=1===f.endOffset?2:f.endOffset-1-b}h=g;do i(f,k,g>=2?g-2:0),j(f,k,g>=1?g-1:0),g-=1,q=f.toString();while(" "!==q&&""!==q&&160!==q.charCodeAt(0)&&g-2>=0&&q!==e);d(f.toString(),e)?(i(f,k,g),j(f,k,h),g+=1):0===f.startOffset?(i(f,k,0),j(f,k,h)):(i(f,k,g),j(f,k,h)),m=f.toString(),"."===m.charAt(m.length-1)&&j(f,k,h-1),m=f.toString().trim(),n=m.match(r),n&&("www."===n[1]?n[1]="http://www.":/@$/.test(n[1])&&!/^mailto:/.test(n[1])&&(n[1]="mailto:"+n[1]),l=a.selection.getBookmark(),a.selection.setRng(f),a.execCommand("createlink",!1,n[1]+n[2]),s&&a.dom.setAttrib(a.selection.getNode(),"target",s),a.selection.moveToBookmark(l),a.nodeChanged())}},l=function(b){var c;return b.on("keydown",function(a){if(13===a.keyCode)return g(b)}),a.ie?void b.on("focus",function(){if(!c){c=!0;try{b.execCommand("AutoUrlDetect",!1,!0)}catch(a){}}}):(b.on("keypress",function(a){if(41===a.keyCode)return e(b)}),void b.on("keyup",function(a){if(32===a.keyCode)return f(b)}))};return{setup:l}}),g("0",["1","2","3"],function(a,b,c){return b.add("autolink",function(a){c.setup(a)}),function(){}}),d("0")()}(); \ No newline at end of file +!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),t=tinymce.util.Tools.resolve("tinymce.Env"),n=function(e){return e.getParam("autolink_pattern",/^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.|(?:mailto:)?[A-Z0-9._%+\-]+@)(.+)$/i)},i=function(e){return e.getParam("default_link_target","")},o=function(e,t){if(t<0&&(t=0),3===e.nodeType){var n=e.data.length;t>n&&(t=n)}return t},r=function(e,t,n){1!==t.nodeType||t.hasChildNodes()?e.setStart(t,o(t,n)):e.setStartBefore(t)},a=function(e,t,n){1!==t.nodeType||t.hasChildNodes()?e.setEnd(t,o(t,n)):e.setEndAfter(t)},f=function(e,t,o){var f,s,d,l,c,u,g,h,C,m,y=n(e),k=i(e);if("A"!==e.selection.getNode().tagName){if((f=e.selection.getRng(!0).cloneRange()).startOffset<5){if(!(h=f.endContainer.previousSibling)){if(!f.endContainer.firstChild||!f.endContainer.firstChild.nextSibling)return;h=f.endContainer.firstChild.nextSibling}if(C=h.length,r(f,h,C),a(f,h,C),f.endOffset<5)return;s=f.endOffset,l=h}else{if(3!==(l=f.endContainer).nodeType&&l.firstChild){for(;3!==l.nodeType&&l.firstChild;)l=l.firstChild;3===l.nodeType&&(r(f,l,0),a(f,l,l.nodeValue.length))}s=1===f.endOffset?2:f.endOffset-1-t}for(d=s;r(f,l,s>=2?s-2:0),a(f,l,s>=1?s-1:0),s-=1," "!==(m=f.toString())&&""!==m&&160!==m.charCodeAt(0)&&s-2>=0&&m!==o;);var p;(p=f.toString())===o||" "===p||160===p.charCodeAt(0)?(r(f,l,s),a(f,l,d),s+=1):0===f.startOffset?(r(f,l,0),a(f,l,d)):(r(f,l,s),a(f,l,d)),"."===(u=f.toString()).charAt(u.length-1)&&a(f,l,d-1),(g=(u=f.toString().trim()).match(y))&&("www."===g[1]?g[1]="http://www.":/@$/.test(g[1])&&!/^mailto:/.test(g[1])&&(g[1]="mailto:"+g[1]),c=e.selection.getBookmark(),e.selection.setRng(f),e.execCommand("createlink",!1,g[1]+g[2]),k&&e.dom.setAttrib(e.selection.getNode(),"target",k),e.selection.moveToBookmark(c),e.nodeChanged())}},s=function(e){var n;e.on("keydown",function(t){13!==t.keyCode||f(e,-1,"")}),t.ie?e.on("focus",function(){if(!n){n=!0;try{e.execCommand("AutoUrlDetect",!1,!0)}catch(t){}}}):(e.on("keypress",function(t){41!==t.keyCode||f(e,-1,"(")}),e.on("keyup",function(t){32!==t.keyCode||f(e,0,"")}))};e.add("autolink",function(e){s(e)})}(); \ No newline at end of file diff --git a/tinymce_4/static/tinymce_4/tinymce/plugins/autoresize/plugin.js b/tinymce_4/static/tinymce_4/tinymce/plugins/autoresize/plugin.js index 0356843..780a339 100644 --- a/tinymce_4/static/tinymce_4/tinymce/plugins/autoresize/plugin.js +++ b/tinymce_4/static/tinymce_4/tinymce/plugins/autoresize/plugin.js @@ -1,440 +1,169 @@ (function () { +var autoresize = (function () { + 'use strict'; -var defs = {}; // id -> {dependencies, definition, instance (possibly undefined)} - -// Used when there is no 'main' module. -// The name is probably (hopefully) unique so minification removes for releases. -var register_3795 = function (id) { - var module = dem(id); - var fragments = id.split('.'); - var target = Function('return this;')(); - for (var i = 0; i < fragments.length - 1; ++i) { - if (target[fragments[i]] === undefined) - target[fragments[i]] = {}; - target = target[fragments[i]]; - } - target[fragments[fragments.length - 1]] = module; -}; - -var instantiate = function (id) { - var actual = defs[id]; - var dependencies = actual.deps; - var definition = actual.defn; - var len = dependencies.length; - var instances = new Array(len); - for (var i = 0; i < len; ++i) - instances[i] = dem(dependencies[i]); - var defResult = definition.apply(null, instances); - if (defResult === undefined) - throw 'module [' + id + '] returned undefined'; - actual.instance = defResult; -}; - -var def = function (id, dependencies, definition) { - if (typeof id !== 'string') - throw 'module id must be a string'; - else if (dependencies === undefined) - throw 'no dependencies for ' + id; - else if (definition === undefined) - throw 'no definition function for ' + id; - defs[id] = { - deps: dependencies, - defn: definition, - instance: undefined - }; -}; - -var dem = function (id) { - var actual = defs[id]; - if (actual === undefined) - throw 'module [' + id + '] was undefined'; - else if (actual.instance === undefined) - instantiate(id); - return actual.instance; -}; - -var req = function (ids, callback) { - var len = ids.length; - var instances = new Array(len); - for (var i = 0; i < len; ++i) - instances[i] = dem(ids[i]); - callback.apply(null, instances); -}; - -var ephox = {}; - -ephox.bolt = { - module: { - api: { - define: def, - require: req, - demand: dem - } - } -}; - -var define = def; -var require = req; -var demand = dem; -// this helps with minification when using a lot of global references -var defineGlobal = function (id, ref) { - define(id, [], function () { return ref; }); -}; -/*jsc -["tinymce.plugins.autoresize.Plugin","ephox.katamari.api.Cell","tinymce.core.PluginManager","tinymce.plugins.autoresize.api.Commands","tinymce.plugins.autoresize.core.Resize","global!tinymce.util.Tools.resolve","tinymce.core.Env","tinymce.core.util.Delay","tinymce.plugins.autoresize.api.Settings"] -jsc*/ -define( - 'ephox.katamari.api.Cell', - - [ - ], - - function () { - var Cell = function (initial) { - var value = initial; - - var get = function () { - return value; - }; - - var set = function (v) { - value = v; - }; - - var clone = function () { - return Cell(get()); - }; - - return { - get: get, - set: set, - clone: clone - }; + var Cell = function (initial) { + var value = initial; + var get = function () { + return value; }; - - return Cell; - } -); - -defineGlobal("global!tinymce.util.Tools.resolve", tinymce.util.Tools.resolve); -/** - * ResolveGlobal.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.core.PluginManager', - [ - 'global!tinymce.util.Tools.resolve' - ], - function (resolve) { - return resolve('tinymce.PluginManager'); - } -); - -/** - * ResolveGlobal.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.core.Env', - [ - 'global!tinymce.util.Tools.resolve' - ], - function (resolve) { - return resolve('tinymce.Env'); - } -); - -/** - * ResolveGlobal.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.core.util.Delay', - [ - 'global!tinymce.util.Tools.resolve' - ], - function (resolve) { - return resolve('tinymce.util.Delay'); - } -); - -/** - * Settings.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.autoresize.api.Settings', - [ - ], - function () { - var getAutoResizeMinHeight = function (editor) { - return parseInt(editor.getParam('autoresize_min_height', editor.getElement().offsetHeight), 10); + var set = function (v) { + value = v; }; - - var getAutoResizeMaxHeight = function (editor) { - return parseInt(editor.getParam('autoresize_max_height', 0), 10); - }; - - var getAutoResizeOverflowPadding = function (editor) { - return editor.getParam('autoresize_overflow_padding', 1); + var clone = function () { + return Cell(get()); }; - - var getAutoResizeBottomMargin = function (editor) { - return editor.getParam('autoresize_bottom_margin', 50); - }; - - var shouldAutoResizeOnInit = function (editor) { - return editor.getParam('autoresize_on_init', true); - }; - return { - getAutoResizeMinHeight: getAutoResizeMinHeight, - getAutoResizeMaxHeight: getAutoResizeMaxHeight, - getAutoResizeOverflowPadding: getAutoResizeOverflowPadding, - getAutoResizeBottomMargin: getAutoResizeBottomMargin, - shouldAutoResizeOnInit: shouldAutoResizeOnInit - }; - } -); -/** - * Plugin.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -/** - * This class contains all core logic for the autoresize plugin. - * - * @class tinymce.autoresize.Plugin - * @private - */ -define( - 'tinymce.plugins.autoresize.core.Resize', - [ - 'tinymce.core.Env', - 'tinymce.core.util.Delay', - 'tinymce.plugins.autoresize.api.Settings' - ], - function (Env, Delay, Settings) { - var isFullscreen = function (editor) { - return editor.plugins.fullscreen && editor.plugins.fullscreen.isFullscreen(); + get: get, + set: set, + clone: clone }; + }; - /** - * Calls the resize x times in 100ms intervals. We can't wait for load events since - * the CSS files might load async. - */ - var wait = function (editor, oldSize, times, interval, callback) { - Delay.setEditorTimeout(editor, function () { - resize(editor, oldSize); - - if (times--) { - wait(editor, oldSize, times, interval, callback); - } else if (callback) { - callback(); - } - }, interval); - }; - - /** - * This method gets executed each time the editor needs to resize. - */ - var resize = function (editor, oldSize) { - var deltaSize, doc, body, docElm, resizeHeight, myHeight; - var marginTop, marginBottom, paddingTop, paddingBottom, borderTop, borderBottom; - var dom = editor.dom; - - doc = editor.getDoc(); - if (!doc || isFullscreen(editor)) { - return; - } + var PluginManager = tinymce.util.Tools.resolve('tinymce.PluginManager'); - body = doc.body; - docElm = doc.documentElement; - resizeHeight = Settings.getAutoResizeMinHeight(editor); + var Env = tinymce.util.Tools.resolve('tinymce.Env'); - // Calculate outer height of the body element using CSS styles - marginTop = dom.getStyle(body, 'margin-top', true); - marginBottom = dom.getStyle(body, 'margin-bottom', true); - paddingTop = dom.getStyle(body, 'padding-top', true); - paddingBottom = dom.getStyle(body, 'padding-bottom', true); - borderTop = dom.getStyle(body, 'border-top-width', true); - borderBottom = dom.getStyle(body, 'border-bottom-width', true); - myHeight = body.offsetHeight + parseInt(marginTop, 10) + parseInt(marginBottom, 10) + - parseInt(paddingTop, 10) + parseInt(paddingBottom, 10) + - parseInt(borderTop, 10) + parseInt(borderBottom, 10); + var Delay = tinymce.util.Tools.resolve('tinymce.util.Delay'); - // Make sure we have a valid height - if (isNaN(myHeight) || myHeight <= 0) { - // Get height differently depending on the browser used - // eslint-disable-next-line no-nested-ternary - myHeight = Env.ie ? body.scrollHeight : (Env.webkit && body.clientHeight === 0 ? 0 : body.offsetHeight); - } + var getAutoResizeMinHeight = function (editor) { + return parseInt(editor.getParam('autoresize_min_height', editor.getElement().offsetHeight), 10); + }; + var getAutoResizeMaxHeight = function (editor) { + return parseInt(editor.getParam('autoresize_max_height', 0), 10); + }; + var getAutoResizeOverflowPadding = function (editor) { + return editor.getParam('autoresize_overflow_padding', 1); + }; + var getAutoResizeBottomMargin = function (editor) { + return editor.getParam('autoresize_bottom_margin', 50); + }; + var shouldAutoResizeOnInit = function (editor) { + return editor.getParam('autoresize_on_init', true); + }; + var $_b4exj8cje5nvbhi = { + getAutoResizeMinHeight: getAutoResizeMinHeight, + getAutoResizeMaxHeight: getAutoResizeMaxHeight, + getAutoResizeOverflowPadding: getAutoResizeOverflowPadding, + getAutoResizeBottomMargin: getAutoResizeBottomMargin, + shouldAutoResizeOnInit: shouldAutoResizeOnInit + }; - // Don't make it smaller than the minimum height - if (myHeight > Settings.getAutoResizeMinHeight(editor)) { - resizeHeight = myHeight; + var isFullscreen = function (editor) { + return editor.plugins.fullscreen && editor.plugins.fullscreen.isFullscreen(); + }; + var wait = function (editor, oldSize, times, interval, callback) { + Delay.setEditorTimeout(editor, function () { + resize(editor, oldSize); + if (times--) { + wait(editor, oldSize, times, interval, callback); + } else if (callback) { + callback(); } - - // If a maximum height has been defined don't exceed this height - var maxHeight = Settings.getAutoResizeMaxHeight(editor); - if (maxHeight && myHeight > maxHeight) { - resizeHeight = maxHeight; - body.style.overflowY = "auto"; - docElm.style.overflowY = "auto"; // Old IE - } else { - body.style.overflowY = "hidden"; - docElm.style.overflowY = "hidden"; // Old IE + }, interval); + }; + var toggleScrolling = function (editor, state) { + var body = editor.getBody(); + if (body) { + body.style.overflowY = state ? '' : 'hidden'; + if (!state) { body.scrollTop = 0; } - - // Resize content element - if (resizeHeight !== oldSize.get()) { - deltaSize = resizeHeight - oldSize.get(); - dom.setStyle(editor.iframeElement, 'height', resizeHeight + 'px'); - oldSize.set(resizeHeight); - - // WebKit doesn't decrease the size of the body element until the iframe gets resized - // So we need to continue to resize the iframe down until the size gets fixed - if (Env.webKit && deltaSize < 0) { - resize(editor); - } - } - }; - - var setup = function (editor, oldSize) { - editor.on("init", function () { - var overflowPadding, bottomMargin, dom = editor.dom; - - overflowPadding = Settings.getAutoResizeOverflowPadding(editor); - bottomMargin = Settings.getAutoResizeBottomMargin(editor); - - if (overflowPadding !== false) { - dom.setStyles(editor.getBody(), { - paddingLeft: overflowPadding, - paddingRight: overflowPadding - }); - } - - if (bottomMargin !== false) { - dom.setStyles(editor.getBody(), { - paddingBottom: bottomMargin - }); - } - }); - - editor.on("nodechange setcontent keyup FullscreenStateChanged", function () { + } + }; + var resize = function (editor, oldSize) { + var deltaSize, doc, body, resizeHeight, myHeight; + var marginTop, marginBottom, paddingTop, paddingBottom, borderTop, borderBottom; + var dom = editor.dom; + doc = editor.getDoc(); + if (!doc) { + return; + } + if (isFullscreen(editor)) { + toggleScrolling(editor, true); + return; + } + body = doc.body; + resizeHeight = $_b4exj8cje5nvbhi.getAutoResizeMinHeight(editor); + marginTop = dom.getStyle(body, 'margin-top', true); + marginBottom = dom.getStyle(body, 'margin-bottom', true); + paddingTop = dom.getStyle(body, 'padding-top', true); + paddingBottom = dom.getStyle(body, 'padding-bottom', true); + borderTop = dom.getStyle(body, 'border-top-width', true); + borderBottom = dom.getStyle(body, 'border-bottom-width', true); + myHeight = body.offsetHeight + parseInt(marginTop, 10) + parseInt(marginBottom, 10) + parseInt(paddingTop, 10) + parseInt(paddingBottom, 10) + parseInt(borderTop, 10) + parseInt(borderBottom, 10); + if (isNaN(myHeight) || myHeight <= 0) { + myHeight = Env.ie ? body.scrollHeight : Env.webkit && body.clientHeight === 0 ? 0 : body.offsetHeight; + } + if (myHeight > $_b4exj8cje5nvbhi.getAutoResizeMinHeight(editor)) { + resizeHeight = myHeight; + } + var maxHeight = $_b4exj8cje5nvbhi.getAutoResizeMaxHeight(editor); + if (maxHeight && myHeight > maxHeight) { + resizeHeight = maxHeight; + toggleScrolling(editor, true); + } else { + toggleScrolling(editor, false); + } + if (resizeHeight !== oldSize.get()) { + deltaSize = resizeHeight - oldSize.get(); + dom.setStyle(editor.iframeElement, 'height', resizeHeight + 'px'); + oldSize.set(resizeHeight); + if (Env.webkit && deltaSize < 0) { resize(editor, oldSize); - }); - - if (Settings.shouldAutoResizeOnInit(editor)) { - editor.on('init', function () { - // Hit it 20 times in 100 ms intervals - wait(editor, oldSize, 20, 100, function () { - // Hit it 5 times in 1 sec intervals - wait(editor, oldSize, 5, 1000); - }); + } + } + }; + var setup = function (editor, oldSize) { + editor.on('init', function () { + var overflowPadding, bottomMargin; + var dom = editor.dom; + overflowPadding = $_b4exj8cje5nvbhi.getAutoResizeOverflowPadding(editor); + bottomMargin = $_b4exj8cje5nvbhi.getAutoResizeBottomMargin(editor); + if (overflowPadding !== false) { + dom.setStyles(editor.getBody(), { + paddingLeft: overflowPadding, + paddingRight: overflowPadding }); } - }; - - return { - setup: setup, - resize: resize - }; - } -); -/** - * Commands.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.autoresize.api.Commands', - [ - 'tinymce.plugins.autoresize.core.Resize' - ], - function (Resize) { - var register = function (editor, oldSize) { - editor.addCommand('mceAutoResize', function () { - Resize.resize(editor, oldSize); + if (bottomMargin !== false) { + dom.setStyles(editor.getBody(), { paddingBottom: bottomMargin }); + } + }); + editor.on('nodechange setcontent keyup FullscreenStateChanged', function (e) { + resize(editor, oldSize); + }); + if ($_b4exj8cje5nvbhi.shouldAutoResizeOnInit(editor)) { + editor.on('init', function () { + wait(editor, oldSize, 20, 100, function () { + wait(editor, oldSize, 5, 1000); + }); }); - }; - - return { - register: register - }; - } -); -/** - * Plugin.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ + } + }; + var $_40s9wf89je5nvbhf = { + setup: setup, + resize: resize + }; -/** - * This class contains all core logic for the autoresize plugin. - * - * @class tinymce.autoresize.Plugin - * @private - */ -define( - 'tinymce.plugins.autoresize.Plugin', - [ - 'ephox.katamari.api.Cell', - 'tinymce.core.PluginManager', - 'tinymce.plugins.autoresize.api.Commands', - 'tinymce.plugins.autoresize.core.Resize' - ], - function (Cell, PluginManager, Commands, Resize) { - PluginManager.add('autoresize', function (editor) { - if (!editor.inline) { - var oldSize = Cell(0); - Commands.register(editor, oldSize); - Resize.setup(editor, oldSize); - } + var register = function (editor, oldSize) { + editor.addCommand('mceAutoResize', function () { + $_40s9wf89je5nvbhf.resize(editor, oldSize); }); + }; + var $_enoxse88je5nvbhd = { register: register }; - return function () {}; + PluginManager.add('autoresize', function (editor) { + if (!editor.inline) { + var oldSize = Cell(0); + $_enoxse88je5nvbhd.register(editor, oldSize); + $_40s9wf89je5nvbhf.setup(editor, oldSize); + } + }); + function Plugin () { } -); -dem('tinymce.plugins.autoresize.Plugin')(); + + return Plugin; + +}()); })(); diff --git a/tinymce_4/static/tinymce_4/tinymce/plugins/autoresize/plugin.min.js b/tinymce_4/static/tinymce_4/tinymce/plugins/autoresize/plugin.min.js index b486f7a..9f2b8fc 100644 --- a/tinymce_4/static/tinymce_4/tinymce/plugins/autoresize/plugin.min.js +++ b/tinymce_4/static/tinymce_4/tinymce/plugins/autoresize/plugin.min.js @@ -1 +1 @@ -!function(){var a={},b=function(b){for(var c=a[b],e=c.deps,f=c.defn,g=e.length,h=new Array(g),i=0;ic.getAutoResizeMinHeight(b)&&(k=l);var t=c.getAutoResizeMaxHeight(b);t&&l>t?(k=t,i.style.overflowY="auto",j.style.overflowY="auto"):(i.style.overflowY="hidden",j.style.overflowY="hidden",i.scrollTop=0),k!==e.get()&&(g=k-e.get(),s.setStyle(b.iframeElement,"height",k+"px"),e.set(k),a.webKit&&g<0&&f(b))}},g=function(a,b){a.on("init",function(){var b,d,e=a.dom;b=c.getAutoResizeOverflowPadding(a),d=c.getAutoResizeBottomMargin(a),b!==!1&&e.setStyles(a.getBody(),{paddingLeft:b,paddingRight:b}),d!==!1&&e.setStyles(a.getBody(),{paddingBottom:d})}),a.on("nodechange setcontent keyup FullscreenStateChanged",function(){f(a,b)}),c.shouldAutoResizeOnInit(a)&&a.on("init",function(){e(a,b,20,100,function(){e(a,b,5,1e3)})})};return{setup:g,resize:f}}),g("3",["4"],function(a){var b=function(b,c){b.addCommand("mceAutoResize",function(){a.resize(b,c)})};return{register:b}}),g("0",["1","2","3","4"],function(a,b,c,d){return b.add("autoresize",function(b){if(!b.inline){var e=a(0);c.register(b,e),d.setup(b,e)}}),function(){}}),d("0")()}(); \ No newline at end of file +!function(){"use strict";var t=function(e){var n=e,i=function(){return n};return{get:i,set:function(t){n=t},clone:function(){return t(i())}}},e=tinymce.util.Tools.resolve("tinymce.PluginManager"),n=tinymce.util.Tools.resolve("tinymce.Env"),i=tinymce.util.Tools.resolve("tinymce.util.Delay"),o=function(t){return parseInt(t.getParam("autoresize_min_height",t.getElement().offsetHeight),10)},r=function(t){return parseInt(t.getParam("autoresize_max_height",0),10)},a=function(t){return t.getParam("autoresize_overflow_padding",1)},u=function(t){return t.getParam("autoresize_bottom_margin",50)},s=function(t){return t.getParam("autoresize_on_init",!0)},l=function(t,e,n,o,r){i.setEditorTimeout(t,function(){c(t,e),n--?l(t,e,n,o,r):r&&r()},o)},g=function(t,e){var n=t.getBody();n&&(n.style.overflowY=e?"":"hidden",e||(n.scrollTop=0))},c=function(t,e){var i,a,u,s,l,f,d,m,p,y,h,v=t.dom;if(a=t.getDoc())if((S=t).plugins.fullscreen&&S.plugins.fullscreen.isFullscreen())g(t,!0);else{var S;u=a.body,s=o(t),f=v.getStyle(u,"margin-top",!0),d=v.getStyle(u,"margin-bottom",!0),m=v.getStyle(u,"padding-top",!0),p=v.getStyle(u,"padding-bottom",!0),y=v.getStyle(u,"border-top-width",!0),h=v.getStyle(u,"border-bottom-width",!0),l=u.offsetHeight+parseInt(f,10)+parseInt(d,10)+parseInt(m,10)+parseInt(p,10)+parseInt(y,10)+parseInt(h,10),(isNaN(l)||l<=0)&&(l=n.ie?u.scrollHeight:n.webkit&&0===u.clientHeight?0:u.offsetHeight),l>o(t)&&(s=l);var _=r(t);_&&l>_?(s=_,g(t,!0)):g(t,!1),s!==e.get()&&(i=s-e.get(),v.setStyle(t.iframeElement,"height",s+"px"),e.set(s),n.webkit&&i<0&&c(t,e))}},f={setup:function(t,e){t.on("init",function(){var e,n,i=t.dom;e=a(t),n=u(t),!1!==e&&i.setStyles(t.getBody(),{paddingLeft:e,paddingRight:e}),!1!==n&&i.setStyles(t.getBody(),{paddingBottom:n})}),t.on("nodechange setcontent keyup FullscreenStateChanged",function(n){c(t,e)}),s(t)&&t.on("init",function(){l(t,e,20,100,function(){l(t,e,5,1e3)})})},resize:c},d=function(t,e){t.addCommand("mceAutoResize",function(){f.resize(t,e)})};e.add("autoresize",function(e){if(!e.inline){var n=t(0);d(e,n),f.setup(e,n)}})}(); \ No newline at end of file diff --git a/tinymce_4/static/tinymce_4/tinymce/plugins/autosave/plugin.js b/tinymce_4/static/tinymce_4/tinymce/plugins/autosave/plugin.js index 5a5da59..6f2e73c 100644 --- a/tinymce_4/static/tinymce_4/tinymce/plugins/autosave/plugin.js +++ b/tinymce_4/static/tinymce_4/tinymce/plugins/autosave/plugin.js @@ -1,607 +1,226 @@ (function () { +var autosave = (function () { + 'use strict'; -var defs = {}; // id -> {dependencies, definition, instance (possibly undefined)} - -// Used when there is no 'main' module. -// The name is probably (hopefully) unique so minification removes for releases. -var register_3795 = function (id) { - var module = dem(id); - var fragments = id.split('.'); - var target = Function('return this;')(); - for (var i = 0; i < fragments.length - 1; ++i) { - if (target[fragments[i]] === undefined) - target[fragments[i]] = {}; - target = target[fragments[i]]; - } - target[fragments[fragments.length - 1]] = module; -}; - -var instantiate = function (id) { - var actual = defs[id]; - var dependencies = actual.deps; - var definition = actual.defn; - var len = dependencies.length; - var instances = new Array(len); - for (var i = 0; i < len; ++i) - instances[i] = dem(dependencies[i]); - var defResult = definition.apply(null, instances); - if (defResult === undefined) - throw 'module [' + id + '] returned undefined'; - actual.instance = defResult; -}; - -var def = function (id, dependencies, definition) { - if (typeof id !== 'string') - throw 'module id must be a string'; - else if (dependencies === undefined) - throw 'no dependencies for ' + id; - else if (definition === undefined) - throw 'no definition function for ' + id; - defs[id] = { - deps: dependencies, - defn: definition, - instance: undefined - }; -}; - -var dem = function (id) { - var actual = defs[id]; - if (actual === undefined) - throw 'module [' + id + '] was undefined'; - else if (actual.instance === undefined) - instantiate(id); - return actual.instance; -}; - -var req = function (ids, callback) { - var len = ids.length; - var instances = new Array(len); - for (var i = 0; i < len; ++i) - instances[i] = dem(ids[i]); - callback.apply(null, instances); -}; - -var ephox = {}; - -ephox.bolt = { - module: { - api: { - define: def, - require: req, - demand: dem - } - } -}; - -var define = def; -var require = req; -var demand = dem; -// this helps with minification when using a lot of global references -var defineGlobal = function (id, ref) { - define(id, [], function () { return ref; }); -}; -/*jsc -["tinymce.plugins.autosave.Plugin","ephox.katamari.api.Cell","tinymce.core.PluginManager","tinymce.plugins.autosave.api.Api","tinymce.plugins.autosave.core.BeforeUnload","tinymce.plugins.autosave.ui.Buttons","global!tinymce.util.Tools.resolve","tinymce.plugins.autosave.core.Storage","global!window","tinymce.core.EditorManager","tinymce.core.util.Tools","tinymce.plugins.autosave.api.Settings","global!setInterval","tinymce.core.util.LocalStorage","tinymce.plugins.autosave.api.Events","global!document","tinymce.plugins.autosave.core.Time"] -jsc*/ -define( - 'ephox.katamari.api.Cell', - - [ - ], - - function () { - var Cell = function (initial) { - var value = initial; - - var get = function () { - return value; - }; - - var set = function (v) { - value = v; - }; - - var clone = function () { - return Cell(get()); - }; - - return { - get: get, - set: set, - clone: clone - }; + var Cell = function (initial) { + var value = initial; + var get = function () { + return value; }; - - return Cell; - } -); - -defineGlobal("global!tinymce.util.Tools.resolve", tinymce.util.Tools.resolve); -/** - * ResolveGlobal.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.core.PluginManager', - [ - 'global!tinymce.util.Tools.resolve' - ], - function (resolve) { - return resolve('tinymce.PluginManager'); - } -); - -defineGlobal("global!setInterval", setInterval); -/** - * ResolveGlobal.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.core.util.LocalStorage', - [ - 'global!tinymce.util.Tools.resolve' - ], - function (resolve) { - return resolve('tinymce.util.LocalStorage'); - } -); - -/** - * ResolveGlobal.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.core.util.Tools', - [ - 'global!tinymce.util.Tools.resolve' - ], - function (resolve) { - return resolve('tinymce.util.Tools'); - } -); - -/** - * Events.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.autosave.api.Events', - [ - ], - function () { - var fireRestoreDraft = function (editor) { - return editor.fire('RestoreDraft'); + var set = function (v) { + value = v; }; - - var fireStoreDraft = function (editor) { - return editor.fire('StoreDraft'); + var clone = function () { + return Cell(get()); }; - - var fireRemoveDraft = function (editor) { - return editor.fire('RemoveDraft'); - }; - return { - fireRestoreDraft: fireRestoreDraft, - fireStoreDraft: fireStoreDraft, - fireRemoveDraft: fireRemoveDraft - }; - } -); - -defineGlobal("global!document", document); -/** - * Time.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.autosave.core.Time', - [ - ], - function () { - var parse = function (time, defaultTime) { - var multiples = { - s: 1000, - m: 60000 - }; - - time = /^(\d+)([ms]?)$/.exec('' + (time || defaultTime)); - - return (time[2] ? multiples[time[2]] : 1) * parseInt(time, 10); + get: get, + set: set, + clone: clone }; + }; - return { - parse: parse - }; - } -); -/** - * Settings.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ + var PluginManager = tinymce.util.Tools.resolve('tinymce.PluginManager'); -define( - 'tinymce.plugins.autosave.api.Settings', - [ - 'global!document', - 'tinymce.plugins.autosave.core.Time' - ], - function (document, Time) { - var shouldAskBeforeUnload = function (editor) { - return editor.getParam("autosave_ask_before_unload", true); - }; + var LocalStorage = tinymce.util.Tools.resolve('tinymce.util.LocalStorage'); - var getAutoSavePrefix = function (editor) { - var prefix = editor.getParam('autosave_prefix', 'tinymce-autosave-{path}{query}-{id}-'); + var Tools = tinymce.util.Tools.resolve('tinymce.util.Tools'); - prefix = prefix.replace(/\{path\}/g, document.location.pathname); - prefix = prefix.replace(/\{query\}/g, document.location.search); - prefix = prefix.replace(/\{id\}/g, editor.id); + var fireRestoreDraft = function (editor) { + return editor.fire('RestoreDraft'); + }; + var fireStoreDraft = function (editor) { + return editor.fire('StoreDraft'); + }; + var fireRemoveDraft = function (editor) { + return editor.fire('RemoveDraft'); + }; + var $_e9knqi8kje5nvbi7 = { + fireRestoreDraft: fireRestoreDraft, + fireStoreDraft: fireStoreDraft, + fireRemoveDraft: fireRemoveDraft + }; - return prefix; + var parse = function (time, defaultTime) { + var multiples = { + s: 1000, + m: 60000 }; + time = /^(\d+)([ms]?)$/.exec('' + (time || defaultTime)); + return (time[2] ? multiples[time[2]] : 1) * parseInt(time, 10); + }; + var $_32iu1r8mje5nvbi9 = { parse: parse }; - var shouldRestoreWhenEmpty = function (editor) { - return editor.getParam('autosave_restore_when_empty', false); - }; + var shouldAskBeforeUnload = function (editor) { + return editor.getParam('autosave_ask_before_unload', true); + }; + var getAutoSavePrefix = function (editor) { + var prefix = editor.getParam('autosave_prefix', 'tinymce-autosave-{path}{query}{hash}-{id}-'); + prefix = prefix.replace(/\{path\}/g, document.location.pathname); + prefix = prefix.replace(/\{query\}/g, document.location.search); + prefix = prefix.replace(/\{hash\}/g, document.location.hash); + prefix = prefix.replace(/\{id\}/g, editor.id); + return prefix; + }; + var shouldRestoreWhenEmpty = function (editor) { + return editor.getParam('autosave_restore_when_empty', false); + }; + var getAutoSaveInterval = function (editor) { + return $_32iu1r8mje5nvbi9.parse(editor.settings.autosave_interval, '30s'); + }; + var getAutoSaveRetention = function (editor) { + return $_32iu1r8mje5nvbi9.parse(editor.settings.autosave_retention, '20m'); + }; + var $_1ti0pj8lje5nvbi8 = { + shouldAskBeforeUnload: shouldAskBeforeUnload, + getAutoSavePrefix: getAutoSavePrefix, + shouldRestoreWhenEmpty: shouldRestoreWhenEmpty, + getAutoSaveInterval: getAutoSaveInterval, + getAutoSaveRetention: getAutoSaveRetention + }; - var getAutoSaveInterval = function (editor) { - return Time.parse(editor.settings.autosave_interval, '30s'); - }; + var isEmpty = function (editor, html) { + var forcedRootBlockName = editor.settings.forced_root_block; + html = Tools.trim(typeof html === 'undefined' ? editor.getBody().innerHTML : html); + return html === '' || new RegExp('^<' + forcedRootBlockName + '[^>]*>((\xA0| |[ \t]|]*>)+?|)|
$', 'i').test(html); + }; + var hasDraft = function (editor) { + var time = parseInt(LocalStorage.getItem($_1ti0pj8lje5nvbi8.getAutoSavePrefix(editor) + 'time'), 10) || 0; + if (new Date().getTime() - time > $_1ti0pj8lje5nvbi8.getAutoSaveRetention(editor)) { + removeDraft(editor, false); + return false; + } + return true; + }; + var removeDraft = function (editor, fire) { + var prefix = $_1ti0pj8lje5nvbi8.getAutoSavePrefix(editor); + LocalStorage.removeItem(prefix + 'draft'); + LocalStorage.removeItem(prefix + 'time'); + if (fire !== false) { + $_e9knqi8kje5nvbi7.fireRemoveDraft(editor); + } + }; + var storeDraft = function (editor) { + var prefix = $_1ti0pj8lje5nvbi8.getAutoSavePrefix(editor); + if (!isEmpty(editor) && editor.isDirty()) { + LocalStorage.setItem(prefix + 'draft', editor.getContent({ + format: 'raw', + no_events: true + })); + LocalStorage.setItem(prefix + 'time', new Date().getTime().toString()); + $_e9knqi8kje5nvbi7.fireStoreDraft(editor); + } + }; + var restoreDraft = function (editor) { + var prefix = $_1ti0pj8lje5nvbi8.getAutoSavePrefix(editor); + if (hasDraft(editor)) { + editor.setContent(LocalStorage.getItem(prefix + 'draft'), { format: 'raw' }); + $_e9knqi8kje5nvbi7.fireRestoreDraft(editor); + } + }; + var startStoreDraft = function (editor, started) { + var interval = $_1ti0pj8lje5nvbi8.getAutoSaveInterval(editor); + if (!started.get()) { + setInterval(function () { + if (!editor.removed) { + storeDraft(editor); + } + }, interval); + started.set(true); + } + }; + var restoreLastDraft = function (editor) { + editor.undoManager.transact(function () { + restoreDraft(editor); + removeDraft(editor); + }); + editor.focus(); + }; + var $_69kz9a8hje5nvbi4 = { + isEmpty: isEmpty, + hasDraft: hasDraft, + removeDraft: removeDraft, + storeDraft: storeDraft, + restoreDraft: restoreDraft, + startStoreDraft: startStoreDraft, + restoreLastDraft: restoreLastDraft + }; - var getAutoSaveRetention = function (editor) { - return Time.parse(editor.settings.autosave_retention, '20m'); + var curry = function (f, editor) { + return function () { + var args = Array.prototype.slice.call(arguments); + return f.apply(null, [editor].concat(args)); }; - + }; + var get = function (editor) { return { - shouldAskBeforeUnload: shouldAskBeforeUnload, - getAutoSavePrefix: getAutoSavePrefix, - shouldRestoreWhenEmpty: shouldRestoreWhenEmpty, - getAutoSaveInterval: getAutoSaveInterval, - getAutoSaveRetention: getAutoSaveRetention - }; - } -); -/** - * Storage.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.autosave.core.Storage', - [ - 'global!setInterval', - 'tinymce.core.util.LocalStorage', - 'tinymce.core.util.Tools', - 'tinymce.plugins.autosave.api.Events', - 'tinymce.plugins.autosave.api.Settings' - ], - function (setInterval, LocalStorage, Tools, Events, Settings) { - var isEmpty = function (editor, html) { - var forcedRootBlockName = editor.settings.forced_root_block; - - html = Tools.trim(typeof html === "undefined" ? editor.getBody().innerHTML : html); - - return html === '' || new RegExp( - '^<' + forcedRootBlockName + '[^>]*>((\u00a0| |[ \t]|]*>)+?|)<\/' + forcedRootBlockName + '>|
$', 'i' - ).test(html); - }; - - var hasDraft = function (editor) { - var time = parseInt(LocalStorage.getItem(Settings.getAutoSavePrefix(editor) + "time"), 10) || 0; - - if (new Date().getTime() - time > Settings.getAutoSaveRetention(editor)) { - removeDraft(editor, false); - return false; - } - - return true; - }; - - var removeDraft = function (editor, fire) { - var prefix = Settings.getAutoSavePrefix(editor); - - LocalStorage.removeItem(prefix + "draft"); - LocalStorage.removeItem(prefix + "time"); - - if (fire !== false) { - Events.fireRemoveDraft(editor); - } + hasDraft: curry($_69kz9a8hje5nvbi4.hasDraft, editor), + storeDraft: curry($_69kz9a8hje5nvbi4.storeDraft, editor), + restoreDraft: curry($_69kz9a8hje5nvbi4.restoreDraft, editor), + removeDraft: curry($_69kz9a8hje5nvbi4.removeDraft, editor), + isEmpty: curry($_69kz9a8hje5nvbi4.isEmpty, editor) }; + }; + var $_4jgvbi8gje5nvbi2 = { get: get }; - var storeDraft = function (editor) { - var prefix = Settings.getAutoSavePrefix(editor); + var EditorManager = tinymce.util.Tools.resolve('tinymce.EditorManager'); - if (!isEmpty(editor) && editor.isDirty()) { - LocalStorage.setItem(prefix + "draft", editor.getContent({ format: 'raw', no_events: true })); - LocalStorage.setItem(prefix + "time", new Date().getTime()); - Events.fireStoreDraft(editor); + EditorManager._beforeUnloadHandler = function () { + var msg; + Tools.each(EditorManager.get(), function (editor) { + if (editor.plugins.autosave) { + editor.plugins.autosave.storeDraft(); } - }; - - var restoreDraft = function (editor) { - var prefix = Settings.getAutoSavePrefix(editor); - - if (hasDraft(editor)) { - editor.setContent(LocalStorage.getItem(prefix + "draft"), { format: 'raw' }); - Events.fireRestoreDraft(editor); + if (!msg && editor.isDirty() && $_1ti0pj8lje5nvbi8.shouldAskBeforeUnload(editor)) { + msg = editor.translate('You have unsaved changes are you sure you want to navigate away?'); } - }; - - var startStoreDraft = function (editor, started) { - var interval = Settings.getAutoSaveInterval(editor); - - if (!started.get()) { - setInterval(function () { - if (!editor.removed) { - storeDraft(editor); - } - }, interval); - - started.set(true); - } - }; - - var restoreLastDraft = function (editor) { - editor.undoManager.transact(function () { - restoreDraft(editor); - removeDraft(editor); - }); - - editor.focus(); - }; - - return { - isEmpty: isEmpty, - hasDraft: hasDraft, - removeDraft: removeDraft, - storeDraft: storeDraft, - restoreDraft: restoreDraft, - startStoreDraft: startStoreDraft, - restoreLastDraft: restoreLastDraft - }; - } -); -/** - * Api.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.autosave.api.Api', - [ - 'tinymce.plugins.autosave.core.Storage' - ], - function (Storage) { - // Inlined the curry function since adding Fun without tree shaking to every plugin would produce a lot of bloat - var curry = function (f, editor) { - return function () { - var args = Array.prototype.slice.call(arguments); - return f.apply(null, [editor].concat(args)); - }; - }; - - var get = function (editor) { - return { - hasDraft: curry(Storage.hasDraft, editor), - storeDraft: curry(Storage.storeDraft, editor), - restoreDraft: curry(Storage.restoreDraft, editor), - removeDraft: curry(Storage.removeDraft, editor), - isEmpty: curry(Storage.isEmpty, editor) - }; - }; - - return { - get: get - }; - } -); -defineGlobal("global!window", window); -/** - * ResolveGlobal.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.core.EditorManager', - [ - 'global!tinymce.util.Tools.resolve' - ], - function (resolve) { - return resolve('tinymce.EditorManager'); - } -); - -/** - * BeforeUnload.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.autosave.core.BeforeUnload', - [ - 'global!window', - 'tinymce.core.EditorManager', - 'tinymce.core.util.Tools', - 'tinymce.plugins.autosave.api.Settings' - ], - function (window, EditorManager, Tools, Settings) { - EditorManager._beforeUnloadHandler = function () { - var msg; - - Tools.each(EditorManager.get(), function (editor) { - // Store a draft for each editor instance - if (editor.plugins.autosave) { - editor.plugins.autosave.storeDraft(); - } - - // Setup a return message if the editor is dirty - if (!msg && editor.isDirty() && Settings.shouldAskBeforeUnload(editor)) { - msg = editor.translate("You have unsaved changes are you sure you want to navigate away?"); - } - }); - - return msg; - }; - - var setup = function (editor) { - window.onbeforeunload = EditorManager._beforeUnloadHandler; - }; - - return { - setup: setup - }; - } -); -/** - * Buttons.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.autosave.ui.Buttons', - [ - 'tinymce.plugins.autosave.core.Storage' - ], - function (Storage) { - var postRender = function (editor, started) { - return function (e) { - var ctrl = e.control; - - ctrl.disabled(!Storage.hasDraft(editor)); - - editor.on('StoreDraft RestoreDraft RemoveDraft', function () { - ctrl.disabled(!Storage.hasDraft(editor)); - }); - - // TODO: Investigate why this is only done on postrender that would - // make the feature broken if only the menu item was rendered since - // it is rendered when the menu appears - Storage.startStoreDraft(editor, started); - }; - }; - - var register = function (editor, started) { - editor.addButton('restoredraft', { - title: 'Restore last draft', - onclick: function () { - Storage.restoreLastDraft(editor); - }, - onPostRender: postRender(editor, started) - }); - - editor.addMenuItem('restoredraft', { - text: 'Restore last draft', - onclick: function () { - Storage.restoreLastDraft(editor); - }, - onPostRender: postRender(editor, started), - context: 'file' + }); + return msg; + }; + var setup = function (editor) { + window.onbeforeunload = EditorManager._beforeUnloadHandler; + }; + var $_d2mth48nje5nvbib = { setup: setup }; + + var postRender = function (editor, started) { + return function (e) { + var ctrl = e.control; + ctrl.disabled(!$_69kz9a8hje5nvbi4.hasDraft(editor)); + editor.on('StoreDraft RestoreDraft RemoveDraft', function () { + ctrl.disabled(!$_69kz9a8hje5nvbi4.hasDraft(editor)); }); + $_69kz9a8hje5nvbi4.startStoreDraft(editor, started); }; - - return { - register: register - }; + }; + var register = function (editor, started) { + editor.addButton('restoredraft', { + title: 'Restore last draft', + onclick: function () { + $_69kz9a8hje5nvbi4.restoreLastDraft(editor); + }, + onPostRender: postRender(editor, started) + }); + editor.addMenuItem('restoredraft', { + text: 'Restore last draft', + onclick: function () { + $_69kz9a8hje5nvbi4.restoreLastDraft(editor); + }, + onPostRender: postRender(editor, started), + context: 'file' + }); + }; + var $_5dhnmz8pje5nvbid = { register: register }; + + PluginManager.add('autosave', function (editor) { + var started = Cell(false); + $_d2mth48nje5nvbib.setup(editor); + $_5dhnmz8pje5nvbid.register(editor, started); + return $_4jgvbi8gje5nvbi2.get(editor); + }); + function Plugin () { } -); -/** - * Plugin.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ -/** - * This class contains all core logic for the autosave plugin. - * - * @class tinymce.autosave.Plugin - * @private - */ -define( - 'tinymce.plugins.autosave.Plugin', - [ - 'ephox.katamari.api.Cell', - 'tinymce.core.PluginManager', - 'tinymce.plugins.autosave.api.Api', - 'tinymce.plugins.autosave.core.BeforeUnload', - 'tinymce.plugins.autosave.ui.Buttons' - ], - function (Cell, PluginManager, Api, BeforeUnload, Buttons) { - PluginManager.add('autosave', function (editor) { - var started = Cell(false); + return Plugin; - BeforeUnload.setup(editor); - Buttons.register(editor, started); - - return Api.get(editor); - }); - - return function () { }; - } -); -dem('tinymce.plugins.autosave.Plugin')(); +}()); })(); diff --git a/tinymce_4/static/tinymce_4/tinymce/plugins/autosave/plugin.min.js b/tinymce_4/static/tinymce_4/tinymce/plugins/autosave/plugin.min.js index a9e6b31..77d0af9 100644 --- a/tinymce_4/static/tinymce_4/tinymce/plugins/autosave/plugin.min.js +++ b/tinymce_4/static/tinymce_4/tinymce/plugins/autosave/plugin.min.js @@ -1 +1 @@ -!function(){var a={},b=function(b){for(var c=a[b],e=c.deps,f=c.defn,g=e.length,h=new Array(g),i=0;i]*>((\xa0| |[ \t]|]*>)+?|)|
$","i").test(b)},g=function(a){var c=parseInt(b.getItem(e.getAutoSavePrefix(a)+"time"),10)||0;return!((new Date).getTime()-c>e.getAutoSaveRetention(a))||(h(a,!1),!1)},h=function(a,c){var f=e.getAutoSavePrefix(a);b.removeItem(f+"draft"),b.removeItem(f+"time"),c!==!1&&d.fireRemoveDraft(a)},i=function(a){var c=e.getAutoSavePrefix(a);!f(a)&&a.isDirty()&&(b.setItem(c+"draft",a.getContent({format:"raw",no_events:!0})),b.setItem(c+"time",(new Date).getTime()),d.fireStoreDraft(a))},j=function(a){var c=e.getAutoSavePrefix(a);g(a)&&(a.setContent(b.getItem(c+"draft"),{format:"raw"}),d.fireRestoreDraft(a))},k=function(b,c){var d=e.getAutoSaveInterval(b);c.get()||(a(function(){b.removed||i(b)},d),c.set(!0))},l=function(a){a.undoManager.transact(function(){j(a),h(a)}),a.focus()};return{isEmpty:f,hasDraft:g,removeDraft:h,storeDraft:i,restoreDraft:j,startStoreDraft:k,restoreLastDraft:l}}),g("3",["7"],function(a){var b=function(a,b){return function(){var c=Array.prototype.slice.call(arguments);return a.apply(null,[b].concat(c))}},c=function(c){return{hasDraft:b(a.hasDraft,c),storeDraft:b(a.storeDraft,c),restoreDraft:b(a.restoreDraft,c),removeDraft:b(a.removeDraft,c),isEmpty:b(a.isEmpty,c)}};return{get:c}}),h("8",window),g("9",["6"],function(a){return a("tinymce.EditorManager")}),g("4",["8","9","a","b"],function(a,b,c,d){b._beforeUnloadHandler=function(){var a;return c.each(b.get(),function(b){b.plugins.autosave&&b.plugins.autosave.storeDraft(),!a&&b.isDirty()&&d.shouldAskBeforeUnload(b)&&(a=b.translate("You have unsaved changes are you sure you want to navigate away?"))}),a};var e=function(c){a.onbeforeunload=b._beforeUnloadHandler};return{setup:e}}),g("5",["7"],function(a){var b=function(b,c){return function(d){var e=d.control;e.disabled(!a.hasDraft(b)),b.on("StoreDraft RestoreDraft RemoveDraft",function(){e.disabled(!a.hasDraft(b))}),a.startStoreDraft(b,c)}},c=function(c,d){c.addButton("restoredraft",{title:"Restore last draft",onclick:function(){a.restoreLastDraft(c)},onPostRender:b(c,d)}),c.addMenuItem("restoredraft",{text:"Restore last draft",onclick:function(){a.restoreLastDraft(c)},onPostRender:b(c,d),context:"file"})};return{register:c}}),g("0",["1","2","3","4","5"],function(a,b,c,d,e){return b.add("autosave",function(b){var f=a(!1);return d.setup(b),e.register(b,f),c.get(b)}),function(){}}),d("0")()}(); \ No newline at end of file +!function(){"use strict";var t=function(e){var r=e,n=function(){return r};return{get:n,set:function(t){r=t},clone:function(){return t(n())}}},e=tinymce.util.Tools.resolve("tinymce.PluginManager"),r=tinymce.util.Tools.resolve("tinymce.util.LocalStorage"),n=tinymce.util.Tools.resolve("tinymce.util.Tools"),a=function(t){return t.fire("RestoreDraft")},o=function(t){return t.fire("StoreDraft")},i=function(t){return t.fire("RemoveDraft")},s=function(t,e){return((t=/^(\d+)([ms]?)$/.exec(""+(t||e)))[2]?{s:1e3,m:6e4}[t[2]]:1)*parseInt(t,10)},u=function(t){return t.getParam("autosave_ask_before_unload",!0)},f=function(t){var e=t.getParam("autosave_prefix","tinymce-autosave-{path}{query}{hash}-{id}-");return e=(e=(e=(e=e.replace(/\{path\}/g,document.location.pathname)).replace(/\{query\}/g,document.location.search)).replace(/\{hash\}/g,document.location.hash)).replace(/\{id\}/g,t.id)},c=function(t){return s(t.settings.autosave_interval,"30s")},l=function(t){return s(t.settings.autosave_retention,"20m")},m=function(t,e){var r=t.settings.forced_root_block;return""===(e=n.trim(void 0===e?t.getBody().innerHTML:e))||new RegExp("^<"+r+"[^>]*>((\xa0| |[ \t]|]*>)+?|)|
$","i").test(e)},v=function(t){var e=parseInt(r.getItem(f(t)+"time"),10)||0;return!((new Date).getTime()-e>l(t)&&(d(t,!1),1))},d=function(t,e){var n=f(t);r.removeItem(n+"draft"),r.removeItem(n+"time"),!1!==e&&i(t)},D=function(t){var e=f(t);!m(t)&&t.isDirty()&&(r.setItem(e+"draft",t.getContent({format:"raw",no_events:!0})),r.setItem(e+"time",(new Date).getTime().toString()),o(t))},g=function(t){var e=f(t);v(t)&&(t.setContent(r.getItem(e+"draft"),{format:"raw"}),a(t))},y={isEmpty:m,hasDraft:v,removeDraft:d,storeDraft:D,restoreDraft:g,startStoreDraft:function(t,e){var r=c(t);e.get()||(setInterval(function(){t.removed||D(t)},r),e.set(!0))},restoreLastDraft:function(t){t.undoManager.transact(function(){g(t),d(t)}),t.focus()}},p=function(t,e){return function(){var r=Array.prototype.slice.call(arguments);return t.apply(null,[e].concat(r))}},h=function(t){return{hasDraft:p(y.hasDraft,t),storeDraft:p(y.storeDraft,t),restoreDraft:p(y.restoreDraft,t),removeDraft:p(y.removeDraft,t),isEmpty:p(y.isEmpty,t)}},_=tinymce.util.Tools.resolve("tinymce.EditorManager");_._beforeUnloadHandler=function(){var t;return n.each(_.get(),function(e){e.plugins.autosave&&e.plugins.autosave.storeDraft(),!t&&e.isDirty()&&u(e)&&(t=e.translate("You have unsaved changes are you sure you want to navigate away?"))}),t};var b=function(t){window.onbeforeunload=_._beforeUnloadHandler},I=function(t,e){return function(r){var n=r.control;n.disabled(!y.hasDraft(t)),t.on("StoreDraft RestoreDraft RemoveDraft",function(){n.disabled(!y.hasDraft(t))}),y.startStoreDraft(t,e)}},w=function(t,e){t.addButton("restoredraft",{title:"Restore last draft",onclick:function(){y.restoreLastDraft(t)},onPostRender:I(t,e)}),t.addMenuItem("restoredraft",{text:"Restore last draft",onclick:function(){y.restoreLastDraft(t)},onPostRender:I(t,e),context:"file"})};e.add("autosave",function(e){var r=t(!1);return b(e),w(e,r),h(e)})}(); \ No newline at end of file diff --git a/tinymce_4/static/tinymce_4/tinymce/plugins/bbcode/plugin.js b/tinymce_4/static/tinymce_4/tinymce/plugins/bbcode/plugin.js index 8e84e21..3f6748b 100644 --- a/tinymce_4/static/tinymce_4/tinymce/plugins/bbcode/plugin.js +++ b/tinymce_4/static/tinymce_4/tinymce/plugins/bbcode/plugin.js @@ -1,264 +1,101 @@ (function () { +var bbcode = (function () { + 'use strict'; -var defs = {}; // id -> {dependencies, definition, instance (possibly undefined)} + var PluginManager = tinymce.util.Tools.resolve('tinymce.PluginManager'); -// Used when there is no 'main' module. -// The name is probably (hopefully) unique so minification removes for releases. -var register_3795 = function (id) { - var module = dem(id); - var fragments = id.split('.'); - var target = Function('return this;')(); - for (var i = 0; i < fragments.length - 1; ++i) { - if (target[fragments[i]] === undefined) - target[fragments[i]] = {}; - target = target[fragments[i]]; - } - target[fragments[fragments.length - 1]] = module; -}; - -var instantiate = function (id) { - var actual = defs[id]; - var dependencies = actual.deps; - var definition = actual.defn; - var len = dependencies.length; - var instances = new Array(len); - for (var i = 0; i < len; ++i) - instances[i] = dem(dependencies[i]); - var defResult = definition.apply(null, instances); - if (defResult === undefined) - throw 'module [' + id + '] returned undefined'; - actual.instance = defResult; -}; - -var def = function (id, dependencies, definition) { - if (typeof id !== 'string') - throw 'module id must be a string'; - else if (dependencies === undefined) - throw 'no dependencies for ' + id; - else if (definition === undefined) - throw 'no definition function for ' + id; - defs[id] = { - deps: dependencies, - defn: definition, - instance: undefined - }; -}; - -var dem = function (id) { - var actual = defs[id]; - if (actual === undefined) - throw 'module [' + id + '] was undefined'; - else if (actual.instance === undefined) - instantiate(id); - return actual.instance; -}; - -var req = function (ids, callback) { - var len = ids.length; - var instances = new Array(len); - for (var i = 0; i < len; ++i) - instances[i] = dem(ids[i]); - callback.apply(null, instances); -}; - -var ephox = {}; - -ephox.bolt = { - module: { - api: { - define: def, - require: req, - demand: dem - } - } -}; - -var define = def; -var require = req; -var demand = dem; -// this helps with minification when using a lot of global references -var defineGlobal = function (id, ref) { - define(id, [], function () { return ref; }); -}; -/*jsc -["tinymce.plugins.bbcode.Plugin","tinymce.core.PluginManager","tinymce.plugins.bbcode.core.Convert","global!tinymce.util.Tools.resolve","tinymce.core.util.Tools"] -jsc*/ -defineGlobal("global!tinymce.util.Tools.resolve", tinymce.util.Tools.resolve); -/** - * ResolveGlobal.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.core.PluginManager', - [ - 'global!tinymce.util.Tools.resolve' - ], - function (resolve) { - return resolve('tinymce.PluginManager'); - } -); - -/** - * ResolveGlobal.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.core.util.Tools', - [ - 'global!tinymce.util.Tools.resolve' - ], - function (resolve) { - return resolve('tinymce.util.Tools'); - } -); + var Tools = tinymce.util.Tools.resolve('tinymce.util.Tools'); -/** - * Convert.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.bbcode.core.Convert', - [ - 'tinymce.core.util.Tools' - ], - function (Tools) { - var html2bbcode = function (s) { - s = Tools.trim(s); - - var rep = function (re, str) { - s = s.replace(re, str); - }; - - // example: to [b] - rep(/(.*?)<\/a>/gi, "[url=$1]$2[/url]"); - rep(/(.*?)<\/font>/gi, "[code][color=$1]$2[/color][/code]"); - rep(/(.*?)<\/font>/gi, "[quote][color=$1]$2[/color][/quote]"); - rep(/(.*?)<\/font>/gi, "[code][color=$1]$2[/color][/code]"); - rep(/(.*?)<\/font>/gi, "[quote][color=$1]$2[/color][/quote]"); - rep(/(.*?)<\/span>/gi, "[color=$1]$2[/color]"); - rep(/(.*?)<\/font>/gi, "[color=$1]$2[/color]"); - rep(/(.*?)<\/span>/gi, "[size=$1]$2[/size]"); - rep(/(.*?)<\/font>/gi, "$1"); - rep(//gi, "[img]$1[/img]"); - rep(/(.*?)<\/span>/gi, "[code]$1[/code]"); - rep(/(.*?)<\/span>/gi, "[quote]$1[/quote]"); - rep(/(.*?)<\/strong>/gi, "[code][b]$1[/b][/code]"); - rep(/(.*?)<\/strong>/gi, "[quote][b]$1[/b][/quote]"); - rep(/(.*?)<\/em>/gi, "[code][i]$1[/i][/code]"); - rep(/(.*?)<\/em>/gi, "[quote][i]$1[/i][/quote]"); - rep(/(.*?)<\/u>/gi, "[code][u]$1[/u][/code]"); - rep(/(.*?)<\/u>/gi, "[quote][u]$1[/u][/quote]"); - rep(/<\/(strong|b)>/gi, "[/b]"); - rep(/<(strong|b)>/gi, "[b]"); - rep(/<\/(em|i)>/gi, "[/i]"); - rep(/<(em|i)>/gi, "[i]"); - rep(/<\/u>/gi, "[/u]"); - rep(/(.*?)<\/span>/gi, "[u]$1[/u]"); - rep(//gi, "[u]"); - rep(/]*>/gi, "[quote]"); - rep(/<\/blockquote>/gi, "[/quote]"); - rep(/
/gi, "\n"); - rep(//gi, "\n"); - rep(/
/gi, "\n"); - rep(/

/gi, ""); - rep(/<\/p>/gi, "\n"); - rep(/ |\u00a0/gi, " "); - rep(/"/gi, "\""); - rep(/</gi, "<"); - rep(/>/gi, ">"); - rep(/&/gi, "&"); - - return s; + var html2bbcode = function (s) { + s = Tools.trim(s); + var rep = function (re, str) { + s = s.replace(re, str); }; - - var bbcode2html = function (s) { - s = Tools.trim(s); - - var rep = function (re, str) { - s = s.replace(re, str); - }; - - // example: [b] to - rep(/\n/gi, "
"); - rep(/\[b\]/gi, ""); - rep(/\[\/b\]/gi, ""); - rep(/\[i\]/gi, ""); - rep(/\[\/i\]/gi, ""); - rep(/\[u\]/gi, ""); - rep(/\[\/u\]/gi, ""); - rep(/\[url=([^\]]+)\](.*?)\[\/url\]/gi, "$2"); - rep(/\[url\](.*?)\[\/url\]/gi, "$1"); - rep(/\[img\](.*?)\[\/img\]/gi, ""); - rep(/\[color=(.*?)\](.*?)\[\/color\]/gi, "$2"); - rep(/\[code\](.*?)\[\/code\]/gi, "$1 "); - rep(/\[quote.*?\](.*?)\[\/quote\]/gi, "$1 "); - - return s; + rep(/(.*?)<\/a>/gi, '[url=$1]$2[/url]'); + rep(/(.*?)<\/font>/gi, '[code][color=$1]$2[/color][/code]'); + rep(/(.*?)<\/font>/gi, '[quote][color=$1]$2[/color][/quote]'); + rep(/(.*?)<\/font>/gi, '[code][color=$1]$2[/color][/code]'); + rep(/(.*?)<\/font>/gi, '[quote][color=$1]$2[/color][/quote]'); + rep(/(.*?)<\/span>/gi, '[color=$1]$2[/color]'); + rep(/(.*?)<\/font>/gi, '[color=$1]$2[/color]'); + rep(/(.*?)<\/span>/gi, '[size=$1]$2[/size]'); + rep(/(.*?)<\/font>/gi, '$1'); + rep(//gi, '[img]$1[/img]'); + rep(/(.*?)<\/span>/gi, '[code]$1[/code]'); + rep(/(.*?)<\/span>/gi, '[quote]$1[/quote]'); + rep(/(.*?)<\/strong>/gi, '[code][b]$1[/b][/code]'); + rep(/(.*?)<\/strong>/gi, '[quote][b]$1[/b][/quote]'); + rep(/(.*?)<\/em>/gi, '[code][i]$1[/i][/code]'); + rep(/(.*?)<\/em>/gi, '[quote][i]$1[/i][/quote]'); + rep(/(.*?)<\/u>/gi, '[code][u]$1[/u][/code]'); + rep(/(.*?)<\/u>/gi, '[quote][u]$1[/u][/quote]'); + rep(/<\/(strong|b)>/gi, '[/b]'); + rep(/<(strong|b)>/gi, '[b]'); + rep(/<\/(em|i)>/gi, '[/i]'); + rep(/<(em|i)>/gi, '[i]'); + rep(/<\/u>/gi, '[/u]'); + rep(/(.*?)<\/span>/gi, '[u]$1[/u]'); + rep(//gi, '[u]'); + rep(/]*>/gi, '[quote]'); + rep(/<\/blockquote>/gi, '[/quote]'); + rep(/
/gi, '\n'); + rep(//gi, '\n'); + rep(/
/gi, '\n'); + rep(/

/gi, ''); + rep(/<\/p>/gi, '\n'); + rep(/ |\u00a0/gi, ' '); + rep(/"/gi, '"'); + rep(/</gi, '<'); + rep(/>/gi, '>'); + rep(/&/gi, '&'); + return s; + }; + var bbcode2html = function (s) { + s = Tools.trim(s); + var rep = function (re, str) { + s = s.replace(re, str); }; + rep(/\n/gi, '
'); + rep(/\[b\]/gi, ''); + rep(/\[\/b\]/gi, ''); + rep(/\[i\]/gi, ''); + rep(/\[\/i\]/gi, ''); + rep(/\[u\]/gi, ''); + rep(/\[\/u\]/gi, ''); + rep(/\[url=([^\]]+)\](.*?)\[\/url\]/gi, '$2'); + rep(/\[url\](.*?)\[\/url\]/gi, '$1'); + rep(/\[img\](.*?)\[\/img\]/gi, ''); + rep(/\[color=(.*?)\](.*?)\[\/color\]/gi, '$2'); + rep(/\[code\](.*?)\[\/code\]/gi, '$1 '); + rep(/\[quote.*?\](.*?)\[\/quote\]/gi, '$1 '); + return s; + }; + var $_4w7kam8sje5nvbiv = { + html2bbcode: html2bbcode, + bbcode2html: bbcode2html + }; + PluginManager.add('bbcode', function () { return { - html2bbcode: html2bbcode, - bbcode2html: bbcode2html + init: function (editor) { + editor.on('beforeSetContent', function (e) { + e.content = $_4w7kam8sje5nvbiv.bbcode2html(e.content); + }); + editor.on('postProcess', function (e) { + if (e.set) { + e.content = $_4w7kam8sje5nvbiv.bbcode2html(e.content); + } + if (e.get) { + e.content = $_4w7kam8sje5nvbiv.html2bbcode(e.content); + } + }); + } }; + }); + function Plugin () { } -); -/** - * Plugin.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ -define( - 'tinymce.plugins.bbcode.Plugin', - [ - 'tinymce.core.PluginManager', - 'tinymce.plugins.bbcode.core.Convert' - ], - function (PluginManager, Convert) { - PluginManager.add('bbcode', function () { - return { - init: function (editor) { - editor.on('beforeSetContent', function (e) { - e.content = Convert.bbcode2html(e.content); - }); + return Plugin; - editor.on('postProcess', function (e) { - if (e.set) { - e.content = Convert.bbcode2html(e.content); - } - - if (e.get) { - e.content = Convert.html2bbcode(e.content); - } - }); - } - }; - }); - - return function () { }; - } -); -dem('tinymce.plugins.bbcode.Plugin')(); +}()); })(); diff --git a/tinymce_4/static/tinymce_4/tinymce/plugins/bbcode/plugin.min.js b/tinymce_4/static/tinymce_4/tinymce/plugins/bbcode/plugin.min.js index 4f60d15..1589274 100644 --- a/tinymce_4/static/tinymce_4/tinymce/plugins/bbcode/plugin.min.js +++ b/tinymce_4/static/tinymce_4/tinymce/plugins/bbcode/plugin.min.js @@ -1 +1 @@ -!function(){var a={},b=function(b){for(var c=a[b],e=c.deps,f=c.defn,g=e.length,h=new Array(g),i=0;i(.*?)<\/a>/gi,"[url=$1]$2[/url]"),c(/(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]"),c(/(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]"),c(/(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]"),c(/(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]"),c(/(.*?)<\/span>/gi,"[color=$1]$2[/color]"),c(/(.*?)<\/font>/gi,"[color=$1]$2[/color]"),c(/(.*?)<\/span>/gi,"[size=$1]$2[/size]"),c(/(.*?)<\/font>/gi,"$1"),c(//gi,"[img]$1[/img]"),c(/(.*?)<\/span>/gi,"[code]$1[/code]"),c(/(.*?)<\/span>/gi,"[quote]$1[/quote]"),c(/(.*?)<\/strong>/gi,"[code][b]$1[/b][/code]"),c(/(.*?)<\/strong>/gi,"[quote][b]$1[/b][/quote]"),c(/(.*?)<\/em>/gi,"[code][i]$1[/i][/code]"),c(/(.*?)<\/em>/gi,"[quote][i]$1[/i][/quote]"),c(/(.*?)<\/u>/gi,"[code][u]$1[/u][/code]"),c(/(.*?)<\/u>/gi,"[quote][u]$1[/u][/quote]"),c(/<\/(strong|b)>/gi,"[/b]"),c(/<(strong|b)>/gi,"[b]"),c(/<\/(em|i)>/gi,"[/i]"),c(/<(em|i)>/gi,"[i]"),c(/<\/u>/gi,"[/u]"),c(/(.*?)<\/span>/gi,"[u]$1[/u]"),c(//gi,"[u]"),c(/]*>/gi,"[quote]"),c(/<\/blockquote>/gi,"[/quote]"),c(/
/gi,"\n"),c(//gi,"\n"),c(/
/gi,"\n"),c(/

/gi,""),c(/<\/p>/gi,"\n"),c(/ |\u00a0/gi," "),c(/"/gi,'"'),c(/</gi,"<"),c(/>/gi,">"),c(/&/gi,"&"),b},c=function(b){b=a.trim(b);var c=function(a,c){b=b.replace(a,c)};return c(/\n/gi,"
"),c(/\[b\]/gi,""),c(/\[\/b\]/gi,""),c(/\[i\]/gi,""),c(/\[\/i\]/gi,""),c(/\[u\]/gi,""),c(/\[\/u\]/gi,""),c(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,'$2'),c(/\[url\](.*?)\[\/url\]/gi,'$1'),c(/\[img\](.*?)\[\/img\]/gi,''),c(/\[color=(.*?)\](.*?)\[\/color\]/gi,'$2'),c(/\[code\](.*?)\[\/code\]/gi,'$1 '),c(/\[quote.*?\](.*?)\[\/quote\]/gi,'$1 '),b};return{html2bbcode:b,bbcode2html:c}}),g("0",["1","2"],function(a,b){return a.add("bbcode",function(){return{init:function(a){a.on("beforeSetContent",function(a){a.content=b.bbcode2html(a.content)}),a.on("postProcess",function(a){a.set&&(a.content=b.bbcode2html(a.content)),a.get&&(a.content=b.html2bbcode(a.content))})}}}),function(){}}),d("0")()}(); \ No newline at end of file +!function(){"use strict";var o=tinymce.util.Tools.resolve("tinymce.PluginManager"),t=tinymce.util.Tools.resolve("tinymce.util.Tools"),e=function(o){o=t.trim(o);var e=function(t,e){o=o.replace(t,e)};return e(/(.*?)<\/a>/gi,"[url=$1]$2[/url]"),e(/(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]"),e(/(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]"),e(/(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]"),e(/(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]"),e(/(.*?)<\/span>/gi,"[color=$1]$2[/color]"),e(/(.*?)<\/font>/gi,"[color=$1]$2[/color]"),e(/(.*?)<\/span>/gi,"[size=$1]$2[/size]"),e(/(.*?)<\/font>/gi,"$1"),e(//gi,"[img]$1[/img]"),e(/(.*?)<\/span>/gi,"[code]$1[/code]"),e(/(.*?)<\/span>/gi,"[quote]$1[/quote]"),e(/(.*?)<\/strong>/gi,"[code][b]$1[/b][/code]"),e(/(.*?)<\/strong>/gi,"[quote][b]$1[/b][/quote]"),e(/(.*?)<\/em>/gi,"[code][i]$1[/i][/code]"),e(/(.*?)<\/em>/gi,"[quote][i]$1[/i][/quote]"),e(/(.*?)<\/u>/gi,"[code][u]$1[/u][/code]"),e(/(.*?)<\/u>/gi,"[quote][u]$1[/u][/quote]"),e(/<\/(strong|b)>/gi,"[/b]"),e(/<(strong|b)>/gi,"[b]"),e(/<\/(em|i)>/gi,"[/i]"),e(/<(em|i)>/gi,"[i]"),e(/<\/u>/gi,"[/u]"),e(/(.*?)<\/span>/gi,"[u]$1[/u]"),e(//gi,"[u]"),e(/]*>/gi,"[quote]"),e(/<\/blockquote>/gi,"[/quote]"),e(/
/gi,"\n"),e(//gi,"\n"),e(/
/gi,"\n"),e(/

/gi,""),e(/<\/p>/gi,"\n"),e(/ |\u00a0/gi," "),e(/"/gi,'"'),e(/</gi,"<"),e(/>/gi,">"),e(/&/gi,"&"),o},i=function(o){o=t.trim(o);var e=function(t,e){o=o.replace(t,e)};return e(/\n/gi,"
"),e(/\[b\]/gi,""),e(/\[\/b\]/gi,""),e(/\[i\]/gi,""),e(/\[\/i\]/gi,""),e(/\[u\]/gi,""),e(/\[\/u\]/gi,""),e(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,'$2'),e(/\[url\](.*?)\[\/url\]/gi,'$1'),e(/\[img\](.*?)\[\/img\]/gi,''),e(/\[color=(.*?)\](.*?)\[\/color\]/gi,'$2'),e(/\[code\](.*?)\[\/code\]/gi,'$1 '),e(/\[quote.*?\](.*?)\[\/quote\]/gi,'$1 '),o};o.add("bbcode",function(){return{init:function(o){o.on("beforeSetContent",function(o){o.content=i(o.content)}),o.on("postProcess",function(o){o.set&&(o.content=i(o.content)),o.get&&(o.content=e(o.content))})}}})}(); \ No newline at end of file diff --git a/tinymce_4/static/tinymce_4/tinymce/plugins/charmap/plugin.js b/tinymce_4/static/tinymce_4/tinymce/plugins/charmap/plugin.js index facdb72..0cfac59 100644 --- a/tinymce_4/static/tinymce_4/tinymce/plugins/charmap/plugin.js +++ b/tinymce_4/static/tinymce_4/tinymce/plugins/charmap/plugin.js @@ -1,844 +1,1275 @@ (function () { +var charmap = (function () { + 'use strict'; -var defs = {}; // id -> {dependencies, definition, instance (possibly undefined)} + var PluginManager = tinymce.util.Tools.resolve('tinymce.PluginManager'); -// Used when there is no 'main' module. -// The name is probably (hopefully) unique so minification removes for releases. -var register_3795 = function (id) { - var module = dem(id); - var fragments = id.split('.'); - var target = Function('return this;')(); - for (var i = 0; i < fragments.length - 1; ++i) { - if (target[fragments[i]] === undefined) - target[fragments[i]] = {}; - target = target[fragments[i]]; - } - target[fragments[fragments.length - 1]] = module; -}; - -var instantiate = function (id) { - var actual = defs[id]; - var dependencies = actual.deps; - var definition = actual.defn; - var len = dependencies.length; - var instances = new Array(len); - for (var i = 0; i < len; ++i) - instances[i] = dem(dependencies[i]); - var defResult = definition.apply(null, instances); - if (defResult === undefined) - throw 'module [' + id + '] returned undefined'; - actual.instance = defResult; -}; - -var def = function (id, dependencies, definition) { - if (typeof id !== 'string') - throw 'module id must be a string'; - else if (dependencies === undefined) - throw 'no dependencies for ' + id; - else if (definition === undefined) - throw 'no definition function for ' + id; - defs[id] = { - deps: dependencies, - defn: definition, - instance: undefined + var fireInsertCustomChar = function (editor, chr) { + return editor.fire('insertCustomChar', { chr: chr }); }; -}; + var $_312mdu8yje5nvbjb = { fireInsertCustomChar: fireInsertCustomChar }; -var dem = function (id) { - var actual = defs[id]; - if (actual === undefined) - throw 'module [' + id + '] was undefined'; - else if (actual.instance === undefined) - instantiate(id); - return actual.instance; -}; + var insertChar = function (editor, chr) { + var evtChr = $_312mdu8yje5nvbjb.fireInsertCustomChar(editor, chr).chr; + editor.execCommand('mceInsertContent', false, evtChr); + }; + var $_7z9qb78xje5nvbja = { insertChar: insertChar }; -var req = function (ids, callback) { - var len = ids.length; - var instances = new Array(len); - for (var i = 0; i < len; ++i) - instances[i] = dem(ids[i]); - callback.apply(null, instances); -}; + var Tools = tinymce.util.Tools.resolve('tinymce.util.Tools'); -var ephox = {}; + var getCharMap = function (editor) { + return editor.settings.charmap; + }; + var getCharMapAppend = function (editor) { + return editor.settings.charmap_append; + }; + var $_1ypcuy91je5nvbji = { + getCharMap: getCharMap, + getCharMapAppend: getCharMapAppend + }; -ephox.bolt = { - module: { - api: { - define: def, - require: req, - demand: dem + var isArray = Tools.isArray; + var getDefaultCharMap = function () { + return [ + [ + '160', + 'no-break space' + ], + [ + '173', + 'soft hyphen' + ], + [ + '34', + 'quotation mark' + ], + [ + '162', + 'cent sign' + ], + [ + '8364', + 'euro sign' + ], + [ + '163', + 'pound sign' + ], + [ + '165', + 'yen sign' + ], + [ + '169', + 'copyright sign' + ], + [ + '174', + 'registered sign' + ], + [ + '8482', + 'trade mark sign' + ], + [ + '8240', + 'per mille sign' + ], + [ + '181', + 'micro sign' + ], + [ + '183', + 'middle dot' + ], + [ + '8226', + 'bullet' + ], + [ + '8230', + 'three dot leader' + ], + [ + '8242', + 'minutes / feet' + ], + [ + '8243', + 'seconds / inches' + ], + [ + '167', + 'section sign' + ], + [ + '182', + 'paragraph sign' + ], + [ + '223', + 'sharp s / ess-zed' + ], + [ + '8249', + 'single left-pointing angle quotation mark' + ], + [ + '8250', + 'single right-pointing angle quotation mark' + ], + [ + '171', + 'left pointing guillemet' + ], + [ + '187', + 'right pointing guillemet' + ], + [ + '8216', + 'left single quotation mark' + ], + [ + '8217', + 'right single quotation mark' + ], + [ + '8220', + 'left double quotation mark' + ], + [ + '8221', + 'right double quotation mark' + ], + [ + '8218', + 'single low-9 quotation mark' + ], + [ + '8222', + 'double low-9 quotation mark' + ], + [ + '60', + 'less-than sign' + ], + [ + '62', + 'greater-than sign' + ], + [ + '8804', + 'less-than or equal to' + ], + [ + '8805', + 'greater-than or equal to' + ], + [ + '8211', + 'en dash' + ], + [ + '8212', + 'em dash' + ], + [ + '175', + 'macron' + ], + [ + '8254', + 'overline' + ], + [ + '164', + 'currency sign' + ], + [ + '166', + 'broken bar' + ], + [ + '168', + 'diaeresis' + ], + [ + '161', + 'inverted exclamation mark' + ], + [ + '191', + 'turned question mark' + ], + [ + '710', + 'circumflex accent' + ], + [ + '732', + 'small tilde' + ], + [ + '176', + 'degree sign' + ], + [ + '8722', + 'minus sign' + ], + [ + '177', + 'plus-minus sign' + ], + [ + '247', + 'division sign' + ], + [ + '8260', + 'fraction slash' + ], + [ + '215', + 'multiplication sign' + ], + [ + '185', + 'superscript one' + ], + [ + '178', + 'superscript two' + ], + [ + '179', + 'superscript three' + ], + [ + '188', + 'fraction one quarter' + ], + [ + '189', + 'fraction one half' + ], + [ + '190', + 'fraction three quarters' + ], + [ + '402', + 'function / florin' + ], + [ + '8747', + 'integral' + ], + [ + '8721', + 'n-ary sumation' + ], + [ + '8734', + 'infinity' + ], + [ + '8730', + 'square root' + ], + [ + '8764', + 'similar to' + ], + [ + '8773', + 'approximately equal to' + ], + [ + '8776', + 'almost equal to' + ], + [ + '8800', + 'not equal to' + ], + [ + '8801', + 'identical to' + ], + [ + '8712', + 'element of' + ], + [ + '8713', + 'not an element of' + ], + [ + '8715', + 'contains as member' + ], + [ + '8719', + 'n-ary product' + ], + [ + '8743', + 'logical and' + ], + [ + '8744', + 'logical or' + ], + [ + '172', + 'not sign' + ], + [ + '8745', + 'intersection' + ], + [ + '8746', + 'union' + ], + [ + '8706', + 'partial differential' + ], + [ + '8704', + 'for all' + ], + [ + '8707', + 'there exists' + ], + [ + '8709', + 'diameter' + ], + [ + '8711', + 'backward difference' + ], + [ + '8727', + 'asterisk operator' + ], + [ + '8733', + 'proportional to' + ], + [ + '8736', + 'angle' + ], + [ + '180', + 'acute accent' + ], + [ + '184', + 'cedilla' + ], + [ + '170', + 'feminine ordinal indicator' + ], + [ + '186', + 'masculine ordinal indicator' + ], + [ + '8224', + 'dagger' + ], + [ + '8225', + 'double dagger' + ], + [ + '192', + 'A - grave' + ], + [ + '193', + 'A - acute' + ], + [ + '194', + 'A - circumflex' + ], + [ + '195', + 'A - tilde' + ], + [ + '196', + 'A - diaeresis' + ], + [ + '197', + 'A - ring above' + ], + [ + '256', + 'A - macron' + ], + [ + '198', + 'ligature AE' + ], + [ + '199', + 'C - cedilla' + ], + [ + '200', + 'E - grave' + ], + [ + '201', + 'E - acute' + ], + [ + '202', + 'E - circumflex' + ], + [ + '203', + 'E - diaeresis' + ], + [ + '274', + 'E - macron' + ], + [ + '204', + 'I - grave' + ], + [ + '205', + 'I - acute' + ], + [ + '206', + 'I - circumflex' + ], + [ + '207', + 'I - diaeresis' + ], + [ + '298', + 'I - macron' + ], + [ + '208', + 'ETH' + ], + [ + '209', + 'N - tilde' + ], + [ + '210', + 'O - grave' + ], + [ + '211', + 'O - acute' + ], + [ + '212', + 'O - circumflex' + ], + [ + '213', + 'O - tilde' + ], + [ + '214', + 'O - diaeresis' + ], + [ + '216', + 'O - slash' + ], + [ + '332', + 'O - macron' + ], + [ + '338', + 'ligature OE' + ], + [ + '352', + 'S - caron' + ], + [ + '217', + 'U - grave' + ], + [ + '218', + 'U - acute' + ], + [ + '219', + 'U - circumflex' + ], + [ + '220', + 'U - diaeresis' + ], + [ + '362', + 'U - macron' + ], + [ + '221', + 'Y - acute' + ], + [ + '376', + 'Y - diaeresis' + ], + [ + '562', + 'Y - macron' + ], + [ + '222', + 'THORN' + ], + [ + '224', + 'a - grave' + ], + [ + '225', + 'a - acute' + ], + [ + '226', + 'a - circumflex' + ], + [ + '227', + 'a - tilde' + ], + [ + '228', + 'a - diaeresis' + ], + [ + '229', + 'a - ring above' + ], + [ + '257', + 'a - macron' + ], + [ + '230', + 'ligature ae' + ], + [ + '231', + 'c - cedilla' + ], + [ + '232', + 'e - grave' + ], + [ + '233', + 'e - acute' + ], + [ + '234', + 'e - circumflex' + ], + [ + '235', + 'e - diaeresis' + ], + [ + '275', + 'e - macron' + ], + [ + '236', + 'i - grave' + ], + [ + '237', + 'i - acute' + ], + [ + '238', + 'i - circumflex' + ], + [ + '239', + 'i - diaeresis' + ], + [ + '299', + 'i - macron' + ], + [ + '240', + 'eth' + ], + [ + '241', + 'n - tilde' + ], + [ + '242', + 'o - grave' + ], + [ + '243', + 'o - acute' + ], + [ + '244', + 'o - circumflex' + ], + [ + '245', + 'o - tilde' + ], + [ + '246', + 'o - diaeresis' + ], + [ + '248', + 'o slash' + ], + [ + '333', + 'o macron' + ], + [ + '339', + 'ligature oe' + ], + [ + '353', + 's - caron' + ], + [ + '249', + 'u - grave' + ], + [ + '250', + 'u - acute' + ], + [ + '251', + 'u - circumflex' + ], + [ + '252', + 'u - diaeresis' + ], + [ + '363', + 'u - macron' + ], + [ + '253', + 'y - acute' + ], + [ + '254', + 'thorn' + ], + [ + '255', + 'y - diaeresis' + ], + [ + '563', + 'y - macron' + ], + [ + '913', + 'Alpha' + ], + [ + '914', + 'Beta' + ], + [ + '915', + 'Gamma' + ], + [ + '916', + 'Delta' + ], + [ + '917', + 'Epsilon' + ], + [ + '918', + 'Zeta' + ], + [ + '919', + 'Eta' + ], + [ + '920', + 'Theta' + ], + [ + '921', + 'Iota' + ], + [ + '922', + 'Kappa' + ], + [ + '923', + 'Lambda' + ], + [ + '924', + 'Mu' + ], + [ + '925', + 'Nu' + ], + [ + '926', + 'Xi' + ], + [ + '927', + 'Omicron' + ], + [ + '928', + 'Pi' + ], + [ + '929', + 'Rho' + ], + [ + '931', + 'Sigma' + ], + [ + '932', + 'Tau' + ], + [ + '933', + 'Upsilon' + ], + [ + '934', + 'Phi' + ], + [ + '935', + 'Chi' + ], + [ + '936', + 'Psi' + ], + [ + '937', + 'Omega' + ], + [ + '945', + 'alpha' + ], + [ + '946', + 'beta' + ], + [ + '947', + 'gamma' + ], + [ + '948', + 'delta' + ], + [ + '949', + 'epsilon' + ], + [ + '950', + 'zeta' + ], + [ + '951', + 'eta' + ], + [ + '952', + 'theta' + ], + [ + '953', + 'iota' + ], + [ + '954', + 'kappa' + ], + [ + '955', + 'lambda' + ], + [ + '956', + 'mu' + ], + [ + '957', + 'nu' + ], + [ + '958', + 'xi' + ], + [ + '959', + 'omicron' + ], + [ + '960', + 'pi' + ], + [ + '961', + 'rho' + ], + [ + '962', + 'final sigma' + ], + [ + '963', + 'sigma' + ], + [ + '964', + 'tau' + ], + [ + '965', + 'upsilon' + ], + [ + '966', + 'phi' + ], + [ + '967', + 'chi' + ], + [ + '968', + 'psi' + ], + [ + '969', + 'omega' + ], + [ + '8501', + 'alef symbol' + ], + [ + '982', + 'pi symbol' + ], + [ + '8476', + 'real part symbol' + ], + [ + '978', + 'upsilon - hook symbol' + ], + [ + '8472', + 'Weierstrass p' + ], + [ + '8465', + 'imaginary part' + ], + [ + '8592', + 'leftwards arrow' + ], + [ + '8593', + 'upwards arrow' + ], + [ + '8594', + 'rightwards arrow' + ], + [ + '8595', + 'downwards arrow' + ], + [ + '8596', + 'left right arrow' + ], + [ + '8629', + 'carriage return' + ], + [ + '8656', + 'leftwards double arrow' + ], + [ + '8657', + 'upwards double arrow' + ], + [ + '8658', + 'rightwards double arrow' + ], + [ + '8659', + 'downwards double arrow' + ], + [ + '8660', + 'left right double arrow' + ], + [ + '8756', + 'therefore' + ], + [ + '8834', + 'subset of' + ], + [ + '8835', + 'superset of' + ], + [ + '8836', + 'not a subset of' + ], + [ + '8838', + 'subset of or equal to' + ], + [ + '8839', + 'superset of or equal to' + ], + [ + '8853', + 'circled plus' + ], + [ + '8855', + 'circled times' + ], + [ + '8869', + 'perpendicular' + ], + [ + '8901', + 'dot operator' + ], + [ + '8968', + 'left ceiling' + ], + [ + '8969', + 'right ceiling' + ], + [ + '8970', + 'left floor' + ], + [ + '8971', + 'right floor' + ], + [ + '9001', + 'left-pointing angle bracket' + ], + [ + '9002', + 'right-pointing angle bracket' + ], + [ + '9674', + 'lozenge' + ], + [ + '9824', + 'black spade suit' + ], + [ + '9827', + 'black club suit' + ], + [ + '9829', + 'black heart suit' + ], + [ + '9830', + 'black diamond suit' + ], + [ + '8194', + 'en space' + ], + [ + '8195', + 'em space' + ], + [ + '8201', + 'thin space' + ], + [ + '8204', + 'zero width non-joiner' + ], + [ + '8205', + 'zero width joiner' + ], + [ + '8206', + 'left-to-right mark' + ], + [ + '8207', + 'right-to-left mark' + ] + ]; + }; + var charmapFilter = function (charmap) { + return Tools.grep(charmap, function (item) { + return isArray(item) && item.length === 2; + }); + }; + var getCharsFromSetting = function (settingValue) { + if (isArray(settingValue)) { + return [].concat(charmapFilter(settingValue)); } - } -}; - -var define = def; -var require = req; -var demand = dem; -// this helps with minification when using a lot of global references -var defineGlobal = function (id, ref) { - define(id, [], function () { return ref; }); -}; -/*jsc -["tinymce.plugins.charmap.Plugin","tinymce.core.PluginManager","tinymce.plugins.charmap.api.Api","tinymce.plugins.charmap.api.Commands","tinymce.plugins.charmap.ui.Buttons","global!tinymce.util.Tools.resolve","tinymce.plugins.charmap.core.Actions","tinymce.plugins.charmap.core.CharMap","tinymce.plugins.charmap.ui.Dialog","tinymce.plugins.charmap.api.Events","tinymce.core.util.Tools","tinymce.plugins.charmap.api.Settings","tinymce.plugins.charmap.ui.GridHtml"] -jsc*/ -defineGlobal("global!tinymce.util.Tools.resolve", tinymce.util.Tools.resolve); -/** - * ResolveGlobal.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.core.PluginManager', - [ - 'global!tinymce.util.Tools.resolve' - ], - function (resolve) { - return resolve('tinymce.PluginManager'); - } -); - -/** - * Events.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.charmap.api.Events', - [ - ], - function () { - var fireInsertCustomChar = function (editor, chr) { - return editor.fire('insertCustomChar', { chr: chr }); - }; - - return { - fireInsertCustomChar: fireInsertCustomChar - }; - } -); - -/** - * Actions.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.charmap.core.Actions', - [ - 'tinymce.plugins.charmap.api.Events' - ], - function (Events) { - var insertChar = function (editor, chr) { - var evtChr = Events.fireInsertCustomChar(editor, chr).chr; - editor.execCommand('mceInsertContent', false, evtChr); - }; - - return { - insertChar: insertChar - }; - } -); -/** - * ResolveGlobal.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.core.util.Tools', - [ - 'global!tinymce.util.Tools.resolve' - ], - function (resolve) { - return resolve('tinymce.util.Tools'); - } -); - -/** - * Settings.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ + if (typeof settingValue === 'function') { + return settingValue(); + } + return []; + }; + var extendCharMap = function (editor, charmap) { + var userCharMap = $_1ypcuy91je5nvbji.getCharMap(editor); + if (userCharMap) { + charmap = getCharsFromSetting(userCharMap); + } + var userCharMapAppend = $_1ypcuy91je5nvbji.getCharMapAppend(editor); + if (userCharMapAppend) { + return [].concat(charmap).concat(getCharsFromSetting(userCharMapAppend)); + } + return charmap; + }; + var getCharMap$1 = function (editor) { + return extendCharMap(editor, getDefaultCharMap()); + }; + var $_7llp4e8zje5nvbjc = { getCharMap: getCharMap$1 }; -define( - 'tinymce.plugins.charmap.api.Settings', - [ - ], - function () { - var getCharMap = function (editor) { - return editor.settings.charmap; + var get = function (editor) { + var getCharMap = function () { + return $_7llp4e8zje5nvbjc.getCharMap(editor); }; - - var getCharMapAppend = function (editor) { - return editor.settings.charmap_append; + var insertChar = function (chr) { + $_7z9qb78xje5nvbja.insertChar(editor, chr); }; - return { getCharMap: getCharMap, - getCharMapAppend: getCharMapAppend - }; - } -); -/** - * CharMap.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.charmap.core.CharMap', - [ - 'tinymce.core.util.Tools', - 'tinymce.plugins.charmap.api.Settings' - ], - function (Tools, Settings) { - var isArray = Tools.isArray; - - var getDefaultCharMap = function () { - return [ - ['160', 'no-break space'], - ['173', 'soft hyphen'], - ['34', 'quotation mark'], - // finance - ['162', 'cent sign'], - ['8364', 'euro sign'], - ['163', 'pound sign'], - ['165', 'yen sign'], - // signs - ['169', 'copyright sign'], - ['174', 'registered sign'], - ['8482', 'trade mark sign'], - ['8240', 'per mille sign'], - ['181', 'micro sign'], - ['183', 'middle dot'], - ['8226', 'bullet'], - ['8230', 'three dot leader'], - ['8242', 'minutes / feet'], - ['8243', 'seconds / inches'], - ['167', 'section sign'], - ['182', 'paragraph sign'], - ['223', 'sharp s / ess-zed'], - // quotations - ['8249', 'single left-pointing angle quotation mark'], - ['8250', 'single right-pointing angle quotation mark'], - ['171', 'left pointing guillemet'], - ['187', 'right pointing guillemet'], - ['8216', 'left single quotation mark'], - ['8217', 'right single quotation mark'], - ['8220', 'left double quotation mark'], - ['8221', 'right double quotation mark'], - ['8218', 'single low-9 quotation mark'], - ['8222', 'double low-9 quotation mark'], - ['60', 'less-than sign'], - ['62', 'greater-than sign'], - ['8804', 'less-than or equal to'], - ['8805', 'greater-than or equal to'], - ['8211', 'en dash'], - ['8212', 'em dash'], - ['175', 'macron'], - ['8254', 'overline'], - ['164', 'currency sign'], - ['166', 'broken bar'], - ['168', 'diaeresis'], - ['161', 'inverted exclamation mark'], - ['191', 'turned question mark'], - ['710', 'circumflex accent'], - ['732', 'small tilde'], - ['176', 'degree sign'], - ['8722', 'minus sign'], - ['177', 'plus-minus sign'], - ['247', 'division sign'], - ['8260', 'fraction slash'], - ['215', 'multiplication sign'], - ['185', 'superscript one'], - ['178', 'superscript two'], - ['179', 'superscript three'], - ['188', 'fraction one quarter'], - ['189', 'fraction one half'], - ['190', 'fraction three quarters'], - // math / logical - ['402', 'function / florin'], - ['8747', 'integral'], - ['8721', 'n-ary sumation'], - ['8734', 'infinity'], - ['8730', 'square root'], - ['8764', 'similar to'], - ['8773', 'approximately equal to'], - ['8776', 'almost equal to'], - ['8800', 'not equal to'], - ['8801', 'identical to'], - ['8712', 'element of'], - ['8713', 'not an element of'], - ['8715', 'contains as member'], - ['8719', 'n-ary product'], - ['8743', 'logical and'], - ['8744', 'logical or'], - ['172', 'not sign'], - ['8745', 'intersection'], - ['8746', 'union'], - ['8706', 'partial differential'], - ['8704', 'for all'], - ['8707', 'there exists'], - ['8709', 'diameter'], - ['8711', 'backward difference'], - ['8727', 'asterisk operator'], - ['8733', 'proportional to'], - ['8736', 'angle'], - // undefined - ['180', 'acute accent'], - ['184', 'cedilla'], - ['170', 'feminine ordinal indicator'], - ['186', 'masculine ordinal indicator'], - ['8224', 'dagger'], - ['8225', 'double dagger'], - // alphabetical special chars - ['192', 'A - grave'], - ['193', 'A - acute'], - ['194', 'A - circumflex'], - ['195', 'A - tilde'], - ['196', 'A - diaeresis'], - ['197', 'A - ring above'], - ['256', 'A - macron'], - ['198', 'ligature AE'], - ['199', 'C - cedilla'], - ['200', 'E - grave'], - ['201', 'E - acute'], - ['202', 'E - circumflex'], - ['203', 'E - diaeresis'], - ['274', 'E - macron'], - ['204', 'I - grave'], - ['205', 'I - acute'], - ['206', 'I - circumflex'], - ['207', 'I - diaeresis'], - ['298', 'I - macron'], - ['208', 'ETH'], - ['209', 'N - tilde'], - ['210', 'O - grave'], - ['211', 'O - acute'], - ['212', 'O - circumflex'], - ['213', 'O - tilde'], - ['214', 'O - diaeresis'], - ['216', 'O - slash'], - ['332', 'O - macron'], - ['338', 'ligature OE'], - ['352', 'S - caron'], - ['217', 'U - grave'], - ['218', 'U - acute'], - ['219', 'U - circumflex'], - ['220', 'U - diaeresis'], - ['362', 'U - macron'], - ['221', 'Y - acute'], - ['376', 'Y - diaeresis'], - ['562', 'Y - macron'], - ['222', 'THORN'], - ['224', 'a - grave'], - ['225', 'a - acute'], - ['226', 'a - circumflex'], - ['227', 'a - tilde'], - ['228', 'a - diaeresis'], - ['229', 'a - ring above'], - ['257', 'a - macron'], - ['230', 'ligature ae'], - ['231', 'c - cedilla'], - ['232', 'e - grave'], - ['233', 'e - acute'], - ['234', 'e - circumflex'], - ['235', 'e - diaeresis'], - ['275', 'e - macron'], - ['236', 'i - grave'], - ['237', 'i - acute'], - ['238', 'i - circumflex'], - ['239', 'i - diaeresis'], - ['299', 'i - macron'], - ['240', 'eth'], - ['241', 'n - tilde'], - ['242', 'o - grave'], - ['243', 'o - acute'], - ['244', 'o - circumflex'], - ['245', 'o - tilde'], - ['246', 'o - diaeresis'], - ['248', 'o slash'], - ['333', 'o macron'], - ['339', 'ligature oe'], - ['353', 's - caron'], - ['249', 'u - grave'], - ['250', 'u - acute'], - ['251', 'u - circumflex'], - ['252', 'u - diaeresis'], - ['363', 'u - macron'], - ['253', 'y - acute'], - ['254', 'thorn'], - ['255', 'y - diaeresis'], - ['563', 'y - macron'], - ['913', 'Alpha'], - ['914', 'Beta'], - ['915', 'Gamma'], - ['916', 'Delta'], - ['917', 'Epsilon'], - ['918', 'Zeta'], - ['919', 'Eta'], - ['920', 'Theta'], - ['921', 'Iota'], - ['922', 'Kappa'], - ['923', 'Lambda'], - ['924', 'Mu'], - ['925', 'Nu'], - ['926', 'Xi'], - ['927', 'Omicron'], - ['928', 'Pi'], - ['929', 'Rho'], - ['931', 'Sigma'], - ['932', 'Tau'], - ['933', 'Upsilon'], - ['934', 'Phi'], - ['935', 'Chi'], - ['936', 'Psi'], - ['937', 'Omega'], - ['945', 'alpha'], - ['946', 'beta'], - ['947', 'gamma'], - ['948', 'delta'], - ['949', 'epsilon'], - ['950', 'zeta'], - ['951', 'eta'], - ['952', 'theta'], - ['953', 'iota'], - ['954', 'kappa'], - ['955', 'lambda'], - ['956', 'mu'], - ['957', 'nu'], - ['958', 'xi'], - ['959', 'omicron'], - ['960', 'pi'], - ['961', 'rho'], - ['962', 'final sigma'], - ['963', 'sigma'], - ['964', 'tau'], - ['965', 'upsilon'], - ['966', 'phi'], - ['967', 'chi'], - ['968', 'psi'], - ['969', 'omega'], - // symbols - ['8501', 'alef symbol'], - ['982', 'pi symbol'], - ['8476', 'real part symbol'], - ['978', 'upsilon - hook symbol'], - ['8472', 'Weierstrass p'], - ['8465', 'imaginary part'], - // arrows - ['8592', 'leftwards arrow'], - ['8593', 'upwards arrow'], - ['8594', 'rightwards arrow'], - ['8595', 'downwards arrow'], - ['8596', 'left right arrow'], - ['8629', 'carriage return'], - ['8656', 'leftwards double arrow'], - ['8657', 'upwards double arrow'], - ['8658', 'rightwards double arrow'], - ['8659', 'downwards double arrow'], - ['8660', 'left right double arrow'], - ['8756', 'therefore'], - ['8834', 'subset of'], - ['8835', 'superset of'], - ['8836', 'not a subset of'], - ['8838', 'subset of or equal to'], - ['8839', 'superset of or equal to'], - ['8853', 'circled plus'], - ['8855', 'circled times'], - ['8869', 'perpendicular'], - ['8901', 'dot operator'], - ['8968', 'left ceiling'], - ['8969', 'right ceiling'], - ['8970', 'left floor'], - ['8971', 'right floor'], - ['9001', 'left-pointing angle bracket'], - ['9002', 'right-pointing angle bracket'], - ['9674', 'lozenge'], - ['9824', 'black spade suit'], - ['9827', 'black club suit'], - ['9829', 'black heart suit'], - ['9830', 'black diamond suit'], - ['8194', 'en space'], - ['8195', 'em space'], - ['8201', 'thin space'], - ['8204', 'zero width non-joiner'], - ['8205', 'zero width joiner'], - ['8206', 'left-to-right mark'], - ['8207', 'right-to-left mark'] - ]; - }; - - var charmapFilter = function (charmap) { - return Tools.grep(charmap, function (item) { - return isArray(item) && item.length === 2; - }); - }; - - var getCharsFromSetting = function (settingValue) { - if (isArray(settingValue)) { - return [].concat(charmapFilter(settingValue)); - } - - if (typeof settingValue === "function") { - return settingValue(); - } - - return []; + insertChar: insertChar }; - - var extendCharMap = function (editor, charmap) { - var userCharMap = Settings.getCharMap(editor); - if (userCharMap) { - charmap = getCharsFromSetting(userCharMap); + }; + var $_6qsyee8wje5nvbj9 = { get: get }; + + var getHtml = function (charmap) { + var gridHtml, x, y; + var width = Math.min(charmap.length, 25); + var height = Math.ceil(charmap.length / width); + gridHtml = ''; + for (y = 0; y < height; y++) { + gridHtml += ''; + for (x = 0; x < width; x++) { + var index = y * width + x; + if (index < charmap.length) { + var chr = charmap[index]; + var charCode = parseInt(chr[0], 10); + var chrText = chr ? String.fromCharCode(charCode) : ' '; + gridHtml += ''; + } else { + gridHtml += ''; + } + gridHtml += ''; + return gridHtml; + }; + var $_9etl0k94je5nvbjr = { getHtml: getHtml }; - var userCharMapAppend = Settings.getCharMapAppend(editor); - if (userCharMapAppend) { - return [].concat(charmap).concat(getCharsFromSetting(userCharMapAppend)); + var getParentTd = function (elm) { + while (elm) { + if (elm.nodeName === 'TD') { + return elm; } - - return charmap; - }; - - var getCharMap = function (editor) { - return extendCharMap(editor, getDefaultCharMap()); - }; - - return { - getCharMap: getCharMap - }; - } -); -/** - * Api.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.charmap.api.Api', - [ - 'tinymce.plugins.charmap.core.Actions', - 'tinymce.plugins.charmap.core.CharMap' - ], - function (Actions, CharMap) { - var get = function (editor) { - var getCharMap = function () { - return CharMap.getCharMap(editor); - }; - - var insertChar = function (chr) { - Actions.insertChar(editor, chr); - }; - - return { - getCharMap: getCharMap, - insertChar: insertChar - }; - }; - - return { - get: get - }; - } -); - - -/** - * GridHtml.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.charmap.ui.GridHtml', - [ - ], - function () { - var getHtml = function (charmap) { - var gridHtml, x, y; - var width = Math.min(charmap.length, 25); - var height = Math.ceil(charmap.length / width); - - gridHtml = ''; - - for (y = 0; y < height; y++) { - gridHtml += ''; - - for (x = 0; x < width; x++) { - var index = y * width + x; - if (index < charmap.length) { - var chr = charmap[index]; - var chrText = chr ? String.fromCharCode(parseInt(chr[0], 10)) : ' '; - - gridHtml += ( - '' - ); - } else { - gridHtml += ''; - } - - gridHtml += ''; - - return gridHtml; - }; - - return { - getHtml: getHtml - }; - } -); -/** - * Dialog.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.charmap.ui.Dialog', - [ - 'tinymce.plugins.charmap.core.Actions', - 'tinymce.plugins.charmap.core.CharMap', - 'tinymce.plugins.charmap.ui.GridHtml' - ], - function (Actions, CharMap, GridHtml) { - var getParentTd = function (elm) { - while (elm) { - if (elm.nodeName === 'TD') { - return elm; + }, + onmouseover: function (e) { + var td = getParentTd(e.target); + if (td && td.firstChild) { + win.find('#preview').text(td.firstChild.firstChild.data); + win.find('#previewTitle').text(td.title); + } else { + win.find('#preview').text(' '); + win.find('#previewTitle').text(' '); } - - elm = elm.parentNode; } }; - - var open = function (editor) { - var win; - - var charMapPanel = { - type: 'container', - html: GridHtml.getHtml(CharMap.getCharMap(editor)), - onclick: function (e) { - var target = e.target; - - if (/^(TD|DIV)$/.test(target.nodeName)) { - var charDiv = getParentTd(target).firstChild; - if (charDiv && charDiv.hasAttribute('data-chr')) { - Actions.insertChar(editor, charDiv.getAttribute('data-chr')); - - if (!e.ctrlKey) { - win.close(); - } + win = editor.windowManager.open({ + title: 'Special character', + spacing: 10, + padding: 10, + items: [ + charMapPanel, + { + type: 'container', + layout: 'flex', + direction: 'column', + align: 'center', + spacing: 5, + minWidth: 160, + minHeight: 160, + items: [ + { + type: 'label', + name: 'preview', + text: ' ', + style: 'font-size: 40px; text-align: center', + border: 1, + minWidth: 140, + minHeight: 80 + }, + { + type: 'spacer', + minHeight: 20 + }, + { + type: 'label', + name: 'previewTitle', + text: ' ', + style: 'white-space: pre-wrap;', + border: 1, + minWidth: 140 } - } - }, - onmouseover: function (e) { - var td = getParentTd(e.target); - - if (td && td.firstChild) { - win.find('#preview').text(td.firstChild.firstChild.data); - win.find('#previewTitle').text(td.title); - } else { - win.find('#preview').text(' '); - win.find('#previewTitle').text(' '); - } + ] } - }; - - win = editor.windowManager.open({ - title: "Special character", - spacing: 10, - padding: 10, - items: [ - charMapPanel, - { - type: 'container', - layout: 'flex', - direction: 'column', - align: 'center', - spacing: 5, - minWidth: 160, - minHeight: 160, - items: [ - { - type: 'label', - name: 'preview', - text: ' ', - style: 'font-size: 40px; text-align: center', - border: 1, - minWidth: 140, - minHeight: 80 - }, - { - type: 'spacer', - minHeight: 20 - }, - { - type: 'label', - name: 'previewTitle', - text: ' ', - style: 'white-space: pre-wrap;', - border: 1, - minWidth: 140 - } - ] + ], + buttons: [{ + text: 'Close', + onclick: function () { + win.close(); } - ], - buttons: [ - { - text: "Close", onclick: function () { - win.close(); - } - } - ] - }); - }; - - return { - open: open - }; - } -); -/** - * Commands.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.charmap.api.Commands', - [ - 'tinymce.plugins.charmap.ui.Dialog' - ], - function (Dialog) { - var register = function (editor) { - editor.addCommand('mceShowCharmap', function () { - Dialog.open(editor); - }); - }; - - return { - register: register - }; - } -); -/** - * Buttons.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.charmap.ui.Buttons', - [ - ], - function () { - var register = function (editor) { - editor.addButton('charmap', { - icon: 'charmap', - tooltip: 'Special character', - cmd: 'mceShowCharmap' - }); + }] + }); + }; + var $_63exy93je5nvbjl = { open: open }; - editor.addMenuItem('charmap', { - icon: 'charmap', - text: 'Special character', - cmd: 'mceShowCharmap', - context: 'insert' - }); - }; + var register = function (editor) { + editor.addCommand('mceShowCharmap', function () { + $_63exy93je5nvbjl.open(editor); + }); + }; + var $_9e2y4r92je5nvbjj = { register: register }; - return { - register: register - }; + var register$1 = function (editor) { + editor.addButton('charmap', { + icon: 'charmap', + tooltip: 'Special character', + cmd: 'mceShowCharmap' + }); + editor.addMenuItem('charmap', { + icon: 'charmap', + text: 'Special character', + cmd: 'mceShowCharmap', + context: 'insert' + }); + }; + var $_22dujo95je5nvbjs = { register: register$1 }; + + PluginManager.add('charmap', function (editor) { + $_9e2y4r92je5nvbjj.register(editor); + $_22dujo95je5nvbjs.register(editor); + return $_6qsyee8wje5nvbj9.get(editor); + }); + function Plugin () { } -); -/** - * Plugin.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.charmap.Plugin', - [ - 'tinymce.core.PluginManager', - 'tinymce.plugins.charmap.api.Api', - 'tinymce.plugins.charmap.api.Commands', - 'tinymce.plugins.charmap.ui.Buttons' - ], - function (PluginManager, Api, Commands, Buttons) { - PluginManager.add('charmap', function (editor) { - Commands.register(editor); - Buttons.register(editor); - return Api.get(editor); - }); + return Plugin; - return function () { }; - } -); -dem('tinymce.plugins.charmap.Plugin')(); +}()); })(); diff --git a/tinymce_4/static/tinymce_4/tinymce/plugins/charmap/plugin.min.js b/tinymce_4/static/tinymce_4/tinymce/plugins/charmap/plugin.min.js index 4e790ce..14d1653 100644 --- a/tinymce_4/static/tinymce_4/tinymce/plugins/charmap/plugin.min.js +++ b/tinymce_4/static/tinymce_4/tinymce/plugins/charmap/plugin.min.js @@ -1 +1 @@ -!function(){var a={},b=function(b){for(var c=a[b],e=c.deps,f=c.defn,g=e.length,h=new Array(g),i=0;i',d=0;d",c=0;c

'+i+"
"}else b+=""}b+=""}return b+=""};return{getHtml:a}}),g("8",["6","7","c"],function(a,b,c){var d=function(a){for(;a;){if("TD"===a.nodeName)return a;a=a.parentNode}},e=function(e){var f,g={type:"container",html:c.getHtml(b.getCharMap(e)),onclick:function(b){var c=b.target;if(/^(TD|DIV)$/.test(c.nodeName)){var g=d(c).firstChild;g&&g.hasAttribute("data-chr")&&(a.insertChar(e,g.getAttribute("data-chr")),b.ctrlKey||f.close())}},onmouseover:function(a){var b=d(a.target);b&&b.firstChild?(f.find("#preview").text(b.firstChild.firstChild.data),f.find("#previewTitle").text(b.title)):(f.find("#preview").text(" "),f.find("#previewTitle").text(" "))}};f=e.windowManager.open({title:"Special character",spacing:10,padding:10,items:[g,{type:"container",layout:"flex",direction:"column",align:"center",spacing:5,minWidth:160,minHeight:160,items:[{type:"label",name:"preview",text:" ",style:"font-size: 40px; text-align: center",border:1,minWidth:140,minHeight:80},{type:"spacer",minHeight:20},{type:"label",name:"previewTitle",text:" ",style:"white-space: pre-wrap;",border:1,minWidth:140}]}],buttons:[{text:"Close",onclick:function(){f.close()}}]})};return{open:e}}),g("3",["8"],function(a){var b=function(b){b.addCommand("mceShowCharmap",function(){a.open(b)})};return{register:b}}),g("4",[],function(){var a=function(a){a.addButton("charmap",{icon:"charmap",tooltip:"Special character",cmd:"mceShowCharmap"}),a.addMenuItem("charmap",{icon:"charmap",text:"Special character",cmd:"mceShowCharmap",context:"insert"})};return{register:a}}),g("0",["1","2","3","4"],function(a,b,c,d){return a.add("charmap",function(a){return c.register(a),d.register(a),b.get(a)}),function(){}}),d("0")()}(); \ No newline at end of file +!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),t=function(e,t){return e.fire("insertCustomChar",{chr:t})},a=function(e,a){var i=t(e,a).chr;e.execCommand("mceInsertContent",!1,i)},i=tinymce.util.Tools.resolve("tinymce.util.Tools"),r=function(e){return e.settings.charmap},n=function(e){return e.settings.charmap_append},o=i.isArray,l=function(e){return o(e)?[].concat((t=e,i.grep(t,function(e){return o(e)&&2===e.length}))):"function"==typeof e?e():[];var t},c=function(e){return function(e,t){var a=r(e);a&&(t=l(a));var i=n(e);return i?[].concat(t).concat(l(i)):t}(e,[["160","no-break space"],["173","soft hyphen"],["34","quotation mark"],["162","cent sign"],["8364","euro sign"],["163","pound sign"],["165","yen sign"],["169","copyright sign"],["174","registered sign"],["8482","trade mark sign"],["8240","per mille sign"],["181","micro sign"],["183","middle dot"],["8226","bullet"],["8230","three dot leader"],["8242","minutes / feet"],["8243","seconds / inches"],["167","section sign"],["182","paragraph sign"],["223","sharp s / ess-zed"],["8249","single left-pointing angle quotation mark"],["8250","single right-pointing angle quotation mark"],["171","left pointing guillemet"],["187","right pointing guillemet"],["8216","left single quotation mark"],["8217","right single quotation mark"],["8220","left double quotation mark"],["8221","right double quotation mark"],["8218","single low-9 quotation mark"],["8222","double low-9 quotation mark"],["60","less-than sign"],["62","greater-than sign"],["8804","less-than or equal to"],["8805","greater-than or equal to"],["8211","en dash"],["8212","em dash"],["175","macron"],["8254","overline"],["164","currency sign"],["166","broken bar"],["168","diaeresis"],["161","inverted exclamation mark"],["191","turned question mark"],["710","circumflex accent"],["732","small tilde"],["176","degree sign"],["8722","minus sign"],["177","plus-minus sign"],["247","division sign"],["8260","fraction slash"],["215","multiplication sign"],["185","superscript one"],["178","superscript two"],["179","superscript three"],["188","fraction one quarter"],["189","fraction one half"],["190","fraction three quarters"],["402","function / florin"],["8747","integral"],["8721","n-ary sumation"],["8734","infinity"],["8730","square root"],["8764","similar to"],["8773","approximately equal to"],["8776","almost equal to"],["8800","not equal to"],["8801","identical to"],["8712","element of"],["8713","not an element of"],["8715","contains as member"],["8719","n-ary product"],["8743","logical and"],["8744","logical or"],["172","not sign"],["8745","intersection"],["8746","union"],["8706","partial differential"],["8704","for all"],["8707","there exists"],["8709","diameter"],["8711","backward difference"],["8727","asterisk operator"],["8733","proportional to"],["8736","angle"],["180","acute accent"],["184","cedilla"],["170","feminine ordinal indicator"],["186","masculine ordinal indicator"],["8224","dagger"],["8225","double dagger"],["192","A - grave"],["193","A - acute"],["194","A - circumflex"],["195","A - tilde"],["196","A - diaeresis"],["197","A - ring above"],["256","A - macron"],["198","ligature AE"],["199","C - cedilla"],["200","E - grave"],["201","E - acute"],["202","E - circumflex"],["203","E - diaeresis"],["274","E - macron"],["204","I - grave"],["205","I - acute"],["206","I - circumflex"],["207","I - diaeresis"],["298","I - macron"],["208","ETH"],["209","N - tilde"],["210","O - grave"],["211","O - acute"],["212","O - circumflex"],["213","O - tilde"],["214","O - diaeresis"],["216","O - slash"],["332","O - macron"],["338","ligature OE"],["352","S - caron"],["217","U - grave"],["218","U - acute"],["219","U - circumflex"],["220","U - diaeresis"],["362","U - macron"],["221","Y - acute"],["376","Y - diaeresis"],["562","Y - macron"],["222","THORN"],["224","a - grave"],["225","a - acute"],["226","a - circumflex"],["227","a - tilde"],["228","a - diaeresis"],["229","a - ring above"],["257","a - macron"],["230","ligature ae"],["231","c - cedilla"],["232","e - grave"],["233","e - acute"],["234","e - circumflex"],["235","e - diaeresis"],["275","e - macron"],["236","i - grave"],["237","i - acute"],["238","i - circumflex"],["239","i - diaeresis"],["299","i - macron"],["240","eth"],["241","n - tilde"],["242","o - grave"],["243","o - acute"],["244","o - circumflex"],["245","o - tilde"],["246","o - diaeresis"],["248","o slash"],["333","o macron"],["339","ligature oe"],["353","s - caron"],["249","u - grave"],["250","u - acute"],["251","u - circumflex"],["252","u - diaeresis"],["363","u - macron"],["253","y - acute"],["254","thorn"],["255","y - diaeresis"],["563","y - macron"],["913","Alpha"],["914","Beta"],["915","Gamma"],["916","Delta"],["917","Epsilon"],["918","Zeta"],["919","Eta"],["920","Theta"],["921","Iota"],["922","Kappa"],["923","Lambda"],["924","Mu"],["925","Nu"],["926","Xi"],["927","Omicron"],["928","Pi"],["929","Rho"],["931","Sigma"],["932","Tau"],["933","Upsilon"],["934","Phi"],["935","Chi"],["936","Psi"],["937","Omega"],["945","alpha"],["946","beta"],["947","gamma"],["948","delta"],["949","epsilon"],["950","zeta"],["951","eta"],["952","theta"],["953","iota"],["954","kappa"],["955","lambda"],["956","mu"],["957","nu"],["958","xi"],["959","omicron"],["960","pi"],["961","rho"],["962","final sigma"],["963","sigma"],["964","tau"],["965","upsilon"],["966","phi"],["967","chi"],["968","psi"],["969","omega"],["8501","alef symbol"],["982","pi symbol"],["8476","real part symbol"],["978","upsilon - hook symbol"],["8472","Weierstrass p"],["8465","imaginary part"],["8592","leftwards arrow"],["8593","upwards arrow"],["8594","rightwards arrow"],["8595","downwards arrow"],["8596","left right arrow"],["8629","carriage return"],["8656","leftwards double arrow"],["8657","upwards double arrow"],["8658","rightwards double arrow"],["8659","downwards double arrow"],["8660","left right double arrow"],["8756","therefore"],["8834","subset of"],["8835","superset of"],["8836","not a subset of"],["8838","subset of or equal to"],["8839","superset of or equal to"],["8853","circled plus"],["8855","circled times"],["8869","perpendicular"],["8901","dot operator"],["8968","left ceiling"],["8969","right ceiling"],["8970","left floor"],["8971","right floor"],["9001","left-pointing angle bracket"],["9002","right-pointing angle bracket"],["9674","lozenge"],["9824","black spade suit"],["9827","black club suit"],["9829","black heart suit"],["9830","black diamond suit"],["8194","en space"],["8195","em space"],["8201","thin space"],["8204","zero width non-joiner"],["8205","zero width joiner"],["8206","left-to-right mark"],["8207","right-to-left mark"]])},s=function(e){return{getCharMap:function(){return c(e)},insertChar:function(t){a(e,t)}}},u=function(e){var t,a,i,r=Math.min(e.length,25),n=Math.ceil(e.length/r);for(t='',i=0;i",a=0;a
'+s+"
"}else t+="
"}return t+=""},d=function(e){for(;e;){if("TD"===e.nodeName)return e;e=e.parentNode}},m=function(e){var t,i={type:"container",html:u(c(e)),onclick:function(i){var r=i.target;if(/^(TD|DIV)$/.test(r.nodeName)){var n=d(r).firstChild;if(n&&n.hasAttribute("data-chr")){var o=n.getAttribute("data-chr"),l=parseInt(o,10);isNaN(l)||a(e,String.fromCharCode(l)),i.ctrlKey||t.close()}}},onmouseover:function(e){var a=d(e.target);a&&a.firstChild?(t.find("#preview").text(a.firstChild.firstChild.data),t.find("#previewTitle").text(a.title)):(t.find("#preview").text(" "),t.find("#previewTitle").text(" "))}};t=e.windowManager.open({title:"Special character",spacing:10,padding:10,items:[i,{type:"container",layout:"flex",direction:"column",align:"center",spacing:5,minWidth:160,minHeight:160,items:[{type:"label",name:"preview",text:" ",style:"font-size: 40px; text-align: center",border:1,minWidth:140,minHeight:80},{type:"spacer",minHeight:20},{type:"label",name:"previewTitle",text:" ",style:"white-space: pre-wrap;",border:1,minWidth:140}]}],buttons:[{text:"Close",onclick:function(){t.close()}}]})},g=function(e){e.addCommand("mceShowCharmap",function(){m(e)})},p=function(e){e.addButton("charmap",{icon:"charmap",tooltip:"Special character",cmd:"mceShowCharmap"}),e.addMenuItem("charmap",{icon:"charmap",text:"Special character",cmd:"mceShowCharmap",context:"insert"})};e.add("charmap",function(e){return g(e),p(e),s(e)})}(); \ No newline at end of file diff --git a/tinymce_4/static/tinymce_4/tinymce/plugins/code/plugin.js b/tinymce_4/static/tinymce_4/tinymce/plugins/code/plugin.js index 0a19440..e815764 100644 --- a/tinymce_4/static/tinymce_4/tinymce/plugins/code/plugin.js +++ b/tinymce_4/static/tinymce_4/tinymce/plugins/code/plugin.js @@ -1,338 +1,94 @@ (function () { +var code = (function () { + 'use strict'; -var defs = {}; // id -> {dependencies, definition, instance (possibly undefined)} + var PluginManager = tinymce.util.Tools.resolve('tinymce.PluginManager'); -// Used when there is no 'main' module. -// The name is probably (hopefully) unique so minification removes for releases. -var register_3795 = function (id) { - var module = dem(id); - var fragments = id.split('.'); - var target = Function('return this;')(); - for (var i = 0; i < fragments.length - 1; ++i) { - if (target[fragments[i]] === undefined) - target[fragments[i]] = {}; - target = target[fragments[i]]; - } - target[fragments[fragments.length - 1]] = module; -}; - -var instantiate = function (id) { - var actual = defs[id]; - var dependencies = actual.deps; - var definition = actual.defn; - var len = dependencies.length; - var instances = new Array(len); - for (var i = 0; i < len; ++i) - instances[i] = dem(dependencies[i]); - var defResult = definition.apply(null, instances); - if (defResult === undefined) - throw 'module [' + id + '] returned undefined'; - actual.instance = defResult; -}; + var DOMUtils = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils'); -var def = function (id, dependencies, definition) { - if (typeof id !== 'string') - throw 'module id must be a string'; - else if (dependencies === undefined) - throw 'no dependencies for ' + id; - else if (definition === undefined) - throw 'no definition function for ' + id; - defs[id] = { - deps: dependencies, - defn: definition, - instance: undefined + var getMinWidth = function (editor) { + return editor.getParam('code_dialog_width', 600); + }; + var getMinHeight = function (editor) { + return editor.getParam('code_dialog_height', Math.min(DOMUtils.DOM.getViewPort().h - 200, 500)); + }; + var $_bdsc1g9aje5nvbkf = { + getMinWidth: getMinWidth, + getMinHeight: getMinHeight }; -}; - -var dem = function (id) { - var actual = defs[id]; - if (actual === undefined) - throw 'module [' + id + '] was undefined'; - else if (actual.instance === undefined) - instantiate(id); - return actual.instance; -}; - -var req = function (ids, callback) { - var len = ids.length; - var instances = new Array(len); - for (var i = 0; i < len; ++i) - instances[i] = dem(ids[i]); - callback.apply(null, instances); -}; - -var ephox = {}; - -ephox.bolt = { - module: { - api: { - define: def, - require: req, - demand: dem - } - } -}; - -var define = def; -var require = req; -var demand = dem; -// this helps with minification when using a lot of global references -var defineGlobal = function (id, ref) { - define(id, [], function () { return ref; }); -}; -/*jsc -["tinymce.plugins.code.Plugin","tinymce.core.PluginManager","tinymce.plugins.code.api.Commands","tinymce.plugins.code.ui.Buttons","global!tinymce.util.Tools.resolve","tinymce.plugins.code.ui.Dialog","tinymce.plugins.code.api.Settings","tinymce.plugins.code.core.Content","tinymce.core.dom.DOMUtils"] -jsc*/ -defineGlobal("global!tinymce.util.Tools.resolve", tinymce.util.Tools.resolve); -/** - * ResolveGlobal.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.core.PluginManager', - [ - 'global!tinymce.util.Tools.resolve' - ], - function (resolve) { - return resolve('tinymce.PluginManager'); - } -); - -/** - * ResolveGlobal.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.core.dom.DOMUtils', - [ - 'global!tinymce.util.Tools.resolve' - ], - function (resolve) { - return resolve('tinymce.dom.DOMUtils'); - } -); - -/** - * Settings.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.code.api.Settings', - [ - 'tinymce.core.dom.DOMUtils' - ], - function (DOMUtils) { - var getMinWidth = function (editor) { - return editor.getParam('code_dialog_width', 600); - }; - - var getMinHeight = function (editor) { - return editor.getParam('code_dialog_height', Math.min(DOMUtils.DOM.getViewPort().h - 200, 500)); - }; - - return { - getMinWidth: getMinWidth, - getMinHeight: getMinHeight - }; - } -); -/** - * Content.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.code.core.Content', - [ - ], - function () { - var setContent = function (editor, html) { - // We get a lovely "Wrong document" error in IE 11 if we - // don't move the focus to the editor before creating an undo - // transation since it tries to make a bookmark for the current selection - editor.focus(); - - editor.undoManager.transact(function () { - editor.setContent(html); - }); - - editor.selection.setCursorLocation(); - editor.nodeChanged(); - }; - - var getContent = function (editor) { - return editor.getContent({ source_view: true }); - }; - - return { - setContent: setContent, - getContent: getContent - }; - } -); -/** - * Dialog.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.code.ui.Dialog', - [ - 'tinymce.plugins.code.api.Settings', - 'tinymce.plugins.code.core.Content' - ], - function (Settings, Content) { - var open = function (editor) { - var minWidth = Settings.getMinWidth(editor); - var minHeight = Settings.getMinHeight(editor); - - var win = editor.windowManager.open({ - title: 'Source code', - body: { - type: 'textbox', - name: 'code', - multiline: true, - minWidth: minWidth, - minHeight: minHeight, - spellcheck: false, - style: 'direction: ltr; text-align: left' - }, - onSubmit: function (e) { - Content.setContent(editor, e.data.code); - } - }); - - // Gecko has a major performance issue with textarea - // contents so we need to set it when all reflows are done - win.find('#code').value(Content.getContent(editor)); - }; - - return { - open: open - }; - } -); -/** - * Commands.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.code.api.Commands', - [ - 'tinymce.plugins.code.ui.Dialog' - ], - function (Dialog) { - var register = function (editor) { - editor.addCommand('mceCodeEditor', function () { - Dialog.open(editor); - }); - }; - - return { - register: register - }; - } -); -/** - * Buttons.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ -define( - 'tinymce.plugins.code.ui.Buttons', - [ - 'tinymce.plugins.code.ui.Dialog' - ], - function (Dialog) { - var register = function (editor) { - editor.addButton('code', { - icon: 'code', - tooltip: 'Source code', - onclick: function () { - Dialog.open(editor); - } - }); + var setContent = function (editor, html) { + editor.focus(); + editor.undoManager.transact(function () { + editor.setContent(html); + }); + editor.selection.setCursorLocation(); + editor.nodeChanged(); + }; + var getContent = function (editor) { + return editor.getContent({ source_view: true }); + }; + var $_87my539cje5nvbkg = { + setContent: setContent, + getContent: getContent + }; - editor.addMenuItem('code', { - icon: 'code', - text: 'Source code', - onclick: function () { - Dialog.open(editor); - } - }); - }; + var open = function (editor) { + var minWidth = $_bdsc1g9aje5nvbkf.getMinWidth(editor); + var minHeight = $_bdsc1g9aje5nvbkf.getMinHeight(editor); + var win = editor.windowManager.open({ + title: 'Source code', + body: { + type: 'textbox', + name: 'code', + multiline: true, + minWidth: minWidth, + minHeight: minHeight, + spellcheck: false, + style: 'direction: ltr; text-align: left' + }, + onSubmit: function (e) { + $_87my539cje5nvbkg.setContent(editor, e.data.code); + } + }); + win.find('#code').value($_87my539cje5nvbkg.getContent(editor)); + }; + var $_agyp9q99je5nvbke = { open: open }; - return { - register: register - }; + var register = function (editor) { + editor.addCommand('mceCodeEditor', function () { + $_agyp9q99je5nvbke.open(editor); + }); + }; + var $_9tzgyf98je5nvbkd = { register: register }; + + var register$1 = function (editor) { + editor.addButton('code', { + icon: 'code', + tooltip: 'Source code', + onclick: function () { + $_agyp9q99je5nvbke.open(editor); + } + }); + editor.addMenuItem('code', { + icon: 'code', + text: 'Source code', + onclick: function () { + $_agyp9q99je5nvbke.open(editor); + } + }); + }; + var $_e0a13c9dje5nvbkh = { register: register$1 }; + + PluginManager.add('code', function (editor) { + $_9tzgyf98je5nvbkd.register(editor); + $_e0a13c9dje5nvbkh.register(editor); + return {}; + }); + function Plugin () { } -); -/** - * Plugin.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ -define( - 'tinymce.plugins.code.Plugin', - [ - 'tinymce.core.PluginManager', - 'tinymce.plugins.code.api.Commands', - 'tinymce.plugins.code.ui.Buttons' - ], - function (PluginManager, Commands, Buttons) { - PluginManager.add('code', function (editor) { - Commands.register(editor); - Buttons.register(editor); + return Plugin; - return {}; - }); - - return function () { }; - } -); -dem('tinymce.plugins.code.Plugin')(); +}()); })(); diff --git a/tinymce_4/static/tinymce_4/tinymce/plugins/code/plugin.min.js b/tinymce_4/static/tinymce_4/tinymce/plugins/code/plugin.min.js index bbc3923..c983b5c 100644 --- a/tinymce_4/static/tinymce_4/tinymce/plugins/code/plugin.min.js +++ b/tinymce_4/static/tinymce_4/tinymce/plugins/code/plugin.min.js @@ -1 +1 @@ -!function(){var a={},b=function(b){for(var c=a[b],e=c.deps,f=c.defn,g=e.length,h=new Array(g),i=0;i {dependencies, definition, instance (possibly undefined)} - -// Used when there is no 'main' module. -// The name is probably (hopefully) unique so minification removes for releases. -var register_3795 = function (id) { - var module = dem(id); - var fragments = id.split('.'); - var target = Function('return this;')(); - for (var i = 0; i < fragments.length - 1; ++i) { - if (target[fragments[i]] === undefined) - target[fragments[i]] = {}; - target = target[fragments[i]]; - } - target[fragments[fragments.length - 1]] = module; -}; - -var instantiate = function (id) { - var actual = defs[id]; - var dependencies = actual.deps; - var definition = actual.defn; - var len = dependencies.length; - var instances = new Array(len); - for (var i = 0; i < len; ++i) - instances[i] = dem(dependencies[i]); - var defResult = definition.apply(null, instances); - if (defResult === undefined) - throw 'module [' + id + '] returned undefined'; - actual.instance = defResult; -}; - -var def = function (id, dependencies, definition) { - if (typeof id !== 'string') - throw 'module id must be a string'; - else if (dependencies === undefined) - throw 'no dependencies for ' + id; - else if (definition === undefined) - throw 'no definition function for ' + id; - defs[id] = { - deps: dependencies, - defn: definition, - instance: undefined - }; -}; - -var dem = function (id) { - var actual = defs[id]; - if (actual === undefined) - throw 'module [' + id + '] was undefined'; - else if (actual.instance === undefined) - instantiate(id); - return actual.instance; -}; - -var req = function (ids, callback) { - var len = ids.length; - var instances = new Array(len); - for (var i = 0; i < len; ++i) - instances[i] = dem(ids[i]); - callback.apply(null, instances); -}; - -var ephox = {}; - -ephox.bolt = { - module: { - api: { - define: def, - require: req, - demand: dem - } - } -}; - -var define = def; -var require = req; -var demand = dem; -// this helps with minification when using a lot of global references -var defineGlobal = function (id, ref) { - define(id, [], function () { return ref; }); -}; -/*jsc -["tinymce.plugins.codesample.Plugin","ephox.katamari.api.Cell","tinymce.core.PluginManager","tinymce.plugins.codesample.api.Commands","tinymce.plugins.codesample.core.FilterContent","tinymce.plugins.codesample.core.LoadCss","tinymce.plugins.codesample.ui.Buttons","global!tinymce.util.Tools.resolve","tinymce.plugins.codesample.ui.Dialog","tinymce.plugins.codesample.util.Utils","tinymce.plugins.codesample.core.Prism","tinymce.plugins.codesample.api.Settings","tinymce.core.dom.DOMUtils","tinymce.plugins.codesample.core.CodeSample","tinymce.plugins.codesample.core.Languages"] -jsc*/ -define( - 'ephox.katamari.api.Cell', - - [ - ], - - function () { - var Cell = function (initial) { - var value = initial; - - var get = function () { - return value; - }; - - var set = function (v) { - value = v; - }; - - var clone = function () { - return Cell(get()); - }; - - return { - get: get, - set: set, - clone: clone - }; - }; - - return Cell; - } -); - -defineGlobal("global!tinymce.util.Tools.resolve", tinymce.util.Tools.resolve); -/** - * ResolveGlobal.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.core.PluginManager', - [ - 'global!tinymce.util.Tools.resolve' - ], - function (resolve) { - return resolve('tinymce.PluginManager'); - } -); - -/** - * ResolveGlobal.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.core.dom.DOMUtils', - [ - 'global!tinymce.util.Tools.resolve' - ], - function (resolve) { - return resolve('tinymce.dom.DOMUtils'); - } -); - -/** - * Settings.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.codesample.api.Settings', - [ - 'tinymce.core.dom.DOMUtils' - ], - function (DOMUtils) { - var getContentCss = function (editor) { - return editor.settings.codesample_content_css; - }; - - var getLanguages = function (editor) { - return editor.settings.codesample_languages; + var Cell = function (initial) { + var value = initial; + var get = function () { + return value; }; - - var getDialogMinWidth = function (editor) { - return Math.min(DOMUtils.DOM.getViewPort().w, editor.getParam('codesample_dialog_width', 800)); + var set = function (v) { + value = v; }; - - var getDialogMinHeight = function (editor) { - return Math.min(DOMUtils.DOM.getViewPort().w, editor.getParam('codesample_dialog_height', 650)); + var clone = function () { + return Cell(get()); }; - return { - getContentCss: getContentCss, - getLanguages: getLanguages, - getDialogMinWidth: getDialogMinWidth, - getDialogMinHeight: getDialogMinHeight + get: get, + set: set, + clone: clone }; - } -); -/** - * Prism.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - * - * Import of prism. Disabled DOMContentLoaded event listener. - */ - -/*eslint-disable*/ - -define( - 'tinymce.plugins.codesample.core.Prism', - [ - ], - function () { - var window = {}; - // ------------------ Start wrap - - /* http://prismjs.com/download.html?themes=prism-dark&languages=markup+css+clike+javascript+c+csharp+cpp+java+php+python+ruby */ - var _self = (typeof window !== 'undefined') - ? window // if in browser - : ( - (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) - ? self // if in worker - : {} // if in node js - ); - - /** - * Prism: Lightweight, robust, elegant syntax highlighting - * MIT license http://www.opensource.org/licenses/mit-license.php/ - * @author Lea Verou http://lea.verou.me - */ - - var Prism = (function () { - - // Private helper vars - var lang = /\blang(?:uage)?-(?!\*)(\w+)\b/i; - - var _ = _self.Prism = { - util: { - encode: function (tokens) { - if (tokens instanceof Token) { - return new Token(tokens.type, _.util.encode(tokens.content), tokens.alias); - } else if (_.util.type(tokens) === 'Array') { - return tokens.map(_.util.encode); - } else { - return tokens.replace(/&/g, '&').replace(/ text.length) { - // Something went terribly wrong, ABORT, ABORT! break tokenloop; } - if (str instanceof Token) { continue; } - pattern.lastIndex = 0; - var match = pattern.exec(str); - if (match) { if (lookbehind) { lookbehindLength = match[1].length; } - - var from = match.index - 1 + lookbehindLength, - match = match[0].slice(lookbehindLength), - len = match.length, - to = from + len, - before = str.slice(0, from + 1), - after = str.slice(to + 1); - - var args = [i, 1]; - + var from = match.index - 1 + lookbehindLength; + match = match[0].slice(lookbehindLength); + var len = match.length, to = from + len, before = str.slice(0, from + 1), after = str.slice(to + 1); + var args = [ + i, + 1 + ]; if (before) { args.push(before); } - var wrapped = new Token(token, inside ? _.tokenize(match, inside) : match, alias); - args.push(wrapped); - if (after) { args.push(after); } - Array.prototype.splice.apply(strarr, args); } } } } - - return strarr; + return strarr; + }, + hooks: { + all: {}, + add: function (name, callback) { + var hooks = _.hooks.all; + hooks[name] = hooks[name] || []; + hooks[name].push(callback); }, - - hooks: { - all: {}, - - add: function (name, callback) { - var hooks = _.hooks.all; - - hooks[name] = hooks[name] || []; - - hooks[name].push(callback); - }, - - run: function (name, env) { - var callbacks = _.hooks.all[name]; - - if (!callbacks || !callbacks.length) { - return; - } - - for (var i = 0, callback; callback = callbacks[i++];) { - callback(env); - } + run: function (name, env) { + var callbacks = _.hooks.all[name]; + if (!callbacks || !callbacks.length) { + return; + } + for (var i = 0, callback = void 0; callback = callbacks[i++];) { + callback(env); } } + } + }; + var Token = _.Token = function (type, content, alias) { + this.type = type; + this.content = content; + this.alias = alias; + }; + Token.stringify = function (o, language, parent) { + if (typeof o === 'string') { + return o; + } + if (_.util.type(o) === 'Array') { + return o.map(function (element) { + return Token.stringify(element, language, o); + }).join(''); + } + var env = { + type: o.type, + content: Token.stringify(o.content, language, parent), + tag: 'span', + classes: [ + 'token', + o.type + ], + attributes: {}, + language: language, + parent: parent }; - - var Token = _.Token = function (type, content, alias) { - this.type = type; - this.content = content; - this.alias = alias; - }; - - Token.stringify = function (o, language, parent) { - if (typeof o == 'string') { - return o; - } - - if (_.util.type(o) === 'Array') { - return o.map(function (element) { - return Token.stringify(element, language, o); - }).join(''); - } - - var env = { - type: o.type, - content: Token.stringify(o.content, language, parent), - tag: 'span', - classes: ['token', o.type], - attributes: {}, - language: language, - parent: parent - }; - - if (env.type == 'comment') { - env.attributes['spellcheck'] = 'true'; - } - - if (o.alias) { - var aliases = _.util.type(o.alias) === 'Array' ? o.alias : [o.alias]; - Array.prototype.push.apply(env.classes, aliases); - } - - _.hooks.run('wrap', env); - - var attributes = ''; - - for (var name in env.attributes) { - attributes += (attributes ? ' ' : '') + name + '="' + (env.attributes[name] || '') + '"'; - } - - return '<' + env.tag + ' class="' + env.classes.join(' ') + '" ' + attributes + '>' + env.content + ''; - - }; - - if (!_self.document) { - if (!_self.addEventListener) { - // in Node.js - return _self.Prism; - } - // In worker - _self.addEventListener('message', function (evt) { - var message = JSON.parse(evt.data), - lang = message.language, - code = message.code, - immediateClose = message.immediateClose; - - _self.postMessage(_.highlight(code, _.languages[lang], lang)); - if (immediateClose) { - _self.close(); - } - }, false); - + if (env.type === 'comment') { + env.attributes.spellcheck = 'true'; + } + if (o.alias) { + var aliases = _.util.type(o.alias) === 'Array' ? o.alias : [o.alias]; + Array.prototype.push.apply(env.classes, aliases); + } + _.hooks.run('wrap', env); + var attributes = ''; + for (var name_1 in env.attributes) { + attributes += (attributes ? ' ' : '') + name_1 + '="' + (env.attributes[name_1] || '') + '"'; + } + return '<' + env.tag + ' class="' + env.classes.join(' ') + '" ' + attributes + '>' + env.content + ''; + }; + if (!_self.document) { + if (!_self.addEventListener) { return _self.Prism; } - /* - // Get current script and highlight - var script = document.getElementsByTagName('script'); - - script = script[script.length - 1]; - - if (script) { - _.filename = script.src; - - if (document.addEventListener && !script.hasAttribute('data-manual')) { - document.addEventListener('DOMContentLoaded', _.highlightAll); + _self.addEventListener('message', function (evt) { + var message = JSON.parse(evt.data), lang = message.language, code = message.code, immediateClose = message.immediateClose; + _self.postMessage(_.highlight(code, _.languages[lang], lang)); + if (immediateClose) { + _self.close(); } - } - + }, false); return _self.Prism; - */ - })(); - - if (typeof module !== 'undefined' && module.exports) { - module.exports = Prism; } - - // hack for components to work correctly in node.js - if (typeof global !== 'undefined') { - global.Prism = Prism; + }(); + if (typeof module !== 'undefined' && module.exports) { + module.exports = Prism; + } + if (typeof global !== 'undefined') { + global.Prism = Prism; + } + Prism.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 + }; + Prism.hooks.add('wrap', function (env) { + if (env.type === 'entity') { + env.attributes.title = env.content.replace(/&/, '&'); } - ; - Prism.languages.markup = { - 'comment': //, - 'prolog': /<\?[\w\W]+?\?>/, - 'doctype': //, - 'cdata': //i, - 'tag': { - pattern: /<\/?[^\s>\/=.]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\\1|\\?(?!\1)[\w\W])*\1|[^\s'">=]+))?)*\s*\/?>/i, + }); + Prism.languages.xml = Prism.languages.markup; + Prism.languages.html = Prism.languages.markup; + Prism.languages.mathml = Prism.languages.markup; + Prism.languages.svg = Prism.languages.markup; + Prism.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: /[(){};:]/ + }; + Prism.languages.css.atrule.inside.rest = Prism.util.clone(Prism.languages.css); + if (Prism.languages.markup) { + Prism.languages.insertBefore('markup', 'tag', { + style: { + pattern: /[\w\W]*?<\/style>/i, inside: { - 'tag': { - pattern: /^<\/?[^\s>\/]+/i, - inside: { - 'punctuation': /^<\/?/, - 'namespace': /^[^\s>\/:]+:/ - } + tag: { + pattern: /|<\/style>/i, + inside: Prism.languages.markup.tag.inside }, - 'attr-value': { - pattern: /=(?:('|")[\w\W]*?(\1)|[^\s>]+)/i, - inside: { - 'punctuation': /[=>"']/ - } - }, - 'punctuation': /\/?>/, + rest: Prism.languages.css + }, + alias: 'language-css' + } + }); + Prism.languages.insertBefore('inside', 'attr-value', { + 'style-attr': { + pattern: /\s*style=("|').*?\1/i, + inside: { 'attr-name': { - pattern: /[^\s>\/]+/, - inside: { - 'namespace': /^[^\s>\/:]+:/ - } + pattern: /^\s*style/i, + inside: Prism.languages.markup.tag.inside + }, + 'punctuation': /^\s*=\s*['"]|['"]\s*$/, + 'attr-value': { + pattern: /.+/i, + inside: Prism.languages.css } - - } - }, - 'entity': /&#?[\da-z]{1,8};/i - }; - - // Plugin to make entity title show the real entity, idea by Roman Komarov - Prism.hooks.add('wrap', function (env) { - - if (env.type === 'entity') { - env.attributes['title'] = env.content.replace(/&/, '&'); + }, + alias: 'language-css' } - }); - - Prism.languages.xml = Prism.languages.markup; - Prism.languages.html = Prism.languages.markup; - Prism.languages.mathml = Prism.languages.markup; - Prism.languages.svg = Prism.languages.markup; - - Prism.languages.css = { - 'comment': /\/\*[\w\W]*?\*\//, - 'atrule': { - pattern: /@[\w-]+?.*?(;|(?=\s*\{))/i, - inside: { - 'rule': /@[\w-]+/ - // See rest below - } + }, Prism.languages.markup.tag); + } + Prism.languages.clike = { + 'comment': [ + { + pattern: /(^|[^\\])\/\*[\w\W]*?\*\//, + lookbehind: true }, - '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': /[(){};:]/ - }; - - Prism.languages.css['atrule'].inside.rest = Prism.util.clone(Prism.languages.css); - - if (Prism.languages.markup) { - Prism.languages.insertBefore('markup', 'tag', { - 'style': { - pattern: /[\w\W]*?<\/style>/i, - inside: { - 'tag': { - pattern: /|<\/style>/i, - inside: Prism.languages.markup.tag.inside - }, - rest: Prism.languages.css - }, - alias: 'language-css' - } - }); - - Prism.languages.insertBefore('inside', 'attr-value', { - 'style-attr': { - pattern: /\s*style=("|').*?\1/i, + { + pattern: /(^|[^\\:])\/\/.*/, + lookbehind: true + } + ], + '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: true, + 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': /[{}[\];(),.:]/ + }; + Prism.languages.javascript = Prism.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 + }); + Prism.languages.insertBefore('javascript', 'keyword', { + regex: { + pattern: /(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\\\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})]))/, + lookbehind: true + } + }); + Prism.languages.insertBefore('javascript', 'class-name', { + 'template-string': { + pattern: /`(?:\\`|\\?[^`])*`/, + inside: { + interpolation: { + pattern: /\$\{[^}]+\}/, inside: { - 'attr-name': { - pattern: /^\s*style/i, - inside: Prism.languages.markup.tag.inside + 'interpolation-punctuation': { + pattern: /^\$\{|\}$/, + alias: 'punctuation' }, - 'punctuation': /^\s*=\s*['"]|['"]\s*$/, - 'attr-value': { - pattern: /.+/i, - inside: Prism.languages.css - } - }, - alias: 'language-css' - } - }, Prism.languages.markup.tag); - }; - Prism.languages.clike = { - 'comment': [ - { - pattern: /(^|[^\\])\/\*[\w\W]*?\*\//, - lookbehind: true + 'rest': Prism.languages.javascript + } }, - { - pattern: /(^|[^\\:])\/\/.*/, - lookbehind: true - } - ], - '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: true, - 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': /[{}[\];(),.:]/ - }; - - Prism.languages.javascript = Prism.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/, - // Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444) - 'function': /[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*(?=\()/i - }); - - Prism.languages.insertBefore('javascript', 'keyword', { - 'regex': { - pattern: /(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\\\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})]))/, - lookbehind: true + string: /[\s\S]+/ } - }); - - Prism.languages.insertBefore('javascript', 'class-name', { - 'template-string': { - pattern: /`(?:\\`|\\?[^`])*`/, + } + }); + if (Prism.languages.markup) { + Prism.languages.insertBefore('markup', 'tag', { + script: { + pattern: /[\w\W]*?<\/script>/i, inside: { - 'interpolation': { - pattern: /\$\{[^}]+\}/, - inside: { - 'interpolation-punctuation': { - pattern: /^\$\{|\}$/, - alias: 'punctuation' - }, - rest: Prism.languages.javascript - } + tag: { + pattern: /|<\/script>/i, + inside: Prism.languages.markup.tag.inside }, - 'string': /[\s\S]+/ - } + rest: Prism.languages.javascript + }, + alias: 'language-javascript' } }); - - if (Prism.languages.markup) { - Prism.languages.insertBefore('markup', 'tag', { - 'script': { - pattern: /[\w\W]*?<\/script>/i, - inside: { - 'tag': { - pattern: /|<\/script>/i, - inside: Prism.languages.markup.tag.inside - }, - rest: Prism.languages.javascript - }, - alias: 'language-javascript' - } - }); - } - - Prism.languages.js = Prism.languages.javascript; - Prism.languages.c = Prism.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 - }); - - Prism.languages.insertBefore('c', 'string', { - 'macro': { - // allow for multiline macro definitions - // spaces after the # character compile fine with gcc - pattern: /(^\s*)#\s*[a-z]+([^\r\n\\]|\\.|\\(?:\r\n?|\n))*/im, - lookbehind: true, - alias: 'property', - inside: { - // highlight the path of the include statement as a string - 'string': { - pattern: /(#\s*include\s*)(<.+?>|("|')(\\?.)+?\3)/, - lookbehind: true - } + } + Prism.languages.js = Prism.languages.javascript; + Prism.languages.c = Prism.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 + }); + Prism.languages.insertBefore('c', 'string', { + macro: { + pattern: /(^\s*)#\s*[a-z]+([^\r\n\\]|\\.|\\(?:\r\n?|\n))*/im, + lookbehind: true, + alias: 'property', + inside: { + string: { + pattern: /(#\s*include\s*)(<.+?>|("|')(\\?.)+?\3)/, + lookbehind: true } } - }); - - delete Prism.languages.c['class-name']; - delete Prism.languages.c['boolean']; - - Prism.languages.csharp = Prism.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 - }); - - Prism.languages.insertBefore('csharp', 'keyword', { - 'preprocessor': { - pattern: /(^\s*)#.*/m, - lookbehind: true + } + }); + delete Prism.languages.c['class-name']; + delete Prism.languages.c.boolean; + Prism.languages.csharp = Prism.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 + }); + Prism.languages.insertBefore('csharp', 'keyword', { + preprocessor: { + pattern: /(^\s*)#.*/m, + lookbehind: true + } + }); + Prism.languages.cpp = Prism.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/ + }); + Prism.languages.insertBefore('cpp', 'keyword', { + 'class-name': { + pattern: /(class\s+)[a-z0-9_]+/i, + lookbehind: true + } + }); + Prism.languages.java = Prism.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: true + } + }); + Prism.languages.php = Prism.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: true + } + }); + Prism.languages.insertBefore('php', 'class-name', { + 'shell-comment': { + pattern: /(^|[^\\])#.*/, + lookbehind: true, + alias: 'comment' + } + }); + Prism.languages.insertBefore('php', 'keyword', { + delimiter: /\?>|<\?(?:php)?/i, + variable: /\$\w+\b/i, + package: { + pattern: /(\\|namespace\s+|use\s+)[\w\\]+/, + lookbehind: true, + inside: { punctuation: /\\/ } + } + }); + Prism.languages.insertBefore('php', 'operator', { + property: { + pattern: /(->)[\w]+/, + lookbehind: true + } + }); + if (Prism.languages.markup) { + Prism.hooks.add('before-highlight', function (env) { + if (env.language !== 'php') { + return; } + env.tokenStack = []; + env.backupCode = env.code; + env.code = env.code.replace(/(?:<\?php|<\?)[\w\W]*?(?:\?>)/ig, function (match) { + env.tokenStack.push(match); + return '{{{PHP' + env.tokenStack.length + '}}}'; + }); }); - - Prism.languages.cpp = Prism.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/ - }); - - Prism.languages.insertBefore('cpp', 'keyword', { - 'class-name': { - pattern: /(class\s+)[a-z0-9_]+/i, - lookbehind: true + Prism.hooks.add('before-insert', function (env) { + if (env.language === 'php') { + env.code = env.backupCode; + delete env.backupCode; } }); - Prism.languages.java = Prism.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: true + Prism.hooks.add('after-highlight', function (env) { + if (env.language !== 'php') { + return; } - }); - /** - * Original by Aaron Harun: http://aahacreative.com/2012/07/31/php-syntax-highlighting-prism/ - * Modified by Miles Johnson: http://milesj.me - * - * Supports the following: - * - Extends clike syntax - * - Support for PHP 5.3+ (namespaces, traits, generators, etc) - * - Smarter constant and function matching - * - * Adds the following new token classes: - * constant, delimiter, variable, function, package - */ - - Prism.languages.php = Prism.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: true + for (var i = 0, t = void 0; t = env.tokenStack[i]; i++) { + env.highlightedCode = env.highlightedCode.replace('{{{PHP' + (i + 1) + '}}}', Prism.highlight(t, env.grammar, 'php').replace(/\$/g, '$$$$')); } + env.element.innerHTML = env.highlightedCode; }); - - // Shell-like comments are matched after strings, because they are less - // common than strings containing hashes... - Prism.languages.insertBefore('php', 'class-name', { - 'shell-comment': { - pattern: /(^|[^\\])#.*/, - lookbehind: true, - alias: 'comment' + Prism.hooks.add('wrap', function (env) { + if (env.language === 'php' && env.type === 'markup') { + env.content = env.content.replace(/(\{\{\{PHP[0-9]+\}\}\})/g, '$1'); } }); - - Prism.languages.insertBefore('php', 'keyword', { - 'delimiter': /\?>|<\?(?:php)?/i, - 'variable': /\$\w+\b/i, - 'package': { - pattern: /(\\|namespace\s+|use\s+)[\w\\]+/, - lookbehind: true, - inside: { - punctuation: /\\/ - } - } + Prism.languages.insertBefore('php', 'comment', { + markup: { + pattern: /<[^?]\/?(.*?)>/, + inside: Prism.languages.markup + }, + php: /\{\{\{PHP[0-9]+\}\}\}/ }); - - // Must be defined after the function pattern - Prism.languages.insertBefore('php', 'operator', { - 'property': { - pattern: /(->)[\w]+/, - lookbehind: true - } + } + Prism.languages.python = { + 'comment': { + pattern: /(^|[^\\])#.*/, + lookbehind: true + }, + 'string': /"""[\s\S]+?"""|'''[\s\S]+?'''|("|')(?:\\?.)*?\1/, + 'function': { + pattern: /((?:^|\s)def[ \t]+)[a-zA-Z_][a-zA-Z0-9_]*(?=\()/g, + lookbehind: true + }, + 'class-name': { + pattern: /(\bclass\s+)[a-z0-9_]+/i, + lookbehind: true + }, + '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 (Prism) { + Prism.languages.ruby = Prism.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/ }); - - // Add HTML support of the markup language exists - if (Prism.languages.markup) { - - // Tokenize all inline PHP blocks that are wrapped in - // This allows for easy PHP + markup highlighting - Prism.hooks.add('before-highlight', function (env) { - if (env.language !== 'php') { - return; - } - - env.tokenStack = []; - - env.backupCode = env.code; - env.code = env.code.replace(/(?:<\?php|<\?)[\w\W]*?(?:\?>)/ig, function (match) { - env.tokenStack.push(match); - - return '{{{PHP' + env.tokenStack.length + '}}}'; - }); - }); - - // Restore env.code for other plugins (e.g. line-numbers) - Prism.hooks.add('before-insert', function (env) { - if (env.language === 'php') { - env.code = env.backupCode; - delete env.backupCode; - } - }); - - // Re-insert the tokens after highlighting - Prism.hooks.add('after-highlight', function (env) { - if (env.language !== 'php') { - return; - } - - for (var i = 0, t; t = env.tokenStack[i]; i++) { - // The replace prevents $$, $&, $`, $', $n, $nn from being interpreted as special patterns - env.highlightedCode = env.highlightedCode.replace('{{{PHP' + (i + 1) + '}}}', Prism.highlight(t, env.grammar, 'php').replace(/\$/g, '$$$$')); - } - - env.element.innerHTML = env.highlightedCode; - }); - - // Wrap tokens in classes that are missing them - Prism.hooks.add('wrap', function (env) { - if (env.language === 'php' && env.type === 'markup') { - env.content = env.content.replace(/(\{\{\{PHP[0-9]+\}\}\})/g, "$1"); - } - }); - - // Add the rules before all others - Prism.languages.insertBefore('php', 'comment', { - 'markup': { - pattern: /<[^?]\/?(.*?)>/, - inside: Prism.languages.markup + var interpolation = { + pattern: /#\{[^}]+\}/, + inside: { + delimiter: { + pattern: /^#\{|\}$/, + alias: 'tag' }, - 'php': /\{\{\{PHP[0-9]+\}\}\}/ - }); - } - ; - Prism.languages.python = { - 'comment': { - pattern: /(^|[^\\])#.*/, - lookbehind: true - }, - 'string': /"""[\s\S]+?"""|'''[\s\S]+?'''|("|')(?:\\?.)*?\1/, - 'function': { - pattern: /((?:^|\s)def[ \t]+)[a-zA-Z_][a-zA-Z0-9_]*(?=\()/g, - lookbehind: true - }, - 'class-name': { - pattern: /(\bclass\s+)[a-z0-9_]+/i, - lookbehind: true - }, - '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': /[{}[\];(),.:]/ + rest: Prism.util.clone(Prism.languages.ruby) + } }; - - /** - * Original by Samuel Flores - * - * Adds the following new token classes: - * constant, builtin, variable, symbol, regex - */ - (function (Prism) { - Prism.languages.ruby = Prism.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 interpolation = { - pattern: /#\{[^}]+\}/, - inside: { - 'delimiter': { - pattern: /^#\{|\}$/, - alias: 'tag' - }, - rest: Prism.util.clone(Prism.languages.ruby) - } - }; - - Prism.languages.insertBefore('ruby', 'keyword', { - 'regex': [ - { - pattern: /%r([^a-zA-Z0-9\s\{\(\[<])(?:[^\\]|\\[\s\S])*?\1[gim]{0,3}/, - inside: { - 'interpolation': interpolation - } - }, - { - pattern: /%r\((?:[^()\\]|\\[\s\S])*\)[gim]{0,3}/, - inside: { - 'interpolation': interpolation - } - }, - { - // Here we need to specifically allow interpolation - pattern: /%r\{(?:[^#{}\\]|#(?:\{[^}]+\})?|\\[\s\S])*\}[gim]{0,3}/, - inside: { - 'interpolation': interpolation - } - }, - { - pattern: /%r\[(?:[^\[\]\\]|\\[\s\S])*\][gim]{0,3}/, - inside: { - 'interpolation': interpolation - } - }, - { - pattern: /%r<(?:[^<>\\]|\\[\s\S])*>[gim]{0,3}/, - inside: { - 'interpolation': interpolation - } - }, - { - pattern: /(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/, - lookbehind: true - } - ], - 'variable': /[@$]+[a-zA-Z_][a-zA-Z_0-9]*(?:[?!]|\b)/, - 'symbol': /:[a-zA-Z_][a-zA-Z_0-9]*(?:[?!]|\b)/ - }); - - Prism.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)/ - }); - - Prism.languages.ruby.string = [ + Prism.languages.insertBefore('ruby', 'keyword', { + regex: [ { - pattern: /%[qQiIwWxs]?([^a-zA-Z0-9\s\{\(\[<])(?:[^\\]|\\[\s\S])*?\1/, - inside: { - 'interpolation': interpolation - } + pattern: /%r([^a-zA-Z0-9\s\{\(\[<])(?:[^\\]|\\[\s\S])*?\1[gim]{0,3}/, + inside: { interpolation: interpolation } }, { - pattern: /%[qQiIwWxs]?\((?:[^()\\]|\\[\s\S])*\)/, - inside: { - 'interpolation': interpolation - } + pattern: /%r\((?:[^()\\]|\\[\s\S])*\)[gim]{0,3}/, + inside: { interpolation: interpolation } }, { - // Here we need to specifically allow interpolation - pattern: /%[qQiIwWxs]?\{(?:[^#{}\\]|#(?:\{[^}]+\})?|\\[\s\S])*\}/, - inside: { - 'interpolation': interpolation - } + pattern: /%r\{(?:[^#{}\\]|#(?:\{[^}]+\})?|\\[\s\S])*\}[gim]{0,3}/, + inside: { interpolation: interpolation } }, { - pattern: /%[qQiIwWxs]?\[(?:[^\[\]\\]|\\[\s\S])*\]/, - inside: { - 'interpolation': interpolation - } + pattern: /%r\[(?:[^\[\]\\]|\\[\s\S])*\][gim]{0,3}/, + inside: { interpolation: interpolation } }, { - pattern: /%[qQiIwWxs]?<(?:[^<>\\]|\\[\s\S])*>/, - inside: { - 'interpolation': interpolation - } + pattern: /%r<(?:[^<>\\]|\\[\s\S])*>[gim]{0,3}/, + inside: { interpolation: interpolation } }, { - pattern: /("|')(#\{[^}]+\}|\\(?:\r?\n|\r)|\\?.)*?\1/, - inside: { - 'interpolation': interpolation - } + pattern: /(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/, + lookbehind: true } - ]; - }(Prism)); + ], + variable: /[@$]+[a-zA-Z_][a-zA-Z_0-9]*(?:[?!]|\b)/, + symbol: /:[a-zA-Z_][a-zA-Z_0-9]*(?:[?!]|\b)/ + }); + Prism.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)/ + }); + Prism.languages.ruby.string = [ + { + pattern: /%[qQiIwWxs]?([^a-zA-Z0-9\s\{\(\[<])(?:[^\\]|\\[\s\S])*?\1/, + inside: { interpolation: interpolation } + }, + { + pattern: /%[qQiIwWxs]?\((?:[^()\\]|\\[\s\S])*\)/, + inside: { interpolation: interpolation } + }, + { + pattern: /%[qQiIwWxs]?\{(?:[^#{}\\]|#(?:\{[^}]+\})?|\\[\s\S])*\}/, + inside: { interpolation: interpolation } + }, + { + pattern: /%[qQiIwWxs]?\[(?:[^\[\]\\]|\\[\s\S])*\]/, + inside: { interpolation: interpolation } + }, + { + pattern: /%[qQiIwWxs]?<(?:[^<>\\]|\\[\s\S])*>/, + inside: { interpolation: interpolation } + }, + { + pattern: /("|')(#\{[^}]+\}|\\(?:\r?\n|\r)|\\?.)*?\1/, + inside: { interpolation: interpolation } + } + ]; + }(Prism)); - // ------------------ End wrap - return Prism; + function isCodeSample(elm) { + return elm && elm.nodeName === 'PRE' && elm.className.indexOf('language-') !== -1; } -); - -/*eslint-enable */ - -/** - * Utils.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.codesample.util.Utils', - [ - ], - function () { - function isCodeSample(elm) { - return elm && elm.nodeName === 'PRE' && elm.className.indexOf('language-') !== -1; - } - - function trimArg(predicateFn) { - return function (arg1, arg2) { - return predicateFn(arg2); - }; - } - - return { - isCodeSample: isCodeSample, - trimArg: trimArg + function trimArg(predicateFn) { + return function (arg1, arg2) { + return predicateFn(arg2); }; } -); -/** - * CodeSample.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.codesample.core.CodeSample', - [ - 'tinymce.core.dom.DOMUtils', - 'tinymce.plugins.codesample.core.Prism', - 'tinymce.plugins.codesample.util.Utils' - ], - function (DOMUtils, Prism, Utils) { - var getSelectedCodeSample = function (editor) { - var node = editor.selection.getNode(); - - if (Utils.isCodeSample(node)) { - return node; - } - - return null; - }; - - var insertCodeSample = function (editor, language, code) { - editor.undoManager.transact(function () { - var node = getSelectedCodeSample(editor); - - code = DOMUtils.DOM.encode(code); - - if (node) { - editor.dom.setAttrib(node, 'class', 'language-' + language); - node.innerHTML = code; - Prism.highlightElement(node); - editor.selection.select(node); - } else { - editor.insertContent('
' + code + '
'); - editor.selection.select(editor.$('#__new').removeAttr('id')[0]); - } - }); - }; + var $_5fv1wu9nje5nvbm0 = { + isCodeSample: isCodeSample, + trimArg: trimArg + }; - var getCurrentCode = function (editor) { + var getSelectedCodeSample = function (editor) { + var node = editor.selection.getNode(); + if ($_5fv1wu9nje5nvbm0.isCodeSample(node)) { + return node; + } + return null; + }; + var insertCodeSample = function (editor, language, code) { + editor.undoManager.transact(function () { var node = getSelectedCodeSample(editor); - + code = DOMUtils.DOM.encode(code); if (node) { - return node.textContent; + editor.dom.setAttrib(node, 'class', 'language-' + language); + node.innerHTML = code; + Prism.highlightElement(node); + editor.selection.select(node); + } else { + editor.insertContent('
' + code + '
'); + editor.selection.select(editor.$('#__new').removeAttr('id')[0]); } + }); + }; + var getCurrentCode = function (editor) { + var node = getSelectedCodeSample(editor); + if (node) { + return node.textContent; + } + return ''; + }; + var $_eww01i9lje5nvbkz = { + getSelectedCodeSample: getSelectedCodeSample, + insertCodeSample: insertCodeSample, + getCurrentCode: getCurrentCode + }; - return ''; - }; - - return { - getSelectedCodeSample: getSelectedCodeSample, - insertCodeSample: insertCodeSample, - getCurrentCode: getCurrentCode - }; - } -); -/** - * Languages.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.codesample.core.Languages', - [ - 'tinymce.plugins.codesample.api.Settings', - 'tinymce.plugins.codesample.core.CodeSample' - ], - function (Settings, CodeSample) { - var getLanguages = function (editor) { - var defaultLanguages = [ - { 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' } - ]; - - var customLanguages = Settings.getLanguages(editor); - return customLanguages ? customLanguages : defaultLanguages; - }; - - var getCurrentLanguage = function (editor) { - var matches, node = CodeSample.getSelectedCodeSample(editor); - - if (node) { - matches = node.className.match(/language-(\w+)/); - return matches ? matches[1] : ''; + var getLanguages$1 = function (editor) { + var defaultLanguages = [ + { + 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' } + ]; + var customLanguages = $_b3qanp9jje5nvbkw.getLanguages(editor); + return customLanguages ? customLanguages : defaultLanguages; + }; + var getCurrentLanguage = function (editor) { + var matches; + var node = $_eww01i9lje5nvbkz.getSelectedCodeSample(editor); + if (node) { + matches = node.className.match(/language-(\w+)/); + return matches ? matches[1] : ''; + } + return ''; + }; + var $_cibmoi9oje5nvbm1 = { + getLanguages: getLanguages$1, + getCurrentLanguage: getCurrentLanguage + }; - return ''; - }; - - return { - getLanguages: getLanguages, - getCurrentLanguage: getCurrentLanguage - }; - } -); -/** - * Dialog.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.codesample.ui.Dialog', - [ - 'tinymce.plugins.codesample.api.Settings', - 'tinymce.plugins.codesample.core.CodeSample', - 'tinymce.plugins.codesample.core.Languages' - ], - function (Settings, CodeSample, Languages) { - return { - open: function (editor) { - var minWidth = Settings.getDialogMinWidth(editor); - var minHeight = Settings.getDialogMinHeight(editor); - var currentLanguage = Languages.getCurrentLanguage(editor); - var currentLanguages = Languages.getLanguages(editor); - var currentCode = CodeSample.getCurrentCode(editor); - - editor.windowManager.open({ - title: "Insert/Edit code sample", - minWidth: minWidth, - minHeight: minHeight, - layout: 'flex', - direction: 'column', - align: 'stretch', - body: [ - { - type: 'listbox', - name: 'language', - label: 'Language', - maxWidth: 200, - value: currentLanguage, - values: currentLanguages - }, - - { - type: 'textbox', - name: 'code', - multiline: true, - spellcheck: false, - ariaLabel: 'Code view', - flex: 1, - style: 'direction: ltr; text-align: left', - classes: 'monospace', - value: currentCode, - autofocus: true - } - ], - onSubmit: function (e) { - CodeSample.insertCodeSample(editor, e.data.language, e.data.code); + var $_9aozjz9ije5nvbkv = { + open: function (editor) { + var minWidth = $_b3qanp9jje5nvbkw.getDialogMinWidth(editor); + var minHeight = $_b3qanp9jje5nvbkw.getDialogMinHeight(editor); + var currentLanguage = $_cibmoi9oje5nvbm1.getCurrentLanguage(editor); + var currentLanguages = $_cibmoi9oje5nvbm1.getLanguages(editor); + var currentCode = $_eww01i9lje5nvbkz.getCurrentCode(editor); + editor.windowManager.open({ + title: 'Insert/Edit code sample', + minWidth: minWidth, + minHeight: minHeight, + layout: 'flex', + direction: 'column', + align: 'stretch', + body: [ + { + type: 'listbox', + name: 'language', + label: 'Language', + maxWidth: 200, + value: currentLanguage, + values: currentLanguages + }, + { + type: 'textbox', + name: 'code', + multiline: true, + spellcheck: false, + ariaLabel: 'Code view', + flex: 1, + style: 'direction: ltr; text-align: left', + classes: 'monospace', + value: currentCode, + autofocus: true } - }); - } - }; - } -); -/** - * Commands.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.codesample.api.Commands', - [ - 'tinymce.plugins.codesample.ui.Dialog', - 'tinymce.plugins.codesample.util.Utils' - ], - function (Dialog, Utils) { - var register = function (editor) { - editor.addCommand('codesample', function () { - var node = editor.selection.getNode(); - if (editor.selection.isCollapsed() || Utils.isCodeSample(node)) { - Dialog.open(editor); - } else { - editor.formatter.toggle('code'); + ], + onSubmit: function (e) { + $_eww01i9lje5nvbkz.insertCodeSample(editor, e.data.language, e.data.code); } }); - }; - - return { - register: register - }; - } -); -/** - * FilterContent.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.codesample.core.FilterContent', - [ - 'tinymce.plugins.codesample.core.Prism', - 'tinymce.plugins.codesample.util.Utils' - ], - function (Prism, Utils) { - var setup = function (editor) { - var $ = editor.$; - - editor.on('PreProcess', function (e) { - $('pre[contenteditable=false]', e.node). - filter(Utils.trimArg(Utils.isCodeSample)). - each(function (idx, elm) { - var $elm = $(elm), code = elm.textContent; - - $elm.attr('class', $.trim($elm.attr('class'))); - $elm.removeAttr('contentEditable'); + } + }; - $elm.empty().append($('').each(function () { - // Needs to be textContent since innerText produces BR:s - this.textContent = code; - })); - }); + var register = function (editor) { + editor.addCommand('codesample', function () { + var node = editor.selection.getNode(); + if (editor.selection.isCollapsed() || $_5fv1wu9nje5nvbm0.isCodeSample(node)) { + $_9aozjz9ije5nvbkv.open(editor); + } else { + editor.formatter.toggle('code'); + } + }); + }; + var $_1sbohl9hje5nvbkt = { register: register }; + + var setup = function (editor) { + var $ = editor.$; + editor.on('PreProcess', function (e) { + $('pre[contenteditable=false]', e.node).filter($_5fv1wu9nje5nvbm0.trimArg($_5fv1wu9nje5nvbm0.isCodeSample)).each(function (idx, elm) { + var $elm = $(elm), code = elm.textContent; + $elm.attr('class', $.trim($elm.attr('class'))); + $elm.removeAttr('contentEditable'); + $elm.empty().append($('').each(function () { + this.textContent = code; + })); }); - - editor.on('SetContent', function () { - var unprocessedCodeSamples = $('pre').filter(Utils.trimArg(Utils.isCodeSample)).filter(function (idx, elm) { - return elm.contentEditable !== "false"; - }); - - if (unprocessedCodeSamples.length) { - editor.undoManager.transact(function () { - unprocessedCodeSamples.each(function (idx, elm) { - $(elm).find('br').each(function (idx, elm) { - elm.parentNode.replaceChild(editor.getDoc().createTextNode('\n'), elm); - }); - - elm.contentEditable = false; - elm.innerHTML = editor.dom.encode(elm.textContent); - Prism.highlightElement(elm); - elm.className = $.trim(elm.className); + }); + editor.on('SetContent', function () { + var unprocessedCodeSamples = $('pre').filter($_5fv1wu9nje5nvbm0.trimArg($_5fv1wu9nje5nvbm0.isCodeSample)).filter(function (idx, elm) { + return elm.contentEditable !== 'false'; + }); + if (unprocessedCodeSamples.length) { + editor.undoManager.transact(function () { + unprocessedCodeSamples.each(function (idx, elm) { + $(elm).find('br').each(function (idx, elm) { + elm.parentNode.replaceChild(editor.getDoc().createTextNode('\n'), elm); }); + elm.contentEditable = false; + elm.innerHTML = editor.dom.encode(elm.textContent); + Prism.highlightElement(elm); + elm.className = $.trim(elm.className); }); - } - }); - }; - - return { - setup: setup - }; - } -); -/** - * LoadCss.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.codesample.core.LoadCss', - [ - 'tinymce.plugins.codesample.api.Settings' - ], - function (Settings) { - // Todo: use a proper css loader here - var loadCss = function (editor, pluginUrl, addedInlineCss, addedCss) { - var linkElm, contentCss = Settings.getContentCss(editor); - - if (editor.inline && addedInlineCss.get()) { - return; - } - - if (!editor.inline && addedCss.get()) { - return; - } - - if (editor.inline) { - addedInlineCss.set(true); - } else { - addedCss.set(true); - } - - if (contentCss !== false) { - linkElm = editor.dom.create('link', { - rel: 'stylesheet', - href: contentCss ? contentCss : pluginUrl + '/css/prism.css' }); - - editor.getDoc().getElementsByTagName('head')[0].appendChild(linkElm); } - }; - - return { - loadCss: loadCss - }; - } -); -/** - * Buttons.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.codesample.ui.Buttons', - [ - ], - function () { - var register = function (editor) { - editor.addButton('codesample', { - cmd: 'codesample', - title: 'Insert/Edit code sample' - }); + }); + }; + var $_1nsa5o9pje5nvbm3 = { setup: setup }; - editor.addMenuItem('codesample', { - cmd: 'codesample', - text: 'Code sample', - icon: 'codesample' + var loadCss = function (editor, pluginUrl, addedInlineCss, addedCss) { + var linkElm; + var contentCss = $_b3qanp9jje5nvbkw.getContentCss(editor); + if (editor.inline && addedInlineCss.get()) { + return; + } + if (!editor.inline && addedCss.get()) { + return; + } + if (editor.inline) { + addedInlineCss.set(true); + } else { + addedCss.set(true); + } + if (contentCss !== false) { + linkElm = editor.dom.create('link', { + rel: 'stylesheet', + href: contentCss ? contentCss : pluginUrl + '/css/prism.css' }); - }; + editor.getDoc().getElementsByTagName('head')[0].appendChild(linkElm); + } + }; + var $_2t6ph69qje5nvbm4 = { loadCss: loadCss }; - return { - register: register - }; + var register$1 = function (editor) { + editor.addButton('codesample', { + cmd: 'codesample', + title: 'Insert/Edit code sample' + }); + editor.addMenuItem('codesample', { + cmd: 'codesample', + text: 'Code sample', + icon: 'codesample' + }); + }; + var $_276kpq9rje5nvbm5 = { register: register$1 }; + + var addedInlineCss = Cell(false); + PluginManager.add('codesample', function (editor, pluginUrl) { + var addedCss = Cell(false); + $_1nsa5o9pje5nvbm3.setup(editor); + $_276kpq9rje5nvbm5.register(editor); + $_1sbohl9hje5nvbkt.register(editor); + editor.on('init', function () { + $_2t6ph69qje5nvbm4.loadCss(editor, pluginUrl, addedInlineCss, addedCss); + }); + editor.on('dblclick', function (ev) { + if ($_5fv1wu9nje5nvbm0.isCodeSample(ev.target)) { + $_9aozjz9ije5nvbkv.open(editor); + } + }); + }); + function Plugin () { } -); -/** - * Plugin.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.codesample.Plugin', - [ - 'ephox.katamari.api.Cell', - 'tinymce.core.PluginManager', - 'tinymce.plugins.codesample.api.Commands', - 'tinymce.plugins.codesample.core.FilterContent', - 'tinymce.plugins.codesample.core.LoadCss', - 'tinymce.plugins.codesample.ui.Buttons' - ], - function (Cell, PluginManager, Commands, FilterContent, LoadCss, Buttons) { - var addedInlineCss = Cell(false); - PluginManager.add('codesample', function (editor, pluginUrl) { - var addedCss = Cell(false); + return Plugin; - FilterContent.setup(editor); - Buttons.register(editor); - Commands.register(editor); - - editor.on('init', function () { - LoadCss.loadCss(editor, pluginUrl, addedInlineCss, addedCss); - }); - }); - - return function () { }; - } -); -dem('tinymce.plugins.codesample.Plugin')(); +}()); })(); diff --git a/tinymce_4/static/tinymce_4/tinymce/plugins/codesample/plugin.min.js b/tinymce_4/static/tinymce_4/tinymce/plugins/codesample/plugin.min.js index 607f766..f8bdb3f 100644 --- a/tinymce_4/static/tinymce_4/tinymce/plugins/codesample/plugin.min.js +++ b/tinymce_4/static/tinymce_4/tinymce/plugins/codesample/plugin.min.js @@ -1 +1 @@ -!function(){var a={},b=function(b){for(var c=a[b],e=c.deps,f=c.defn,g=e.length,h=new Array(g),i=0;ia.length)break a;if(!(q instanceof e)){k.lastIndex=0;var r=k.exec(q);if(r){m&&(n=r[1].length);var s=r.index-1+n,r=r[0].slice(n),t=r.length,u=s+t,v=q.slice(0,s+1),w=q.slice(u+1),x=[p,1];v&&x.push(v);var y=new e(h,l?c.tokenize(r,l):r,o);x.push(y),w&&x.push(w),Array.prototype.splice.apply(f,x)}}}}}return f},hooks:{all:{},add:function(a,b){var d=c.hooks.all;d[a]=d[a]||[],d[a].push(b)},run:function(a,b){var d=c.hooks.all[a];if(d&&d.length)for(var e,f=0;e=d[f++];)e(b)}}},d=c.Token=function(a,b,c){this.type=a,this.content=b,this.alias=c};if(d.stringify=function(a,b,e){if("string"==typeof a)return a;if("Array"===c.util.type(a))return a.map(function(c){return d.stringify(c,b,a)}).join("");var f={type:a.type,content:d.stringify(a.content,b,e),tag:"span",classes:["token",a.type],attributes:{},language:b,parent:e};if("comment"==f.type&&(f.attributes.spellcheck="true"),a.alias){var g="Array"===c.util.type(a.alias)?a.alias:[a.alias];Array.prototype.push.apply(f.classes,g)}c.hooks.run("wrap",f);var h="";for(var i in f.attributes)h+=(h?" ":"")+i+'="'+(f.attributes[i]||"")+'"';return"<"+f.tag+' class="'+f.classes.join(" ")+'" '+h+">"+f.content+""},!b.document)return b.addEventListener?(b.addEventListener("message",function(a){var d=JSON.parse(a.data),e=d.language,f=d.code,g=d.immediateClose;b.postMessage(c.highlight(f,c.languages[e],e)),g&&b.close()},!1),b.Prism):b.Prism}();return"undefined"!=typeof module&&module.exports&&(module.exports=c),"undefined"!=typeof global&&(global.Prism=c),c.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},c.hooks.add("wrap",function(a){"entity"===a.type&&(a.attributes.title=a.content.replace(/&/,"&"))}),c.languages.xml=c.languages.markup,c.languages.html=c.languages.markup,c.languages.mathml=c.languages.markup,c.languages.svg=c.languages.markup,c.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:/[(){};:]/},c.languages.css.atrule.inside.rest=c.util.clone(c.languages.css),c.languages.markup&&(c.languages.insertBefore("markup","tag",{style:{pattern:/[\w\W]*?<\/style>/i,inside:{tag:{pattern:/|<\/style>/i,inside:c.languages.markup.tag.inside},rest:c.languages.css},alias:"language-css"}}),c.languages.insertBefore("inside","attr-value",{"style-attr":{pattern:/\s*style=("|').*?\1/i,inside:{"attr-name":{pattern:/^\s*style/i,inside:c.languages.markup.tag.inside},punctuation:/^\s*=\s*['"]|['"]\s*$/,"attr-value":{pattern:/.+/i,inside:c.languages.css}},alias:"language-css"}},c.languages.markup.tag)),c.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:/[{}[\];(),.:]/},c.languages.javascript=c.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}),c.languages.insertBefore("javascript","keyword",{regex:{pattern:/(^|[^\/])\/(?!\/)(\[.+?]|\\.|[^\/\\\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})]))/,lookbehind:!0}}),c.languages.insertBefore("javascript","class-name",{"template-string":{pattern:/`(?:\\`|\\?[^`])*`/,inside:{interpolation:{pattern:/\$\{[^}]+\}/,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:c.languages.javascript}},string:/[\s\S]+/}}}),c.languages.markup&&c.languages.insertBefore("markup","tag",{script:{pattern:/[\w\W]*?<\/script>/i,inside:{tag:{pattern:/|<\/script>/i,inside:c.languages.markup.tag.inside},rest:c.languages.javascript},alias:"language-javascript"}}),c.languages.js=c.languages.javascript,c.languages.c=c.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}),c.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 c.languages.c["class-name"],delete c.languages.c["boolean"],c.languages.csharp=c.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}),c.languages.insertBefore("csharp","keyword",{preprocessor:{pattern:/(^\s*)#.*/m,lookbehind:!0}}),c.languages.cpp=c.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/}),c.languages.insertBefore("cpp","keyword",{"class-name":{pattern:/(class\s+)[a-z0-9_]+/i,lookbehind:!0}}),c.languages.java=c.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}}),c.languages.php=c.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}}),c.languages.insertBefore("php","class-name",{"shell-comment":{pattern:/(^|[^\\])#.*/,lookbehind:!0,alias:"comment"}}),c.languages.insertBefore("php","keyword",{delimiter:/\?>|<\?(?:php)?/i,variable:/\$\w+\b/i,"package":{pattern:/(\\|namespace\s+|use\s+)[\w\\]+/,lookbehind:!0,inside:{punctuation:/\\/}}}),c.languages.insertBefore("php","operator",{property:{pattern:/(->)[\w]+/,lookbehind:!0}}),c.languages.markup&&(c.hooks.add("before-highlight",function(a){"php"===a.language&&(a.tokenStack=[],a.backupCode=a.code,a.code=a.code.replace(/(?:<\?php|<\?)[\w\W]*?(?:\?>)/gi,function(b){return a.tokenStack.push(b),"{{{PHP"+a.tokenStack.length+"}}}"}))}),c.hooks.add("before-insert",function(a){"php"===a.language&&(a.code=a.backupCode,delete a.backupCode)}),c.hooks.add("after-highlight",function(a){if("php"===a.language){for(var b,d=0;b=a.tokenStack[d];d++)a.highlightedCode=a.highlightedCode.replace("{{{PHP"+(d+1)+"}}}",c.highlight(b,a.grammar,"php").replace(/\$/g,"$$$$"));a.element.innerHTML=a.highlightedCode}}),c.hooks.add("wrap",function(a){"php"===a.language&&"markup"===a.type&&(a.content=a.content.replace(/(\{\{\{PHP[0-9]+\}\}\})/g,'$1'))}),c.languages.insertBefore("php","comment",{markup:{pattern:/<[^?]\/?(.*?)>/,inside:c.languages.markup},php:/\{\{\{PHP[0-9]+\}\}\}/})),c.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(a){a.languages.ruby=a.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 b={pattern:/#\{[^}]+\}/,inside:{delimiter:{pattern:/^#\{|\}$/,alias:"tag"},rest:a.util.clone(a.languages.ruby)}};a.languages.insertBefore("ruby","keyword",{regex:[{pattern:/%r([^a-zA-Z0-9\s\{\(\[<])(?:[^\\]|\\[\s\S])*?\1[gim]{0,3}/,inside:{interpolation:b}},{pattern:/%r\((?:[^()\\]|\\[\s\S])*\)[gim]{0,3}/,inside:{interpolation:b}},{pattern:/%r\{(?:[^#{}\\]|#(?:\{[^}]+\})?|\\[\s\S])*\}[gim]{0,3}/,inside:{interpolation:b}},{pattern:/%r\[(?:[^\[\]\\]|\\[\s\S])*\][gim]{0,3}/,inside:{interpolation:b}},{pattern:/%r<(?:[^<>\\]|\\[\s\S])*>[gim]{0,3}/,inside:{interpolation:b}},{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)/}),a.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)/}),a.languages.ruby.string=[{pattern:/%[qQiIwWxs]?([^a-zA-Z0-9\s\{\(\[<])(?:[^\\]|\\[\s\S])*?\1/,inside:{interpolation:b}},{pattern:/%[qQiIwWxs]?\((?:[^()\\]|\\[\s\S])*\)/,inside:{interpolation:b}},{pattern:/%[qQiIwWxs]?\{(?:[^#{}\\]|#(?:\{[^}]+\})?|\\[\s\S])*\}/,inside:{interpolation:b}},{pattern:/%[qQiIwWxs]?\[(?:[^\[\]\\]|\\[\s\S])*\]/,inside:{interpolation:b}},{pattern:/%[qQiIwWxs]?<(?:[^<>\\]|\\[\s\S])*>/,inside:{interpolation:b}},{pattern:/("|')(#\{[^}]+\}|\\(?:\r?\n|\r)|\\?.)*?\1/,inside:{interpolation:b}}]}(c),c}),g("9",[],function(){function a(a){return a&&"PRE"===a.nodeName&&a.className.indexOf("language-")!==-1}function b(a){return function(b,c){return a(c)}}return{isCodeSample:a,trimArg:b}}),g("d",["c","a","9"],function(a,b,c){var d=function(a){var b=a.selection.getNode();return c.isCodeSample(b)?b:null},e=function(c,e,f){c.undoManager.transact(function(){var g=d(c);f=a.DOM.encode(f),g?(c.dom.setAttrib(g,"class","language-"+e),g.innerHTML=f,b.highlightElement(g),c.selection.select(g)):(c.insertContent('
'+f+"
"),c.selection.select(c.$("#__new").removeAttr("id")[0]))})},f=function(a){var b=d(a);return b?b.textContent:""};return{getSelectedCodeSample:d,insertCodeSample:e,getCurrentCode:f}}),g("e",["b","d"],function(a,b){var c=function(b){var c=[{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"}],d=a.getLanguages(b);return d?d:c},d=function(a){var c,d=b.getSelectedCodeSample(a);return d?(c=d.className.match(/language-(\w+)/),c?c[1]:""):""};return{getLanguages:c,getCurrentLanguage:d}}),g("8",["b","d","e"],function(a,b,c){return{open:function(d){var e=a.getDialogMinWidth(d),f=a.getDialogMinHeight(d),g=c.getCurrentLanguage(d),h=c.getLanguages(d),i=b.getCurrentCode(d);d.windowManager.open({title:"Insert/Edit code sample",minWidth:e,minHeight:f,layout:"flex",direction:"column",align:"stretch",body:[{type:"listbox",name:"language",label:"Language",maxWidth:200,value:g,values:h},{type:"textbox",name:"code",multiline:!0,spellcheck:!1,ariaLabel:"Code view",flex:1,style:"direction: ltr; text-align: left",classes:"monospace",value:i,autofocus:!0}],onSubmit:function(a){b.insertCodeSample(d,a.data.language,a.data.code)}})}}}),g("3",["8","9"],function(a,b){var c=function(c){c.addCommand("codesample",function(){var d=c.selection.getNode();c.selection.isCollapsed()||b.isCodeSample(d)?a.open(c):c.formatter.toggle("code")})};return{register:c}}),g("4",["a","9"],function(a,b){var c=function(c){var d=c.$;c.on("PreProcess",function(a){d("pre[contenteditable=false]",a.node).filter(b.trimArg(b.isCodeSample)).each(function(a,b){var c=d(b),e=b.textContent;c.attr("class",d.trim(c.attr("class"))),c.removeAttr("contentEditable"),c.empty().append(d("").each(function(){this.textContent=e}))})}),c.on("SetContent",function(){var e=d("pre").filter(b.trimArg(b.isCodeSample)).filter(function(a,b){return"false"!==b.contentEditable});e.length&&c.undoManager.transact(function(){e.each(function(b,e){d(e).find("br").each(function(a,b){b.parentNode.replaceChild(c.getDoc().createTextNode("\n"),b)}),e.contentEditable=!1,e.innerHTML=c.dom.encode(e.textContent),a.highlightElement(e),e.className=d.trim(e.className)})})})};return{setup:c}}),g("5",["b"],function(a){var b=function(b,c,d,e){var f,g=a.getContentCss(b);b.inline&&d.get()||!b.inline&&e.get()||(b.inline?d.set(!0):e.set(!0),g!==!1&&(f=b.dom.create("link",{rel:"stylesheet",href:g?g:c+"/css/prism.css"}),b.getDoc().getElementsByTagName("head")[0].appendChild(f)))};return{loadCss:b}}),g("6",[],function(){var a=function(a){a.addButton("codesample",{cmd:"codesample",title:"Insert/Edit code sample"}),a.addMenuItem("codesample",{cmd:"codesample",text:"Code sample",icon:"codesample"})};return{register:a}}),g("0",["1","2","3","4","5","6"],function(a,b,c,d,e,f){var g=a(!1);return b.add("codesample",function(b,h){var i=a(!1);d.setup(b),f.register(b),c.register(b),b.on("init",function(){e.loadCss(b,h,g,i)})}),function(){}}),d("0")()}(); \ No newline at end of file +!function(){"use strict";var e=function(t){var a=t,n=function(){return a};return{get:n,set:function(e){a=e},clone:function(){return e(n())}}},t=tinymce.util.Tools.resolve("tinymce.PluginManager"),a=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),n=function(e){return e.settings.codesample_content_css},i=function(e){return e.settings.codesample_languages},r=function(e){return Math.min(a.DOM.getViewPort().w,e.getParam("codesample_dialog_width",800))},s=function(e){return Math.min(a.DOM.getViewPort().w,e.getParam("codesample_dialog_height",650))},o={},l=void 0!==o?o:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},c=function(){var e=/\blang(?:uage)?-(?!\*)(\w+)\b/i,t=l.Prism={util:{encode:function(e){return e instanceof a?new a(e.type,t.util.encode(e.content),e.alias):"Array"===t.util.type(e)?e.map(t.util.encode):e.replace(/&/g,"&").replace(/e.length)break e;if(!(m instanceof i)){u.lastIndex=0;var b=u.exec(m);if(b){d&&(p=b[1].length);var y=b.index-1+p,v=y+(b=b[0].slice(p)).length,k=m.slice(0,y+1),w=m.slice(v+1),x=[h,1];k&&x.push(k);var S=new i(o,g?t.tokenize(b,g):b,f);x.push(S),w&&x.push(w),Array.prototype.splice.apply(r,x)}}}}}return r},hooks:{all:{},add:function(e,a){var n=t.hooks.all;n[e]=n[e]||[],n[e].push(a)},run:function(e,a){var n=t.hooks.all[e];if(n&&n.length)for(var i=0,r=void 0;r=n[i++];)r(a)}}},a=t.Token=function(e,t,a){this.type=e,this.content=t,this.alias=a};if(a.stringify=function(e,n,i){if("string"==typeof e)return e;if("Array"===t.util.type(e))return e.map(function(t){return a.stringify(t,n,e)}).join("");var r={type:e.type,content:a.stringify(e.content,n,i),tag:"span",classes:["token",e.type],attributes:{},language:n,parent:i};if("comment"===r.type&&(r.attributes.spellcheck="true"),e.alias){var s="Array"===t.util.type(e.alias)?e.alias:[e.alias];Array.prototype.push.apply(r.classes,s)}t.hooks.run("wrap",r);var o="";for(var l in r.attributes)o+=(o?" ":"")+l+'="'+(r.attributes[l]||"")+'"';return"<"+r.tag+' class="'+r.classes.join(" ")+'" '+o+">"+r.content+""},!l.document)return l.addEventListener?(l.addEventListener("message",function(e){var a=JSON.parse(e.data),n=a.language,i=a.code,r=a.immediateClose;l.postMessage(t.highlight(i,t.languages[n],n)),r&&l.close()},!1),l.Prism):l.Prism}();"undefined"!=typeof module&&module.exports&&(module.exports=c),"undefined"!=typeof global&&(global.Prism=c),c.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},c.hooks.add("wrap",function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&/,"&"))}),c.languages.xml=c.languages.markup,c.languages.html=c.languages.markup,c.languages.mathml=c.languages.markup,c.languages.svg=c.languages.markup,c.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:/[(){};:]/},c.languages.css.atrule.inside.rest=c.util.clone(c.languages.css),c.languages.markup&&(c.languages.insertBefore("markup","tag",{style:{pattern:/[\w\W]*?<\/style>/i,inside:{tag:{pattern:/|<\/style>/i,inside:c.languages.markup.tag.inside},rest:c.languages.css},alias:"language-css"}}),c.languages.insertBefore("inside","attr-value",{"style-attr":{pattern:/\s*style=("|').*?\1/i,inside:{"attr-name":{pattern:/^\s*style/i,inside:c.languages.markup.tag.inside},punctuation:/^\s*=\s*['"]|['"]\s*$/,"attr-value":{pattern:/.+/i,inside:c.languages.css}},alias:"language-css"}},c.languages.markup.tag)),c.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:/[{}[\];(),.:]/},c.languages.javascript=c.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}),c.languages.insertBefore("javascript","keyword",{regex:{pattern:/(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\\\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})]))/,lookbehind:!0}}),c.languages.insertBefore("javascript","class-name",{"template-string":{pattern:/`(?:\\`|\\?[^`])*`/,inside:{interpolation:{pattern:/\$\{[^}]+\}/,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:c.languages.javascript}},string:/[\s\S]+/}}}),c.languages.markup&&c.languages.insertBefore("markup","tag",{script:{pattern:/[\w\W]*?<\/script>/i,inside:{tag:{pattern:/|<\/script>/i,inside:c.languages.markup.tag.inside},rest:c.languages.javascript},alias:"language-javascript"}}),c.languages.js=c.languages.javascript,c.languages.c=c.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}),c.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 c.languages.c["class-name"],delete c.languages.c["boolean"],c.languages.csharp=c.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}),c.languages.insertBefore("csharp","keyword",{preprocessor:{pattern:/(^\s*)#.*/m,lookbehind:!0}}),c.languages.cpp=c.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/}),c.languages.insertBefore("cpp","keyword",{"class-name":{pattern:/(class\s+)[a-z0-9_]+/i,lookbehind:!0}}),c.languages.java=c.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}}),c.languages.php=c.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}}),c.languages.insertBefore("php","class-name",{"shell-comment":{pattern:/(^|[^\\])#.*/,lookbehind:!0,alias:"comment"}}),c.languages.insertBefore("php","keyword",{delimiter:/\?>|<\?(?:php)?/i,variable:/\$\w+\b/i,"package":{pattern:/(\\|namespace\s+|use\s+)[\w\\]+/,lookbehind:!0,inside:{punctuation:/\\/}}}),c.languages.insertBefore("php","operator",{property:{pattern:/(->)[\w]+/,lookbehind:!0}}),c.languages.markup&&(c.hooks.add("before-highlight",function(e){"php"===e.language&&(e.tokenStack=[],e.backupCode=e.code,e.code=e.code.replace(/(?:<\?php|<\?)[\w\W]*?(?:\?>)/gi,function(t){return e.tokenStack.push(t),"{{{PHP"+e.tokenStack.length+"}}}"}))}),c.hooks.add("before-insert",function(e){"php"===e.language&&(e.code=e.backupCode,delete e.backupCode)}),c.hooks.add("after-highlight",function(e){if("php"===e.language){for(var t=0,a=void 0;a=e.tokenStack[t];t++)e.highlightedCode=e.highlightedCode.replace("{{{PHP"+(t+1)+"}}}",c.highlight(a,e.grammar,"php").replace(/\$/g,"$$$$"));e.element.innerHTML=e.highlightedCode}}),c.hooks.add("wrap",function(e){"php"===e.language&&"markup"===e.type&&(e.content=e.content.replace(/(\{\{\{PHP[0-9]+\}\}\})/g,'$1'))}),c.languages.insertBefore("php","comment",{markup:{pattern:/<[^?]\/?(.*?)>/,inside:c.languages.markup},php:/\{\{\{PHP[0-9]+\}\}\}/})),c.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}}]}(c);var u={isCodeSample:function(e){return e&&"PRE"===e.nodeName&&-1!==e.className.indexOf("language-")},trimArg:function(e){return function(t,a){return e(a)}}},g=function(e){var t=e.selection.getNode();return u.isCodeSample(t)?t:null},d=g,p=function(e,t,n){e.undoManager.transact(function(){var i=g(e);n=a.DOM.encode(n),i?(e.dom.setAttrib(i,"class","language-"+t),i.innerHTML=n,c.highlightElement(i),e.selection.select(i)):(e.insertContent('
'+n+"
"),e.selection.select(e.$("#__new").removeAttr("id")[0]))})},f=function(e){var t=g(e);return t?t.textContent:""},h=function(e){var t=i(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"}]},m=function(e){var t,a=d(e);return a&&(t=a.className.match(/language-(\w+)/))?t[1]:""},b=function(e){var t=r(e),a=s(e),n=m(e),i=h(e),o=f(e);e.windowManager.open({title:"Insert/Edit code sample",minWidth:t,minHeight:a,layout:"flex",direction:"column",align:"stretch",body:[{type:"listbox",name:"language",label:"Language",maxWidth:200,value:n,values:i},{type:"textbox",name:"code",multiline:!0,spellcheck:!1,ariaLabel:"Code view",flex:1,style:"direction: ltr; text-align: left",classes:"monospace",value:o,autofocus:!0}],onSubmit:function(t){p(e,t.data.language,t.data.code)}})},y=function(e){e.addCommand("codesample",function(){var t=e.selection.getNode();e.selection.isCollapsed()||u.isCodeSample(t)?b(e):e.formatter.toggle("code")})},v=function(e){var t=e.$;e.on("PreProcess",function(e){t("pre[contenteditable=false]",e.node).filter(u.trimArg(u.isCodeSample)).each(function(e,a){var n=t(a),i=a.textContent;n.attr("class",t.trim(n.attr("class"))),n.removeAttr("contentEditable"),n.empty().append(t("").each(function(){this.textContent=i}))})}),e.on("SetContent",function(){var a=t("pre").filter(u.trimArg(u.isCodeSample)).filter(function(e,t){return"false"!==t.contentEditable});a.length&&e.undoManager.transact(function(){a.each(function(a,n){t(n).find("br").each(function(t,a){a.parentNode.replaceChild(e.getDoc().createTextNode("\n"),a)}),n.contentEditable=!1,n.innerHTML=e.dom.encode(n.textContent),c.highlightElement(n),n.className=t.trim(n.className)})})})},k=function(e,t,a,i){var r,s=n(e);e.inline&&a.get()||!e.inline&&i.get()||(e.inline?a.set(!0):i.set(!0),!1!==s&&(r=e.dom.create("link",{rel:"stylesheet",href:s||t+"/css/prism.css"}),e.getDoc().getElementsByTagName("head")[0].appendChild(r)))},w=function(e){e.addButton("codesample",{cmd:"codesample",title:"Insert/Edit code sample"}),e.addMenuItem("codesample",{cmd:"codesample",text:"Code sample",icon:"codesample"})},x=e(!1);t.add("codesample",function(t,a){var n=e(!1);v(t),w(t),y(t),t.on("init",function(){k(t,a,x,n)}),t.on("dblclick",function(e){u.isCodeSample(e.target)&&b(t)})})}(); \ No newline at end of file diff --git a/tinymce_4/static/tinymce_4/tinymce/plugins/colorpicker/plugin.js b/tinymce_4/static/tinymce_4/tinymce/plugins/colorpicker/plugin.js index 9e5d8b9..9e49f97 100644 --- a/tinymce_4/static/tinymce_4/tinymce/plugins/colorpicker/plugin.js +++ b/tinymce_4/static/tinymce_4/tinymce/plugins/colorpicker/plugin.js @@ -1,272 +1,126 @@ (function () { +var colorpicker = (function () { + 'use strict'; -var defs = {}; // id -> {dependencies, definition, instance (possibly undefined)} + var PluginManager = tinymce.util.Tools.resolve('tinymce.PluginManager'); -// Used when there is no 'main' module. -// The name is probably (hopefully) unique so minification removes for releases. -var register_3795 = function (id) { - var module = dem(id); - var fragments = id.split('.'); - var target = Function('return this;')(); - for (var i = 0; i < fragments.length - 1; ++i) { - if (target[fragments[i]] === undefined) - target[fragments[i]] = {}; - target = target[fragments[i]]; - } - target[fragments[fragments.length - 1]] = module; -}; - -var instantiate = function (id) { - var actual = defs[id]; - var dependencies = actual.deps; - var definition = actual.defn; - var len = dependencies.length; - var instances = new Array(len); - for (var i = 0; i < len; ++i) - instances[i] = dem(dependencies[i]); - var defResult = definition.apply(null, instances); - if (defResult === undefined) - throw 'module [' + id + '] returned undefined'; - actual.instance = defResult; -}; + var Color = tinymce.util.Tools.resolve('tinymce.util.Color'); -var def = function (id, dependencies, definition) { - if (typeof id !== 'string') - throw 'module id must be a string'; - else if (dependencies === undefined) - throw 'no dependencies for ' + id; - else if (definition === undefined) - throw 'no definition function for ' + id; - defs[id] = { - deps: dependencies, - defn: definition, - instance: undefined + var showPreview = function (win, hexColor) { + win.find('#preview')[0].getEl().style.background = hexColor; }; -}; - -var dem = function (id) { - var actual = defs[id]; - if (actual === undefined) - throw 'module [' + id + '] was undefined'; - else if (actual.instance === undefined) - instantiate(id); - return actual.instance; -}; - -var req = function (ids, callback) { - var len = ids.length; - var instances = new Array(len); - for (var i = 0; i < len; ++i) - instances[i] = dem(ids[i]); - callback.apply(null, instances); -}; - -var ephox = {}; - -ephox.bolt = { - module: { - api: { - define: def, - require: req, - demand: dem - } - } -}; - -var define = def; -var require = req; -var demand = dem; -// this helps with minification when using a lot of global references -var defineGlobal = function (id, ref) { - define(id, [], function () { return ref; }); -}; -/*jsc -["tinymce.plugins.colorpicker.Plugin","tinymce.core.PluginManager","tinymce.plugins.colorpicker.ui.Dialog","global!tinymce.util.Tools.resolve","tinymce.core.util.Color"] -jsc*/ -defineGlobal("global!tinymce.util.Tools.resolve", tinymce.util.Tools.resolve); -/** - * ResolveGlobal.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.core.PluginManager', - [ - 'global!tinymce.util.Tools.resolve' - ], - function (resolve) { - return resolve('tinymce.PluginManager'); - } -); - -/** - * ResolveGlobal.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.core.util.Color', - [ - 'global!tinymce.util.Tools.resolve' - ], - function (resolve) { - return resolve('tinymce.util.Color'); - } -); - -/** - * Dialog.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.colorpicker.ui.Dialog', - [ - 'tinymce.core.util.Color' - ], - function (Color) { - var showPreview = function (win, hexColor) { - win.find('#preview')[0].getEl().style.background = hexColor; - }; - - var setColor = function (win, value) { - var color = new Color(value), rgb = color.toRgb(); - - win.fromJSON({ - r: rgb.r, - g: rgb.g, - b: rgb.b, - hex: color.toHex().substr(1) - }); - - showPreview(win, color.toHex()); - }; - - var open = function (editor, callback, value) { - var win = editor.windowManager.open({ - title: 'Color', - items: { - type: 'container', - layout: 'flex', - direction: 'row', - align: 'stretch', - padding: 5, - spacing: 10, - items: [ - { - type: 'colorpicker', - value: value, + var setColor = function (win, value) { + var color = Color(value), rgb = color.toRgb(); + win.fromJSON({ + r: rgb.r, + g: rgb.g, + b: rgb.b, + hex: color.toHex().substr(1) + }); + showPreview(win, color.toHex()); + }; + var open = function (editor, callback, value) { + var win = editor.windowManager.open({ + title: 'Color', + items: { + type: 'container', + layout: 'flex', + direction: 'row', + align: 'stretch', + padding: 5, + spacing: 10, + items: [ + { + type: 'colorpicker', + value: value, + onchange: function () { + var rgb = this.rgb(); + if (win) { + win.find('#r').value(rgb.r); + win.find('#g').value(rgb.g); + win.find('#b').value(rgb.b); + win.find('#hex').value(this.value().substr(1)); + showPreview(win, this.value()); + } + } + }, + { + type: 'form', + padding: 0, + labelGap: 5, + defaults: { + type: 'textbox', + size: 7, + value: '0', + flex: 1, + spellcheck: false, onchange: function () { - var rgb = this.rgb(); - - if (win) { - win.find('#r').value(rgb.r); - win.find('#g').value(rgb.g); - win.find('#b').value(rgb.b); - win.find('#hex').value(this.value().substr(1)); - showPreview(win, this.value()); + var colorPickerCtrl = win.find('colorpicker')[0]; + var name, value; + name = this.name(); + value = this.value(); + if (name === 'hex') { + value = '#' + value; + setColor(win, value); + colorPickerCtrl.value(value); + return; } + value = { + r: win.find('#r').value(), + g: win.find('#g').value(), + b: win.find('#b').value() + }; + colorPickerCtrl.value(value); + setColor(win, value); } }, - { - type: 'form', - padding: 0, - labelGap: 5, - defaults: { - type: 'textbox', - size: 7, - value: '0', - flex: 1, - spellcheck: false, - onchange: function () { - var colorPickerCtrl = win.find('colorpicker')[0]; - var name, value; - - name = this.name(); - value = this.value(); - - if (name === "hex") { - value = '#' + value; - setColor(win, value); - colorPickerCtrl.value(value); - return; - } - - value = { - r: win.find('#r').value(), - g: win.find('#g').value(), - b: win.find('#b').value() - }; - - colorPickerCtrl.value(value); - setColor(win, value); - } + items: [ + { + name: 'r', + label: 'R', + autofocus: 1 }, - items: [ - { name: 'r', label: 'R', autofocus: 1 }, - { name: 'g', label: 'G' }, - { name: 'b', label: 'B' }, - { name: 'hex', label: '#', value: '000000' }, - { name: 'preview', type: 'container', border: 1 } - ] - } - ] - }, - onSubmit: function () { - callback('#' + win.toJSON().hex); - } - }); - - setColor(win, value); - }; - - return { - open: open - }; - } -); -/** - * Plugin.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.colorpicker.Plugin', - [ - 'tinymce.core.PluginManager', - 'tinymce.plugins.colorpicker.ui.Dialog' - ], - function (PluginManager, Dialog) { - PluginManager.add('colorpicker', function (editor) { - if (!editor.settings.color_picker_callback) { - editor.settings.color_picker_callback = function (callback, value) { - Dialog.open(editor, callback, value); - }; + { + name: 'g', + label: 'G' + }, + { + name: 'b', + label: 'B' + }, + { + name: 'hex', + label: '#', + value: '000000' + }, + { + name: 'preview', + type: 'container', + border: 1 + } + ] + } + ] + }, + onSubmit: function () { + callback('#' + win.toJSON().hex); } }); + setColor(win, value); + }; + var $_1aqyr69uje5nvbn8 = { open: open }; - return function () { }; + PluginManager.add('colorpicker', function (editor) { + if (!editor.settings.color_picker_callback) { + editor.settings.color_picker_callback = function (callback, value) { + $_1aqyr69uje5nvbn8.open(editor, callback, value); + }; + } + }); + function Plugin () { } -); -dem('tinymce.plugins.colorpicker.Plugin')(); + + return Plugin; + +}()); })(); diff --git a/tinymce_4/static/tinymce_4/tinymce/plugins/colorpicker/plugin.min.js b/tinymce_4/static/tinymce_4/tinymce/plugins/colorpicker/plugin.min.js index 132caaa..3ffbe16 100644 --- a/tinymce_4/static/tinymce_4/tinymce/plugins/colorpicker/plugin.min.js +++ b/tinymce_4/static/tinymce_4/tinymce/plugins/colorpicker/plugin.min.js @@ -1 +1 @@ -!function(){var a={},b=function(b){for(var c=a[b],e=c.deps,f=c.defn,g=e.length,h=new Array(g),i=0;i {dependencies, definition, instance (possibly undefined)} - -// Used when there is no 'main' module. -// The name is probably (hopefully) unique so minification removes for releases. -var register_3795 = function (id) { - var module = dem(id); - var fragments = id.split('.'); - var target = Function('return this;')(); - for (var i = 0; i < fragments.length - 1; ++i) { - if (target[fragments[i]] === undefined) - target[fragments[i]] = {}; - target = target[fragments[i]]; - } - target[fragments[fragments.length - 1]] = module; -}; - -var instantiate = function (id) { - var actual = defs[id]; - var dependencies = actual.deps; - var definition = actual.defn; - var len = dependencies.length; - var instances = new Array(len); - for (var i = 0; i < len; ++i) - instances[i] = dem(dependencies[i]); - var defResult = definition.apply(null, instances); - if (defResult === undefined) - throw 'module [' + id + '] returned undefined'; - actual.instance = defResult; -}; - -var def = function (id, dependencies, definition) { - if (typeof id !== 'string') - throw 'module id must be a string'; - else if (dependencies === undefined) - throw 'no dependencies for ' + id; - else if (definition === undefined) - throw 'no definition function for ' + id; - defs[id] = { - deps: dependencies, - defn: definition, - instance: undefined - }; -}; - -var dem = function (id) { - var actual = defs[id]; - if (actual === undefined) - throw 'module [' + id + '] was undefined'; - else if (actual.instance === undefined) - instantiate(id); - return actual.instance; -}; - -var req = function (ids, callback) { - var len = ids.length; - var instances = new Array(len); - for (var i = 0; i < len; ++i) - instances[i] = dem(ids[i]); - callback.apply(null, instances); -}; - -var ephox = {}; - -ephox.bolt = { - module: { - api: { - define: def, - require: req, - demand: dem - } - } -}; - -var define = def; -var require = req; -var demand = dem; -// this helps with minification when using a lot of global references -var defineGlobal = function (id, ref) { - define(id, [], function () { return ref; }); -}; -/*jsc -["tinymce.plugins.contextmenu.Plugin","ephox.katamari.api.Cell","tinymce.core.PluginManager","tinymce.plugins.contextmenu.api.Api","tinymce.plugins.contextmenu.core.Bind","global!tinymce.util.Tools.resolve","tinymce.core.dom.DOMUtils","tinymce.core.Env","tinymce.plugins.contextmenu.api.Settings","tinymce.plugins.contextmenu.core.RangePoint","tinymce.plugins.contextmenu.ui.ContextMenu","ephox.katamari.api.Arr","tinymce.core.ui.Factory","tinymce.core.util.Tools","ephox.katamari.api.Option","global!Array","global!Error","global!String","ephox.katamari.api.Fun","global!Object"] -jsc*/ -define( - 'ephox.katamari.api.Cell', - - [ - ], - - function () { - var Cell = function (initial) { - var value = initial; - - var get = function () { - return value; - }; - - var set = function (v) { - value = v; - }; - - var clone = function () { - return Cell(get()); - }; - - return { - get: get, - set: set, - clone: clone - }; + var Cell = function (initial) { + var value = initial; + var get = function () { + return value; }; - - return Cell; - } -); - -defineGlobal("global!tinymce.util.Tools.resolve", tinymce.util.Tools.resolve); -/** - * ResolveGlobal.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.core.PluginManager', - [ - 'global!tinymce.util.Tools.resolve' - ], - function (resolve) { - return resolve('tinymce.PluginManager'); - } -); - -/** - * Api.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.contextmenu.api.Api', - [ - ], - function () { - var get = function (visibleState) { - var isContextMenuVisible = function () { - return visibleState.get(); - }; - - return { - isContextMenuVisible: isContextMenuVisible - }; - }; - - return { - get: get - }; - } -); - - -/** - * ResolveGlobal.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.core.dom.DOMUtils', - [ - 'global!tinymce.util.Tools.resolve' - ], - function (resolve) { - return resolve('tinymce.dom.DOMUtils'); - } -); - -/** - * ResolveGlobal.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.core.Env', - [ - 'global!tinymce.util.Tools.resolve' - ], - function (resolve) { - return resolve('tinymce.Env'); - } -); - -/** - * Settings.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.contextmenu.api.Settings', - [ - ], - function () { - var shouldNeverUseNative = function (editor) { - return editor.settings.contextmenu_never_use_native; + var set = function (v) { + value = v; }; - - var getContextMenu = function (editor) { - return editor.getParam('contextmenu', 'link openlink image inserttable | cell row column deletetable'); + var clone = function () { + return Cell(get()); }; - return { - shouldNeverUseNative: shouldNeverUseNative, - getContextMenu: getContextMenu - }; - } -); -defineGlobal("global!Array", Array); -defineGlobal("global!Error", Error); -define( - 'ephox.katamari.api.Fun', - - [ - 'global!Array', - 'global!Error' - ], - - function (Array, Error) { - - var noop = function () { }; - - var compose = function (fa, fb) { - return function () { - return fa(fb.apply(null, arguments)); - }; - }; - - var constant = function (value) { - return function () { - return value; - }; - }; - - var identity = function (x) { - return x; - }; - - var tripleEquals = function(a, b) { - return a === b; - }; - - // Don't use array slice(arguments), makes the whole function unoptimisable on Chrome - var curry = function (f) { - // equivalent to arguments.slice(1) - // starting at 1 because 0 is the f, makes things tricky. - // Pay attention to what variable is where, and the -1 magic. - // thankfully, we have tests for this. - var args = new Array(arguments.length - 1); - for (var i = 1; i < arguments.length; i++) args[i-1] = arguments[i]; - - return function () { - var newArgs = new Array(arguments.length); - for (var j = 0; j < newArgs.length; j++) newArgs[j] = arguments[j]; - - var all = args.concat(newArgs); - return f.apply(null, all); - }; - }; - - var not = function (f) { - return function () { - return !f.apply(null, arguments); - }; - }; - - var die = function (msg) { - return function () { - throw new Error(msg); - }; - }; - - var apply = function (f) { - return f(); - }; - - var call = function(f) { - f(); + get: get, + set: set, + clone: clone }; + }; - var never = constant(false); - var always = constant(true); - + var PluginManager = tinymce.util.Tools.resolve('tinymce.PluginManager'); - return { - noop: noop, - compose: compose, - constant: constant, - identity: identity, - tripleEquals: tripleEquals, - curry: curry, - not: not, - die: die, - apply: apply, - call: call, - never: never, - always: always + var get = function (visibleState) { + var isContextMenuVisible = function () { + return visibleState.get(); }; - } -); - -defineGlobal("global!Object", Object); -define( - 'ephox.katamari.api.Option', - - [ - 'ephox.katamari.api.Fun', - 'global!Object' - ], - - function (Fun, Object) { - - var never = Fun.never; - var always = Fun.always; - - /** - Option objects support the following methods: - - fold :: this Option a -> ((() -> b, a -> b)) -> Option b - - is :: this Option a -> a -> Boolean - - isSome :: this Option a -> () -> Boolean - - isNone :: this Option a -> () -> Boolean - - getOr :: this Option a -> a -> a - - getOrThunk :: this Option a -> (() -> a) -> a - - getOrDie :: this Option a -> String -> a - - or :: this Option a -> Option a -> Option a - - if some: return self - - if none: return opt - - orThunk :: this Option a -> (() -> Option a) -> Option a - - Same as "or", but uses a thunk instead of a value - - map :: this Option a -> (a -> b) -> Option b - - "fmap" operation on the Option Functor. - - same as 'each' - - ap :: this Option a -> Option (a -> b) -> Option b - - "apply" operation on the Option Apply/Applicative. - - Equivalent to <*> in Haskell/PureScript. - - each :: this Option a -> (a -> b) -> Option b - - same as 'map' - - bind :: this Option a -> (a -> Option b) -> Option b - - "bind"/"flatMap" operation on the Option Bind/Monad. - - Equivalent to >>= in Haskell/PureScript; flatMap in Scala. - - flatten :: {this Option (Option a))} -> () -> Option a - - "flatten"/"join" operation on the Option Monad. - - exists :: this Option a -> (a -> Boolean) -> Boolean - - forall :: this Option a -> (a -> Boolean) -> Boolean - - filter :: this Option a -> (a -> Boolean) -> Option a - - equals :: this Option a -> Option a -> Boolean - - equals_ :: this Option a -> (Option a, a -> Boolean) -> Boolean - - toArray :: this Option a -> () -> [a] - - */ - - var none = function () { return NONE; }; - - var NONE = (function () { - var eq = function (o) { - return o.isNone(); - }; - - // inlined from peanut, maybe a micro-optimisation? - var call = function (thunk) { return thunk(); }; - var id = function (n) { return n; }; - var noop = function () { }; - - var me = { - fold: function (n, s) { return n(); }, - is: never, - isSome: never, - isNone: always, - getOr: id, - getOrThunk: call, - getOrDie: function (msg) { - throw new Error(msg || 'error: getOrDie called on none.'); - }, - or: id, - orThunk: call, - map: none, - ap: none, - each: noop, - bind: none, - flatten: none, - exists: never, - forall: always, - filter: none, - equals: eq, - equals_: eq, - toArray: function () { return []; }, - toString: Fun.constant("none()") - }; - if (Object.freeze) Object.freeze(me); - return me; - })(); - - - /** some :: a -> Option a */ - var some = function (a) { - - // inlined from peanut, maybe a micro-optimisation? - var constant_a = function () { return a; }; - - var self = function () { - // can't Fun.constant this one - return me; - }; - - var map = function (f) { - return some(f(a)); - }; + return { isContextMenuVisible: isContextMenuVisible }; + }; + var $_77k9e69zje5nvbno = { get: get }; - var bind = function (f) { - return f(a); - }; + var shouldNeverUseNative = function (editor) { + return editor.settings.contextmenu_never_use_native; + }; + var getContextMenu = function (editor) { + return editor.getParam('contextmenu', 'link openlink image inserttable | cell row column deletetable'); + }; + var $_15haufa1je5nvbnr = { + shouldNeverUseNative: shouldNeverUseNative, + getContextMenu: getContextMenu + }; - var me = { - fold: function (n, s) { return s(a); }, - is: function (v) { return a === v; }, - isSome: always, - isNone: never, - getOr: constant_a, - getOrThunk: constant_a, - getOrDie: constant_a, - or: self, - orThunk: self, - map: map, - ap: function (optfab) { - return optfab.fold(none, function(fab) { - return some(fab(a)); - }); - }, - each: function (f) { - f(a); - }, - bind: bind, - flatten: constant_a, - exists: bind, - forall: bind, - filter: function (f) { - return f(a) ? me : NONE; - }, - equals: function (o) { - return o.is(a); - }, - equals_: function (o, elementEq) { - return o.fold( - never, - function (b) { return elementEq(a, b); } - ); - }, - toArray: function () { - return [a]; - }, - toString: function () { - return 'some(' + a + ')'; - } - }; - return me; - }; + var DOMUtils = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils'); - /** from :: undefined|null|a -> Option a */ - var from = function (value) { - return value === null || value === undefined ? NONE : some(value); - }; + var getUiContainer = function (editor) { + return DOMUtils.DOM.select(editor.settings.ui_container)[0]; + }; + var nu = function (x, y) { return { - some: some, - none: none, - from: from - }; - } -); - -defineGlobal("global!String", String); -define( - 'ephox.katamari.api.Arr', - - [ - 'ephox.katamari.api.Option', - 'global!Array', - 'global!Error', - 'global!String' - ], - - function (Option, Array, Error, String) { - // Use the native Array.indexOf if it is available (IE9+) otherwise fall back to manual iteration - // https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf - var rawIndexOf = (function () { - var pIndexOf = Array.prototype.indexOf; - - var fastIndex = function (xs, x) { return pIndexOf.call(xs, x); }; - - var slowIndex = function(xs, x) { return slowIndexOf(xs, x); }; - - return pIndexOf === undefined ? slowIndex : fastIndex; - })(); - - var indexOf = function (xs, x) { - // The rawIndexOf method does not wrap up in an option. This is for performance reasons. - var r = rawIndexOf(xs, x); - return r === -1 ? Option.none() : Option.some(r); - }; - - var contains = function (xs, x) { - return rawIndexOf(xs, x) > -1; - }; - - // Using findIndex is likely less optimal in Chrome (dynamic return type instead of bool) - // but if we need that micro-optimisation we can inline it later. - var exists = function (xs, pred) { - return findIndex(xs, pred).isSome(); - }; - - var range = function (num, f) { - var r = []; - for (var i = 0; i < num; i++) { - r.push(f(i)); - } - return r; - }; - - // It's a total micro optimisation, but these do make some difference. - // Particularly for browsers other than Chrome. - // - length caching - // http://jsperf.com/browser-diet-jquery-each-vs-for-loop/69 - // - not using push - // http://jsperf.com/array-direct-assignment-vs-push/2 - - var chunk = function (array, size) { - var r = []; - for (var i = 0; i < array.length; i += size) { - var s = array.slice(i, i + size); - r.push(s); - } - return r; - }; - - var map = function(xs, f) { - // pre-allocating array size when it's guaranteed to be known - // http://jsperf.com/push-allocated-vs-dynamic/22 - var len = xs.length; - var r = new Array(len); - for (var i = 0; i < len; i++) { - var x = xs[i]; - r[i] = f(x, i, xs); - } - return r; - }; - - // Unwound implementing other functions in terms of each. - // The code size is roughly the same, and it should allow for better optimisation. - var each = function(xs, f) { - for (var i = 0, len = xs.length; i < len; i++) { - var x = xs[i]; - f(x, i, xs); - } - }; - - var eachr = function (xs, f) { - for (var i = xs.length - 1; i >= 0; i--) { - var x = xs[i]; - f(x, i, xs); - } - }; - - var partition = function(xs, pred) { - var pass = []; - var fail = []; - for (var i = 0, len = xs.length; i < len; i++) { - var x = xs[i]; - var arr = pred(x, i, xs) ? pass : fail; - arr.push(x); - } - return { pass: pass, fail: fail }; - }; - - var filter = function(xs, pred) { - var r = []; - for (var i = 0, len = xs.length; i < len; i++) { - var x = xs[i]; - if (pred(x, i, xs)) { - r.push(x); - } - } - return r; - }; - - /* - * Groups an array into contiguous arrays of like elements. Whether an element is like or not depends on f. - * - * f is a function that derives a value from an element - e.g. true or false, or a string. - * Elements are like if this function generates the same value for them (according to ===). - * - * - * Order of the elements is preserved. Arr.flatten() on the result will return the original list, as with Haskell groupBy function. - * For a good explanation, see the group function (which is a special case of groupBy) - * http://hackage.haskell.org/package/base-4.7.0.0/docs/Data-List.html#v:group - */ - var groupBy = function (xs, f) { - if (xs.length === 0) { - return []; - } else { - var wasType = f(xs[0]); // initial case for matching - var r = []; - var group = []; - - for (var i = 0, len = xs.length; i < len; i++) { - var x = xs[i]; - var type = f(x); - if (type !== wasType) { - r.push(group); - group = []; - } - wasType = type; - group.push(x); - } - if (group.length !== 0) { - r.push(group); - } - return r; - } - }; - - var foldr = function (xs, f, acc) { - eachr(xs, function (x) { - acc = f(acc, x); - }); - return acc; + x: x, + y: y }; + }; + var transpose = function (pos, dx, dy) { + return nu(pos.x + dx, pos.y + dy); + }; + var fromPageXY = function (e) { + return nu(e.pageX, e.pageY); + }; + var fromClientXY = function (e) { + return nu(e.clientX, e.clientY); + }; + var transposeUiContainer = function (element, pos) { + if (element && DOMUtils.DOM.getStyle(element, 'position', true) !== 'static') { + var containerPos = DOMUtils.DOM.getPos(element); + var dx = containerPos.x - element.scrollLeft; + var dy = containerPos.y - element.scrollTop; + return transpose(pos, -dx, -dy); + } else { + return transpose(pos, 0, 0); + } + }; + var transposeContentAreaContainer = function (element, pos) { + var containerPos = DOMUtils.DOM.getPos(element); + return transpose(pos, containerPos.x, containerPos.y); + }; + var getPos = function (editor, e) { + if (editor.inline) { + return transposeUiContainer(getUiContainer(editor), fromPageXY(e)); + } else { + var iframePos = transposeContentAreaContainer(editor.getContentAreaContainer(), fromClientXY(e)); + return transposeUiContainer(getUiContainer(editor), iframePos); + } + }; + var $_b3tsosa2je5nvbnt = { getPos: getPos }; - var foldl = function (xs, f, acc) { - each(xs, function (x) { - acc = f(acc, x); - }); - return acc; - }; + var Factory = tinymce.util.Tools.resolve('tinymce.ui.Factory'); - var find = function (xs, pred) { - for (var i = 0, len = xs.length; i < len; i++) { - var x = xs[i]; - if (pred(x, i, xs)) { - return Option.some(x); - } - } - return Option.none(); - }; + var Tools = tinymce.util.Tools.resolve('tinymce.util.Tools'); - var findIndex = function (xs, pred) { - for (var i = 0, len = xs.length; i < len; i++) { - var x = xs[i]; - if (pred(x, i, xs)) { - return Option.some(i); - } + var renderMenu = function (editor, visibleState) { + var menu, contextmenu; + var items = []; + contextmenu = $_15haufa1je5nvbnr.getContextMenu(editor); + Tools.each(contextmenu.split(/[ ,]/), function (name) { + var item = editor.menuItems[name]; + if (name === '|') { + item = { text: name }; } - - return Option.none(); - }; - - var slowIndexOf = function (xs, x) { - for (var i = 0, len = xs.length; i < len; ++i) { - if (xs[i] === x) { - return i; - } + if (item) { + item.shortcut = ''; + items.push(item); } - - return -1; - }; - - var push = Array.prototype.push; - var flatten = function (xs) { - // Note, this is possible because push supports multiple arguments: - // http://jsperf.com/concat-push/6 - // Note that in the past, concat() would silently work (very slowly) for array-like objects. - // With this change it will throw an error. - var r = []; - for (var i = 0, len = xs.length; i < len; ++i) { - // Ensure that each value is an array itself - if (! Array.prototype.isPrototypeOf(xs[i])) throw new Error('Arr.flatten item ' + i + ' was not an array, input: ' + xs); - push.apply(r, xs[i]); - } - return r; - }; - - var bind = function (xs, f) { - var output = map(xs, f); - return flatten(output); - }; - - var forall = function (xs, pred) { - for (var i = 0, len = xs.length; i < len; ++i) { - var x = xs[i]; - if (pred(x, i, xs) !== true) { - return false; + }); + for (var i = 0; i < items.length; i++) { + if (items[i].text === '|') { + if (i === 0 || i === items.length - 1) { + items.splice(i, 1); } } - return true; - }; - - var equal = function (a1, a2) { - return a1.length === a2.length && forall(a1, function (x, i) { - return x === a2[i]; - }); - }; - - var slice = Array.prototype.slice; - var reverse = function (xs) { - var r = slice.call(xs, 0); - r.reverse(); - return r; - }; - - var difference = function (a1, a2) { - return filter(a1, function (x) { - return !contains(a2, x); - }); - }; - - var mapToObject = function(xs, f) { - var r = {}; - for (var i = 0, len = xs.length; i < len; i++) { - var x = xs[i]; - r[String(x)] = f(x, i); - } - return r; - }; - - var pure = function(x) { - return [x]; - }; - - var sort = function (xs, comparator) { - var copy = slice.call(xs, 0); - copy.sort(comparator); - return copy; - }; - - var head = function (xs) { - return xs.length === 0 ? Option.none() : Option.some(xs[0]); - }; - - var last = function (xs) { - return xs.length === 0 ? Option.none() : Option.some(xs[xs.length - 1]); - }; - - return { - map: map, - each: each, - eachr: eachr, - partition: partition, - filter: filter, - groupBy: groupBy, - indexOf: indexOf, - foldr: foldr, - foldl: foldl, - find: find, - findIndex: findIndex, - flatten: flatten, - bind: bind, - forall: forall, - exists: exists, - contains: contains, - equal: equal, - reverse: reverse, - chunk: chunk, - difference: difference, - mapToObject: mapToObject, - pure: pure, - sort: sort, - range: range, - head: head, - last: last - }; - } -); -/** - * RangePoint.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.contextmenu.core.RangePoint', - [ - 'ephox.katamari.api.Arr' - ], - function (Arr) { - var containsXY = function (clientRect, clientX, clientY) { - return ( - clientX >= clientRect.left && - clientX <= clientRect.right && - clientY >= clientRect.top && - clientY <= clientRect.bottom - ); - }; - - var isXYWithinRange = function (clientX, clientY, range) { - if (range.collapsed) { - return false; - } - - return Arr.foldl(range.getClientRects(), function (state, rect) { - return state || containsXY(rect, clientX, clientY); - }, false); - }; - - return { - isXYWithinRange: isXYWithinRange - }; - } -); -/** - * ResolveGlobal.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.core.ui.Factory', - [ - 'global!tinymce.util.Tools.resolve' - ], - function (resolve) { - return resolve('tinymce.ui.Factory'); - } -); - -/** - * ResolveGlobal.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.core.util.Tools', - [ - 'global!tinymce.util.Tools.resolve' - ], - function (resolve) { - return resolve('tinymce.util.Tools'); - } -); - -/** - * ContextMenu.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.contextmenu.ui.ContextMenu', - [ - 'tinymce.core.ui.Factory', - 'tinymce.core.util.Tools', - 'tinymce.plugins.contextmenu.api.Settings' - ], - function (Factory, Tools, Settings) { - var renderMenu = function (editor, visibleState) { - var menu, contextmenu, items = []; - - contextmenu = Settings.getContextMenu(editor); - Tools.each(contextmenu.split(/[ ,]/), function (name) { - var item = editor.menuItems[name]; - - if (name === '|') { - item = { text: name }; - } - - if (item) { - item.shortcut = ''; // Hide shortcuts - items.push(item); - } - }); - - for (var i = 0; i < items.length; i++) { - if (items[i].text === '|') { - if (i === 0 || i === items.length - 1) { - items.splice(i, 1); - } - } + } + menu = Factory.create('menu', { + items: items, + context: 'contextmenu', + classes: 'contextmenu' + }); + menu.uiContainer = getUiContainer(editor); + menu.renderTo(getUiContainer(editor)); + menu.on('hide', function (e) { + if (e.control === this) { + visibleState.set(false); } + }); + editor.on('remove', function () { + menu.remove(); + menu = null; + }); + return menu; + }; + var show = function (editor, pos, visibleState, menu) { + if (menu.get() === null) { + menu.set(renderMenu(editor, visibleState)); + } else { + menu.get().show(); + } + menu.get().moveTo(pos.x, pos.y); + visibleState.set(true); + }; + var $_2npsv5a5je5nvbnw = { show: show }; - menu = Factory.create('menu', { - items: items, - context: 'contextmenu', - classes: 'contextmenu' - }).renderTo(); - - menu.on('hide', function (e) { - if (e.control === this) { - visibleState.set(false); - } - }); - - editor.on('remove', function () { - menu.remove(); - menu = null; - }); - - return menu; - }; - - var show = function (editor, x, y, visibleState, menu) { - if (menu.get() === null) { - menu.set(renderMenu(editor, visibleState)); - } else { - menu.get().show(); + var isNativeOverrideKeyEvent = function (editor, e) { + return e.ctrlKey && !$_15haufa1je5nvbnr.shouldNeverUseNative(editor); + }; + var setup = function (editor, visibleState, menu) { + editor.on('contextmenu', function (e) { + if (isNativeOverrideKeyEvent(editor, e)) { + return; } + e.preventDefault(); + $_2npsv5a5je5nvbnw.show(editor, $_b3tsosa2je5nvbnt.getPos(editor, e), visibleState, menu); + }); + }; + var $_b1limta0je5nvbnq = { setup: setup }; - menu.get().moveTo(x, y); - visibleState.set(true); - }; - - return { - show: show - }; - } -); -/** - * Bind.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.contextmenu.core.Bind', - [ - 'tinymce.core.dom.DOMUtils', - 'tinymce.core.Env', - 'tinymce.plugins.contextmenu.api.Settings', - 'tinymce.plugins.contextmenu.core.RangePoint', - 'tinymce.plugins.contextmenu.ui.ContextMenu' - ], - function (DOMUtils, Env, Settings, RangePoint, ContextMenu) { - var isNativeOverrideKeyEvent = function (editor, e) { - return e.ctrlKey && !Settings.shouldNeverUseNative(editor); - }; - - var isMacWebKit = function () { - return Env.mac && Env.webkit; - }; - - var isImage = function (elm) { - return elm && elm.nodeName === 'IMG'; - }; - - var isEventOnImageOutsideRange = function (evt, range) { - return isImage(evt.target) && RangePoint.isXYWithinRange(evt.clientX, evt.clientY, range) === false; - }; - - var setup = function (editor, visibleState, menu) { - /** - * This takes care of a os x native issue where it expands the selection - * to the word at the caret position to do "lookups". Since we are overriding - * the context menu we also need to override this expanding so the behavior becomes - * normalized. Firefox on os x doesn't expand to the word when using the context menu. - */ - editor.on('mousedown', function (e) { - if (isMacWebKit() && e.button === 2 && !isNativeOverrideKeyEvent(editor, e) && editor.selection.isCollapsed()) { - editor.once('contextmenu', function (e2) { - if (!isImage(e2.target)) { - editor.selection.placeCaretAt(e2.clientX, e2.clientY); - } - }); - } - }); - - editor.on('contextmenu', function (e) { - var x = e.pageX, y = e.pageY; - - if (!editor.inline) { - var pos = DOMUtils.DOM.getPos(editor.getContentAreaContainer()); - x = pos.x + e.clientX; - y = pos.y + e.clientY; - } - - if (isNativeOverrideKeyEvent(editor, e)) { - return; - } - - if (isEventOnImageOutsideRange(e, editor.selection.getRng())) { - editor.selection.select(e.target); - } - - e.preventDefault(); - - ContextMenu.show(editor, x, y, visibleState, menu); - }); - }; - - return { - setup: setup - }; + PluginManager.add('contextmenu', function (editor) { + var menu = Cell(null), visibleState = Cell(false); + $_b1limta0je5nvbnq.setup(editor, visibleState, menu); + return $_77k9e69zje5nvbno.get(visibleState); + }); + function Plugin () { } -); -/** - * Plugin.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ -define( - 'tinymce.plugins.contextmenu.Plugin', - [ - 'ephox.katamari.api.Cell', - 'tinymce.core.PluginManager', - 'tinymce.plugins.contextmenu.api.Api', - 'tinymce.plugins.contextmenu.core.Bind' - ], - function (Cell, PluginManager, Api, Bind) { - PluginManager.add('contextmenu', function (editor) { - var menu = Cell(null), visibleState = Cell(false); + return Plugin; - Bind.setup(editor, visibleState, menu); - - return Api.get(visibleState); - }); - - return function () { }; - } -); -dem('tinymce.plugins.contextmenu.Plugin')(); +}()); })(); diff --git a/tinymce_4/static/tinymce_4/tinymce/plugins/contextmenu/plugin.min.js b/tinymce_4/static/tinymce_4/tinymce/plugins/contextmenu/plugin.min.js index 3c211a8..8603ff5 100644 --- a/tinymce_4/static/tinymce_4/tinymce/plugins/contextmenu/plugin.min.js +++ b/tinymce_4/static/tinymce_4/tinymce/plugins/contextmenu/plugin.min.js @@ -1 +1 @@ -!function(){var a={},b=function(b){for(var c=a[b],e=c.deps,f=c.defn,g=e.length,h=new Array(g),i=0;i-1},h=function(a,b){return t(a,b).isSome()},i=function(a,b){for(var c=[],d=0;d=0;c--){var d=a[c];b(d,c,a)}},n=function(a,b){for(var c=[],d=[],e=0,f=a.length;e=a.left&&b<=a.right&&c>=a.top&&c<=a.bottom},c=function(c,d,e){return!e.collapsed&&a.foldl(e.getClientRects(),function(a,e){return a||b(e,c,d)},!1)};return{isXYWithinRange:c}}),g("c",["5"],function(a){return a("tinymce.ui.Factory")}),g("d",["5"],function(a){return a("tinymce.util.Tools")}),g("a",["c","d","8"],function(a,b,c){var d=function(d,e){var f,g,h=[];g=c.getContextMenu(d),b.each(g.split(/[ ,]/),function(a){var b=d.menuItems[a];"|"===a&&(b={text:a}),b&&(b.shortcut="",h.push(b))});for(var i=0;i {dependencies, definition, instance (possibly undefined)} - -// Used when there is no 'main' module. -// The name is probably (hopefully) unique so minification removes for releases. -var register_3795 = function (id) { - var module = dem(id); - var fragments = id.split('.'); - var target = Function('return this;')(); - for (var i = 0; i < fragments.length - 1; ++i) { - if (target[fragments[i]] === undefined) - target[fragments[i]] = {}; - target = target[fragments[i]]; - } - target[fragments[fragments.length - 1]] = module; -}; - -var instantiate = function (id) { - var actual = defs[id]; - var dependencies = actual.deps; - var definition = actual.defn; - var len = dependencies.length; - var instances = new Array(len); - for (var i = 0; i < len; ++i) - instances[i] = dem(dependencies[i]); - var defResult = definition.apply(null, instances); - if (defResult === undefined) - throw 'module [' + id + '] returned undefined'; - actual.instance = defResult; -}; - -var def = function (id, dependencies, definition) { - if (typeof id !== 'string') - throw 'module id must be a string'; - else if (dependencies === undefined) - throw 'no dependencies for ' + id; - else if (definition === undefined) - throw 'no definition function for ' + id; - defs[id] = { - deps: dependencies, - defn: definition, - instance: undefined - }; -}; - -var dem = function (id) { - var actual = defs[id]; - if (actual === undefined) - throw 'module [' + id + '] was undefined'; - else if (actual.instance === undefined) - instantiate(id); - return actual.instance; -}; - -var req = function (ids, callback) { - var len = ids.length; - var instances = new Array(len); - for (var i = 0; i < len; ++i) - instances[i] = dem(ids[i]); - callback.apply(null, instances); -}; - -var ephox = {}; - -ephox.bolt = { - module: { - api: { - define: def, - require: req, - demand: dem - } - } -}; - -var define = def; -var require = req; -var demand = dem; -// this helps with minification when using a lot of global references -var defineGlobal = function (id, ref) { - define(id, [], function () { return ref; }); -}; -/*jsc -["tinymce.plugins.directionality.Plugin","tinymce.core.PluginManager","tinymce.plugins.directionality.api.Commands","tinymce.plugins.directionality.ui.Buttons","global!tinymce.util.Tools.resolve","tinymce.plugins.directionality.core.Direction","tinymce.core.util.Tools"] -jsc*/ -defineGlobal("global!tinymce.util.Tools.resolve", tinymce.util.Tools.resolve); -/** - * ResolveGlobal.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.core.PluginManager', - [ - 'global!tinymce.util.Tools.resolve' - ], - function (resolve) { - return resolve('tinymce.PluginManager'); - } -); - -/** - * ResolveGlobal.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.core.util.Tools', - [ - 'global!tinymce.util.Tools.resolve' - ], - function (resolve) { - return resolve('tinymce.util.Tools'); - } -); - -/** - * Direction.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.directionality.core.Direction', - [ - 'tinymce.core.util.Tools' - ], - function (Tools) { - var setDir = function (editor, dir) { - var dom = editor.dom, curDir, blocks = editor.selection.getSelectedBlocks(); - - if (blocks.length) { - curDir = dom.getAttrib(blocks[0], 'dir'); - - Tools.each(blocks, function (block) { - // Add dir to block if the parent block doesn't already have that dir - if (!dom.getParent(block.parentNode, '*[dir="' + dir + '"]', dom.getRoot())) { - dom.setAttrib(block, 'dir', curDir !== dir ? dir : null); - } - }); - - editor.nodeChanged(); - } - }; - - return { - setDir: setDir - }; - } -); - - -/** - * Commands.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.directionality.api.Commands', - [ - 'tinymce.plugins.directionality.core.Direction' - ], - function (Direction) { - var register = function (editor) { - editor.addCommand('mceDirectionLTR', function () { - Direction.setDir(editor, 'ltr'); +var directionality = (function () { + 'use strict'; + + var PluginManager = tinymce.util.Tools.resolve('tinymce.PluginManager'); + + var Tools = tinymce.util.Tools.resolve('tinymce.util.Tools'); + + var setDir = function (editor, dir) { + var dom = editor.dom; + var curDir; + var blocks = editor.selection.getSelectedBlocks(); + if (blocks.length) { + curDir = dom.getAttrib(blocks[0], 'dir'); + Tools.each(blocks, function (block) { + if (!dom.getParent(block.parentNode, '*[dir="' + dir + '"]', dom.getRoot())) { + dom.setAttrib(block, 'dir', curDir !== dir ? dir : null); + } }); + editor.nodeChanged(); + } + }; + var $_30wzhdabje5nvboc = { setDir: setDir }; - editor.addCommand('mceDirectionRTL', function () { - Direction.setDir(editor, 'rtl'); - }); - }; - - return { - register: register - }; - } -); -/** - * Buttons.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.directionality.ui.Buttons', - [ - 'tinymce.core.util.Tools' - ], - function (Tools) { - var generateSelector = function (dir) { - var selector = []; - - Tools.each('h1 h2 h3 h4 h5 h6 div p'.split(' '), function (name) { - selector.push(name + '[dir=' + dir + ']'); - }); - - return selector.join(','); - }; - - var register = function (editor) { - editor.addButton('ltr', { - title: 'Left to right', - cmd: 'mceDirectionLTR', - stateSelector: generateSelector('ltr') - }); + var register = function (editor) { + editor.addCommand('mceDirectionLTR', function () { + $_30wzhdabje5nvboc.setDir(editor, 'ltr'); + }); + editor.addCommand('mceDirectionRTL', function () { + $_30wzhdabje5nvboc.setDir(editor, 'rtl'); + }); + }; + var $_23jvpoaaje5nvbob = { register: register }; - editor.addButton('rtl', { - title: 'Right to left', - cmd: 'mceDirectionRTL', - stateSelector: generateSelector('rtl') - }); - }; + var generateSelector = function (dir) { + var selector = []; + Tools.each('h1 h2 h3 h4 h5 h6 div p'.split(' '), function (name) { + selector.push(name + '[dir=' + dir + ']'); + }); + return selector.join(','); + }; + var register$1 = function (editor) { + editor.addButton('ltr', { + title: 'Left to right', + cmd: 'mceDirectionLTR', + stateSelector: generateSelector('ltr') + }); + editor.addButton('rtl', { + title: 'Right to left', + cmd: 'mceDirectionRTL', + stateSelector: generateSelector('rtl') + }); + }; + var $_7sbdsvadje5nvboe = { register: register$1 }; - return { - register: register - }; + PluginManager.add('directionality', function (editor) { + $_23jvpoaaje5nvbob.register(editor); + $_7sbdsvadje5nvboe.register(editor); + }); + function Plugin () { } -); -/** - * Plugin.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ -define( - 'tinymce.plugins.directionality.Plugin', - [ - 'tinymce.core.PluginManager', - 'tinymce.plugins.directionality.api.Commands', - 'tinymce.plugins.directionality.ui.Buttons' - ], - function (PluginManager, Commands, Buttons) { - PluginManager.add('directionality', function (editor) { - Commands.register(editor); - Buttons.register(editor); - }); + return Plugin; - return function () { }; - } -); -dem('tinymce.plugins.directionality.Plugin')(); +}()); })(); diff --git a/tinymce_4/static/tinymce_4/tinymce/plugins/directionality/plugin.min.js b/tinymce_4/static/tinymce_4/tinymce/plugins/directionality/plugin.min.js index 4709a45..c187c76 100644 --- a/tinymce_4/static/tinymce_4/tinymce/plugins/directionality/plugin.min.js +++ b/tinymce_4/static/tinymce_4/tinymce/plugins/directionality/plugin.min.js @@ -1 +1 @@ -!function(){var a={},b=function(b){for(var c=a[b],e=c.deps,f=c.defn,g=e.length,h=new Array(g),i=0;i {dependencies, definition, instance (possibly undefined)} - -// Used when there is no 'main' module. -// The name is probably (hopefully) unique so minification removes for releases. -var register_3795 = function (id) { - var module = dem(id); - var fragments = id.split('.'); - var target = Function('return this;')(); - for (var i = 0; i < fragments.length - 1; ++i) { - if (target[fragments[i]] === undefined) - target[fragments[i]] = {}; - target = target[fragments[i]]; - } - target[fragments[fragments.length - 1]] = module; -}; - -var instantiate = function (id) { - var actual = defs[id]; - var dependencies = actual.deps; - var definition = actual.defn; - var len = dependencies.length; - var instances = new Array(len); - for (var i = 0; i < len; ++i) - instances[i] = dem(dependencies[i]); - var defResult = definition.apply(null, instances); - if (defResult === undefined) - throw 'module [' + id + '] returned undefined'; - actual.instance = defResult; -}; - -var def = function (id, dependencies, definition) { - if (typeof id !== 'string') - throw 'module id must be a string'; - else if (dependencies === undefined) - throw 'no dependencies for ' + id; - else if (definition === undefined) - throw 'no definition function for ' + id; - defs[id] = { - deps: dependencies, - defn: definition, - instance: undefined - }; -}; - -var dem = function (id) { - var actual = defs[id]; - if (actual === undefined) - throw 'module [' + id + '] was undefined'; - else if (actual.instance === undefined) - instantiate(id); - return actual.instance; -}; - -var req = function (ids, callback) { - var len = ids.length; - var instances = new Array(len); - for (var i = 0; i < len; ++i) - instances[i] = dem(ids[i]); - callback.apply(null, instances); -}; - -var ephox = {}; - -ephox.bolt = { - module: { - api: { - define: def, - require: req, - demand: dem - } - } -}; - -var define = def; -var require = req; -var demand = dem; -// this helps with minification when using a lot of global references -var defineGlobal = function (id, ref) { - define(id, [], function () { return ref; }); -}; -/*jsc -["tinymce.plugins.emoticons.Plugin","tinymce.core.PluginManager","tinymce.plugins.emoticons.ui.Buttons","global!tinymce.util.Tools.resolve","tinymce.plugins.emoticons.ui.PanelHtml","tinymce.core.util.Tools"] -jsc*/ -defineGlobal("global!tinymce.util.Tools.resolve", tinymce.util.Tools.resolve); -/** - * ResolveGlobal.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.core.PluginManager', - [ - 'global!tinymce.util.Tools.resolve' - ], - function (resolve) { - return resolve('tinymce.PluginManager'); - } -); - -/** - * ResolveGlobal.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.core.util.Tools', - [ - 'global!tinymce.util.Tools.resolve' - ], - function (resolve) { - return resolve('tinymce.util.Tools'); - } -); - -/** - * PanelHtml.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.emoticons.ui.PanelHtml', - [ - 'tinymce.core.util.Tools' - ], - function (Tools) { - var emoticons = [ - ["cool", "cry", "embarassed", "foot-in-mouth"], - ["frown", "innocent", "kiss", "laughing"], - ["money-mouth", "sealed", "smile", "surprised"], - ["tongue-out", "undecided", "wink", "yell"] - ]; - - var getHtml = function (pluginUrl) { - var emoticonsHtml; - - emoticonsHtml = ''; - - Tools.each(emoticons, function (row) { - emoticonsHtml += ''; - - Tools.each(row, function (icon) { - var emoticonUrl = pluginUrl + '/img/smiley-' + icon + '.gif'; - - emoticonsHtml += ''; - }); - - emoticonsHtml += ''; +var emoticons = (function () { + 'use strict'; + + var PluginManager = tinymce.util.Tools.resolve('tinymce.PluginManager'); + + var Tools = tinymce.util.Tools.resolve('tinymce.util.Tools'); + + var emoticons = [ + [ + 'cool', + 'cry', + 'embarassed', + 'foot-in-mouth' + ], + [ + 'frown', + 'innocent', + 'kiss', + 'laughing' + ], + [ + 'money-mouth', + 'sealed', + 'smile', + 'surprised' + ], + [ + 'tongue-out', + 'undecided', + 'wink', + 'yell' + ] + ]; + var getHtml = function (pluginUrl) { + var emoticonsHtml; + emoticonsHtml = '
'; + Tools.each(emoticons, function (row) { + emoticonsHtml += ''; + Tools.each(row, function (icon) { + var emoticonUrl = pluginUrl + '/img/smiley-' + icon + '.gif'; + emoticonsHtml += ''; }); + emoticonsHtml += ''; + }); + emoticonsHtml += '
'; + return emoticonsHtml; + }; + var $_2l9evpahje5nvbou = { getHtml: getHtml }; - emoticonsHtml += ''; - - return emoticonsHtml; - }; - - return { - getHtml: getHtml - }; - } -); -/** - * Buttons.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.emoticons.ui.Buttons', - [ - 'tinymce.plugins.emoticons.ui.PanelHtml' - ], - function (PanelHtml) { - var insertEmoticon = function (editor, src, alt) { - editor.insertContent(editor.dom.createHTML('img', { src: src, alt: alt })); - }; - - var register = function (editor, pluginUrl) { - var panelHtml = PanelHtml.getHtml(pluginUrl); - - editor.addButton('emoticons', { - type: 'panelbutton', - panel: { - role: 'application', - autohide: true, - html: panelHtml, - onclick: function (e) { - var linkElm = editor.dom.getParent(e.target, 'a'); - if (linkElm) { - insertEmoticon(editor, linkElm.getAttribute('data-mce-url'), linkElm.getAttribute('data-mce-alt')); - this.hide(); - } + var insertEmoticon = function (editor, src, alt) { + editor.insertContent(editor.dom.createHTML('img', { + src: src, + alt: alt + })); + }; + var register = function (editor, pluginUrl) { + var panelHtml = $_2l9evpahje5nvbou.getHtml(pluginUrl); + editor.addButton('emoticons', { + type: 'panelbutton', + panel: { + role: 'application', + autohide: true, + html: panelHtml, + onclick: function (e) { + var linkElm = editor.dom.getParent(e.target, 'a'); + if (linkElm) { + insertEmoticon(editor, linkElm.getAttribute('data-mce-url'), linkElm.getAttribute('data-mce-alt')); + this.hide(); } - }, - tooltip: 'Emoticons' - }); - }; + } + }, + tooltip: 'Emoticons' + }); + }; + var $_2ohiylagje5nvbos = { register: register }; - return { - register: register - }; + PluginManager.add('emoticons', function (editor, pluginUrl) { + $_2ohiylagje5nvbos.register(editor, pluginUrl); + }); + function Plugin () { } -); -/** - * Plugin.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ -/** - * This class contains all core logic for the emoticons plugin. - * - * @class tinymce.emoticons.Plugin - * @private - */ -define( - 'tinymce.plugins.emoticons.Plugin', - [ - 'tinymce.core.PluginManager', - 'tinymce.plugins.emoticons.ui.Buttons' - ], - function (PluginManager, Buttons) { - PluginManager.add('emoticons', function (editor, pluginUrl) { - Buttons.register(editor, pluginUrl); - }); + return Plugin; - return function () { }; - } -); -dem('tinymce.plugins.emoticons.Plugin')(); +}()); })(); diff --git a/tinymce_4/static/tinymce_4/tinymce/plugins/emoticons/plugin.min.js b/tinymce_4/static/tinymce_4/tinymce/plugins/emoticons/plugin.min.js index 92363b3..75f5f7c 100644 --- a/tinymce_4/static/tinymce_4/tinymce/plugins/emoticons/plugin.min.js +++ b/tinymce_4/static/tinymce_4/tinymce/plugins/emoticons/plugin.min.js @@ -1 +1 @@ -!function(){var a={},b=function(b){for(var c=a[b],e=c.deps,f=c.defn,g=e.length,h=new Array(g),i=0;i'}),d+=""}),d+=""};return{getHtml:c}}),g("2",["4"],function(a){var b=function(a,b,c){a.insertContent(a.dom.createHTML("img",{src:b,alt:c}))},c=function(c,d){var e=a.getHtml(d);c.addButton("emoticons",{type:"panelbutton",panel:{role:"application",autohide:!0,html:e,onclick:function(a){var d=c.dom.getParent(a.target,"a");d&&(b(c,d.getAttribute("data-mce-url"),d.getAttribute("data-mce-alt")),this.hide())}},tooltip:"Emoticons"})};return{register:c}}),g("0",["1","2"],function(a,b){return a.add("emoticons",function(a,c){b.register(a,c)}),function(){}}),d("0")()}(); \ No newline at end of file +!function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager"),e=tinymce.util.Tools.resolve("tinymce.util.Tools"),i=[["cool","cry","embarassed","foot-in-mouth"],["frown","innocent","kiss","laughing"],["money-mouth","sealed","smile","surprised"],["tongue-out","undecided","wink","yell"]],o=function(t){var o;return o='',e.each(i,function(i){o+="",e.each(i,function(e){var i=t+"/img/smiley-"+e+".gif";o+=''}),o+=""}),o+="
"},n=function(t,e){var i=o(e);t.addButton("emoticons",{type:"panelbutton",panel:{role:"application",autohide:!0,html:i,onclick:function(e){var i,o,n,a=t.dom.getParent(e.target,"a");a&&(i=t,o=a.getAttribute("data-mce-url"),n=a.getAttribute("data-mce-alt"),i.insertContent(i.dom.createHTML("img",{src:o,alt:n})),this.hide())}},tooltip:"Emoticons"})};t.add("emoticons",function(t,e){n(t,e)})}(); \ No newline at end of file diff --git a/tinymce_4/static/tinymce_4/tinymce/plugins/fullpage/plugin.js b/tinymce_4/static/tinymce_4/tinymce/plugins/fullpage/plugin.js index 696712e..80c5201 100644 --- a/tinymce_4/static/tinymce_4/tinymce/plugins/fullpage/plugin.js +++ b/tinymce_4/static/tinymce_4/tinymce/plugins/fullpage/plugin.js @@ -1,962 +1,519 @@ (function () { +var fullpage = (function () { + 'use strict'; -var defs = {}; // id -> {dependencies, definition, instance (possibly undefined)} - -// Used when there is no 'main' module. -// The name is probably (hopefully) unique so minification removes for releases. -var register_3795 = function (id) { - var module = dem(id); - var fragments = id.split('.'); - var target = Function('return this;')(); - for (var i = 0; i < fragments.length - 1; ++i) { - if (target[fragments[i]] === undefined) - target[fragments[i]] = {}; - target = target[fragments[i]]; - } - target[fragments[fragments.length - 1]] = module; -}; - -var instantiate = function (id) { - var actual = defs[id]; - var dependencies = actual.deps; - var definition = actual.defn; - var len = dependencies.length; - var instances = new Array(len); - for (var i = 0; i < len; ++i) - instances[i] = dem(dependencies[i]); - var defResult = definition.apply(null, instances); - if (defResult === undefined) - throw 'module [' + id + '] returned undefined'; - actual.instance = defResult; -}; - -var def = function (id, dependencies, definition) { - if (typeof id !== 'string') - throw 'module id must be a string'; - else if (dependencies === undefined) - throw 'no dependencies for ' + id; - else if (definition === undefined) - throw 'no definition function for ' + id; - defs[id] = { - deps: dependencies, - defn: definition, - instance: undefined - }; -}; - -var dem = function (id) { - var actual = defs[id]; - if (actual === undefined) - throw 'module [' + id + '] was undefined'; - else if (actual.instance === undefined) - instantiate(id); - return actual.instance; -}; - -var req = function (ids, callback) { - var len = ids.length; - var instances = new Array(len); - for (var i = 0; i < len; ++i) - instances[i] = dem(ids[i]); - callback.apply(null, instances); -}; - -var ephox = {}; - -ephox.bolt = { - module: { - api: { - define: def, - require: req, - demand: dem - } - } -}; - -var define = def; -var require = req; -var demand = dem; -// this helps with minification when using a lot of global references -var defineGlobal = function (id, ref) { - define(id, [], function () { return ref; }); -}; -/*jsc -["tinymce.plugins.fullpage.Plugin","ephox.katamari.api.Cell","tinymce.core.PluginManager","tinymce.plugins.fullpage.api.Commands","tinymce.plugins.fullpage.core.FilterContent","tinymce.plugins.fullpage.ui.Buttons","global!tinymce.util.Tools.resolve","tinymce.plugins.fullpage.ui.Dialog","tinymce.core.util.Tools","tinymce.plugins.fullpage.api.Settings","tinymce.plugins.fullpage.core.Parser","tinymce.plugins.fullpage.core.Protect","tinymce.core.html.DomParser","tinymce.core.html.Node","tinymce.core.html.Serializer"] -jsc*/ -define( - 'ephox.katamari.api.Cell', - - [ - ], - - function () { - var Cell = function (initial) { - var value = initial; - - var get = function () { - return value; - }; - - var set = function (v) { - value = v; - }; - - var clone = function () { - return Cell(get()); - }; - - return { - get: get, - set: set, - clone: clone - }; - }; - - return Cell; - } -); - -defineGlobal("global!tinymce.util.Tools.resolve", tinymce.util.Tools.resolve); -/** - * ResolveGlobal.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.core.PluginManager', - [ - 'global!tinymce.util.Tools.resolve' - ], - function (resolve) { - return resolve('tinymce.PluginManager'); - } -); - -/** - * ResolveGlobal.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.core.util.Tools', - [ - 'global!tinymce.util.Tools.resolve' - ], - function (resolve) { - return resolve('tinymce.util.Tools'); - } -); - -/** - * ResolveGlobal.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.core.html.DomParser', - [ - 'global!tinymce.util.Tools.resolve' - ], - function (resolve) { - return resolve('tinymce.html.DomParser'); - } -); - -/** - * ResolveGlobal.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.core.html.Node', - [ - 'global!tinymce.util.Tools.resolve' - ], - function (resolve) { - return resolve('tinymce.html.Node'); - } -); - -/** - * ResolveGlobal.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.core.html.Serializer', - [ - 'global!tinymce.util.Tools.resolve' - ], - function (resolve) { - return resolve('tinymce.html.Serializer'); - } -); - -/** - * Settings.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.fullpage.api.Settings', - [ - ], - function () { - var shouldHideInSourceView = function (editor) { - return editor.getParam('fullpage_hide_in_source_view'); + var Cell = function (initial) { + var value = initial; + var get = function () { + return value; }; - - var getDefaultXmlPi = function (editor) { - return editor.getParam('fullpage_default_xml_pi'); + var set = function (v) { + value = v; }; - - var getDefaultEncoding = function (editor) { - return editor.getParam('fullpage_default_encoding'); + var clone = function () { + return Cell(get()); }; - - var getDefaultFontFamily = function (editor) { - return editor.getParam('fullpage_default_font_family'); - }; - - var getDefaultFontSize = function (editor) { - return editor.getParam('fullpage_default_font_size'); - }; - - var getDefaultTextColor = function (editor) { - return editor.getParam('fullpage_default_text_color'); + return { + get: get, + set: set, + clone: clone }; + }; - var getDefaultTitle = function (editor) { - return editor.getParam('fullpage_default_title'); - }; + var PluginManager = tinymce.util.Tools.resolve('tinymce.PluginManager'); - var getDefaultDocType = function (editor) { - return editor.getParam('fullpage_default_doctype', ''); - }; + var Tools = tinymce.util.Tools.resolve('tinymce.util.Tools'); - return { - shouldHideInSourceView: shouldHideInSourceView, - getDefaultXmlPi: getDefaultXmlPi, - getDefaultEncoding: getDefaultEncoding, - getDefaultFontFamily: getDefaultFontFamily, - getDefaultFontSize: getDefaultFontSize, - getDefaultTextColor: getDefaultTextColor, - getDefaultTitle: getDefaultTitle, - getDefaultDocType: getDefaultDocType - }; - } -); -/** - * Protect.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ + var DomParser = tinymce.util.Tools.resolve('tinymce.html.DomParser'); -define( - 'tinymce.plugins.fullpage.core.Parser', - [ - 'tinymce.core.html.DomParser', - 'tinymce.core.html.Node', - 'tinymce.core.html.Serializer', - 'tinymce.core.util.Tools', - 'tinymce.plugins.fullpage.api.Settings' - ], - function (DomParser, Node, Serializer, Tools, Settings) { - var parseHeader = function (head) { - // Parse the contents with a DOM parser - return new DomParser({ - validate: false, - root_name: '#document' - }).parse(head); - }; + var Node = tinymce.util.Tools.resolve('tinymce.html.Node'); - var htmlToData = function (editor, head) { - var headerFragment = parseHeader(head), data = {}, elm, matches; + var Serializer = tinymce.util.Tools.resolve('tinymce.html.Serializer'); - function getAttr(elm, name) { - var value = elm.attr(name); + var shouldHideInSourceView = function (editor) { + return editor.getParam('fullpage_hide_in_source_view'); + }; + var getDefaultXmlPi = function (editor) { + return editor.getParam('fullpage_default_xml_pi'); + }; + var getDefaultEncoding = function (editor) { + return editor.getParam('fullpage_default_encoding'); + }; + var getDefaultFontFamily = function (editor) { + return editor.getParam('fullpage_default_font_family'); + }; + var getDefaultFontSize = function (editor) { + return editor.getParam('fullpage_default_font_size'); + }; + var getDefaultTextColor = function (editor) { + return editor.getParam('fullpage_default_text_color'); + }; + var getDefaultTitle = function (editor) { + return editor.getParam('fullpage_default_title'); + }; + var getDefaultDocType = function (editor) { + return editor.getParam('fullpage_default_doctype', ''); + }; + var $_e0ugg1bdje5nvbsm = { + shouldHideInSourceView: shouldHideInSourceView, + getDefaultXmlPi: getDefaultXmlPi, + getDefaultEncoding: getDefaultEncoding, + getDefaultFontFamily: getDefaultFontFamily, + getDefaultFontSize: getDefaultFontSize, + getDefaultTextColor: getDefaultTextColor, + getDefaultTitle: getDefaultTitle, + getDefaultDocType: getDefaultDocType + }; - return value || ''; + var parseHeader = function (head) { + return DomParser({ + validate: false, + root_name: '#document' + }).parse(head); + }; + var htmlToData = function (editor, head) { + var headerFragment = parseHeader(head); + var data = {}; + var elm, matches; + function getAttr(elm, name) { + var value = elm.attr(name); + return value || ''; + } + data.fontface = $_e0ugg1bdje5nvbsm.getDefaultFontFamily(editor); + data.fontsize = $_e0ugg1bdje5nvbsm.getDefaultFontSize(editor); + elm = headerFragment.firstChild; + if (elm.type === 7) { + data.xml_pi = true; + matches = /encoding="([^"]+)"/.exec(elm.value); + if (matches) { + data.docencoding = matches[1]; } - - // Default some values - // TODO: Not sure these are used anymore - data.fontface = Settings.getDefaultFontFamily(editor); - data.fontsize = Settings.getDefaultFontSize(editor); - - // Parse XML PI - elm = headerFragment.firstChild; - if (elm.type === 7) { - data.xml_pi = true; - matches = /encoding="([^"]+)"/.exec(elm.value); + } + elm = headerFragment.getAll('#doctype')[0]; + if (elm) { + data.doctype = ''; + } + elm = headerFragment.getAll('title')[0]; + if (elm && elm.firstChild) { + data.title = elm.firstChild.value; + } + Tools.each(headerFragment.getAll('meta'), function (meta) { + var name = meta.attr('name'); + var httpEquiv = meta.attr('http-equiv'); + var matches; + if (name) { + data[name.toLowerCase()] = meta.attr('content'); + } else if (httpEquiv === 'Content-Type') { + matches = /charset\s*=\s*(.*)\s*/gi.exec(meta.attr('content')); if (matches) { data.docencoding = matches[1]; } } - - // Parse doctype - elm = headerFragment.getAll('#doctype')[0]; - if (elm) { - data.doctype = '"; + }); + elm = headerFragment.getAll('html')[0]; + if (elm) { + data.langcode = getAttr(elm, 'lang') || getAttr(elm, 'xml:lang'); + } + data.stylesheets = []; + Tools.each(headerFragment.getAll('link'), function (link) { + if (link.attr('rel') === 'stylesheet') { + data.stylesheets.push(link.attr('href')); } - - // Parse title element - elm = headerFragment.getAll('title')[0]; - if (elm && elm.firstChild) { - data.title = elm.firstChild.value; + }); + elm = headerFragment.getAll('body')[0]; + if (elm) { + data.langdir = getAttr(elm, 'dir'); + data.style = getAttr(elm, 'style'); + data.visited_color = getAttr(elm, 'vlink'); + data.link_color = getAttr(elm, 'link'); + data.active_color = getAttr(elm, 'alink'); + } + return data; + }; + var dataToHtml = function (editor, data, head) { + var headerFragment, headElement, html, elm, value; + var dom = editor.dom; + function setAttr(elm, name, value) { + elm.attr(name, value ? value : undefined); + } + function addHeadNode(node) { + if (headElement.firstChild) { + headElement.insert(node, headElement.firstChild); + } else { + headElement.append(node); } - - // Parse meta elements - Tools.each(headerFragment.getAll('meta'), function (meta) { - var name = meta.attr('name'), httpEquiv = meta.attr('http-equiv'), matches; - - if (name) { - data[name.toLowerCase()] = meta.attr('content'); - } else if (httpEquiv === "Content-Type") { - matches = /charset\s*=\s*(.*)\s*/gi.exec(meta.attr('content')); - - if (matches) { - data.docencoding = matches[1]; - } - } - }); - - // Parse html attribs + } + headerFragment = parseHeader(head); + headElement = headerFragment.getAll('head')[0]; + if (!headElement) { elm = headerFragment.getAll('html')[0]; - if (elm) { - data.langcode = getAttr(elm, 'lang') || getAttr(elm, 'xml:lang'); - } - - // Parse stylesheets - data.stylesheets = []; - Tools.each(headerFragment.getAll('link'), function (link) { - if (link.attr('rel') === 'stylesheet') { - data.stylesheets.push(link.attr('href')); - } - }); - - // Parse body parts - elm = headerFragment.getAll('body')[0]; - if (elm) { - data.langdir = getAttr(elm, 'dir'); - data.style = getAttr(elm, 'style'); - data.visited_color = getAttr(elm, 'vlink'); - data.link_color = getAttr(elm, 'link'); - data.active_color = getAttr(elm, 'alink'); + headElement = new Node('head', 1); + if (elm.firstChild) { + elm.insert(headElement, elm.firstChild, true); + } else { + elm.append(headElement); } - - return data; - }; - - var dataToHtml = function (editor, data, head) { - var headerFragment, headElement, html, elm, value, dom = editor.dom; - - function setAttr(elm, name, value) { - elm.attr(name, value ? value : undefined); + } + elm = headerFragment.firstChild; + if (data.xml_pi) { + value = 'version="1.0"'; + if (data.docencoding) { + value += ' encoding="' + data.docencoding + '"'; } - - function addHeadNode(node) { - if (headElement.firstChild) { - headElement.insert(node, headElement.firstChild); - } else { - headElement.append(node); - } + if (elm.type !== 7) { + elm = new Node('xml', 7); + headerFragment.insert(elm, headerFragment.firstChild, true); } - - headerFragment = parseHeader(head); - headElement = headerFragment.getAll('head')[0]; - if (!headElement) { - elm = headerFragment.getAll('html')[0]; - headElement = new Node('head', 1); - - if (elm.firstChild) { - elm.insert(headElement, elm.firstChild, true); + elm.value = value; + } else if (elm && elm.type === 7) { + elm.remove(); + } + elm = headerFragment.getAll('#doctype')[0]; + if (data.doctype) { + if (!elm) { + elm = new Node('#doctype', 10); + if (data.xml_pi) { + headerFragment.insert(elm, headerFragment.firstChild); } else { - elm.append(headElement); - } - } - - // Add/update/remove XML-PI - elm = headerFragment.firstChild; - if (data.xml_pi) { - value = 'version="1.0"'; - - if (data.docencoding) { - value += ' encoding="' + data.docencoding + '"'; - } - - if (elm.type !== 7) { - elm = new Node('xml', 7); - headerFragment.insert(elm, headerFragment.firstChild, true); + addHeadNode(elm); } - - elm.value = value; - } else if (elm && elm.type === 7) { - elm.remove(); } - - // Add/update/remove doctype - elm = headerFragment.getAll('#doctype')[0]; - if (data.doctype) { - if (!elm) { - elm = new Node('#doctype', 10); - - if (data.xml_pi) { - headerFragment.insert(elm, headerFragment.firstChild); - } else { - addHeadNode(elm); - } - } - - elm.value = data.doctype.substring(9, data.doctype.length - 1); - } else if (elm) { - elm.remove(); + elm.value = data.doctype.substring(9, data.doctype.length - 1); + } else if (elm) { + elm.remove(); + } + elm = null; + Tools.each(headerFragment.getAll('meta'), function (meta) { + if (meta.attr('http-equiv') === 'Content-Type') { + elm = meta; } - - // Add meta encoding - elm = null; - Tools.each(headerFragment.getAll('meta'), function (meta) { - if (meta.attr('http-equiv') === 'Content-Type') { - elm = meta; - } - }); - - if (data.docencoding) { - if (!elm) { - elm = new Node('meta', 1); - elm.attr('http-equiv', 'Content-Type'); - elm.shortEnded = true; - addHeadNode(elm); - } - - elm.attr('content', 'text/html; charset=' + data.docencoding); - } else if (elm) { - elm.remove(); + }); + if (data.docencoding) { + if (!elm) { + elm = new Node('meta', 1); + elm.attr('http-equiv', 'Content-Type'); + elm.shortEnded = true; + addHeadNode(elm); } - - // Add/update/remove title - elm = headerFragment.getAll('title')[0]; - if (data.title) { - if (!elm) { - elm = new Node('title', 1); - addHeadNode(elm); - } else { - elm.empty(); - } - - elm.append(new Node('#text', 3)).value = data.title; - } else if (elm) { - elm.remove(); + elm.attr('content', 'text/html; charset=' + data.docencoding); + } else if (elm) { + elm.remove(); + } + elm = headerFragment.getAll('title')[0]; + if (data.title) { + if (!elm) { + elm = new Node('title', 1); + addHeadNode(elm); + } else { + elm.empty(); } - - // Add/update/remove meta - Tools.each('keywords,description,author,copyright,robots'.split(','), function (name) { - var nodes = headerFragment.getAll('meta'), i, meta, value = data[name]; - - for (i = 0; i < nodes.length; i++) { - meta = nodes[i]; - - if (meta.attr('name') === name) { - if (value) { - meta.attr('content', value); - } else { - meta.remove(); - } - - return; + elm.append(new Node('#text', 3)).value = data.title; + } else if (elm) { + elm.remove(); + } + Tools.each('keywords,description,author,copyright,robots'.split(','), function (name) { + var nodes = headerFragment.getAll('meta'); + var i, meta; + var value = data[name]; + for (i = 0; i < nodes.length; i++) { + meta = nodes[i]; + if (meta.attr('name') === name) { + if (value) { + meta.attr('content', value); + } else { + meta.remove(); } + return; } - - if (value) { - elm = new Node('meta', 1); - elm.attr('name', name); - elm.attr('content', value); - elm.shortEnded = true; - - addHeadNode(elm); - } - }); - - var currentStyleSheetsMap = {}; - Tools.each(headerFragment.getAll('link'), function (stylesheet) { - if (stylesheet.attr('rel') === 'stylesheet') { - currentStyleSheetsMap[stylesheet.attr('href')] = stylesheet; - } - }); - - // Add new - Tools.each(data.stylesheets, function (stylesheet) { - if (!currentStyleSheetsMap[stylesheet]) { - elm = new Node('link', 1); - elm.attr({ - rel: 'stylesheet', - text: 'text/css', - href: stylesheet - }); - elm.shortEnded = true; - addHeadNode(elm); - } - - delete currentStyleSheetsMap[stylesheet]; - }); - - // Delete old - Tools.each(currentStyleSheetsMap, function (stylesheet) { - stylesheet.remove(); - }); - - // Update body attributes - elm = headerFragment.getAll('body')[0]; - if (elm) { - setAttr(elm, 'dir', data.langdir); - setAttr(elm, 'style', data.style); - setAttr(elm, 'vlink', data.visited_color); - setAttr(elm, 'link', data.link_color); - setAttr(elm, 'alink', data.active_color); - - // Update iframe body as well - dom.setAttribs(editor.getBody(), { - style: data.style, - dir: data.dir, - vLink: data.visited_color, - link: data.link_color, - aLink: data.active_color - }); } - - // Set html attributes - elm = headerFragment.getAll('html')[0]; - if (elm) { - setAttr(elm, 'lang', data.langcode); - setAttr(elm, 'xml:lang', data.langcode); + if (value) { + elm = new Node('meta', 1); + elm.attr('name', name); + elm.attr('content', value); + elm.shortEnded = true; + addHeadNode(elm); } - - // No need for a head element - if (!headElement.firstChild) { - headElement.remove(); + }); + var currentStyleSheetsMap = {}; + Tools.each(headerFragment.getAll('link'), function (stylesheet) { + if (stylesheet.attr('rel') === 'stylesheet') { + currentStyleSheetsMap[stylesheet.attr('href')] = stylesheet; } - - // Serialize header fragment and crop away body part - html = new Serializer({ - validate: false, - indent: true, - apply_source_formatting: true, - indent_before: 'head,html,body,meta,title,script,link,style', - indent_after: 'head,html,body,meta,title,script,link,style' - }).serialize(headerFragment); - - return html.substring(0, html.indexOf('')); - }; - - return { - parseHeader: parseHeader, - htmlToData: htmlToData, - dataToHtml: dataToHtml - }; - } -); - -/** - * Dialog.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.fullpage.ui.Dialog', - [ - 'tinymce.core.util.Tools', - 'tinymce.plugins.fullpage.core.Parser' - ], - function (Tools, Parser) { - var open = function (editor, headState) { - var data = Parser.htmlToData(editor, headState.get()); - - editor.windowManager.open({ - title: 'Document properties', - data: data, - defaults: { type: 'textbox', size: 40 }, - body: [ - { name: 'title', label: 'Title' }, - { name: 'keywords', label: 'Keywords' }, - { name: 'description', label: 'Description' }, - { name: 'robots', label: 'Robots' }, - { name: 'author', label: 'Author' }, - { name: 'docencoding', label: 'Encoding' } - ], - onSubmit: function (e) { - var headHtml = Parser.dataToHtml(editor, Tools.extend(data, e.data), headState.get()); - headState.set(headHtml); - } - }); - }; - - return { - open: open - }; - } -); - -/** - * Commands.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.fullpage.api.Commands', - [ - 'tinymce.plugins.fullpage.ui.Dialog' - ], - function (Dialog) { - var register = function (editor, headState) { - editor.addCommand('mceFullPageProperties', function () { - Dialog.open(editor, headState); - }); - }; - - return { - register: register - }; - } -); -/** - * Protect.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.fullpage.core.Protect', - [ - 'tinymce.core.util.Tools' - ], - function (Tools) { - var protectHtml = function (protect, html) { - Tools.each(protect, function (pattern) { - html = html.replace(pattern, function (str) { - return ''; + }); + Tools.each(data.stylesheets, function (stylesheet) { + if (!currentStyleSheetsMap[stylesheet]) { + elm = new Node('link', 1); + elm.attr({ + rel: 'stylesheet', + text: 'text/css', + href: stylesheet }); - }); - - return html; - }; - - var unprotectHtml = function (html) { - return html.replace(//g, function (a, m) { - return unescape(m); - }); - }; - - return { - protectHtml: protectHtml, - unprotectHtml: unprotectHtml - }; - } -); - -/** - * FilterContent.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.fullpage.core.FilterContent', - [ - 'tinymce.core.util.Tools', - 'tinymce.plugins.fullpage.api.Settings', - 'tinymce.plugins.fullpage.core.Parser', - 'tinymce.plugins.fullpage.core.Protect' - ], - function (Tools, Settings, Parser, Protect) { - var each = Tools.each; - - var low = function (s) { - return s.replace(/<\/?[A-Z]+/g, function (a) { - return a.toLowerCase(); - }); - }; - - var handleSetContent = function (editor, headState, footState, evt) { - var startPos, endPos, content, headerFragment, styles = '', dom = editor.dom, elm; - - if (evt.selection) { - return; - } - - content = Protect.protectHtml(editor.settings.protect, evt.content); - - // Ignore raw updated if we already have a head, this will fix issues with undo/redo keeping the head/foot separate - if (evt.format === 'raw' && headState.get()) { - return; - } - - if (evt.source_view && Settings.shouldHideInSourceView(editor)) { - return; - } - - // Fixed so new document/setContent('') doesn't remove existing header/footer except when it's in source code view - if (content.length === 0 && !evt.source_view) { - content = Tools.trim(headState.get()) + '\n' + Tools.trim(content) + '\n' + Tools.trim(footState.get()); + elm.shortEnded = true; + addHeadNode(elm); } - - // Parse out head, body and footer - content = content.replace(/<(\/?)BODY/gi, '<$1body'); - startPos = content.indexOf('', startPos); - headState.set(low(content.substring(0, startPos + 1))); - - endPos = content.indexOf('\n'); - } - - // Parse header and update iframe - headerFragment = Parser.parseHeader(headState.get()); - each(headerFragment.getAll('style'), function (node) { - if (node.firstChild) { - styles += node.firstChild.value; - } + delete currentStyleSheetsMap[stylesheet]; + }); + Tools.each(currentStyleSheetsMap, function (stylesheet) { + stylesheet.remove(); + }); + elm = headerFragment.getAll('body')[0]; + if (elm) { + setAttr(elm, 'dir', data.langdir); + setAttr(elm, 'style', data.style); + setAttr(elm, 'vlink', data.visited_color); + setAttr(elm, 'link', data.link_color); + setAttr(elm, 'alink', data.active_color); + dom.setAttribs(editor.getBody(), { + style: data.style, + dir: data.dir, + vLink: data.visited_color, + link: data.link_color, + aLink: data.active_color }); + } + elm = headerFragment.getAll('html')[0]; + if (elm) { + setAttr(elm, 'lang', data.langcode); + setAttr(elm, 'xml:lang', data.langcode); + } + if (!headElement.firstChild) { + headElement.remove(); + } + html = Serializer({ + validate: false, + indent: true, + apply_source_formatting: true, + indent_before: 'head,html,body,meta,title,script,link,style', + indent_after: 'head,html,body,meta,title,script,link,style' + }).serialize(headerFragment); + return html.substring(0, html.indexOf('')); + }; + var $_6ivrn3b9je5nvbsd = { + parseHeader: parseHeader, + htmlToData: htmlToData, + dataToHtml: dataToHtml + }; - elm = headerFragment.getAll('body')[0]; - if (elm) { - dom.setAttribs(editor.getBody(), { - style: elm.attr('style') || '', - dir: elm.attr('dir') || '', - vLink: elm.attr('vlink') || '', - link: elm.attr('link') || '', - aLink: elm.attr('alink') || '' - }); - } - - dom.remove('fullpage_styles'); - - var headElm = editor.getDoc().getElementsByTagName('head')[0]; - - if (styles) { - dom.add(headElm, 'style', { - id: 'fullpage_styles' - }, styles); - - // Needed for IE 6/7 - elm = dom.get('fullpage_styles'); - if (elm.styleSheet) { - elm.styleSheet.cssText = styles; + var open = function (editor, headState) { + var data = $_6ivrn3b9je5nvbsd.htmlToData(editor, headState.get()); + editor.windowManager.open({ + title: 'Document properties', + data: data, + defaults: { + type: 'textbox', + size: 40 + }, + body: [ + { + name: 'title', + label: 'Title' + }, + { + name: 'keywords', + label: 'Keywords' + }, + { + name: 'description', + label: 'Description' + }, + { + name: 'robots', + label: 'Robots' + }, + { + name: 'author', + label: 'Author' + }, + { + name: 'docencoding', + label: 'Encoding' } + ], + onSubmit: function (e) { + var headHtml = $_6ivrn3b9je5nvbsd.dataToHtml(editor, Tools.extend(data, e.data), headState.get()); + headState.set(headHtml); } + }); + }; + var $_12r4fvb7je5nvbsa = { open: open }; - var currentStyleSheetsMap = {}; - Tools.each(headElm.getElementsByTagName('link'), function (stylesheet) { - if (stylesheet.rel === 'stylesheet' && stylesheet.getAttribute('data-mce-fullpage')) { - currentStyleSheetsMap[stylesheet.href] = stylesheet; - } - }); - - // Add new - Tools.each(headerFragment.getAll('link'), function (stylesheet) { - var href = stylesheet.attr('href'); - if (!href) { - return true; - } - - if (!currentStyleSheetsMap[href] && stylesheet.attr('rel') === 'stylesheet') { - dom.add(headElm, 'link', { - rel: 'stylesheet', - text: 'text/css', - href: href, - 'data-mce-fullpage': '1' - }); - } - - delete currentStyleSheetsMap[href]; - }); + var register = function (editor, headState) { + editor.addCommand('mceFullPageProperties', function () { + $_12r4fvb7je5nvbsa.open(editor, headState); + }); + }; + var $_f7sik6b6je5nvbs9 = { register: register }; - // Delete old - Tools.each(currentStyleSheetsMap, function (stylesheet) { - stylesheet.parentNode.removeChild(stylesheet); + var protectHtml = function (protect, html) { + Tools.each(protect, function (pattern) { + html = html.replace(pattern, function (str) { + return ''; }); - }; - - var getDefaultHeader = function (editor) { - var header = '', value, styles = ''; - - if (Settings.getDefaultXmlPi(editor)) { - var piEncoding = Settings.getDefaultEncoding(editor); - header += '\n'; - } - - header += Settings.getDefaultDocType(editor); - header += '\n\n\n'; + }); + return html; + }; + var unprotectHtml = function (html) { + return html.replace(//g, function (a, m) { + return unescape(m); + }); + }; + var $_54m0yxbfje5nvbst = { + protectHtml: protectHtml, + unprotectHtml: unprotectHtml + }; - if ((value = Settings.getDefaultTitle(editor))) { - header += '' + value + '\n'; + var each = Tools.each; + var low = function (s) { + return s.replace(/<\/?[A-Z]+/g, function (a) { + return a.toLowerCase(); + }); + }; + var handleSetContent = function (editor, headState, footState, evt) { + var startPos, endPos, content, headerFragment, styles = ''; + var dom = editor.dom; + var elm; + if (evt.selection) { + return; + } + content = $_54m0yxbfje5nvbst.protectHtml(editor.settings.protect, evt.content); + if (evt.format === 'raw' && headState.get()) { + return; + } + if (evt.source_view && $_e0ugg1bdje5nvbsm.shouldHideInSourceView(editor)) { + return; + } + if (content.length === 0 && !evt.source_view) { + content = Tools.trim(headState.get()) + '\n' + Tools.trim(content) + '\n' + Tools.trim(footState.get()); + } + content = content.replace(/<(\/?)BODY/gi, '<$1body'); + startPos = content.indexOf('', startPos); + headState.set(low(content.substring(0, startPos + 1))); + endPos = content.indexOf('\n'; + evt.content = Tools.trim(content.substring(startPos + 1, endPos)); + footState.set(low(content.substring(endPos))); + } else { + headState.set(getDefaultHeader(editor)); + footState.set('\n\n'); + } + headerFragment = $_6ivrn3b9je5nvbsd.parseHeader(headState.get()); + each(headerFragment.getAll('style'), function (node) { + if (node.firstChild) { + styles += node.firstChild.value; } - - if ((value = Settings.getDefaultFontFamily(editor))) { - styles += 'font-family: ' + value + ';'; + }); + elm = headerFragment.getAll('body')[0]; + if (elm) { + dom.setAttribs(editor.getBody(), { + style: elm.attr('style') || '', + dir: elm.attr('dir') || '', + vLink: elm.attr('vlink') || '', + link: elm.attr('link') || '', + aLink: elm.attr('alink') || '' + }); + } + dom.remove('fullpage_styles'); + var headElm = editor.getDoc().getElementsByTagName('head')[0]; + if (styles) { + dom.add(headElm, 'style', { id: 'fullpage_styles' }, styles); + elm = dom.get('fullpage_styles'); + if (elm.styleSheet) { + elm.styleSheet.cssText = styles; } - - if ((value = Settings.getDefaultFontSize(editor))) { - styles += 'font-size: ' + value + ';'; + } + var currentStyleSheetsMap = {}; + Tools.each(headElm.getElementsByTagName('link'), function (stylesheet) { + if (stylesheet.rel === 'stylesheet' && stylesheet.getAttribute('data-mce-fullpage')) { + currentStyleSheetsMap[stylesheet.href] = stylesheet; } - - if ((value = Settings.getDefaultTextColor(editor))) { - styles += 'color: ' + value + ';'; + }); + Tools.each(headerFragment.getAll('link'), function (stylesheet) { + var href = stylesheet.attr('href'); + if (!href) { + return true; } - - header += '\n\n'; - - return header; - }; - - var handleGetContent = function (editor, head, foot, evt) { - if (!evt.selection && (!evt.source_view || !Settings.shouldHideInSourceView(editor))) { - evt.content = Protect.unprotectHtml(Tools.trim(head) + '\n' + Tools.trim(evt.content) + '\n' + Tools.trim(foot)); + if (!currentStyleSheetsMap[href] && stylesheet.attr('rel') === 'stylesheet') { + dom.add(headElm, 'link', { + 'rel': 'stylesheet', + 'text': 'text/css', + 'href': href, + 'data-mce-fullpage': '1' + }); } - }; - - var setup = function (editor, headState, footState) { - editor.on('BeforeSetContent', function (evt) { - handleSetContent(editor, headState, footState, evt); - }); - editor.on('GetContent', function (evt) { - handleGetContent(editor, headState.get(), footState.get(), evt); - }); - }; - - return { - setup: setup - }; - } -); -/** - * Buttons.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.fullpage.ui.Buttons', - [ - ], - function () { - var register = function (editor) { - editor.addButton('fullpage', { - title: 'Document properties', - cmd: 'mceFullPageProperties' - }); - - editor.addMenuItem('fullpage', { - text: 'Document properties', - cmd: 'mceFullPageProperties', - context: 'file' - }); - }; + delete currentStyleSheetsMap[href]; + }); + Tools.each(currentStyleSheetsMap, function (stylesheet) { + stylesheet.parentNode.removeChild(stylesheet); + }); + }; + var getDefaultHeader = function (editor) { + var header = '', value, styles = ''; + if ($_e0ugg1bdje5nvbsm.getDefaultXmlPi(editor)) { + var piEncoding = $_e0ugg1bdje5nvbsm.getDefaultEncoding(editor); + header += '\n'; + } + header += $_e0ugg1bdje5nvbsm.getDefaultDocType(editor); + header += '\n\n\n'; + if (value = $_e0ugg1bdje5nvbsm.getDefaultTitle(editor)) { + header += '' + value + '\n'; + } + if (value = $_e0ugg1bdje5nvbsm.getDefaultEncoding(editor)) { + header += '\n'; + } + if (value = $_e0ugg1bdje5nvbsm.getDefaultFontFamily(editor)) { + styles += 'font-family: ' + value + ';'; + } + if (value = $_e0ugg1bdje5nvbsm.getDefaultFontSize(editor)) { + styles += 'font-size: ' + value + ';'; + } + if (value = $_e0ugg1bdje5nvbsm.getDefaultTextColor(editor)) { + styles += 'color: ' + value + ';'; + } + header += '\n\n'; + return header; + }; + var handleGetContent = function (editor, head, foot, evt) { + if (!evt.selection && (!evt.source_view || !$_e0ugg1bdje5nvbsm.shouldHideInSourceView(editor))) { + evt.content = $_54m0yxbfje5nvbst.unprotectHtml(Tools.trim(head) + '\n' + Tools.trim(evt.content) + '\n' + Tools.trim(foot)); + } + }; + var setup = function (editor, headState, footState) { + editor.on('BeforeSetContent', function (evt) { + handleSetContent(editor, headState, footState, evt); + }); + editor.on('GetContent', function (evt) { + handleGetContent(editor, headState.get(), footState.get(), evt); + }); + }; + var $_g4dxr5beje5nvbsp = { setup: setup }; - return { - register: register - }; + var register$1 = function (editor) { + editor.addButton('fullpage', { + title: 'Document properties', + cmd: 'mceFullPageProperties' + }); + editor.addMenuItem('fullpage', { + text: 'Document properties', + cmd: 'mceFullPageProperties', + context: 'file' + }); + }; + var $_e0bg5mbgje5nvbsu = { register: register$1 }; + + PluginManager.add('fullpage', function (editor) { + var headState = Cell(''), footState = Cell(''); + $_f7sik6b6je5nvbs9.register(editor, headState); + $_e0bg5mbgje5nvbsu.register(editor); + $_g4dxr5beje5nvbsp.setup(editor, headState, footState); + }); + function Plugin () { } -); -/** - * Plugin.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.fullpage.Plugin', - [ - 'ephox.katamari.api.Cell', - 'tinymce.core.PluginManager', - 'tinymce.plugins.fullpage.api.Commands', - 'tinymce.plugins.fullpage.core.FilterContent', - 'tinymce.plugins.fullpage.ui.Buttons' - ], - function (Cell, PluginManager, Commands, FilterContent, Buttons) { - PluginManager.add('fullpage', function (editor) { - var headState = Cell(''), footState = Cell(''); - Commands.register(editor, headState); - Buttons.register(editor); - FilterContent.setup(editor, headState, footState); - }); + return Plugin; - return function () { }; - } -); -dem('tinymce.plugins.fullpage.Plugin')(); +}()); })(); diff --git a/tinymce_4/static/tinymce_4/tinymce/plugins/fullpage/plugin.min.js b/tinymce_4/static/tinymce_4/tinymce/plugins/fullpage/plugin.min.js index 8705544..9d2cdff 100644 --- a/tinymce_4/static/tinymce_4/tinymce/plugins/fullpage/plugin.min.js +++ b/tinymce_4/static/tinymce_4/tinymce/plugins/fullpage/plugin.min.js @@ -1 +1 @@ -!function(){var a={},b=function(b){for(var c=a[b],e=c.deps,f=c.defn,g=e.length,h=new Array(g),i=0;i")};return{shouldHideInSourceView:a,getDefaultXmlPi:b,getDefaultEncoding:c,getDefaultFontFamily:d,getDefaultFontSize:e,getDefaultTextColor:f,getDefaultTitle:g,getDefaultDocType:h}}),g("a",["c","d","e","8","9"],function(a,b,c,d,e){var f=function(b){return new a({validate:!1,root_name:"#document"}).parse(b)},g=function(a,b){function c(a,b){var c=a.attr(b);return c||""}var g,h,i=f(b),j={};return j.fontface=e.getDefaultFontFamily(a),j.fontsize=e.getDefaultFontSize(a),g=i.firstChild,7===g.type&&(j.xml_pi=!0,h=/encoding="([^"]+)"/.exec(g.value),h&&(j.docencoding=h[1])),g=i.getAll("#doctype")[0],g&&(j.doctype=""),g=i.getAll("title")[0],g&&g.firstChild&&(j.title=g.firstChild.value),d.each(i.getAll("meta"),function(a){var b,c=a.attr("name"),d=a.attr("http-equiv");c?j[c.toLowerCase()]=a.attr("content"):"Content-Type"===d&&(b=/charset\s*=\s*(.*)\s*/gi.exec(a.attr("content")),b&&(j.docencoding=b[1]))}),g=i.getAll("html")[0],g&&(j.langcode=c(g,"lang")||c(g,"xml:lang")),j.stylesheets=[],d.each(i.getAll("link"),function(a){"stylesheet"===a.attr("rel")&&j.stylesheets.push(a.attr("href"))}),g=i.getAll("body")[0],g&&(j.langdir=c(g,"dir"),j.style=c(g,"style"),j.visited_color=c(g,"vlink"),j.link_color=c(g,"link"),j.active_color=c(g,"alink")),j},h=function(a,e,g){function h(a,b,c){a.attr(b,c?c:void 0)}function i(a){k.firstChild?k.insert(a,k.firstChild):k.append(a)}var j,k,l,m,n,o=a.dom;j=f(g),k=j.getAll("head")[0],k||(m=j.getAll("html")[0],k=new b("head",1),m.firstChild?m.insert(k,m.firstChild,!0):m.append(k)),m=j.firstChild,e.xml_pi?(n='version="1.0"',e.docencoding&&(n+=' encoding="'+e.docencoding+'"'),7!==m.type&&(m=new b("xml",7),j.insert(m,j.firstChild,!0)),m.value=n):m&&7===m.type&&m.remove(),m=j.getAll("#doctype")[0],e.doctype?(m||(m=new b("#doctype",10),e.xml_pi?j.insert(m,j.firstChild):i(m)),m.value=e.doctype.substring(9,e.doctype.length-1)):m&&m.remove(),m=null,d.each(j.getAll("meta"),function(a){"Content-Type"===a.attr("http-equiv")&&(m=a)}),e.docencoding?(m||(m=new b("meta",1),m.attr("http-equiv","Content-Type"),m.shortEnded=!0,i(m)),m.attr("content","text/html; charset="+e.docencoding)):m&&m.remove(),m=j.getAll("title")[0],e.title?(m?m.empty():(m=new b("title",1),i(m)),m.append(new b("#text",3)).value=e.title):m&&m.remove(),d.each("keywords,description,author,copyright,robots".split(","),function(a){var c,d,f=j.getAll("meta"),g=e[a];for(c=0;c"))};return{parseHeader:f,htmlToData:g,dataToHtml:h}}),g("7",["8","a"],function(a,b){var c=function(c,d){var e=b.htmlToData(c,d.get());c.windowManager.open({title:"Document properties",data:e,defaults:{type:"textbox",size:40},body:[{name:"title",label:"Title"},{name:"keywords",label:"Keywords"},{name:"description",label:"Description"},{name:"robots",label:"Robots"},{name:"author",label:"Author"},{name:"docencoding",label:"Encoding"}],onSubmit:function(f){var g=b.dataToHtml(c,a.extend(e,f.data),d.get());d.set(g)}})};return{open:c}}),g("3",["7"],function(a){var b=function(b,c){b.addCommand("mceFullPageProperties",function(){a.open(b,c)})};return{register:b}}),g("b",["8"],function(a){var b=function(b,c){return a.each(b,function(a){c=c.replace(a,function(a){return""})}),c},c=function(a){return a.replace(//g,function(a,b){return unescape(b)})};return{protectHtml:b,unprotectHtml:c}}),g("4",["8","9","a","b"],function(a,b,c,d){var e=a.each,f=function(a){return a.replace(/<\/?[A-Z]+/g,function(a){return a.toLowerCase()})},g=function(g,i,j,k){var l,m,n,o,p,q="",r=g.dom;if(!(k.selection||(n=d.protectHtml(g.settings.protect,k.content),"raw"===k.format&&i.get()||k.source_view&&b.shouldHideInSourceView(g)))){0!==n.length||k.source_view||(n=a.trim(i.get())+"\n"+a.trim(n)+"\n"+a.trim(j.get())),n=n.replace(/<(\/?)BODY/gi,"<$1body"),l=n.indexOf("",l),i.set(f(n.substring(0,l+1))),m=n.indexOf("\n")),o=c.parseHeader(i.get()),e(o.getAll("style"),function(a){a.firstChild&&(q+=a.firstChild.value)}),p=o.getAll("body")[0],p&&r.setAttribs(g.getBody(),{style:p.attr("style")||"",dir:p.attr("dir")||"",vLink:p.attr("vlink")||"",link:p.attr("link")||"",aLink:p.attr("alink")||""}),r.remove("fullpage_styles");var s=g.getDoc().getElementsByTagName("head")[0];q&&(r.add(s,"style",{id:"fullpage_styles"},q),p=r.get("fullpage_styles"),p.styleSheet&&(p.styleSheet.cssText=q));var t={};a.each(s.getElementsByTagName("link"),function(a){"stylesheet"===a.rel&&a.getAttribute("data-mce-fullpage")&&(t[a.href]=a)}),a.each(o.getAll("link"),function(a){var b=a.attr("href");return!b||(t[b]||"stylesheet"!==a.attr("rel")||r.add(s,"link",{rel:"stylesheet",text:"text/css",href:b,"data-mce-fullpage":"1"}),void delete t[b])}),a.each(t,function(a){a.parentNode.removeChild(a)})}},h=function(a){var c,d="",e="";if(b.getDefaultXmlPi(a)){var f=b.getDefaultEncoding(a);d+='\n'}return d+=b.getDefaultDocType(a),d+="\n\n\n",(c=b.getDefaultTitle(a))&&(d+=""+c+"\n"),(c=b.getDefaultEncoding(a))&&(d+='\n'),(c=b.getDefaultFontFamily(a))&&(e+="font-family: "+c+";"),(c=b.getDefaultFontSize(a))&&(e+="font-size: "+c+";"),(c=b.getDefaultTextColor(a))&&(e+="color: "+c+";"),d+="\n\n"},i=function(c,e,f,g){g.selection||g.source_view&&b.shouldHideInSourceView(c)||(g.content=d.unprotectHtml(a.trim(e)+"\n"+a.trim(g.content)+"\n"+a.trim(f)))},j=function(a,b,c){a.on("BeforeSetContent",function(d){g(a,b,c,d)}),a.on("GetContent",function(d){i(a,b.get(),c.get(),d)})};return{setup:j}}),g("5",[],function(){var a=function(a){a.addButton("fullpage",{title:"Document properties",cmd:"mceFullPageProperties"}),a.addMenuItem("fullpage",{text:"Document properties",cmd:"mceFullPageProperties",context:"file"})};return{register:a}}),g("0",["1","2","3","4","5"],function(a,b,c,d,e){return b.add("fullpage",function(b){var f=a(""),g=a("");c.register(b,f),e.register(b),d.setup(b,f,g)}),function(){}}),d("0")()}(); \ No newline at end of file +!function(){"use strict";var e=function(t){var n=t,l=function(){return n};return{get:l,set:function(e){n=e},clone:function(){return e(l())}}},t=tinymce.util.Tools.resolve("tinymce.PluginManager"),n=tinymce.util.Tools.resolve("tinymce.util.Tools"),l=tinymce.util.Tools.resolve("tinymce.html.DomParser"),i=tinymce.util.Tools.resolve("tinymce.html.Node"),r=tinymce.util.Tools.resolve("tinymce.html.Serializer"),o=function(e){return e.getParam("fullpage_hide_in_source_view")},a=function(e){return e.getParam("fullpage_default_xml_pi")},c=function(e){return e.getParam("fullpage_default_encoding")},s=function(e){return e.getParam("fullpage_default_font_family")},u=function(e){return e.getParam("fullpage_default_font_size")},d=function(e){return e.getParam("fullpage_default_text_color")},f=function(e){return e.getParam("fullpage_default_title")},g=function(e){return e.getParam("fullpage_default_doctype","")},m=function(e){return l({validate:!1,root_name:"#document"}).parse(e)},h=m,p=function(e,t){var l,i,r=m(t),o={};function a(e,t){return e.attr(t)||""}return o.fontface=s(e),o.fontsize=u(e),7===(l=r.firstChild).type&&(o.xml_pi=!0,(i=/encoding="([^"]+)"/.exec(l.value))&&(o.docencoding=i[1])),(l=r.getAll("#doctype")[0])&&(o.doctype=""),(l=r.getAll("title")[0])&&l.firstChild&&(o.title=l.firstChild.value),n.each(r.getAll("meta"),function(e){var t,n=e.attr("name"),l=e.attr("http-equiv");n?o[n.toLowerCase()]=e.attr("content"):"Content-Type"===l&&(t=/charset\s*=\s*(.*)\s*/gi.exec(e.attr("content")))&&(o.docencoding=t[1])}),(l=r.getAll("html")[0])&&(o.langcode=a(l,"lang")||a(l,"xml:lang")),o.stylesheets=[],n.each(r.getAll("link"),function(e){"stylesheet"===e.attr("rel")&&o.stylesheets.push(e.attr("href"))}),(l=r.getAll("body")[0])&&(o.langdir=a(l,"dir"),o.style=a(l,"style"),o.visited_color=a(l,"vlink"),o.link_color=a(l,"link"),o.active_color=a(l,"alink")),o},y=function(e,t,l){var o,a,c,s,u,d=e.dom;function f(e,t,n){e.attr(t,n||undefined)}function g(e){a.firstChild?a.insert(e,a.firstChild):a.append(e)}o=m(l),(a=o.getAll("head")[0])||(s=o.getAll("html")[0],a=new i("head",1),s.firstChild?s.insert(a,s.firstChild,!0):s.append(a)),s=o.firstChild,t.xml_pi?(u='version="1.0"',t.docencoding&&(u+=' encoding="'+t.docencoding+'"'),7!==s.type&&(s=new i("xml",7),o.insert(s,o.firstChild,!0)),s.value=u):s&&7===s.type&&s.remove(),s=o.getAll("#doctype")[0],t.doctype?(s||(s=new i("#doctype",10),t.xml_pi?o.insert(s,o.firstChild):g(s)),s.value=t.doctype.substring(9,t.doctype.length-1)):s&&s.remove(),s=null,n.each(o.getAll("meta"),function(e){"Content-Type"===e.attr("http-equiv")&&(s=e)}),t.docencoding?(s||((s=new i("meta",1)).attr("http-equiv","Content-Type"),s.shortEnded=!0,g(s)),s.attr("content","text/html; charset="+t.docencoding)):s&&s.remove(),s=o.getAll("title")[0],t.title?(s?s.empty():g(s=new i("title",1)),s.append(new i("#text",3)).value=t.title):s&&s.remove(),n.each("keywords,description,author,copyright,robots".split(","),function(e){var n,l,r=o.getAll("meta"),a=t[e];for(n=0;n"))},v=function(e,t){var l=p(e,t.get());e.windowManager.open({title:"Document properties",data:l,defaults:{type:"textbox",size:40},body:[{name:"title",label:"Title"},{name:"keywords",label:"Keywords"},{name:"description",label:"Description"},{name:"robots",label:"Robots"},{name:"author",label:"Author"},{name:"docencoding",label:"Encoding"}],onSubmit:function(i){var r=y(e,n.extend(l,i.data),t.get());t.set(r)}})},_=function(e,t){e.addCommand("mceFullPageProperties",function(){v(e,t)})},b=function(e,t){return n.each(e,function(e){t=t.replace(e,function(e){return"\x3c!--mce:protected "+escape(e)+"--\x3e"})}),t},x=function(e){return e.replace(//g,function(e,t){return unescape(t)})},k=n.each,C=function(e){return e.replace(/<\/?[A-Z]+/g,function(e){return e.toLowerCase()})},A=function(e){var t,n="",l="";if(a(e)){var i=c(e);n+='\n'}return n+=g(e),n+="\n\n\n",(t=f(e))&&(n+=""+t+"\n"),(t=c(e))&&(n+='\n'),(t=s(e))&&(l+="font-family: "+t+";"),(t=u(e))&&(l+="font-size: "+t+";"),(t=d(e))&&(l+="color: "+t+";"),n+="\n\n"},w=function(e,t,l){e.on("BeforeSetContent",function(i){!function(e,t,l,i){var r,a,c,s,u,d="",f=e.dom;if(!(i.selection||(c=b(e.settings.protect,i.content),"raw"===i.format&&t.get()||i.source_view&&o(e)))){0!==c.length||i.source_view||(c=n.trim(t.get())+"\n"+n.trim(c)+"\n"+n.trim(l.get())),-1!==(r=(c=c.replace(/<(\/?)BODY/gi,"<$1body")).indexOf("",r),t.set(C(c.substring(0,r+1))),-1===(a=c.indexOf("\n")),s=h(t.get()),k(s.getAll("style"),function(e){e.firstChild&&(d+=e.firstChild.value)}),(u=s.getAll("body")[0])&&f.setAttribs(e.getBody(),{style:u.attr("style")||"",dir:u.attr("dir")||"",vLink:u.attr("vlink")||"",link:u.attr("link")||"",aLink:u.attr("alink")||""}),f.remove("fullpage_styles");var g=e.getDoc().getElementsByTagName("head")[0];d&&(f.add(g,"style",{id:"fullpage_styles"},d),(u=f.get("fullpage_styles")).styleSheet&&(u.styleSheet.cssText=d));var m={};n.each(g.getElementsByTagName("link"),function(e){"stylesheet"===e.rel&&e.getAttribute("data-mce-fullpage")&&(m[e.href]=e)}),n.each(s.getAll("link"),function(e){var t=e.attr("href");if(!t)return!0;m[t]||"stylesheet"!==e.attr("rel")||f.add(g,"link",{rel:"stylesheet",text:"text/css",href:t,"data-mce-fullpage":"1"}),delete m[t]}),n.each(m,function(e){e.parentNode.removeChild(e)})}}(e,t,l,i)}),e.on("GetContent",function(i){var r,a,c,s;r=e,a=t.get(),c=l.get(),(s=i).selection||s.source_view&&o(r)||(s.content=x(n.trim(a)+"\n"+n.trim(s.content)+"\n"+n.trim(c)))})},P=function(e){e.addButton("fullpage",{title:"Document properties",cmd:"mceFullPageProperties"}),e.addMenuItem("fullpage",{text:"Document properties",cmd:"mceFullPageProperties",context:"file"})};t.add("fullpage",function(t){var n=e(""),l=e("");_(t,n),P(t),w(t,n,l)})}(); \ No newline at end of file diff --git a/tinymce_4/static/tinymce_4/tinymce/plugins/fullscreen/plugin.js b/tinymce_4/static/tinymce_4/tinymce/plugins/fullscreen/plugin.js index cc3e81f..fb0e1e2 100644 --- a/tinymce_4/static/tinymce_4/tinymce/plugins/fullscreen/plugin.js +++ b/tinymce_4/static/tinymce_4/tinymce/plugins/fullscreen/plugin.js @@ -1,455 +1,177 @@ (function () { +var fullscreen = (function () { + 'use strict'; -var defs = {}; // id -> {dependencies, definition, instance (possibly undefined)} - -// Used when there is no 'main' module. -// The name is probably (hopefully) unique so minification removes for releases. -var register_3795 = function (id) { - var module = dem(id); - var fragments = id.split('.'); - var target = Function('return this;')(); - for (var i = 0; i < fragments.length - 1; ++i) { - if (target[fragments[i]] === undefined) - target[fragments[i]] = {}; - target = target[fragments[i]]; - } - target[fragments[fragments.length - 1]] = module; -}; - -var instantiate = function (id) { - var actual = defs[id]; - var dependencies = actual.deps; - var definition = actual.defn; - var len = dependencies.length; - var instances = new Array(len); - for (var i = 0; i < len; ++i) - instances[i] = dem(dependencies[i]); - var defResult = definition.apply(null, instances); - if (defResult === undefined) - throw 'module [' + id + '] returned undefined'; - actual.instance = defResult; -}; - -var def = function (id, dependencies, definition) { - if (typeof id !== 'string') - throw 'module id must be a string'; - else if (dependencies === undefined) - throw 'no dependencies for ' + id; - else if (definition === undefined) - throw 'no definition function for ' + id; - defs[id] = { - deps: dependencies, - defn: definition, - instance: undefined - }; -}; - -var dem = function (id) { - var actual = defs[id]; - if (actual === undefined) - throw 'module [' + id + '] was undefined'; - else if (actual.instance === undefined) - instantiate(id); - return actual.instance; -}; - -var req = function (ids, callback) { - var len = ids.length; - var instances = new Array(len); - for (var i = 0; i < len; ++i) - instances[i] = dem(ids[i]); - callback.apply(null, instances); -}; - -var ephox = {}; - -ephox.bolt = { - module: { - api: { - define: def, - require: req, - demand: dem - } - } -}; - -var define = def; -var require = req; -var demand = dem; -// this helps with minification when using a lot of global references -var defineGlobal = function (id, ref) { - define(id, [], function () { return ref; }); -}; -/*jsc -["tinymce.plugins.fullscreen.Plugin","ephox.katamari.api.Cell","tinymce.core.PluginManager","tinymce.plugins.fullscreen.api.Api","tinymce.plugins.fullscreen.api.Commands","tinymce.plugins.fullscreen.ui.Buttons","global!tinymce.util.Tools.resolve","tinymce.plugins.fullscreen.core.Actions","global!document","global!window","tinymce.core.dom.DOMUtils","tinymce.plugins.fullscreen.api.Events"] -jsc*/ -define( - 'ephox.katamari.api.Cell', - - [ - ], - - function () { - var Cell = function (initial) { - var value = initial; - - var get = function () { - return value; - }; - - var set = function (v) { - value = v; - }; - - var clone = function () { - return Cell(get()); - }; - - return { - get: get, - set: set, - clone: clone - }; - }; - - return Cell; - } -); - -defineGlobal("global!tinymce.util.Tools.resolve", tinymce.util.Tools.resolve); -/** - * ResolveGlobal.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.core.PluginManager', - [ - 'global!tinymce.util.Tools.resolve' - ], - function (resolve) { - return resolve('tinymce.PluginManager'); - } -); - -/** - * Api.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.fullscreen.api.Api', - [ - ], - function () { - var get = function (fullscreenState) { - return { - isFullscreen: function () { - return fullscreenState.get() !== null; - } - }; + var Cell = function (initial) { + var value = initial; + var get = function () { + return value; }; - - return { - get: get + var set = function (v) { + value = v; }; - } -); - -defineGlobal("global!document", document); -defineGlobal("global!window", window); -/** - * ResolveGlobal.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.core.dom.DOMUtils', - [ - 'global!tinymce.util.Tools.resolve' - ], - function (resolve) { - return resolve('tinymce.dom.DOMUtils'); - } -); - -/** - * Events.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.fullscreen.api.Events', - [ - ], - function () { - var fireFullscreenStateChanged = function (editor, state) { - editor.fire('FullscreenStateChanged', { state: state }); + var clone = function () { + return Cell(get()); }; - return { - fireFullscreenStateChanged: fireFullscreenStateChanged + get: get, + set: set, + clone: clone }; - } -); - -/** - * Actions.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.fullscreen.core.Actions', - [ - 'global!document', - 'global!window', - 'tinymce.core.dom.DOMUtils', - 'tinymce.plugins.fullscreen.api.Events' - ], - function (document, window, DOMUtils, Events) { - var DOM = DOMUtils.DOM; - - var getWindowSize = function () { - var w, h, win = window, doc = document; - var body = doc.body; + }; - // Old IE - if (body.offsetWidth) { - w = body.offsetWidth; - h = body.offsetHeight; - } + var PluginManager = tinymce.util.Tools.resolve('tinymce.PluginManager'); - // Modern browsers - if (win.innerWidth && win.innerHeight) { - w = win.innerWidth; - h = win.innerHeight; + var get = function (fullscreenState) { + return { + isFullscreen: function () { + return fullscreenState.get() !== null; } - - return { w: w, h: h }; - }; - - var getScrollPos = function () { - var vp = DOM.getViewPort(); - - return { - x: vp.x, - y: vp.y - }; }; + }; + var $_djl9ddbkje5nvbtm = { get: get }; - var setScrollPos = function (pos) { - window.scrollTo(pos.x, pos.y); - }; - - var toggleFullscreen = function (editor, fullscreenInfo) { - var body = document.body, documentElement = document.documentElement, editorContainerStyle; - var editorContainer, iframe, iframeStyle; - - var resize = function () { - DOM.setStyle(iframe, 'height', getWindowSize().h - (editorContainer.clientHeight - iframe.clientHeight)); - }; - - var removeResize = function () { - DOM.unbind(window, 'resize', resize); - }; - - editorContainer = editor.getContainer(); - editorContainerStyle = editorContainer.style; - iframe = editor.getContentAreaContainer().firstChild; - iframeStyle = iframe.style; - - if (!fullscreenInfo) { - var newFullScreenInfo = { - scrollPos: getScrollPos(), - containerWidth: editorContainerStyle.width, - containerHeight: editorContainerStyle.height, - iframeWidth: iframeStyle.width, - iframeHeight: iframeStyle.height, - resizeHandler: resize, - removeHandler: removeResize - }; - - iframeStyle.width = iframeStyle.height = '100%'; - editorContainerStyle.width = editorContainerStyle.height = ''; - - DOM.addClass(body, 'mce-fullscreen'); - DOM.addClass(documentElement, 'mce-fullscreen'); - DOM.addClass(editorContainer, 'mce-fullscreen'); - - DOM.bind(window, 'resize', resize); - editor.on('remove', removeResize); - - resize(); - - Events.fireFullscreenStateChanged(editor, true); - - return newFullScreenInfo; - } else { - iframeStyle.width = fullscreenInfo.iframeWidth; - iframeStyle.height = fullscreenInfo.iframeHeight; - - if (fullscreenInfo.containerWidth) { - editorContainerStyle.width = fullscreenInfo.containerWidth; - } - - if (fullscreenInfo.containerHeight) { - editorContainerStyle.height = fullscreenInfo.containerHeight; - } - - DOM.removeClass(body, 'mce-fullscreen'); - DOM.removeClass(documentElement, 'mce-fullscreen'); - DOM.removeClass(editorContainer, 'mce-fullscreen'); - setScrollPos(fullscreenInfo.scrollPos); - - DOM.unbind(window, 'resize', fullscreenInfo.resizeHandler); - editor.off('remove', fullscreenInfo.removeHandler); - - Events.fireFullscreenStateChanged(editor, false); + var DOMUtils = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils'); - return null; - } + var fireFullscreenStateChanged = function (editor, state) { + editor.fire('FullscreenStateChanged', { state: state }); + }; + var $_gcj9n2boje5nvbtv = { fireFullscreenStateChanged: fireFullscreenStateChanged }; + + var DOM = DOMUtils.DOM; + var getWindowSize = function () { + var w; + var h; + var win = window; + var doc = document; + var body = doc.body; + if (body.offsetWidth) { + w = body.offsetWidth; + h = body.offsetHeight; + } + if (win.innerWidth && win.innerHeight) { + w = win.innerWidth; + h = win.innerHeight; + } + return { + w: w, + h: h }; - + }; + var getScrollPos = function () { + var vp = DOM.getViewPort(); return { - toggleFullscreen: toggleFullscreen + x: vp.x, + y: vp.y }; - } -); - -/** - * Commands.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.fullscreen.api.Commands', - [ - 'tinymce.plugins.fullscreen.core.Actions' - ], - function (Actions) { - var register = function (editor, fullscreenState) { - editor.addCommand('mceFullScreen', function () { - fullscreenState.set(Actions.toggleFullscreen(editor, fullscreenState.get())); - }); + }; + var setScrollPos = function (pos) { + window.scrollTo(pos.x, pos.y); + }; + var toggleFullscreen = function (editor, fullscreenState) { + var body = document.body; + var documentElement = document.documentElement; + var editorContainerStyle; + var editorContainer, iframe, iframeStyle; + var fullscreenInfo = fullscreenState.get(); + var resize = function () { + DOM.setStyle(iframe, 'height', getWindowSize().h - (editorContainer.clientHeight - iframe.clientHeight)); }; - - return { - register: register + var removeResize = function () { + DOM.unbind(window, 'resize', resize); }; - } -); - -/** - * Buttons.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.fullscreen.ui.Buttons', - [ - ], - function () { - var postRender = function (editor) { - return function (e) { - var ctrl = e.control; - - editor.on('FullscreenStateChanged', function (e) { - ctrl.active(e.state); - }); + editorContainer = editor.getContainer(); + editorContainerStyle = editorContainer.style; + iframe = editor.getContentAreaContainer().firstChild; + iframeStyle = iframe.style; + if (!fullscreenInfo) { + var newFullScreenInfo = { + scrollPos: getScrollPos(), + containerWidth: editorContainerStyle.width, + containerHeight: editorContainerStyle.height, + iframeWidth: iframeStyle.width, + iframeHeight: iframeStyle.height, + resizeHandler: resize, + removeHandler: removeResize }; - }; + iframeStyle.width = iframeStyle.height = '100%'; + editorContainerStyle.width = editorContainerStyle.height = ''; + DOM.addClass(body, 'mce-fullscreen'); + DOM.addClass(documentElement, 'mce-fullscreen'); + DOM.addClass(editorContainer, 'mce-fullscreen'); + DOM.bind(window, 'resize', resize); + editor.on('remove', removeResize); + resize(); + fullscreenState.set(newFullScreenInfo); + $_gcj9n2boje5nvbtv.fireFullscreenStateChanged(editor, true); + } else { + iframeStyle.width = fullscreenInfo.iframeWidth; + iframeStyle.height = fullscreenInfo.iframeHeight; + if (fullscreenInfo.containerWidth) { + editorContainerStyle.width = fullscreenInfo.containerWidth; + } + if (fullscreenInfo.containerHeight) { + editorContainerStyle.height = fullscreenInfo.containerHeight; + } + DOM.removeClass(body, 'mce-fullscreen'); + DOM.removeClass(documentElement, 'mce-fullscreen'); + DOM.removeClass(editorContainer, 'mce-fullscreen'); + setScrollPos(fullscreenInfo.scrollPos); + DOM.unbind(window, 'resize', fullscreenInfo.resizeHandler); + editor.off('remove', fullscreenInfo.removeHandler); + fullscreenState.set(null); + $_gcj9n2boje5nvbtv.fireFullscreenStateChanged(editor, false); + } + }; + var $_g4koalbmje5nvbtq = { toggleFullscreen: toggleFullscreen }; - var register = function (editor) { - editor.addMenuItem('fullscreen', { - text: 'Fullscreen', - shortcut: 'Ctrl+Shift+F', - selectable: true, - cmd: 'mceFullScreen', - onPostRender: postRender(editor), - context: 'view' - }); + var register = function (editor, fullscreenState) { + editor.addCommand('mceFullScreen', function () { + $_g4koalbmje5nvbtq.toggleFullscreen(editor, fullscreenState); + }); + }; + var $_di85zwblje5nvbtn = { register: register }; - editor.addButton('fullscreen', { - tooltip: 'Fullscreen', - shortcut: 'Ctrl+Shift+F', - cmd: 'mceFullScreen', - onPostRender: postRender(editor) + var postRender = function (editor) { + return function (e) { + var ctrl = e.control; + editor.on('FullscreenStateChanged', function (e) { + ctrl.active(e.state); }); }; + }; + var register$1 = function (editor) { + editor.addMenuItem('fullscreen', { + text: 'Fullscreen', + shortcut: 'Ctrl+Shift+F', + selectable: true, + cmd: 'mceFullScreen', + onPostRender: postRender(editor), + context: 'view' + }); + editor.addButton('fullscreen', { + active: false, + tooltip: 'Fullscreen', + cmd: 'mceFullScreen', + onPostRender: postRender(editor) + }); + }; + var $_3tjz2lbpje5nvbtw = { register: register$1 }; - return { - register: register - }; + PluginManager.add('fullscreen', function (editor) { + var fullscreenState = Cell(null); + if (editor.settings.inline) { + return $_djl9ddbkje5nvbtm.get(fullscreenState); + } + $_di85zwblje5nvbtn.register(editor, fullscreenState); + $_3tjz2lbpje5nvbtw.register(editor); + editor.addShortcut('Ctrl+Shift+F', '', 'mceFullScreen'); + return $_djl9ddbkje5nvbtm.get(fullscreenState); + }); + function Plugin () { } -); -/** - * Plugin.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.fullscreen.Plugin', - [ - 'ephox.katamari.api.Cell', - 'tinymce.core.PluginManager', - 'tinymce.plugins.fullscreen.api.Api', - 'tinymce.plugins.fullscreen.api.Commands', - 'tinymce.plugins.fullscreen.ui.Buttons' - ], - function (Cell, PluginManager, Api, Commands, Buttons) { - PluginManager.add('fullscreen', function (editor) { - var fullscreenState = Cell(null); - - Commands.register(editor, fullscreenState); - Buttons.register(editor); - editor.addShortcut('Ctrl+Shift+F', '', 'mceFullScreen'); + return Plugin; - return Api.get(fullscreenState); - }); - - return function () { }; - } -); -dem('tinymce.plugins.fullscreen.Plugin')(); +}()); })(); diff --git a/tinymce_4/static/tinymce_4/tinymce/plugins/fullscreen/plugin.min.js b/tinymce_4/static/tinymce_4/tinymce/plugins/fullscreen/plugin.min.js index 2f2aa8b..cd8feb7 100644 --- a/tinymce_4/static/tinymce_4/tinymce/plugins/fullscreen/plugin.min.js +++ b/tinymce_4/static/tinymce_4/tinymce/plugins/fullscreen/plugin.min.js @@ -1 +1 @@ -!function(){var a={},b=function(b){for(var c=a[b],e=c.deps,f=c.defn,g=e.length,h=new Array(g),i=0;i*?%_#SM)QlQv9ofJF*6DwEO@qGX zfPA~xoSA+MDd8U>mB)i?C}WSyrkY{{Nc16D27Qnk~^dQWsz>25;EhfTcOh06VW~fcfjIGO%i?mTJjd9j~$P z*-{0Y0(CL&U3!xbuuxfE<3`-0j~7>3HDJk&PJ4|5J{fq`fK^MiGzGA#Z%jQ`uF&TC zM%)=?)@~a5=E&&!F83TB^B$z$*J(DXWo!it5AAMkBH8TevrE ze&%tk<9N7;(EwVp%qPsqF~l0Md{<#z&)Q$)vRhcgy5YcqRZF#0OUI(DY&TFY-)09^ zWAzQ0H*)XME!mSe*2OnGT1I?_K?`?>?fyblM+&q`0M=U*#}|8+Ic4tHq#$dT@J;+E zR3ogx6fK$aBQ;FI*VtM##uk02IA^TYtdD#!#=^0>Z6EsMueuvp7fnB3fZ9@kRmKNa zQUz})7^l>P24@C$@%+?dWPrDM%`C=e#(73%KXW)ki!m}6C@03rc==o7`nLg5Pn-P;)Lk|if3eE)ck zVZ)j1I)8JWTXT7^aVCMm6W-=~ixrA5*_{M~>hc->jo zxbDISvVAlDazj!Mp6a6ABG)+t>`!!g(t>j#EdPS36UfhOQUE?51~ezm{}h$tyG(Tz^(1nt6>vO1`9iw0p74pLG0-j(5EI&*>xJ?jhW&vD-%NM!vp+PjCREnJ<8a7?WBPi=9&D+{{rp4Hwx z@}c(b{7>4t^Vha@5C642IdY|rKT!D(wXNR#5Z5p<^02CK=elFf=BKqKhv%xkUnyTl zeacsW^H}=+&;PR8;?2t;yVr)Yg3EU$k`%UqjoveznejqrNn@ zb&b4k(aIq&47^I(H$~|_|JUpNliR!U&u;4(`MlcuDQ&9{e^L8av?p^v@6h$u?)-BS zt8YKmZJ&A$IX7@xL*@mA9l-w3npF{4g`w4idq_Z~DXl?V%FhR-4rypv-+1kaAWuOz z$5>EOMD}yk-@A0(0!PP`@A0CAdt_W=UAs@`gI;6$5mxoIIjc_bYBGw@A4zw0c;mSKV>l8$jiGm)z*1_`GH(>l#p1neCeUe*m`dXB}2I zDtjfWnz8VsL(H9(Kj4juSgMuf1?9rr%um0B>mU1N;XBjXo%^(mX0!6`GNK_J-^}&a zRrg#ZuzXK{4_&c-yMJYRx1UJu@~^b4zpq%o!`Jze#yT+kT6_5x!~{*@~G zALUVd-s($OeH&Dt`qG{pPPBIAp6!g9;W_%L-h_Q`_{IN!~MHs%_iEv zL*+XKlb00%anTe8U2AIVMVi|N)xBPD8cR&lhs1`Rv_GyNh7IaN)1q}lp4*2*CW1W@ z+wejb*h^DZ#i2C~_mD4s(|(|J2=9uS0zqL2+<9WnfC6(ucGmMIlzlRAckfdkfB-gA zIJQez7fWBy4k1~}^LpU3KVVId_C8q8?*{t3#>2W<;XTH6j~DdTt6zn-0H= z{4?9S@?TY*o36_2@fWS#O8voDwp-iQKKE%`_c!~L*E#u5Qaw*_)nd8stibbeHnyo|GL@vLTm??t+V6gcyVCnv#-Q!4k0qJJlON~uya)9+QfR#>plfRl{@L=v{ ztL{984sbMYZPN=I8$*#xsXILi6oD2hOp0iQ>bnA!q+^$kIqMJLWA_#q>3r2}!Pwez z$NXTqsH*=~#z&T-ybG7qfloPUZycWL`o34_^LF~9dOywe7pQ$xEi#B`pp?dBEPHT` zPy*L(oZ#9xhNj~V-RlipxJ9@z%2`2Wg8MuNkT5d2JD2V?FyB7`_wl*`-={8RV8HoS zJ)3On&Rwf#7fE&e4Fx1P7}WN(>-^e{zTetC{99MK6;qW4HMzG>QynP)3>+DopkQ@x zW_)UUvButxn$zFQQC6M3TdaSyJAO_7IOp3m?oXGhbPOuLTYmS2s{dMprRo?3j0x*Q zS8koIEf$nIIcgr(a$Ws2r8UZPS7*n3T=B%ZtruGT2h9zPG-O`{tQ6s{rVwUN*blopZy0#maWO?`x2QC5xwxfj(MQcLzcS7E7aA9Fw^aCA~&HKZS;b~YE(8*Qa~2|5h`#5LOfGrP8|Ik`sk zWX(OmtDm2FkNUgx?OQ=hc&K_%dy9vkrZ z(J~c^tI0Z+0n5~aR7gB9(h0z$;}$`t@N1t0V8h>UOO8CA^%u99->w`wQ-FD%?q35-= z1#^&E)H6JtvTSfXz;2+yDzs)5O})7YtjdNKZjonkTB@I85ojIqNn`k%?GiGsSuHFe z7oF>pBi&tK0Yktf$c?Hk0BNq?4i?l)1+ZY%TzE;HXEO$^-|SCmd(rjJ=7$Ak7r3>{ ztZyi$a=%}=nSf6a-xHBi)ZagFfo4W0!-}DdPyo0is0%3#j`_Bp;a8N>B#X$nP^c&j zQ=qw3i^pH5E@gnhwL3etpj=XY-6NOs4D|)|`W@XvFPuzam;nn&uSQJ;00mk)=B{r| z4!^aW@7coS@H0_e%nQ&&ZQ&jZz~6Is68F~!HZL@f{gfB*cA%Ejulw4&hCf>B0zN7Z zxN7V}f!f-x`Z#V_nA~!{t&u%IZXiaH60B0&z5h{GWx%RTr6mKr%bE;rKVW`a7~ zyKjp+!VIurg?|+jTf7EoVNCy)+Gb89boMuRDm#ySuHo8 zVxLpFYn8-xv7ThRi+~Gv-Rg69NC`in9N!V#UR!sfOd0<->>5CYOI!F471`H?!5#({ zkO>y3cenL!dQv$C!QwhcJ^Mji7#8Dg(O8Nt-_d>FL(5q(wsOR41%2Bsl?7D4XMMNG z@WPr={$l|scVpOq;@b5i=NKrg-bw>kHJ-o!=?33tQ{b;R`;2LE7_f|y5D(U!v|&JB zxBk9+=*b4mO8Q{WwfAg(DvSS8uDI*K^S+LCJ7-Rv8)(WZZpzBsz`mkxVD**O#>Zml z`=E7w5v6r>0?QOuunV{w!x!lHs;f$OKUqUUHCde&)EnM06r_GcIaC&~>&)@d29!nYPN9SVJ;3Fo`QyG#QA9 z?Lsjr7k1a2z5x^qd}V=KpadjiKv!#4FFz1ig+nubFLzUIWCg;T$#Qi!vT*M9Ly-Co zyNbBKs4Fd;&vAiPVY2#x<~)NkDws`xDRTo^v*1_Nlof7<8@k{cX)#&_V5JwhhI6FyN#16EOw(X1R~lEE~Ns-TpeJd=T~B|1ywXE!_9xCT=&KLmRNG% z8B!`4E#%uqz#X04_g>7sAN{oeVQmb&E!b7uLwkfO6zPB2$?8~evwzBhB_rpsJGwyX zZNZY8PvM>ghDr_IN*{qWaBEEwcUJ`Z<<3P`bD_n2>L+GS^Lz`zz14?RL*`{6H*j2A z^lz!Y8(5Be*!TFleQ{c&f)?;U$Y7^Y`B!Z7j`KV#elVEufg+6Zi~Z}7&dW5)I)tN zSZfFIgRWXBCAo{qC^Q!HgWbZ-sGa{+9{Dx_*LD;q*i8(#R~2X#QDB<0w*V5>>@;>< zwr_C#dwRtNg>@jAHh^O=)~^L~I~u6iH&Hv(eM|M-z{)}%2z&%uC@nxh zT$2l}qZU}iVX-sV%$#JFy1R~*zjAcfX#(L!+NU4Hlo500ma%b2)qOBfSGx<5`RSk7 zcZ*zPvHjB)%HV}V8A2%(hXtqzY{ZrMXjzIV48X43&jSFCv4({)n`=}FAOK)cA9-hc zPwuI9Z}Gs;nF?DN#CXZ@eCc-@Y|8USSHLIRQ9ZlS5CL3R55+ zPW9W4Wi{MFKcuWOJ25VE1BtUL!wo#P@=V<&Kd4+EtYiKQ=fp>^~EE8_sW3m z!{orq#S1PRfWe)~zpD~pnel3U=Q}}t6D$%d9_v-6h$;aVFDCB;R(`ht_>8?UTb+L_ zfv%`8+SI*780=G&!chG?YLfA?@ZP$5=v}E$JxY^!?+BVWQRHW*KelE+v&CJi6n#UnREI`mS%c-#_Bt_s;la1rO@bRAUCA+ zM*opO3n#4;r?nGS;e*y>1uS*AUsDOd;(sppxy=EryQvys_t;HP_nq|0w*KIZ(`Q#` zHhz`+!eUC1P=*MAwNU~z^FJyBuwWa<8DIe<1fP}zSi<e^o`86;C(U z46K=!{(e+5u#!&(`ikn)l5t`l4&=&7?AAdpXiYA_${1j2%vAY+rM{_o23X_{zT}Wq z1AyfNP;LF<4+_BTfGu&&GM>3!pI+bTS$l;tO!q?>ikpO*4+vo4wEl4!fCbyAC}1^p z6bCGE=zkqkkSKj(u!P+mI$HU5cK;|_BW)?>G(bY&E$KXjH}G2N#wsZH6~KaBmIYQa zk-kLi4im~M3lO>x*$iaz=+e44=3At-$`7!a_feXhuUY&gNtxJJQd`UVj0##L-7=wG zIsjTdhgJ%-VuodawX!(F@*Xk*SU0O#N|gLAobN8EF=i()c(a8vV0yZt3=+6U#WoI-6tP;VBWowdL-Oz=a8OE$;4GUJz#G_)s z2g$NWG=U#1ra_d(1Y`f&BeMh2UpBrdpvCgN#c2ru0$MnHebAZ|3~S^8D1y$ zNFNp*w4%w3#ekJA4p_FbIJN7A@;_M1{(8*4l;3fMNGKESI_Qb0cS9MX0v36H)c{!T zB)xdv!>^Ukv(&iKz|lM0K1S<7O8FP=p*r0+P_1G7DY@uBs8$kU2`+TaKsU~c3)}Y+ zE0q0B|3v!wsjT$;nD>#|f2GO(a{gapR=PK~1kidA5LD12;`+$pKns8`|$ zTobo><^RfO8g6ii#Ybrn>#r@?)RL;%x75b@=%?8KFfy}ZWoAm<-k}RHtLR{*lS&)= zSJdpXF=+pcJ-T_g_}vz#g-N1;j7Jm&E$43lq;$}VO+t4(vful7Ao3s#*lu0-9J{Vi zNr*lNsxoY)%BXw%L}gf(XGa)?COvQGyj+i+Z{!04A53DWdt`>CV|UepR$GahT{6B;*aOpQsfAlg>qhDuf{aE&6u|OvJ z!dFqRswAcr1D1|W7j$}lVGoVaJj|S`{asSCS13bw@lb|{aah&DumA!#eFv5m*1_5Z zXdP|Q>E-ycEP1-6YyAfS3Q~heZWd5paS_!&opFf&>hF&xkq6~%ZsqfGfYVd`xlBt< z7kH&|X*4siKJzu9;cn=HGOOrd#eSwID910+mSG}|M58$o zTCmEaU4NC_lk=H8_*&FNS^M&7nb(%Ex)}Sgyx$2vP1%1n$7zY@C1I(e?%psraYY!) zaGDp&Fo8`%*oBQT+12-Ht4!LY5%yMP6tj(MEwQwVCLL$Hs1Hy72zH3lP`w3@+I5o@ zEkM>o04a&&`Vcs*RM29~cF!c3_YW#yu}w=Y&nLfdcxHtb-2k)dDG98c3C0ijBdX-W ziN%_NY8LgO@r#XdP?xkOz`?4YYzN?7HqFUpRf)vt)8#if9BeXzJ@)f?QT? z5|#&8j@eCK>Tw$RzMJ2mw3WQaOdK?nVG;lq_ty56@6OappIb>WVzrKQyEVJmcewMq zl}}+$azCyPnNxNX;}GUF$G?XI^}FVau3;F^N!t^GOy7T8pBErE6fxp^_H*(Fzl8}H zu0V#0J4lcf$a%}|uZ5g4qF?=#-E+{35 z*LB2W9%`zHw(fQGO~P%+ywZySt8#SpVyCh$KeDyPQy0Gl^AmO9avkx+h*1?2&@eR~0GG)P5TG(#Lb1Ep zB#d_awXiH64%~aHYy>R2cqqe!4QpV6`)V~f#swUfUXJ-D{wykgh9#D>b4VbLa&GEv zp$?63gh`xfsKVyvRR3p+U5jgW%DFFw?Gf=#1N2lJ^~bXo4_#Cc)}-n|H>&^zKxyhh z=X$w}o*C#cD}H2V^2le?EqJdAR|88PFJ*!)xmy8?wwWkvwEmF2svua!CZWf&h_&N* zTP+O#2bsvB48`hUReF_h_9z3E3tEY;{43BrWP;<*N>GuJH5sJkxhYe^|zEctkE zLMRovGGeDf`TX2H0IsS)Z&z)?Uh2u)d560PY}Cbf1YEZQdadezk|gbeNGqB-?~!*Q zdB!y*JG0-BaUB6mBw`+47}v}3yia!Kk1rxB8^%I8%xb5afV(gQb)sfqFt(C2DF91B z2)#e#wycD(JmCSWMMPJ-`;7!(vAnO0j&|?90G3SlMWH#rnDKTGEu@;s!CfUSIT*4@eG=z#!M@ttqw(_9xt1|2(V7Wr7+nFd$ow*;D16aty(;p@bAef|F zaT$Om<2nbXL4q@SgQUC^0}jq%=An$^bQqSd-0h)J?;Y?8m3(rWP=!XZ8U};u2Eb@i z@h+}`zonlWk{#<`?*mdq(E1~x2!I}d3EQ%M8Jh~q_5)}p;%b_V1j1qhVus55U%CAc z8nA~@ruwXOf@JpSs$lTs4bmZ|rr%_fbiA2_w2GO8dVQ~{>v|3)d(qdk+T_T$<3AY* zuo|QyK}YQoy@i@X?kfbox&4>CGD;;*isxa*)*ki{X-fgvu~^{j!>cNBFL)h*!Zp?& znFFxqRuHfvw2upH#V$}2CEP2PAY5WbNdy z7RG1~qe8LOPGpkg2ep$QE`SAaQG*>}OcMyOrTZzx6W=>ve^zfdW><0ZFYd zoiqz5%R6FVrkM;MoUw@TV2n8gHxmJ>(iRwQL>U9j=Z!juj`ff}I>RJCmk z02K@p(^J|Vn5}l5$|j4)lZiv~7eufFR+taG2f!R*%){|x5v&Jj!L(e^nowa4dOgUi z!>l~8>cXV4{i@EyEe0;*aZ~n0#agXdhB~w-Fj2Xb6Fwh<{-XasBJ{^Tur0p^dm`2U zYN{y6>fyH&Qml}8tz>Hb7b!oSyrchlzKK~*<%hww9R za6G_c6F;iXVx?=sTjF$7*|f+aAUI=%HQhm}*;lBfI8Qi_b|Z=kXu-hDJX|9`q5!ns z%OoCGsX5pCsW}nNz&oD>SQ)cY&`M1?WcdrnkXb#BHsZ(XzGFRpCwKLe_)mivtOEmv ze`*D5ls(Q~D|w9-@2||wjem*|i#0-}m4_TdX+ViHx28V*Vcxq{4*VYo#qBhRa;GsZ z11%qlXFvlK$ILWt4`qhv~a|` zpjAEPWqb#FX09%qV+I0NZRE6#B3Q+nQvw-nOKGa)gU8@H8xD2R3}PSTU7>DXG;xbh_`t2eOdi_#MQ&cmE0mQD?kab0;H5#@p?0f!jl86$n{bQrJ-`QG&jwn zrP-hN>_5`ui~PBcg(7juj{f&Hr#5_8#5Ui-xcBj-@fL$t_x>7Gx+^-JgIxtNZK$y$6L&_ z>H(|h=HW<#Rreg%45Ypl#rY-+SlRoT?GL_+`q+t7@B7^J4S&BDQAm*t`acO6953~v z4wdZxFOM{6l~&p%_ZBK-YIVvr2qUQINe?X!$G(6-{$~_Xqm~g8QWS&>>LsBI zw`faE)WU86A?73{aObKSN+p0|rYa3~=O53pe$E;DYVD{uQxHz;DJ?UGW#^;~Xa3r` z*pL1F^ZDgdXzq6r_NkUF1}zb1nBkd+YXGegWj2n_3WvHzuIp-G=4z@?Ocn<_0H91{ zDsoL)zBZ@^N%1=BCCzFpU>0iuxV~?)50xsZp`teqyfnRUF8My3QgGhpOIU(3;Ux zXH08kLCXcJheEJ|Sy2O=KvOBB^WJm$e*BerhDlJnsFFW=GmB=;MQ1LzoU*&<$5Ffu zAhNQ!N!7E%oDv3hm(~;C3b0v2VMbWlPO54OtNDkHc}QV`D;D-W7ZHP|PGM}F{XcAI z%YFdn;``K4G)7E;x=k{++5z)bj&EwqepWvFUQjzJ-Typa@RK5OVP(smjB6E6_z-v> zc|FHbm<~};8<)NM0G8-}=otywFFaT7`%UdZ0la6sU?lfv3d%B!b5`5>=ezgVzzcRZ zv%T+Cw2S9GEYj*#`B02OOTZ%pt!V>HYjy1bOI}}5^HBR?Dcl7sWms2mo^b(I9-v%x zX8}RVSpp*I#`eBX*$yC1FXOqeirH5TS}5;m zZrFf%2xuADRLl&l%iN+4_H7DQmk}jBUcky{BRs7El$-8FCaL$Q{(gSVBHkATGMWd7 zuny^evHE$o0wU_e+9?c+$r%Ec)FM|=%%XrLeE?XuGfCZRuyZknWGdePfY31203FOs z{VW8LR9Huy4d!KXU1*V}Ky~RE=Ho}S@lMICt>S_ZTrcwfnF#lEaP=JL=2mp2D zF7wZ0W0UU=Ws++@56BARR8(KYB>XJ(&M`w(C1sO<^LzA|4%-LfmVLe< zbfQ4^Hz+hd-M*98^fWS0l;;oU_Iih^~Ynv=G8IG0D zuM!~my(<=g??*mA7cenhJkO+LpMOc;_hMerm{`OwVP?62g}I37Xl7#*4ad7GvB*UK zl}$!heyVZ7`q#;IZ&n+-DS>Xh9=kdAh|4YC{`^qK|4D~iZR!qPgK+6BdB-l~0 z;rbLymow8+R;ae697w@ z!20Xf6bcAiBGDx8dBQUZP76(vY}4)ez%07QbwVRge$##7DqvCozy%Z+w3<6My#z*s zQ@OD%_Ys5vaCnT+bEem$#m(@SAb03EN0gtG7TD+^DVIhQ!Q z5Qynl#Z%KPLdY0y!ch;9H3LKnyqI?u-eA|nJ>|MsQ8iN(rQ}P~1DbyK!3?il9x%UK z?S2>Hu!e~QTGYVGObtQHF%PFj11&Z0RDUmXvttJG+RS&w!D?Lku-1sFB!GiHTDvY=?aTz{bw}PZ27`VJ*z>2V!>p41XG+151LH z&1}oQ35GR09Vq{<0f>EuVm>q23*!l$?Ac?{unT-xp?K&zxmPcAvDWzC@SN`X3WLf>upk`ae_|b)?c)yG*N?&kC?oMzvkRDp4(965i#Z6(a#!ozR|USm66wz5;#`0W4fcT2 zFlN#)L-v`2-+w~-V;sA2e9QPQLa3C_tqJHh$>+_m6JA+KQy73?{Q*ipL<7bq{obvB)X!M$KHy7) z6`O)Gp%hJ>09wqjCNgM+3Mn(v|5ni2rJ)a=dFYsdfK^@QCIc(g4Q!|;u<`+m$;PB; zMwZ+ItOk)E52eI&eXs#Q3$S8>3z+>I-wMn{CD)aWc(GWi+;8b$lZ3 zgu6C4pTuJ&+H!`=Qh9$cCZ)!REunv1O`LyCSK;Zg(|t1J9!_&XYo$2O zGpj<-!u$&(m@xwZtI!ODS*>L?aAq;EswR^Vr?xJ;`zGPh`d!yRBzG!*`jz4G{sZdx zT}?kWQCvS0EJ6BT$3$0Olpn6JOIPh~R6o&AFyr`)NljDcw8x0rFCBNE*HmKD19Y5ETf4Vz*0svv(2Fl6EN+Hg6Wk5w47CtNu zd05G3@^?MgB>i#y_nWic-B^W`v1D-AV?OeK2*%%@{T#ug%Fvc4<~{UcF|p4FzyLP> zHx`>V(E~4ab_Rx1Bp426YUxhs$mK~V3DSSqul_D^c0wf1($Lj#ub8E zK9AqXWpZx7Dq#yS4PEhE(mcQayA6x7H84X!fuK;C?0mPz{6WNN!TJ=4_Jna(`EJ4| z070VviIHL~8i&R8UTKl;!Ui`GAWEOfJMMm-AI%P6;h4v%55T})NyQNcxeU+&v;cnM zwy3Mcc(hW*GR!^pA;yXv%5%FOcsid0;*3?U=Ubek<*wc-JTw3-{94?@*q=4wK}!WR z>$?Am5)MpDivcdHncn>&0jnz!sQ|1*0tyCpz7JMa3|LuZ2|J0(#^l3y0*Hz8n!j(u z0qn&zU3X;|^3ZE>OH2?Su!uQ=T@?c?fJvA9uTyj92l!^1oc;B6C%^!p`hFT?bC|0# zo||xr!#DsgLNKHeg}xcHOs{WKgD{m~vbV4QASPjW&ipz7k~Xecqw2Te69WhU4~=wR zitj2k+466vU;I;?XE26!aYyfaNxR|PJQ!@Bq%-#Sx`2h*2+#nWpERsd9h7GNds&-R#A)t4@�x8a_6hzULJ1Og=3n8m7@LHN&c08QS_81L zvgm@D&)@(=nRrWaOlvOT9&0cP^BpCGAq0KT&%X_Sm6~d4!`8Km0s_PAV`C^~AOC+ZJL zytniD!W=a3`n|rK@l4Jw_GuxKid^|*7Sy!KbJeoKvq%x4kX)2iD7Q`)CW0Dl#+WcZ;lk1g7~x)@5l#haTG=YiN{ z1+7v|j$%)I0IFF1^5Xkd?piKryO&kc?-KvT0s-fZbqC|E*!F)?_)<-9H<)4o0000< KMNUMnLSTZ+CVU?N literal 23101 zcmY(q1ymftvoE~3y9Eu9;O_1Y3v6)r#oZ;?VgZ7?OK{8L?!kiucXti$@bbU+e)oHC z&Y79&>guYlK6B3es=F!@q#}obN`eXi05BBfrPTlc80LR85E=2`bKxy2>)#9BNadoe}$*QPX=S5pQ6d}#rIpiltd=^rcT5CHIC2LO&u006;s0D#CjyX}kczYY{< zd0jUE01fXyHw+*%`@=sAx;7d*?mEgqL31YuR#OWnGcc>SgY!RW06^GV@E_>_b~mN; zcCdGJ6Z96L{x1o^fAoLYY}AzhCE{);Lan0=qLgxS1yk~{ae=R0Rc94PBubV~-j8b}c?xPA3Lr`Bam&`tT_gZ{5<;ZxO z;nhk{^{HYW5$wn;Oc;JyMjGTTd^>A^Sq3JuFj(6ZZ^a}rE1ZwHTZ}EPIZb`@IjKp& zlOMwDClaYCMZl~l1Ys^+A=0Gu%sP!e{Zvd?Z1*p9c==LMMFut2utKTAZL9~LSlK$} z30XM3F)O87`K|hdc{UD#YXU*kiweclf_x@Nyfh$py1>+`^}8cECtsOWiw{CMx!ocx z&fbkdp7Ml5_z?W$+i9CDm1gE0o24XU<{^^64X0&4Urp!3Jep_?$Sh`xi~M|UmGtU5A-d5CSbT5g6fY|h+pi+h~~&*)p9=XO!y&FW1<57h>2hSl+8 z{i60ykK*7tx4L~6-X9oLm_oW*ZyJKHogcRcDZUz8C`NCHZ;26T6KJNoBy~!`F>vlM zpgxXCT?knjr{u7E2l(NzR$+&{Bb+83GS~&z$EX%HPNiOZ+CgsW?B1c zG~FOP!Y!{8RxSO&JHq)haqSHc#sGVy)cfZSodvQhpD!>Z-8%^JUU!{moq86}Oog*a$1Muj?UX zwrD1B@7#=3T5!rBt%}MXYVd$qltHcAM0{yDJYTEVDwll-P1b>)tb6IHA|&h!J=1y6)XlZX&kcdOXY5u7G_X>lJ zFR}N=9H#}BaJF#!d!_~4v&s@XCVnq2)VDQNA?4GUcrR;BHrETWO-Hd}^k?-p%N#(H zC|}jb3i?sBx-qxVly4bz6%2_9Erh0lOo&)%XCYTx#iav+n7Xt|2Cse|In*NjYH60N z>Pr0sYzmI=x&}1KEcK(wjp|KXNxPj~zrQ`_? zMxLY@NNk{G>0s0Z%>ANe8RVhTxI#Uq#`WkHG;UzI!1axPX*Ow--EkGYxJ|E)@vhw5 z*Y`QKKuFK*Poa#h!icwk`Z_QWr^`nn^0RhYf&CTCO%5h1Df~xn$Bd$H!aZz_j$BGc z4f1L_;d|gj;$*B_4kcdfSd%%Y(eUtT(v9Z)CX?Xl>1XA&2l79dr;A5i-kd6VHl*QH ztFhBrZ|1jIZN2oJHqn}bXPtSA4iPXnGWiW4;)Z^u;^wc`w^>~yj5%$lRvV-nthFZ( z#IIl>SGA+>KNJ<8_)dVUaF{C;jRy}x3r)l>L2%M_+x*D9y~X5>(KKv^qn^X-9=u=u z81S4Q?JoRj1Lq?iuQQMQtzMDCbE>iWxz^vVj#FXJ*^>O%lQ2TntXo;>nPiM0DPkZk z1zu1hQ^h{|b5?#8p_O<5giuFbO|OEwli8+A4Ma&Px|-jxy`VWkao1xiV*`WlJNNTs z$E96^xKLn>W-N1`6J1yHyY#8c(q2C`e2c)?syV}Gm>%$L*j-6LQJAU>H(YLD{Os0} zXJx?APU+mOKOA=|*HQGO1b@T-{_pWTm%&wKeiHiE``7hwGVLm9@l*|wy6YM|yU(7v zpEW`FFO-u+QMsn&SJq?Pap4dJ(NszTgRCB3vok4Q<3H7N7Ar~Rin!%<0|X8XbVWiY z1HJ{plXZ05G_?m41%7Qn@)FKnlO&d#=pb80nTk|)^fV=ph?|n??l(mdNbOJkXkJ}` z%aUc-{$FKU7E2Cxo>B{N}@1de1EJxDEG;uos~GU6YRw(&>g&z z22jE~^tg{ocH5Kt#&Y5XlPiMXMl*%gn`Egrk~T$vg8_J2mHmL-agtr@z z3+RMh_`GJeuXHFF8~^-w2H~{gmjRU}Z<$9i^E3-MB;baQrOrIAe3%>ihc84_^(4kT zc8fD-kQ8+dqy|S=zp^nl$r7F(Me$dOYx-22cip*D({2fnn%)C>VNprGkwxv9JnE2< z6xPA!x6KfGdV#0L&5Nin7+B9@WJvEu>}-PT(HG&A(mtMjf~ROLWmh#@`X8KoZk-;1 z+UFa8BIUjXo9mKth_bEvPkxKf7hR$qxd7~~vPp2=5)`FGbih7fs%o!^Y@?Q_|B^Nhady?6}I^`f2pKske|< zL!6S{?s}n${h-oe_iHXX{4GzxJo;Vme%!FLc9DyGFLU?K+mE3FaRgp(fC2H?h9n$6 zPUbja!7V7Yoi5MdhQb)>k_Ckmo;~6=tGnb*cns>;bHdfp6*TDSI&FUKg0LW+7AN;9 zrp14WyV_V;w0MEBMDB0z^LMz^i+c|V5M8gU<3?i9ke24hQu*Wi1mu-X@7@h%b;Crlr;MBO`#;kti=dQS>PWUr{-#b`kRczNl z0b%p2B(p#4#|%!=Qfz&~uW4f{b-i4jEb1=KNdzd_6k9>(VTgXM>w(AZd*L)9OiVR| zP-<`rhE6S@=rcgC{etW=mr?0J|ME};omK{u-Pdal5dKng+Qc_Vse7V087)e%Te-pK5a6}AzEwH&rM|XU$#v05Xp1rd>K;}a1ScrO~;2hRRGmV+*o?v@mlQWA3%waz`+m#Ll+fiZ#5dPk`pl~&C}WmF8A zTTk9_>J<9l!aw10GZ{MGBj<_Tr^!khhCRHGxz?it)9#PXxnP;q1eJII-&96X#~a{T zQqp)x(~ZmyL{apFEV1ZrookBZnDoWRuI+{gYKSBdcoK5#`xKt)JM>VTwNk5=^o|aH zpmrrZ)OI%weh63SluFkiL;1*yp#4pY!4|uut~&A~;y21>t~n;hR%Bc%R+ISKUpf_n zu%}Hntwv#e=V{eC^_YK?p)D{ZY_&>?((64=IO4|)4UdX99V9_HQF)@on(lkJ4z`daxz6c7v>po;g03v=8gTUZt;UR24R_iJlldUM;kR*By@y+G}3UBg4q z6P+tsQ~+ua*N=qwU9{cAL|c_#)RhVIT>m~-loun#U*_+F+X=gu%SQ@Pg^$-!5I604 z;omomjEv}NjvbSS;+m{_4LVfd+eLjpIllRYu7o6GXFLF(7_Kd+hH{d;VF7DQ*;xDV zv%svmgfNNT_mge_p^$=%FUUAFjXfL~==c^^V$;PD2(FGtLPBu%d=Wur+@tUR^iw+p zV4sWl@QRbvn`X8ZA6xhBi8y>6**O5|?9o7&B*4JH{7>`I#pNT&g8*zjs|loj%kDth zuded<{j;J>1N1VUvJEjICOr@r3DGg^wOX#o}i39(Fyz~gg9ntb7>tv^YsiTJHIPo152lm4yicv(AzOYg9z>fnSo!r5bDra+6 z6A>yUkcd>j2`06^b9GglD)cuzKV2ovZ5yfksN;8MHh4P370{oZ3j6XeBP=IH@39sX5Q_fg%9nno zkP%NZ6h<$(T)QCL=$vrxg`j1jwJ14c$uA)O(!oNENp#cz=ZT13b5eCq7W9TV3m+^( zoZKXl)^|Hu(w#)1sYyldKs=up30pbyPnymCPJ?WHUe)Ze>21Zc&}{;MTJq9f8t#^& zCTFfEWYXOc{!6gqM?4MU<)t?$ zsvnNv^bSDQ*iFh|cJC502huFM7wlt(AMA3JjuvaJGl&&D!bXm3b$0r=HY=C0wXc*g z>zyaIiOMr8qnXA8z;b;(6m5Y%`Jqm!Tq%uj5w<{`I z4JqOfO$-o@16W6)?i-w-F3k;)n+7u>1JcQh2;jh4EoWmo9Uyq zj}Q?*WG{byOHXx6MWO9Fb9ER9?E_vj_f&*oG*l^3vOS&zfVG~PRMkp&Hp653mFIjV z)DWzR^IJ632j%W)#+Am5OK>npGV>;OMOI=}rx z!6Z+hee@ZBme!5gdq>H*wve(2Zh+pS5!3Qtc0$Pj>xj?A4ys1Q>gxg+`h-SSM9FKS z2(z0fns26ice}Xo$Y8>@k^}nlq}OOOz|!73&&>pG1>XXAP^vqa`PvE-Bp8BeKdAwd zt^ZL#OAbdejLC6V5miKvq_fX9oMogII{-lZG27+iZGiN);a{_ya-? zcQ?eOsoS-CRV(9kN+)2mKH8?wljbP|h=u)%a8yXYpMf`+%Ira(e#4y&gC4aH3-X_Y zCDR00hvp+F?nx!@m5i82)rY?gY0YIrbX|FMW`4?Ml5!X;D5^LHJo z<3(AHQ9hm~!^|26f}(!HyI!lJ^UTW#cLiZlYG6=3kDu4d#PL^A?=&0?%MKyVzhaxX zN386eAmpPVxuU(~doN_wom4Rm?#}UZ*4FS5cZXq|a`}t&C?446!)c`-w4qe# zP(+CQVkBU6r_f1Zgb>iTP3G*U?jB_tZVBi@p(eU^X!1g8$2bHJg$7P3DJ5F+fY1 zExpdK3Qnsk`k~-d#ZdaKj8p=$x9!zo2E2@lG>;mT=~oWCd4eOEZUhjfip9IVz7Y8R z1W&|bl3aw?lO_jiS2euR&~^Wn4#o0=Nw3v;5K;dZ#(FDW=Ame*5XU>|`JwJ<4*1A1 zI!>n-BCSPv3ijC6FXTx{2zP(U`sM2)BFkXz_8p;=jLAw?rQ#~mw>BAFJ;9sb9351bugeBaND66BoB7vLdyhbGx^cGhEIY;+gag2+8%}!5$LN?;E)#xjWTO&-U z`WZq_O5*6ad9^Emro9l;{?&c!3Ov?RCnXdH_`*82ZCh3IoFm5flYMm-JN$IyBPLJR zF0uNJG7N4O^Zi3FHXF!3em~KpAWr>btXu{fB63#Hdz^SMEvVE^!bS$f_K{H5F|WDg z@}owlb6G`i^cTSviOLhln*+jZWvygNxYjvYLyoS1y~Fi(LYC#-^$s6s7hBj~gO#2x zJm5~BuAJb#kEkcUk48yWLTN-$sl$3vHEly$5|tmpSiCpe z-__*KIAnai7%+=@!CKn-Z@wuzJ$s*I;UMUqu(Dhv52drj%X8;x&9+mTuBM4g7=5h^b{sfm1$OlI#^hYfy z1${0|*($i0Qs+xEQbuB(8f&lYe$nqJ$%9z262lyoH)Y8D#1dV#w#9vGA`YD2VZDUX z^*CZNk8+W>caRnx(?-~)uds|GC2tYYDenABb?=WtNZV-9%aReVhB;vBtM9=kqr5Po zd7X)#3rIv%J!LS`+Tu?-ZQog|+oI$5NUIN+XmBVB*Y^>>CDGN&{~pFZTdJiLyeE6L zxCc;_F`{rXk8|#vyo{fxol&QPizG*C`-lxL`_D2XKV5GSh=McvqrGeb<*%lWw7xQg z?$2ee^y4cJCpy<^seD*@hU;R3^B6dJBWs>yM_-%{6h{mL8;-;fa0kTvfu!^W8MWc# zBL_jEetu9`z@f(hoKk8aTG)*?cdO~BR)mZ9HVB>||0-(ufK~SQIy|#&T<2*?uf5%o z33+H|zh=>odV_p{n^RY7fd{)z3TEM(OEF&VKd5LwA_!w`6OHygsru6tZUOTx}(KuKxz;t<;PDwjBrG$K#6DTVq88rO&~_L?YR~^1UrjR^v>zkR zH44Y!Df9x_UIQKBl|z&SQ-L*~TZ5KY>Frluy33rrzJF0=7_?l0(zE8$nj4GOsZMZ z{Zi9kL(xw6<@QqTiMK1##D?!dbA;RurtLnv$;$o`#u`Ck2wFCd3^>aun&G9=qC1z( zYaX1NiOf~(l<~JH{h!L}es+YtWf)-lhliwzBV|nT0yb=rBRo){5fv{uJ2zu2=H&Hm zTvk!e1bdxX1u9VT>|;>X(;qgz8tYEyHId(Z@*ul9hCrz>BQnp$vUrXH+`)eIhf%h}Y=8%(R2}l% z)QZ!C=+(zIdsI*;O$%p@x8^aH0pQ!6*q>ITqCjqWe8%(cec?prfUDt_oe6?bs!vUEBqC&?gx&QMN3 z){~r}Af-V#+=0B)R*^)Gz!~pqjPC{S2LfTz)5VoJ6kd#7#Y}j8PU*e_jDRSr)c&J6 znzLz-F#_T}if~L4x?e1dB`JfuAgYnEdci5Q`j(CFb3G~^>GK5pLk=_LXOx(J$clD7 z%A}KjZV#iQNRzdM(G|x6<=)FllXKj{-?zId8vge3gZ^&yF>DfsUUa^6Gn&4HJezcdX1vm z9?ND(u|rUf5#noQV8liidcBav0J7E}tqSxrHSNPx0NngMK&FV^m42n7IKmBn6O`RI zXbr;}1rRSg<;?zcq7aufE<*biX9F{Okc&K(gp|#0?o)5g{ik+hf4W280bYM|{Ogbk zcy`vTn|cf><>wn{*{2(gGX=oulF7Lmj5>zvZ+n0S1z(^H3%pOsq)8;!uP^SU+j$6c zR!gUG6>~e!ge#mvD7Kh}o-8H^_3Q`YGX(#@SX6Qfc>5;wA5cxTrxf!|3oOJvgUf}} z^TJ%o*F)683d>EEy_<40*y<;IVQUju^4?>i(-D7I}MKMH2NTPmYq!|8jl~c z^>M0j=F)aUvW?7qts{pL(9nG|Wnn2}zQ*Bv?7r5tfngf0il^@xMaUpnCLsst)u&CX zm5n2wJMm!K{Q1)4LMgV7&hOaFis|QluT5#8IT3RAzzU53R6`wGUz?@8PIz(dyKx() zGci8Ztnr@CM(^GO2P7y2f@jsQ!hIq|%NR#@Kw*?Utph^3B`Smq)3tWIkA^Bg!MdS05N(_j3#0LQB_+-;LUy;7b*-V zi&w?3A@xLja+vf-hcVgnZ$D2>i%y{#mE#mZYOusI#F7vmXK}kQ6@yXcu0MqRE;Blp74MMy~kLm&R~K)sl!wAK6WGaxLu zS~^=l&0UGZ%U@xutd}d$BM+Cwf2|ZSN;PX8xhZ}}rw)b{>jgj@aPd!EZI-OGs81t* z6*{tXt4>R_a>7L0O;~w$w4aO;!?a3tO8n-|Nj7Z^(%i5iod~gqR0baq$QuY*pa_f@KS*5dtnF@&{XjNz(n*JGJ$Uh8mpU8S*&^AEJ9SM^wzn86bBRk0EMEj0tVQC^l9vV@Pfoqtwa%FN-uV zogMi_eE_G0h^ESS>@o-WTL7v)GRxRdy|9j{`z*7d?JgW+n>sQSO#8e0GzfQvK8vM6 z82Y{5v@abJheaR4{K*PM=b;7vR5SSmuEd`IBPTnAAjK12XKN<};~%n5)}-rEB+CZa zE4PSp?;XOsg9_>INd(VkTzL4?s3A2ME>cPl#?C+cuwSsXq+rTgegkB6i@kA zQ^2VQAuFu*R;j5v?J7!s#PT!?r~2Vmy5TMs?9V9#8jK-7?j-3>7`{f3T6-dr z{y=KEISfO71IaIc8g`tU?J{rmH&6!B=l8LXFt3ZYn`?&q*YDJ0(^>esAU|V#zkhR& zXudN~8&hZgj-ogZrPJb}@H$HGcxP5R=R2+0b~C@)2Y-%EqZ;AFWT;KhJ**hH@X<@DfB|7#)RCRFg1? zuP~Iy3?NAbC~o_Vf-V?Ki)=SGD>&GwR({Q8BVNy&#l55bD~(B_gY#97A^}eI+Re0h zrTbIKHHTeykb|&4haDZW*Cs6)tOOc-vjsfMK7tUC+CeU_45?w+!B$cl33J0b`@u84 zAvd`&W`T;?o9b8X_p!esAD2j&;}Sg@`mQVzjl6gIJhRK}ZQNwq%*Ira1WvDyoeQAZ zW^Q?g0!=kNJsT&BzCN7XYdedo$mae9PM?0;(;0XfFnkKJ>(^VTHXN%}vMYLrOfx!C zIhUU2e$I*8_@PZf)BnQ!m%4Q+i>>WgCmg|P9%Ghg4Nh`-ciN&~&_*B4+X5(nq7~1! z+4Joh=fDZTRK}VgxCO&RlID?#@%d!;Wti8~@~7S)XNeCdOUY5u29A!vAGOo1crSeA zF!J+5M}_O@Ts7FyVm@RVJSSxReqrmuRPV|wQFz;|6J{fPQYTjSBj-q#YO9I?&ho$&5suW8OfpcK}c9*aA& zO-@QSL9H_tI*td$5%W?$1CfyJ$~w>{(2oS-VgF_QeqO%#@*A-Q*|KElYAs}{<)E=L z)(?f)>->1Rw#2q81OtVsD7030AqELm&Md^|8KoH-TvP?ZsS9R}zz8jPj>@SQlF;S& z#66gQBI@3pXLaB82>q}^Ojb`%PICtOhZ=mE-<7j^CIcQAw=v zy*9wE2_&kumT;@vzEjdE!L2|)1jR+ohE9pvyp`na>UV^-pvSEtaKp;!C5p*=<*tWF z_tNDW+|V{%bRZ{j9)yve{9wOu{S54#T3?9?sjTDxI`kYVa)(6q^@Xd>;dNz>vD60M23v^obrkbb8wMEdX`)X6#qj*YH z#r_1`;OE|j8*vh%3O=?ku0x4q4dr4jDhw!yxvu<6g^~=pI;M9eu})FZ4TM>gs-d`} zDK2h-oAI_Zn>#Jwi<+Z{1{81IQ@|7al?o#9EFWEzU?%zyF54svc}$)xA@b75Q|T0v zj>_T|`Z2I~fT4Y3{yR=?W|^^P&yHIY9-)s*!cZcm7wNTiak&Q&NTfk*UjqBOgI(_K z`7vrX3=Tf3WECS`5X*m=6sM^^`N&OsuEP+9=|@9qP_Pp`71<;!SO{NNMNdhm!A2Ex zb}Jw)OIrgzKK=?oh~dE#7Z3>ic_wl5+!sgX8XQe?(=A^xXlKF~fc$&qS4VJmJ)o$$ zzv{|?8*V3=XN42HYLF!)n~XXKfywTt*4p_6H_z+<6lWD~O0QCmjW; zOG;1A^wq3~Z+8n&X&Nm^W1@Pl0NMI$u$1LT%~fJgPT#lU=%o<@azT#y()_BE@bFth zmRz;+UkI?{1oGkkNT^indw8Zi1qp6FdM&Bu!%MYFWx87bQO9=CZdpWyICW)`HTk@` zKe;AqHQY4&*5dect``_T?&{nnQ>vI_(eAZMx6r3}WL&T)gfNRw(2r=E{sIGLPDKAL zlbKe@c`e$(3Qj4A=_pozq@WEB0SgnWf1PIwlG)!g+bQ-%hSzeTs2 z3g=#1g100qLHUsn8-0lfPSx-&s!CVR?RZ_ch2z z@ScMVHYJgJKHHLjReE*XRK}dR)#L}yh*7Oir9eS72_(DZ50-8`p=7A`H`C+0d7ffq z#wFQsdLW-5%G|qIV*n}a9SE7&$yK2irS6#AI`pJfajzD)U>s0+?Oe0YOSMuloXVrH z=Z(BdRy7%K)X04OA&&o)E%gz;Y~kcDhDd&u322rF`Iu?({pgQ%N^h}^=TFzZQmb2; z&Io%O4kB-MPt=A!hFgqAx?bT+9kLhfaKx`Qx$?qdfphC8bg@UbLH&9OgF!w!ymiOD zb6_$oOV`Q#-jL70ALlq^6&$hivZfN;0I7g>!@3hWdleWp1<&dZ16X9;(W0cigZ-MS zoRlnMesXY6?r9lXWq3CvCG5wVrM2P!{j;-%n(DMDc$2ZvVU56qu%Vn+k8r@No5+?F zwc!abcvV=Ne%76|tSOLPtS-wYD8&Mf%7iVa?IXJ;IZs zN=N^kIArGcuwUE$#}PmKy@GSi)J~mWhYza0zHMkv%N%nl?5$78R08m?IW7!SBv&dM zgKr+-glfSoPN{l^j^NqJJ9W05U8`}y)4f^zk9|Mod*iBxE{%p5!j@Ndl6qAN?&!mlWLN)ABlL4@uRCykv~vTNg&hs0}Cq=|vVFLekeZJ(cLnX2gT7qMUUqM=^*fX-owW??o|(T zri|Df8+k@i;TIy0u=stqtMN*pK^)@;W`-*-A+wv}w|C4%ZGSNCKc*uL#~`2mfi}C7 z2Z}Im*v&FS(O(o-)B1La--{}E57`UuEXYXl!t!6$S`SHJuleOM5&2i>Tqs58md}Ir z7$$<2-m|HrFK9KPSG5D$(MobvSs6d5^l%BCXYUzxlF8zgWP5+fxyRg~>WQNCS`_3} zy&oq>nngd=kInpM!2<6W2-6dW$8<_)%~-|?%snP<)`Vb^DKRqD1dpNr>MrH|h80b{Dp*(?T=@d)@~P6#ikmdyBH23VU>6S~g&Z74J) zb`bL#02<0SR1H3hax0*4f!|gzIk8@wA+oL7i0;fGG8Sz!5xA`-vt{XYPfqxQC<@~~ z&CuBu(a{G*c>lC~34165TV)C4Efkc(5><@z; z3<1oMYXyI&)f-{%7(R0ZbS41?f8Ub(0eAkd!Ilstcs>GR(;X}RJVNrBZ~bjFy|y9^ zm6JqGX^C>*$&+QF`DpzZm$PrB!i9MGuvBppc$B|v-Iwpc!e5*ZqaaIok}@+O@&1O7 zO-U)z5j+;dcxSFq^nz2hpe-6fn(+fYsHOz;gcA@1D^>a*3rNV5Igw6f>BCJ8^ zSCo~&CnGTx>*Xf`tx{BRYHHmpU<>*#FTcnydXq#za)UorT4#|B?qzO-z3jfIUXU5h zg?SD$`q5z{st0egL3D){=g=1j`#%)2L@#!HKg;MH4>HE?R=dgSl(Ef6z7Ja3Kc+^5 z7p0gs$Y}AhX|vU#AhXGfYgAdBa$L>GBRmv$LL&&|5M+%Fz*@i$$!i+x?$-Dh|NJ)7 z2h~V*eB8xL)Q@Ui%o?yrF#2pRHGT{IRtnn{fMaSUgs&RAgvQpUa_r*lWZ)nh{8LMbBQf?5w{10l4# zV9v63!Js|rINA+ejtXZ|NmDGe=yhLM1QQ8M9*2IJGQ<)d{cCa&q2L3hgrmrO`g3;Z z1j-2q91Fvh+0iV^f!2h;)J=K1SY+jZra*7I5aX!W& z=Yfy1u42i*2s2GQxomK&e3jP{NfWjwdtqsNDp(7>ubg3lGbUKl1D}(_}`(40QL~oDal7iKxYbomx%%#04U9X0~81CzivXgZG@a zoZsDCV_3&9pvjkVT+5qjpKd>N%%dXWv34@YZoJhTxmX-2be12Bpi}<#9d-P)*%UK_ zv4kGBg^3HR^93c1`r9(p1s7SLJ&YZpNGhe^M2q;BJOWBmifVX1QA-bC#=aJN z1)*OmmUGXP^_RUce7H%O`kDC+sp2y>x=U8dC!K;S9hcCIBlSHjoTCc5d7d@2rknP^ z?<9+pcz-w%qRdc0R)zevn6wmCz91d_zZgcYHph5rv5XJjE{4O+Si&Mkn~n}#HyBRn zq%^lC&Dt^aa*(XeNGgK{AXdc0S6Rm57kh-YL$Rfap9}Lw6Hl^Lg0<9WVW^JF`Ey^C zOZ=d7B>4K(TR)*I0UTC#=m1ZhKQP~}pQp;5g2CXEx^)z@AdTxOFJ zaFyS~Y5~?p#f9KZ-HsJY0b(Hwh}pbxf*j>5o93B#pf_*d5g2I(z@{AbA&fJwLxU&S(>CDiSD zwE4b2k#9!qVo4kEYW^wtQKA>jSKW)6ta(nHFG$VFQ0aY5qBO_0C~{C_OJ`8of^-s0 z?m=6EwPk5`jOIFc)Iy=6`zv6Sc%)Rr;K1Q3ldR*&bV=)(lgvBjghQZneGg**17SgQq$F3W!=zoTwBL>l@bqIGPh)$8&@nRC_b$vu=PyB|r6~CX zKR!dfw-;!GQT|fN$nhW@dpDv$<01_HWq|((8z=g*uI{Wi>a((s?k97I7pw_XqlGYs zlw6)A61Jp}hPY^?qDfAv_Tc125MOM3;#gb&*DHn(zSuYIW0%IJ)U9VGnZa!gdnou6 zRSn`)Ip6l$_Si06bmnt_8u9t(F%u4Avy4q3*eH@#}e!^Zb>)aAm*9VL(WHR(Fx6q(W` z-Wf#nkIf`Xv#J(g_L6e*;E&r%<(a6k`7QdMF6H?cgch<<-#|-hnF0d zo39WCDZ+7EQDGDPobD;toZ=4Dql;e^;L@|uOQ_Cop!_!Z4;(xv0CP&~G{lRkZ65PA za}9k=1j>WO+)6~Gis76}Zq$WkmB#xv8j9Mh2h?&9;G@^1)Q2O~3J^dZ#MwtED8NSv zY2yAl?X3EW(ZtA1B_I?R8bpT7Kp2NM^$Rp+@vKuWUl0OjZvgMII3=Y-D+8n}EHYs~eeU(2#s*SjP=cNc{ICNFl z0dJPe{_zO@b^#XJ_^tGeR1FkC`RK|52t5pS6G!{2W0`&nKi4E7*XWeGln3Y+M_0?7qSdP&y!p=+ycq)oN_s_Xs4W zSWq&fZ{|@rO$09x3P~c>L;DfmJ}~{zdJ#x(!{KD=MI6jbMR?hYu7LED`q5W@R}TCu z?4UIz?-=rg!r*YjkPbvS^R#0n9m!W%ET}u`WinJ9jR2upjQD}+T{3~ubadD3)2Va) z!&>Q6f>sBHbZ=JgAseaY;Nb!^Bl4n@!m9OQ52eRR*s4*9FETJ%MojY$lcB1eWrF-g zKJR;HlC{2t?yIm0rb4{y#!;_sfrH$?#+}2kq3&^g! z0<_NrS=`tcg?nMFmJS5c%7+>yymoeJ5;J22UiPBSA`=Sm?&w_if)i6#D^qYbTluPs zEINP=HsK#5=2@8VN{cPfC!GQ}YeWE}n|TH(MmO`G#*!oC=!CeX{6|y{E0tM^h)0+m z{2~lwi7d_l$^@-Et^CF}%cZ?;xa8E}O4OJK6=;NwjpvYqAeew77eOcI2pT+P5vZ#i z+Qnk;PSfupml|P4vRc#YdRFo_*H;EsFoo5^?G=BSREwTSs38Y8c zbF30X09<~e{}xDG8KFDczzLp0=+-hRZVn$RC zET?v#+M@1NUR?ef$A(%PfsHF759+0c_+vw`zakS(vYgT^$3~DalSjO4r8~);vh}n7 z?9KmIy}VR8lW}FPKm8T8-$_>Bo(1i-9;M$|q~?SLnkP_&hEiG^Q9Q$|oW^}`Xmd(s zp+{?>XFOqc3q|wcQpByY&qx761;-GXs7#F24%J!1_hwu0YNA`o2>+a3GH3DcULCZC z$=ru#WtqC;&W8l4Jj(EQm6v!nt}ru(VEjO4YA^w>$wVpnArev->%g~p%tGoe)yLTw z6G@M4H?EQia|~TV$+jpbxvgR3N52zur4NbrSn%oMo<3l1PHTzop+5nc0$_gyorWM` zg`*^*?nHX{sRBRmYW}N*Sao*mN7|y@+qLV`nl(9?eR86W9}vX&oxx0K(}?LH7Wv}5 zVk9!to3R9Kg)jhDt>(Bkz(Ad_ z-NXYw83vYiafwS%%;Qff41{Pe9KgHhSgbOR0EB>uR6qXr$h*0+i8kl~}{sI8l}x8J1qbE;#@I7(z)zK~&{^m$uJxzD3I`Uzt`$@lnxE-g-wLc! zM$WpH*@4GmXJ;zUzG3AK^4Bg5=ymJnudE+OKX!Z$uH?X`m+dfc+W58ej)u_qDv|Fh z#-)hnase?os)+vLs3-*^6I#0R(G2HvDMK+bN5E7qABhAhhX_;T7I-|`0F_E^BjWmOxSE<#FCO;gH6p^qe$k* zDBDx4AI_$mti{Y#&}@KtWOXs}e8r5IYv!-2oodU_Kq14$!K%{H{H~(N(U334gS>CW z!G$XkXE7?c(9n%H2d%DKI)82LFqV()?tm5TFyVlNpUDyTTXG_?4A#LHYioO#d(+>lMh(4K$N2$l46O!&H@&3oXrhqk*BjsqQ{A3+)6kP42oB#|V`y>MCy zK{A;_+e`9Y!BPxTzMUz+51$$!Ko*VVTCl42F&rlF>p)JyabVRH94>%tEeS_ad2@0L zPQlSpFX8OGD+qW@Bc3pDx`$PQ^Y!>xFn@K;T{*e=j}`YRIu0kONHDxE;aGN@rQ$sX zY0Qp)>8vLn{lpS>*fkYGckBnlsSQX%as%Z4T->+d_Wa_)BCkJJ#6{jJjygXB$EG~@ z_}igUf(+Tshu&%^I>tX@i7z+zK7VfB@Z5r8uco;r{%`_~$D5OP0`k2RmfByM_j+}| zNn?s0$M<*&X}M9aAy5>%mjzzFOpuD!+!fW|!228W@(VpE%nn%45Ar>~AHO5-d)$Gy zz`+A7mMtB$W)GbsC1O)$msfQtEeEtZyZ5kFwbQ^#Rpn=38TD*{R18X?9)Q+gtNcU9 z^I%x%Py(y83M4Sh@mSZ~V1WBk1)*vvpQ z5d$}L0IQ%cCx0?eNWnn_RgrMx4PfWSf-*T92Mo-GpP?a76z_NQR#czFI4Z~>6e5O$ zIQe*l*OxmDN2Kqm-BWi(ZQ)dS9i!Rpo)c%rzZD*-G%MR`s z0LjHQyXyW`Ut2dd(p-NdY>KaBevNgtk(`3UBaL|Me;JS<;+7MS<>VEfONtWdH#9fY z{4N@fOo&CACx#m8eviXMn{fJ!gcBxCmE6iA#`EM9UWH@R-^Jk&*v9I<7`D@YLg1aZ zHq;N4;C)=JL_Ok|IDT;1=;H09lrzcVm{yPLS__DovTISZjOBn9uGlbrH>^BhpO}A6 zQV@TX5s$nCO6%MmcMSd@3+2+*nWnLUQiNcYd$vtk<>8Ri#>G{>VVByVxm3gT(4eeZ z*Fci;;Sqvd31c6qa}3!K++87Aem7X4Pv)(zn?GrE;iH2$OB$Yk0eCwB(DMAm(Zzoz zO9L>{Aygj#LgQA5$a?|S{tUmD2yk2-V|EkA6#WrlK$XZpN7{YphcGx=DF(!9eFPXe zKa@ipSwb{QQf<(3fG08sdA5Y{IT)EYR~RWDnzycDkQLXjrBL6{;}J!6T{&TNe$vVU zV@R)Ir7?Jn#;ddogBu%i38l_sGru+bzk5$dO;PO$$$-SW>?mQgLJ_iUp zg&=}7u6gXOz4z*h+=P-Uq!bZV!HF?XP8wTusfd9;uxb9QK%({qP?u-(gcg*49N)zU z)=%{LaxY|BIHIe@lGTbyV+#K1#KU#L{MGe;1Ld|T)L2&pAjF}db^iw)uX}OQ@wKsN z=pUfqe0n$@T)4VsnW4w74dmt@!@9%WJrO4r6BIjhkV9JDJ+~dSz`>=koQxgN!ZSfj z(xX#g-GS^O^tHOk9;U#m(r-oF6tK5|RkYzrn83ND1*~B1`4DxHW{APzcs?A=s@zf7 zyYNmNYEKk-;w!YnaK;hM@ z%l#cix5R1JxZqd&{ zHC2MbW8&l1;*bO!Jr6xEWDh^e*#NrJFCW!w3x)9<^ourG6tDwy3#S{2#5%C8JQgYd znbp_5rkfIXlawN;tO#Usvl#Y;4=m54OF!}QXmeRoe#^7(kO5ITmx~Y}CoiYU2B}VP zm3K}CSP^)+_`xf|c;e`S*O2y19z(?go*=urgsdn|I(`EQ-NqGEyz2!aJV4o+q~HXz zSS{sO=xyna9D=S>{4A{RGHZa=wIFwf}m*ybj!@!(w9*P-*?3)8tlRSB~)wK_UOZqJ= zZL4+FH9u5T_y0h?bM5@M_JT}w-~Q=;YA*%FaD*P#&qCCvIG|(Awco;#eHifZhbEoc zYc=2oSY=aA1g#*bt$yny_3}~jZp7iQjl+pRv7G!os68aW8iHO!2ph31o(LSns^VYb zx;cdrkv_o?#1`|ht4m9Ek9i*B?SyeO~{sbneUu7PBn+NGhcFI_4+0-0>`y~M4NalkmCrC>CHPjLZ zPy*9p(LDgA9gMqrkdzoa=twaU;Mns@AZr+^8h#Ya&;#l~l;>EKoBCySl5YN;aq8Ad z3fMcLlSkm9pCbGJrY9mdgR<+5GzKYq_I?T8{{hANtNE+yMxxA@;?U3jl(jY0)qd)d z%^xFOai$-xhwLQDx*e|WvjZ%)P#S3MnltQI045B^wR9TU@cDgGV{P3$9MAp37JmsVhqVEWhe@E5 zetOC1+;Yf?mgW}+&c@k#-$b~l;!U-b1)bSg-vk+xC8(ukVg=3~FiB7$HDoS$r{P#5 znm7*wdmtzV@$K;f!hK?s3{|H3>n&)NLPRVEJ0n3zUJvDfcP5Q0cpHxp1=?W6`+Zyy zX+;n`aR{rg@%q$j96Lejq((fdqnwbZdAxz<`nuk3#Z_%uwjV&PraAthSf=FR2u}Ld zgg`iez#aos7y$yHlb^tpha(SRa2D^FbwnI>?L-q-1i^{fJfMkTMBoA}jp9&I;Zx^v z`-I+B;m0lcNlEH4riU7^I=Bb2yWR-yQFNIMykMv2t*&_h+Vz*BeWNIk7vT5IrDIC| zL$K>%1=&gm$9=Yd#X9T*TK%VOz$&!&S1I-omP-j*>oQSVDK>De-w3-&SrM$_FcISc zSk0@NGi;|o zu*0mI=JMjG^+dv(06ULjOq#!X?}CY=zX@;Lsp^oA&TkLh(X&r@m6*v5{d1QdF=o| z4$xel;zT_Dbp-x{B#oqy-gR7)WNnqUa$Fc@JpNT#RlkI=sJ65nm+ee=hqv}-e@^~4 zxx$FDybrH0e3Trf{H8^*NKd)I7NPN`KsjM_{odM--IhzN-lc@# zVBI)i7Ori?X}j{R9OTf6iecPxFlvZw|18Nx!7@gqn7mX;KB}ms=n|}gU4i|CS9tw_ z$$`AQn+z+y3cxp>U`2HamQA>2%S0c7aQh#Ta5Gl{v65(B^~9>ivJSwCR7KoL>ft?QsFtzQCwPqi#0yrXCz8qV#g~+#h%g zd_EMGQ|>fMtLpCI_w}2KZ9JL>;3ZZMk1=R&`NjJHqEr|nwz%v!lsbUQ4}|Gn$^zPjR`lf!G^J2|1+GtsVT3MVcR!OPd-( z*v1pX(wKO|L1);i2+a=yaMo3vT<|d|IjS?vC@bTZ7a7}T)bWn&!sEP+hnNJBm!aS3(Un&t5UMcmu+mh!T=9WCidixs7lpo(9v)b^v=2 zNo-EbB)c8eci#_z-4(t--tp0Js1)UTVgAa!_bak{xekIBGOMouY<{LH+VRw_g8IWp zp8kcmKe)Ei4+{~$1&F)h2PV{-HuTj2Afu$;1{C@o8_nltp*mJ$7#thp7z9=iQUTZZ&Z|EcT8Y7t|;;>owc z%9G=^qRkIswebr8R-z$_xJn48_&Q`=zj2!E@-f9L zaQ|{3C!Z|dUWlF-@ZDw@-E+b?S1kV*sjl{SKamO`Vqx?NHWK+lCQeZkw&Re%vwtqE z{^=OJg#eBVn0CoBQZ~RD03HUZxTo3z^p^gCfh&P!IuXMCr_`vtB5uZB2V%S#$SItb zS6Iksy$wZZph+(L1Cp9h<3J+vwoqg3ilUOj;Q+`-A=-LVQq0%fzMP+6Wl*!hs&P3MA?%C%9D{U?M0-ArqIR8F&d=kj|iH1E@y?;-j3XZ3s*r(Km!ehY6wP#_h<5 zY-~S|FXt|BAD8HFBrq?r6zqstA zl1eDR{wxj!R-ij~>@OE%5mR7V9BE%kK15vq$^}YwJH1>|q=- zPFXn~`%&MNWc4C5T5mwm4yBv$pP zjrDa)uyo%S$MJm$%8s?r`F;d!$M_$dUeZKiE@Kg7;8eFyJUmamCHirI*s1dGI&o_m z=5DND*^S%svgM8{6;yV&tSWjUSrBtj$!ZCaj7w4s&N2n!RF|~`L0Od=t;Qc}Ziqqa{O^__kGw<-9jpQ=H?Z8a`TFS7ZfNNCN$8WlMUtE%T6iW%D4bD))%jcwKm|=pL>Q{xn$9i zjFcnii#D1twq%{lqnrUP_a{MphR}Xkd?<9~78FtapKNCc+U`#(l2HcTs&_#>{uGOW z6pKUfuD$|#VvO_P+O;lcb1;=nlWd)T!bydn;`IcWx_PLvzUDN5KtAH`1!}FBFsATz z#-)b8P?~Mjw^_OBH$Y{2pyA)#U(bgU7~Z38tr<2*Xi~2a04v{$h8jG`r{SH%GQn0e zjmy3wfbUXhv5$a;{i*m3u%H`)FS8SL=37u!UC;DbFT+*$c03w`Dv2Sf9&H1`If!o( zl+lK`BADe0C2olY%$KkQh(xNIFdDc5Db(MYPLKN{wt%o=V0X6CX&bLCz43jk-}KE^ z=`9~w0I}bts!Xu@f;kR=eXGRTxs{L`0WjM?{#un~L00mL6F$={&Vk1Fkc)kL;hF|( z@rIa%xYoQ?H8kL7((k$dh;;sxOh-@x5OCl53~06|-w9a^^Z2?Z>$wjs#`{}G`SBg= zKyY=!Wx7)S#UJ0zT~$8{Wr;ksG0w7W7MkdpA|?HtIsqj1PqpkPj8ldVvXj~iv+uX! z2JnpO?57MFj@-cg#%rGVOjd6o#|*R>CZT}9JHIsh87FcVHLym|iWx@PczS3|;8 zf|Q#YYHI%K(G;wXfs{ZvvVrM&IrpqX5Dy&an^FA1ILLzAR6rdHi=Jg=;xG$iUm!r5 zB8iYxBB;bgn_%;5(9IA1}~G;aqys((9~8X5deSo2}3rP z^>bc3>>AtKu`(*&VdZn2R3`M_`5~SYm-`Q~ zEdL$afC6>)eX+`x444AVw03`NRb%lJYnq1AEQ^z#6V7?=>eT_P1#22cFIZh~E%}g? zUhOA~-m)l}16vnVMB2%EcQv1$cs(uf*|mV^tZAfw+F<(Z3UTP< {dependencies, definition, instance (possibly undefined)} + var PluginManager = tinymce.util.Tools.resolve('tinymce.PluginManager'); -// Used when there is no 'main' module. -// The name is probably (hopefully) unique so minification removes for releases. -var register_3795 = function (id) { - var module = dem(id); - var fragments = id.split('.'); - var target = Function('return this;')(); - for (var i = 0; i < fragments.length - 1; ++i) { - if (target[fragments[i]] === undefined) - target[fragments[i]] = {}; - target = target[fragments[i]]; - } - target[fragments[fragments.length - 1]] = module; -}; - -var instantiate = function (id) { - var actual = defs[id]; - var dependencies = actual.deps; - var definition = actual.defn; - var len = dependencies.length; - var instances = new Array(len); - for (var i = 0; i < len; ++i) - instances[i] = dem(dependencies[i]); - var defResult = definition.apply(null, instances); - if (defResult === undefined) - throw 'module [' + id + '] returned undefined'; - actual.instance = defResult; -}; - -var def = function (id, dependencies, definition) { - if (typeof id !== 'string') - throw 'module id must be a string'; - else if (dependencies === undefined) - throw 'no dependencies for ' + id; - else if (definition === undefined) - throw 'no definition function for ' + id; - defs[id] = { - deps: dependencies, - defn: definition, - instance: undefined - }; -}; - -var dem = function (id) { - var actual = defs[id]; - if (actual === undefined) - throw 'module [' + id + '] was undefined'; - else if (actual.instance === undefined) - instantiate(id); - return actual.instance; -}; - -var req = function (ids, callback) { - var len = ids.length; - var instances = new Array(len); - for (var i = 0; i < len; ++i) - instances[i] = dem(ids[i]); - callback.apply(null, instances); -}; - -var ephox = {}; - -ephox.bolt = { - module: { - api: { - define: def, - require: req, - demand: dem - } - } -}; - -var define = def; -var require = req; -var demand = dem; -// this helps with minification when using a lot of global references -var defineGlobal = function (id, ref) { - define(id, [], function () { return ref; }); -}; -/*jsc -["tinymce.plugins.help.Plugin","tinymce.core.PluginManager","tinymce.plugins.help.api.Commands","tinymce.plugins.help.ui.Buttons","tinymce.plugins.help.ui.Dialog","global!tinymce.util.Tools.resolve","tinymce.core.EditorManager","tinymce.plugins.help.ui.KeyboardShortcutsTab","tinymce.plugins.help.ui.PluginsTab","tinymce.plugins.help.ui.ButtonsRow","ephox.katamari.api.Arr","tinymce.core.util.I18n","tinymce.plugins.help.data.KeyboardShortcuts","ephox.katamari.api.Fun","ephox.katamari.api.Obj","ephox.katamari.api.Strings","tinymce.plugins.help.data.PluginUrls","ephox.katamari.api.Option","global!Array","global!Error","global!String","tinymce.core.Env","global!Object","ephox.katamari.str.StrAppend","ephox.katamari.str.StringParts"] -jsc*/ -defineGlobal("global!tinymce.util.Tools.resolve", tinymce.util.Tools.resolve); -/** - * ResolveGlobal.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.core.PluginManager', - [ - 'global!tinymce.util.Tools.resolve' - ], - function (resolve) { - return resolve('tinymce.PluginManager'); - } -); - -/** - * ResolveGlobal.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.core.EditorManager', - [ - 'global!tinymce.util.Tools.resolve' - ], - function (resolve) { - return resolve('tinymce.EditorManager'); - } -); - -defineGlobal("global!Array", Array); -defineGlobal("global!Error", Error); -define( - 'ephox.katamari.api.Fun', - - [ - 'global!Array', - 'global!Error' - ], - - function (Array, Error) { - - var noop = function () { }; - - var compose = function (fa, fb) { - return function () { - return fa(fb.apply(null, arguments)); - }; - }; - - var constant = function (value) { - return function () { - return value; - }; - }; - - var identity = function (x) { - return x; - }; - - var tripleEquals = function(a, b) { - return a === b; - }; - - // Don't use array slice(arguments), makes the whole function unoptimisable on Chrome - var curry = function (f) { - // equivalent to arguments.slice(1) - // starting at 1 because 0 is the f, makes things tricky. - // Pay attention to what variable is where, and the -1 magic. - // thankfully, we have tests for this. - var args = new Array(arguments.length - 1); - for (var i = 1; i < arguments.length; i++) args[i-1] = arguments[i]; - - return function () { - var newArgs = new Array(arguments.length); - for (var j = 0; j < newArgs.length; j++) newArgs[j] = arguments[j]; - - var all = args.concat(newArgs); - return f.apply(null, all); - }; - }; - - var not = function (f) { - return function () { - return !f.apply(null, arguments); - }; - }; - - var die = function (msg) { - return function () { - throw new Error(msg); - }; - }; - - var apply = function (f) { - return f(); - }; - - var call = function(f) { - f(); - }; - - var never = constant(false); - var always = constant(true); - - - return { - noop: noop, - compose: compose, - constant: constant, - identity: identity, - tripleEquals: tripleEquals, - curry: curry, - not: not, - die: die, - apply: apply, - call: call, - never: never, - always: always - }; - } -); - -defineGlobal("global!Object", Object); -define( - 'ephox.katamari.api.Option', - - [ - 'ephox.katamari.api.Fun', - 'global!Object' - ], - - function (Fun, Object) { - - var never = Fun.never; - var always = Fun.always; - - /** - Option objects support the following methods: - - fold :: this Option a -> ((() -> b, a -> b)) -> Option b - - is :: this Option a -> a -> Boolean - - isSome :: this Option a -> () -> Boolean - - isNone :: this Option a -> () -> Boolean - - getOr :: this Option a -> a -> a - - getOrThunk :: this Option a -> (() -> a) -> a - - getOrDie :: this Option a -> String -> a - - or :: this Option a -> Option a -> Option a - - if some: return self - - if none: return opt - - orThunk :: this Option a -> (() -> Option a) -> Option a - - Same as "or", but uses a thunk instead of a value - - map :: this Option a -> (a -> b) -> Option b - - "fmap" operation on the Option Functor. - - same as 'each' - - ap :: this Option a -> Option (a -> b) -> Option b - - "apply" operation on the Option Apply/Applicative. - - Equivalent to <*> in Haskell/PureScript. - - each :: this Option a -> (a -> b) -> Option b - - same as 'map' - - bind :: this Option a -> (a -> Option b) -> Option b - - "bind"/"flatMap" operation on the Option Bind/Monad. - - Equivalent to >>= in Haskell/PureScript; flatMap in Scala. - - flatten :: {this Option (Option a))} -> () -> Option a - - "flatten"/"join" operation on the Option Monad. - - exists :: this Option a -> (a -> Boolean) -> Boolean - - forall :: this Option a -> (a -> Boolean) -> Boolean - - filter :: this Option a -> (a -> Boolean) -> Option a - - equals :: this Option a -> Option a -> Boolean - - equals_ :: this Option a -> (Option a, a -> Boolean) -> Boolean - - toArray :: this Option a -> () -> [a] - - */ - - var none = function () { return NONE; }; - - var NONE = (function () { - var eq = function (o) { - return o.isNone(); - }; - - // inlined from peanut, maybe a micro-optimisation? - var call = function (thunk) { return thunk(); }; - var id = function (n) { return n; }; - var noop = function () { }; - - var me = { - fold: function (n, s) { return n(); }, - is: never, - isSome: never, - isNone: always, - getOr: id, - getOrThunk: call, - getOrDie: function (msg) { - throw new Error(msg || 'error: getOrDie called on none.'); - }, - or: id, - orThunk: call, - map: none, - ap: none, - each: noop, - bind: none, - flatten: none, - exists: never, - forall: always, - filter: none, - equals: eq, - equals_: eq, - toArray: function () { return []; }, - toString: Fun.constant("none()") - }; - if (Object.freeze) Object.freeze(me); - return me; - })(); - - - /** some :: a -> Option a */ - var some = function (a) { - - // inlined from peanut, maybe a micro-optimisation? - var constant_a = function () { return a; }; - - var self = function () { - // can't Fun.constant this one - return me; - }; - - var map = function (f) { - return some(f(a)); - }; - - var bind = function (f) { - return f(a); - }; - - var me = { - fold: function (n, s) { return s(a); }, - is: function (v) { return a === v; }, - isSome: always, - isNone: never, - getOr: constant_a, - getOrThunk: constant_a, - getOrDie: constant_a, - or: self, - orThunk: self, - map: map, - ap: function (optfab) { - return optfab.fold(none, function(fab) { - return some(fab(a)); - }); - }, - each: function (f) { - f(a); - }, - bind: bind, - flatten: constant_a, - exists: bind, - forall: bind, - filter: function (f) { - return f(a) ? me : NONE; - }, - equals: function (o) { - return o.is(a); - }, - equals_: function (o, elementEq) { - return o.fold( - never, - function (b) { return elementEq(a, b); } - ); - }, - toArray: function () { - return [a]; - }, - toString: function () { - return 'some(' + a + ')'; - } - }; - return me; - }; - - /** from :: undefined|null|a -> Option a */ - var from = function (value) { - return value === null || value === undefined ? NONE : some(value); - }; - - return { - some: some, - none: none, - from: from - }; - } -); - -defineGlobal("global!String", String); -define( - 'ephox.katamari.api.Arr', - - [ - 'ephox.katamari.api.Option', - 'global!Array', - 'global!Error', - 'global!String' - ], - - function (Option, Array, Error, String) { - // Use the native Array.indexOf if it is available (IE9+) otherwise fall back to manual iteration - // https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf - var rawIndexOf = (function () { - var pIndexOf = Array.prototype.indexOf; - - var fastIndex = function (xs, x) { return pIndexOf.call(xs, x); }; - - var slowIndex = function(xs, x) { return slowIndexOf(xs, x); }; - - return pIndexOf === undefined ? slowIndex : fastIndex; - })(); - - var indexOf = function (xs, x) { - // The rawIndexOf method does not wrap up in an option. This is for performance reasons. - var r = rawIndexOf(xs, x); - return r === -1 ? Option.none() : Option.some(r); - }; - - var contains = function (xs, x) { - return rawIndexOf(xs, x) > -1; - }; - - // Using findIndex is likely less optimal in Chrome (dynamic return type instead of bool) - // but if we need that micro-optimisation we can inline it later. - var exists = function (xs, pred) { - return findIndex(xs, pred).isSome(); - }; - - var range = function (num, f) { - var r = []; - for (var i = 0; i < num; i++) { - r.push(f(i)); - } - return r; - }; - - // It's a total micro optimisation, but these do make some difference. - // Particularly for browsers other than Chrome. - // - length caching - // http://jsperf.com/browser-diet-jquery-each-vs-for-loop/69 - // - not using push - // http://jsperf.com/array-direct-assignment-vs-push/2 - - var chunk = function (array, size) { - var r = []; - for (var i = 0; i < array.length; i += size) { - var s = array.slice(i, i + size); - r.push(s); - } - return r; - }; - - var map = function(xs, f) { - // pre-allocating array size when it's guaranteed to be known - // http://jsperf.com/push-allocated-vs-dynamic/22 - var len = xs.length; - var r = new Array(len); - for (var i = 0; i < len; i++) { - var x = xs[i]; - r[i] = f(x, i, xs); - } - return r; - }; - - // Unwound implementing other functions in terms of each. - // The code size is roughly the same, and it should allow for better optimisation. - var each = function(xs, f) { - for (var i = 0, len = xs.length; i < len; i++) { - var x = xs[i]; - f(x, i, xs); - } - }; - - var eachr = function (xs, f) { - for (var i = xs.length - 1; i >= 0; i--) { - var x = xs[i]; - f(x, i, xs); - } - }; - - var partition = function(xs, pred) { - var pass = []; - var fail = []; - for (var i = 0, len = xs.length; i < len; i++) { - var x = xs[i]; - var arr = pred(x, i, xs) ? pass : fail; - arr.push(x); - } - return { pass: pass, fail: fail }; - }; - - var filter = function(xs, pred) { - var r = []; - for (var i = 0, len = xs.length; i < len; i++) { - var x = xs[i]; - if (pred(x, i, xs)) { - r.push(x); - } - } - return r; - }; - - /* - * Groups an array into contiguous arrays of like elements. Whether an element is like or not depends on f. - * - * f is a function that derives a value from an element - e.g. true or false, or a string. - * Elements are like if this function generates the same value for them (according to ===). - * - * - * Order of the elements is preserved. Arr.flatten() on the result will return the original list, as with Haskell groupBy function. - * For a good explanation, see the group function (which is a special case of groupBy) - * http://hackage.haskell.org/package/base-4.7.0.0/docs/Data-List.html#v:group - */ - var groupBy = function (xs, f) { - if (xs.length === 0) { - return []; - } else { - var wasType = f(xs[0]); // initial case for matching - var r = []; - var group = []; - - for (var i = 0, len = xs.length; i < len; i++) { - var x = xs[i]; - var type = f(x); - if (type !== wasType) { - r.push(group); - group = []; - } - wasType = type; - group.push(x); - } - if (group.length !== 0) { - r.push(group); - } - return r; - } - }; - - var foldr = function (xs, f, acc) { - eachr(xs, function (x) { - acc = f(acc, x); - }); - return acc; - }; - - var foldl = function (xs, f, acc) { - each(xs, function (x) { - acc = f(acc, x); - }); - return acc; - }; - - var find = function (xs, pred) { - for (var i = 0, len = xs.length; i < len; i++) { - var x = xs[i]; - if (pred(x, i, xs)) { - return Option.some(x); - } - } - return Option.none(); - }; - - var findIndex = function (xs, pred) { - for (var i = 0, len = xs.length; i < len; i++) { - var x = xs[i]; - if (pred(x, i, xs)) { - return Option.some(i); - } - } - - return Option.none(); - }; - - var slowIndexOf = function (xs, x) { - for (var i = 0, len = xs.length; i < len; ++i) { - if (xs[i] === x) { - return i; - } - } - - return -1; - }; - - var push = Array.prototype.push; - var flatten = function (xs) { - // Note, this is possible because push supports multiple arguments: - // http://jsperf.com/concat-push/6 - // Note that in the past, concat() would silently work (very slowly) for array-like objects. - // With this change it will throw an error. - var r = []; - for (var i = 0, len = xs.length; i < len; ++i) { - // Ensure that each value is an array itself - if (! Array.prototype.isPrototypeOf(xs[i])) throw new Error('Arr.flatten item ' + i + ' was not an array, input: ' + xs); - push.apply(r, xs[i]); - } - return r; - }; - - var bind = function (xs, f) { - var output = map(xs, f); - return flatten(output); - }; - - var forall = function (xs, pred) { - for (var i = 0, len = xs.length; i < len; ++i) { - var x = xs[i]; - if (pred(x, i, xs) !== true) { - return false; - } - } - return true; - }; - - var equal = function (a1, a2) { - return a1.length === a2.length && forall(a1, function (x, i) { - return x === a2[i]; - }); - }; - - var slice = Array.prototype.slice; - var reverse = function (xs) { - var r = slice.call(xs, 0); - r.reverse(); - return r; - }; - - var difference = function (a1, a2) { - return filter(a1, function (x) { - return !contains(a2, x); - }); - }; - - var mapToObject = function(xs, f) { - var r = {}; - for (var i = 0, len = xs.length; i < len; i++) { - var x = xs[i]; - r[String(x)] = f(x, i); - } - return r; - }; - - var pure = function(x) { - return [x]; - }; - - var sort = function (xs, comparator) { - var copy = slice.call(xs, 0); - copy.sort(comparator); - return copy; - }; - - var head = function (xs) { - return xs.length === 0 ? Option.none() : Option.some(xs[0]); - }; - - var last = function (xs) { - return xs.length === 0 ? Option.none() : Option.some(xs[xs.length - 1]); - }; - - return { - map: map, - each: each, - eachr: eachr, - partition: partition, - filter: filter, - groupBy: groupBy, - indexOf: indexOf, - foldr: foldr, - foldl: foldl, - find: find, - findIndex: findIndex, - flatten: flatten, - bind: bind, - forall: forall, - exists: exists, - contains: contains, - equal: equal, - reverse: reverse, - chunk: chunk, - difference: difference, - mapToObject: mapToObject, - pure: pure, - sort: sort, - range: range, - head: head, - last: last - }; - } -); -/** - * ResolveGlobal.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.core.util.I18n', - [ - 'global!tinymce.util.Tools.resolve' - ], - function (resolve) { - return resolve('tinymce.util.I18n'); - } -); - -/** - * ResolveGlobal.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.core.Env', - [ - 'global!tinymce.util.Tools.resolve' - ], - function (resolve) { - return resolve('tinymce.Env'); - } -); - -/** - * KeyboardShortcuts.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.help.data.KeyboardShortcuts', - [ - 'tinymce.core.Env' - ], - function (Env) { - var meta = Env.mac ? '\u2318' : 'Ctrl'; - var access = Env.mac ? 'Ctrl + Alt' : 'Shift + Alt'; - - var shortcuts = [ - { shortcut: meta + ' + B', action: 'Bold' }, - { shortcut: meta + ' + I', action: 'Italic' }, - { shortcut: meta + ' + U', action: 'Underline' }, - { shortcut: meta + ' + A', action: 'Select all' }, - { shortcut: meta + ' + Y or ' + meta + ' + Shift + Z', action: 'Redo' }, - { shortcut: meta + ' + Z', action: 'Undo' }, - { shortcut: access + ' + 1', action: 'Header 1' }, - { shortcut: access + ' + 2', action: 'Header 2' }, - { shortcut: access + ' + 3', action: 'Header 3' }, - { shortcut: access + ' + 4', action: 'Header 4' }, - { shortcut: access + ' + 5', action: 'Header 5' }, - { shortcut: access + ' + 6', action: 'Header 6' }, - { shortcut: access + ' + 7', action: 'Paragraph' }, - { shortcut: access + ' + 8', action: 'Div' }, - { shortcut: access + ' + 9', action: 'Address' }, - { shortcut: 'Alt + F9', action: 'Focus to menubar' }, - { shortcut: 'Alt + F10', action: 'Focus to toolbar' }, - { shortcut: 'Alt + F11', action: 'Focus to element path' }, - { - shortcut: 'Ctrl + Shift + P > Ctrl + Shift + P', - action: 'Focus to contextual toolbar' - }, - { shortcut: meta + ' + K', action: 'Insert link (if link plugin activated)' }, - { shortcut: meta + ' + S', action: 'Save (if save plugin activated)' }, - { shortcut: meta + ' + F', action: 'Find (if searchreplace plugin activated)' } - ]; - - return { - shortcuts: shortcuts - }; - }); - -/** - * KeyboardShortcutsTab.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.help.ui.KeyboardShortcutsTab', - [ - 'ephox.katamari.api.Arr', - 'tinymce.core.util.I18n', - 'tinymce.plugins.help.data.KeyboardShortcuts' - ], - function (Arr, I18n, KeyboardShortcuts) { - var makeTab = function () { - var makeAriaLabel = function (shortcut) { - return 'aria-label="Action: ' + shortcut.action + ', Shortcut: ' + shortcut.shortcut.replace(/Ctrl/g, 'Control') + '"'; - }; - var shortcutLisString = Arr.map(KeyboardShortcuts.shortcuts, function (shortcut) { - return '' + - '' + I18n.translate(shortcut.action) + '' + - '' + shortcut.shortcut + '' + - ''; - }).join(''); - - return { - title: 'Handy Shortcuts', - type: 'container', - style: 'overflow-y: auto; overflow-x: hidden; max-height: 250px', - items: [ - { - type: 'container', - html: '
' + - '' + - '' + - '' + - '' + - '' + - shortcutLisString + - '
' + I18n.translate('Action') + '' + I18n.translate('Shortcut') + '
' + - '
' - } - ] - }; - }; - - return { - makeTab: makeTab - }; - }); - -define( - 'ephox.katamari.api.Obj', - - [ - 'ephox.katamari.api.Option', - 'global!Object' - ], - - function (Option, Object) { - // There are many variations of Object iteration that are faster than the 'for-in' style: - // http://jsperf.com/object-keys-iteration/107 - // - // Use the native keys if it is available (IE9+), otherwise fall back to manually filtering - var keys = (function () { - var fastKeys = Object.keys; - - // This technically means that 'each' and 'find' on IE8 iterate through the object twice. - // This code doesn't run on IE8 much, so it's an acceptable tradeoff. - // If it becomes a problem we can always duplicate the feature detection inside each and find as well. - var slowKeys = function (o) { - var r = []; - for (var i in o) { - if (o.hasOwnProperty(i)) { - r.push(i); - } - } - return r; - }; - - return fastKeys === undefined ? slowKeys : fastKeys; - })(); - - - var each = 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); - } - }; - - /** objectMap :: (JsObj(k, v), (v, k, JsObj(k, v) -> x)) -> JsObj(k, x) */ - var objectMap = function (obj, f) { - return tupleMap(obj, function (x, i, obj) { - return { - k: i, - v: f(x, i, obj) - }; - }); - }; - - /** tupleMap :: (JsObj(k, v), (v, k, JsObj(k, v) -> { k: x, v: y })) -> JsObj(x, y) */ - var tupleMap = function (obj, f) { - var r = {}; - each(obj, function (x, i) { - var tuple = f(x, i, obj); - r[tuple.k] = tuple.v; - }); - return r; - }; - - /** bifilter :: (JsObj(k, v), (v, k -> Bool)) -> { t: JsObj(k, v), f: JsObj(k, v) } */ - var bifilter = function (obj, pred) { - var t = {}; - var f = {}; - each(obj, function(x, i) { - var branch = pred(x, i) ? t : f; - branch[i] = x; - }); - return { - t: t, - f: f - }; - }; - - /** mapToArray :: (JsObj(k, v), (v, k -> a)) -> [a] */ - var mapToArray = function (obj, f) { - var r = []; - each(obj, function(value, name) { - r.push(f(value, name)); - }); - return r; - }; - - /** find :: (JsObj(k, v), (v, k, JsObj(k, v) -> Bool)) -> Option v */ - var find = function (obj, pred) { - var props = keys(obj); - for (var k = 0, len = props.length; k < len; k++) { - var i = props[k]; - var x = obj[i]; - if (pred(x, i, obj)) { - return Option.some(x); - } - } - return Option.none(); - }; - - /** values :: JsObj(k, v) -> [v] */ - var values = function (obj) { - return mapToArray(obj, function (v) { - return v; - }); - }; - - var size = function (obj) { - return values(obj).length; - }; - - return { - bifilter: bifilter, - each: each, - map: objectMap, - mapToArray: mapToArray, - tupleMap: tupleMap, - find: find, - keys: keys, - values: values, - size: size - }; - } -); -define( - 'ephox.katamari.str.StrAppend', - - [ - - ], - - function () { - var addToStart = function (str, prefix) { - return prefix + str; - }; - - var addToEnd = function (str, suffix) { - return str + suffix; - }; - - var removeFromStart = function (str, numChars) { - return str.substring(numChars); + var noop = function () { + }; + var noarg = function (f) { + return function () { + return f(); }; - - var removeFromEnd = function (str, numChars) { - return str.substring(0, str.length - numChars); + }; + var compose = function (fa, fb) { + return function () { + return fa(fb.apply(null, arguments)); }; - - return { - addToStart: addToStart, - addToEnd: addToEnd, - removeFromStart: removeFromStart, - removeFromEnd: removeFromEnd + }; + var constant = function (value) { + return function () { + return value; }; - } -); -define( - 'ephox.katamari.str.StringParts', - - [ - 'ephox.katamari.api.Option', - 'global!Error' - ], - - function (Option, Error) { - /** Return the first 'count' letters from 'str'. -- * e.g. first("abcde", 2) === "ab" -- */ - var first = function(str, count) { - return str.substr(0, count); + }; + var identity = function (x) { + return x; + }; + var tripleEquals = function (a, b) { + return a === b; + }; + var curry = function (f) { + var args = new Array(arguments.length - 1); + for (var i = 1; i < arguments.length; i++) + args[i - 1] = arguments[i]; + return function () { + var newArgs = new Array(arguments.length); + for (var j = 0; j < newArgs.length; j++) + newArgs[j] = arguments[j]; + var all = args.concat(newArgs); + return f.apply(null, all); }; - - /** Return the last 'count' letters from 'str'. - * e.g. last("abcde", 2) === "de" - */ - var last = function(str, count) { - return str.substr(str.length - count, str.length); + }; + var not = function (f) { + return function () { + return !f.apply(null, arguments); }; - - var head = function(str) { - return str === '' ? Option.none() : Option.some(str.substr(0, 1)); + }; + var die = function (msg) { + return function () { + throw new Error(msg); }; + }; + var apply = function (f) { + return f(); + }; + var call = function (f) { + f(); + }; + var never = constant(false); + var always = constant(true); + var $_dftk13aqje5nvbpy = { + noop: noop, + noarg: noarg, + compose: compose, + constant: constant, + identity: identity, + tripleEquals: tripleEquals, + curry: curry, + not: not, + die: die, + apply: apply, + call: call, + never: never, + always: always + }; - var tail = function(str) { - return str === '' ? Option.none() : Option.some(str.substring(1)); + var never$1 = $_dftk13aqje5nvbpy.never; + var always$1 = $_dftk13aqje5nvbpy.always; + var none = function () { + return NONE; + }; + var NONE = function () { + var eq = function (o) { + return o.isNone(); }; - - return { - first: first, - last: last, - head: head, - tail: tail + var call = function (thunk) { + return thunk(); }; - } -); -define( - 'ephox.katamari.api.Strings', - - [ - 'ephox.katamari.str.StrAppend', - 'ephox.katamari.str.StringParts', - 'global!Error' - ], - - function (StrAppend, StringParts, Error) { - var checkRange = function(str, substr, start) { - if (substr === '') return true; - if (str.length < substr.length) return false; - var x = str.substr(start, start + substr.length); - return x === substr; + var id = function (n) { + return n; }; - - /** Given a string and object, perform template-replacements on the string, as specified by the object. - * Any template fields of the form ${name} are replaced by the string or number specified as obj["name"] - * Based on Douglas Crockford's 'supplant' method for template-replace of strings. Uses different template format. - */ - var supplant = function(str, obj) { - var isStringOrNumber = function(a) { - var t = typeof a; - return t === 'string' || t === 'number'; - }; - - return str.replace(/\${([^{}]*)}/g, - function (a, b) { - var value = obj[b]; - return isStringOrNumber(value) ? value : a; - } - ); + var noop = function () { }; - - var removeLeading = function (str, prefix) { - return startsWith(str, prefix) ? StrAppend.removeFromStart(str, prefix.length) : str; + var me = { + fold: function (n, s) { + return n(); + }, + is: never$1, + isSome: never$1, + isNone: always$1, + getOr: id, + getOrThunk: call, + getOrDie: function (msg) { + throw new Error(msg || 'error: getOrDie called on none.'); + }, + or: id, + orThunk: call, + map: none, + ap: none, + each: noop, + bind: none, + flatten: none, + exists: never$1, + forall: always$1, + filter: none, + equals: eq, + equals_: eq, + toArray: function () { + return []; + }, + toString: $_dftk13aqje5nvbpy.constant('none()') }; - - var removeTrailing = function (str, prefix) { - return endsWith(str, prefix) ? StrAppend.removeFromEnd(str, prefix.length) : str; + if (Object.freeze) + Object.freeze(me); + return me; + }(); + var some = function (a) { + var constant_a = function () { + return a; }; - - var ensureLeading = function (str, prefix) { - return startsWith(str, prefix) ? str : StrAppend.addToStart(str, prefix); + var self = function () { + return me; }; - - var ensureTrailing = function (str, prefix) { - return endsWith(str, prefix) ? str : StrAppend.addToEnd(str, prefix); + var map = function (f) { + return some(f(a)); }; - - var contains = function(str, substr) { - return str.indexOf(substr) !== -1; + var bind = function (f) { + return f(a); }; - - var capitalize = function(str) { - return StringParts.head(str).bind(function (head) { - return StringParts.tail(str).map(function (tail) { - return head.toUpperCase() + tail; + var me = { + fold: function (n, s) { + return s(a); + }, + is: function (v) { + return a === v; + }, + isSome: always$1, + isNone: never$1, + getOr: constant_a, + getOrThunk: constant_a, + getOrDie: constant_a, + or: self, + orThunk: self, + map: map, + ap: function (optfab) { + return optfab.fold(none, function (fab) { + return some(fab(a)); }); - }).getOr(str); - }; - - /** Does 'str' start with 'prefix'? - * Note: all strings start with the empty string. - * More formally, for all strings x, startsWith(x, ""). - * This is so that for all strings x and y, startsWith(y + x, y) - */ - var startsWith = function(str, prefix) { - return checkRange(str, prefix, 0); - }; - - /** Does 'str' end with 'suffix'? - * Note: all strings end with the empty string. - * More formally, for all strings x, endsWith(x, ""). - * This is so that for all strings x and y, endsWith(x + y, y) - */ - var endsWith = function(str, suffix) { - return checkRange(str, suffix, str.length - suffix.length); - }; - - - /** removes all leading and trailing spaces */ - var trim = function(str) { - return str.replace(/^\s+|\s+$/g, ''); - }; - - var lTrim = function(str) { - return str.replace(/^\s+/g, ''); + }, + each: function (f) { + f(a); + }, + bind: bind, + flatten: constant_a, + exists: bind, + forall: bind, + filter: function (f) { + return f(a) ? me : NONE; + }, + equals: function (o) { + return o.is(a); + }, + equals_: function (o, elementEq) { + return o.fold(never$1, function (b) { + return elementEq(a, b); + }); + }, + toArray: function () { + return [a]; + }, + toString: function () { + return 'some(' + a + ')'; + } }; + return me; + }; + var from = function (value) { + return value === null || value === undefined ? NONE : some(value); + }; + var Option = { + some: some, + none: none, + from: from + }; - var rTrim = function(str) { - return str.replace(/\s+$/g, ''); + var rawIndexOf = function () { + var pIndexOf = Array.prototype.indexOf; + var fastIndex = function (xs, x) { + return pIndexOf.call(xs, x); }; - - return { - supplant: supplant, - startsWith: startsWith, - removeLeading: removeLeading, - removeTrailing: removeTrailing, - ensureLeading: ensureLeading, - ensureTrailing: ensureTrailing, - endsWith: endsWith, - contains: contains, - trim: trim, - lTrim: lTrim, - rTrim: rTrim, - capitalize: capitalize + var slowIndex = function (xs, x) { + return slowIndexOf(xs, x); }; - } -); - -/** - * PluginUrls.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.help.data.PluginUrls', - [ - ], - function () { - var urls = [ - { key: 'advlist', name: 'Advanced List' }, - { key: 'anchor', name: 'Anchor' }, - { key: 'autolink', name: 'Autolink' }, - { key: 'autoresize', name: 'Autoresize' }, - { key: 'autosave', name: 'Autosave' }, - { key: 'bbcode', name: 'BBCode' }, - { key: 'charmap', name: 'Character Map' }, - { key: 'code', name: 'Code' }, - { key: 'codesample', name: 'Code Sample' }, - { key: 'colorpicker', name: 'Color Picker' }, - { key: 'compat3x', name: '3.x Compatibility' }, - { key: 'contextmenu', name: 'Context Menu' }, - { key: 'directionality', name: 'Directionality' }, - { key: 'emoticons', name: 'Emoticons' }, - { key: 'fullpage', name: 'Full Page' }, - { key: 'fullscreen', name: 'Full Screen' }, - { key: 'help', name: 'Help' }, - { key: 'hr', name: 'Horizontal Rule' }, - { key: 'image', name: 'Image' }, - { key: 'imagetools', name: 'Image Tools' }, - { key: 'importcss', name: 'Import CSS' }, - { key: 'insertdatetime', name: 'Insert Date/Time' }, - { key: 'legacyoutput', name: 'Legacy Output' }, - { key: 'link', name: 'Link' }, - { key: 'lists', name: 'Lists' }, - { key: 'media', name: 'Media' }, - { key: 'nonbreaking', name: 'Nonbreaking' }, - { key: 'noneditable', name: 'Noneditable' }, - { key: 'pagebreak', name: 'Page Break' }, - { key: 'paste', name: 'Paste' }, - { key: 'preview', name: 'Preview' }, - { key: 'print', name: 'Print' }, - { key: 'save', name: 'Save' }, - { key: 'searchreplace', name: 'Search and Replace' }, - { key: 'spellchecker', name: 'Spell Checker' }, - { key: 'tabfocus', name: 'Tab Focus' }, - { key: 'table', name: 'Table' }, - { key: 'template', name: 'Template' }, - { key: 'textcolor', name: 'Text Color' }, - { key: 'textpattern', name: 'Text Pattern' }, - { key: 'toc', name: 'Table of Contents' }, - { key: 'visualblocks', name: 'Visual Blocks' }, - { key: 'visualchars', name: 'Visual Characters' }, - { key: 'wordcount', name: 'Word Count' } - ]; - + return pIndexOf === undefined ? slowIndex : fastIndex; + }(); + var indexOf = function (xs, x) { + var r = rawIndexOf(xs, x); + return r === -1 ? Option.none() : Option.some(r); + }; + var contains = function (xs, x) { + return rawIndexOf(xs, x) > -1; + }; + var exists = function (xs, pred) { + return findIndex(xs, pred).isSome(); + }; + var range = function (num, f) { + var r = []; + for (var i = 0; i < num; i++) { + r.push(f(i)); + } + return r; + }; + var chunk = function (array, size) { + var r = []; + for (var i = 0; i < array.length; i += size) { + var s = array.slice(i, i + size); + r.push(s); + } + return r; + }; + var map = function (xs, f) { + var len = xs.length; + var r = new Array(len); + for (var i = 0; i < len; i++) { + var x = xs[i]; + r[i] = f(x, i, xs); + } + return r; + }; + var each = function (xs, f) { + for (var i = 0, len = xs.length; i < len; i++) { + var x = xs[i]; + f(x, i, xs); + } + }; + var eachr = function (xs, f) { + for (var i = xs.length - 1; i >= 0; i--) { + var x = xs[i]; + f(x, i, xs); + } + }; + var partition = function (xs, pred) { + var pass = []; + var fail = []; + for (var i = 0, len = xs.length; i < len; i++) { + var x = xs[i]; + var arr = pred(x, i, xs) ? pass : fail; + arr.push(x); + } return { - urls: urls - }; - }); - -/** - * PluginsTab.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.help.ui.PluginsTab', - [ - 'ephox.katamari.api.Arr', - 'ephox.katamari.api.Fun', - 'ephox.katamari.api.Obj', - 'ephox.katamari.api.Strings', - 'tinymce.core.EditorManager', - 'tinymce.core.util.I18n', - 'tinymce.plugins.help.data.PluginUrls' - ], - function (Arr, Fun, Obj, Strings, tinymce, I18n, PluginUrls) { - var makeLink = Fun.curry(Strings.supplant, '${name}'); - - var maybeUrlize = function (editor, key) { - return Arr.find(PluginUrls.urls, function (x) { - return x.key === key; - }).fold(function () { - var getMetadata = editor.plugins[key].getMetadata; - return typeof getMetadata === 'function' ? makeLink(getMetadata()) : key; - }, function (x) { - return makeLink({ name: x.name, url: 'https://www.tinymce.com/docs/plugins/' + x.key }); - }); - }; - - var getPluginKeys = function (editor) { - var keys = Obj.keys(editor.plugins); - return editor.settings.forced_plugins === undefined ? - keys : - Arr.filter(keys, Fun.not(Fun.curry(Arr.contains, editor.settings.forced_plugins))); + pass: pass, + fail: fail }; + }; + var filter = function (xs, pred) { + var r = []; + for (var i = 0, len = xs.length; i < len; i++) { + var x = xs[i]; + if (pred(x, i, xs)) { + r.push(x); + } + } + return r; + }; + var groupBy = function (xs, f) { + if (xs.length === 0) { + return []; + } else { + var wasType = f(xs[0]); + var r = []; + var group = []; + for (var i = 0, len = xs.length; i < len; i++) { + var x = xs[i]; + var type = f(x); + if (type !== wasType) { + r.push(group); + group = []; + } + wasType = type; + group.push(x); + } + if (group.length !== 0) { + r.push(group); + } + return r; + } + }; + var foldr = function (xs, f, acc) { + eachr(xs, function (x) { + acc = f(acc, x); + }); + return acc; + }; + var foldl = function (xs, f, acc) { + each(xs, function (x) { + acc = f(acc, x); + }); + return acc; + }; + var find = function (xs, pred) { + for (var i = 0, len = xs.length; i < len; i++) { + var x = xs[i]; + if (pred(x, i, xs)) { + return Option.some(x); + } + } + return Option.none(); + }; + var findIndex = function (xs, pred) { + for (var i = 0, len = xs.length; i < len; i++) { + var x = xs[i]; + if (pred(x, i, xs)) { + return Option.some(i); + } + } + return Option.none(); + }; + var slowIndexOf = function (xs, x) { + for (var i = 0, len = xs.length; i < len; ++i) { + if (xs[i] === x) { + return i; + } + } + return -1; + }; + var push = Array.prototype.push; + var flatten = function (xs) { + var r = []; + for (var i = 0, len = xs.length; i < len; ++i) { + if (!Array.prototype.isPrototypeOf(xs[i])) + throw new Error('Arr.flatten item ' + i + ' was not an array, input: ' + xs); + push.apply(r, xs[i]); + } + return r; + }; + var bind = function (xs, f) { + var output = map(xs, f); + return flatten(output); + }; + var forall = function (xs, pred) { + for (var i = 0, len = xs.length; i < len; ++i) { + var x = xs[i]; + if (pred(x, i, xs) !== true) { + return false; + } + } + return true; + }; + var equal = function (a1, a2) { + return a1.length === a2.length && forall(a1, function (x, i) { + return x === a2[i]; + }); + }; + var slice = Array.prototype.slice; + var reverse = function (xs) { + var r = slice.call(xs, 0); + r.reverse(); + return r; + }; + var difference = function (a1, a2) { + return filter(a1, function (x) { + return !contains(a2, x); + }); + }; + var mapToObject = function (xs, f) { + var r = {}; + for (var i = 0, len = xs.length; i < len; i++) { + var x = xs[i]; + r[String(x)] = f(x, i); + } + return r; + }; + var pure = function (x) { + return [x]; + }; + var sort = function (xs, comparator) { + var copy = slice.call(xs, 0); + copy.sort(comparator); + return copy; + }; + var head = function (xs) { + return xs.length === 0 ? Option.none() : Option.some(xs[0]); + }; + var last = function (xs) { + return xs.length === 0 ? Option.none() : Option.some(xs[xs.length - 1]); + }; + var $_4q6jluaoje5nvbpn = { + map: map, + each: each, + eachr: eachr, + partition: partition, + filter: filter, + groupBy: groupBy, + indexOf: indexOf, + foldr: foldr, + foldl: foldl, + find: find, + findIndex: findIndex, + flatten: flatten, + bind: bind, + forall: forall, + exists: exists, + contains: contains, + equal: equal, + reverse: reverse, + chunk: chunk, + difference: difference, + mapToObject: mapToObject, + pure: pure, + sort: sort, + range: range, + head: head, + last: last + }; - var pluginLister = function (editor) { - var pluginKeys = getPluginKeys(editor); - var pluginLis = Arr.map(pluginKeys, function (key) { - return '
  • ' + maybeUrlize(editor, key) + '
  • '; - }); - var count = pluginLis.length; - var pluginsString = pluginLis.join(''); + var I18n = tinymce.util.Tools.resolve('tinymce.util.I18n'); + + var Env = tinymce.util.Tools.resolve('tinymce.Env'); + + var meta = Env.mac ? '\u2318' : 'Ctrl'; + var access = Env.mac ? 'Ctrl + Alt' : 'Shift + Alt'; + var shortcuts = [ + { + shortcut: meta + ' + B', + action: 'Bold' + }, + { + shortcut: meta + ' + I', + action: 'Italic' + }, + { + shortcut: meta + ' + U', + action: 'Underline' + }, + { + shortcut: meta + ' + A', + action: 'Select all' + }, + { + shortcut: meta + ' + Y or ' + meta + ' + Shift + Z', + action: 'Redo' + }, + { + shortcut: meta + ' + Z', + action: 'Undo' + }, + { + shortcut: access + ' + 1', + action: 'Header 1' + }, + { + shortcut: access + ' + 2', + action: 'Header 2' + }, + { + shortcut: access + ' + 3', + action: 'Header 3' + }, + { + shortcut: access + ' + 4', + action: 'Header 4' + }, + { + shortcut: access + ' + 5', + action: 'Header 5' + }, + { + shortcut: access + ' + 6', + action: 'Header 6' + }, + { + shortcut: access + ' + 7', + action: 'Paragraph' + }, + { + shortcut: access + ' + 8', + action: 'Div' + }, + { + shortcut: access + ' + 9', + action: 'Address' + }, + { + shortcut: 'Alt + F9', + action: 'Focus to menubar' + }, + { + shortcut: 'Alt + F10', + action: 'Focus to toolbar' + }, + { + shortcut: 'Alt + F11', + action: 'Focus to element path' + }, + { + shortcut: 'Ctrl + Shift + P > Ctrl + Shift + P', + action: 'Focus to contextual toolbar' + }, + { + shortcut: meta + ' + K', + action: 'Insert link (if link plugin activated)' + }, + { + shortcut: meta + ' + S', + action: 'Save (if save plugin activated)' + }, + { + shortcut: meta + ' + F', + action: 'Find (if searchreplace plugin activated)' + } + ]; + var $_2gcimiasje5nvbq1 = { shortcuts: shortcuts }; - return '

    ' + I18n.translate(['Plugins installed ({0}):', count ]) + '

    ' + - '
      ' + pluginsString + '
    '; + var makeTab = function () { + var makeAriaLabel = function (shortcut) { + return 'aria-label="Action: ' + shortcut.action + ', Shortcut: ' + shortcut.shortcut.replace(/Ctrl/g, 'Control') + '"'; }; - - var installedPlugins = function (editor) { - return { - type: 'container', - html: '
    ' + - pluginLister(editor) + - '
    ', - flex: 1 - }; + var shortcutLisString = $_4q6jluaoje5nvbpn.map($_2gcimiasje5nvbq1.shortcuts, function (shortcut) { + return '' + '' + I18n.translate(shortcut.action) + '' + '' + shortcut.shortcut + '' + ''; + }).join(''); + return { + title: 'Handy Shortcuts', + type: 'container', + style: 'overflow-y: auto; overflow-x: hidden; max-height: 250px', + items: [{ + type: 'container', + html: '
    ' + '' + '' + '' + '' + '' + shortcutLisString + '
    ' + I18n.translate('Action') + '' + I18n.translate('Shortcut') + '
    ' + '
    ' + }] }; + }; + var $_1k9514anje5nvbpg = { makeTab: makeTab }; - var availablePlugins = function () { - return { - type: 'container', - html: '
    ' + - '

    ' + I18n.translate('Premium plugins:') + '

    ' + - '
      ' + - '
    • PowerPaste
    • ' + - '
    • Spell Checker Pro
    • ' + - '
    • Accessibility Checker
    • ' + - '
    • Advanced Code Editor
    • ' + - '
    • Enhanced Media Embed
    • ' + - '
    • Link Checker
    • ' + - '

    ' + - '

    ' + I18n.translate('Learn more...') + '

    ' + - '
    ', - flex: 1 - }; + var keys = function () { + var fastKeys = Object.keys; + var slowKeys = function (o) { + var r = []; + for (var i in o) { + if (o.hasOwnProperty(i)) { + r.push(i); + } + } + return r; }; - - var makeTab = function (editor) { + return fastKeys === undefined ? slowKeys : fastKeys; + }(); + 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 objectMap = function (obj, f) { + return tupleMap(obj, function (x, i, obj) { return { - title: 'Plugins', - type: 'container', - style: 'overflow-y: auto; overflow-x: hidden;', - layout: 'flex', - padding: 10, - spacing: 10, - items: [ - installedPlugins(editor), - availablePlugins() - ] + k: i, + v: f(x, i, obj) }; - }; - + }); + }; + var tupleMap = function (obj, f) { + var r = {}; + each$1(obj, function (x, i) { + var tuple = f(x, i, obj); + r[tuple.k] = tuple.v; + }); + return r; + }; + var bifilter = function (obj, pred) { + var t = {}; + var f = {}; + each$1(obj, function (x, i) { + var branch = pred(x, i) ? t : f; + branch[i] = x; + }); return { - makeTab: makeTab + t: t, + f: f }; - } -); - -/** - * ButtonsRow.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ + }; + var mapToArray = function (obj, f) { + var r = []; + each$1(obj, function (value, name) { + r.push(f(value, name)); + }); + return r; + }; + var find$1 = function (obj, pred) { + var props = keys(obj); + for (var k = 0, len = props.length; k < len; k++) { + var i = props[k]; + var x = obj[i]; + if (pred(x, i, obj)) { + return Option.some(x); + } + } + return Option.none(); + }; + var values = function (obj) { + return mapToArray(obj, function (v) { + return v; + }); + }; + var size = function (obj) { + return values(obj).length; + }; + var $_7ls6h4avje5nvbqc = { + bifilter: bifilter, + each: each$1, + map: objectMap, + mapToArray: mapToArray, + tupleMap: tupleMap, + find: find$1, + keys: keys, + values: values, + size: size + }; -define( - 'tinymce.plugins.help.ui.ButtonsRow', - [ - 'tinymce.core.EditorManager', - 'tinymce.core.util.I18n' - ], - function (EditorManager, I18n) { - var getVersion = function (major, minor) { - return major.indexOf('@') === 0 ? 'X.X.X' : major + '.' + minor; - }; + var addToStart = function (str, prefix) { + return prefix + str; + }; + var addToEnd = function (str, suffix) { + return str + suffix; + }; + var removeFromStart = function (str, numChars) { + return str.substring(numChars); + }; + var removeFromEnd = function (str, numChars) { + return str.substring(0, str.length - numChars); + }; + var $_6u6tpcaxje5nvbqj = { + addToStart: addToStart, + addToEnd: addToEnd, + removeFromStart: removeFromStart, + removeFromEnd: removeFromEnd + }; - var makeRow = function () { - var version = getVersion(EditorManager.majorVersion, EditorManager.minorVersion); - var changeLogLink = 'TinyMCE ' + version + ''; + var first = function (str, count) { + return str.substr(0, count); + }; + var last$1 = function (str, count) { + return str.substr(str.length - count, str.length); + }; + var head$1 = function (str) { + return str === '' ? Option.none() : Option.some(str.substr(0, 1)); + }; + var tail = function (str) { + return str === '' ? Option.none() : Option.some(str.substring(1)); + }; + var $_er7x3eayje5nvbqk = { + first: first, + last: last$1, + head: head$1, + tail: tail + }; - return [ - { - type: 'label', - html: I18n.translate(['You are using {0}', changeLogLink]) - }, - { - type: 'spacer', - flex: 1 - }, - { - text: 'Close', - onclick: function () { - this.parent().parent().close(); - } - } - ]; - }; + var checkRange = function (str, substr, start) { + if (substr === '') + return true; + if (str.length < substr.length) + return false; + var x = str.substr(start, start + substr.length); + return x === substr; + }; + var supplant = function (str, obj) { + var isStringOrNumber = function (a) { + var t = typeof a; + return t === 'string' || t === 'number'; + }; + return str.replace(/\${([^{}]*)}/g, function (a, b) { + var value = obj[b]; + return isStringOrNumber(value) ? value : a; + }); + }; + var removeLeading = function (str, prefix) { + return startsWith(str, prefix) ? $_6u6tpcaxje5nvbqj.removeFromStart(str, prefix.length) : str; + }; + var removeTrailing = function (str, prefix) { + return endsWith(str, prefix) ? $_6u6tpcaxje5nvbqj.removeFromEnd(str, prefix.length) : str; + }; + var ensureLeading = function (str, prefix) { + return startsWith(str, prefix) ? str : $_6u6tpcaxje5nvbqj.addToStart(str, prefix); + }; + var ensureTrailing = function (str, prefix) { + return endsWith(str, prefix) ? str : $_6u6tpcaxje5nvbqj.addToEnd(str, prefix); + }; + var contains$1 = function (str, substr) { + return str.indexOf(substr) !== -1; + }; + var capitalize = function (str) { + return $_er7x3eayje5nvbqk.head(str).bind(function (head) { + return $_er7x3eayje5nvbqk.tail(str).map(function (tail) { + return head.toUpperCase() + tail; + }); + }).getOr(str); + }; + var startsWith = function (str, prefix) { + return checkRange(str, prefix, 0); + }; + var endsWith = function (str, suffix) { + return checkRange(str, suffix, str.length - suffix.length); + }; + var trim = function (str) { + return str.replace(/^\s+|\s+$/g, ''); + }; + var lTrim = function (str) { + return str.replace(/^\s+/g, ''); + }; + var rTrim = function (str) { + return str.replace(/\s+$/g, ''); + }; + var $_32rpwoawje5nvbqg = { + supplant: supplant, + startsWith: startsWith, + removeLeading: removeLeading, + removeTrailing: removeTrailing, + ensureLeading: ensureLeading, + ensureTrailing: ensureTrailing, + endsWith: endsWith, + contains: contains$1, + trim: trim, + lTrim: lTrim, + rTrim: rTrim, + capitalize: capitalize + }; + var urls = [ + { + key: 'advlist', + name: 'Advanced List' + }, + { + key: 'anchor', + name: 'Anchor' + }, + { + key: 'autolink', + name: 'Autolink' + }, + { + key: 'autoresize', + name: 'Autoresize' + }, + { + key: 'autosave', + name: 'Autosave' + }, + { + key: 'bbcode', + name: 'BBCode' + }, + { + key: 'charmap', + name: 'Character Map' + }, + { + key: 'code', + name: 'Code' + }, + { + key: 'codesample', + name: 'Code Sample' + }, + { + key: 'colorpicker', + name: 'Color Picker' + }, + { + key: 'compat3x', + name: '3.x Compatibility' + }, + { + key: 'contextmenu', + name: 'Context Menu' + }, + { + key: 'directionality', + name: 'Directionality' + }, + { + key: 'emoticons', + name: 'Emoticons' + }, + { + key: 'fullpage', + name: 'Full Page' + }, + { + key: 'fullscreen', + name: 'Full Screen' + }, + { + key: 'help', + name: 'Help' + }, + { + key: 'hr', + name: 'Horizontal Rule' + }, + { + key: 'image', + name: 'Image' + }, + { + key: 'imagetools', + name: 'Image Tools' + }, + { + key: 'importcss', + name: 'Import CSS' + }, + { + key: 'insertdatetime', + name: 'Insert Date/Time' + }, + { + key: 'legacyoutput', + name: 'Legacy Output' + }, + { + key: 'link', + name: 'Link' + }, + { + key: 'lists', + name: 'Lists' + }, + { + key: 'media', + name: 'Media' + }, + { + key: 'nonbreaking', + name: 'Nonbreaking' + }, + { + key: 'noneditable', + name: 'Noneditable' + }, + { + key: 'pagebreak', + name: 'Page Break' + }, + { + key: 'paste', + name: 'Paste' + }, + { + key: 'preview', + name: 'Preview' + }, + { + key: 'print', + name: 'Print' + }, + { + key: 'save', + name: 'Save' + }, + { + key: 'searchreplace', + name: 'Search and Replace' + }, + { + key: 'spellchecker', + name: 'Spell Checker' + }, + { + key: 'tabfocus', + name: 'Tab Focus' + }, + { + key: 'table', + name: 'Table' + }, + { + key: 'template', + name: 'Template' + }, + { + key: 'textcolor', + name: 'Text Color' + }, + { + key: 'textpattern', + name: 'Text Pattern' + }, + { + key: 'toc', + name: 'Table of Contents' + }, + { + key: 'visualblocks', + name: 'Visual Blocks' + }, + { + key: 'visualchars', + name: 'Visual Characters' + }, + { + key: 'wordcount', + name: 'Word Count' + } + ]; + var $_8awrchazje5nvbql = { urls: urls }; + + var makeLink = $_dftk13aqje5nvbpy.curry($_32rpwoawje5nvbqg.supplant, '${name}'); + var maybeUrlize = function (editor, key) { + return $_4q6jluaoje5nvbpn.find($_8awrchazje5nvbql.urls, function (x) { + return x.key === key; + }).fold(function () { + var getMetadata = editor.plugins[key].getMetadata; + return typeof getMetadata === 'function' ? makeLink(getMetadata()) : key; + }, function (x) { + return makeLink({ + name: x.name, + url: 'https://www.tinymce.com/docs/plugins/' + x.key + }); + }); + }; + var getPluginKeys = function (editor) { + var keys = $_7ls6h4avje5nvbqc.keys(editor.plugins); + return editor.settings.forced_plugins === undefined ? keys : $_4q6jluaoje5nvbpn.filter(keys, $_dftk13aqje5nvbpy.not($_dftk13aqje5nvbpy.curry($_4q6jluaoje5nvbpn.contains, editor.settings.forced_plugins))); + }; + var pluginLister = function (editor) { + var pluginKeys = getPluginKeys(editor); + var pluginLis = $_4q6jluaoje5nvbpn.map(pluginKeys, function (key) { + return '
  • ' + maybeUrlize(editor, key) + '
  • '; + }); + var count = pluginLis.length; + var pluginsString = pluginLis.join(''); + return '

    ' + I18n.translate([ + 'Plugins installed ({0}):', + count + ]) + '

    ' + '
      ' + pluginsString + '
    '; + }; + var installedPlugins = function (editor) { return { - makeRow: makeRow - }; - } -); - -/** - * Dialog.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.help.ui.Dialog', - [ - 'tinymce.core.EditorManager', - 'tinymce.plugins.help.ui.KeyboardShortcutsTab', - 'tinymce.plugins.help.ui.PluginsTab', - 'tinymce.plugins.help.ui.ButtonsRow' - ], - function (EditorManager, KeyboardShortcutsTab, PluginsTab, ButtonsRow) { - var open = function (editor, pluginUrl) { - return function () { - editor.windowManager.open({ - title: 'Help', - bodyType: 'tabpanel', - layout: 'flex', - body: [ - KeyboardShortcutsTab.makeTab(), - PluginsTab.makeTab(editor, pluginUrl) - ], - buttons: ButtonsRow.makeRow(), - onPostRender: function () { - var title = this.getEl('title'); - title.innerHTML = 'TinyMCE Logo'; - } - }); - }; + type: 'container', + html: '
    ' + pluginLister(editor) + '
    ', + flex: 1 }; - + }; + var availablePlugins = function () { return { - open: open - }; - }); - -/** - * Commands.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.help.api.Commands', - [ - 'tinymce.plugins.help.ui.Dialog' - ], - function (Dialog) { - var register = function (editor, pluginUrl) { - editor.addCommand('mceHelp', Dialog.open(editor, pluginUrl)); + type: 'container', + html: '
    ' + '

    ' + I18n.translate('Premium plugins:') + '

    ' + '
      ' + '
    • PowerPaste
    • ' + '
    • Spell Checker Pro
    • ' + '
    • Accessibility Checker
    • ' + '
    • Advanced Code Editor
    • ' + '
    • Enhanced Media Embed
    • ' + '
    • Link Checker
    • ' + '

    ' + '

    ' + I18n.translate('Learn more...') + '

    ' + '
    ', + flex: 1 }; - + }; + var makeTab$1 = function (editor) { return { - register: register + title: 'Plugins', + type: 'container', + style: 'overflow-y: auto; overflow-x: hidden;', + layout: 'flex', + padding: 10, + spacing: 10, + items: [ + installedPlugins(editor), + availablePlugins() + ] }; - } -); - - + }; + var $_dp1hvyauje5nvbq5 = { makeTab: makeTab$1 }; -/** - * Buttons.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ + var EditorManager = tinymce.util.Tools.resolve('tinymce.EditorManager'); -define( - 'tinymce.plugins.help.ui.Buttons', - [ - 'tinymce.plugins.help.ui.Dialog' - ], - function (Dialog) { - var register = function (editor, pluginUrl) { - editor.addButton('help', { - icon: 'help', - onclick: Dialog.open(editor, pluginUrl) - }); + var getVersion = function (major, minor) { + return major.indexOf('@') === 0 ? 'X.X.X' : major + '.' + minor; + }; + var makeRow = function () { + var version = getVersion(EditorManager.majorVersion, EditorManager.minorVersion); + var changeLogLink = 'TinyMCE ' + version + ''; + return [ + { + type: 'label', + html: I18n.translate([ + 'You are using {0}', + changeLogLink + ]) + }, + { + type: 'spacer', + flex: 1 + }, + { + text: 'Close', + onclick: function () { + this.parent().parent().close(); + } + } + ]; + }; + var $_lxd7qb0je5nvbqn = { makeRow: makeRow }; - editor.addMenuItem('Help', { - text: 'Help', - icon: 'help', - context: 'help', - onclick: Dialog.open(editor, pluginUrl) + var open = function (editor, pluginUrl) { + return function () { + editor.windowManager.open({ + title: 'Help', + bodyType: 'tabpanel', + layout: 'flex', + body: [ + $_1k9514anje5nvbpg.makeTab(), + $_dp1hvyauje5nvbq5.makeTab(editor) + ], + buttons: $_lxd7qb0je5nvbqn.makeRow(), + onPostRender: function () { + var title = this.getEl('title'); + title.innerHTML = 'TinyMCE Logo'; + } }); }; + }; + var $_9qfhazamje5nvbpe = { open: open }; - return { - register: register - }; - } -); - -/** - * PLugin.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ + var register = function (editor, pluginUrl) { + editor.addCommand('mceHelp', $_9qfhazamje5nvbpe.open(editor, pluginUrl)); + }; + var $_bsywcjalje5nvbpc = { register: register }; -define( - 'tinymce.plugins.help.Plugin', - [ - 'tinymce.core.PluginManager', - 'tinymce.plugins.help.api.Commands', - 'tinymce.plugins.help.ui.Buttons', - 'tinymce.plugins.help.ui.Dialog' - ], - function (PluginManager, Commands, Buttons, Dialog) { - PluginManager.add('help', function (editor, pluginUrl) { - Buttons.register(editor, pluginUrl); - Commands.register(editor, pluginUrl); - editor.shortcuts.add('Alt+0', 'Open help dialog', 'mceHelp'); + var register$1 = function (editor, pluginUrl) { + editor.addButton('help', { + icon: 'help', + onclick: $_9qfhazamje5nvbpe.open(editor, pluginUrl) }); + editor.addMenuItem('help', { + text: 'Help', + icon: 'help', + context: 'help', + onclick: $_9qfhazamje5nvbpe.open(editor, pluginUrl) + }); + }; + var $_dqtc9hb2je5nvbqp = { register: register$1 }; - return function () {}; + PluginManager.add('help', function (editor, pluginUrl) { + $_dqtc9hb2je5nvbqp.register(editor, pluginUrl); + $_bsywcjalje5nvbpc.register(editor, pluginUrl); + editor.shortcuts.add('Alt+0', 'Open help dialog', 'mceHelp'); + }); + function Plugin () { } -); -dem('tinymce.plugins.help.Plugin')(); + return Plugin; + +}()); })(); diff --git a/tinymce_4/static/tinymce_4/tinymce/plugins/help/plugin.min.js b/tinymce_4/static/tinymce_4/tinymce/plugins/help/plugin.min.js index f2e7e15..147ff10 100644 --- a/tinymce_4/static/tinymce_4/tinymce/plugins/help/plugin.min.js +++ b/tinymce_4/static/tinymce_4/tinymce/plugins/help/plugin.min.js @@ -1 +1 @@ -!function(){var a={},b=function(b){for(var c=a[b],e=c.deps,f=c.defn,g=e.length,h=new Array(g),i=0;i-1},h=function(a,b){return t(a,b).isSome()},i=function(a,b){for(var c=[],d=0;d=0;c--){var d=a[c];b(d,c,a)}},n=function(a,b){for(var c=[],d=[],e=0,f=a.length;e Ctrl + Shift + P",action:"Focus to contextual toolbar"},{shortcut:b+" + K",action:"Insert link (if link plugin activated)"},{shortcut:b+" + S",action:"Save (if save plugin activated)"},{shortcut:b+" + F",action:"Find (if searchreplace plugin activated)"}];return{shortcuts:d}}),g("7",["a","b","c"],function(a,b,c){var d=function(){var d=function(a){return'aria-label="Action: '+a.action+", Shortcut: "+a.shortcut.replace(/Ctrl/g,"Control")+'"'},e=a.map(c.shortcuts,function(a){return'"+b.translate(a.action)+""+a.shortcut+""}).join("");return{title:"Handy Shortcuts",type:"container",style:"overflow-y: auto; overflow-x: hidden; max-height: 250px",items:[{type:"container",html:'
    "+e+"
    '+b.translate("Action")+""+b.translate("Shortcut")+"
    "}]}};return{makeTab:d}}),g("e",["h","m"],function(a,b){var c=function(){var a=b.keys,c=function(a){var b=[];for(var c in a)a.hasOwnProperty(c)&&b.push(c);return b};return void 0===a?c:a}(),d=function(a,b){for(var d=c(a),e=0,f=d.length;e${name}'),i=function(b,c){return a.find(g.urls,function(a){return a.key===c}).fold(function(){var a=b.plugins[c].getMetadata;return"function"==typeof a?h(a()):c},function(a){return h({name:a.name,url:"https://www.tinymce.com/docs/plugins/"+a.key})})},j=function(d){var e=c.keys(d.plugins);return void 0===d.settings.forced_plugins?e:a.filter(e,b.not(b.curry(a.contains,d.settings.forced_plugins)))},k=function(b){var c=j(b),d=a.map(c,function(a){return"
  • "+i(b,a)+"
  • "}),e=d.length,g=d.join("");return"

    "+f.translate(["Plugins installed ({0}):",e])+"

      "+g+"
    "},l=function(a){return{type:"container",html:'
    '+k(a)+"
    ",flex:1}},m=function(){return{type:"container",html:'

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

    • PowerPaste
    • Spell Checker Pro
    • Accessibility Checker
    • Advanced Code Editor
    • Enhanced Media Embed
    • Link Checker

    '+f.translate("Learn more...")+"

    ",flex:1}},n=function(a){return{title:"Plugins",type:"container",style:"overflow-y: auto; overflow-x: hidden;",layout:"flex",padding:10,spacing:10,items:[l(a),m()]}};return{makeTab:n}}),g("9",["6","b"],function(a,b){var c=function(a,b){return 0===a.indexOf("@")?"X.X.X":a+"."+b},d=function(){var d=c(a.majorVersion,a.minorVersion),e='TinyMCE '+d+"";return[{type:"label",html:b.translate(["You are using {0}",e])},{type:"spacer",flex:1},{text:"Close",onclick:function(){this.parent().parent().close()}}]};return{makeRow:d}}),g("4",["6","7","8","9"],function(a,b,c,d){var e=function(a,e){return function(){a.windowManager.open({title:"Help",bodyType:"tabpanel",layout:"flex",body:[b.makeTab(),c.makeTab(a,e)],buttons:d.makeRow(),onPostRender:function(){var a=this.getEl("title");a.innerHTML='TinyMCE Logo'}})}};return{open:e}}),g("2",["4"],function(a){var b=function(b,c){b.addCommand("mceHelp",a.open(b,c))};return{register:b}}),g("3",["4"],function(a){var b=function(b,c){b.addButton("help",{icon:"help",onclick:a.open(b,c)}),b.addMenuItem("Help",{text:"Help",icon:"help",context:"help",onclick:a.open(b,c)})};return{register:b}}),g("0",["1","2","3","4"],function(a,b,c,d){return a.add("help",function(a,d){c.register(a,d),b.register(a,d),a.shortcuts.add("Alt+0","Open help dialog","mceHelp")}),function(){}}),d("0")()}(); \ No newline at end of file +!function(){"use strict";var e,t,n,r,o,a,i=tinymce.util.Tools.resolve("tinymce.PluginManager"),u=function(e){return function(){return e}},c={noop:function(){},noarg:function(e){return function(){return e()}},compose:function(e,t){return function(){return e(t.apply(null,arguments))}},constant:u,identity:function(e){return e},tripleEquals:function(e,t){return e===t},curry:function(e){for(var t=new Array(arguments.length-1),n=1;n-1},g=function(e,t){for(var n=e.length,r=new Array(n),o=0;o Ctrl + Shift + P",action:"Focus to contextual toolbar"},{shortcut:T+" + K",action:"Insert link (if link plugin activated)"},{shortcut:T+" + S",action:"Save (if save plugin activated)"},{shortcut:T+" + F",action:"Find (if searchreplace plugin activated)"}]},O=function(){var e=b(_.shortcuts,function(e){return''+A.translate(e.action)+""+e.shortcut+"";var t}).join("");return{title:"Handy Shortcuts",type:"container",style:"overflow-y: auto; overflow-x: hidden; max-height: 250px",items:[{type:"container",html:'
    "+e+"
    '+A.translate("Action")+""+A.translate("Shortcut")+"
    "}]}},H=(a=Object.keys)===undefined?function(e){var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(n);return t}:a,M=function(e,t){for(var n=H(e),r=0,o=n.length;r${name}'),z=function(e){var t,n,r=(t=e,n=L.keys(t.plugins),t.settings.forced_plugins===undefined?n:x(n,c.not(c.curry(C,t.settings.forced_plugins)))),o=b(r,function(t){return"
  • "+(n=e,r=t,w(B,function(e){return e.key===r}).fold(function(){var e=n.plugins[r].getMetadata;return"function"==typeof e?j(e()):r},function(e){return j({name:e.name,url:"https://www.tinymce.com/docs/plugins/"+e.key})}))+"
  • ";var n,r}),a=o.length,i=o.join("");return"

    "+A.translate(["Plugins installed ({0}):",a])+"

      "+i+"
    "},D=function(e){return{title:"Plugins",type:"container",style:"overflow-y: auto; overflow-x: hidden;",layout:"flex",padding:10,spacing:10,items:[(t=e,{type:"container",html:'
    '+z(t)+"
    ",flex:1}),{type:"container",html:'

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

    • PowerPaste
    • Spell Checker Pro
    • Accessibility Checker
    • Advanced Code Editor
    • Enhanced Media Embed
    • Link Checker

    '+A.translate("Learn more...")+"

    ",flex:1}]};var t},q=tinymce.util.Tools.resolve("tinymce.EditorManager"),N=function(){var e,t,n='TinyMCE '+(e=q.majorVersion,t=q.minorVersion,0===e.indexOf("@")?"X.X.X":e+"."+t)+"";return[{type:"label",html:A.translate(["You are using {0}",n])},{type:"spacer",flex:1},{text:"Close",onclick:function(){this.parent().parent().close()}}]},R=function(e,t){return function(){e.windowManager.open({title:"Help",bodyType:"tabpanel",layout:"flex",body:[O(),D(e)],buttons:N(),onPostRender:function(){this.getEl("title").innerHTML='TinyMCE Logo'}})}},V=function(e,t){e.addCommand("mceHelp",R(e,t))},U=function(e,t){e.addButton("help",{icon:"help",onclick:R(e,t)}),e.addMenuItem("help",{text:"Help",icon:"help",context:"help",onclick:R(e,t)})};i.add("help",function(e,t){U(e,t),V(e,t),e.shortcuts.add("Alt+0","Open help dialog","mceHelp")})}(); \ No newline at end of file diff --git a/tinymce_4/static/tinymce_4/tinymce/plugins/hr/plugin.js b/tinymce_4/static/tinymce_4/tinymce/plugins/hr/plugin.js index d1c343a..91b522f 100644 --- a/tinymce_4/static/tinymce_4/tinymce/plugins/hr/plugin.js +++ b/tinymce_4/static/tinymce_4/tinymce/plugins/hr/plugin.js @@ -1,195 +1,39 @@ (function () { +var hr = (function () { + 'use strict'; -var defs = {}; // id -> {dependencies, definition, instance (possibly undefined)} + var PluginManager = tinymce.util.Tools.resolve('tinymce.PluginManager'); -// Used when there is no 'main' module. -// The name is probably (hopefully) unique so minification removes for releases. -var register_3795 = function (id) { - var module = dem(id); - var fragments = id.split('.'); - var target = Function('return this;')(); - for (var i = 0; i < fragments.length - 1; ++i) { - if (target[fragments[i]] === undefined) - target[fragments[i]] = {}; - target = target[fragments[i]]; - } - target[fragments[fragments.length - 1]] = module; -}; - -var instantiate = function (id) { - var actual = defs[id]; - var dependencies = actual.deps; - var definition = actual.defn; - var len = dependencies.length; - var instances = new Array(len); - for (var i = 0; i < len; ++i) - instances[i] = dem(dependencies[i]); - var defResult = definition.apply(null, instances); - if (defResult === undefined) - throw 'module [' + id + '] returned undefined'; - actual.instance = defResult; -}; - -var def = function (id, dependencies, definition) { - if (typeof id !== 'string') - throw 'module id must be a string'; - else if (dependencies === undefined) - throw 'no dependencies for ' + id; - else if (definition === undefined) - throw 'no definition function for ' + id; - defs[id] = { - deps: dependencies, - defn: definition, - instance: undefined + var register = function (editor) { + editor.addCommand('InsertHorizontalRule', function () { + editor.execCommand('mceInsertContent', false, '
    '); + }); }; -}; - -var dem = function (id) { - var actual = defs[id]; - if (actual === undefined) - throw 'module [' + id + '] was undefined'; - else if (actual.instance === undefined) - instantiate(id); - return actual.instance; -}; - -var req = function (ids, callback) { - var len = ids.length; - var instances = new Array(len); - for (var i = 0; i < len; ++i) - instances[i] = dem(ids[i]); - callback.apply(null, instances); -}; - -var ephox = {}; - -ephox.bolt = { - module: { - api: { - define: def, - require: req, - demand: dem - } - } -}; - -var define = def; -var require = req; -var demand = dem; -// this helps with minification when using a lot of global references -var defineGlobal = function (id, ref) { - define(id, [], function () { return ref; }); -}; -/*jsc -["tinymce.plugins.hr.Plugin","tinymce.core.PluginManager","tinymce.plugins.hr.api.Commands","tinymce.plugins.hr.ui.Buttons","global!tinymce.util.Tools.resolve"] -jsc*/ -defineGlobal("global!tinymce.util.Tools.resolve", tinymce.util.Tools.resolve); -/** - * ResolveGlobal.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.core.PluginManager', - [ - 'global!tinymce.util.Tools.resolve' - ], - function (resolve) { - return resolve('tinymce.PluginManager'); - } -); - -/** - * Commands.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.hr.api.Commands', - [ - ], - function () { - var register = function (editor) { - editor.addCommand('InsertHorizontalRule', function () { - editor.execCommand('mceInsertContent', false, '
    '); - }); - }; - - return { - register: register - }; - } -); -/** - * Buttons.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.hr.ui.Buttons', - [ - ], - function () { - var register = function (editor) { - editor.addButton('hr', { - icon: 'hr', - tooltip: 'Horizontal line', - cmd: 'InsertHorizontalRule' - }); + var $_7ewy2tbsje5nvbu8 = { register: register }; - editor.addMenuItem('hr', { - icon: 'hr', - text: 'Horizontal line', - cmd: 'InsertHorizontalRule', - context: 'insert' - }); - }; + var register$1 = function (editor) { + editor.addButton('hr', { + icon: 'hr', + tooltip: 'Horizontal line', + cmd: 'InsertHorizontalRule' + }); + editor.addMenuItem('hr', { + icon: 'hr', + text: 'Horizontal line', + cmd: 'InsertHorizontalRule', + context: 'insert' + }); + }; + var $_bcez0kbtje5nvbu9 = { register: register$1 }; - return { - register: register - }; + PluginManager.add('hr', function (editor) { + $_7ewy2tbsje5nvbu8.register(editor); + $_bcez0kbtje5nvbu9.register(editor); + }); + function Plugin () { } -); -/** - * Plugin.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ -define( - 'tinymce.plugins.hr.Plugin', - [ - 'tinymce.core.PluginManager', - 'tinymce.plugins.hr.api.Commands', - 'tinymce.plugins.hr.ui.Buttons' - ], - function (PluginManager, Commands, Buttons) { - PluginManager.add('hr', function (editor) { - Commands.register(editor); - Buttons.register(editor); - }); + return Plugin; - return function () { }; - } -); -dem('tinymce.plugins.hr.Plugin')(); +}()); })(); diff --git a/tinymce_4/static/tinymce_4/tinymce/plugins/hr/plugin.min.js b/tinymce_4/static/tinymce_4/tinymce/plugins/hr/plugin.min.js index c1dfdca..72bc2ca 100644 --- a/tinymce_4/static/tinymce_4/tinymce/plugins/hr/plugin.min.js +++ b/tinymce_4/static/tinymce_4/tinymce/plugins/hr/plugin.min.js @@ -1 +1 @@ -!function(){var a={},b=function(b){for(var c=a[b],e=c.deps,f=c.defn,g=e.length,h=new Array(g),i=0;i")})};return{register:a}}),g("3",[],function(){var a=function(a){a.addButton("hr",{icon:"hr",tooltip:"Horizontal line",cmd:"InsertHorizontalRule"}),a.addMenuItem("hr",{icon:"hr",text:"Horizontal line",cmd:"InsertHorizontalRule",context:"insert"})};return{register:a}}),g("0",["1","2","3"],function(a,b,c){return a.add("hr",function(a){b.register(a),c.register(a)}),function(){}}),d("0")()}(); \ No newline at end of file +!function(){"use strict";var n=tinymce.util.Tools.resolve("tinymce.PluginManager"),t=function(n){n.addCommand("InsertHorizontalRule",function(){n.execCommand("mceInsertContent",!1,"
    ")})},o=function(n){n.addButton("hr",{icon:"hr",tooltip:"Horizontal line",cmd:"InsertHorizontalRule"}),n.addMenuItem("hr",{icon:"hr",text:"Horizontal line",cmd:"InsertHorizontalRule",context:"insert"})};n.add("hr",function(n){t(n),o(n)})}(); \ No newline at end of file diff --git a/tinymce_4/static/tinymce_4/tinymce/plugins/image/plugin.js b/tinymce_4/static/tinymce_4/tinymce/plugins/image/plugin.js index 37a3611..bcb406e 100644 --- a/tinymce_4/static/tinymce_4/tinymce/plugins/image/plugin.js +++ b/tinymce_4/static/tinymce_4/tinymce/plugins/image/plugin.js @@ -1,1431 +1,1008 @@ (function () { +var image = (function () { + 'use strict'; -var defs = {}; // id -> {dependencies, definition, instance (possibly undefined)} + var PluginManager = tinymce.util.Tools.resolve('tinymce.PluginManager'); -// Used when there is no 'main' module. -// The name is probably (hopefully) unique so minification removes for releases. -var register_3795 = function (id) { - var module = dem(id); - var fragments = id.split('.'); - var target = Function('return this;')(); - for (var i = 0; i < fragments.length - 1; ++i) { - if (target[fragments[i]] === undefined) - target[fragments[i]] = {}; - target = target[fragments[i]]; - } - target[fragments[fragments.length - 1]] = module; -}; - -var instantiate = function (id) { - var actual = defs[id]; - var dependencies = actual.deps; - var definition = actual.defn; - var len = dependencies.length; - var instances = new Array(len); - for (var i = 0; i < len; ++i) - instances[i] = dem(dependencies[i]); - var defResult = definition.apply(null, instances); - if (defResult === undefined) - throw 'module [' + id + '] returned undefined'; - actual.instance = defResult; -}; + var Tools = tinymce.util.Tools.resolve('tinymce.util.Tools'); -var def = function (id, dependencies, definition) { - if (typeof id !== 'string') - throw 'module id must be a string'; - else if (dependencies === undefined) - throw 'no dependencies for ' + id; - else if (definition === undefined) - throw 'no definition function for ' + id; - defs[id] = { - deps: dependencies, - defn: definition, - instance: undefined + var hasDimensions = function (editor) { + return editor.settings.image_dimensions === false ? false : true; + }; + var hasAdvTab = function (editor) { + return editor.settings.image_advtab === true ? true : false; + }; + var getPrependUrl = function (editor) { + return editor.getParam('image_prepend_url', ''); + }; + var getClassList = function (editor) { + return editor.getParam('image_class_list'); + }; + var hasDescription = function (editor) { + return editor.settings.image_description === false ? false : true; + }; + var hasImageTitle = function (editor) { + return editor.settings.image_title === true ? true : false; + }; + var hasImageCaption = function (editor) { + return editor.settings.image_caption === true ? true : false; + }; + var getImageList = function (editor) { + return editor.getParam('image_list', false); + }; + var hasUploadUrl = function (editor) { + return editor.getParam('images_upload_url', false); + }; + var hasUploadHandler = function (editor) { + return editor.getParam('images_upload_handler', false); + }; + var getUploadUrl = function (editor) { + return editor.getParam('images_upload_url'); + }; + var getUploadHandler = function (editor) { + return editor.getParam('images_upload_handler'); + }; + var getUploadBasePath = function (editor) { + return editor.getParam('images_upload_base_path'); + }; + var getUploadCredentials = function (editor) { + return editor.getParam('images_upload_credentials'); + }; + var $_14xnkcbzje5nvbum = { + hasDimensions: hasDimensions, + hasAdvTab: hasAdvTab, + getPrependUrl: getPrependUrl, + getClassList: getClassList, + hasDescription: hasDescription, + hasImageTitle: hasImageTitle, + hasImageCaption: hasImageCaption, + getImageList: getImageList, + hasUploadUrl: hasUploadUrl, + hasUploadHandler: hasUploadHandler, + getUploadUrl: getUploadUrl, + getUploadHandler: getUploadHandler, + getUploadBasePath: getUploadBasePath, + getUploadCredentials: getUploadCredentials }; -}; - -var dem = function (id) { - var actual = defs[id]; - if (actual === undefined) - throw 'module [' + id + '] was undefined'; - else if (actual.instance === undefined) - instantiate(id); - return actual.instance; -}; - -var req = function (ids, callback) { - var len = ids.length; - var instances = new Array(len); - for (var i = 0; i < len; ++i) - instances[i] = dem(ids[i]); - callback.apply(null, instances); -}; - -var ephox = {}; - -ephox.bolt = { - module: { - api: { - define: def, - require: req, - demand: dem - } - } -}; - -var define = def; -var require = req; -var demand = dem; -// this helps with minification when using a lot of global references -var defineGlobal = function (id, ref) { - define(id, [], function () { return ref; }); -}; -/*jsc -["tinymce.plugins.image.Plugin","tinymce.core.PluginManager","tinymce.plugins.image.api.Commands","tinymce.plugins.image.core.FilterContent","tinymce.plugins.image.ui.Buttons","global!tinymce.util.Tools.resolve","tinymce.plugins.image.ui.Dialog","tinymce.core.util.Tools","ephox.sand.api.URL","global!document","global!Math","global!RegExp","tinymce.core.Env","tinymce.core.ui.Factory","tinymce.core.util.JSON","tinymce.core.util.XHR","tinymce.plugins.image.api.Settings","tinymce.plugins.image.core.Uploader","tinymce.plugins.image.core.Utils","ephox.sand.util.Global","ephox.sand.api.XMLHttpRequest","global!window","tinymce.core.util.Promise","ephox.katamari.api.Resolve","ephox.katamari.api.Global"] -jsc*/ -defineGlobal("global!tinymce.util.Tools.resolve", tinymce.util.Tools.resolve); -/** - * ResolveGlobal.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.core.PluginManager', - [ - 'global!tinymce.util.Tools.resolve' - ], - function (resolve) { - return resolve('tinymce.PluginManager'); - } -); - -define( - 'ephox.katamari.api.Global', - - [ - ], - - function () { - // Use window object as the global if it's available since CSP will block script evals - if (typeof window !== 'undefined') { - return window; - } else { - return Function('return this;')(); - } - } -); - - -define( - 'ephox.katamari.api.Resolve', - - [ - 'ephox.katamari.api.Global' - ], - - function (Global) { - /** path :: ([String], JsObj?) -> JsObj */ - var path = function (parts, scope) { - var o = scope !== undefined ? scope : Global; - for (var i = 0; i < parts.length && o !== undefined && o !== null; ++i) - o = o[parts[i]]; - return o; - }; - - /** resolve :: (String, JsObj?) -> JsObj */ - var resolve = function (p, scope) { - var parts = p.split('.'); - return path(parts, scope); - }; - - /** step :: (JsObj, String) -> JsObj */ - var step = function (o, part) { - if (o[part] === undefined || o[part] === null) - o[part] = {}; - return o[part]; - }; - - /** forge :: ([String], JsObj?) -> JsObj */ - var forge = function (parts, target) { - var o = target !== undefined ? target : Global; - for (var i = 0; i < parts.length; ++i) - o = step(o, parts[i]); - return o; - }; - - /** namespace :: (String, JsObj?) -> JsObj */ - var namespace = function (name, target) { - var parts = name.split('.'); - return forge(parts, target); - }; - - return { - path: path, - resolve: resolve, - forge: forge, - namespace: namespace - }; - } -); - - -define( - 'ephox.sand.util.Global', - - [ - 'ephox.katamari.api.Resolve' - ], - - function (Resolve) { - var unsafe = function (name, scope) { - return Resolve.resolve(name, scope); - }; - - var getOrDie = function (name, scope) { - var actual = unsafe(name, scope); - - if (actual === undefined) throw name + ' not available on this browser'; - return actual; - }; - - return { - getOrDie: getOrDie - }; - } -); -define( - 'ephox.sand.api.URL', - - [ - 'ephox.sand.util.Global' - ], - - function (Global) { - /* - * IE10 and above per - * https://developer.mozilla.org/en-US/docs/Web/API/URL.createObjectURL - * - * Also Safari 6.1+ - * Safari 6.0 has 'webkitURL' instead, but doesn't support flexbox so we - * aren't supporting it anyway - */ - var url = function () { - return Global.getOrDie('URL'); - }; - - var createObjectURL = function (blob) { - return url().createObjectURL(blob); - }; - - var revokeObjectURL = function (u) { - url().revokeObjectURL(u); - }; - - return { - createObjectURL: createObjectURL, - revokeObjectURL: revokeObjectURL - }; - } -); -defineGlobal("global!document", document); -defineGlobal("global!Math", Math); -defineGlobal("global!RegExp", RegExp); -/** - * ResolveGlobal.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.core.Env', - [ - 'global!tinymce.util.Tools.resolve' - ], - function (resolve) { - return resolve('tinymce.Env'); - } -); - -/** - * ResolveGlobal.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.core.ui.Factory', - [ - 'global!tinymce.util.Tools.resolve' - ], - function (resolve) { - return resolve('tinymce.ui.Factory'); - } -); - -/** - * ResolveGlobal.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.core.util.JSON', - [ - 'global!tinymce.util.Tools.resolve' - ], - function (resolve) { - return resolve('tinymce.util.JSON'); - } -); - -/** - * ResolveGlobal.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.core.util.Tools', - [ - 'global!tinymce.util.Tools.resolve' - ], - function (resolve) { - return resolve('tinymce.util.Tools'); - } -); - -/** - * ResolveGlobal.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.core.util.XHR', - [ - 'global!tinymce.util.Tools.resolve' - ], - function (resolve) { - return resolve('tinymce.util.XHR'); - } -); - -/** - * Settings.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.plugins.image.api.Settings', - [ - ], - function () { - var hasDimensions = function (editor) { - return editor.getParam('image_dimensions', true); - }; - - var hasAdvTab = function (editor) { - return editor.getParam('image_advtab', false); - }; - - var getPrependUrl = function (editor) { - return editor.getParam('image_prepend_url', ''); - }; - - var getClassList = function (editor) { - return editor.getParam('image_class_list'); - }; - - var hasDescription = function (editor) { - return editor.getParam('image_description', true); - }; - - var hasImageTitle = function (editor) { - return editor.getParam('image_title', false); - }; - - var hasImageCaption = function (editor) { - return editor.getParam('image_caption', false); - }; - - var getImageList = function (editor) { - return editor.getParam('image_list', false); - }; - - return { - hasDimensions: hasDimensions, - hasAdvTab: hasAdvTab, - getPrependUrl: getPrependUrl, - getClassList: getClassList, - hasDescription: hasDescription, - hasImageTitle: hasImageTitle, - hasImageCaption: hasImageCaption, - getImageList: getImageList - }; - } -); -define( - 'ephox.sand.api.XMLHttpRequest', - - [ - 'ephox.sand.util.Global' - ], - - function (Global) { - /* - * IE8 and above per - * https://developer.mozilla.org/en/docs/XMLHttpRequest - */ - return function () { - var f = Global.getOrDie('XMLHttpRequest'); - return new f(); - }; - } -); -defineGlobal("global!window", window); -/** - * ResolveGlobal.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.core.util.Promise', - [ - 'global!tinymce.util.Tools.resolve' - ], - function (resolve) { - return resolve('tinymce.util.Promise'); - } -); - -/** - * Uploader.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -/** - * This is basically cut down version of tinymce.core.file.Uploader, which we could use directly - * if it wasn't marked as private. - */ -define( - 'tinymce.plugins.image.core.Uploader', - [ - 'ephox.sand.api.XMLHttpRequest', - 'global!document', - 'global!window', - 'tinymce.core.util.Promise', - 'tinymce.core.util.Tools' - ], - function (XMLHttpRequest, document, window, Promise, Tools) { - var noop = function () {}; - - var pathJoin = function (path1, path2) { - if (path1) { - return path1.replace(/\/$/, '') + '/' + path2.replace(/^\//, ''); - } - - return path2; - }; - - return function (settings) { - var defaultHandler = function (blobInfo, success, failure, progress) { - var xhr, formData; - - xhr = new XMLHttpRequest(); - xhr.open('POST', settings.url); - xhr.withCredentials = settings.credentials; - - xhr.upload.onprogress = function (e) { - progress(e.loaded / e.total * 100); - }; - - xhr.onerror = function () { - failure('Image upload failed due to a XHR Transport error. Code: ' + xhr.status); - }; - - xhr.onload = function () { - var json; - - if (xhr.status < 200 || xhr.status >= 300) { - failure('HTTP Error: ' + xhr.status); - return; - } - - json = JSON.parse(xhr.responseText); - - if (!json || typeof json.location !== 'string') { - failure('Invalid JSON: ' + xhr.responseText); - return; - } - - success(pathJoin(settings.basePath, json.location)); - }; - - formData = new window.FormData(); - formData.append('file', blobInfo.blob(), blobInfo.filename()); - - xhr.send(formData); - }; - - var uploadBlob = function (blobInfo, handler) { - return new Promise(function (resolve, reject) { - try { - handler(blobInfo, resolve, reject, noop); - } catch (ex) { - reject(ex.message); - } - }); - }; - - var isDefaultHandler = function (handler) { - return handler === defaultHandler; - }; - - var upload = function (blobInfo) { - return (!settings.url && isDefaultHandler(settings.handler)) ? Promise.reject('Upload url missng from the settings.') : uploadBlob(blobInfo, settings.handler); - }; - - settings = Tools.extend({ - credentials: false, - handler: defaultHandler - }, settings); - - return { - upload: upload - }; - }; - } -); -/** - * Utils.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -/** - * @class tinymce.image.core.Utils - * @private - */ -define( - 'tinymce.plugins.image.core.Utils', - [ - 'tinymce.core.util.Tools', - 'global!Math', - 'global!document' - ], - function (Tools, Math, document) { - - var getImageSize = function (url, callback) { - var img = document.createElement('img'); - - function done(width, height) { - if (img.parentNode) { - img.parentNode.removeChild(img); - } - - callback({ width: width, height: height }); - } - - img.onload = function () { - done(Math.max(img.width, img.clientWidth), Math.max(img.height, img.clientHeight)); - }; - - img.onerror = function () { - done(); - }; - - var style = img.style; - style.visibility = 'hidden'; - style.position = 'fixed'; - style.bottom = style.left = 0; - style.width = style.height = 'auto'; - - document.body.appendChild(img); - img.src = url; - }; - - - var buildListItems = function (inputList, itemCallback, startItems) { - function appendItems(values, output) { - output = output || []; - - Tools.each(values, function (item) { - var menuItem = { text: item.text || item.title }; - - if (item.menu) { - menuItem.menu = appendItems(item.menu); - } else { - menuItem.value = item.value; - itemCallback(menuItem); - } - - output.push(menuItem); - }); - - return output; - } - - return appendItems(inputList, startItems || []); - }; - - var removePixelSuffix = function (value) { - if (value) { - value = value.replace(/px$/, ''); - } - return value; - }; - - var addPixelSuffix = function (value) { - if (value.length > 0 && /^[0-9]+$/.test(value)) { - value += 'px'; - } - return value; - }; - - var mergeMargins = function (css) { - if (css.margin) { - - var splitMargin = css.margin.split(" "); - - switch (splitMargin.length) { - case 1: //margin: toprightbottomleft; - css['margin-top'] = css['margin-top'] || splitMargin[0]; - css['margin-right'] = css['margin-right'] || splitMargin[0]; - css['margin-bottom'] = css['margin-bottom'] || splitMargin[0]; - css['margin-left'] = css['margin-left'] || splitMargin[0]; - break; - case 2: //margin: topbottom rightleft; - css['margin-top'] = css['margin-top'] || splitMargin[0]; - css['margin-right'] = css['margin-right'] || splitMargin[1]; - css['margin-bottom'] = css['margin-bottom'] || splitMargin[0]; - css['margin-left'] = css['margin-left'] || splitMargin[1]; - break; - case 3: //margin: top rightleft bottom; - css['margin-top'] = css['margin-top'] || splitMargin[0]; - css['margin-right'] = css['margin-right'] || splitMargin[1]; - css['margin-bottom'] = css['margin-bottom'] || splitMargin[2]; - css['margin-left'] = css['margin-left'] || splitMargin[1]; - break; - case 4: //margin: top right bottom left; - css['margin-top'] = css['margin-top'] || splitMargin[0]; - css['margin-right'] = css['margin-right'] || splitMargin[1]; - css['margin-bottom'] = css['margin-bottom'] || splitMargin[2]; - css['margin-left'] = css['margin-left'] || splitMargin[3]; - } - delete css.margin; - } - return css; - }; - - return { - getImageSize: getImageSize, - buildListItems: buildListItems, - removePixelSuffix: removePixelSuffix, - addPixelSuffix: addPixelSuffix, - mergeMargins: mergeMargins - }; - } -); - -/** - * Dialog.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -/** - * @class tinymce.image.ui.Dialog - * @private - */ -define( - 'tinymce.plugins.image.ui.Dialog', - [ - 'ephox.sand.api.URL', - 'global!document', - 'global!Math', - 'global!RegExp', - 'tinymce.core.Env', - 'tinymce.core.ui.Factory', - 'tinymce.core.util.JSON', - 'tinymce.core.util.Tools', - 'tinymce.core.util.XHR', - 'tinymce.plugins.image.api.Settings', - 'tinymce.plugins.image.core.Uploader', - 'tinymce.plugins.image.core.Utils' - ], - function (URL, document, Math, RegExp, Env, Factory, JSON, Tools, XHR, Settings, Uploader, Utils) { - return function (editor) { - function createImageList(callback) { - var imageList = Settings.getImageList(editor); - - if (typeof imageList === "string") { - XHR.send({ - url: imageList, - success: function (text) { - callback(JSON.parse(text)); - } - }); - } else if (typeof imageList === "function") { - imageList(callback); - } else { - callback(imageList); - } - } - - function showDialog(imageList) { - var win, data = {}, imgElm, figureElm, dom = editor.dom, settings = editor.settings; - var width, height, imageListCtrl, classListCtrl, imageDimensions = Settings.hasDimensions(editor); - - function onFileInput() { - var Throbber = Factory.get('Throbber'); - var throbber = new Throbber(win.getEl()); - var file = this.value(); - - var uploader = new Uploader({ - url: settings.images_upload_url, - basePath: settings.images_upload_base_path, - credentials: settings.images_upload_credentials, - handler: settings.images_upload_handler - }); - - // we do not need to add this to editors blobCache, so we fake bare minimum - var blobInfo = editor.editorUpload.blobCache.create({ - blob: file, - name: file.name ? file.name.replace(/\.[^\.]+$/, '') : null, // strip extension - base64: 'data:image/fake;base64,=' // without this create() will throw exception - }); - - var finalize = function () { - throbber.hide(); - URL.revokeObjectURL(blobInfo.blobUri()); // in theory we could fake blobUri too, but until it's legitimate, we have too revoke it manually - }; - - throbber.show(); - - return uploader.upload(blobInfo).then(function (url) { - var src = win.find('#src'); - src.value(url); - win.find('tabpanel')[0].activateTab(0); // switch to General tab - src.fire('change'); // this will invoke onSrcChange (and any other handlers, if any). - finalize(); - return url; - }, function (err) { - editor.windowManager.alert(err); - finalize(); - }); - } - - function isTextBlock(node) { - return editor.schema.getTextBlockElements()[node.nodeName]; - } - - function recalcSize() { - var widthCtrl, heightCtrl, newWidth, newHeight; - - widthCtrl = win.find('#width')[0]; - heightCtrl = win.find('#height')[0]; - - if (!widthCtrl || !heightCtrl) { - return; - } - - newWidth = widthCtrl.value(); - newHeight = heightCtrl.value(); - - if (win.find('#constrain')[0].checked() && width && height && newWidth && newHeight) { - if (width !== newWidth) { - newHeight = Math.round((newWidth / width) * newHeight); - - if (!isNaN(newHeight)) { - heightCtrl.value(newHeight); - } - } else { - newWidth = Math.round((newHeight / height) * newWidth); - - if (!isNaN(newWidth)) { - widthCtrl.value(newWidth); - } - } - } - - width = newWidth; - height = newHeight; - } - - function updateStyle() { - if (!Settings.hasAdvTab(editor)) { - return; - } - - var data = win.toJSON(), - css = dom.parseStyle(data.style); - - css = Utils.mergeMargins(css); - - if (data.vspace) { - css['margin-top'] = css['margin-bottom'] = Utils.addPixelSuffix(data.vspace); - } - if (data.hspace) { - css['margin-left'] = css['margin-right'] = Utils.addPixelSuffix(data.hspace); - } - if (data.border) { - css['border-width'] = Utils.addPixelSuffix(data.border); - } - - win.find('#style').value(dom.serializeStyle(dom.parseStyle(dom.serializeStyle(css)))); - } - - function updateVSpaceHSpaceBorder() { - if (!Settings.hasAdvTab(editor)) { - return; - } - - var data = win.toJSON(), - css = dom.parseStyle(data.style); - - win.find('#vspace').value(""); - win.find('#hspace').value(""); - - css = Utils.mergeMargins(css); - - //Move opposite equal margins to vspace/hspace field - if ((css['margin-top'] && css['margin-bottom']) || (css['margin-right'] && css['margin-left'])) { - if (css['margin-top'] === css['margin-bottom']) { - win.find('#vspace').value(Utils.removePixelSuffix(css['margin-top'])); - } else { - win.find('#vspace').value(''); - } - if (css['margin-right'] === css['margin-left']) { - win.find('#hspace').value(Utils.removePixelSuffix(css['margin-right'])); - } else { - win.find('#hspace').value(''); - } - } - - //Move border-width - if (css['border-width']) { - win.find('#border').value(Utils.removePixelSuffix(css['border-width'])); - } - - win.find('#style').value(dom.serializeStyle(dom.parseStyle(dom.serializeStyle(css)))); - } - - function waitLoad(imgElm) { - function selectImage() { - imgElm.onload = imgElm.onerror = null; - - if (editor.selection) { - editor.selection.select(imgElm); - editor.nodeChanged(); - } - } - - imgElm.onload = function () { - if (!data.width && !data.height && imageDimensions) { - dom.setAttribs(imgElm, { - width: imgElm.clientWidth, - height: imgElm.clientHeight - }); - } - - selectImage(); - }; - - imgElm.onerror = selectImage; - } - - function onSubmitForm() { - var figureElm, oldImg; - - updateStyle(); - recalcSize(); - - data = Tools.extend(data, win.toJSON()); - - if (!data.alt) { - data.alt = ''; - } - - if (!data.title) { - data.title = ''; - } - - if (data.width === '') { - data.width = null; - } - - if (data.height === '') { - data.height = null; - } - - if (!data.style) { - data.style = null; - } - - // Setup new data excluding style properties - /*eslint dot-notation: 0*/ - data = { - src: data.src, - alt: data.alt, - title: data.title, - width: data.width, - height: data.height, - style: data.style, - caption: data.caption, - "class": data["class"] - }; - - editor.undoManager.transact(function () { - if (!data.src) { - if (imgElm) { - var elm = dom.is(imgElm.parentNode, 'figure.image') ? imgElm.parentNode : imgElm; - dom.remove(elm); - editor.focus(); - editor.nodeChanged(); - - if (dom.isEmpty(editor.getBody())) { - editor.setContent(''); - editor.selection.setCursorLocation(); - } - } - - return; - } - - if (data.title === "") { - data.title = null; - } - - if (!imgElm) { - data.id = '__mcenew'; - editor.focus(); - editor.selection.setContent(dom.createHTML('img', data)); - imgElm = dom.get('__mcenew'); - dom.setAttrib(imgElm, 'id', null); - } else { - dom.setAttribs(imgElm, data); - } - - editor.editorUpload.uploadImagesAuto(); - - if (data.caption === false) { - if (dom.is(imgElm.parentNode, 'figure.image')) { - figureElm = imgElm.parentNode; - dom.setAttrib(imgElm, 'contenteditable', null); - dom.insertAfter(imgElm, figureElm); - dom.remove(figureElm); - editor.selection.select(imgElm); - editor.nodeChanged(); - } - } - - if (data.caption === true) { - if (!dom.is(imgElm.parentNode, 'figure.image')) { - oldImg = imgElm; - imgElm = imgElm.cloneNode(true); - imgElm.contentEditable = true; - figureElm = dom.create('figure', { 'class': 'image' }); - figureElm.appendChild(imgElm); - figureElm.appendChild(dom.create('figcaption', { contentEditable: true }, 'Caption')); - figureElm.contentEditable = false; - - var textBlock = dom.getParent(oldImg, isTextBlock); - if (textBlock) { - dom.split(textBlock, oldImg, figureElm); - } else { - dom.replace(figureElm, oldImg); - } - - editor.selection.select(figureElm); - } - - return; - } - - waitLoad(imgElm); - }); - } - - function onSrcChange(e) { - var srcURL, prependURL, absoluteURLPattern, meta = e.meta || {}; - - if (imageListCtrl) { - imageListCtrl.value(editor.convertURL(this.value(), 'src')); - } - - Tools.each(meta, function (value, key) { - win.find('#' + key).value(value); - }); - - if (!meta.width && !meta.height) { - srcURL = editor.convertURL(this.value(), 'src'); - - // Pattern test the src url and make sure we haven't already prepended the url - prependURL = Settings.getPrependUrl(editor); - absoluteURLPattern = new RegExp('^(?:[a-z]+:)?//', 'i'); - if (prependURL && !absoluteURLPattern.test(srcURL) && srcURL.substring(0, prependURL.length) !== prependURL) { - srcURL = prependURL + srcURL; - } - - this.value(srcURL); - - Utils.getImageSize(editor.documentBaseURI.toAbsolute(this.value()), function (data) { - if (data.width && data.height && imageDimensions) { - width = data.width; - height = data.height; - - win.find('#width').value(width); - win.find('#height').value(height); - } - }); - } - } - - function onBeforeCall(e) { - e.meta = win.toJSON(); - } - - imgElm = editor.selection.getNode(); - figureElm = dom.getParent(imgElm, 'figure.image'); - if (figureElm) { - imgElm = dom.select('img', figureElm)[0]; - } - - if (imgElm && - (imgElm.nodeName !== 'IMG' || - imgElm.getAttribute('data-mce-object') || - imgElm.getAttribute('data-mce-placeholder'))) { - imgElm = null; - } - - if (imgElm) { - width = dom.getAttrib(imgElm, 'width'); - height = dom.getAttrib(imgElm, 'height'); - data = { - src: dom.getAttrib(imgElm, 'src'), - alt: dom.getAttrib(imgElm, 'alt'), - title: dom.getAttrib(imgElm, 'title'), - "class": dom.getAttrib(imgElm, 'class'), - width: width, - height: height, - caption: !!figureElm - }; - } + var global = typeof window !== 'undefined' ? window : Function('return this;')(); - if (imageList) { - imageListCtrl = { - type: 'listbox', - label: 'Image list', - values: Utils.buildListItems( - imageList, - function (item) { - item.value = editor.convertURL(item.value || item.url, 'src'); - }, - [{ text: 'None', value: '' }] - ), - value: data.src && editor.convertURL(data.src, 'src'), - onselect: function (e) { - var altCtrl = win.find('#alt'); + 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 step = function (o, part) { + if (o[part] === undefined || o[part] === null) + o[part] = {}; + return o[part]; + }; + var forge = function (parts, target) { + var o = target !== undefined ? target : global; + for (var i = 0; i < parts.length; ++i) + o = step(o, parts[i]); + return o; + }; + var namespace = function (name, target) { + var parts = name.split('.'); + return forge(parts, target); + }; + var $_4xlcafc3je5nvbuz = { + path: path, + resolve: resolve, + forge: forge, + namespace: namespace + }; - if (!altCtrl.value() || (e.lastControl && altCtrl.value() === e.lastControl.text())) { - altCtrl.value(e.control.text()); - } + var unsafe = function (name, scope) { + return $_4xlcafc3je5nvbuz.resolve(name, scope); + }; + var getOrDie = function (name, scope) { + var actual = unsafe(name, scope); + if (actual === undefined || actual === null) + throw name + ' not available on this browser'; + return actual; + }; + var $_f55bjmc2je5nvbuw = { getOrDie: getOrDie }; - win.find('#src').value(e.control.value()).fire('change'); - }, - onPostRender: function () { - /*eslint consistent-this: 0*/ - imageListCtrl = this; - } - }; - } + function FileReader () { + var f = $_f55bjmc2je5nvbuw.getOrDie('FileReader'); + return new f(); + } - if (Settings.getClassList(editor)) { - classListCtrl = { - name: 'class', - type: 'listbox', - label: 'Class', - values: Utils.buildListItems( - Settings.getClassList(editor), - function (item) { - if (item.value) { - item.textStyle = function () { - return editor.formatter.getCssText({ inline: 'img', classes: [item.value] }); - }; - } - } - ) - }; - } + var Promise = tinymce.util.Tools.resolve('tinymce.util.Promise'); - // General settings shared between simple and advanced dialogs - var generalFormItems = [ - { - name: 'src', - type: 'filepicker', - filetype: 'image', - label: 'Source', - autofocus: true, - onchange: onSrcChange, - onbeforecall: onBeforeCall - }, - imageListCtrl - ]; + var XHR = tinymce.util.Tools.resolve('tinymce.util.XHR'); - if (Settings.hasDescription(editor)) { - generalFormItems.push({ name: 'alt', type: 'textbox', label: 'Image description' }); + var parseIntAndGetMax = function (val1, val2) { + return Math.max(parseInt(val1, 10), parseInt(val2, 10)); + }; + var getImageSize = function (url, callback) { + var img = document.createElement('img'); + function done(width, height) { + if (img.parentNode) { + img.parentNode.removeChild(img); + } + callback({ + width: width, + height: height + }); + } + img.onload = function () { + var width = parseIntAndGetMax(img.width, img.clientWidth); + var height = parseIntAndGetMax(img.height, img.clientHeight); + done(width, height); + }; + img.onerror = function () { + done(0, 0); + }; + var style = img.style; + style.visibility = 'hidden'; + style.position = 'fixed'; + style.bottom = style.left = '0px'; + style.width = style.height = 'auto'; + document.body.appendChild(img); + img.src = url; + }; + var buildListItems = function (inputList, itemCallback, startItems) { + function appendItems(values, output) { + output = output || []; + Tools.each(values, function (item) { + var menuItem = { text: item.text || item.title }; + if (item.menu) { + menuItem.menu = appendItems(item.menu); + } else { + menuItem.value = item.value; + itemCallback(menuItem); } - - if (Settings.hasImageTitle(editor)) { - generalFormItems.push({ name: 'title', type: 'textbox', label: 'Image Title' }); + output.push(menuItem); + }); + return output; + } + return appendItems(inputList, startItems || []); + }; + var removePixelSuffix = function (value) { + if (value) { + value = value.replace(/px$/, ''); + } + return value; + }; + var addPixelSuffix = function (value) { + if (value.length > 0 && /^[0-9]+$/.test(value)) { + value += 'px'; + } + return value; + }; + var mergeMargins = function (css) { + if (css.margin) { + var splitMargin = css.margin.split(' '); + switch (splitMargin.length) { + case 1: + css['margin-top'] = css['margin-top'] || splitMargin[0]; + css['margin-right'] = css['margin-right'] || splitMargin[0]; + css['margin-bottom'] = css['margin-bottom'] || splitMargin[0]; + css['margin-left'] = css['margin-left'] || splitMargin[0]; + break; + case 2: + css['margin-top'] = css['margin-top'] || splitMargin[0]; + css['margin-right'] = css['margin-right'] || splitMargin[1]; + css['margin-bottom'] = css['margin-bottom'] || splitMargin[0]; + css['margin-left'] = css['margin-left'] || splitMargin[1]; + break; + case 3: + css['margin-top'] = css['margin-top'] || splitMargin[0]; + css['margin-right'] = css['margin-right'] || splitMargin[1]; + css['margin-bottom'] = css['margin-bottom'] || splitMargin[2]; + css['margin-left'] = css['margin-left'] || splitMargin[1]; + break; + case 4: + css['margin-top'] = css['margin-top'] || splitMargin[0]; + css['margin-right'] = css['margin-right'] || splitMargin[1]; + css['margin-bottom'] = css['margin-bottom'] || splitMargin[2]; + css['margin-left'] = css['margin-left'] || splitMargin[3]; + } + delete css.margin; + } + return css; + }; + var createImageList = function (editor, callback) { + var imageList = $_14xnkcbzje5nvbum.getImageList(editor); + if (typeof imageList === 'string') { + XHR.send({ + url: imageList, + success: function (text) { + callback(JSON.parse(text)); } + }); + } else if (typeof imageList === 'function') { + imageList(callback); + } else { + callback(imageList); + } + }; + var waitLoadImage = function (editor, data, imgElm) { + function selectImage() { + imgElm.onload = imgElm.onerror = null; + if (editor.selection) { + editor.selection.select(imgElm); + editor.nodeChanged(); + } + } + imgElm.onload = function () { + if (!data.width && !data.height && $_14xnkcbzje5nvbum.hasDimensions(editor)) { + editor.dom.setAttribs(imgElm, { + width: imgElm.clientWidth, + height: imgElm.clientHeight + }); + } + selectImage(); + }; + imgElm.onerror = selectImage; + }; + var blobToDataUri = function (blob) { + return new Promise(function (resolve, reject) { + var reader = new FileReader(); + reader.onload = function () { + resolve(reader.result); + }; + reader.onerror = function () { + reject(FileReader.error.message); + }; + reader.readAsDataURL(blob); + }); + }; + var $_1g1v9c0je5nvbuo = { + getImageSize: getImageSize, + buildListItems: buildListItems, + removePixelSuffix: removePixelSuffix, + addPixelSuffix: addPixelSuffix, + mergeMargins: mergeMargins, + createImageList: createImageList, + waitLoadImage: waitLoadImage, + blobToDataUri: blobToDataUri + }; - if (imageDimensions) { - generalFormItems.push({ - type: 'container', - label: 'Dimensions', - layout: 'flex', - direction: 'row', - align: 'center', - spacing: 5, - items: [ - { name: 'width', type: 'textbox', maxLength: 5, size: 3, onchange: recalcSize, ariaLabel: 'Width' }, - { type: 'label', text: 'x' }, - { name: 'height', type: 'textbox', maxLength: 5, size: 3, onchange: recalcSize, ariaLabel: 'Height' }, - { name: 'constrain', type: 'checkbox', checked: true, text: 'Constrain proportions' } - ] - }); + var updateVSpaceHSpaceBorder = function (editor) { + return function (evt) { + var dom = editor.dom; + var rootControl = evt.control.rootControl; + if (!$_14xnkcbzje5nvbum.hasAdvTab(editor)) { + return; + } + var data = rootControl.toJSON(); + var css = dom.parseStyle(data.style); + rootControl.find('#vspace').value(''); + rootControl.find('#hspace').value(''); + css = $_1g1v9c0je5nvbuo.mergeMargins(css); + if (css['margin-top'] && css['margin-bottom'] || css['margin-right'] && css['margin-left']) { + if (css['margin-top'] === css['margin-bottom']) { + rootControl.find('#vspace').value($_1g1v9c0je5nvbuo.removePixelSuffix(css['margin-top'])); + } else { + rootControl.find('#vspace').value(''); } - - generalFormItems.push(classListCtrl); - - if (Settings.hasImageCaption(editor)) { - generalFormItems.push({ name: 'caption', type: 'checkbox', label: 'Caption' }); + if (css['margin-right'] === css['margin-left']) { + rootControl.find('#hspace').value($_1g1v9c0je5nvbuo.removePixelSuffix(css['margin-right'])); + } else { + rootControl.find('#hspace').value(''); } - - if (Settings.hasAdvTab(editor) || editor.settings.images_upload_url) { - var body = [ - { - title: 'General', - type: 'form', - items: generalFormItems - } - ]; - - if (Settings.hasAdvTab(editor)) { - // Parse styles from img - if (imgElm) { - if (imgElm.style.marginLeft && imgElm.style.marginRight && imgElm.style.marginLeft === imgElm.style.marginRight) { - data.hspace = Utils.removePixelSuffix(imgElm.style.marginLeft); - } - if (imgElm.style.marginTop && imgElm.style.marginBottom && imgElm.style.marginTop === imgElm.style.marginBottom) { - data.vspace = Utils.removePixelSuffix(imgElm.style.marginTop); - } - if (imgElm.style.borderWidth) { - data.border = Utils.removePixelSuffix(imgElm.style.borderWidth); - } - - data.style = editor.dom.serializeStyle(editor.dom.parseStyle(editor.dom.getAttrib(imgElm, 'style'))); + } + if (css['border-width']) { + rootControl.find('#border').value($_1g1v9c0je5nvbuo.removePixelSuffix(css['border-width'])); + } + rootControl.find('#style').value(dom.serializeStyle(dom.parseStyle(dom.serializeStyle(css)))); + }; + }; + var makeTab = function (editor, updateStyle) { + return { + title: 'Advanced', + type: 'form', + pack: 'start', + items: [ + { + label: 'Style', + name: 'style', + type: 'textbox', + onchange: updateVSpaceHSpaceBorder(editor) + }, + { + type: 'form', + layout: 'grid', + packV: 'start', + columns: 2, + padding: 0, + defaults: { + type: 'textbox', + maxWidth: 50, + onchange: function (evt) { + updateStyle(editor, evt.control.rootControl); } - - body.push({ - title: 'Advanced', - type: 'form', - pack: 'start', - items: [ + }, + items: [ + { + label: 'Vertical space', + name: 'vspace' + }, + { + label: 'Border width', + name: 'border' + }, + { + label: 'Horizontal space', + name: 'hspace' + }, + { + label: 'Border style', + type: 'listbox', + name: 'borderStyle', + width: 90, + maxWidth: 90, + onselect: function (evt) { + updateStyle(editor, evt.control.rootControl); + }, + values: [ { - label: 'Style', - name: 'style', - type: 'textbox', - onchange: updateVSpaceHSpaceBorder + text: 'Select...', + value: '' }, { - type: 'form', - layout: 'grid', - packV: 'start', - columns: 2, - padding: 0, - alignH: ['left', 'right'], - defaults: { - type: 'textbox', - maxWidth: 50, - onchange: updateStyle - }, - items: [ - { label: 'Vertical space', name: 'vspace' }, - { label: 'Horizontal space', name: 'hspace' }, - { label: 'Border', name: 'border' } - ] - } - ] - }); - } - - if (editor.settings.images_upload_url) { - var acceptExts = '.jpg,.jpeg,.png,.gif'; - - var uploadTab = { - title: 'Upload', - type: 'form', - layout: 'flex', - direction: 'column', - align: 'stretch', - padding: '20 20 20 20', - items: [ + text: 'Solid', + value: 'solid' + }, + { + text: 'Dotted', + value: 'dotted' + }, + { + text: 'Dashed', + value: 'dashed' + }, { - type: 'container', - layout: 'flex', - direction: 'column', - align: 'center', - spacing: 10, - items: [ - { - text: "Browse for an image", - type: 'browsebutton', - accept: acceptExts, - onchange: onFileInput - }, - { - text: 'OR', - type: 'label' - } - ] + text: 'Double', + value: 'double' }, { - text: "Drop an image here", - type: 'dropzone', - accept: acceptExts, - height: 100, - onchange: onFileInput + text: 'Groove', + value: 'groove' + }, + { + text: 'Ridge', + value: 'ridge' + }, + { + text: 'Inset', + value: 'inset' + }, + { + text: 'Outset', + value: 'outset' + }, + { + text: 'None', + value: 'none' + }, + { + text: 'Hidden', + value: 'hidden' } ] - }; - - body.push(uploadTab); - } - - // Advanced dialog shows general+advanced tabs - win = editor.windowManager.open({ - title: 'Insert/edit image', - data: data, - bodyType: 'tabpanel', - body: body, - onSubmit: onSubmitForm - }); - } else { - // Simple default dialog - win = editor.windowManager.open({ - title: 'Insert/edit image', - data: data, - body: generalFormItems, - onSubmit: onSubmitForm - }); + } + ] } - } - - function open() { - createImageList(showDialog); - } - - return { - open: open - }; + ] }; - } -); - -/** - * Commands.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ + }; + var $_ffdvd8c7je5nvbv2 = { makeTab: makeTab }; -define( - 'tinymce.plugins.image.api.Commands', - [ - 'tinymce.plugins.image.ui.Dialog' - ], - function (Dialog) { - var register = function (editor) { - editor.addCommand('mceImage', Dialog(editor).open); + var doSyncSize = function (widthCtrl, heightCtrl) { + widthCtrl.state.set('oldVal', widthCtrl.value()); + heightCtrl.state.set('oldVal', heightCtrl.value()); + }; + var doSizeControls = function (win, f) { + var widthCtrl = win.find('#width')[0]; + var heightCtrl = win.find('#height')[0]; + var constrained = win.find('#constrain')[0]; + if (widthCtrl && heightCtrl && constrained) { + f(widthCtrl, heightCtrl, constrained.checked()); + } + }; + var doUpdateSize = function (widthCtrl, heightCtrl, isContrained) { + var oldWidth = widthCtrl.state.get('oldVal'); + var oldHeight = heightCtrl.state.get('oldVal'); + var newWidth = widthCtrl.value(); + var newHeight = heightCtrl.value(); + if (isContrained && oldWidth && oldHeight && newWidth && newHeight) { + if (newWidth !== oldWidth) { + newHeight = Math.round(newWidth / oldWidth * newHeight); + if (!isNaN(newHeight)) { + heightCtrl.value(newHeight); + } + } else { + newWidth = Math.round(newHeight / oldHeight * newWidth); + if (!isNaN(newWidth)) { + widthCtrl.value(newWidth); + } + } + } + doSyncSize(widthCtrl, heightCtrl); + }; + var syncSize = function (win) { + doSizeControls(win, doSyncSize); + }; + var updateSize = function (win) { + doSizeControls(win, doUpdateSize); + }; + var createUi = function () { + var recalcSize = function (evt) { + updateSize(evt.control.rootControl); }; - return { - register: register + type: 'container', + label: 'Dimensions', + layout: 'flex', + align: 'center', + spacing: 5, + items: [ + { + name: 'width', + type: 'textbox', + maxLength: 5, + size: 5, + onchange: recalcSize, + ariaLabel: 'Width' + }, + { + type: 'label', + text: 'x' + }, + { + name: 'height', + type: 'textbox', + maxLength: 5, + size: 5, + onchange: recalcSize, + ariaLabel: 'Height' + }, + { + name: 'constrain', + type: 'checkbox', + checked: true, + text: 'Constrain proportions' + } + ] }; - } -); -/** - * FilterContent.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ + }; + var $_fyr2idc9je5nvbva = { + createUi: createUi, + syncSize: syncSize, + updateSize: updateSize + }; -define( - 'tinymce.plugins.image.core.FilterContent', - [ - 'tinymce.core.util.Tools' - ], - function (Tools) { - var hasImageClass = function (node) { - var className = node.attr('class'); - return className && /\bimage\b/.test(className); + var onSrcChange = function (evt, editor) { + var srcURL, prependURL, absoluteURLPattern; + var meta = evt.meta || {}; + var control = evt.control; + var rootControl = control.rootControl; + var imageListCtrl = rootControl.find('#image-list')[0]; + if (imageListCtrl) { + imageListCtrl.value(editor.convertURL(control.value(), 'src')); + } + Tools.each(meta, function (value, key) { + rootControl.find('#' + key).value(value); + }); + if (!meta.width && !meta.height) { + srcURL = editor.convertURL(control.value(), 'src'); + prependURL = $_14xnkcbzje5nvbum.getPrependUrl(editor); + absoluteURLPattern = new RegExp('^(?:[a-z]+:)?//', 'i'); + if (prependURL && !absoluteURLPattern.test(srcURL) && srcURL.substring(0, prependURL.length) !== prependURL) { + srcURL = prependURL + srcURL; + } + control.value(srcURL); + $_1g1v9c0je5nvbuo.getImageSize(editor.documentBaseURI.toAbsolute(control.value()), function (data) { + if (data.width && data.height && $_14xnkcbzje5nvbum.hasDimensions(editor)) { + rootControl.find('#width').value(data.width); + rootControl.find('#height').value(data.height); + $_fyr2idc9je5nvbva.updateSize(rootControl); + } + }); + } + }; + var onBeforeCall = function (evt) { + evt.meta = evt.control.rootControl.toJSON(); + }; + var getGeneralItems = function (editor, imageListCtrl) { + var generalFormItems = [ + { + name: 'src', + type: 'filepicker', + filetype: 'image', + label: 'Source', + autofocus: true, + onchange: function (evt) { + onSrcChange(evt, editor); + }, + onbeforecall: onBeforeCall + }, + imageListCtrl + ]; + if ($_14xnkcbzje5nvbum.hasDescription(editor)) { + generalFormItems.push({ + name: 'alt', + type: 'textbox', + label: 'Image description' + }); + } + if ($_14xnkcbzje5nvbum.hasImageTitle(editor)) { + generalFormItems.push({ + name: 'title', + type: 'textbox', + label: 'Image Title' + }); + } + if ($_14xnkcbzje5nvbum.hasDimensions(editor)) { + generalFormItems.push($_fyr2idc9je5nvbva.createUi()); + } + if ($_14xnkcbzje5nvbum.getClassList(editor)) { + generalFormItems.push({ + name: 'class', + type: 'listbox', + label: 'Class', + values: $_1g1v9c0je5nvbuo.buildListItems($_14xnkcbzje5nvbum.getClassList(editor), function (item) { + if (item.value) { + item.textStyle = function () { + return editor.formatter.getCssText({ + inline: 'img', + classes: [item.value] + }); + }; + } + }) + }); + } + if ($_14xnkcbzje5nvbum.hasImageCaption(editor)) { + generalFormItems.push({ + name: 'caption', + type: 'checkbox', + label: 'Caption' + }); + } + return generalFormItems; + }; + var makeTab$1 = function (editor, imageListCtrl) { + return { + title: 'General', + type: 'form', + items: getGeneralItems(editor, imageListCtrl) }; + }; + var $_ez9wv0c8je5nvbv6 = { + makeTab: makeTab$1, + getGeneralItems: getGeneralItems + }; - var toggleContentEditableState = function (state) { - return function (nodes) { - var i = nodes.length, node; + var url = function () { + return $_f55bjmc2je5nvbuw.getOrDie('URL'); + }; + var createObjectURL = function (blob) { + return url().createObjectURL(blob); + }; + var revokeObjectURL = function (u) { + url().revokeObjectURL(u); + }; + var $_4fid6xcbje5nvbvf = { + createObjectURL: createObjectURL, + revokeObjectURL: revokeObjectURL + }; - var toggleContentEditable = function (node) { - node.attr('contenteditable', state ? 'true' : null); - }; + var Factory = tinymce.util.Tools.resolve('tinymce.ui.Factory'); - while (i--) { - node = nodes[i]; + function XMLHttpRequest () { + var f = $_f55bjmc2je5nvbuw.getOrDie('XMLHttpRequest'); + return new f(); + } - if (hasImageClass(node)) { - node.attr('contenteditable', state ? 'false' : null); - Tools.each(node.getAll('figcaption'), toggleContentEditable); - Tools.each(node.getAll('img'), toggleContentEditable); - } + var noop = function () { + }; + var pathJoin = function (path1, path2) { + if (path1) { + return path1.replace(/\/$/, '') + '/' + path2.replace(/^\//, ''); + } + return path2; + }; + function Uploader (settings) { + var defaultHandler = function (blobInfo, success, failure, progress) { + var xhr, formData; + xhr = new XMLHttpRequest(); + xhr.open('POST', settings.url); + xhr.withCredentials = settings.credentials; + xhr.upload.onprogress = function (e) { + progress(e.loaded / e.total * 100); + }; + xhr.onerror = function () { + failure('Image upload failed due to a XHR Transport error. Code: ' + xhr.status); + }; + xhr.onload = function () { + var json; + if (xhr.status < 200 || xhr.status >= 300) { + failure('HTTP Error: ' + xhr.status); + return; + } + json = JSON.parse(xhr.responseText); + if (!json || typeof json.location !== 'string') { + failure('Invalid JSON: ' + xhr.responseText); + return; } + success(pathJoin(settings.basePath, json.location)); }; - }; - - var setup = function (editor) { - editor.on('preInit', function () { - editor.parser.addNodeFilter('figure', toggleContentEditableState(true)); - editor.serializer.addNodeFilter('figure', toggleContentEditableState(false)); + formData = new FormData(); + formData.append('file', blobInfo.blob(), blobInfo.filename()); + xhr.send(formData); + }; + var uploadBlob = function (blobInfo, handler) { + return new Promise(function (resolve, reject) { + try { + handler(blobInfo, resolve, reject, noop); + } catch (ex) { + reject(ex.message); + } }); }; - - return { - setup: setup + var isDefaultHandler = function (handler) { + return handler === defaultHandler; + }; + var upload = function (blobInfo) { + return !settings.url && isDefaultHandler(settings.handler) ? Promise.reject('Upload url missing from the settings.') : uploadBlob(blobInfo, settings.handler); }; + settings = Tools.extend({ + credentials: false, + handler: defaultHandler + }, settings); + return { upload: upload }; } -); -/** - * Buttons.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ -define( - 'tinymce.plugins.image.ui.Buttons', - [ - 'tinymce.plugins.image.ui.Dialog' - ], - function (Dialog) { - var register = function (editor) { - editor.addButton('image', { - icon: 'image', - tooltip: 'Insert/edit image', - onclick: Dialog(editor).open, - stateSelector: 'img:not([data-mce-object],[data-mce-placeholder]),figure.image' + var onFileInput = function (editor) { + return function (evt) { + var Throbber = Factory.get('Throbber'); + var rootControl = evt.control.rootControl; + var throbber = new Throbber(rootControl.getEl()); + var file = evt.control.value(); + var blobUri = $_4fid6xcbje5nvbvf.createObjectURL(file); + var uploader = Uploader({ + url: $_14xnkcbzje5nvbum.getUploadUrl(editor), + basePath: $_14xnkcbzje5nvbum.getUploadBasePath(editor), + credentials: $_14xnkcbzje5nvbum.getUploadCredentials(editor), + handler: $_14xnkcbzje5nvbum.getUploadHandler(editor) }); - - editor.addMenuItem('image', { - icon: 'image', - text: 'Image', - onclick: Dialog(editor).open, - context: 'insert', - prependToContext: true + var finalize = function () { + throbber.hide(); + $_4fid6xcbje5nvbvf.revokeObjectURL(blobUri); + }; + throbber.show(); + return $_1g1v9c0je5nvbuo.blobToDataUri(file).then(function (dataUrl) { + var blobInfo = editor.editorUpload.blobCache.create({ + blob: file, + blobUri: blobUri, + name: file.name ? file.name.replace(/\.[^\.]+$/, '') : null, + base64: dataUrl.split(',')[1] + }); + return uploader.upload(blobInfo).then(function (url) { + var src = rootControl.find('#src'); + src.value(url); + rootControl.find('tabpanel')[0].activateTab(0); + src.fire('change'); + finalize(); + return url; + }); + }).catch(function (err) { + editor.windowManager.alert(err); + finalize(); }); }; - + }; + var acceptExts = '.jpg,.jpeg,.png,.gif'; + var makeTab$2 = function (editor) { return { - register: register + title: 'Upload', + type: 'form', + layout: 'flex', + direction: 'column', + align: 'stretch', + padding: '20 20 20 20', + items: [ + { + type: 'container', + layout: 'flex', + direction: 'column', + align: 'center', + spacing: 10, + items: [ + { + text: 'Browse for an image', + type: 'browsebutton', + accept: acceptExts, + onchange: onFileInput(editor) + }, + { + text: 'OR', + type: 'label' + } + ] + }, + { + text: 'Drop an image here', + type: 'dropzone', + accept: acceptExts, + height: 100, + onchange: onFileInput(editor) + } + ] }; + }; + var $_3z2h61caje5nvbvc = { makeTab: makeTab$2 }; + + function Dialog (editor) { + var updateStyle = function (editor, rootControl) { + if (!$_14xnkcbzje5nvbum.hasAdvTab(editor)) { + return; + } + var dom = editor.dom; + var data = rootControl.toJSON(); + var css = dom.parseStyle(data.style); + css = $_1g1v9c0je5nvbuo.mergeMargins(css); + if (data.vspace) { + css['margin-top'] = css['margin-bottom'] = $_1g1v9c0je5nvbuo.addPixelSuffix(data.vspace); + } + if (data.hspace) { + css['margin-left'] = css['margin-right'] = $_1g1v9c0je5nvbuo.addPixelSuffix(data.hspace); + } + if (data.border) { + css['border-width'] = $_1g1v9c0je5nvbuo.addPixelSuffix(data.border); + } + if (data.borderStyle) { + css['border-style'] = data.borderStyle; + } + rootControl.find('#style').value(dom.serializeStyle(dom.parseStyle(dom.serializeStyle(css)))); + }; + function showDialog(imageList) { + var win, data = {}, imgElm, figureElm; + var dom = editor.dom; + var imageListCtrl; + function onSubmitForm() { + var figureElm, oldImg; + $_fyr2idc9je5nvbva.updateSize(win); + updateStyle(editor, win); + data = Tools.extend(data, win.toJSON()); + if (!data.alt) { + data.alt = ''; + } + if (!data.title) { + data.title = ''; + } + if (data.width === '') { + data.width = null; + } + if (data.height === '') { + data.height = null; + } + if (!data.style) { + data.style = null; + } + data = { + src: data.src, + alt: data.alt, + title: data.title, + width: data.width, + height: data.height, + style: data.style, + caption: data.caption, + class: data.class + }; + editor.undoManager.transact(function () { + if (!data.src) { + if (imgElm) { + var elm = dom.is(imgElm.parentNode, 'figure.image') ? imgElm.parentNode : imgElm; + dom.remove(elm); + editor.focus(); + editor.nodeChanged(); + if (dom.isEmpty(editor.getBody())) { + editor.setContent(''); + editor.selection.setCursorLocation(); + } + } + return; + } + if (data.title === '') { + data.title = null; + } + if (!imgElm) { + data.id = '__mcenew'; + editor.focus(); + editor.selection.setContent(dom.createHTML('img', data)); + imgElm = dom.get('__mcenew'); + dom.setAttrib(imgElm, 'id', null); + } else { + dom.setAttribs(imgElm, data); + } + editor.editorUpload.uploadImagesAuto(); + if (data.caption === false) { + if (dom.is(imgElm.parentNode, 'figure.image')) { + figureElm = imgElm.parentNode; + dom.insertAfter(imgElm, figureElm); + dom.remove(figureElm); + } + } + if (data.caption === true) { + if (!dom.is(imgElm.parentNode, 'figure.image')) { + oldImg = imgElm; + imgElm = imgElm.cloneNode(true); + figureElm = dom.create('figure', { class: 'image' }); + figureElm.appendChild(imgElm); + figureElm.appendChild(dom.create('figcaption', { contentEditable: true }, 'Caption')); + figureElm.contentEditable = false; + var textBlock = dom.getParent(oldImg, function (node) { + return editor.schema.getTextBlockElements()[node.nodeName]; + }); + if (textBlock) { + dom.split(textBlock, oldImg, figureElm); + } else { + dom.replace(figureElm, oldImg); + } + editor.selection.select(figureElm); + } + return; + } + $_1g1v9c0je5nvbuo.waitLoadImage(editor, data, imgElm); + }); + } + imgElm = editor.selection.getNode(); + figureElm = dom.getParent(imgElm, 'figure.image'); + if (figureElm) { + imgElm = dom.select('img', figureElm)[0]; + } + if (imgElm && (imgElm.nodeName !== 'IMG' || imgElm.getAttribute('data-mce-object') || imgElm.getAttribute('data-mce-placeholder'))) { + imgElm = null; + } + if (imgElm) { + data = { + src: dom.getAttrib(imgElm, 'src'), + alt: dom.getAttrib(imgElm, 'alt'), + title: dom.getAttrib(imgElm, 'title'), + class: dom.getAttrib(imgElm, 'class'), + width: dom.getAttrib(imgElm, 'width'), + height: dom.getAttrib(imgElm, 'height'), + caption: !!figureElm + }; + } + if (imageList) { + imageListCtrl = { + type: 'listbox', + label: 'Image list', + name: 'image-list', + values: $_1g1v9c0je5nvbuo.buildListItems(imageList, function (item) { + item.value = editor.convertURL(item.value || item.url, 'src'); + }, [{ + text: 'None', + value: '' + }]), + value: data.src && editor.convertURL(data.src, 'src'), + onselect: function (e) { + var altCtrl = win.find('#alt'); + if (!altCtrl.value() || e.lastControl && altCtrl.value() === e.lastControl.text()) { + altCtrl.value(e.control.text()); + } + win.find('#src').value(e.control.value()).fire('change'); + }, + onPostRender: function () { + imageListCtrl = this; + } + }; + } + if ($_14xnkcbzje5nvbum.hasAdvTab(editor) || $_14xnkcbzje5nvbum.hasUploadUrl(editor) || $_14xnkcbzje5nvbum.hasUploadHandler(editor)) { + var body = [$_ez9wv0c8je5nvbv6.makeTab(editor, imageListCtrl)]; + if ($_14xnkcbzje5nvbum.hasAdvTab(editor)) { + if (imgElm) { + if (imgElm.style.marginLeft && imgElm.style.marginRight && imgElm.style.marginLeft === imgElm.style.marginRight) { + data.hspace = $_1g1v9c0je5nvbuo.removePixelSuffix(imgElm.style.marginLeft); + } + if (imgElm.style.marginTop && imgElm.style.marginBottom && imgElm.style.marginTop === imgElm.style.marginBottom) { + data.vspace = $_1g1v9c0je5nvbuo.removePixelSuffix(imgElm.style.marginTop); + } + if (imgElm.style.borderWidth) { + data.border = $_1g1v9c0je5nvbuo.removePixelSuffix(imgElm.style.borderWidth); + } + data.borderStyle = imgElm.style.borderStyle; + data.style = editor.dom.serializeStyle(editor.dom.parseStyle(editor.dom.getAttrib(imgElm, 'style'))); + } + body.push($_ffdvd8c7je5nvbv2.makeTab(editor, updateStyle)); + } + if ($_14xnkcbzje5nvbum.hasUploadUrl(editor) || $_14xnkcbzje5nvbum.hasUploadHandler(editor)) { + body.push($_3z2h61caje5nvbvc.makeTab(editor)); + } + win = editor.windowManager.open({ + title: 'Insert/edit image', + data: data, + bodyType: 'tabpanel', + body: body, + onSubmit: onSubmitForm + }); + } else { + win = editor.windowManager.open({ + title: 'Insert/edit image', + data: data, + body: $_ez9wv0c8je5nvbv6.getGeneralItems(editor, imageListCtrl), + onSubmit: onSubmitForm + }); + } + $_fyr2idc9je5nvbva.syncSize(win); + } + function open() { + $_1g1v9c0je5nvbuo.createImageList(editor, showDialog); + } + return { open: open }; } -); -/** - * Plugin.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ -define( - 'tinymce.plugins.image.Plugin', - [ - 'tinymce.core.PluginManager', - 'tinymce.plugins.image.api.Commands', - 'tinymce.plugins.image.core.FilterContent', - 'tinymce.plugins.image.ui.Buttons' - ], - function (PluginManager, Commands, FilterContent, Buttons) { - PluginManager.add('image', function (editor) { - FilterContent.setup(editor); - Buttons.register(editor); - Commands.register(editor); - }); + var register = function (editor) { + editor.addCommand('mceImage', Dialog(editor).open); + }; + var $_487p0wbwje5nvbuf = { register: register }; - return function () { }; + var hasImageClass = function (node) { + var className = node.attr('class'); + return className && /\bimage\b/.test(className); + }; + var toggleContentEditableState = function (state) { + return function (nodes) { + var i = nodes.length, node; + var toggleContentEditable = function (node) { + node.attr('contenteditable', state ? 'true' : null); + }; + while (i--) { + node = nodes[i]; + if (hasImageClass(node)) { + node.attr('contenteditable', state ? 'false' : null); + Tools.each(node.getAll('figcaption'), toggleContentEditable); + } + } + }; + }; + var setup = function (editor) { + editor.on('preInit', function () { + editor.parser.addNodeFilter('figure', toggleContentEditableState(true)); + editor.serializer.addNodeFilter('figure', toggleContentEditableState(false)); + }); + }; + var $_2pa46ycfje5nvbvo = { setup: setup }; + + var register$1 = function (editor) { + editor.addButton('image', { + icon: 'image', + tooltip: 'Insert/edit image', + onclick: Dialog(editor).open, + stateSelector: 'img:not([data-mce-object],[data-mce-placeholder]),figure.image' + }); + editor.addMenuItem('image', { + icon: 'image', + text: 'Image', + onclick: Dialog(editor).open, + context: 'insert', + prependToContext: true + }); + }; + var $_f38athcgje5nvbvp = { register: register$1 }; + + PluginManager.add('image', function (editor) { + $_2pa46ycfje5nvbvo.setup(editor); + $_f38athcgje5nvbvp.register(editor); + $_487p0wbwje5nvbuf.register(editor); + }); + function Plugin () { } -); -dem('tinymce.plugins.image.Plugin')(); + + return Plugin; + +}()); })(); diff --git a/tinymce_4/static/tinymce_4/tinymce/plugins/image/plugin.min.js b/tinymce_4/static/tinymce_4/tinymce/plugins/image/plugin.min.js index bd96a7c..cc6cdae 100644 --- a/tinymce_4/static/tinymce_4/tinymce/plugins/image/plugin.min.js +++ b/tinymce_4/static/tinymce_4/tinymce/plugins/image/plugin.min.js @@ -1 +1 @@ -!function(){var a={},b=function(b){for(var c=a[b],e=c.deps,f=c.defn,g=e.length,h=new Array(g),i=0;i=300?void f("HTTP Error: "+i.status):(a=JSON.parse(i.responseText),a&&"string"==typeof a.location?void e(g(b.basePath,a.location)):void f("Invalid JSON: "+i.responseText))},j=new c.FormData,j.append("file",d.blob(),d.filename()),i.send(j)},i=function(a,b){return new d(function(c,d){try{b(a,c,d,f)}catch(a){d(a.message)}})},j=function(a){return a===h},k=function(a){return!b.url&&j(b.handler)?d.reject("Upload url missng from the settings."):i(a,b.handler)};return b=e.extend({credentials:!1,handler:h},b),{upload:k}}}),g("i",["7","a","9"],function(a,b,c){var d=function(a,d){function e(a,b){f.parentNode&&f.parentNode.removeChild(f),d({width:a,height:b})}var f=c.createElement("img");f.onload=function(){e(b.max(f.width,f.clientWidth),b.max(f.height,f.clientHeight))},f.onerror=function(){e()};var g=f.style;g.visibility="hidden",g.position="fixed",g.bottom=g.left=0,g.width=g.height="auto",c.body.appendChild(f),f.src=a},e=function(b,c,d){function e(b,d){return d=d||[],a.each(b,function(a){var b={text:a.text||a.title};a.menu?b.menu=e(a.menu):(b.value=a.value,c(b)),d.push(b)}),d}return e(b,d||[])},f=function(a){return a&&(a=a.replace(/px$/,"")),a},g=function(a){return a.length>0&&/^[0-9]+$/.test(a)&&(a+="px"),a},h=function(a){if(a.margin){var b=a.margin.split(" ");switch(b.length){case 1:a["margin-top"]=a["margin-top"]||b[0],a["margin-right"]=a["margin-right"]||b[0],a["margin-bottom"]=a["margin-bottom"]||b[0],a["margin-left"]=a["margin-left"]||b[0];break;case 2:a["margin-top"]=a["margin-top"]||b[0],a["margin-right"]=a["margin-right"]||b[1],a["margin-bottom"]=a["margin-bottom"]||b[0],a["margin-left"]=a["margin-left"]||b[1];break;case 3:a["margin-top"]=a["margin-top"]||b[0],a["margin-right"]=a["margin-right"]||b[1],a["margin-bottom"]=a["margin-bottom"]||b[2],a["margin-left"]=a["margin-left"]||b[1];break;case 4:a["margin-top"]=a["margin-top"]||b[0],a["margin-right"]=a["margin-right"]||b[1],a["margin-bottom"]=a["margin-bottom"]||b[2],a["margin-left"]=a["margin-left"]||b[3]}delete a.margin}return a};return{getImageSize:d,buildListItems:e,removePixelSuffix:f,addPixelSuffix:g,mergeMargins:h}}),g("6",["8","9","a","b","c","d","e","7","f","g","h","i"],function(a,b,c,d,e,f,g,h,i,j,k,l){return function(b){function e(a){var c=j.getImageList(b);"string"==typeof c?i.send({url:c,success:function(b){a(g.parse(b))}}):"function"==typeof c?c(a):a(c)}function m(e){function g(){var c=f.get("Throbber"),d=new c(t.getEl()),e=this.value(),g=new k({url:C.images_upload_url,basePath:C.images_upload_base_path,credentials:C.images_upload_credentials,handler:C.images_upload_handler}),h=b.editorUpload.blobCache.create({blob:e,name:e.name?e.name.replace(/\.[^\.]+$/,""):null,base64:"data:image/fake;base64,="}),i=function(){d.hide(),a.revokeObjectURL(h.blobUri())};return d.show(),g.upload(h).then(function(a){var b=t.find("#src");return b.value(a),t.find("tabpanel")[0].activateTab(0),b.fire("change"),i(),a},function(a){b.windowManager.alert(a),i()})}function i(a){return b.schema.getTextBlockElements()[a.nodeName]}function m(){var a,b,d,e;a=t.find("#width")[0],b=t.find("#height")[0],a&&b&&(d=a.value(),e=b.value(),t.find("#constrain")[0].checked()&&w&&x&&d&&e&&(w!==d?(e=c.round(d/w*e),isNaN(e)||b.value(e)):(d=c.round(e/x*d),isNaN(d)||a.value(d))),w=d,x=e)}function n(){if(j.hasAdvTab(b)){var a=t.toJSON(),c=B.parseStyle(a.style);c=l.mergeMargins(c),a.vspace&&(c["margin-top"]=c["margin-bottom"]=l.addPixelSuffix(a.vspace)),a.hspace&&(c["margin-left"]=c["margin-right"]=l.addPixelSuffix(a.hspace)),a.border&&(c["border-width"]=l.addPixelSuffix(a.border)),t.find("#style").value(B.serializeStyle(B.parseStyle(B.serializeStyle(c))))}}function o(){if(j.hasAdvTab(b)){var a=t.toJSON(),c=B.parseStyle(a.style);t.find("#vspace").value(""),t.find("#hspace").value(""),c=l.mergeMargins(c),(c["margin-top"]&&c["margin-bottom"]||c["margin-right"]&&c["margin-left"])&&(c["margin-top"]===c["margin-bottom"]?t.find("#vspace").value(l.removePixelSuffix(c["margin-top"])):t.find("#vspace").value(""),c["margin-right"]===c["margin-left"]?t.find("#hspace").value(l.removePixelSuffix(c["margin-right"])):t.find("#hspace").value("")),c["border-width"]&&t.find("#border").value(l.removePixelSuffix(c["border-width"])),t.find("#style").value(B.serializeStyle(B.parseStyle(B.serializeStyle(c))))}}function p(a){function c(){a.onload=a.onerror=null,b.selection&&(b.selection.select(a),b.nodeChanged())}a.onload=function(){A.width||A.height||!D||B.setAttribs(a,{width:a.clientWidth,height:a.clientHeight}),c()},a.onerror=c}function q(){var a,c;n(),m(),A=h.extend(A,t.toJSON()),A.alt||(A.alt=""),A.title||(A.title=""),""===A.width&&(A.width=null),""===A.height&&(A.height=null),A.style||(A.style=null),A={src:A.src,alt:A.alt,title:A.title,width:A.width,height:A.height,style:A.style,caption:A.caption,"class":A["class"]},b.undoManager.transact(function(){if(A.src){if(""===A.title&&(A.title=null),u?B.setAttribs(u,A):(A.id="__mcenew",b.focus(),b.selection.setContent(B.createHTML("img",A)),u=B.get("__mcenew"),B.setAttrib(u,"id",null)),b.editorUpload.uploadImagesAuto(),A.caption===!1&&B.is(u.parentNode,"figure.image")&&(a=u.parentNode,B.setAttrib(u,"contenteditable",null),B.insertAfter(u,a),B.remove(a),b.selection.select(u),b.nodeChanged()),A.caption!==!0)p(u);else if(!B.is(u.parentNode,"figure.image")){c=u,u=u.cloneNode(!0),u.contentEditable=!0,a=B.create("figure",{"class":"image"}),a.appendChild(u),a.appendChild(B.create("figcaption",{contentEditable:!0},"Caption")),a.contentEditable=!1;var d=B.getParent(c,i);d?B.split(d,c,a):B.replace(a,c),b.selection.select(a)}}else if(u){var e=B.is(u.parentNode,"figure.image")?u.parentNode:u;B.remove(e),b.focus(),b.nodeChanged(),B.isEmpty(b.getBody())&&(b.setContent(""),b.selection.setCursorLocation())}})}function r(a){var c,e,f,g=a.meta||{};y&&y.value(b.convertURL(this.value(),"src")),h.each(g,function(a,b){t.find("#"+b).value(a)}),g.width||g.height||(c=b.convertURL(this.value(),"src"),e=j.getPrependUrl(b),f=new d("^(?:[a-z]+:)?//","i"),e&&!f.test(c)&&c.substring(0,e.length)!==e&&(c=e+c),this.value(c),l.getImageSize(b.documentBaseURI.toAbsolute(this.value()),function(a){a.width&&a.height&&D&&(w=a.width,x=a.height,t.find("#width").value(w),t.find("#height").value(x))}))}function s(a){a.meta=t.toJSON()}var t,u,v,w,x,y,z,A={},B=b.dom,C=b.settings,D=j.hasDimensions(b);u=b.selection.getNode(),v=B.getParent(u,"figure.image"),v&&(u=B.select("img",v)[0]),u&&("IMG"!==u.nodeName||u.getAttribute("data-mce-object")||u.getAttribute("data-mce-placeholder"))&&(u=null),u&&(w=B.getAttrib(u,"width"),x=B.getAttrib(u,"height"),A={src:B.getAttrib(u,"src"),alt:B.getAttrib(u,"alt"),title:B.getAttrib(u,"title"),"class":B.getAttrib(u,"class"),width:w,height:x,caption:!!v}),e&&(y={type:"listbox",label:"Image list",values:l.buildListItems(e,function(a){a.value=b.convertURL(a.value||a.url,"src")},[{text:"None",value:""}]),value:A.src&&b.convertURL(A.src,"src"),onselect:function(a){var b=t.find("#alt");(!b.value()||a.lastControl&&b.value()===a.lastControl.text())&&b.value(a.control.text()),t.find("#src").value(a.control.value()).fire("change")},onPostRender:function(){y=this}}),j.getClassList(b)&&(z={name:"class",type:"listbox",label:"Class",values:l.buildListItems(j.getClassList(b),function(a){a.value&&(a.textStyle=function(){return b.formatter.getCssText({inline:"img",classes:[a.value]})})})});var E=[{name:"src",type:"filepicker",filetype:"image",label:"Source",autofocus:!0,onchange:r,onbeforecall:s},y];if(j.hasDescription(b)&&E.push({name:"alt",type:"textbox",label:"Image description"}),j.hasImageTitle(b)&&E.push({name:"title",type:"textbox",label:"Image Title"}),D&&E.push({type:"container",label:"Dimensions",layout:"flex",direction:"row",align:"center",spacing:5,items:[{name:"width",type:"textbox",maxLength:5,size:3,onchange:m,ariaLabel:"Width"},{type:"label",text:"x"},{name:"height",type:"textbox",maxLength:5,size:3,onchange:m,ariaLabel:"Height"},{name:"constrain",type:"checkbox",checked:!0,text:"Constrain proportions"}]}),E.push(z),j.hasImageCaption(b)&&E.push({name:"caption",type:"checkbox",label:"Caption"}),j.hasAdvTab(b)||b.settings.images_upload_url){var F=[{title:"General",type:"form",items:E}];if(j.hasAdvTab(b)&&(u&&(u.style.marginLeft&&u.style.marginRight&&u.style.marginLeft===u.style.marginRight&&(A.hspace=l.removePixelSuffix(u.style.marginLeft)),u.style.marginTop&&u.style.marginBottom&&u.style.marginTop===u.style.marginBottom&&(A.vspace=l.removePixelSuffix(u.style.marginTop)),u.style.borderWidth&&(A.border=l.removePixelSuffix(u.style.borderWidth)),A.style=b.dom.serializeStyle(b.dom.parseStyle(b.dom.getAttrib(u,"style")))),F.push({title:"Advanced",type:"form",pack:"start",items:[{label:"Style",name:"style",type:"textbox",onchange:o},{type:"form",layout:"grid",packV:"start",columns:2,padding:0,alignH:["left","right"],defaults:{type:"textbox",maxWidth:50,onchange:n},items:[{label:"Vertical space",name:"vspace"},{label:"Horizontal space",name:"hspace"},{label:"Border",name:"border"}]}]})),b.settings.images_upload_url){var G=".jpg,.jpeg,.png,.gif",H={title:"Upload",type:"form",layout:"flex",direction:"column",align:"stretch",padding:"20 20 20 20",items:[{type:"container",layout:"flex",direction:"column",align:"center",spacing:10,items:[{text:"Browse for an image",type:"browsebutton",accept:G,onchange:g},{text:"OR",type:"label"}]},{text:"Drop an image here",type:"dropzone",accept:G,height:100,onchange:g}]};F.push(H)}t=b.windowManager.open({title:"Insert/edit image",data:A,bodyType:"tabpanel",body:F,onSubmit:q})}else t=b.windowManager.open({title:"Insert/edit image",data:A,body:E,onSubmit:q})}function n(){e(m)}return{open:n}}}),g("2",["6"],function(a){var b=function(b){b.addCommand("mceImage",a(b).open)};return{register:b}}),g("3",["7"],function(a){var b=function(a){var b=a.attr("class");return b&&/\bimage\b/.test(b)},c=function(c){return function(d){for(var e,f=d.length,g=function(a){a.attr("contenteditable",c?"true":null)};f--;)e=d[f],b(e)&&(e.attr("contenteditable",c?"false":null),a.each(e.getAll("figcaption"),g),a.each(e.getAll("img"),g))}},d=function(a){a.on("preInit",function(){a.parser.addNodeFilter("figure",c(!0)),a.serializer.addNodeFilter("figure",c(!1))})};return{setup:d}}),g("4",["6"],function(a){var b=function(b){b.addButton("image",{icon:"image",tooltip:"Insert/edit image",onclick:a(b).open,stateSelector:"img:not([data-mce-object],[data-mce-placeholder]),figure.image"}),b.addMenuItem("image",{icon:"image",text:"Image",onclick:a(b).open,context:"insert",prependToContext:!0})};return{register:b}}),g("0",["1","2","3","4"],function(a,b,c,d){return a.add("image",function(a){c.setup(a),d.register(a),b.register(a)}),function(){}}),d("0")()}(); \ No newline at end of file +!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),t=tinymce.util.Tools.resolve("tinymce.util.Tools"),n={hasDimensions:function(e){return!1!==e.settings.image_dimensions},hasAdvTab:function(e){return!0===e.settings.image_advtab},getPrependUrl:function(e){return e.getParam("image_prepend_url","")},getClassList:function(e){return e.getParam("image_class_list")},hasDescription:function(e){return!1!==e.settings.image_description},hasImageTitle:function(e){return!0===e.settings.image_title},hasImageCaption:function(e){return!0===e.settings.image_caption},getImageList:function(e){return e.getParam("image_list",!1)},hasUploadUrl:function(e){return e.getParam("images_upload_url",!1)},hasUploadHandler:function(e){return e.getParam("images_upload_handler",!1)},getUploadUrl:function(e){return e.getParam("images_upload_url")},getUploadHandler:function(e){return e.getParam("images_upload_handler")},getUploadBasePath:function(e){return e.getParam("images_upload_base_path")},getUploadCredentials:function(e){return e.getParam("images_upload_credentials")}},a="undefined"!=typeof window?window:Function("return this;")(),i=function(e,t){for(var n=t!==undefined&&null!==t?t:a,i=0;i0&&/^[0-9]+$/.test(e)&&(e+="px"),e},mergeMargins:function(e){if(e.margin){var t=e.margin.split(" ");switch(t.length){case 1:e["margin-top"]=e["margin-top"]||t[0],e["margin-right"]=e["margin-right"]||t[0],e["margin-bottom"]=e["margin-bottom"]||t[0],e["margin-left"]=e["margin-left"]||t[0];break;case 2:e["margin-top"]=e["margin-top"]||t[0],e["margin-right"]=e["margin-right"]||t[1],e["margin-bottom"]=e["margin-bottom"]||t[0],e["margin-left"]=e["margin-left"]||t[1];break;case 3:e["margin-top"]=e["margin-top"]||t[0],e["margin-right"]=e["margin-right"]||t[1],e["margin-bottom"]=e["margin-bottom"]||t[2],e["margin-left"]=e["margin-left"]||t[1];break;case 4:e["margin-top"]=e["margin-top"]||t[0],e["margin-right"]=e["margin-right"]||t[1],e["margin-bottom"]=e["margin-bottom"]||t[2],e["margin-left"]=e["margin-left"]||t[3]}delete e.margin}return e},createImageList:function(e,t){var a=n.getImageList(e);"string"==typeof a?u.send({url:a,success:function(e){t(JSON.parse(e))}}):"function"==typeof a?a(t):t(a)},waitLoadImage:function(e,t,a){function i(){a.onload=a.onerror=null,e.selection&&(e.selection.select(a),e.nodeChanged())}a.onload=function(){t.width||t.height||!n.hasDimensions(e)||e.dom.setAttribs(a,{width:a.clientWidth,height:a.clientHeight}),i()},a.onerror=i},blobToDataUri:function(e){return new s(function(t,n){var a=new l;a.onload=function(){t(a.result)},a.onerror=function(){n(l.error.message)},a.readAsDataURL(e)})}},g={makeTab:function(e,t){return{title:"Advanced",type:"form",pack:"start",items:[{label:"Style",name:"style",type:"textbox",onchange:(a=e,function(e){var t=a.dom,i=e.control.rootControl;if(n.hasAdvTab(a)){var r=i.toJSON(),o=t.parseStyle(r.style);i.find("#vspace").value(""),i.find("#hspace").value(""),((o=d.mergeMargins(o))["margin-top"]&&o["margin-bottom"]||o["margin-right"]&&o["margin-left"])&&(o["margin-top"]===o["margin-bottom"]?i.find("#vspace").value(d.removePixelSuffix(o["margin-top"])):i.find("#vspace").value(""),o["margin-right"]===o["margin-left"]?i.find("#hspace").value(d.removePixelSuffix(o["margin-right"])):i.find("#hspace").value("")),o["border-width"]&&i.find("#border").value(d.removePixelSuffix(o["border-width"])),i.find("#style").value(t.serializeStyle(t.parseStyle(t.serializeStyle(o))))}})},{type:"form",layout:"grid",packV:"start",columns:2,padding:0,defaults:{type:"textbox",maxWidth:50,onchange:function(n){t(e,n.control.rootControl)}},items:[{label:"Vertical space",name:"vspace"},{label:"Border width",name:"border"},{label:"Horizontal space",name:"hspace"},{label:"Border style",type:"listbox",name:"borderStyle",width:90,maxWidth:90,onselect:function(n){t(e,n.control.rootControl)},values:[{text:"Select...",value:""},{text:"Solid",value:"solid"},{text:"Dotted",value:"dotted"},{text:"Dashed",value:"dashed"},{text:"Double",value:"double"},{text:"Groove",value:"groove"},{text:"Ridge",value:"ridge"},{text:"Inset",value:"inset"},{text:"Outset",value:"outset"},{text:"None",value:"none"},{text:"Hidden",value:"hidden"}]}]}]};var a}},m=function(e,t){e.state.set("oldVal",e.value()),t.state.set("oldVal",t.value())},f=function(e,t){var n=e.find("#width")[0],a=e.find("#height")[0],i=e.find("#constrain")[0];n&&a&&i&&t(n,a,i.checked())},p=function(e,t,n){var a=e.state.get("oldVal"),i=t.state.get("oldVal"),r=e.value(),o=t.value();n&&a&&i&&r&&o&&(r!==a?(o=Math.round(r/a*o),isNaN(o)||t.value(o)):(r=Math.round(o/i*r),isNaN(r)||e.value(r))),m(e,t)},h=function(e){f(e,p)},b={createUi:function(){var e=function(e){h(e.control.rootControl)};return{type:"container",label:"Dimensions",layout:"flex",align:"center",spacing:5,items:[{name:"width",type:"textbox",maxLength:5,size:5,onchange:e,ariaLabel:"Width"},{type:"label",text:"x"},{name:"height",type:"textbox",maxLength:5,size:5,onchange:e,ariaLabel:"Height"},{name:"constrain",type:"checkbox",checked:!0,text:"Constrain proportions"}]}},syncSize:function(e){f(e,m)},updateSize:h},v=function(e){e.meta=e.control.rootControl.toJSON()},y=function(e,a){var i=[{name:"src",type:"filepicker",filetype:"image",label:"Source",autofocus:!0,onchange:function(a){var i,r,o,l,s,u,c,g,m;r=e,u=(i=a).meta||{},c=i.control,g=c.rootControl,(m=g.find("#image-list")[0])&&m.value(r.convertURL(c.value(),"src")),t.each(u,function(e,t){g.find("#"+t).value(e)}),u.width||u.height||(o=r.convertURL(c.value(),"src"),l=n.getPrependUrl(r),s=new RegExp("^(?:[a-z]+:)?//","i"),l&&!s.test(o)&&o.substring(0,l.length)!==l&&(o=l+o),c.value(o),d.getImageSize(r.documentBaseURI.toAbsolute(c.value()),function(e){e.width&&e.height&&n.hasDimensions(r)&&(g.find("#width").value(e.width),g.find("#height").value(e.height),b.updateSize(g))}))},onbeforecall:v},a];return n.hasDescription(e)&&i.push({name:"alt",type:"textbox",label:"Image description"}),n.hasImageTitle(e)&&i.push({name:"title",type:"textbox",label:"Image Title"}),n.hasDimensions(e)&&i.push(b.createUi()),n.getClassList(e)&&i.push({name:"class",type:"listbox",label:"Class",values:d.buildListItems(n.getClassList(e),function(t){t.value&&(t.textStyle=function(){return e.formatter.getCssText({inline:"img",classes:[t.value]})})})}),n.hasImageCaption(e)&&i.push({name:"caption",type:"checkbox",label:"Caption"}),i},x={makeTab:function(e,t){return{title:"General",type:"form",items:y(e,t)}},getGeneralItems:y},w=function(){return o.getOrDie("URL")},S=function(e){return w().createObjectURL(e)},U=function(e){w().revokeObjectURL(e)},T=tinymce.util.Tools.resolve("tinymce.ui.Factory"),C=function(){},I=function(e,t){return e?e.replace(/\/$/,"")+"/"+t.replace(/^\//,""):t};function P(e){var n=function(t,n,a,i){var r,l;(r=new function(){return new(o.getOrDie("XMLHttpRequest"))}).open("POST",e.url),r.withCredentials=e.credentials,r.upload.onprogress=function(e){i(e.loaded/e.total*100)},r.onerror=function(){a("Image upload failed due to a XHR Transport error. Code: "+r.status)},r.onload=function(){var t;r.status<200||r.status>=300?a("HTTP Error: "+r.status):(t=JSON.parse(r.responseText))&&"string"==typeof t.location?n(I(e.basePath,t.location)):a("Invalid JSON: "+r.responseText)},(l=new FormData).append("file",t.blob(),t.filename()),r.send(l)};return e=t.extend({credentials:!1,handler:n},e),{upload:function(t){return e.url||e.handler!==n?(a=t,i=e.handler,new s(function(e,t){try{i(a,e,t,C)}catch(n){t(n.message)}})):s.reject("Upload url missing from the settings.");var a,i}}}var L=function(e){return function(t){var a=T.get("Throbber"),i=t.control.rootControl,r=new a(i.getEl()),o=t.control.value(),l=S(o),s=P({url:n.getUploadUrl(e),basePath:n.getUploadBasePath(e),credentials:n.getUploadCredentials(e),handler:n.getUploadHandler(e)}),u=function(){r.hide(),U(l)};return r.show(),d.blobToDataUri(o).then(function(t){var n=e.editorUpload.blobCache.create({blob:o,blobUri:l,name:o.name?o.name.replace(/\.[^\.]+$/,""):null,base64:t.split(",")[1]});return s.upload(n).then(function(e){var t=i.find("#src");return t.value(e),i.find("tabpanel")[0].activateTab(0),t.fire("change"),u(),e})})["catch"](function(t){e.windowManager.alert(t),u()})}},_=".jpg,.jpeg,.png,.gif",N={makeTab:function(e){return{title:"Upload",type:"form",layout:"flex",direction:"column",align:"stretch",padding:"20 20 20 20",items:[{type:"container",layout:"flex",direction:"column",align:"center",spacing:10,items:[{text:"Browse for an image",type:"browsebutton",accept:_,onchange:L(e)},{text:"OR",type:"label"}]},{text:"Drop an image here",type:"dropzone",accept:_,height:100,onchange:L(e)}]}}};function A(e){var a=function(e,t){if(n.hasAdvTab(e)){var a=e.dom,i=t.toJSON(),r=a.parseStyle(i.style);r=d.mergeMargins(r),i.vspace&&(r["margin-top"]=r["margin-bottom"]=d.addPixelSuffix(i.vspace)),i.hspace&&(r["margin-left"]=r["margin-right"]=d.addPixelSuffix(i.hspace)),i.border&&(r["border-width"]=d.addPixelSuffix(i.border)),i.borderStyle&&(r["border-style"]=i.borderStyle),t.find("#style").value(a.serializeStyle(a.parseStyle(a.serializeStyle(r))))}};function i(i){var r,o,l,s,u={},c=e.dom;function m(){var n,i;b.updateSize(r),a(e,r),(u=t.extend(u,r.toJSON())).alt||(u.alt=""),u.title||(u.title=""),""===u.width&&(u.width=null),""===u.height&&(u.height=null),u.style||(u.style=null),u={src:u.src,alt:u.alt,title:u.title,width:u.width,height:u.height,style:u.style,caption:u.caption,"class":u["class"]},e.undoManager.transact(function(){if(u.src){if(""===u.title&&(u.title=null),o?c.setAttribs(o,u):(u.id="__mcenew",e.focus(),e.selection.setContent(c.createHTML("img",u)),o=c.get("__mcenew"),c.setAttrib(o,"id",null)),e.editorUpload.uploadImagesAuto(),!1===u.caption&&c.is(o.parentNode,"figure.image")&&(n=o.parentNode,c.insertAfter(o,n),c.remove(n)),!0!==u.caption)d.waitLoadImage(e,u,o);else if(!c.is(o.parentNode,"figure.image")){i=o,o=o.cloneNode(!0),(n=c.create("figure",{"class":"image"})).appendChild(o),n.appendChild(c.create("figcaption",{contentEditable:!0},"Caption")),n.contentEditable=!1;var t=c.getParent(i,function(t){return e.schema.getTextBlockElements()[t.nodeName]});t?c.split(t,i,n):c.replace(n,i),e.selection.select(n)}}else if(o){var a=c.is(o.parentNode,"figure.image")?o.parentNode:o;c.remove(a),e.focus(),e.nodeChanged(),c.isEmpty(e.getBody())&&(e.setContent(""),e.selection.setCursorLocation())}})}if(o=e.selection.getNode(),(l=c.getParent(o,"figure.image"))&&(o=c.select("img",l)[0]),o&&("IMG"!==o.nodeName||o.getAttribute("data-mce-object")||o.getAttribute("data-mce-placeholder"))&&(o=null),o&&(u={src:c.getAttrib(o,"src"),alt:c.getAttrib(o,"alt"),title:c.getAttrib(o,"title"),"class":c.getAttrib(o,"class"),width:c.getAttrib(o,"width"),height:c.getAttrib(o,"height"),caption:!!l}),i&&(s={type:"listbox",label:"Image list",name:"image-list",values:d.buildListItems(i,function(t){t.value=e.convertURL(t.value||t.url,"src")},[{text:"None",value:""}]),value:u.src&&e.convertURL(u.src,"src"),onselect:function(e){var t=r.find("#alt");(!t.value()||e.lastControl&&t.value()===e.lastControl.text())&&t.value(e.control.text()),r.find("#src").value(e.control.value()).fire("change")},onPostRender:function(){s=this}}),n.hasAdvTab(e)||n.hasUploadUrl(e)||n.hasUploadHandler(e)){var f=[x.makeTab(e,s)];n.hasAdvTab(e)&&(o&&(o.style.marginLeft&&o.style.marginRight&&o.style.marginLeft===o.style.marginRight&&(u.hspace=d.removePixelSuffix(o.style.marginLeft)),o.style.marginTop&&o.style.marginBottom&&o.style.marginTop===o.style.marginBottom&&(u.vspace=d.removePixelSuffix(o.style.marginTop)),o.style.borderWidth&&(u.border=d.removePixelSuffix(o.style.borderWidth)),u.borderStyle=o.style.borderStyle,u.style=e.dom.serializeStyle(e.dom.parseStyle(e.dom.getAttrib(o,"style")))),f.push(g.makeTab(e,a))),(n.hasUploadUrl(e)||n.hasUploadHandler(e))&&f.push(N.makeTab(e)),r=e.windowManager.open({title:"Insert/edit image",data:u,bodyType:"tabpanel",body:f,onSubmit:m})}else r=e.windowManager.open({title:"Insert/edit image",data:u,body:x.getGeneralItems(e,s),onSubmit:m});b.syncSize(r)}return{open:function(){d.createImageList(e,i)}}}var k=function(e){e.addCommand("mceImage",A(e).open)},D=function(e){return function(n){for(var a,i,r=n.length,o=function(t){t.attr("contenteditable",e?"true":null)};r--;)a=n[r],(i=a.attr("class"))&&/\bimage\b/.test(i)&&(a.attr("contenteditable",e?"false":null),t.each(a.getAll("figcaption"),o))}},R=function(e){e.on("preInit",function(){e.parser.addNodeFilter("figure",D(!0)),e.serializer.addNodeFilter("figure",D(!1))})},z=function(e){e.addButton("image",{icon:"image",tooltip:"Insert/edit image",onclick:A(e).open,stateSelector:"img:not([data-mce-object],[data-mce-placeholder]),figure.image"}),e.addMenuItem("image",{icon:"image",text:"Image",onclick:A(e).open,context:"insert",prependToContext:!0})};e.add("image",function(e){R(e),z(e),k(e)})}(); \ No newline at end of file diff --git a/tinymce_4/static/tinymce_4/tinymce/plugins/imagetools/plugin.js b/tinymce_4/static/tinymce_4/tinymce/plugins/imagetools/plugin.js index 3e9e204..3fcdf4c 100644 --- a/tinymce_4/static/tinymce_4/tinymce/plugins/imagetools/plugin.js +++ b/tinymce_4/static/tinymce_4/tinymce/plugins/imagetools/plugin.js @@ -1,202 +1,99 @@ (function () { +var imagetools = (function () { + 'use strict'; -var defs = {}; // id -> {dependencies, definition, instance (possibly undefined)} - -// Used when there is no 'main' module. -// The name is probably (hopefully) unique so minification removes for releases. -var register_3795 = function (id) { - var module = dem(id); - var fragments = id.split('.'); - var target = Function('return this;')(); - for (var i = 0; i < fragments.length - 1; ++i) { - if (target[fragments[i]] === undefined) - target[fragments[i]] = {}; - target = target[fragments[i]]; - } - target[fragments[fragments.length - 1]] = module; -}; - -var instantiate = function (id) { - var actual = defs[id]; - var dependencies = actual.deps; - var definition = actual.defn; - var len = dependencies.length; - var instances = new Array(len); - for (var i = 0; i < len; ++i) - instances[i] = dem(dependencies[i]); - var defResult = definition.apply(null, instances); - if (defResult === undefined) - throw 'module [' + id + '] returned undefined'; - actual.instance = defResult; -}; - -var def = function (id, dependencies, definition) { - if (typeof id !== 'string') - throw 'module id must be a string'; - else if (dependencies === undefined) - throw 'no dependencies for ' + id; - else if (definition === undefined) - throw 'no definition function for ' + id; - defs[id] = { - deps: dependencies, - defn: definition, - instance: undefined - }; -}; - -var dem = function (id) { - var actual = defs[id]; - if (actual === undefined) - throw 'module [' + id + '] was undefined'; - else if (actual.instance === undefined) - instantiate(id); - return actual.instance; -}; - -var req = function (ids, callback) { - var len = ids.length; - var instances = new Array(len); - for (var i = 0; i < len; ++i) - instances[i] = dem(ids[i]); - callback.apply(null, instances); -}; - -var ephox = {}; - -ephox.bolt = { - module: { - api: { - define: def, - require: req, - demand: dem - } - } -}; - -var define = def; -var require = req; -var demand = dem; -// this helps with minification when using a lot of global references -var defineGlobal = function (id, ref) { - define(id, [], function () { return ref; }); -}; -/*jsc -["tinymce.plugins.imagetools.Plugin","ephox.katamari.api.Cell","tinymce.core.PluginManager","tinymce.plugins.imagetools.api.Commands","tinymce.plugins.imagetools.core.UploadSelectedImage","tinymce.plugins.imagetools.ui.Buttons","tinymce.plugins.imagetools.ui.ContextToolbar","global!tinymce.util.Tools.resolve","tinymce.core.util.Tools","tinymce.plugins.imagetools.core.Actions","ephox.katamari.api.Fun","tinymce.plugins.imagetools.api.Settings","ephox.imagetools.api.BlobConversions","ephox.imagetools.api.ImageTransformations","global!Array","global!Error","ephox.sand.api.URL","global!clearTimeout","tinymce.core.util.Delay","tinymce.core.util.Promise","tinymce.core.util.URI","tinymce.plugins.imagetools.core.ImageSize","tinymce.plugins.imagetools.core.Proxy","tinymce.plugins.imagetools.ui.Dialog","ephox.imagetools.util.Conversions","ephox.imagetools.util.ImageResult","ephox.imagetools.transformations.Filters","ephox.imagetools.transformations.ImageTools","ephox.sand.util.Global","tinymce.plugins.imagetools.core.Errors","tinymce.plugins.imagetools.core.Utils","global!Math","global!setTimeout","tinymce.core.dom.DOMUtils","tinymce.core.ui.Factory","tinymce.plugins.imagetools.core.UndoStack","tinymce.plugins.imagetools.ui.ImagePanel","ephox.imagetools.util.Promise","ephox.imagetools.util.Canvas","ephox.imagetools.util.Mime","ephox.imagetools.util.ImageSize","ephox.imagetools.transformations.ColorMatrix","ephox.imagetools.transformations.ImageResizerCanvas","ephox.katamari.api.Resolve","ephox.katamari.api.Arr","ephox.sand.api.FileReader","ephox.sand.api.XMLHttpRequest","global!document","global!Image","tinymce.core.geom.Rect","tinymce.plugins.imagetools.core.LoadImage","tinymce.plugins.imagetools.ui.CropRect","ephox.katamari.api.Global","ephox.katamari.api.Option","global!String","tinymce.core.dom.DomQuery","tinymce.core.util.Observable","tinymce.core.util.VK","global!Object"] -jsc*/ -define( - 'ephox.katamari.api.Cell', - - [ - ], - - function () { - var Cell = function (initial) { - var value = initial; - - var get = function () { - return value; - }; - - var set = function (v) { - value = v; - }; - - var clone = function () { - return Cell(get()); - }; - - return { - get: get, - set: set, - clone: clone - }; + var Cell = function (initial) { + var value = initial; + var get = function () { + return value; }; + var set = function (v) { + value = v; + }; + var clone = function () { + return Cell(get()); + }; + return { + get: get, + set: set, + clone: clone + }; + }; - return Cell; - } -); + var PluginManager = tinymce.util.Tools.resolve('tinymce.PluginManager'); -defineGlobal("global!tinymce.util.Tools.resolve", tinymce.util.Tools.resolve); -/** - * ResolveGlobal.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ + var Tools = tinymce.util.Tools.resolve('tinymce.util.Tools'); -define( - 'tinymce.core.PluginManager', - [ - 'global!tinymce.util.Tools.resolve' - ], - function (resolve) { - return resolve('tinymce.PluginManager'); + function create(width, height) { + return resize(document.createElement('canvas'), width, height); } -); - -/** - * ResolveGlobal.js - * - * Released under LGPL License. - * Copyright (c) 1999-2017 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -define( - 'tinymce.core.util.Tools', - [ - 'global!tinymce.util.Tools.resolve' - ], - function (resolve) { - return resolve('tinymce.util.Tools'); + function clone(canvas) { + var tCanvas, ctx; + tCanvas = create(canvas.width, canvas.height); + ctx = get2dContext(tCanvas); + ctx.drawImage(canvas, 0, 0); + return tCanvas; } -); - -/* eslint-disable */ -/* jshint ignore:start */ - -/** - * Modifed to be a feature fill and wrapped as tinymce module. - * - * Promise polyfill under MIT license: https://github.com/taylorhakes/promise-polyfill - */ -define( - 'ephox.imagetools.util.Promise', - [ - ], - function () { - if (window.Promise) { - return window.Promise; + function get2dContext(canvas) { + return canvas.getContext('2d'); + } + function get3dContext(canvas) { + var gl = null; + try { + gl = canvas.getContext('webgl') || canvas.getContext('experimental-webgl'); + } catch (e) { } - - // Use polyfill for setImmediate for performance gains - var asap = Promise.immediateFn || (typeof setImmediate === 'function' && setImmediate) || - function (fn) { setTimeout(fn, 1); }; - - // Polyfill for Function.prototype.bind - function bind(fn, thisArg) { - return function () { - fn.apply(thisArg, arguments); - }; + if (!gl) { + gl = null; } + return gl; + } + function resize(canvas, width, height) { + canvas.width = width; + canvas.height = height; + return canvas; + } + var $_ceaiu4cpje5nvbxy = { + create: create, + clone: clone, + resize: resize, + get2dContext: get2dContext, + get3dContext: get3dContext + }; - var isArray = Array.isArray || function (value) { return Object.prototype.toString.call(value) === "[object Array]"; }; + function getWidth(image) { + return image.naturalWidth || image.width; + } + function getHeight(image) { + return image.naturalHeight || image.height; + } + var $_7turnscqje5nvbxz = { + getWidth: getWidth, + getHeight: getHeight + }; - 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'); + var promise = function () { + var Promise = function (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 = null; this._value = null; this._deferreds = []; - doResolve(fn, bind(resolve, this), bind(reject, this)); + }; + var asap = Promise.immediateFn || typeof setImmediate === 'function' && setImmediate || function (fn) { + setTimeout(fn, 1); + }; + function bind(fn, thisArg) { + return function () { + fn.apply(thisArg, arguments); + }; } - + var isArray = Array.isArray || function (value) { + return Object.prototype.toString.call(value) === '[object Array]'; + }; function handle(deferred) { var me = this; if (this._state === null) { @@ -212,18 +109,17 @@ define( var ret; try { ret = cb(me._value); - } - catch (e) { + } catch (e) { deferred.reject(e); return; } deferred.resolve(ret); }); } - function resolve(newValue) { - try { //Promise Resolution Procedure: https://github.com/promises-aplus/promises-spec#the-promise-resolution-procedure - if (newValue === this) throw new TypeError('A promise cannot be resolved with itself.'); + try { + if (newValue === this) + throw new TypeError('A promise cannot be resolved with itself.'); if (newValue && (typeof newValue === 'object' || typeof newValue === 'function')) { var then = newValue.then; if (typeof then === 'function') { @@ -234,77 +130,71 @@ define( this._state = true; this._value = newValue; finale.call(this); - } catch (e) { reject.call(this, e); } + } catch (e) { + reject.call(this, e); + } } - function reject(newValue) { this._state = false; this._value = newValue; finale.call(this); } - function finale() { for (var i = 0, len = this._deferreds.length; i < len; i++) { handle.call(this, this._deferreds[i]); } this._deferreds = null; } - function Handler(onFulfilled, onRejected, resolve, reject) { this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null; this.onRejected = typeof onRejected === 'function' ? onRejected : null; this.resolve = resolve; this.reject = reject; } - - /** - * Take a potentially misbehaving resolver function and make sure - * onFulfilled and onRejected are only called once. - * - * Makes no guarantees about asynchrony. - */ function doResolve(fn, onFulfilled, onRejected) { var done = false; try { fn(function (value) { - if (done) return; + if (done) + return; done = true; onFulfilled(value); }, function (reason) { - if (done) return; + if (done) + return; done = true; onRejected(reason); }); } catch (ex) { - if (done) return; + if (done) + return; done = true; onRejected(ex); } } - Promise.prototype['catch'] = function (onRejected) { return this.then(null, onRejected); }; - Promise.prototype.then = function (onFulfilled, onRejected) { var me = this; return new Promise(function (resolve, reject) { handle.call(me, new Handler(onFulfilled, onRejected, resolve, reject)); }); }; - Promise.all = function () { var args = Array.prototype.slice.call(arguments.length === 1 && isArray(arguments[0]) ? arguments[0] : arguments); - return new Promise(function (resolve, reject) { - if (args.length === 0) return resolve([]); + 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); + then.call(val, function (val) { + res(i, val); + }, reject); return; } } @@ -321,23 +211,19 @@ define( } }); }; - 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++) { @@ -345,3960 +231,3209 @@ define( } }); }; - return Promise; - }); - -/* jshint ignore:end */ -/* eslint-enable */ - -define( - 'ephox.imagetools.util.Canvas', - [ - ], - function () { - function create(width, height) { - return resize(document.createElement('canvas'), width, height); - } - - function clone(canvas) { - var tCanvas, ctx; - tCanvas = create(canvas.width, canvas.height); - ctx = get2dContext(tCanvas); - ctx.drawImage(canvas, 0, 0); - return tCanvas; - } - - function get2dContext(canvas) { - return canvas.getContext("2d"); - } + }; + var Promise = window.Promise ? window.Promise : promise(); - function get3dContext(canvas) { - var gl = null; - try { - gl = canvas.getContext("webgl") || canvas.getContext("experimental-webgl"); - } - catch (e) { } + var noop = function () { + }; + var noarg = function (f) { + return function () { + return f(); + }; + }; + var compose = function (fa, fb) { + return function () { + return fa(fb.apply(null, arguments)); + }; + }; + var constant = function (value) { + return function () { + return value; + }; + }; + var identity = function (x) { + return x; + }; + var tripleEquals = function (a, b) { + return a === b; + }; + var curry = function (f) { + var args = new Array(arguments.length - 1); + for (var i = 1; i < arguments.length; i++) + args[i - 1] = arguments[i]; + return function () { + var newArgs = new Array(arguments.length); + for (var j = 0; j < newArgs.length; j++) + newArgs[j] = arguments[j]; + var all = args.concat(newArgs); + return f.apply(null, all); + }; + }; + var not = function (f) { + return function () { + return !f.apply(null, arguments); + }; + }; + var die = function (msg) { + return function () { + throw new Error(msg); + }; + }; + var apply = function (f) { + return f(); + }; + var call = function (f) { + f(); + }; + var never = constant(false); + var always = constant(true); + var $_eo5aunctje5nvbya = { + noop: noop, + noarg: noarg, + compose: compose, + constant: constant, + identity: identity, + tripleEquals: tripleEquals, + curry: curry, + not: not, + die: die, + apply: apply, + call: call, + never: never, + always: always + }; - if (!gl) { // it seems that sometimes it doesn't throw exception, but still fails to get context - gl = null; + var never$1 = $_eo5aunctje5nvbya.never; + var always$1 = $_eo5aunctje5nvbya.always; + var none = function () { + return NONE; + }; + var NONE = function () { + var eq = function (o) { + return o.isNone(); + }; + var call = function (thunk) { + return thunk(); + }; + var id = function (n) { + return n; + }; + var noop = function () { + }; + var me = { + fold: function (n, s) { + return n(); + }, + is: never$1, + isSome: never$1, + isNone: always$1, + getOr: id, + getOrThunk: call, + getOrDie: function (msg) { + throw new Error(msg || 'error: getOrDie called on none.'); + }, + or: id, + orThunk: call, + map: none, + ap: none, + each: noop, + bind: none, + flatten: none, + exists: never$1, + forall: always$1, + filter: none, + equals: eq, + equals_: eq, + toArray: function () { + return []; + }, + toString: $_eo5aunctje5nvbya.constant('none()') + }; + if (Object.freeze) + Object.freeze(me); + return me; + }(); + var some = function (a) { + var constant_a = function () { + return a; + }; + var self = function () { + return me; + }; + var map = function (f) { + return some(f(a)); + }; + var bind = function (f) { + return f(a); + }; + var me = { + fold: function (n, s) { + return s(a); + }, + is: function (v) { + return a === v; + }, + isSome: always$1, + isNone: never$1, + getOr: constant_a, + getOrThunk: constant_a, + getOrDie: constant_a, + or: self, + orThunk: self, + map: map, + ap: function (optfab) { + return optfab.fold(none, function (fab) { + return some(fab(a)); + }); + }, + each: function (f) { + f(a); + }, + bind: bind, + flatten: constant_a, + exists: bind, + forall: bind, + filter: function (f) { + return f(a) ? me : NONE; + }, + equals: function (o) { + return o.is(a); + }, + equals_: function (o, elementEq) { + return o.fold(never$1, function (b) { + return elementEq(a, b); + }); + }, + toArray: function () { + return [a]; + }, + toString: function () { + return 'some(' + a + ')'; } - return gl; - } - - function resize(canvas, width, height) { - canvas.width = width; - canvas.height = height; - - return canvas; - } - - return { - create: create, - clone: clone, - resize: resize, - get2dContext: get2dContext, - get3dContext: get3dContext }; - }); -define( - 'ephox.imagetools.util.Mime', - [ - ], - function () { - function getUriPathName(uri) { - var a = document.createElement('a'); - a.href = uri; - return a.pathname; - } - - function guessMimeType(uri) { - var parts, ext, mimes, matches; + return me; + }; + var from = function (value) { + return value === null || value === undefined ? NONE : some(value); + }; + var Option = { + some: some, + none: none, + from: from + }; - if (uri.indexOf('data:') === 0) { - uri = uri.split(','); - matches = /data:([^;]+)/.exec(uri[0]); - return matches ? matches[1] : ''; - } else { - mimes = { - 'jpg': 'image/jpeg', - 'jpeg': 'image/jpeg', - 'png': 'image/png' - }; + var global = typeof window !== 'undefined' ? window : Function('return this;')(); - parts = getUriPathName(uri).split('.'); - ext = parts[parts.length - 1]; + 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 step = function (o, part) { + if (o[part] === undefined || o[part] === null) + o[part] = {}; + return o[part]; + }; + var forge = function (parts, target) { + var o = target !== undefined ? target : global; + for (var i = 0; i < parts.length; ++i) + o = step(o, parts[i]); + return o; + }; + var namespace = function (name, target) { + var parts = name.split('.'); + return forge(parts, target); + }; + var $_b0gaccwje5nvbyf = { + path: path, + resolve: resolve, + forge: forge, + namespace: namespace + }; - if (ext) { - ext = ext.toLowerCase(); - } - return mimes[ext]; - } - } + var unsafe = function (name, scope) { + return $_b0gaccwje5nvbyf.resolve(name, scope); + }; + var getOrDie = function (name, scope) { + var actual = unsafe(name, scope); + if (actual === undefined || actual === null) + throw name + ' not available on this browser'; + return actual; + }; + var $_etk8i4cvje5nvbyd = { getOrDie: getOrDie }; + function Blob (parts, properties) { + var f = $_etk8i4cvje5nvbyd.getOrDie('Blob'); + return new f(parts, properties); + } - return { - guessMimeType: guessMimeType - }; - }); -define( - 'ephox.imagetools.util.ImageSize', - [ - ], - function() { - function getWidth(image) { - return image.naturalWidth || image.width; + function FileReader () { + var f = $_etk8i4cvje5nvbyd.getOrDie('FileReader'); + return new f(); } - function getHeight(image) { - return image.naturalHeight || image.height; + function Uint8Array (arr) { + var f = $_etk8i4cvje5nvbyd.getOrDie('Uint8Array'); + return new f(arr); } - return { - getWidth: getWidth, - getHeight: getHeight + var requestAnimationFrame = function (callback) { + var f = $_etk8i4cvje5nvbyd.getOrDie('requestAnimationFrame'); + f(callback); + }; + var atob = function (base64) { + var f = $_etk8i4cvje5nvbyd.getOrDie('atob'); + return f(base64); + }; + var $_2srakbd0je5nvbyi = { + atob: atob, + requestAnimationFrame: requestAnimationFrame }; -}); -define( - 'ephox.imagetools.util.Conversions', - [ - 'ephox.imagetools.util.Promise', - 'ephox.imagetools.util.Canvas', - 'ephox.imagetools.util.Mime', - 'ephox.imagetools.util.ImageSize' - ], - function (Promise, Canvas, Mime, ImageSize) { - function loadImage(image) { - return new Promise(function (resolve) { - function loaded() { - image.removeEventListener('load', loaded); - resolve(image); - } - if (image.complete) { - resolve(image); - } else { - image.addEventListener('load', loaded); + function loadImage(image) { + return new Promise(function (resolve) { + function loaded() { + image.removeEventListener('load', loaded); + resolve(image); + } + if (image.complete) { + resolve(image); + } else { + image.addEventListener('load', loaded); + } + }); + } + function imageToBlob(image) { + return loadImage(image).then(function (image) { + var src = image.src; + if (src.indexOf('blob:') === 0) { + return anyUriToBlob(src); + } + if (src.indexOf('data:') === 0) { + return dataUriToBlob(src); + } + return anyUriToBlob(src); + }); + } + function blobToImage(blob) { + return new Promise(function (resolve, reject) { + var blobUrl = URL.createObjectURL(blob); + var image = new Image(); + var removeListeners = function () { + image.removeEventListener('load', loaded); + image.removeEventListener('error', error); + }; + function loaded() { + removeListeners(); + resolve(image); + } + function error() { + removeListeners(); + reject('Unable to load data of type ' + blob.type + ': ' + blobUrl); + } + image.addEventListener('load', loaded); + image.addEventListener('error', error); + image.src = blobUrl; + if (image.complete) { + loaded(); + } + }); + } + function anyUriToBlob(url) { + return new Promise(function (resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open('GET', url, true); + xhr.responseType = 'blob'; + xhr.onload = function () { + if (this.status == 200) { + resolve(this.response); } + }; + xhr.onerror = function () { + var _this = this; + var corsError = function () { + var obj = new Error('No access to download image'); + obj.code = 18; + obj.name = 'SecurityError'; + return obj; + }; + var genericError = function () { + return new Error('Error ' + _this.status + ' downloading image'); + }; + reject(this.status === 0 ? corsError() : genericError()); + }; + xhr.send(); + }); + } + function dataUriToBlobSync(uri) { + var data = uri.split(','); + var matches = /data:([^;]+)/.exec(data[0]); + if (!matches) + return Option.none(); + var mimetype = matches[1]; + var base64 = data[1]; + var sliceSize = 1024; + var byteCharacters = $_2srakbd0je5nvbyi.atob(base64); + var bytesLength = byteCharacters.length; + var slicesCount = Math.ceil(bytesLength / sliceSize); + var byteArrays = new Array(slicesCount); + for (var sliceIndex = 0; sliceIndex < slicesCount; ++sliceIndex) { + var begin = sliceIndex * sliceSize; + var end = Math.min(begin + sliceSize, bytesLength); + var bytes = new Array(end - begin); + for (var offset = begin, i = 0; offset < end; ++i, ++offset) { + bytes[i] = byteCharacters[offset].charCodeAt(0); + } + byteArrays[sliceIndex] = Uint8Array(bytes); + } + return Option.some(Blob(byteArrays, { type: mimetype })); + } + function dataUriToBlob(uri) { + return new Promise(function (resolve, reject) { + dataUriToBlobSync(uri).fold(function () { + reject('uri is not base64: ' + uri); + }, resolve); + }); + } + function uriToBlob(url) { + if (url.indexOf('blob:') === 0) { + return anyUriToBlob(url); + } + if (url.indexOf('data:') === 0) { + return dataUriToBlob(url); + } + return null; + } + function canvasToBlob(canvas, type, quality) { + type = type || 'image/png'; + if (HTMLCanvasElement.prototype.toBlob) { + return new Promise(function (resolve) { + canvas.toBlob(function (blob) { + resolve(blob); + }, type, quality); }); + } else { + return dataUriToBlob(canvas.toDataURL(type, quality)); } + } + function canvasToDataURL(getCanvas, type, quality) { + type = type || 'image/png'; + return getCanvas.then(function (canvas) { + return canvas.toDataURL(type, quality); + }); + } + function blobToCanvas(blob) { + return blobToImage(blob).then(function (image) { + revokeImageUrl(image); + var context, canvas; + canvas = $_ceaiu4cpje5nvbxy.create($_7turnscqje5nvbxz.getWidth(image), $_7turnscqje5nvbxz.getHeight(image)); + context = $_ceaiu4cpje5nvbxy.get2dContext(canvas); + context.drawImage(image, 0, 0); + return canvas; + }); + } + function blobToDataUri(blob) { + return new Promise(function (resolve) { + var reader = new FileReader(); + reader.onloadend = function () { + resolve(reader.result); + }; + reader.readAsDataURL(blob); + }); + } + function blobToArrayBuffer(blob) { + return new Promise(function (resolve) { + var reader = new FileReader(); + reader.onloadend = function () { + resolve(reader.result); + }; + reader.readAsArrayBuffer(blob); + }); + } + function blobToBase64(blob) { + return blobToDataUri(blob).then(function (dataUri) { + return dataUri.split(',')[1]; + }); + } + function revokeImageUrl(image) { + URL.revokeObjectURL(image.src); + } + var $_4eip14coje5nvbxm = { + blobToImage: blobToImage, + imageToBlob: imageToBlob, + blobToArrayBuffer: blobToArrayBuffer, + blobToDataUri: blobToDataUri, + blobToBase64: blobToBase64, + dataUriToBlobSync: dataUriToBlobSync, + canvasToBlob: canvasToBlob, + canvasToDataURL: canvasToDataURL, + blobToCanvas: blobToCanvas, + uriToBlob: uriToBlob + }; - function imageToCanvas(image) { - return loadImage(image).then(function (image) { - var context, canvas; - - canvas = Canvas.create(ImageSize.getWidth(image), ImageSize.getHeight(image)); - context = Canvas.get2dContext(canvas); - context.drawImage(image, 0, 0); + var blobToImage$1 = function (image) { + return $_4eip14coje5nvbxm.blobToImage(image); + }; + var imageToBlob$1 = function (blob) { + return $_4eip14coje5nvbxm.imageToBlob(blob); + }; + var blobToDataUri$1 = function (blob) { + return $_4eip14coje5nvbxm.blobToDataUri(blob); + }; + var blobToBase64$1 = function (blob) { + return $_4eip14coje5nvbxm.blobToBase64(blob); + }; + var dataUriToBlobSync$1 = function (uri) { + return $_4eip14coje5nvbxm.dataUriToBlobSync(uri); + }; + var uriToBlob$1 = function (uri) { + return Option.from($_4eip14coje5nvbxm.uriToBlob(uri)); + }; + var $_6m4f63cnje5nvbxi = { + blobToImage: blobToImage$1, + imageToBlob: imageToBlob$1, + blobToDataUri: blobToDataUri$1, + blobToBase64: blobToBase64$1, + dataUriToBlobSync: dataUriToBlobSync$1, + uriToBlob: uriToBlob$1 + }; - return canvas; + function create$1(getCanvas, blob, uri) { + var initialType = blob.type; + var getType = $_eo5aunctje5nvbya.constant(initialType); + function toBlob() { + return Promise.resolve(blob); + } + function toDataURL() { + return uri; + } + function toBase64() { + return uri.split(',')[1]; + } + function toAdjustedBlob(type, quality) { + return getCanvas.then(function (canvas) { + return $_4eip14coje5nvbxm.canvasToBlob(canvas, type, quality); }); } - - function imageToBlob(image) { - return loadImage(image).then(function (image) { - var src = image.src; - - if (src.indexOf('blob:') === 0) { - return blobUriToBlob(src); - } - - if (src.indexOf('data:') === 0) { - return dataUriToBlob(src); - } - - return imageToCanvas(image).then(function (canvas) { - return dataUriToBlob(canvas.toDataURL(Mime.guessMimeType(src))); - }); + function toAdjustedDataURL(type, quality) { + return getCanvas.then(function (canvas) { + return $_4eip14coje5nvbxm.canvasToDataURL(canvas, type, quality); }); } - - function blobToImage(blob) { - return new Promise(function (resolve) { - var image = new Image(); - - function loaded() { - image.removeEventListener('load', loaded); - resolve(image); - } - - image.addEventListener('load', loaded); - image.src = URL.createObjectURL(blob); - - if (image.complete) { - loaded(); - } + function toAdjustedBase64(type, quality) { + return toAdjustedDataURL(type, quality).then(function (dataurl) { + return dataurl.split(',')[1]; }); } - - function blobUriToBlob(url) { - return new Promise(function (resolve) { - var xhr = new XMLHttpRequest(); - - xhr.open('GET', url, true); - xhr.responseType = 'blob'; - - xhr.onload = function () { - if (this.status == 200) { - resolve(this.response); - } - }; - - xhr.send(); - }); + function toCanvas() { + return getCanvas.then($_ceaiu4cpje5nvbxy.clone); } + return { + getType: getType, + toBlob: toBlob, + toDataURL: toDataURL, + toBase64: toBase64, + toAdjustedBlob: toAdjustedBlob, + toAdjustedDataURL: toAdjustedDataURL, + toAdjustedBase64: toAdjustedBase64, + toCanvas: toCanvas + }; + } + function fromBlob(blob) { + return $_4eip14coje5nvbxm.blobToDataUri(blob).then(function (uri) { + return create$1($_4eip14coje5nvbxm.blobToCanvas(blob), blob, uri); + }); + } + function fromCanvas(canvas, type) { + return $_4eip14coje5nvbxm.canvasToBlob(canvas, type).then(function (blob) { + return create$1(Promise.resolve(canvas), blob, canvas.toDataURL()); + }); + } + function fromImage(image) { + return $_4eip14coje5nvbxm.imageToBlob(image).then(function (blob) { + return fromBlob(blob); + }); + } + var fromBlobAndUrlSync = function (blob, url) { + return create$1($_4eip14coje5nvbxm.blobToCanvas(blob), blob, url); + }; + var $_3oqk7xd3je5nvbys = { + fromBlob: fromBlob, + fromCanvas: fromCanvas, + fromImage: fromImage, + fromBlobAndUrlSync: fromBlobAndUrlSync + }; - function dataUriToBlobSync(uri) { - var str, arr, i, matches, type, blobBuilder; - - uri = uri.split(','); - - matches = /data:([^;]+)/.exec(uri[0]); - if (matches) { - type = matches[1]; + function clamp(value, min, max) { + value = parseFloat(value); + if (value > max) { + value = max; + } else if (value < min) { + value = min; + } + return value; + } + function identity$1() { + return [ + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1 + ]; + } + var DELTA_INDEX = [ + 0, + 0.01, + 0.02, + 0.04, + 0.05, + 0.06, + 0.07, + 0.08, + 0.1, + 0.11, + 0.12, + 0.14, + 0.15, + 0.16, + 0.17, + 0.18, + 0.2, + 0.21, + 0.22, + 0.24, + 0.25, + 0.27, + 0.28, + 0.3, + 0.32, + 0.34, + 0.36, + 0.38, + 0.4, + 0.42, + 0.44, + 0.46, + 0.48, + 0.5, + 0.53, + 0.56, + 0.59, + 0.62, + 0.65, + 0.68, + 0.71, + 0.74, + 0.77, + 0.8, + 0.83, + 0.86, + 0.89, + 0.92, + 0.95, + 0.98, + 1, + 1.06, + 1.12, + 1.18, + 1.24, + 1.3, + 1.36, + 1.42, + 1.48, + 1.54, + 1.6, + 1.66, + 1.72, + 1.78, + 1.84, + 1.9, + 1.96, + 2, + 2.12, + 2.25, + 2.37, + 2.5, + 2.62, + 2.75, + 2.87, + 3, + 3.2, + 3.4, + 3.6, + 3.8, + 4, + 4.3, + 4.7, + 4.9, + 5, + 5.5, + 6, + 6.5, + 6.8, + 7, + 7.3, + 7.5, + 7.8, + 8, + 8.4, + 8.7, + 9, + 9.4, + 9.6, + 9.8, + 10 + ]; + function multiply(matrix1, matrix2) { + var i, j, k, val, col = [], out = new Array(10); + for (i = 0; i < 5; i++) { + for (j = 0; j < 5; j++) { + col[j] = matrix2[j + i * 5]; + } + for (j = 0; j < 5; j++) { + val = 0; + for (k = 0; k < 5; k++) { + val += matrix1[j + k * 5] * col[k]; + } + out[j + i * 5] = val; } + } + return out; + } + function adjust(matrix, adjustValue) { + adjustValue = clamp(adjustValue, 0, 1); + return matrix.map(function (value, index) { + if (index % 6 === 0) { + value = 1 - (1 - value) * adjustValue; + } else { + value *= adjustValue; + } + return clamp(value, 0, 1); + }); + } + function adjustContrast(matrix, value) { + var x; + value = clamp(value, -1, 1); + value *= 100; + if (value < 0) { + x = 127 + value / 100 * 127; + } else { + x = value % 1; + if (x === 0) { + x = DELTA_INDEX[value]; + } else { + x = DELTA_INDEX[Math.floor(value)] * (1 - x) + DELTA_INDEX[Math.floor(value) + 1] * x; + } + x = x * 127 + 127; + } + return multiply(matrix, [ + x / 127, + 0, + 0, + 0, + 0.5 * (127 - x), + 0, + x / 127, + 0, + 0, + 0.5 * (127 - x), + 0, + 0, + x / 127, + 0, + 0.5 * (127 - x), + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1 + ]); + } + function adjustSaturation(matrix, value) { + var x, lumR, lumG, lumB; + value = clamp(value, -1, 1); + x = 1 + (value > 0 ? 3 * value : value); + lumR = 0.3086; + lumG = 0.6094; + lumB = 0.082; + return multiply(matrix, [ + lumR * (1 - x) + x, + lumG * (1 - x), + lumB * (1 - x), + 0, + 0, + lumR * (1 - x), + lumG * (1 - x) + x, + lumB * (1 - x), + 0, + 0, + lumR * (1 - x), + lumG * (1 - x), + lumB * (1 - x) + x, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1 + ]); + } + function adjustHue(matrix, angle) { + var cosVal, sinVal, lumR, lumG, lumB; + angle = clamp(angle, -180, 180) / 180 * Math.PI; + cosVal = Math.cos(angle); + sinVal = Math.sin(angle); + lumR = 0.213; + lumG = 0.715; + lumB = 0.072; + return multiply(matrix, [ + lumR + cosVal * (1 - lumR) + sinVal * -lumR, + lumG + cosVal * -lumG + sinVal * -lumG, + lumB + cosVal * -lumB + sinVal * (1 - lumB), + 0, + 0, + lumR + cosVal * -lumR + sinVal * 0.143, + lumG + cosVal * (1 - lumG) + sinVal * 0.14, + lumB + cosVal * -lumB + sinVal * -0.283, + 0, + 0, + lumR + cosVal * -lumR + sinVal * -(1 - lumR), + lumG + cosVal * -lumG + sinVal * lumG, + lumB + cosVal * (1 - lumB) + sinVal * lumB, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1 + ]); + } + function adjustBrightness(matrix, value) { + value = clamp(255 * value, -255, 255); + return multiply(matrix, [ + 1, + 0, + 0, + 0, + value, + 0, + 1, + 0, + 0, + value, + 0, + 0, + 1, + 0, + value, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1 + ]); + } + function adjustColors(matrix, adjustR, adjustG, adjustB) { + adjustR = clamp(adjustR, 0, 2); + adjustG = clamp(adjustG, 0, 2); + adjustB = clamp(adjustB, 0, 2); + return multiply(matrix, [ + adjustR, + 0, + 0, + 0, + 0, + 0, + adjustG, + 0, + 0, + 0, + 0, + 0, + adjustB, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1 + ]); + } + function adjustSepia(matrix, value) { + value = clamp(value, 0, 1); + return multiply(matrix, adjust([ + 0.393, + 0.769, + 0.189, + 0, + 0, + 0.349, + 0.686, + 0.168, + 0, + 0, + 0.272, + 0.534, + 0.131, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1 + ], value)); + } + function adjustGrayscale(matrix, value) { + value = clamp(value, 0, 1); + return multiply(matrix, adjust([ + 0.33, + 0.34, + 0.33, + 0, + 0, + 0.33, + 0.34, + 0.33, + 0, + 0, + 0.33, + 0.34, + 0.33, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1 + ], value)); + } + var $_bh0z57d4je5nvbyx = { + identity: identity$1, + adjust: adjust, + multiply: multiply, + adjustContrast: adjustContrast, + adjustBrightness: adjustBrightness, + adjustSaturation: adjustSaturation, + adjustHue: adjustHue, + adjustColors: adjustColors, + adjustSepia: adjustSepia, + adjustGrayscale: adjustGrayscale + }; - str = atob(uri[1]); - - if (window.WebKitBlobBuilder) { - /*globals WebKitBlobBuilder:false */ - blobBuilder = new WebKitBlobBuilder(); - - arr = new ArrayBuffer(str.length); - for (i = 0; i < arr.length; i++) { - arr[i] = str.charCodeAt(i); + function colorFilter(ir, matrix) { + return ir.toCanvas().then(function (canvas) { + return applyColorFilter(canvas, ir.getType(), matrix); + }); + } + function applyColorFilter(canvas, type, matrix) { + var context = $_ceaiu4cpje5nvbxy.get2dContext(canvas); + var pixels; + function applyMatrix(pixels, m) { + var d = pixels.data, r, g, b, a, i, m0 = m[0], m1 = m[1], m2 = m[2], m3 = m[3], m4 = m[4], m5 = m[5], m6 = m[6], m7 = m[7], m8 = m[8], m9 = m[9], m10 = m[10], m11 = m[11], m12 = m[12], m13 = m[13], m14 = m[14], m15 = m[15], m16 = m[16], m17 = m[17], m18 = m[18], m19 = m[19]; + for (i = 0; i < d.length; i += 4) { + r = d[i]; + g = d[i + 1]; + b = d[i + 2]; + a = d[i + 3]; + d[i] = r * m0 + g * m1 + b * m2 + a * m3 + m4; + d[i + 1] = r * m5 + g * m6 + b * m7 + a * m8 + m9; + d[i + 2] = r * m10 + g * m11 + b * m12 + a * m13 + m14; + d[i + 3] = r * m15 + g * m16 + b * m17 + a * m18 + m19; + } + return pixels; + } + pixels = applyMatrix(context.getImageData(0, 0, canvas.width, canvas.height), matrix); + context.putImageData(pixels, 0, 0); + return $_3oqk7xd3je5nvbys.fromCanvas(canvas, type); + } + function convoluteFilter(ir, matrix) { + return ir.toCanvas().then(function (canvas) { + return applyConvoluteFilter(canvas, ir.getType(), matrix); + }); + } + function applyConvoluteFilter(canvas, type, matrix) { + var context = $_ceaiu4cpje5nvbxy.get2dContext(canvas); + var pixelsIn, pixelsOut; + function applyMatrix(pixelsIn, pixelsOut, matrix) { + var rgba, drgba, side, halfSide, x, y, r, g, b, cx, cy, scx, scy, offset, wt, w, h; + function clamp(value, min, max) { + if (value > max) { + value = max; + } else if (value < min) { + value = min; } - - blobBuilder.append(arr); - return blobBuilder.getBlob(type); + return value; } - - arr = new Uint8Array(str.length); - for (i = 0; i < arr.length; i++) { - arr[i] = str.charCodeAt(i); + side = Math.round(Math.sqrt(matrix.length)); + halfSide = Math.floor(side / 2); + rgba = pixelsIn.data; + drgba = pixelsOut.data; + w = pixelsIn.width; + h = pixelsIn.height; + for (y = 0; y < h; y++) { + for (x = 0; x < w; x++) { + r = g = b = 0; + for (cy = 0; cy < side; cy++) { + for (cx = 0; cx < side; cx++) { + scx = clamp(x + cx - halfSide, 0, w - 1); + scy = clamp(y + cy - halfSide, 0, h - 1); + offset = (scy * w + scx) * 4; + wt = matrix[cy * side + cx]; + r += rgba[offset] * wt; + g += rgba[offset + 1] * wt; + b += rgba[offset + 2] * wt; + } + } + offset = (y * w + x) * 4; + drgba[offset] = clamp(r, 0, 255); + drgba[offset + 1] = clamp(g, 0, 255); + drgba[offset + 2] = clamp(b, 0, 255); + } } - return new Blob([arr], { type: type }); - } - - function dataUriToBlob(uri) { - return new Promise(function (resolve) { - resolve(dataUriToBlobSync(uri)); - }); + return pixelsOut; } - - function uriToBlob(url) { - if (url.indexOf('blob:') === 0) { - return blobUriToBlob(url); + pixelsIn = context.getImageData(0, 0, canvas.width, canvas.height); + pixelsOut = context.getImageData(0, 0, canvas.width, canvas.height); + pixelsOut = applyMatrix(pixelsIn, pixelsOut, matrix); + context.putImageData(pixelsOut, 0, 0); + return $_3oqk7xd3je5nvbys.fromCanvas(canvas, type); + } + function functionColorFilter(colorFn) { + var filterImpl = function (canvas, type, value) { + var context = $_ceaiu4cpje5nvbxy.get2dContext(canvas); + var pixels, i, lookup = new Array(256); + function applyLookup(pixels, lookup) { + var d = pixels.data, i; + for (i = 0; i < d.length; i += 4) { + d[i] = lookup[d[i]]; + d[i + 1] = lookup[d[i + 1]]; + d[i + 2] = lookup[d[i + 2]]; + } + return pixels; } - - if (url.indexOf('data:') === 0) { - return dataUriToBlob(url); + for (i = 0; i < lookup.length; i++) { + lookup[i] = colorFn(i, value); } + pixels = applyLookup(context.getImageData(0, 0, canvas.width, canvas.height), lookup); + context.putImageData(pixels, 0, 0); + return $_3oqk7xd3je5nvbys.fromCanvas(canvas, type); + }; + return function (ir, value) { + return ir.toCanvas().then(function (canvas) { + return filterImpl(canvas, ir.getType(), value); + }); + }; + } + function complexAdjustableColorFilter(matrixAdjustFn) { + return function (ir, adjust) { + return colorFilter(ir, matrixAdjustFn($_bh0z57d4je5nvbyx.identity(), adjust)); + }; + } + function basicColorFilter(matrix) { + return function (ir) { + return colorFilter(ir, matrix); + }; + } + function basicConvolutionFilter(kernel) { + return function (ir) { + return convoluteFilter(ir, kernel); + }; + } + var $_np2rbd2je5nvbyn = { + invert: basicColorFilter([ + -1, + 0, + 0, + 0, + 255, + 0, + -1, + 0, + 0, + 255, + 0, + 0, + -1, + 0, + 255, + 0, + 0, + 0, + 1, + 0 + ]), + brightness: complexAdjustableColorFilter($_bh0z57d4je5nvbyx.adjustBrightness), + hue: complexAdjustableColorFilter($_bh0z57d4je5nvbyx.adjustHue), + saturate: complexAdjustableColorFilter($_bh0z57d4je5nvbyx.adjustSaturation), + contrast: complexAdjustableColorFilter($_bh0z57d4je5nvbyx.adjustContrast), + grayscale: complexAdjustableColorFilter($_bh0z57d4je5nvbyx.adjustGrayscale), + sepia: complexAdjustableColorFilter($_bh0z57d4je5nvbyx.adjustSepia), + colorize: function (ir, adjustR, adjustG, adjustB) { + return colorFilter(ir, $_bh0z57d4je5nvbyx.adjustColors($_bh0z57d4je5nvbyx.identity(), adjustR, adjustG, adjustB)); + }, + sharpen: basicConvolutionFilter([ + 0, + -1, + 0, + -1, + 5, + -1, + 0, + -1, + 0 + ]), + emboss: basicConvolutionFilter([ + -2, + -1, + 0, + -1, + 1, + 1, + 0, + 1, + 2 + ]), + gamma: functionColorFilter(function (color, value) { + return Math.pow(color / 255, 1 - value) * 255; + }), + exposure: functionColorFilter(function (color, value) { + return 255 * (1 - Math.exp(-(color / 255) * value)); + }), + colorFilter: colorFilter, + convoluteFilter: convoluteFilter + }; - return null; - } - - function canvasToBlob(canvas, type, quality) { - type = type || 'image/png'; + function scale(image, dW, dH) { + var sW = $_7turnscqje5nvbxz.getWidth(image); + var sH = $_7turnscqje5nvbxz.getHeight(image); + var wRatio = dW / sW; + var hRatio = dH / sH; + var scaleCapped = false; + if (wRatio < 0.5 || wRatio > 2) { + wRatio = wRatio < 0.5 ? 0.5 : 2; + scaleCapped = true; + } + if (hRatio < 0.5 || hRatio > 2) { + hRatio = hRatio < 0.5 ? 0.5 : 2; + scaleCapped = true; + } + var scaled = _scale(image, wRatio, hRatio); + return !scaleCapped ? scaled : scaled.then(function (tCanvas) { + return scale(tCanvas, dW, dH); + }); + } + function _scale(image, wRatio, hRatio) { + return new Promise(function (resolve) { + var sW = $_7turnscqje5nvbxz.getWidth(image); + var sH = $_7turnscqje5nvbxz.getHeight(image); + var dW = Math.floor(sW * wRatio); + var dH = Math.floor(sH * hRatio); + var canvas = $_ceaiu4cpje5nvbxy.create(dW, dH); + var context = $_ceaiu4cpje5nvbxy.get2dContext(canvas); + context.drawImage(image, 0, 0, sW, sH, 0, 0, dW, dH); + resolve(canvas); + }); + } + var $_311nedd6je5nvbz7 = { scale: scale }; - if (HTMLCanvasElement.prototype.toBlob) { - return new Promise(function (resolve) { - canvas.toBlob(function (blob) { - resolve(blob); - }, type, quality); - }); - } else { - return dataUriToBlob(canvas.toDataURL(type, quality)); - } + function rotate(ir, angle) { + return ir.toCanvas().then(function (canvas) { + return applyRotate(canvas, ir.getType(), angle); + }); + } + function applyRotate(image, type, angle) { + var canvas = $_ceaiu4cpje5nvbxy.create(image.width, image.height); + var context = $_ceaiu4cpje5nvbxy.get2dContext(canvas); + var translateX = 0, translateY = 0; + angle = angle < 0 ? 360 + angle : angle; + if (angle == 90 || angle == 270) { + $_ceaiu4cpje5nvbxy.resize(canvas, canvas.height, canvas.width); + } + if (angle == 90 || angle == 180) { + translateX = canvas.width; + } + if (angle == 270 || angle == 180) { + translateY = canvas.height; + } + context.translate(translateX, translateY); + context.rotate(angle * Math.PI / 180); + context.drawImage(image, 0, 0); + return $_3oqk7xd3je5nvbys.fromCanvas(canvas, type); + } + function flip(ir, axis) { + return ir.toCanvas().then(function (canvas) { + return applyFlip(canvas, ir.getType(), axis); + }); + } + function applyFlip(image, type, axis) { + var canvas = $_ceaiu4cpje5nvbxy.create(image.width, image.height); + var context = $_ceaiu4cpje5nvbxy.get2dContext(canvas); + if (axis == 'v') { + context.scale(1, -1); + context.drawImage(image, 0, -canvas.height); + } else { + context.scale(-1, 1); + context.drawImage(image, -canvas.width, 0); } - - function blobToDataUri(blob) { - return new Promise(function (resolve) { - var reader = new FileReader(); - - reader.onloadend = function () { - resolve(reader.result); - }; - - reader.readAsDataURL(blob); + return $_3oqk7xd3je5nvbys.fromCanvas(canvas, type); + } + function crop(ir, x, y, w, h) { + return ir.toCanvas().then(function (canvas) { + return applyCrop(canvas, ir.getType(), x, y, w, h); + }); + } + function applyCrop(image, type, x, y, w, h) { + var canvas = $_ceaiu4cpje5nvbxy.create(w, h); + var context = $_ceaiu4cpje5nvbxy.get2dContext(canvas); + context.drawImage(image, -x, -y); + return $_3oqk7xd3je5nvbys.fromCanvas(canvas, type); + } + function resize$1(ir, w, h) { + return ir.toCanvas().then(function (canvas) { + return $_311nedd6je5nvbz7.scale(canvas, w, h).then(function (newCanvas) { + return $_3oqk7xd3je5nvbys.fromCanvas(newCanvas, ir.getType()); }); - } + }); + } + var $_5n2urbd5je5nvbz3 = { + rotate: rotate, + flip: flip, + crop: crop, + resize: resize$1 + }; - function blobToBase64(blob) { - return blobToDataUri(blob).then(function (dataUri) { - return dataUri.split(',')[1]; - }); - } + var invert = function (ir) { + return $_np2rbd2je5nvbyn.invert(ir); + }; + var sharpen = function (ir) { + return $_np2rbd2je5nvbyn.sharpen(ir); + }; + var emboss = function (ir) { + return $_np2rbd2je5nvbyn.emboss(ir); + }; + var gamma = function (ir, value) { + return $_np2rbd2je5nvbyn.gamma(ir, value); + }; + var exposure = function (ir, value) { + return $_np2rbd2je5nvbyn.exposure(ir, value); + }; + var colorize = function (ir, adjustR, adjustG, adjustB) { + return $_np2rbd2je5nvbyn.colorize(ir, adjustR, adjustG, adjustB); + }; + var brightness = function (ir, adjust) { + return $_np2rbd2je5nvbyn.brightness(ir, adjust); + }; + var hue = function (ir, adjust) { + return $_np2rbd2je5nvbyn.hue(ir, adjust); + }; + var saturate = function (ir, adjust) { + return $_np2rbd2je5nvbyn.saturate(ir, adjust); + }; + var contrast = function (ir, adjust) { + return $_np2rbd2je5nvbyn.contrast(ir, adjust); + }; + var grayscale = function (ir, adjust) { + return $_np2rbd2je5nvbyn.grayscale(ir, adjust); + }; + var sepia = function (ir, adjust) { + return $_np2rbd2je5nvbyn.sepia(ir, adjust); + }; + var flip$1 = function (ir, axis) { + return $_5n2urbd5je5nvbz3.flip(ir, axis); + }; + var crop$1 = function (ir, x, y, w, h) { + return $_5n2urbd5je5nvbz3.crop(ir, x, y, w, h); + }; + var resize$2 = function (ir, w, h) { + return $_5n2urbd5je5nvbz3.resize(ir, w, h); + }; + var rotate$1 = function (ir, angle) { + return $_5n2urbd5je5nvbz3.rotate(ir, angle); + }; + var $_alutkvd1je5nvbyk = { + invert: invert, + sharpen: sharpen, + emboss: emboss, + brightness: brightness, + hue: hue, + saturate: saturate, + contrast: contrast, + grayscale: grayscale, + sepia: sepia, + colorize: colorize, + gamma: gamma, + exposure: exposure, + flip: flip$1, + crop: crop$1, + resize: resize$2, + rotate: rotate$1 + }; - function revokeImageUrl(image) { - URL.revokeObjectURL(image.src); + var blobToImageResult = function (blob) { + return $_3oqk7xd3je5nvbys.fromBlob(blob); + }; + var fromBlobAndUrlSync$1 = function (blob, uri) { + return $_3oqk7xd3je5nvbys.fromBlobAndUrlSync(blob, uri); + }; + var imageToImageResult = function (image) { + return $_3oqk7xd3je5nvbys.fromImage(image); + }; + var imageResultToBlob = function (ir, type, quality) { + if (type === undefined && quality === undefined) { + return imageResultToOriginalBlob(ir); + } else { + return ir.toAdjustedBlob(type, quality); } + }; + var imageResultToOriginalBlob = function (ir) { + return ir.toBlob(); + }; + var imageResultToDataURL = function (ir) { + return ir.toDataURL(); + }; + var $_zore3d7je5nvbz9 = { + blobToImageResult: blobToImageResult, + fromBlobAndUrlSync: fromBlobAndUrlSync$1, + imageToImageResult: imageToImageResult, + imageResultToBlob: imageResultToBlob, + imageResultToOriginalBlob: imageResultToOriginalBlob, + imageResultToDataURL: imageResultToDataURL + }; - return { - // used outside - blobToImage: blobToImage, - // used outside - imageToBlob: imageToBlob, - // used outside - blobToDataUri: blobToDataUri, - // used outside - blobToBase64: blobToBase64, + var url = function () { + return $_etk8i4cvje5nvbyd.getOrDie('URL'); + }; + var createObjectURL = function (blob) { + return url().createObjectURL(blob); + }; + var revokeObjectURL = function (u) { + url().revokeObjectURL(u); + }; + var $_ugs46d8je5nvbzb = { + createObjectURL: createObjectURL, + revokeObjectURL: revokeObjectURL + }; - // helper method - imageToCanvas: imageToCanvas, - // helper method - canvasToBlob: canvasToBlob, - // helper method - revokeImageUrl: revokeImageUrl, - // helper method - uriToBlob: uriToBlob, - // helper method - dataUriToBlobSync: dataUriToBlobSync - }; - }); -define( - 'ephox.imagetools.util.ImageResult', - [ - 'ephox.imagetools.util.Promise', - 'ephox.imagetools.util.Conversions', - 'ephox.imagetools.util.Mime', - 'ephox.imagetools.util.Canvas' - ], - function (Promise, Conversions, Mime, Canvas) { - function create(canvas, initialType) { - function getType() { - return initialType; - } + var Delay = tinymce.util.Tools.resolve('tinymce.util.Delay'); - function toBlob(type, quality) { - return Conversions.canvasToBlob(canvas, type || initialType, quality); - } + var Promise$1 = tinymce.util.Tools.resolve('tinymce.util.Promise'); - function toDataURL(type, quality) { - return canvas.toDataURL(type || initialType, quality); - } + var URI = tinymce.util.Tools.resolve('tinymce.util.URI'); - function toBase64(type, quality) { - return toDataURL(type, quality).split(',')[1]; - } + var getToolbarItems = function (editor) { + return editor.getParam('imagetools_toolbar', 'rotateleft rotateright | flipv fliph | crop editimage imageoptions'); + }; + var getProxyUrl = function (editor) { + return editor.getParam('imagetools_proxy'); + }; + var $_2lbotgdcje5nvbze = { + getToolbarItems: getToolbarItems, + getProxyUrl: getProxyUrl + }; - function toCanvas() { - return Canvas.clone(canvas); - } + var DOMUtils = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils'); + var Factory = tinymce.util.Tools.resolve('tinymce.ui.Factory'); + + function UndoStack () { + var data = []; + var index = -1; + function add(state) { + var removed; + removed = data.splice(++index); + data.push(state); return { - getType: getType, - toBlob: toBlob, - toDataURL: toDataURL, - toBase64: toBase64, - toCanvas: toCanvas + state: state, + removed: removed }; } - - function fromBlob(blob) { - return Conversions.blobToImage(blob) - .then(function (image) { - var result = Conversions.imageToCanvas(image); - Conversions.revokeImageUrl(image); - return result; - }) - .then(function (canvas) { - return create(canvas, blob.type); - }); + function undo() { + if (canUndo()) { + return data[--index]; + } } - - function fromCanvas(canvas, type) { - return new Promise(function (resolve) { - resolve(create(canvas, type)); - }); + function redo() { + if (canRedo()) { + return data[++index]; + } } - - function fromImage(image) { - var type = Mime.guessMimeType(image.src); - return Conversions.imageToCanvas(image).then(function (canvas) { - return create(canvas, type); - }); + function canUndo() { + return index > 0; + } + function canRedo() { + return index !== -1 && index < data.length - 1; } - - return { - fromBlob: fromBlob, - fromCanvas: fromCanvas, - fromImage: fromImage - }; - }); - -define( - 'ephox.imagetools.api.BlobConversions', - [ - 'ephox.imagetools.util.Conversions', - 'ephox.imagetools.util.ImageResult' - ], - function (Conversions, ImageResult) { - var blobToImage = function (image) { - return Conversions.blobToImage(image); - }; - - var imageToBlob = function (blob) { - return Conversions.imageToBlob(blob); - }; - - var blobToDataUri = function (blob) { - return Conversions.blobToDataUri(blob); - }; - - var blobToBase64 = function (blob) { - return Conversions.blobToBase64(blob); - }; - - var blobToImageResult = function(blob) { - return ImageResult.fromBlob(blob); - }; - - var dataUriToImageResult = function(uri) { - return Conversions.uriToBlob(uri).then(ImageResult.fromBlob); - }; - - var imageToImageResult = function(image) { - return ImageResult.fromImage(image); - }; - - var imageResultToBlob = function(ir, type, quality) { - return ir.toBlob(type, quality); - }; - - var imageResultToBlobSync = function(ir, type, quality) { - return Conversions.dataUriToBlobSync(ir.toDataURL(type, quality)); - }; - return { - // used outside - blobToImage: blobToImage, - // used outside - imageToBlob: imageToBlob, - // used outside - blobToDataUri: blobToDataUri, - // used outside - blobToBase64: blobToBase64, - // used outside - blobToImageResult: blobToImageResult, - // used outside - dataUriToImageResult: dataUriToImageResult, - // used outside - imageToImageResult: imageToImageResult, - // used outside - imageResultToBlob: imageResultToBlob, - // just in case - imageResultToBlobSync: imageResultToBlobSync + data: data, + add: add, + undo: undo, + redo: redo, + canUndo: canUndo, + canRedo: canRedo }; } -); -define( - 'ephox.imagetools.transformations.ColorMatrix', - [ - ], - function () { - function clamp(value, min, max) { - value = parseFloat(value); - if (value > max) { - value = max; - } else if (value < min) { - value = min; - } + var Rect = tinymce.util.Tools.resolve('tinymce.geom.Rect'); - return value; + var loadImage$1 = function (image) { + return new Promise$1(function (resolve) { + var loaded = function () { + image.removeEventListener('load', loaded); + resolve(image); + }; + if (image.complete) { + resolve(image); + } else { + image.addEventListener('load', loaded); + } + }); + }; + var $_e2pkvpdjje5nvc04 = { loadImage: loadImage$1 }; + + var DomQuery = tinymce.util.Tools.resolve('tinymce.dom.DomQuery'); + + var Observable = tinymce.util.Tools.resolve('tinymce.util.Observable'); + + var VK = tinymce.util.Tools.resolve('tinymce.util.VK'); + + var count = 0; + function CropRect (currentRect, viewPortRect, clampRect, containerElm, action) { + var instance; + var handles; + var dragHelpers; + var blockers; + var prefix = 'mce-'; + var id = prefix + 'crid-' + count++; + handles = [ + { + name: 'move', + xMul: 0, + yMul: 0, + deltaX: 1, + deltaY: 1, + deltaW: 0, + deltaH: 0, + label: 'Crop Mask' + }, + { + name: 'nw', + xMul: 0, + yMul: 0, + deltaX: 1, + deltaY: 1, + deltaW: -1, + deltaH: -1, + label: 'Top Left Crop Handle' + }, + { + name: 'ne', + xMul: 1, + yMul: 0, + deltaX: 0, + deltaY: 1, + deltaW: 1, + deltaH: -1, + label: 'Top Right Crop Handle' + }, + { + name: 'sw', + xMul: 0, + yMul: 1, + deltaX: 1, + deltaY: 0, + deltaW: -1, + deltaH: 1, + label: 'Bottom Left Crop Handle' + }, + { + name: 'se', + xMul: 1, + yMul: 1, + deltaX: 0, + deltaY: 0, + deltaW: 1, + deltaH: 1, + label: 'Bottom Right Crop Handle' + } + ]; + blockers = [ + 'top', + 'right', + 'bottom', + 'left' + ]; + function getAbsoluteRect(outerRect, relativeRect) { + return { + x: relativeRect.x + outerRect.x, + y: relativeRect.y + outerRect.y, + w: relativeRect.w, + h: relativeRect.h + }; } - - function identity() { - return [ - 1, 0, 0, 0, 0, - 0, 1, 0, 0, 0, - 0, 0, 1, 0, 0, - 0, 0, 0, 1, 0, - 0, 0, 0, 0, 1 - ]; + function getRelativeRect(outerRect, innerRect) { + return { + x: innerRect.x - outerRect.x, + y: innerRect.y - outerRect.y, + w: innerRect.w, + h: innerRect.h + }; } - - var DELTA_INDEX = [ - 0, 0.01, 0.02, 0.04, 0.05, 0.06, 0.07, 0.08, 0.1, 0.11, - 0.12, 0.14, 0.15, 0.16, 0.17, 0.18, 0.20, 0.21, 0.22, 0.24, - 0.25, 0.27, 0.28, 0.30, 0.32, 0.34, 0.36, 0.38, 0.40, 0.42, - 0.44, 0.46, 0.48, 0.5, 0.53, 0.56, 0.59, 0.62, 0.65, 0.68, - 0.71, 0.74, 0.77, 0.80, 0.83, 0.86, 0.89, 0.92, 0.95, 0.98, - 1.0, 1.06, 1.12, 1.18, 1.24, 1.30, 1.36, 1.42, 1.48, 1.54, - 1.60, 1.66, 1.72, 1.78, 1.84, 1.90, 1.96, 2.0, 2.12, 2.25, - 2.37, 2.50, 2.62, 2.75, 2.87, 3.0, 3.2, 3.4, 3.6, 3.8, - 4.0, 4.3, 4.7, 4.9, 5.0, 5.5, 6.0, 6.5, 6.8, 7.0, - 7.3, 7.5, 7.8, 8.0, 8.4, 8.7, 9.0, 9.4, 9.6, 9.8, - 10.0 - ]; - - function multiply(matrix1, matrix2) { - var i, j, k, val, col = [], out = new Array(10); - - for (i = 0; i < 5; i++) { - for (j = 0; j < 5; j++) { - col[j] = matrix2[j + i * 5]; - } - - for (j = 0; j < 5; j++) { - val = 0; - - for (k = 0; k < 5; k++) { - val += matrix1[j + k * 5] * col[k]; + function getInnerRect() { + return getRelativeRect(clampRect, currentRect); + } + function moveRect(handle, startRect, deltaX, deltaY) { + var x, y, w, h, rect; + x = startRect.x; + y = startRect.y; + w = startRect.w; + h = startRect.h; + x += deltaX * handle.deltaX; + y += deltaY * handle.deltaY; + w += deltaX * handle.deltaW; + h += deltaY * handle.deltaH; + if (w < 20) { + w = 20; + } + if (h < 20) { + h = 20; + } + rect = currentRect = Rect.clamp({ + x: x, + y: y, + w: w, + h: h + }, clampRect, handle.name === 'move'); + rect = getRelativeRect(clampRect, rect); + instance.fire('updateRect', { rect: rect }); + setInnerRect(rect); + } + function render() { + function createDragHelper(handle) { + var startRect; + var DragHelper = Factory.get('DragHelper'); + return new DragHelper(id, { + document: containerElm.ownerDocument, + handle: id + '-' + handle.name, + start: function () { + startRect = currentRect; + }, + drag: function (e) { + moveRect(handle, startRect, e.deltaX, e.deltaY); } - - out[j + i * 5] = val; - } + }); } - - return out; - } - - function adjust(matrix, adjustValue) { - adjustValue = clamp(adjustValue, 0, 1); - - return matrix.map(function (value, index) { - if (index % 6 === 0) { - value = 1.0 - ((1 - value) * adjustValue); - } else { - value *= adjustValue; + DomQuery('
    ').appendTo(containerElm); + Tools.each(blockers, function (blocker) { + DomQuery('#' + id, containerElm).append('