From ea1ca3d1ee00f5dccb2929f8dd546f403a82d51c Mon Sep 17 00:00:00 2001 From: Kiran Jonnalagadda Date: Sat, 13 May 2023 23:26:36 +0530 Subject: [PATCH] Add TinyMCE4 to the repository; it's outdated but still used in Hasjob (#406) --- .gitignore | 1 - .prettierignore | 5 + CHANGES.rst | 2 + src/baseframe/Makefile | 8 - src/baseframe/assets.py | 1 - .../static/js/tinymce4/jquery.tinymce.min.js | 214 ++ .../static/js/tinymce4/langs/readme.md | 3 + src/baseframe/static/js/tinymce4/license.txt | 502 +++ .../js/tinymce4/plugins/advlist/plugin.min.js | 83 + .../js/tinymce4/plugins/anchor/plugin.min.js | 42 + .../tinymce4/plugins/autolink/plugin.min.js | 107 + .../tinymce4/plugins/autoresize/plugin.min.js | 102 + .../tinymce4/plugins/autosave/plugin.min.js | 112 + .../js/tinymce4/plugins/bbcode/plugin.min.js | 125 + .../js/tinymce4/plugins/charmap/plugin.min.js | 364 +++ .../js/tinymce4/plugins/code/plugin.min.js | 36 + .../tinymce4/plugins/codesample/css/prism.css | 141 + .../tinymce4/plugins/codesample/plugin.min.js | 864 ++++++ .../plugins/colorpicker/plugin.min.js | 81 + .../plugins/contextmenu/plugin.min.js | 46 + .../plugins/directionality/plugin.min.js | 39 + .../plugins/emoticons/img/smiley-cool.gif | Bin 0 -> 354 bytes .../plugins/emoticons/img/smiley-cry.gif | Bin 0 -> 329 bytes .../emoticons/img/smiley-embarassed.gif | Bin 0 -> 331 bytes .../emoticons/img/smiley-foot-in-mouth.gif | Bin 0 -> 342 bytes .../plugins/emoticons/img/smiley-frown.gif | Bin 0 -> 340 bytes .../plugins/emoticons/img/smiley-innocent.gif | Bin 0 -> 336 bytes .../plugins/emoticons/img/smiley-kiss.gif | Bin 0 -> 338 bytes .../plugins/emoticons/img/smiley-laughing.gif | Bin 0 -> 343 bytes .../emoticons/img/smiley-money-mouth.gif | Bin 0 -> 321 bytes .../plugins/emoticons/img/smiley-sealed.gif | Bin 0 -> 323 bytes .../plugins/emoticons/img/smiley-smile.gif | Bin 0 -> 344 bytes .../emoticons/img/smiley-surprised.gif | Bin 0 -> 338 bytes .../emoticons/img/smiley-tongue-out.gif | Bin 0 -> 328 bytes .../emoticons/img/smiley-undecided.gif | Bin 0 -> 337 bytes .../plugins/emoticons/img/smiley-wink.gif | Bin 0 -> 350 bytes .../plugins/emoticons/img/smiley-yell.gif | Bin 0 -> 336 bytes .../tinymce4/plugins/emoticons/plugin.min.js | 53 + .../js/tinymce4/plugins/example/dialog.html | 12 + .../js/tinymce4/plugins/example/plugin.min.js | 40 + .../plugins/example_dependency/plugin.min.js | 1 + .../tinymce4/plugins/fullpage/plugin.min.js | 312 ++ .../tinymce4/plugins/fullscreen/plugin.min.js | 99 + .../js/tinymce4/plugins/hr/plugin.min.js | 16 + .../js/tinymce4/plugins/image/plugin.min.js | 451 +++ .../tinymce4/plugins/imagetools/plugin.min.js | 1799 +++++++++++ .../tinymce4/plugins/importcss/plugin.min.js | 129 + .../plugins/insertdatetime/plugin.min.js | 88 + .../js/tinymce4/plugins/layer/plugin.min.js | 156 + .../plugins/legacyoutput/plugin.min.js | 142 + .../js/tinymce4/plugins/link/plugin.min.js | 294 ++ .../js/tinymce4/plugins/lists/plugin.min.js | 466 +++ .../js/tinymce4/plugins/media/moxieplayer.swf | Bin 0 -> 20017 bytes .../js/tinymce4/plugins/media/plugin.min.js | 728 +++++ .../plugins/nonbreaking/plugin.min.js | 32 + .../plugins/noneditable/plugin.min.js | 65 + .../tinymce4/plugins/pagebreak/plugin.min.js | 60 + .../js/tinymce4/plugins/paste/plugin.min.js | 910 ++++++ .../js/tinymce4/plugins/preview/plugin.min.js | 68 + .../js/tinymce4/plugins/print/plugin.min.js | 14 + .../js/tinymce4/plugins/save/plugin.min.js | 53 + .../plugins/searchreplace/plugin.min.js | 450 +++ .../plugins/spellchecker/plugin.min.js | 617 ++++ .../tinymce4/plugins/tabfocus/plugin.min.js | 73 + .../js/tinymce4/plugins/table/plugin.min.js | 2732 +++++++++++++++++ .../tinymce4/plugins/template/plugin.min.js | 231 ++ .../tinymce4/plugins/textcolor/plugin.min.js | 253 ++ .../plugins/textpattern/plugin.min.js | 162 + .../plugins/visualblocks/css/visualblocks.css | 154 + .../plugins/visualblocks/plugin.min.js | 55 + .../plugins/visualchars/plugin.min.js | 95 + .../tinymce4/plugins/wordcount/plugin.min.js | 52 + .../skins/lightgray/content.inline.min.css | 152 + .../tinymce4/skins/lightgray/content.min.css | 171 ++ .../skins/lightgray/fonts/tinymce-small.eot | Bin 0 -> 9492 bytes .../skins/lightgray/fonts/tinymce-small.svg | 63 + .../skins/lightgray/fonts/tinymce-small.ttf | Bin 0 -> 9304 bytes .../skins/lightgray/fonts/tinymce-small.woff | Bin 0 -> 9380 bytes .../skins/lightgray/fonts/tinymce.eot | Bin 0 -> 14308 bytes .../skins/lightgray/fonts/tinymce.svg | 98 + .../skins/lightgray/fonts/tinymce.ttf | Bin 0 -> 14144 bytes .../skins/lightgray/fonts/tinymce.woff | Bin 0 -> 14220 bytes .../tinymce4/skins/lightgray/img/anchor.gif | Bin 0 -> 53 bytes .../tinymce4/skins/lightgray/img/loader.gif | Bin 0 -> 2608 bytes .../tinymce4/skins/lightgray/img/object.gif | Bin 0 -> 152 bytes .../js/tinymce4/skins/lightgray/img/trans.gif | Bin 0 -> 43 bytes .../tinymce4/skins/lightgray/skin.ie7.min.css | 1913 ++++++++++++ .../js/tinymce4/skins/lightgray/skin.min.css | 1918 ++++++++++++ .../js/tinymce4/themes/modern/theme.min.js | 502 +++ .../static/js/tinymce4/tinymce.min.js | 12 + 90 files changed, 18559 insertions(+), 10 deletions(-) create mode 100644 .prettierignore create mode 100644 src/baseframe/static/js/tinymce4/jquery.tinymce.min.js create mode 100644 src/baseframe/static/js/tinymce4/langs/readme.md create mode 100644 src/baseframe/static/js/tinymce4/license.txt create mode 100644 src/baseframe/static/js/tinymce4/plugins/advlist/plugin.min.js create mode 100644 src/baseframe/static/js/tinymce4/plugins/anchor/plugin.min.js create mode 100644 src/baseframe/static/js/tinymce4/plugins/autolink/plugin.min.js create mode 100644 src/baseframe/static/js/tinymce4/plugins/autoresize/plugin.min.js create mode 100644 src/baseframe/static/js/tinymce4/plugins/autosave/plugin.min.js create mode 100644 src/baseframe/static/js/tinymce4/plugins/bbcode/plugin.min.js create mode 100644 src/baseframe/static/js/tinymce4/plugins/charmap/plugin.min.js create mode 100644 src/baseframe/static/js/tinymce4/plugins/code/plugin.min.js create mode 100644 src/baseframe/static/js/tinymce4/plugins/codesample/css/prism.css create mode 100644 src/baseframe/static/js/tinymce4/plugins/codesample/plugin.min.js create mode 100644 src/baseframe/static/js/tinymce4/plugins/colorpicker/plugin.min.js create mode 100644 src/baseframe/static/js/tinymce4/plugins/contextmenu/plugin.min.js create mode 100644 src/baseframe/static/js/tinymce4/plugins/directionality/plugin.min.js create mode 100644 src/baseframe/static/js/tinymce4/plugins/emoticons/img/smiley-cool.gif create mode 100644 src/baseframe/static/js/tinymce4/plugins/emoticons/img/smiley-cry.gif create mode 100644 src/baseframe/static/js/tinymce4/plugins/emoticons/img/smiley-embarassed.gif create mode 100644 src/baseframe/static/js/tinymce4/plugins/emoticons/img/smiley-foot-in-mouth.gif create mode 100644 src/baseframe/static/js/tinymce4/plugins/emoticons/img/smiley-frown.gif create mode 100644 src/baseframe/static/js/tinymce4/plugins/emoticons/img/smiley-innocent.gif create mode 100644 src/baseframe/static/js/tinymce4/plugins/emoticons/img/smiley-kiss.gif create mode 100644 src/baseframe/static/js/tinymce4/plugins/emoticons/img/smiley-laughing.gif create mode 100644 src/baseframe/static/js/tinymce4/plugins/emoticons/img/smiley-money-mouth.gif create mode 100644 src/baseframe/static/js/tinymce4/plugins/emoticons/img/smiley-sealed.gif create mode 100644 src/baseframe/static/js/tinymce4/plugins/emoticons/img/smiley-smile.gif create mode 100644 src/baseframe/static/js/tinymce4/plugins/emoticons/img/smiley-surprised.gif create mode 100644 src/baseframe/static/js/tinymce4/plugins/emoticons/img/smiley-tongue-out.gif create mode 100644 src/baseframe/static/js/tinymce4/plugins/emoticons/img/smiley-undecided.gif create mode 100644 src/baseframe/static/js/tinymce4/plugins/emoticons/img/smiley-wink.gif create mode 100644 src/baseframe/static/js/tinymce4/plugins/emoticons/img/smiley-yell.gif create mode 100644 src/baseframe/static/js/tinymce4/plugins/emoticons/plugin.min.js create mode 100644 src/baseframe/static/js/tinymce4/plugins/example/dialog.html create mode 100644 src/baseframe/static/js/tinymce4/plugins/example/plugin.min.js create mode 100644 src/baseframe/static/js/tinymce4/plugins/example_dependency/plugin.min.js create mode 100644 src/baseframe/static/js/tinymce4/plugins/fullpage/plugin.min.js create mode 100644 src/baseframe/static/js/tinymce4/plugins/fullscreen/plugin.min.js create mode 100644 src/baseframe/static/js/tinymce4/plugins/hr/plugin.min.js create mode 100644 src/baseframe/static/js/tinymce4/plugins/image/plugin.min.js create mode 100644 src/baseframe/static/js/tinymce4/plugins/imagetools/plugin.min.js create mode 100644 src/baseframe/static/js/tinymce4/plugins/importcss/plugin.min.js create mode 100644 src/baseframe/static/js/tinymce4/plugins/insertdatetime/plugin.min.js create mode 100644 src/baseframe/static/js/tinymce4/plugins/layer/plugin.min.js create mode 100644 src/baseframe/static/js/tinymce4/plugins/legacyoutput/plugin.min.js create mode 100644 src/baseframe/static/js/tinymce4/plugins/link/plugin.min.js create mode 100644 src/baseframe/static/js/tinymce4/plugins/lists/plugin.min.js create mode 100644 src/baseframe/static/js/tinymce4/plugins/media/moxieplayer.swf create mode 100644 src/baseframe/static/js/tinymce4/plugins/media/plugin.min.js create mode 100644 src/baseframe/static/js/tinymce4/plugins/nonbreaking/plugin.min.js create mode 100644 src/baseframe/static/js/tinymce4/plugins/noneditable/plugin.min.js create mode 100644 src/baseframe/static/js/tinymce4/plugins/pagebreak/plugin.min.js create mode 100644 src/baseframe/static/js/tinymce4/plugins/paste/plugin.min.js create mode 100644 src/baseframe/static/js/tinymce4/plugins/preview/plugin.min.js create mode 100644 src/baseframe/static/js/tinymce4/plugins/print/plugin.min.js create mode 100644 src/baseframe/static/js/tinymce4/plugins/save/plugin.min.js create mode 100644 src/baseframe/static/js/tinymce4/plugins/searchreplace/plugin.min.js create mode 100644 src/baseframe/static/js/tinymce4/plugins/spellchecker/plugin.min.js create mode 100644 src/baseframe/static/js/tinymce4/plugins/tabfocus/plugin.min.js create mode 100644 src/baseframe/static/js/tinymce4/plugins/table/plugin.min.js create mode 100644 src/baseframe/static/js/tinymce4/plugins/template/plugin.min.js create mode 100644 src/baseframe/static/js/tinymce4/plugins/textcolor/plugin.min.js create mode 100644 src/baseframe/static/js/tinymce4/plugins/textpattern/plugin.min.js create mode 100644 src/baseframe/static/js/tinymce4/plugins/visualblocks/css/visualblocks.css create mode 100644 src/baseframe/static/js/tinymce4/plugins/visualblocks/plugin.min.js create mode 100644 src/baseframe/static/js/tinymce4/plugins/visualchars/plugin.min.js create mode 100644 src/baseframe/static/js/tinymce4/plugins/wordcount/plugin.min.js create mode 100644 src/baseframe/static/js/tinymce4/skins/lightgray/content.inline.min.css create mode 100644 src/baseframe/static/js/tinymce4/skins/lightgray/content.min.css create mode 100644 src/baseframe/static/js/tinymce4/skins/lightgray/fonts/tinymce-small.eot create mode 100644 src/baseframe/static/js/tinymce4/skins/lightgray/fonts/tinymce-small.svg create mode 100644 src/baseframe/static/js/tinymce4/skins/lightgray/fonts/tinymce-small.ttf create mode 100644 src/baseframe/static/js/tinymce4/skins/lightgray/fonts/tinymce-small.woff create mode 100644 src/baseframe/static/js/tinymce4/skins/lightgray/fonts/tinymce.eot create mode 100644 src/baseframe/static/js/tinymce4/skins/lightgray/fonts/tinymce.svg create mode 100644 src/baseframe/static/js/tinymce4/skins/lightgray/fonts/tinymce.ttf create mode 100644 src/baseframe/static/js/tinymce4/skins/lightgray/fonts/tinymce.woff create mode 100644 src/baseframe/static/js/tinymce4/skins/lightgray/img/anchor.gif create mode 100644 src/baseframe/static/js/tinymce4/skins/lightgray/img/loader.gif create mode 100644 src/baseframe/static/js/tinymce4/skins/lightgray/img/object.gif create mode 100644 src/baseframe/static/js/tinymce4/skins/lightgray/img/trans.gif create mode 100644 src/baseframe/static/js/tinymce4/skins/lightgray/skin.ie7.min.css create mode 100644 src/baseframe/static/js/tinymce4/skins/lightgray/skin.min.css create mode 100644 src/baseframe/static/js/tinymce4/themes/modern/theme.min.js create mode 100644 src/baseframe/static/js/tinymce4/tinymce.min.js diff --git a/.gitignore b/.gitignore index 52ac568d..6468f13a 100644 --- a/.gitignore +++ b/.gitignore @@ -15,7 +15,6 @@ dist/ src/baseframe/static/css/packed.css src/baseframe/static/js/packed.js src/baseframe/static/js/tinymce3 -src/baseframe/static/js/tinymce4 src/baseframe/static/js/codemirror .cache .pytest_cache diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000..6da5daa2 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,5 @@ +**/.git +**/.svn +**/.hg +**/node_modules +**/*.min.js diff --git a/CHANGES.rst b/CHANGES.rst index acdee964..1644a4ac 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -6,6 +6,8 @@ * Fixed DateTimeField to handle a variety of date and time specifications * Switched back to Flask-Babel * Baseframe now uses ``src`` folder layout and ``pyproject.toml`` +* TinyMCE4 is now part of the repository as it's no longer available for + download; other obsolete static files have been removed 0.3.2 ----- diff --git a/src/baseframe/Makefile b/src/baseframe/Makefile index f528179a..3078d97d 100644 --- a/src/baseframe/Makefile +++ b/src/baseframe/Makefile @@ -1,17 +1,9 @@ # Makefile for tinymce all: tinymce codemirror -tinymce4_zip = tinymce_4.3.0_jquery.zip codemirror_package = codemirror5 codemirror_ver = 4.11.0 -tinymce: - curl -L -O http://download.moxiecode.com/tinymce/$(tinymce4_zip) - unzip $(tinymce4_zip) - rm -rf static/js/tinymce4 - mv tinymce/js/tinymce static/js/tinymce4 - rm -rf $(tinymce4_zip) tinymce - codemirror: curl -L -O https://github.com/codemirror/${codemirror_package}/archive/$(codemirror_ver).zip unzip $(codemirror_ver).zip diff --git a/src/baseframe/assets.py b/src/baseframe/assets.py index a8040e83..b3bdf375 100644 --- a/src/baseframe/assets.py +++ b/src/baseframe/assets.py @@ -487,7 +487,6 @@ 'requires': [ 'extra-material.js', 'mui.js', - 'jquery.tinymce.js>=4.0.0', 'baseframe-material.js', ] } diff --git a/src/baseframe/static/js/tinymce4/jquery.tinymce.min.js b/src/baseframe/static/js/tinymce4/jquery.tinymce.min.js new file mode 100644 index 00000000..667e6b98 --- /dev/null +++ b/src/baseframe/static/js/tinymce4/jquery.tinymce.min.js @@ -0,0 +1,214 @@ +!(function (a) { + function b() { + function b(a) { + 'remove' === a && + this.each(function (a, b) { + var c = e(b); + c && c.remove(); + }), + this.find('span.mceEditor,div.mceEditor').each(function (a, b) { + var c = tinymce.get(b.id.replace(/_parent$/, '')); + c && c.remove(); + }); + } + function d(a) { + var c, + d = this; + if (null != a) + b.call(d), + d.each(function (b, c) { + var d; + (d = tinymce.get(c.id)) && d.setContent(a); + }); + else if (d.length > 0 && (c = tinymce.get(d[0].id))) + return c.getContent(); + } + function e(a) { + var b = null; + return a && a.id && g.tinymce && (b = tinymce.get(a.id)), b; + } + function f(a) { + return !!(a && a.length && g.tinymce && a.is(':tinymce')); + } + var h = {}; + a.each(['text', 'html', 'val'], function (b, g) { + var i = (h[g] = a.fn[g]), + j = 'text' === g; + a.fn[g] = function (b) { + var g = this; + if (!f(g)) return i.apply(g, arguments); + if (b !== c) + return ( + d.call(g.filter(':tinymce'), b), + i.apply(g.not(':tinymce'), arguments), + g + ); + var h = '', + k = arguments; + return ( + (j ? g : g.eq(0)).each(function (b, c) { + var d = e(c); + h += d + ? j + ? d.getContent().replace(/<(?:"[^"]*"|'[^']*'|[^'">])*>/g, '') + : d.getContent({ save: !0 }) + : i.apply(a(c), k); + }), + h + ); + }; + }), + a.each(['append', 'prepend'], function (b, d) { + var g = (h[d] = a.fn[d]), + i = 'prepend' === d; + a.fn[d] = function (a) { + var b = this; + return f(b) + ? a !== c + ? ('string' == typeof a && + b.filter(':tinymce').each(function (b, c) { + var d = e(c); + d && + d.setContent(i ? a + d.getContent() : d.getContent() + a); + }), + g.apply(b.not(':tinymce'), arguments), + b) + : void 0 + : g.apply(b, arguments); + }; + }), + a.each(['remove', 'replaceWith', 'replaceAll', 'empty'], function (c, d) { + var e = (h[d] = a.fn[d]); + a.fn[d] = function () { + return b.call(this, d), e.apply(this, arguments); + }; + }), + (h.attr = a.fn.attr), + (a.fn.attr = function (b, g) { + var i = this, + j = arguments; + if (!b || 'value' !== b || !f(i)) + return g !== c ? h.attr.apply(i, j) : h.attr.apply(i, j); + if (g !== c) + return ( + d.call(i.filter(':tinymce'), g), + h.attr.apply(i.not(':tinymce'), j), + i + ); + var k = i[0], + l = e(k); + return l ? l.getContent({ save: !0 }) : h.attr.apply(a(k), j); + }); + } + var c, + d, + e, + f = [], + g = window; + (a.fn.tinymce = function (c) { + function h() { + var d = [], + f = 0; + e || (b(), (e = !0)), + l.each(function (a, b) { + var e, + g = b.id, + h = c.oninit; + g || (b.id = g = tinymce.DOM.uniqueId()), + tinymce.get(g) || + ((e = new tinymce.Editor(g, c, tinymce.EditorManager)), + d.push(e), + e.on('init', function () { + var a, + b = h; + l.css('visibility', ''), + h && + ++f == d.length && + ('string' == typeof b && + ((a = + -1 === b.indexOf('.') + ? null + : tinymce.resolve(b.replace(/\.\w+$/, ''))), + (b = tinymce.resolve(b))), + b.apply(a || tinymce, d)); + })); + }), + a.each(d, function (a, b) { + b.render(); + }); + } + var i, + j, + k, + l = this, + m = ''; + if (!l.length) return l; + if (!c) return window.tinymce ? tinymce.get(l[0].id) : null; + if ((l.css('visibility', 'hidden'), g.tinymce || d || !(i = c.script_url))) + 1 === d ? f.push(h) : h(); + else { + (d = 1), + (j = i.substring(0, i.lastIndexOf('/'))), + -1 != i.indexOf('.min') && (m = '.min'), + (g.tinymce = g.tinyMCEPreInit || { base: j, suffix: m }), + -1 != i.indexOf('gzip') && + ((k = c.language || 'en'), + (i = + i + + (/\?/.test(i) ? '&' : '?') + + 'js=true&core=true&suffix=' + + escape(m) + + '&themes=' + + escape(c.theme || 'modern') + + '&plugins=' + + escape(c.plugins || '') + + '&languages=' + + (k || '')), + g.tinyMCE_GZ || + (g.tinyMCE_GZ = { + start: function () { + function b(a) { + tinymce.ScriptLoader.markDone(tinymce.baseURI.toAbsolute(a)); + } + b('langs/' + k + '.js'), + b('themes/' + c.theme + '/theme' + m + '.js'), + b('themes/' + c.theme + '/langs/' + k + '.js'), + a.each(c.plugins.split(','), function (a, c) { + c && + (b('plugins/' + c + '/plugin' + m + '.js'), + b('plugins/' + c + '/langs/' + k + '.js')); + }); + }, + end: function () {}, + })); + var n = document.createElement('script'); + (n.type = 'text/javascript'), + (n.onload = n.onreadystatechange = + function (b) { + (b = b || window.event), + 2 === d || + ('load' != b.type && !/complete|loaded/.test(n.readyState)) || + ((tinymce.dom.Event.domLoaded = 1), + (d = 2), + c.script_loaded && c.script_loaded(), + h(), + a.each(f, function (a, b) { + b(); + })); + }), + (n.src = i), + document.body.appendChild(n); + } + return l; + }), + a.extend(a.expr[':'], { + tinymce: function (a) { + var b; + return a.id && + 'tinymce' in window && + ((b = tinymce.get(a.id)), b && b.editorManager === tinymce) + ? !0 + : !1; + }, + }); +})(jQuery); diff --git a/src/baseframe/static/js/tinymce4/langs/readme.md b/src/baseframe/static/js/tinymce4/langs/readme.md new file mode 100644 index 00000000..a52bf03f --- /dev/null +++ b/src/baseframe/static/js/tinymce4/langs/readme.md @@ -0,0 +1,3 @@ +This is where language files should be placed. + +Please DO NOT translate these directly use this service: https://www.transifex.com/projects/p/tinymce/ diff --git a/src/baseframe/static/js/tinymce4/license.txt b/src/baseframe/static/js/tinymce4/license.txt new file mode 100644 index 00000000..9c6a6cc3 --- /dev/null +++ b/src/baseframe/static/js/tinymce4/license.txt @@ -0,0 +1,502 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! diff --git a/src/baseframe/static/js/tinymce4/plugins/advlist/plugin.min.js b/src/baseframe/static/js/tinymce4/plugins/advlist/plugin.min.js new file mode 100644 index 00000000..41ec9148 --- /dev/null +++ b/src/baseframe/static/js/tinymce4/plugins/advlist/plugin.min.js @@ -0,0 +1,83 @@ +tinymce.PluginManager.add('advlist', function (a) { + function b(a, b) { + var c = []; + return ( + tinymce.each(b.split(/[ ,]/), function (a) { + c.push({ + text: a.replace(/\-/g, ' ').replace(/\b\w/g, function (a) { + return a.toUpperCase(); + }), + data: 'default' == a ? '' : a, + }); + }), + c + ); + } + function c(b, c) { + a.undoManager.transact(function () { + var d, + e = a.dom, + f = a.selection; + (d = e.getParent(f.getNode(), 'ol,ul')), + (d && d.nodeName == b && c !== !1) || + a.execCommand( + 'UL' == b ? 'InsertUnorderedList' : 'InsertOrderedList' + ), + (c = c === !1 ? g[b] : c), + (g[b] = c), + (d = e.getParent(f.getNode(), 'ol,ul')), + d && + (e.setStyle(d, 'listStyleType', c ? c : null), + d.removeAttribute('data-mce-style')), + a.focus(); + }); + } + function d(b) { + var c = + a.dom.getStyle( + a.dom.getParent(a.selection.getNode(), 'ol,ul'), + 'listStyleType' + ) || ''; + b.control.items().each(function (a) { + a.active(a.settings.data === c); + }); + } + var e, + f, + g = {}; + (e = b( + 'OL', + a.getParam( + 'advlist_number_styles', + 'default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman' + ) + )), + (f = b( + 'UL', + a.getParam('advlist_bullet_styles', 'default,circle,disc,square') + )), + a.addButton('numlist', { + type: 'splitbutton', + tooltip: 'Numbered list', + menu: e, + onshow: d, + onselect: function (a) { + c('OL', a.control.settings.data); + }, + onclick: function () { + c('OL', !1); + }, + }), + a.addButton('bullist', { + type: 'splitbutton', + tooltip: 'Bullet list', + menu: f, + onshow: d, + onselect: function (a) { + c('UL', a.control.settings.data); + }, + onclick: function () { + c('UL', !1); + }, + }); +}); diff --git a/src/baseframe/static/js/tinymce4/plugins/anchor/plugin.min.js b/src/baseframe/static/js/tinymce4/plugins/anchor/plugin.min.js new file mode 100644 index 00000000..79d9a79b --- /dev/null +++ b/src/baseframe/static/js/tinymce4/plugins/anchor/plugin.min.js @@ -0,0 +1,42 @@ +tinymce.PluginManager.add('anchor', function (a) { + function b() { + var b = a.selection.getNode(), + c = '', + d = 'A' == b.tagName && '' === a.dom.getAttrib(b, 'href'); + d && (c = b.name || b.id || ''), + a.windowManager.open({ + title: 'Anchor', + body: { + type: 'textbox', + name: 'name', + size: 40, + label: 'Name', + value: c, + }, + onsubmit: function (c) { + var e = c.data.name; + d + ? (b.id = e) + : (a.selection.collapse(!0), + a.execCommand( + 'mceInsertContent', + !1, + a.dom.createHTML('a', { id: e }) + )); + }, + }); + } + a.addCommand('mceAnchor', b), + a.addButton('anchor', { + icon: 'anchor', + tooltip: 'Anchor', + onclick: b, + stateSelector: 'a:not([href])', + }), + a.addMenuItem('anchor', { + icon: 'anchor', + text: 'Anchor', + context: 'insert', + onclick: b, + }); +}); diff --git a/src/baseframe/static/js/tinymce4/plugins/autolink/plugin.min.js b/src/baseframe/static/js/tinymce4/plugins/autolink/plugin.min.js new file mode 100644 index 00000000..b1717c5a --- /dev/null +++ b/src/baseframe/static/js/tinymce4/plugins/autolink/plugin.min.js @@ -0,0 +1,107 @@ +tinymce.PluginManager.add('autolink', function (a) { + function b(a) { + e(a, -1, '(', !0); + } + function c(a) { + e(a, 0, '', !0); + } + function d(a) { + e(a, -1, '', !1); + } + function e(a, b, c) { + function d(a, b) { + if ((0 > b && (b = 0), 3 == a.nodeType)) { + var c = a.data.length; + b > c && (b = c); + } + return b; + } + function e(a, b) { + 1 != a.nodeType || a.hasChildNodes() + ? g.setStart(a, d(a, b)) + : g.setStartBefore(a); + } + function f(a, b) { + 1 != a.nodeType || a.hasChildNodes() + ? g.setEnd(a, d(a, b)) + : g.setEndAfter(a); + } + var g, h, i, j, k, l, m, n, o, p; + if ('A' != a.selection.getNode().tagName) { + if (((g = a.selection.getRng(!0).cloneRange()), g.startOffset < 5)) { + if (((n = g.endContainer.previousSibling), !n)) { + if ( + !g.endContainer.firstChild || + !g.endContainer.firstChild.nextSibling + ) + return; + n = g.endContainer.firstChild.nextSibling; + } + if (((o = n.length), e(n, o), f(n, o), g.endOffset < 5)) return; + (h = g.endOffset), (j = n); + } else { + if (((j = g.endContainer), 3 != j.nodeType && j.firstChild)) { + for (; 3 != j.nodeType && j.firstChild; ) j = j.firstChild; + 3 == j.nodeType && (e(j, 0), f(j, j.nodeValue.length)); + } + h = 1 == g.endOffset ? 2 : g.endOffset - 1 - b; + } + i = h; + do + e(j, h >= 2 ? h - 2 : 0), + f(j, h >= 1 ? h - 1 : 0), + (h -= 1), + (p = g.toString()); + while ( + ' ' != p && + '' !== p && + 160 != p.charCodeAt(0) && + h - 2 >= 0 && + p != c + ); + g.toString() == c || 160 == g.toString().charCodeAt(0) + ? (e(j, h), f(j, i), (h += 1)) + : 0 === g.startOffset + ? (e(j, 0), f(j, i)) + : (e(j, h), f(j, i)), + (l = g.toString()), + '.' == l.charAt(l.length - 1) && f(j, i - 1), + (l = g.toString()), + (m = l.match( + /^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.|(?:mailto:)?[A-Z0-9._%+\-]+@)(.+)$/i + )), + m && + ('www.' == m[1] + ? (m[1] = 'http://www.') + : /@$/.test(m[1]) && + !/^mailto:/.test(m[1]) && + (m[1] = 'mailto:' + m[1]), + (k = a.selection.getBookmark()), + a.selection.setRng(g), + a.execCommand('createlink', !1, m[1] + m[2]), + a.selection.moveToBookmark(k), + a.nodeChanged()); + } + } + var f; + return ( + a.on('keydown', function (b) { + return 13 == b.keyCode ? d(a) : void 0; + }), + tinymce.Env.ie + ? void a.on('focus', function () { + if (!f) { + f = !0; + try { + a.execCommand('AutoUrlDetect', !1, !0); + } catch (b) {} + } + }) + : (a.on('keypress', function (c) { + return 41 == c.keyCode ? b(a) : void 0; + }), + void a.on('keyup', function (b) { + return 32 == b.keyCode ? c(a) : void 0; + })) + ); +}); diff --git a/src/baseframe/static/js/tinymce4/plugins/autoresize/plugin.min.js b/src/baseframe/static/js/tinymce4/plugins/autoresize/plugin.min.js new file mode 100644 index 00000000..fe60a5d4 --- /dev/null +++ b/src/baseframe/static/js/tinymce4/plugins/autoresize/plugin.min.js @@ -0,0 +1,102 @@ +tinymce.PluginManager.add('autoresize', function (a) { + function b() { + return a.plugins.fullscreen && a.plugins.fullscreen.isFullscreen(); + } + function c(d) { + var g, + h, + i, + j, + k, + l, + m, + n, + o, + p, + q, + r, + s = tinymce.DOM; + if ((h = a.getDoc())) { + if ( + ((i = h.body), + (j = h.documentElement), + (k = e.autoresize_min_height), + !i || (d && 'setcontent' === d.type && d.initial) || b()) + ) + return void ( + i && + j && + ((i.style.overflowY = 'auto'), (j.style.overflowY = 'auto')) + ); + (m = a.dom.getStyle(i, 'margin-top', !0)), + (n = a.dom.getStyle(i, 'margin-bottom', !0)), + (o = a.dom.getStyle(i, 'padding-top', !0)), + (p = a.dom.getStyle(i, 'padding-bottom', !0)), + (q = a.dom.getStyle(i, 'border-top-width', !0)), + (r = a.dom.getStyle(i, 'border-bottom-width', !0)), + (l = + i.offsetHeight + + parseInt(m, 10) + + parseInt(n, 10) + + parseInt(o, 10) + + parseInt(p, 10) + + parseInt(q, 10) + + parseInt(r, 10)), + (isNaN(l) || 0 >= l) && + (l = tinymce.Env.ie + ? i.scrollHeight + : tinymce.Env.webkit && 0 === i.clientHeight + ? 0 + : i.offsetHeight), + l > e.autoresize_min_height && (k = l), + e.autoresize_max_height && l > e.autoresize_max_height + ? ((k = e.autoresize_max_height), + (i.style.overflowY = 'auto'), + (j.style.overflowY = 'auto')) + : ((i.style.overflowY = 'hidden'), + (j.style.overflowY = 'hidden'), + (i.scrollTop = 0)), + k !== f && + ((g = k - f), + s.setStyle(a.iframeElement, 'height', k + 'px'), + (f = k), + tinymce.isWebKit && 0 > g && c(d)); + } + } + function d(b, e, f) { + tinymce.util.Delay.setEditorTimeout( + a, + function () { + c({}), b-- ? d(b, e, f) : f && f(); + }, + e + ); + } + var e = a.settings, + f = 0; + a.settings.inline || + ((e.autoresize_min_height = parseInt( + a.getParam('autoresize_min_height', a.getElement().offsetHeight), + 10 + )), + (e.autoresize_max_height = parseInt( + a.getParam('autoresize_max_height', 0), + 10 + )), + a.on('init', function () { + var b, c; + (b = a.getParam('autoresize_overflow_padding', 1)), + (c = a.getParam('autoresize_bottom_margin', 50)), + b !== !1 && + a.dom.setStyles(a.getBody(), { paddingLeft: b, paddingRight: b }), + c !== !1 && a.dom.setStyles(a.getBody(), { paddingBottom: c }); + }), + a.on('nodechange setcontent keyup FullscreenStateChanged', c), + a.getParam('autoresize_on_init', !0) && + a.on('init', function () { + d(20, 100, function () { + d(5, 1e3); + }); + }), + a.addCommand('mceAutoResize', c)); +}); diff --git a/src/baseframe/static/js/tinymce4/plugins/autosave/plugin.min.js b/src/baseframe/static/js/tinymce4/plugins/autosave/plugin.min.js new file mode 100644 index 00000000..22f0a9ac --- /dev/null +++ b/src/baseframe/static/js/tinymce4/plugins/autosave/plugin.min.js @@ -0,0 +1,112 @@ +(tinymce._beforeUnloadHandler = function () { + var a; + return ( + tinymce.each(tinymce.editors, function (b) { + b.plugins.autosave && b.plugins.autosave.storeDraft(), + !a && + b.isDirty() && + b.getParam('autosave_ask_before_unload', !0) && + (a = b.translate( + 'You have unsaved changes are you sure you want to navigate away?' + )); + }), + a + ); +}), + tinymce.PluginManager.add('autosave', function (a) { + function b(a, b) { + var c = { s: 1e3, m: 6e4 }; + return ( + (a = /^(\d+)([ms]?)$/.exec('' + (a || b))), + (a[2] ? c[a[2]] : 1) * parseInt(a, 10) + ); + } + function c() { + var a = parseInt(n.getItem(k + 'time'), 10) || 0; + return new Date().getTime() - a > m.autosave_retention ? (d(!1), !1) : !0; + } + function d(b) { + n.removeItem(k + 'draft'), + n.removeItem(k + 'time'), + b !== !1 && a.fire('RemoveDraft'); + } + function e() { + !j() && + a.isDirty() && + (n.setItem(k + 'draft', a.getContent({ format: 'raw', no_events: !0 })), + n.setItem(k + 'time', new Date().getTime()), + a.fire('StoreDraft')); + } + function f() { + c() && + (a.setContent(n.getItem(k + 'draft'), { format: 'raw' }), + a.fire('RestoreDraft')); + } + function g() { + l || + (setInterval(function () { + a.removed || e(); + }, m.autosave_interval), + (l = !0)); + } + function h() { + var b = this; + b.disabled(!c()), + a.on('StoreDraft RestoreDraft RemoveDraft', function () { + b.disabled(!c()); + }), + g(); + } + function i() { + a.undoManager.beforeChange(), f(), d(), a.undoManager.add(); + } + function j(b) { + var c = a.settings.forced_root_block; + return ( + (b = tinymce.trim('undefined' == typeof b ? a.getBody().innerHTML : b)), + '' === b || + new RegExp( + '^<' + + c + + '[^>]*>((\xa0| |[ ]|]*>)+?|)|
$', + 'i' + ).test(b) + ); + } + var k, + l, + m = a.settings, + n = tinymce.util.LocalStorage; + (k = m.autosave_prefix || 'tinymce-autosave-{path}{query}-{id}-'), + (k = k.replace(/\{path\}/g, document.location.pathname)), + (k = k.replace(/\{query\}/g, document.location.search)), + (k = k.replace(/\{id\}/g, a.id)), + (m.autosave_interval = b(m.autosave_interval, '30s')), + (m.autosave_retention = b(m.autosave_retention, '20m')), + a.addButton('restoredraft', { + title: 'Restore last draft', + onclick: i, + onPostRender: h, + }), + a.addMenuItem('restoredraft', { + text: 'Restore last draft', + onclick: i, + onPostRender: h, + context: 'file', + }), + a.settings.autosave_restore_when_empty !== !1 && + (a.on('init', function () { + c() && j() && f(); + }), + a.on('saveContent', function () { + d(); + })), + (window.onbeforeunload = tinymce._beforeUnloadHandler), + (this.hasDraft = c), + (this.storeDraft = e), + (this.restoreDraft = f), + (this.removeDraft = d), + (this.isEmpty = j); + }); diff --git a/src/baseframe/static/js/tinymce4/plugins/bbcode/plugin.min.js b/src/baseframe/static/js/tinymce4/plugins/bbcode/plugin.min.js new file mode 100644 index 00000000..d76a38e6 --- /dev/null +++ b/src/baseframe/static/js/tinymce4/plugins/bbcode/plugin.min.js @@ -0,0 +1,125 @@ +!(function () { + tinymce.create('tinymce.plugins.BBCodePlugin', { + init: function (a) { + var b = this, + c = a.getParam('bbcode_dialect', 'punbb').toLowerCase(); + a.on('beforeSetContent', function (a) { + a.content = b['_' + c + '_bbcode2html'](a.content); + }), + a.on('postProcess', function (a) { + a.set && (a.content = b['_' + c + '_bbcode2html'](a.content)), + a.get && (a.content = b['_' + c + '_html2bbcode'](a.content)); + }); + }, + getInfo: function () { + return { + longname: 'BBCode Plugin', + author: 'Ephox Corp', + authorurl: 'http://www.tinymce.com', + infourl: 'http://www.tinymce.com/wiki.php/Plugin:bbcode', + }; + }, + _punbb_html2bbcode: function (a) { + function b(b, c) { + a = a.replace(b, c); + } + return ( + (a = tinymce.trim(a)), + b(/(.*?)<\/a>/gi, '[url=$1]$2[/url]'), + b( + /(.*?)<\/font>/gi, + '[code][color=$1]$2[/color][/code]' + ), + b( + /(.*?)<\/font>/gi, + '[quote][color=$1]$2[/color][/quote]' + ), + b( + /(.*?)<\/font>/gi, + '[code][color=$1]$2[/color][/code]' + ), + b( + /(.*?)<\/font>/gi, + '[quote][color=$1]$2[/color][/quote]' + ), + b( + /(.*?)<\/span>/gi, + '[color=$1]$2[/color]' + ), + b(/(.*?)<\/font>/gi, '[color=$1]$2[/color]'), + b( + /(.*?)<\/span>/gi, + '[size=$1]$2[/size]' + ), + b(/(.*?)<\/font>/gi, '$1'), + b(//gi, '[img]$1[/img]'), + b(/(.*?)<\/span>/gi, '[code]$1[/code]'), + b(/(.*?)<\/span>/gi, '[quote]$1[/quote]'), + b( + /(.*?)<\/strong>/gi, + '[code][b]$1[/b][/code]' + ), + b( + /(.*?)<\/strong>/gi, + '[quote][b]$1[/b][/quote]' + ), + b(/(.*?)<\/em>/gi, '[code][i]$1[/i][/code]'), + b(/(.*?)<\/em>/gi, '[quote][i]$1[/i][/quote]'), + b(/(.*?)<\/u>/gi, '[code][u]$1[/u][/code]'), + b(/(.*?)<\/u>/gi, '[quote][u]$1[/u][/quote]'), + b(/<\/(strong|b)>/gi, '[/b]'), + b(/<(strong|b)>/gi, '[b]'), + b(/<\/(em|i)>/gi, '[/i]'), + b(/<(em|i)>/gi, '[i]'), + b(/<\/u>/gi, '[/u]'), + b( + /(.*?)<\/span>/gi, + '[u]$1[/u]' + ), + b(//gi, '[u]'), + b(/]*>/gi, '[quote]'), + b(/<\/blockquote>/gi, '[/quote]'), + b(/
/gi, '\n'), + b(//gi, '\n'), + b(/
/gi, '\n'), + b(/

/gi, ''), + b(/<\/p>/gi, '\n'), + b(/ |\u00a0/gi, ' '), + b(/"/gi, '"'), + b(/</gi, '<'), + b(/>/gi, '>'), + b(/&/gi, '&'), + a + ); + }, + _punbb_bbcode2html: function (a) { + function b(b, c) { + a = a.replace(b, c); + } + return ( + (a = tinymce.trim(a)), + b(/\n/gi, '
'), + b(/\[b\]/gi, ''), + b(/\[\/b\]/gi, ''), + b(/\[i\]/gi, ''), + b(/\[\/i\]/gi, ''), + b(/\[u\]/gi, ''), + b(/\[\/u\]/gi, ''), + b(/\[url=([^\]]+)\](.*?)\[\/url\]/gi, '$2'), + b(/\[url\](.*?)\[\/url\]/gi, '$1'), + b(/\[img\](.*?)\[\/img\]/gi, ''), + b(/\[color=(.*?)\](.*?)\[\/color\]/gi, '$2'), + b( + /\[code\](.*?)\[\/code\]/gi, + '$1 ' + ), + b( + /\[quote.*?\](.*?)\[\/quote\]/gi, + '$1 ' + ), + a + ); + }, + }), + tinymce.PluginManager.add('bbcode', tinymce.plugins.BBCodePlugin); +})(); diff --git a/src/baseframe/static/js/tinymce4/plugins/charmap/plugin.min.js b/src/baseframe/static/js/tinymce4/plugins/charmap/plugin.min.js new file mode 100644 index 00000000..42e39be9 --- /dev/null +++ b/src/baseframe/static/js/tinymce4/plugins/charmap/plugin.min.js @@ -0,0 +1,364 @@ +tinymce.PluginManager.add('charmap', function (a) { + function b() { + function b(a) { + for (; a; ) { + if ('TD' == a.nodeName) return a; + a = a.parentNode; + } + } + var d, e, f, g; + d = + ''; + var h = 25, + i = Math.ceil(c.length / h); + for (f = 0; i > f; f++) { + for (d += '', e = 0; h > e; e++) { + var j = f * h + e; + if (j < c.length) { + var k = c[j]; + d += + ''; + } else d += ''; + } + d += ''; + var l = { + type: 'container', + html: d, + onclick: function (c) { + var d = c.target; + /^(TD|DIV)$/.test(d.nodeName) && + b(d).firstChild && + (a.execCommand( + 'mceInsertContent', + !1, + tinymce.trim(d.innerText || d.textContent) + ), + c.ctrlKey || g.close()); + }, + onmouseover: function (a) { + var c = b(a.target); + c && c.firstChild + ? (g.find('#preview').text(c.firstChild.firstChild.data), + g.find('#previewTitle').text(c.title)) + : (g.find('#preview').text(' '), g.find('#previewTitle').text(' ')); + }, + }; + g = a.windowManager.open({ + title: 'Special character', + spacing: 10, + padding: 10, + items: [ + l, + { + 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: 'label', + name: 'previewTitle', + text: ' ', + style: 'text-align: center', + border: 1, + minWidth: 140, + minHeight: 80, + }, + ], + }, + ], + buttons: [ + { + text: 'Close', + onclick: function () { + g.close(); + }, + }, + ], + }); + } + var c = [ + ['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'], + ['198', 'ligature AE'], + ['199', 'C - cedilla'], + ['200', 'E - grave'], + ['201', 'E - acute'], + ['202', 'E - circumflex'], + ['203', 'E - diaeresis'], + ['204', 'I - grave'], + ['205', 'I - acute'], + ['206', 'I - circumflex'], + ['207', 'I - diaeresis'], + ['208', 'ETH'], + ['209', 'N - tilde'], + ['210', 'O - grave'], + ['211', 'O - acute'], + ['212', 'O - circumflex'], + ['213', 'O - tilde'], + ['214', 'O - diaeresis'], + ['216', 'O - slash'], + ['338', 'ligature OE'], + ['352', 'S - caron'], + ['217', 'U - grave'], + ['218', 'U - acute'], + ['219', 'U - circumflex'], + ['220', 'U - diaeresis'], + ['221', 'Y - acute'], + ['376', 'Y - diaeresis'], + ['222', 'THORN'], + ['224', 'a - grave'], + ['225', 'a - acute'], + ['226', 'a - circumflex'], + ['227', 'a - tilde'], + ['228', 'a - diaeresis'], + ['229', 'a - ring above'], + ['230', 'ligature ae'], + ['231', 'c - cedilla'], + ['232', 'e - grave'], + ['233', 'e - acute'], + ['234', 'e - circumflex'], + ['235', 'e - diaeresis'], + ['236', 'i - grave'], + ['237', 'i - acute'], + ['238', 'i - circumflex'], + ['239', 'i - diaeresis'], + ['240', 'eth'], + ['241', 'n - tilde'], + ['242', 'o - grave'], + ['243', 'o - acute'], + ['244', 'o - circumflex'], + ['245', 'o - tilde'], + ['246', 'o - diaeresis'], + ['248', 'o slash'], + ['339', 'ligature oe'], + ['353', 's - caron'], + ['249', 'u - grave'], + ['250', 'u - acute'], + ['251', 'u - circumflex'], + ['252', 'u - diaeresis'], + ['253', 'y - acute'], + ['254', 'thorn'], + ['255', 'y - diaeresis'], + ['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'], + ]; + a.addCommand('mceShowCharmap', b), + a.addButton('charmap', { + icon: 'charmap', + tooltip: 'Special character', + cmd: 'mceShowCharmap', + }), + a.addMenuItem('charmap', { + icon: 'charmap', + text: 'Special character', + cmd: 'mceShowCharmap', + context: 'insert', + }); +}); diff --git a/src/baseframe/static/js/tinymce4/plugins/code/plugin.min.js b/src/baseframe/static/js/tinymce4/plugins/code/plugin.min.js new file mode 100644 index 00000000..d90f0987 --- /dev/null +++ b/src/baseframe/static/js/tinymce4/plugins/code/plugin.min.js @@ -0,0 +1,36 @@ +tinymce.PluginManager.add('code', function (a) { + function b() { + var b = a.windowManager.open({ + title: 'Source code', + body: { + type: 'textbox', + name: 'code', + multiline: !0, + minWidth: a.getParam('code_dialog_width', 600), + minHeight: a.getParam( + 'code_dialog_height', + Math.min(tinymce.DOM.getViewPort().h - 200, 500) + ), + spellcheck: !1, + style: 'direction: ltr; text-align: left', + }, + onSubmit: function (b) { + a.focus(), + a.undoManager.transact(function () { + a.setContent(b.data.code); + }), + a.selection.setCursorLocation(), + a.nodeChanged(); + }, + }); + b.find('#code').value(a.getContent({ source_view: !0 })); + } + a.addCommand('mceCodeEditor', b), + a.addButton('code', { icon: 'code', tooltip: 'Source code', onclick: b }), + a.addMenuItem('code', { + icon: 'code', + text: 'Source code', + context: 'tools', + onclick: b, + }); +}); diff --git a/src/baseframe/static/js/tinymce4/plugins/codesample/css/prism.css b/src/baseframe/static/js/tinymce4/plugins/codesample/css/prism.css new file mode 100644 index 00000000..402367e0 --- /dev/null +++ b/src/baseframe/static/js/tinymce4/plugins/codesample/css/prism.css @@ -0,0 +1,141 @@ +/* http://prismjs.com/download.html?themes=prism&languages=markup+css+clike+javascript */ +/** + * prism.js default theme for JavaScript, CSS and HTML + * Based on dabblet (http://dabblet.com) + * @author Lea Verou + */ + +code[class*='language-'], +pre[class*='language-'] { + color: black; + text-shadow: 0 1px white; + font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; + direction: ltr; + text-align: left; + white-space: pre; + word-spacing: normal; + word-break: normal; + word-wrap: normal; + line-height: 1.5; + + -moz-tab-size: 4; + -o-tab-size: 4; + tab-size: 4; + + -webkit-hyphens: none; + -moz-hyphens: none; + -ms-hyphens: none; + hyphens: none; +} + +pre[class*='language-']::-moz-selection, +pre[class*='language-'] ::-moz-selection, +code[class*='language-']::-moz-selection, +code[class*='language-'] ::-moz-selection { + text-shadow: none; + background: #b3d4fc; +} + +pre[class*='language-']::selection, +pre[class*='language-'] ::selection, +code[class*='language-']::selection, +code[class*='language-'] ::selection { + text-shadow: none; + background: #b3d4fc; +} + +@media print { + code[class*='language-'], + pre[class*='language-'] { + text-shadow: none; + } +} + +/* Code blocks */ +pre[class*='language-'] { + padding: 1em; + margin: 0.5em 0; + overflow: auto; +} + +:not(pre) > code[class*='language-'], +pre[class*='language-'] { + background: #f5f2f0; +} + +/* Inline code */ +:not(pre) > code[class*='language-'] { + padding: 0.1em; + border-radius: 0.3em; +} + +.token.comment, +.token.prolog, +.token.doctype, +.token.cdata { + color: slategray; +} + +.token.punctuation { + color: #999; +} + +.namespace { + opacity: 0.7; +} + +.token.property, +.token.tag, +.token.boolean, +.token.number, +.token.constant, +.token.symbol, +.token.deleted { + color: #905; +} + +.token.selector, +.token.attr-name, +.token.string, +.token.char, +.token.builtin, +.token.inserted { + color: #690; +} + +.token.operator, +.token.entity, +.token.url, +.language-css .token.string, +.style .token.string { + color: #a67f59; + background: hsla(0, 0%, 100%, 0.5); +} + +.token.atrule, +.token.attr-value, +.token.keyword { + color: #07a; +} + +.token.function { + color: #dd4a68; +} + +.token.regex, +.token.important, +.token.variable { + color: #e90; +} + +.token.important, +.token.bold { + font-weight: bold; +} +.token.italic { + font-style: italic; +} + +.token.entity { + cursor: help; +} diff --git a/src/baseframe/static/js/tinymce4/plugins/codesample/plugin.min.js b/src/baseframe/static/js/tinymce4/plugins/codesample/plugin.min.js new file mode 100644 index 00000000..5590d64b --- /dev/null +++ b/src/baseframe/static/js/tinymce4/plugins/codesample/plugin.min.js @@ -0,0 +1,864 @@ +!(function (a, b) { + 'use strict'; + function c(a, b) { + for (var c, d = [], f = 0; f < a.length; ++f) { + if (((c = g[a[f]] || e(a[f])), !c)) + throw 'module definition dependecy not found: ' + a[f]; + d.push(c); + } + b.apply(null, d); + } + function d(a, d, e) { + if ('string' != typeof a) + throw 'invalid module definition, module id must be defined and be a string'; + if (d === b) + throw 'invalid module definition, dependencies must be specified'; + if (e === b) + throw 'invalid module definition, definition function must be specified'; + c(d, function () { + g[a] = e.apply(null, arguments); + }); + } + function e(b) { + for (var c = a, d = b.split(/[.\/]/), e = 0; e < d.length; ++e) { + if (!c[d[e]]) return; + c = c[d[e]]; + } + return c; + } + function f(c) { + var d, e, f, h, i; + for (d = 0; d < c.length; d++) { + (e = a), (f = c[d]), (h = f.split(/[.\/]/)); + for (var j = 0; j < h.length - 1; ++j) + e[h[j]] === b && (e[h[j]] = {}), (e = e[h[j]]); + e[h[h.length - 1]] = g[f]; + } + if (a.AMDLC_TESTS) { + i = a.privateModules || {}; + for (f in g) i[f] = g[f]; + for (d = 0; d < c.length; d++) delete i[c[d]]; + a.privateModules = i; + } + } + var g = {}; + d('tinymce/codesampleplugin/Prism', [], function () { + var a = {}, + b = + 'undefined' != typeof a + ? a + : 'undefined' != typeof WorkerGlobalScope && + self instanceof WorkerGlobalScope + ? self + : {}, + c = (function () { + var a = /\blang(?:uage)?-(?!\*)(\w+)\b/i, + c = (b.Prism = { + util: { + encode: function (a) { + return a instanceof d + ? new d(a.type, c.util.encode(a.content), a.alias) + : 'Array' === c.util.type(a) + ? a.map(c.util.encode) + : a + .replace(/&/g, '&') + .replace(/ a.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); + }); + return ( + (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 + ? void 0 + : 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 + ); + }), + d('tinymce/codesampleplugin/Utils', [], function () { + function a(a) { + return ( + a && 'PRE' == a.nodeName && -1 !== a.className.indexOf('language-') + ); + } + function b(a) { + return function (b, c) { + return a(c); + }; + } + return { isCodeSample: a, trimArg: b }; + }), + d( + 'tinymce/codesampleplugin/Dialog', + [ + 'tinymce/dom/DOMUtils', + 'tinymce/codesampleplugin/Utils', + 'tinymce/codesampleplugin/Prism', + ], + function (a, b, c) { + function d(a, b, d) { + a.undoManager.transact(function () { + var f = e(a); + (d = h.encode(d)), + f + ? (a.dom.setAttrib(f, 'class', 'language-' + b), + (f.innerHTML = d), + c.highlightElement(f), + a.selection.select(f)) + : (a.insertContent( + '

' + d + '
' + ), + a.selection.select(a.$('#__new').removeAttr('id')[0])); + }); + } + function e(a) { + var c = a.selection.getNode(); + return b.isCodeSample(c) ? c : null; + } + function f(a) { + var b = e(a); + return b ? b.textContent : ''; + } + function g(a) { + var b, + c = e(a); + return c + ? ((b = c.className.match(/language-(\w+)/)), b ? b[1] : '') + : ''; + } + var h = a.DOM, + i = [ + { 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' }, + ]; + return { + open: function (a) { + a.windowManager.open({ + title: 'Insert/Edit code sample', + minWidth: Math.min(h.getViewPort().w, 800), + minHeight: Math.min(h.getViewPort().h, 650), + layout: 'fit', + body: [ + { + type: 'listbox', + name: 'language', + label: 'Language', + maxWidth: 200, + value: g(a), + values: i, + }, + { + type: 'textbox', + name: 'code', + multiline: !0, + spellcheck: !1, + ariaLabel: 'Code view', + flex: 1, + style: 'direction: ltr; text-align: left', + classes: 'monospace', + value: f(a), + }, + ], + onSubmit: function (b) { + d(a, b.data.language, b.data.code); + }, + }); + }, + }; + } + ), + d( + 'tinymce/codesampleplugin/Plugin', + [ + 'tinymce/Env', + 'tinymce/PluginManager', + 'tinymce/codesampleplugin/Prism', + 'tinymce/codesampleplugin/Dialog', + 'tinymce/codesampleplugin/Utils', + ], + function (a, b, c, d, e) { + var f, + g = e.trimArg; + b.add('codesample', function (b, h) { + function i() { + var a; + f || + ((f = !0), + (a = b.dom.create('link', { + rel: 'stylesheet', + href: h + '/css/prism.css', + })), + b.getDoc().getElementsByTagName('head')[0].appendChild(a)); + } + var j = b.$; + a.ceFalse && + (b.on('PreProcess', function (a) { + j('pre[contenteditable=false]', a.node) + .filter(g(e.isCodeSample)) + .each(function (a, b) { + var c = j(b), + d = b.textContent; + c.attr('class', j.trim(c.attr('class'))), + c.removeAttr('contentEditable'), + c.empty().append(j('').text(d)); + }); + }), + b.on('SetContent', function () { + var a = j('pre') + .filter(g(e.isCodeSample)) + .filter(function (a, b) { + return 'false' !== b.contentEditable; + }); + a.length && + b.undoManager.transact(function () { + a.each(function (a, d) { + j(d) + .find('br') + .each(function (a, c) { + c.parentNode.replaceChild( + b.getDoc().createTextNode('\n'), + c + ); + }), + (d.contentEditable = !1), + (d.innerHTML = b.dom.encode(d.textContent)), + c.highlightElement(d), + (d.className = j.trim(d.className)); + }); + }); + }), + b.addCommand('codesample', function () { + d.open(b); + }), + b.addButton('codesample', { + cmd: 'codesample', + title: 'Insert/edit code sample', + }), + b.on('init', i)); + }); + } + ), + f([ + 'tinymce/codesampleplugin/Prism', + 'tinymce/codesampleplugin/Utils', + 'tinymce/codesampleplugin/Dialog', + 'tinymce/codesampleplugin/Plugin', + ]); +})(window); diff --git a/src/baseframe/static/js/tinymce4/plugins/colorpicker/plugin.min.js b/src/baseframe/static/js/tinymce4/plugins/colorpicker/plugin.min.js new file mode 100644 index 00000000..1cc831b3 --- /dev/null +++ b/src/baseframe/static/js/tinymce4/plugins/colorpicker/plugin.min.js @@ -0,0 +1,81 @@ +tinymce.PluginManager.add('colorpicker', function (a) { + function b(b, c) { + function d(a) { + var b = new tinymce.util.Color(a), + c = b.toRgb(); + f.fromJSON({ r: c.r, g: c.g, b: c.b, hex: b.toHex().substr(1) }), + e(b.toHex()); + } + function e(a) { + f.find('#preview')[0].getEl().style.background = a; + } + var f = a.windowManager.open({ + title: 'Color', + items: { + type: 'container', + layout: 'flex', + direction: 'row', + align: 'stretch', + padding: 5, + spacing: 10, + items: [ + { + type: 'colorpicker', + value: c, + onchange: function () { + var a = this.rgb(); + f && + (f.find('#r').value(a.r), + f.find('#g').value(a.g), + f.find('#b').value(a.b), + f.find('#hex').value(this.value().substr(1)), + e(this.value())); + }, + }, + { + type: 'form', + padding: 0, + labelGap: 5, + defaults: { + type: 'textbox', + size: 7, + value: '0', + flex: 1, + spellcheck: !1, + onchange: function () { + var a, + b, + c = f.find('colorpicker')[0]; + return ( + (a = this.name()), + (b = this.value()), + 'hex' == a + ? ((b = '#' + b), d(b), void c.value(b)) + : ((b = { + r: f.find('#r').value(), + g: f.find('#g').value(), + b: f.find('#b').value(), + }), + c.value(b), + void d(b)) + ); + }, + }, + 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 () { + b('#' + this.toJSON().hex); + }, + }); + d(c); + } + a.settings.color_picker_callback || (a.settings.color_picker_callback = b); +}); diff --git a/src/baseframe/static/js/tinymce4/plugins/contextmenu/plugin.min.js b/src/baseframe/static/js/tinymce4/plugins/contextmenu/plugin.min.js new file mode 100644 index 00000000..ffcd9292 --- /dev/null +++ b/src/baseframe/static/js/tinymce4/plugins/contextmenu/plugin.min.js @@ -0,0 +1,46 @@ +tinymce.PluginManager.add('contextmenu', function (a) { + var b, + c = a.settings.contextmenu_never_use_native; + a.on('contextmenu', function (d) { + var e, + f = a.getDoc(); + if (!d.ctrlKey || c) { + if ( + (d.preventDefault(), + tinymce.Env.mac && + tinymce.Env.webkit && + 2 == d.button && + f.caretRangeFromPoint && + a.selection.setRng(f.caretRangeFromPoint(d.x, d.y)), + (e = + a.settings.contextmenu || + 'link image inserttable | cell row column deletetable'), + b) + ) + b.show(); + else { + var g = []; + tinymce.each(e.split(/[ ,]/), function (b) { + var c = a.menuItems[b]; + '|' == b && (c = { text: b }), c && ((c.shortcut = ''), g.push(c)); + }); + for (var h = 0; h < g.length; h++) + '|' == g[h].text && (0 === h || h == g.length - 1) && g.splice(h, 1); + (b = new tinymce.ui.Menu({ + items: g, + context: 'contextmenu', + classes: 'contextmenu', + }).renderTo()), + a.on('remove', function () { + b.remove(), (b = null); + }); + } + var i = { x: d.pageX, y: d.pageY }; + a.inline || + ((i = tinymce.DOM.getPos(a.getContentAreaContainer())), + (i.x += d.clientX), + (i.y += d.clientY)), + b.moveTo(i.x, i.y); + } + }); +}); diff --git a/src/baseframe/static/js/tinymce4/plugins/directionality/plugin.min.js b/src/baseframe/static/js/tinymce4/plugins/directionality/plugin.min.js new file mode 100644 index 00000000..ca8358b0 --- /dev/null +++ b/src/baseframe/static/js/tinymce4/plugins/directionality/plugin.min.js @@ -0,0 +1,39 @@ +tinymce.PluginManager.add('directionality', function (a) { + function b(b) { + var c, + d = a.dom, + e = a.selection.getSelectedBlocks(); + e.length && + ((c = d.getAttrib(e[0], 'dir')), + tinymce.each(e, function (a) { + d.getParent(a.parentNode, "*[dir='" + b + "']", d.getRoot()) || + (c != b ? d.setAttrib(a, 'dir', b) : d.setAttrib(a, 'dir', null)); + }), + a.nodeChanged()); + } + function c(a) { + var b = []; + return ( + tinymce.each('h1 h2 h3 h4 h5 h6 div p'.split(' '), function (c) { + b.push(c + '[dir=' + a + ']'); + }), + b.join(',') + ); + } + a.addCommand('mceDirectionLTR', function () { + b('ltr'); + }), + a.addCommand('mceDirectionRTL', function () { + b('rtl'); + }), + a.addButton('ltr', { + title: 'Left to right', + cmd: 'mceDirectionLTR', + stateSelector: c('ltr'), + }), + a.addButton('rtl', { + title: 'Right to left', + cmd: 'mceDirectionRTL', + stateSelector: c('rtl'), + }); +}); diff --git a/src/baseframe/static/js/tinymce4/plugins/emoticons/img/smiley-cool.gif b/src/baseframe/static/js/tinymce4/plugins/emoticons/img/smiley-cool.gif new file mode 100644 index 0000000000000000000000000000000000000000..ba90cc36fb0415d0273d1cd206bff63fd9c91fde GIT binary patch literal 354 zcmV-o0iFIwNk%w1VG;lm0Mr!#3ke00dJfFY%i+lrhK7V(RutUQJhPY;?(XfrsZKgL z7WLQ^zPO&zzav{)SL^9nBOw~z(=orMEH5uC-P_gr`uhCnASMa|$-iRw?m_(dUwU8) zq>Kx}s1_F$4FCWDA^8LW0018VEC2ui01^Na000Hw;3tYzX_jM3Qpv$_M?zI9i5=0S zX-{-uv=l3%&P0s%m9Ox_a(m_c|u z01g3U0`Wll5)poVdma=N8y<3f0Sf~hXmTC}2oxMW4FdxUj+z4<0}lrX2nP=qkDRIt z9Ge*(qzMrj3jrIOjvI{`5eWzt3`G_T8yChG8w(a19SkK12@M(+799Zr9n=~PzBCmA z5)BU-)YKUd4H5!D9|!^o9kWIe9SH(WDHRk92}DZ?3})2$P@$55g90f0N)ZA8JID5J Aw*UYD literal 0 HcmV?d00001 diff --git a/src/baseframe/static/js/tinymce4/plugins/emoticons/img/smiley-cry.gif b/src/baseframe/static/js/tinymce4/plugins/emoticons/img/smiley-cry.gif new file mode 100644 index 0000000000000000000000000000000000000000..74d897a4f6d22e814e2b054e98b8a75fb464b4be GIT binary patch literal 329 zcmV-P0k-}}Nk%w1VG;lm0Mr-&E)xPSit@9T3%;vR+|V+?t0A(pllJjXrMl7n=_A_a za^B+Su$LjvyC3@TIQZNZa##w=!k(SO^P#bO*w(eU#;{U83XFCU_V)J5wrb+;g2vkN z#>U24qVoOvY5)KLA^8LW0018VEC2ui01^Na000HX;3tY$X_jM3QUfCh%s^o(nF++< zc?Th6v=oL>*by8K!mhvwelUXuuW&&U9iGO3hM@>Njw{l^#0q9mWpcefdI;O$;efnY zkd~@r-o$*74FCWI1%d((4+jDz0va0>69^fI6%`W{8w!gU1pyL>prH>E0R<%k6Aq%H z4ij+^9TEwM5P}eh2@)L<~6+>@EpxfA0YrcPNsSu literal 0 HcmV?d00001 diff --git a/src/baseframe/static/js/tinymce4/plugins/emoticons/img/smiley-embarassed.gif b/src/baseframe/static/js/tinymce4/plugins/emoticons/img/smiley-embarassed.gif new file mode 100644 index 0000000000000000000000000000000000000000..963a96b8a7593b1d8bcbab073abe5ee4e539dbf6 GIT binary patch literal 331 zcmV-R0kr-{Nk%w1VG;lm0MrryDh>j~yq&6%75dW~z^P39(NxsGDE{UkxtkIEq(S-a zRKlwv+S=Lr?>hbYY~sQ?c3T&ZcN_Nh_EU3s(>Io6B&>WW`@bsw**)Ocy1bht z{*G6|uwwqUQ2+n{A^8LW0018VEC2ui01^Na000HZ;3tYwX_jM3YQ!c88=*-m*&&bO zILd=`w3KAC;8hxpif*w9ek6oqV-Z0L77fROK$BSR@5BAv-%C>6y>>#+D4e#&nz^qMDItlpp zTG728+|V&?R13PIEBW(C`uh6d*t-1sZ^XQv;oDD}iYLOV7uVO;{`xl4#4tJ{0;h@! z>)kdc3IhA?Hvj+tA^8La0018VEC2ui01^Na06+!P;3tYuX_ljS7!u|-O)I}TzP1q%xT4HOFwMJaO;2ml)!00$)141pU08x3594IX?4 o5YuAA8yXz~76K1c;3^jg77WP185Rf^u}23N0sR5^q(T4yJ1sVN5dZ)H literal 0 HcmV?d00001 diff --git a/src/baseframe/static/js/tinymce4/plugins/emoticons/img/smiley-frown.gif b/src/baseframe/static/js/tinymce4/plugins/emoticons/img/smiley-frown.gif new file mode 100644 index 0000000000000000000000000000000000000000..716f55e161bfebb1c3d34f0b0f40c177fc82c30b GIT binary patch literal 340 zcmV-a0jvH;Nk%w1VG;lm0MroxK_>;q#>Sw62=mns-On=0wransPVevT^YK{Dy(0YY zH)vE6x0?;Wqb>gZas1^OT0si>`ugD5y87}*#H$s=yq(wA*8cf7{`y+(+9J7|9QfT7 z`ROHiU=Y&6FaQ7mA^8LW0018VEC2ui01^Na000Hi;3tYvX_jM3N`@u~nju9hSuh^r zIEcp-wA7(NL0~2d#RP+(G!CPPA>o*KJjv_CkucCA5=K?AfF#RG2V*8BU@jL304|4P z2;PGRF@bj$et;Jf2pR_mVsIA<85|n}kQ*Bq42Ovqj*yy>6P0=h3X&9Z01yyk~2N4w%7#RW^55W%`0vQ+-6(y_*2pqz~90*;x9}yM}%$UI(7t#$D mK_3Se1{4HKM+6iG7EmeH6$V631{L5n)#CyC0qx-*Apkoyg?w!Q literal 0 HcmV?d00001 diff --git a/src/baseframe/static/js/tinymce4/plugins/emoticons/img/smiley-innocent.gif b/src/baseframe/static/js/tinymce4/plugins/emoticons/img/smiley-innocent.gif new file mode 100644 index 0000000000000000000000000000000000000000..334d49e0e60f2997c9ba24071764f95d9e08a5cc GIT binary patch literal 336 zcmV-W0k8f?Nk%w1VG;lm0MrryI4TI-%dP0m5~*+Y`T~ z7Rth){q{I_X%*S48uRZ|(b3V&wIKTX`u+WJzo<^$#wuY;3W|Cf{O29IkTAcaE&lpe z+P*^H)-tknA^-pYA^8LW0018VEC2ui01^Na000He;3tYwX_n)75QgVvNQ`6#5gcMm zEEG~blgXokptKAJgCU?%JT?yos!R6cPtcQWh2siHlNI2L}ifQhgX02^InZ2?-ktkqVRyZJY^Trk|lv zovp437?1~d46O)?2(1i+2NDYk8<+_Kil!K!3njA^!I#dL8x<729}*B65mC=m5gHH@ iDi9P3f*VjB3KS4HDb_qqRul{0DIT=Nk%w1VG;lm0Mrx!QauaC#>Vb6G=_5=^YB^9wrc376Sb5I-qJGf@9vZ# z5WlKU(!eVB+7tfnDXp0zyB`?BZ5IChalob*`uh6d*t+@dKGHcU+L|83yq*5~IoH?L zy`?Gp<{bX|SpWb4A^8LW0018VEC2ui01^Na000Hg;3tYyX_jM3R?Bl7&r(q;SsVx< zNd$5fv{ZsKA$SlL3&KN~a1tZRf*~1Ltkx9~2uL3&z-yb0WJDRY082|tP literal 0 HcmV?d00001 diff --git a/src/baseframe/static/js/tinymce4/plugins/emoticons/img/smiley-laughing.gif b/src/baseframe/static/js/tinymce4/plugins/emoticons/img/smiley-laughing.gif new file mode 100644 index 0000000000000000000000000000000000000000..82c5b182e61d32bd394acae551eff180f1eebd26 GIT binary patch literal 343 zcmV-d0jT~*Nk%w1VG;lm0Q4UK!lp8=s;1-69HWK?p_PpF=Pd8~Ygtcnp*fHAL z**;z>w3iC}`fmL6IkKB1N;3zEa}&zKpsu1;_V)HocR5-{J~BcYvE`YXhBnc@CfU=! za(Ec zG>66zv=rqr;2j)}gKqE$ekcSD?}0=WLB?AWp85)qALd+P=4)6X4oXy{bw2>K^d$ z@6ERvva+(4ib~41YUkTEn1&#?rzrOHT>1I=Y*h`+%*@WtPUPg|!@EEI_d5LgZ>^Og z-qyBKJqy*wF8}}lA^8La0018VEC2ui01^Na06+!6;3tYxX_lj?7+U61R3gAaEg8x< zT>%mSfCwURnWQF&g=Q0ZxH1ulW`QtH0>O!5%iT_X0VBy_@EkOngU8?ye~=H!t21{= z9@Uj3a_UbE88~kh5Eq7rh!7QSBn1c?0|Off1&k^`5*QE<4-gmSR<4C>Dj%C>6W(lWoQPVevT^YB^Fy&h6M z4YZgH{O~qtR1(Ci8T;lQ`uh6d*t-7xar*K{#Jrulo-Wtd*44u?{`oh#n;gQXGXDEo z_}UUC3IeK%0ssI2A^8La0018VEC2ui01^Na06+!R;3tYuX_ljSEE482&%+G^XK%|f zLKbCc4u{4-u|QG~LqamSTo?@JM3OKZAr!|Z2IzP@fY`=CIg$vA3qm46TowfLCt29I z6pDKuvnf~)83+sm9yW#?9s>^(89F=~2?!W44-6Ox2^vNza}fp^9v&G65pp936%Gg+ z6HpTy2o4oGoh+>l3Q)KVQwybl2oo*<4a3D469|nfEii|MH4`}p1_cZp0ssj%2>=2d q41Na?)CpS;4gvxWVpZcR76uLludD?Q1{SnP2NnVU0rZ&)0RTIit8@_n literal 0 HcmV?d00001 diff --git a/src/baseframe/static/js/tinymce4/plugins/emoticons/img/smiley-surprised.gif b/src/baseframe/static/js/tinymce4/plugins/emoticons/img/smiley-surprised.gif new file mode 100644 index 0000000000000000000000000000000000000000..0cc9bb71cca4cdeafbb248ce7e07c3708c1cbd64 GIT binary patch literal 338 zcmV-Y0j>T=Nk%w1VG;lm0Q4UK`{WwN#>SnDDC*4*{OcpiwransPVevTQacIr@mkQp zCf(06s)_=>r7UYx48o@u`uh6d*t-7rH~ji<`P&oj;5Wp)o!8ga`SV6TA_BIW5#ZWV z{`*)c32kA}f=futY?#YE7kxGD|7L}4&OEDw$hkm+~<00QS>F_H?J#bz?uEHnl42f5(9 z5O)`6Q9V2o5;YVLUK)Y`7!Nr+4GMq?85s%^2?`BGDRU798Vn2?1`%>22R{iO0u>bk z9tlA?nk*O<3zHJH6&Mp5qALj)E(mxM!Y&vII4dm@1Ov{`f*8pL3xPEVUI>D>1_uxa kNm?`6VH{N6Di;P13m6<67z+;u7qCYM7XkVK^`jvGJD~P?KL7v# literal 0 HcmV?d00001 diff --git a/src/baseframe/static/js/tinymce4/plugins/emoticons/img/smiley-tongue-out.gif b/src/baseframe/static/js/tinymce4/plugins/emoticons/img/smiley-tongue-out.gif new file mode 100644 index 0000000000000000000000000000000000000000..2075dc16058f1f17912167675ce5cfb9986fc71d GIT binary patch literal 328 zcmV-O0k{4~Nk%w1VG;lm0Mrx!CJF+^#>SU@3-{U*rx+Q^wrc$ABfqLn@9*x?z8(4X zSW-O=@){bmmI~g|GQXoP);cvj3|f1M8e@{G*!tYaiCEujj1NGxRN#6#tiCETo+{x{Hkzt z5k-kPvcD=V2nbmjCgL6k{uF&2nP-t0s;w<385Nx2oxDb z9T5Pp7qJl?3Kkh9oe2sCr5F$p7zPSlsUH*@54w*83=9Or4;w)r2pcU95(FL|1Th;< aDaRQH4;Tal7#Y$v#?=Au0pHUfApkpvZg^t= literal 0 HcmV?d00001 diff --git a/src/baseframe/static/js/tinymce4/plugins/emoticons/img/smiley-undecided.gif b/src/baseframe/static/js/tinymce4/plugins/emoticons/img/smiley-undecided.gif new file mode 100644 index 0000000000000000000000000000000000000000..bef7e257303f8243c89787e7a7f9955dd1f112e2 GIT binary patch literal 337 zcmV-X0j~Z>Nk%w1VG;lm0MroxDi#99#>R?y8~4}{%C>6#>?OadPVevTr-=vi@LATn z4rERY-qJF+n+?CCE&B3D{{3Shh?>WT0o%`b%*Voqm`dL;(4F35y zc485^n;g!+Bme*aA^8LW0018VEC2ui01^Na000Hf;3tYvX_jM3N=AnuogqakNi<9X zK?&0kwA8^tNn{?C$|IAYI1ZzT!2>}iuMddFK#NEkRl!7%6brJAnUs;)XcnA}TNBSP zxQ9;SvEfwYeSaGd2^|LqU~(QF1qBxr3Ii7x84ZVt8wCTKoSYAqc?p`G2onnpk`IOl z1`HLGj}riN2p1K12N4z&8IBDc6tEWs859;JtRB6>lf+xO9}yT19toMv8wnl`7(pKg j7zPv!OGgY81{hE&(iR3pP6ig;HPPS!_yOwPA0Yrc)=Yf3 literal 0 HcmV?d00001 diff --git a/src/baseframe/static/js/tinymce4/plugins/emoticons/img/smiley-wink.gif b/src/baseframe/static/js/tinymce4/plugins/emoticons/img/smiley-wink.gif new file mode 100644 index 0000000000000000000000000000000000000000..0631c7616ec8624ddeee02b633326f697ee72f80 GIT binary patch literal 350 zcmV-k0ipg!Nk%w1VG;lm0Q4UK(ZVUl#>Sn03F^-g-qAA3wransPV?|t@9*x%vmQ`7 z4E*pcw3rOOq%3t@4*K#({N^40{c-yG`rz2Q!KfI-yq*61HrBop*VoqW<}&{JS@_x# zwwfF$4Fdh~IsgCwA^8La0018VEC2ui01^Na06+!X;3tYwX_ljiFp=e23$zWxW@`*G zN?2ty6iUNT!AMdPLn89IbS7WCB_mWF$+hzY-{PWkp(?(Xf;zbH~P z3jOdj?W+^YwrakfE8fyG&5jTBz!3WS`fgM_;MltQ+c}4GO8)(E`S3`@yq&d~5!ct& z)v79NObo)O7XSbNA^8LW0018VEC2ui01^Na000He;3tYwX_jM3QifI(nn6h_*=Wyk zUB{y}v=qYOIUF#R3dZPhAVv~H;(|a2yN_5FH&J0|$eJ3kw4gj1Y?v5d#>LMV12^6BYy$1)ZKA zga!|m2?POz0R)f>4+aPl8KD{gz`+G_9vLMFQU?RU!8uyH9}*i52|cC+7S0YEK_3Vk i1|APfM-Ltb8&4_H83sg61{vHn(cc000qNZzApkp'; + }), + (a += ''); + }), + (a += '') + ); + } + var d = [ + ['cool', 'cry', 'embarassed', 'foot-in-mouth'], + ['frown', 'innocent', 'kiss', 'laughing'], + ['money-mouth', 'sealed', 'smile', 'surprised'], + ['tongue-out', 'undecided', 'wink', 'yell'], + ]; + a.addButton('emoticons', { + type: 'panelbutton', + panel: { + role: 'application', + autohide: !0, + html: c, + onclick: function (b) { + var c = a.dom.getParent(b.target, 'a'); + c && + (a.insertContent( + '' +
+              c.getAttribute('data-mce-alt') +
+              '' + ), + this.hide()); + }, + }, + tooltip: 'Emoticons', + }); +}); diff --git a/src/baseframe/static/js/tinymce4/plugins/example/dialog.html b/src/baseframe/static/js/tinymce4/plugins/example/dialog.html new file mode 100644 index 00000000..c3abca29 --- /dev/null +++ b/src/baseframe/static/js/tinymce4/plugins/example/dialog.html @@ -0,0 +1,12 @@ + + + +

Custom dialog

+ Input some text: + + + diff --git a/src/baseframe/static/js/tinymce4/plugins/example/plugin.min.js b/src/baseframe/static/js/tinymce4/plugins/example/plugin.min.js new file mode 100644 index 00000000..a6691e5c --- /dev/null +++ b/src/baseframe/static/js/tinymce4/plugins/example/plugin.min.js @@ -0,0 +1,40 @@ +tinymce.PluginManager.add('example', function (a, b) { + a.addButton('example', { + text: 'My button', + icon: !1, + onclick: function () { + a.windowManager.open({ + title: 'Example plugin', + body: [{ type: 'textbox', name: 'title', label: 'Title' }], + onsubmit: function (b) { + a.insertContent('Title: ' + b.data.title); + }, + }); + }, + }), + a.addMenuItem('example', { + text: 'Example plugin', + context: 'tools', + onclick: function () { + a.windowManager.open({ + title: 'TinyMCE site', + url: b + '/dialog.html', + width: 600, + height: 400, + buttons: [ + { + text: 'Insert', + onclick: function () { + var b = a.windowManager.getWindows()[0]; + a.insertContent( + b.getContentWindow().document.getElementById('content').value + ), + b.close(); + }, + }, + { text: 'Close', onclick: 'close' }, + ], + }); + }, + }); +}); diff --git a/src/baseframe/static/js/tinymce4/plugins/example_dependency/plugin.min.js b/src/baseframe/static/js/tinymce4/plugins/example_dependency/plugin.min.js new file mode 100644 index 00000000..c8beab58 --- /dev/null +++ b/src/baseframe/static/js/tinymce4/plugins/example_dependency/plugin.min.js @@ -0,0 +1 @@ +tinymce.PluginManager.add('example_dependency', function () {}, ['example']); diff --git a/src/baseframe/static/js/tinymce4/plugins/fullpage/plugin.min.js b/src/baseframe/static/js/tinymce4/plugins/fullpage/plugin.min.js new file mode 100644 index 00000000..a99401c9 --- /dev/null +++ b/src/baseframe/static/js/tinymce4/plugins/fullpage/plugin.min.js @@ -0,0 +1,312 @@ +tinymce.PluginManager.add('fullpage', function (a) { + function b() { + var b = c(); + a.windowManager.open({ + title: 'Document properties', + data: b, + 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 (a) { + d(tinymce.extend(b, a.data)); + }, + }); + } + function c() { + function b(a, b) { + var c = a.attr(b); + return c || ''; + } + var c, + d, + f = e(), + g = {}; + return ( + (g.fontface = a.getParam('fullpage_default_fontface', '')), + (g.fontsize = a.getParam('fullpage_default_fontsize', '')), + (c = f.firstChild), + 7 == c.type && + ((g.xml_pi = !0), + (d = /encoding="([^"]+)"/.exec(c.value)), + d && (g.docencoding = d[1])), + (c = f.getAll('#doctype')[0]), + c && (g.doctype = ''), + (c = f.getAll('title')[0]), + c && c.firstChild && (g.title = c.firstChild.value), + k(f.getAll('meta'), function (a) { + var b, + c = a.attr('name'), + d = a.attr('http-equiv'); + c + ? (g[c.toLowerCase()] = a.attr('content')) + : 'Content-Type' == d && + ((b = /charset\s*=\s*(.*)\s*/gi.exec(a.attr('content'))), + b && (g.docencoding = b[1])); + }), + (c = f.getAll('html')[0]), + c && (g.langcode = b(c, 'lang') || b(c, 'xml:lang')), + (g.stylesheets = []), + tinymce.each(f.getAll('link'), function (a) { + 'stylesheet' == a.attr('rel') && g.stylesheets.push(a.attr('href')); + }), + (c = f.getAll('body')[0]), + c && + ((g.langdir = b(c, 'dir')), + (g.style = b(c, 'style')), + (g.visited_color = b(c, 'vlink')), + (g.link_color = b(c, 'link')), + (g.active_color = b(c, 'alink'))), + g + ); + } + function d(b) { + function c(a, b, c) { + a.attr(b, c ? c : void 0); + } + function d(a) { + g.firstChild ? g.insert(a, g.firstChild) : g.append(a); + } + var f, + g, + h, + j, + m, + n = a.dom; + (f = e()), + (g = f.getAll('head')[0]), + g || + ((j = f.getAll('html')[0]), + (g = new l('head', 1)), + j.firstChild ? j.insert(g, j.firstChild, !0) : j.append(g)), + (j = f.firstChild), + b.xml_pi + ? ((m = 'version="1.0"'), + b.docencoding && (m += ' encoding="' + b.docencoding + '"'), + 7 != j.type && ((j = new l('xml', 7)), f.insert(j, f.firstChild, !0)), + (j.value = m)) + : j && 7 == j.type && j.remove(), + (j = f.getAll('#doctype')[0]), + b.doctype + ? (j || + ((j = new l('#doctype', 10)), + b.xml_pi ? f.insert(j, f.firstChild) : d(j)), + (j.value = b.doctype.substring(9, b.doctype.length - 1))) + : j && j.remove(), + (j = null), + k(f.getAll('meta'), function (a) { + 'Content-Type' == a.attr('http-equiv') && (j = a); + }), + b.docencoding + ? (j || + ((j = new l('meta', 1)), + j.attr('http-equiv', 'Content-Type'), + (j.shortEnded = !0), + d(j)), + j.attr('content', 'text/html; charset=' + b.docencoding)) + : j && j.remove(), + (j = f.getAll('title')[0]), + b.title + ? (j ? j.empty() : ((j = new l('title', 1)), d(j)), + (j.append(new l('#text', 3)).value = b.title)) + : j && j.remove(), + k( + 'keywords,description,author,copyright,robots'.split(','), + function (a) { + var c, + e, + g = f.getAll('meta'), + h = b[a]; + for (c = 0; c < g.length; c++) + if (((e = g[c]), e.attr('name') == a)) + return void (h ? e.attr('content', h) : e.remove()); + h && + ((j = new l('meta', 1)), + j.attr('name', a), + j.attr('content', h), + (j.shortEnded = !0), + d(j)); + } + ); + var o = {}; + tinymce.each(f.getAll('link'), function (a) { + 'stylesheet' == a.attr('rel') && (o[a.attr('href')] = a); + }), + tinymce.each(b.stylesheets, function (a) { + o[a] || + ((j = new l('link', 1)), + j.attr({ rel: 'stylesheet', text: 'text/css', href: a }), + (j.shortEnded = !0), + d(j)), + delete o[a]; + }), + tinymce.each(o, function (a) { + a.remove(); + }), + (j = f.getAll('body')[0]), + j && + (c(j, 'dir', b.langdir), + c(j, 'style', b.style), + c(j, 'vlink', b.visited_color), + c(j, 'link', b.link_color), + c(j, 'alink', b.active_color), + n.setAttribs(a.getBody(), { + style: b.style, + dir: b.dir, + vLink: b.visited_color, + link: b.link_color, + aLink: b.active_color, + })), + (j = f.getAll('html')[0]), + j && (c(j, 'lang', b.langcode), c(j, 'xml:lang', b.langcode)), + g.firstChild || g.remove(), + (h = new tinymce.html.Serializer({ + validate: !1, + indent: !0, + apply_source_formatting: !0, + indent_before: 'head,html,body,meta,title,script,link,style', + indent_after: 'head,html,body,meta,title,script,link,style', + }).serialize(f)), + (i = h.substring(0, h.indexOf(''))); + } + function e() { + return new tinymce.html.DomParser({ + validate: !1, + root_name: '#document', + }).parse(i); + } + function f(b) { + function c(a) { + return a.replace(/<\/?[A-Z]+/g, function (a) { + return a.toLowerCase(); + }); + } + var d, + f, + h, + l, + m = b.content, + n = '', + o = a.dom; + if ( + !b.selection && + !( + ('raw' == b.format && i) || + (b.source_view && a.getParam('fullpage_hide_in_source_view')) + ) + ) { + 0 !== m.length || + b.source_view || + (m = tinymce.trim(i) + '\n' + tinymce.trim(m) + '\n' + tinymce.trim(j)), + (m = m.replace(/<(\/?)BODY/gi, '<$1body')), + (d = m.indexOf('', d)), + (i = c(m.substring(0, d + 1))), + (f = m.indexOf('\n'), + (c += a.getParam('fullpage_default_doctype', '')), + (c += '\n\n\n'), + (b = a.getParam('fullpage_default_title')) && + (c += '' + b + '\n'), + (b = a.getParam('fullpage_default_encoding')) && + (c += + '\n'), + (b = a.getParam('fullpage_default_font_family')) && + (d += 'font-family: ' + b + ';'), + (b = a.getParam('fullpage_default_font_size')) && + (d += 'font-size: ' + b + ';'), + (b = a.getParam('fullpage_default_text_color')) && + (d += 'color: ' + b + ';'), + (c += '\n\n') + ); + } + function h(b) { + b.selection || + (b.source_view && a.getParam('fullpage_hide_in_source_view')) || + (b.content = + tinymce.trim(i) + + '\n' + + tinymce.trim(b.content) + + '\n' + + tinymce.trim(j)); + } + var i, + j, + k = tinymce.each, + l = tinymce.html.Node; + a.addCommand('mceFullPageProperties', b), + a.addButton('fullpage', { + title: 'Document properties', + cmd: 'mceFullPageProperties', + }), + a.addMenuItem('fullpage', { + text: 'Document properties', + cmd: 'mceFullPageProperties', + context: 'file', + }), + a.on('BeforeSetContent', f), + a.on('GetContent', h); +}); diff --git a/src/baseframe/static/js/tinymce4/plugins/fullscreen/plugin.min.js b/src/baseframe/static/js/tinymce4/plugins/fullscreen/plugin.min.js new file mode 100644 index 00000000..f9307a27 --- /dev/null +++ b/src/baseframe/static/js/tinymce4/plugins/fullscreen/plugin.min.js @@ -0,0 +1,99 @@ +tinymce.PluginManager.add('fullscreen', function (a) { + function b() { + var a, + b, + c = window, + d = document, + e = d.body; + return ( + e.offsetWidth && ((a = e.offsetWidth), (b = e.offsetHeight)), + c.innerWidth && + c.innerHeight && + ((a = c.innerWidth), (b = c.innerHeight)), + { w: a, h: b } + ); + } + function c() { + function c() { + j.setStyle(m, 'height', b().h - (l.clientHeight - m.clientHeight)); + } + var k, + l, + m, + n, + o = document.body, + p = document.documentElement; + (i = !i), + (l = a.getContainer()), + (k = l.style), + (m = a.getContentAreaContainer().firstChild), + (n = m.style), + i + ? ((d = n.width), + (e = n.height), + (n.width = n.height = '100%'), + (g = k.width), + (h = k.height), + (k.width = k.height = ''), + j.addClass(o, 'mce-fullscreen'), + j.addClass(p, 'mce-fullscreen'), + j.addClass(l, 'mce-fullscreen'), + j.bind(window, 'resize', c), + c(), + (f = c)) + : ((n.width = d), + (n.height = e), + g && (k.width = g), + h && (k.height = h), + j.removeClass(o, 'mce-fullscreen'), + j.removeClass(p, 'mce-fullscreen'), + j.removeClass(l, 'mce-fullscreen'), + j.unbind(window, 'resize', f)), + a.fire('FullscreenStateChanged', { state: i }); + } + var d, + e, + f, + g, + h, + i = !1, + j = tinymce.DOM; + return a.settings.inline + ? void 0 + : (a.on('init', function () { + a.addShortcut('Meta+Alt+F', '', c); + }), + a.on('remove', function () { + f && j.unbind(window, 'resize', f); + }), + a.addCommand('mceFullScreen', c), + a.addMenuItem('fullscreen', { + text: 'Fullscreen', + shortcut: 'Meta+Alt+F', + selectable: !0, + onClick: c, + onPostRender: function () { + var b = this; + a.on('FullscreenStateChanged', function (a) { + b.active(a.state); + }); + }, + context: 'view', + }), + a.addButton('fullscreen', { + tooltip: 'Fullscreen', + shortcut: 'Meta+Alt+F', + onClick: c, + onPostRender: function () { + var b = this; + a.on('FullscreenStateChanged', function (a) { + b.active(a.state); + }); + }, + }), + { + isFullscreen: function () { + return i; + }, + }); +}); diff --git a/src/baseframe/static/js/tinymce4/plugins/hr/plugin.min.js b/src/baseframe/static/js/tinymce4/plugins/hr/plugin.min.js new file mode 100644 index 00000000..b0b819b7 --- /dev/null +++ b/src/baseframe/static/js/tinymce4/plugins/hr/plugin.min.js @@ -0,0 +1,16 @@ +tinymce.PluginManager.add('hr', function (a) { + a.addCommand('InsertHorizontalRule', function () { + a.execCommand('mceInsertContent', !1, '
'); + }), + a.addButton('hr', { + icon: 'hr', + tooltip: 'Horizontal line', + cmd: 'InsertHorizontalRule', + }), + a.addMenuItem('hr', { + icon: 'hr', + text: 'Horizontal line', + cmd: 'InsertHorizontalRule', + context: 'insert', + }); +}); diff --git a/src/baseframe/static/js/tinymce4/plugins/image/plugin.min.js b/src/baseframe/static/js/tinymce4/plugins/image/plugin.min.js new file mode 100644 index 00000000..c77b95ca --- /dev/null +++ b/src/baseframe/static/js/tinymce4/plugins/image/plugin.min.js @@ -0,0 +1,451 @@ +tinymce.PluginManager.add('image', function (a) { + function b(a, b) { + function c(a, c) { + d.parentNode && d.parentNode.removeChild(d), b({ width: a, height: c }); + } + var d = document.createElement('img'); + (d.onload = function () { + c(Math.max(d.width, d.clientWidth), Math.max(d.height, d.clientHeight)); + }), + (d.onerror = function () { + c(); + }); + var e = d.style; + (e.visibility = 'hidden'), + (e.position = 'fixed'), + (e.bottom = e.left = 0), + (e.width = e.height = 'auto'), + document.body.appendChild(d), + (d.src = a); + } + function c(a, b, c) { + function d(a, c) { + return ( + (c = c || []), + tinymce.each(a, function (a) { + var e = { text: a.text || a.title }; + a.menu ? (e.menu = d(a.menu)) : ((e.value = a.value), b(e)), + c.push(e); + }), + c + ); + } + return d(a, c || []); + } + function d(b) { + return function () { + var c = a.settings.image_list; + 'string' == typeof c + ? tinymce.util.XHR.send({ + url: c, + success: function (a) { + b(tinymce.util.JSON.parse(a)); + }, + }) + : 'function' == typeof c + ? c(b) + : b(c); + }; + } + function e(d) { + function e() { + var a, b, c, d; + (a = l.find('#width')[0]), + (b = l.find('#height')[0]), + a && + b && + ((c = a.value()), + (d = b.value()), + l.find('#constrain')[0].checked() && + o && + p && + c && + d && + (o != c + ? ((d = Math.round((c / o) * d)), isNaN(d) || b.value(d)) + : ((c = Math.round((d / p) * c)), isNaN(c) || a.value(c))), + (o = c), + (p = d)); + } + function f() { + function b(b) { + function c() { + (b.onload = b.onerror = null), + a.selection && (a.selection.select(b), a.nodeChanged()); + } + (b.onload = function () { + s.width || + s.height || + !u || + t.setAttribs(b, { width: b.clientWidth, height: b.clientHeight }), + c(); + }), + (b.onerror = c); + } + var c, d; + j(), + e(), + (s = tinymce.extend(s, l.toJSON())), + s.alt || (s.alt = ''), + s.title || (s.title = ''), + '' === s.width && (s.width = null), + '' === s.height && (s.height = null), + s.style || (s.style = null), + (s = { + src: s.src, + alt: s.alt, + title: s.title, + width: s.width, + height: s.height, + style: s.style, + caption: s.caption, + class: s['class'], + }), + a.undoManager.transact(function () { + function e(b) { + return a.schema.getTextBlockElements()[b.nodeName]; + } + if (!s.src) + return void (m && (t.remove(m), a.focus(), a.nodeChanged())); + if ( + ('' === s.title && (s.title = null), + m + ? t.setAttribs(m, s) + : ((s.id = '__mcenew'), + a.focus(), + a.selection.setContent(t.createHTML('img', s)), + (m = t.get('__mcenew')), + t.setAttrib(m, 'id', null)), + a.editorUpload.uploadImagesAuto(), + s.caption === !1 && + t.is(m.parentNode, 'figure.image') && + ((c = m.parentNode), t.insertAfter(m, c), t.remove(c)), + s.caption !== !0) + ) + b(m); + else if (!t.is(m.parentNode, 'figure.image')) { + (d = m), + (m = m.cloneNode(!0)), + (c = t.create('figure', { class: 'image' })), + c.appendChild(m), + c.appendChild( + t.create('figcaption', { contentEditable: !0 }, 'Caption') + ), + (c.contentEditable = !1); + var f = t.getParent(d, e); + f ? t.split(f, d, c) : t.replace(c, d), a.selection.select(c); + } + }); + } + function g(a) { + return a && (a = a.replace(/px$/, '')), a; + } + function h(c) { + var d, + e, + f, + g = c.meta || {}; + q && q.value(a.convertURL(this.value(), 'src')), + tinymce.each(g, function (a, b) { + l.find('#' + b).value(a); + }), + g.width || + g.height || + ((d = a.convertURL(this.value(), 'src')), + (e = a.settings.image_prepend_url), + (f = new RegExp('^(?:[a-z]+:)?//', 'i')), + e && !f.test(d) && d.substring(0, e.length) !== e && (d = e + d), + this.value(d), + b(a.documentBaseURI.toAbsolute(this.value()), function (a) { + a.width && + a.height && + u && + ((o = a.width), + (p = a.height), + l.find('#width').value(o), + l.find('#height').value(p)); + })); + } + function i(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; + } + function j() { + function b(a) { + return a.length > 0 && /^[0-9]+$/.test(a) && (a += 'px'), a; + } + if (a.settings.image_advtab) { + var c = l.toJSON(), + d = t.parseStyle(c.style); + (d = i(d)), + c.vspace && (d['margin-top'] = d['margin-bottom'] = b(c.vspace)), + c.hspace && (d['margin-left'] = d['margin-right'] = b(c.hspace)), + c.border && (d['border-width'] = b(c.border)), + l + .find('#style') + .value(t.serializeStyle(t.parseStyle(t.serializeStyle(d)))); + } + } + function k() { + if (a.settings.image_advtab) { + var b = l.toJSON(), + c = t.parseStyle(b.style); + l.find('#vspace').value(''), + l.find('#hspace').value(''), + (c = i(c)), + ((c['margin-top'] && c['margin-bottom']) || + (c['margin-right'] && c['margin-left'])) && + (c['margin-top'] === c['margin-bottom'] + ? l.find('#vspace').value(g(c['margin-top'])) + : l.find('#vspace').value(''), + c['margin-right'] === c['margin-left'] + ? l.find('#hspace').value(g(c['margin-right'])) + : l.find('#hspace').value('')), + c['border-width'] && l.find('#border').value(g(c['border-width'])), + l + .find('#style') + .value(t.serializeStyle(t.parseStyle(t.serializeStyle(c)))); + } + } + var l, + m, + n, + o, + p, + q, + r, + s = {}, + t = a.dom, + u = a.settings.image_dimensions !== !1; + (m = a.selection.getNode()), + (n = t.getParent(m, 'figure.image')), + n && (m = t.select('img', n)[0]), + m && + ('IMG' != m.nodeName || + m.getAttribute('data-mce-object') || + m.getAttribute('data-mce-placeholder')) && + (m = null), + m && + ((o = t.getAttrib(m, 'width')), + (p = t.getAttrib(m, 'height')), + (s = { + src: t.getAttrib(m, 'src'), + alt: t.getAttrib(m, 'alt'), + title: t.getAttrib(m, 'title'), + class: t.getAttrib(m, 'class'), + width: o, + height: p, + caption: !!n, + })), + d && + (q = { + type: 'listbox', + label: 'Image list', + values: c( + d, + function (b) { + b.value = a.convertURL(b.value || b.url, 'src'); + }, + [{ text: 'None', value: '' }] + ), + value: s.src && a.convertURL(s.src, 'src'), + onselect: function (a) { + var b = l.find('#alt'); + (!b.value() || + (a.lastControl && b.value() == a.lastControl.text())) && + b.value(a.control.text()), + l.find('#src').value(a.control.value()).fire('change'); + }, + onPostRender: function () { + q = this; + }, + }), + a.settings.image_class_list && + (r = { + name: 'class', + type: 'listbox', + label: 'Class', + values: c(a.settings.image_class_list, function (b) { + b.value && + (b.textStyle = function () { + return a.formatter.getCssText({ + inline: 'img', + classes: [b.value], + }); + }); + }), + }); + var v = [ + { + name: 'src', + type: 'filepicker', + filetype: 'image', + label: 'Source', + autofocus: !0, + onchange: h, + }, + q, + ]; + a.settings.image_description !== !1 && + v.push({ name: 'alt', type: 'textbox', label: 'Image description' }), + a.settings.image_title && + v.push({ name: 'title', type: 'textbox', label: 'Image Title' }), + u && + v.push({ + type: 'container', + label: 'Dimensions', + layout: 'flex', + direction: 'row', + align: 'center', + spacing: 5, + items: [ + { + name: 'width', + type: 'textbox', + maxLength: 5, + size: 3, + onchange: e, + ariaLabel: 'Width', + }, + { type: 'label', text: 'x' }, + { + name: 'height', + type: 'textbox', + maxLength: 5, + size: 3, + onchange: e, + ariaLabel: 'Height', + }, + { + name: 'constrain', + type: 'checkbox', + checked: !0, + text: 'Constrain proportions', + }, + ], + }), + v.push(r), + a.settings.image_caption && + tinymce.Env.ceFalse && + v.push({ name: 'caption', type: 'checkbox', label: 'Caption' }), + a.settings.image_advtab + ? (m && + (m.style.marginLeft && + m.style.marginRight && + m.style.marginLeft === m.style.marginRight && + (s.hspace = g(m.style.marginLeft)), + m.style.marginTop && + m.style.marginBottom && + m.style.marginTop === m.style.marginBottom && + (s.vspace = g(m.style.marginTop)), + m.style.borderWidth && (s.border = g(m.style.borderWidth)), + (s.style = a.dom.serializeStyle( + a.dom.parseStyle(a.dom.getAttrib(m, 'style')) + ))), + (l = a.windowManager.open({ + title: 'Insert/edit image', + data: s, + bodyType: 'tabpanel', + body: [ + { title: 'General', type: 'form', items: v }, + { + title: 'Advanced', + type: 'form', + pack: 'start', + items: [ + { + label: 'Style', + name: 'style', + type: 'textbox', + onchange: k, + }, + { + type: 'form', + layout: 'grid', + packV: 'start', + columns: 2, + padding: 0, + alignH: ['left', 'right'], + defaults: { type: 'textbox', maxWidth: 50, onchange: j }, + items: [ + { label: 'Vertical space', name: 'vspace' }, + { label: 'Horizontal space', name: 'hspace' }, + { label: 'Border', name: 'border' }, + ], + }, + ], + }, + ], + onSubmit: f, + }))) + : (l = a.windowManager.open({ + title: 'Insert/edit image', + data: s, + body: v, + onSubmit: f, + })); + } + a.on('preInit', function () { + function b(a) { + var b = a.attr('class'); + return b && /\bimage\b/.test(b); + } + function c(a) { + return function (c) { + function d(b) { + b.attr('contenteditable', a ? 'true' : null); + } + for (var e, f = c.length; f--; ) + (e = c[f]), + b(e) && + (e.attr('contenteditable', a ? 'false' : null), + tinymce.each(e.getAll('figcaption'), d)); + }; + } + a.parser.addNodeFilter('figure', c(!0)), + a.serializer.addNodeFilter('figure', c(!1)); + }), + a.addButton('image', { + icon: 'image', + tooltip: 'Insert/edit image', + onclick: d(e), + stateSelector: + 'img:not([data-mce-object],[data-mce-placeholder]),figure.image', + }), + a.addMenuItem('image', { + icon: 'image', + text: 'Insert/edit image', + onclick: d(e), + context: 'insert', + prependToContext: !0, + }), + a.addCommand('mceImage', d(e)); +}); diff --git a/src/baseframe/static/js/tinymce4/plugins/imagetools/plugin.min.js b/src/baseframe/static/js/tinymce4/plugins/imagetools/plugin.min.js new file mode 100644 index 00000000..7bed7023 --- /dev/null +++ b/src/baseframe/static/js/tinymce4/plugins/imagetools/plugin.min.js @@ -0,0 +1,1799 @@ +!(function (a, b) { + 'use strict'; + function c(a, b) { + for (var c, d = [], f = 0; f < a.length; ++f) { + if (((c = g[a[f]] || e(a[f])), !c)) + throw 'module definition dependecy not found: ' + a[f]; + d.push(c); + } + b.apply(null, d); + } + function d(a, d, e) { + if ('string' != typeof a) + throw 'invalid module definition, module id must be defined and be a string'; + if (d === b) + throw 'invalid module definition, dependencies must be specified'; + if (e === b) + throw 'invalid module definition, definition function must be specified'; + c(d, function () { + g[a] = e.apply(null, arguments); + }); + } + function e(b) { + for (var c = a, d = b.split(/[.\/]/), e = 0; e < d.length; ++e) { + if (!c[d[e]]) return; + c = c[d[e]]; + } + return c; + } + function f(c) { + var d, e, f, h, i; + for (d = 0; d < c.length; d++) { + (e = a), (f = c[d]), (h = f.split(/[.\/]/)); + for (var j = 0; j < h.length - 1; ++j) + e[h[j]] === b && (e[h[j]] = {}), (e = e[h[j]]); + e[h[h.length - 1]] = g[f]; + } + if (a.AMDLC_TESTS) { + i = a.privateModules || {}; + for (f in g) i[f] = g[f]; + for (d = 0; d < c.length; d++) delete i[c[d]]; + a.privateModules = i; + } + } + var g = {}; + d('tinymce/imagetoolsplugin/Canvas', [], function () { + function a(a, b) { + return c(document.createElement('canvas'), a, b); + } + function b(a) { + return a.getContext('2d'); + } + function c(a, b, c) { + return (a.width = b), (a.height = c), a; + } + return { create: a, resize: c, get2dContext: b }; + }), + d('tinymce/imagetoolsplugin/Mime', [], function () { + function a(a) { + var b = document.createElement('a'); + return (b.href = a), b.pathname; + } + function b(b) { + var c = a(b).split('.'), + d = c[c.length - 1], + e = { jpg: 'image/jpeg', jpeg: 'image/jpeg', png: 'image/png' }; + return d && (d = d.toLowerCase()), e[d]; + } + return { guessMimeType: b }; + }), + d('tinymce/imagetoolsplugin/ImageSize', [], function () { + function a(a) { + return a.naturalWidth || a.width; + } + function b(a) { + return a.naturalHeight || a.height; + } + return { getWidth: a, getHeight: b }; + }), + d( + 'tinymce/imagetoolsplugin/Conversions', + [ + 'tinymce/util/Promise', + 'tinymce/imagetoolsplugin/Canvas', + 'tinymce/imagetoolsplugin/Mime', + 'tinymce/imagetoolsplugin/ImageSize', + ], + function (a, b, c, d) { + function e(b) { + return new a(function (a) { + function c() { + b.removeEventListener('load', c), a(b); + } + b.complete ? a(b) : b.addEventListener('load', c); + }); + } + function f(a) { + return e(a).then(function (a) { + var c, e; + return ( + (e = b.create(d.getWidth(a), d.getHeight(a))), + (c = b.get2dContext(e)), + c.drawImage(a, 0, 0), + e + ); + }); + } + function g(a) { + return e(a).then(function (a) { + var b = a.src; + return 0 === b.indexOf('blob:') + ? i(b) + : 0 === b.indexOf('data:') + ? j(b) + : f(a).then(function (a) { + return j(a.toDataURL(c.guessMimeType(b))); + }); + }); + } + function h(b) { + return new a(function (a) { + function c() { + d.removeEventListener('load', c), a(d); + } + var d = new Image(); + d.addEventListener('load', c), + (d.src = URL.createObjectURL(b)), + d.complete && c(); + }); + } + function i(b) { + return new a(function (a) { + var c = new XMLHttpRequest(); + c.open('GET', b, !0), + (c.responseType = 'blob'), + (c.onload = function () { + 200 == this.status && a(this.response); + }), + c.send(); + }); + } + function j(b) { + return new a(function (a) { + var c, d, e, f, g, h; + if ( + ((b = b.split(',')), + (f = /data:([^;]+)/.exec(b[0])), + f && (g = f[1]), + (c = atob(b[1])), + window.WebKitBlobBuilder) + ) { + for ( + h = new WebKitBlobBuilder(), + d = new ArrayBuffer(c.length), + e = 0; + e < d.length; + e++ + ) + d[e] = c.charCodeAt(e); + return h.append(d), void a(h.getBlob(g)); + } + for (d = new Uint8Array(c.length), e = 0; e < d.length; e++) + d[e] = c.charCodeAt(e); + a(new Blob([d], { type: g })); + }); + } + function k(a) { + return 0 === a.indexOf('blob:') + ? i(a) + : 0 === a.indexOf('data:') + ? j(a) + : null; + } + function l(a, b) { + return j(a.toDataURL(b)); + } + function m(b) { + return new a(function (a) { + var c = new FileReader(); + (c.onloadend = function () { + a(c.result); + }), + c.readAsDataURL(b); + }); + } + function n(a) { + return m(a).then(function (a) { + return a.split(',')[1]; + }); + } + function o(a) { + URL.revokeObjectURL(a.src); + } + return { + blobToImage: h, + imageToBlob: g, + uriToBlob: k, + blobToDataUri: m, + blobToBase64: n, + imageToCanvas: f, + canvasToBlob: l, + revokeImageUrl: o, + }; + } + ), + d( + 'tinymce/imagetoolsplugin/ImageTools', + [ + 'tinymce/imagetoolsplugin/Conversions', + 'tinymce/imagetoolsplugin/Canvas', + 'tinymce/imagetoolsplugin/ImageSize', + ], + function (a, b, c) { + function d(d, e) { + return a.blobToImage(d).then(function (f) { + var g = b.create(c.getWidth(f), c.getHeight(f)), + i = b.get2dContext(g), + j = 0, + k = 0; + return ( + (e = 0 > e ? 360 + e : e), + (90 == e || 270 == e) && b.resize(g, g.height, g.width), + (90 == e || 180 == e) && (j = g.width), + (270 == e || 180 == e) && (k = g.height), + i.translate(j, k), + i.rotate((e * Math.PI) / 180), + i.drawImage(f, 0, 0), + h(f), + a.canvasToBlob(g, d.type) + ); + }); + } + function e(d, e) { + return a.blobToImage(d).then(function (d) { + var f = b.create(c.getWidth(d), c.getHeight(d)), + g = b.get2dContext(f); + return ( + 'v' == e + ? (g.scale(1, -1), g.drawImage(d, 0, -f.height)) + : (g.scale(-1, 1), g.drawImage(d, -f.width, 0)), + h(d), + a.canvasToBlob(f) + ); + }); + } + function f(c, d, e, f, g) { + return a.blobToImage(c).then(function (c) { + var i = b.create(f, g), + j = b.get2dContext(i); + return j.drawImage(c, -d, -e), h(c), a.canvasToBlob(i); + }); + } + function g(c, d, e) { + return a.blobToImage(c).then(function (f) { + var g = b.create(d, e), + i = b.get2dContext(g); + return i.drawImage(f, 0, 0, d, e), h(f), a.canvasToBlob(g, c.type); + }); + } + var h = a.revokeImageUrl; + return { rotate: d, flip: e, crop: f, resize: g }; + } + ), + d( + 'tinymce/imagetoolsplugin/CropRect', + [ + 'tinymce/dom/DomQuery', + 'tinymce/ui/DragHelper', + 'tinymce/geom/Rect', + 'tinymce/util/Tools', + 'tinymce/util/Observable', + ], + function (a, b, c, d, e) { + var f = 0; + return function (g, h, i, j) { + function k(a, b) { + return { x: b.x + a.x, y: b.y + a.y, w: b.w, h: b.h }; + } + function l(a, b) { + return { x: b.x - a.x, y: b.y - a.y, w: b.w, h: b.h }; + } + function m() { + return l(i, g); + } + function n() { + function e(a) { + var d; + return new b(A, { + document: j.ownerDocument, + handle: A + '-' + a.name, + start: function () { + d = g; + }, + drag: function (b) { + var e, f, h, j, k; + (e = d.x), + (f = d.y), + (h = d.w), + (j = d.h), + (e += b.deltaX * a.deltaX), + (f += b.deltaY * a.deltaY), + (h += b.deltaX * a.deltaW), + (j += b.deltaY * a.deltaH), + 20 > h && (h = 20), + 20 > j && (j = 20), + (k = g = + c.clamp({ x: e, y: f, w: h, h: j }, i, 'move' == a.name)), + (k = l(i, k)), + v.fire('updateRect', { rect: k }), + s(k); + }, + }); + } + a( + '
' + ).appendTo(j), + d.each(y, function (b) { + a('#' + A, j).append( + ''},postRender:function(){var e=this;e._super(),e.resizeDragHelper=new t(this._id,{start:function(){e.fire("ResizeStart")},drag:function(t){"both"!=e.settings.direction&&(t.deltaX=0),e.fire("Resize",t)},stop:function(){e.fire("ResizeEnd")}})},remove:function(){return this.resizeDragHelper&&this.resizeDragHelper.destroy(),this._super()}})}),r(It,[ke],function(e){function t(e){var t="";if(e)for(var n=0;n'+e[n]+"";return t}return e.extend({Defaults:{classes:"selectbox",role:"selectbox",options:[]},init:function(e){var t=this;t._super(e),t.settings.size&&(t.size=t.settings.size),t.settings.options&&(t._options=t.settings.options)},options:function(e){return arguments.length?(this.state.set("options",e),this):this.state.get("options")},renderHtml:function(){var e=this,n,r="";return n=t(e._options),e.size&&(r=' size = "'+e.size+'"'),'"},bindStates:function(){var e=this;return e.state.on("change:options",function(n){e.getEl().innerHTML=t(n.value)}),e._super()}})}),r(Ft,[ke,ve,ce],function(e,t,n){function r(e,t,n){return t>e&&(e=t),e>n&&(e=n),e}function i(e,t){var r,i,o,a,s;"v"==e.settings.orientation?(a="top",o="height",i="h"):(a="left",o="width",i="w"),r=(e.layoutRect()[i]||100)-n.getSize(e.getEl("handle"))[o],s=r*((t-e._minValue)/(e._maxValue-e._minValue))+"px",e.getEl("handle").style[a]=s,e.getEl("handle").style.height=e.layoutRect().h+"px"}return e.extend({init:function(e){var t=this;e.previewFilter||(e.previewFilter=function(e){return Math.round(100*e)/100}),t._super(e),t.classes.add("slider"),"v"==e.orientation&&t.classes.add("vertical"),t._minValue=e.minValue||0,t._maxValue=e.maxValue||100,t._initValue=t.state.get("value")},renderHtml:function(){var e=this,t=e._id,n=e.classPrefix;return'
'},reset:function(){this.value(this._initValue).repaint()},postRender:function(){var e=this,i,o,a=0,s,l,c,u,d,f,h,m;l=e._minValue,c=e._maxValue,s=e.value(),"v"==e.settings.orientation?(d="screenY",f="top",h="height",m="h"):(d="screenX",f="left",h="width",m="w"),e._super(),e._dragHelper=new t(e._id,{handle:e._id+"-handle",start:function(t){i=t[d],o=parseInt(e.getEl("handle").style[f],10),u=(e.layoutRect()[m]||100)-n.getSize(e.getEl("handle"))[h],e.fire("dragstart",{value:s})},drag:function(t){var n=t[d]-i,h=e.getEl("handle");a=r(o+n,0,u),h.style[f]=a+"px",s=l+a/u*(c-l),e.value(s),e.tooltip().text(""+e.settings.previewFilter(s)).show().moveRel(h,"bc tc"),e.fire("drag",{value:s})},stop:function(){e.tooltip().hide(),e.fire("dragend",{value:s})}})},repaint:function(){this._super(),i(this,this.value())},bindStates:function(){var e=this;return e.state.on("change:value",function(t){i(e,t.value)}),e._super()}})}),r(zt,[ke],function(e){return e.extend({renderHtml:function(){var e=this;return e.classes.add("spacer"),e.canFocus=!1,'
'}})}),r(Wt,[Dt,ce,g],function(e,t,n){return e.extend({Defaults:{classes:"widget btn splitbtn",role:"button"},repaint:function(){var e=this,r=e.getEl(),i=e.layoutRect(),o,a;return e._super(),o=r.firstChild,a=r.lastChild,n(o).css({width:i.w-t.getSize(a).width,height:i.h-2}),n(a).css({height:i.h-2}),e},activeMenu:function(e){var t=this;n(t.getEl().lastChild).toggleClass(t.classPrefix+"active",e)},renderHtml:function(){var e=this,t=e._id,n=e.classPrefix,r,i=e.state.get("icon"),o=e.state.get("text"),a="";return r=e.settings.image,r?(i="none","string"!=typeof r&&(r=window.getSelection?r[0]:r[1]),r=" style=\"background-image: url('"+r+"')\""):r="",i=e.settings.icon?n+"ico "+n+"i-"+i:"",o&&(e.classes.add("btn-has-text"),a=''+e.encode(o)+""),'
'},postRender:function(){var e=this,t=e.settings.onclick;return e.on("click",function(e){var n=e.target;if(e.control==this)for(;n;){if(e.aria&&"down"!=e.aria.key||"BUTTON"==n.nodeName&&-1==n.className.indexOf("open"))return e.stopImmediatePropagation(),void(t&&t.call(this,e));n=n.parentNode}}),delete e.settings.onclick,e._super()}})}),r(Vt,[_t],function(e){return e.extend({Defaults:{containerClass:"stack-layout",controlClass:"stack-layout-item",endClass:"break"},isNative:function(){return!0}})}),r(Ut,[be,g,ce],function(e,t,n){return e.extend({Defaults:{layout:"absolute",defaults:{type:"panel"}},activateTab:function(e){var n;this.activeTabId&&(n=this.getEl(this.activeTabId),t(n).removeClass(this.classPrefix+"active"),n.setAttribute("aria-selected","false")),this.activeTabId="t"+e,n=this.getEl("t"+e),n.setAttribute("aria-selected","true"),t(n).addClass(this.classPrefix+"active"),this.items()[e].show().fire("showtab"),this.reflow(),this.items().each(function(t,n){e!=n&&t.hide()})},renderHtml:function(){var e=this,t=e._layout,n="",r=e.classPrefix;return e.preRender(),t.preRender(e),e.items().each(function(t,i){var o=e._id+"-t"+i;t.aria("role","tabpanel"),t.aria("labelledby",o),n+='"}),'
'+n+'
'+t.renderHtml(e)+"
"},postRender:function(){var e=this;e._super(),e.settings.activeTab=e.settings.activeTab||0,e.activateTab(e.settings.activeTab),this.on("click",function(t){var n=t.target.parentNode;if(t.target.parentNode.id==e._id+"-head")for(var r=n.childNodes.length;r--;)n.childNodes[r]==t.target&&e.activateTab(r)})},initLayoutRect:function(){var e=this,t,r,i;r=n.getSize(e.getEl("head")).width,r=0>r?0:r,i=0,e.items().each(function(e){r=Math.max(r,e.layoutRect().minW),i=Math.max(i,e.layoutRect().minH)}),e.items().each(function(e){e.settings.x=0,e.settings.y=0,e.settings.w=r,e.settings.h=i,e.layoutRect({x:0,y:0,w:r,h:i})});var o=n.getSize(e.getEl("head")).height;return e.settings.minWidth=r,e.settings.minHeight=i+o,t=e._super(),t.deltaH+=o,t.innerH=t.h-t.deltaH,t}})}),r($t,[ke],function(e){return e.extend({init:function(e){var t=this;t._super(e),t.classes.add("textbox"),e.multiline?t.classes.add("multiline"):(t.on("keydown",function(e){var n;13==e.keyCode&&(e.preventDefault(),t.parents().reverse().each(function(e){return e.toJSON?(n=e,!1):void 0}),t.fire("submit",{data:n.toJSON()}))}),t.on("keyup",function(e){t.state.set("value",e.target.value)}))},repaint:function(){var e=this,t,n,r,i,o=0,a;t=e.getEl().style,n=e._layoutRect,a=e._lastRepaintRect||{};var s=document;return!e.settings.multiline&&s.all&&(!s.documentMode||s.documentMode<=8)&&(t.lineHeight=n.h-o+"px"),r=e.borderBox,i=r.left+r.right+8,o=r.top+r.bottom+(e.settings.multiline?8:0),n.x!==a.x&&(t.left=n.x+"px",a.x=n.x),n.y!==a.y&&(t.top=n.y+"px",a.y=n.y),n.w!==a.w&&(t.width=n.w-i+"px",a.w=n.w),n.h!==a.h&&(t.height=n.h-o+"px",a.h=n.h),e._lastRepaintRect=a,e.fire("repaint",{},!1),e},renderHtml:function(){var e=this,t=e._id,n=e.settings,r=e.encode(e.state.get("value"),!1),i="";return"spellcheck"in n&&(i+=' spellcheck="'+n.spellcheck+'"'),n.maxLength&&(i+=' maxlength="'+n.maxLength+'"'),n.size&&(i+=' size="'+n.size+'"'),n.subtype&&(i+=' type="'+n.subtype+'"'),e.disabled()&&(i+=' disabled="disabled"'),n.multiline?'":'"},value:function(e){return arguments.length?(this.state.set("value",e),this):(this.state.get("rendered")&&this.state.set("value",this.getEl().value),this.state.get("value"))},postRender:function(){var e=this;e._super(),e.$el.on("change",function(t){e.state.set("value",t.target.value),e.fire("change",t)})},bindStates:function(){var e=this;return e.state.on("change:value",function(t){e.getEl().value!=t.value&&(e.getEl().value=t.value)}),e.state.on("change:disabled",function(t){e.getEl().disabled=t.value}),e._super()},remove:function(){this.$el.off(),this._super()}})}),r(qt,[g,he,u],function(e,t,n){return function(r,i){var o=this,a,s=t.classPrefix;o.show=function(t,l){return o.hide(),a=!0,n.setTimeout(function(){a&&(e(r).append('
'),l&&l())},t),o},o.hide=function(){var e=r.lastChild;return e&&-1!=e.className.indexOf("throbber")&&e.parentNode.removeChild(e),a=!1,o}}}),a([l,c,u,d,f,h,p,g,v,y,C,w,E,N,T,A,B,D,M,L,P,H,I,F,j,Y,G,J,ee,te,ne,re,oe,se,le,fe,he,me,pe,ge,ve,ye,be,Ce,xe,we,Ee,Ne,_e,Se,ke,Te,Re,Ae,Me,Pe,Ke,Ge,Je,Qe,et,tt,nt,rt,it,ot,at,st,lt,ct,ut,dt,ft,ht,mt,pt,gt,vt,yt,bt,Ct,xt,wt,Et,Nt,_t,St,kt,Tt,Rt,At,Bt,Dt,Mt,Lt,Pt,Ht,Ot,It,Ft,zt,Wt,Vt,Ut,$t,qt])}(window);