bedrock_sass 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/assets/_vendor/tinymce/plugins/advlist/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/advlist/plugin.js +428 -0
- data/assets/_vendor/tinymce/plugins/advlist/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/anchor/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/anchor/plugin.js +338 -0
- data/assets/_vendor/tinymce/plugins/anchor/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/autolink/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/autolink/plugin.js +404 -0
- data/assets/_vendor/tinymce/plugins/autolink/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/autoresize/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/autoresize/plugin.js +451 -0
- data/assets/_vendor/tinymce/plugins/autoresize/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/autosave/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/autosave/plugin.js +608 -0
- data/assets/_vendor/tinymce/plugins/autosave/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/bbcode/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/bbcode/plugin.js +264 -0
- data/assets/_vendor/tinymce/plugins/bbcode/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/charmap/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/charmap/plugin.js +850 -0
- data/assets/_vendor/tinymce/plugins/charmap/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/code/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/code/plugin.js +338 -0
- data/assets/_vendor/tinymce/plugins/code/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/codesample/css/prism.css +138 -0
- data/assets/_vendor/tinymce/plugins/codesample/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/codesample/plugin.js +1582 -0
- data/assets/_vendor/tinymce/plugins/codesample/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/colorpicker/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/colorpicker/plugin.js +272 -0
- data/assets/_vendor/tinymce/plugins/colorpicker/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/contextmenu/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/contextmenu/plugin.js +496 -0
- data/assets/_vendor/tinymce/plugins/contextmenu/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/directionality/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/directionality/plugin.js +270 -0
- data/assets/_vendor/tinymce/plugins/directionality/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-cool.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-cry.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-embarassed.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-foot-in-mouth.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-frown.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-innocent.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-kiss.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-laughing.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-money-mouth.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-sealed.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-smile.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-surprised.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-tongue-out.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-undecided.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-wink.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-yell.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/emoticons/plugin.js +256 -0
- data/assets/_vendor/tinymce/plugins/emoticons/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/fullpage/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/fullpage/plugin.js +962 -0
- data/assets/_vendor/tinymce/plugins/fullpage/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/fullscreen/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/fullscreen/plugin.js +455 -0
- data/assets/_vendor/tinymce/plugins/fullscreen/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/help/img/logo.png +0 -0
- data/assets/_vendor/tinymce/plugins/help/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/help/plugin.js +1527 -0
- data/assets/_vendor/tinymce/plugins/help/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/hr/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/hr/plugin.js +195 -0
- data/assets/_vendor/tinymce/plugins/hr/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/image/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/image/plugin.js +1572 -0
- data/assets/_vendor/tinymce/plugins/image/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/imagetools/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/imagetools/plugin.js +4444 -0
- data/assets/_vendor/tinymce/plugins/imagetools/plugin.min.js +2 -0
- data/assets/_vendor/tinymce/plugins/importcss/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/importcss/plugin.js +577 -0
- data/assets/_vendor/tinymce/plugins/importcss/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/insertdatetime/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/insertdatetime/plugin.js +482 -0
- data/assets/_vendor/tinymce/plugins/insertdatetime/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/legacyoutput/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/legacyoutput/plugin.js +395 -0
- data/assets/_vendor/tinymce/plugins/legacyoutput/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/link/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/link/plugin.js +1231 -0
- data/assets/_vendor/tinymce/plugins/link/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/lists/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/lists/plugin.js +1985 -0
- data/assets/_vendor/tinymce/plugins/lists/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/media/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/media/plugin.js +2026 -0
- data/assets/_vendor/tinymce/plugins/media/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/nonbreaking/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/nonbreaking/plugin.js +313 -0
- data/assets/_vendor/tinymce/plugins/nonbreaking/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/noneditable/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/noneditable/plugin.js +316 -0
- data/assets/_vendor/tinymce/plugins/noneditable/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/pagebreak/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/pagebreak/plugin.js +354 -0
- data/assets/_vendor/tinymce/plugins/pagebreak/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/paste/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/paste/plugin.js +2935 -0
- data/assets/_vendor/tinymce/plugins/paste/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/preview/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/preview/plugin.js +410 -0
- data/assets/_vendor/tinymce/plugins/preview/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/print/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/print/plugin.js +194 -0
- data/assets/_vendor/tinymce/plugins/print/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/save/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/save/plugin.js +370 -0
- data/assets/_vendor/tinymce/plugins/save/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/searchreplace/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/searchreplace/plugin.js +977 -0
- data/assets/_vendor/tinymce/plugins/searchreplace/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/spellchecker/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/spellchecker/plugin.js +1419 -0
- data/assets/_vendor/tinymce/plugins/spellchecker/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/tabfocus/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/tabfocus/plugin.js +419 -0
- data/assets/_vendor/tinymce/plugins/tabfocus/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/table/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/table/plugin.js +15527 -0
- data/assets/_vendor/tinymce/plugins/table/plugin.min.js +5 -0
- data/assets/_vendor/tinymce/plugins/template/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/template/plugin.js +807 -0
- data/assets/_vendor/tinymce/plugins/template/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/textcolor/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/textcolor/plugin.js +619 -0
- data/assets/_vendor/tinymce/plugins/textcolor/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/textpattern/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/textpattern/plugin.js +718 -0
- data/assets/_vendor/tinymce/plugins/textpattern/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/toc/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/toc/plugin.js +559 -0
- data/assets/_vendor/tinymce/plugins/toc/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/visualblocks/css/visualblocks.css +154 -0
- data/assets/_vendor/tinymce/plugins/visualblocks/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/visualblocks/plugin.js +459 -0
- data/assets/_vendor/tinymce/plugins/visualblocks/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/visualchars/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/visualchars/plugin.js +1325 -0
- data/assets/_vendor/tinymce/plugins/visualchars/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/wordcount/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/wordcount/plugin.js +735 -0
- data/assets/_vendor/tinymce/plugins/wordcount/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/skins/lightgray/content.inline.min.css +1 -0
- data/assets/_vendor/tinymce/skins/lightgray/content.min.css +1 -0
- data/assets/_vendor/tinymce/skins/lightgray/content.mobile.min.css +1 -0
- data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce-mobile.woff +0 -0
- data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce-small.eot +0 -0
- data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce-small.svg +63 -0
- data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce-small.ttf +0 -0
- data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce-small.woff +0 -0
- data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce.eot +0 -0
- data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce.svg +131 -0
- data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce.ttf +0 -0
- data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce.woff +0 -0
- data/assets/_vendor/tinymce/skins/lightgray/img/anchor.gif +0 -0
- data/assets/_vendor/tinymce/skins/lightgray/img/loader.gif +0 -0
- data/assets/_vendor/tinymce/skins/lightgray/img/object.gif +0 -0
- data/assets/_vendor/tinymce/skins/lightgray/img/trans.gif +0 -0
- data/assets/_vendor/tinymce/skins/lightgray/skin.min.css +1 -0
- data/assets/_vendor/tinymce/skins/lightgray/skin.mobile.min.css +2 -0
- data/assets/_vendor/tinymce/themes/inlite/index.js +7 -0
- data/assets/_vendor/tinymce/themes/inlite/theme.js +18787 -0
- data/assets/_vendor/tinymce/themes/inlite/theme.min.js +5 -0
- data/assets/_vendor/tinymce/themes/mobile/index.js +7 -0
- data/assets/_vendor/tinymce/themes/mobile/theme.js +23384 -0
- data/assets/_vendor/tinymce/themes/mobile/theme.min.js +8 -0
- data/assets/_vendor/tinymce/themes/modern/index.js +7 -0
- data/assets/_vendor/tinymce/themes/modern/theme.js +18311 -0
- data/assets/_vendor/tinymce/themes/modern/theme.min.js +5 -0
- data/assets/_vendor/tinymce/tinymce.js +44399 -0
- data/assets/bedrock/js/bedrock.js +16587 -6193
- data/assets/bedrock/scss/_bedrock-components.scss +16 -0
- data/assets/bedrock/scss/_bedrock-settings.scss +15 -0
- data/assets/bedrock/scss/components/attachments-grid.scss +138 -0
- data/assets/bedrock/scss/components/dropzone-upload.scss +158 -0
- data/assets/bedrock/scss/components/global.scss +16 -8
- data/assets/bedrock/scss/components/helper-classes.scss +59 -0
- data/assets/bedrock/scss/components/inline-edit-box.scss +80 -0
- data/assets/bedrock/scss/components/login-box.scss +48 -0
- data/assets/bedrock/scss/components/no-content.scss +31 -0
- data/assets/bedrock/scss/components/off-canvas-menu.scss +1 -1
- data/assets/bedrock/scss/components/page-content.scss +51 -0
- data/assets/bedrock/scss/components/reveal-panel.scss +89 -0
- data/assets/bedrock/scss/components/select-box.scss +332 -0
- data/assets/bedrock/scss/components/tiny-mce-editor.scss +14 -7
- data/lib/bedrock_sass.rb +6 -0
- data/lib/bedrock_sass/engine.rb +8 -0
- data/lib/bedrock_sass/version.rb +1 -1
- data/lib/tasks/before_assets_precompile.rake +11 -0
- metadata +188 -2
@@ -0,0 +1 @@
|
|
1
|
+
!function(){var a={},b=function(b){for(var c=a[b],e=c.deps,f=c.defn,g=e.length,h=new Array(g),i=0;i<g;++i)h[i]=d(e[i]);var j=f.apply(null,h);if(void 0===j)throw"module ["+b+"] returned undefined";c.instance=j},c=function(b,c,d){if("string"!=typeof b)throw"module id must be a string";if(void 0===c)throw"no dependencies for "+b;if(void 0===d)throw"no definition function for "+b;a[b]={deps:c,defn:d,instance:void 0}},d=function(c){var d=a[c];if(void 0===d)throw"module ["+c+"] was undefined";return void 0===d.instance&&b(c),d.instance},e=function(a,b){for(var c=a.length,e=new Array(c),f=0;f<c;++f)e[f]=d(a[f]);b.apply(null,e)},f={};f.bolt={module:{api:{define:c,require:e,demand:d}}};var g=c,h=function(a,b){g(a,[],function(){return b})};h("5",tinymce.util.Tools.resolve),g("1",["5"],function(a){return a("tinymce.PluginManager")}),g("6",["5"],function(a){return a("tinymce.EditorManager")}),h("i",Array),h("j",Error),g("d",["i","j"],function(a,b){var c=function(){},d=function(a){return function(){return a()}},e=function(a,b){return function(){return a(b.apply(null,arguments))}},f=function(a){return function(){return a}},g=function(a){return a},h=function(a,b){return a===b},i=function(b){for(var c=new a(arguments.length-1),d=1;d<arguments.length;d++)c[d-1]=arguments[d];return function(){for(var d=new a(arguments.length),e=0;e<d.length;e++)d[e]=arguments[e];var f=c.concat(d);return b.apply(null,f)}},j=function(a){return function(){return!a.apply(null,arguments)}},k=function(a){return function(){throw new b(a)}},l=function(a){return a()},m=function(a){a()},n=f(!1),o=f(!0);return{noop:c,noarg:d,compose:e,constant:f,identity:g,tripleEquals:h,curry:i,not:j,die:k,apply:l,call:m,never:n,always:o}}),h("m",Object),g("h",["d","m"],function(a,b){var c=a.never,d=a.always,e=function(){return f},f=function(){var f=function(a){return a.isNone()},g=function(a){return a()},h=function(a){return a},i=function(){},j={fold:function(a,b){return a()},is:c,isSome:c,isNone:d,getOr:h,getOrThunk:g,getOrDie:function(a){throw new Error(a||"error: getOrDie called on none.")},or:h,orThunk:g,map:e,ap:e,each:i,bind:e,flatten:e,exists:c,forall:d,filter:e,equals:f,equals_:f,toArray:function(){return[]},toString:a.constant("none()")};return b.freeze&&b.freeze(j),j}(),g=function(a){var b=function(){return a},h=function(){return k},i=function(b){return g(b(a))},j=function(b){return b(a)},k={fold:function(b,c){return c(a)},is:function(b){return a===b},isSome:d,isNone:c,getOr:b,getOrThunk:b,getOrDie:b,or:h,orThunk:h,map:i,ap:function(b){return b.fold(e,function(b){return g(b(a))})},each:function(b){b(a)},bind:j,flatten:b,exists:j,forall:j,filter:function(b){return b(a)?k:f},equals:function(b){return b.is(a)},equals_:function(b,d){return b.fold(c,function(b){return d(a,b)})},toArray:function(){return[a]},toString:function(){return"some("+a+")"}};return k},h=function(a){return null===a||void 0===a?f:g(a)};return{some:g,none:e,from:h}}),h("k",String),g("a",["h","i","j","k"],function(a,b,c,d){var e=function(){var a=b.prototype.indexOf,c=function(b,c){return a.call(b,c)},d=function(a,b){return u(a,b)};return void 0===a?d:c}(),f=function(b,c){var d=e(b,c);return d===-1?a.none():a.some(d)},g=function(a,b){return e(a,b)>-1},h=function(a,b){return t(a,b).isSome()},i=function(a,b){for(var c=[],d=0;d<a;d++)c.push(b(d));return c},j=function(a,b){for(var c=[],d=0;d<a.length;d+=b){var e=a.slice(d,d+b);c.push(e)}return c},k=function(a,c){for(var d=a.length,e=new b(d),f=0;f<d;f++){var g=a[f];e[f]=c(g,f,a)}return e},l=function(a,b){for(var c=0,d=a.length;c<d;c++){var e=a[c];b(e,c,a)}},m=function(a,b){for(var c=a.length-1;c>=0;c--){var d=a[c];b(d,c,a)}},n=function(a,b){for(var c=[],d=[],e=0,f=a.length;e<f;e++){var g=a[e],h=b(g,e,a)?c:d;h.push(g)}return{pass:c,fail:d}},o=function(a,b){for(var c=[],d=0,e=a.length;d<e;d++){var f=a[d];b(f,d,a)&&c.push(f)}return c},p=function(a,b){if(0===a.length)return[];for(var c=b(a[0]),d=[],e=[],f=0,g=a.length;f<g;f++){var h=a[f],i=b(h);i!==c&&(d.push(e),e=[]),c=i,e.push(h)}return 0!==e.length&&d.push(e),d},q=function(a,b,c){return m(a,function(a){c=b(c,a)}),c},r=function(a,b,c){return l(a,function(a){c=b(c,a)}),c},s=function(b,c){for(var d=0,e=b.length;d<e;d++){var f=b[d];if(c(f,d,b))return a.some(f)}return a.none()},t=function(b,c){for(var d=0,e=b.length;d<e;d++){var f=b[d];if(c(f,d,b))return a.some(d)}return a.none()},u=function(a,b){for(var c=0,d=a.length;c<d;++c)if(a[c]===b)return c;return-1},v=b.prototype.push,w=function(a){for(var d=[],e=0,f=a.length;e<f;++e){if(!b.prototype.isPrototypeOf(a[e]))throw new c("Arr.flatten item "+e+" was not an array, input: "+a);v.apply(d,a[e])}return d},x=function(a,b){var c=k(a,b);return w(c)},y=function(a,b){for(var c=0,d=a.length;c<d;++c){var e=a[c];if(b(e,c,a)!==!0)return!1}return!0},z=function(a,b){return a.length===b.length&&y(a,function(a,c){return a===b[c]})},A=b.prototype.slice,B=function(a){var b=A.call(a,0);return b.reverse(),b},C=function(a,b){return o(a,function(a){return!g(b,a)})},D=function(a,b){for(var c={},e=0,f=a.length;e<f;e++){var g=a[e];c[d(g)]=b(g,e)}return c},E=function(a){return[a]},F=function(a,b){var c=A.call(a,0);return c.sort(b),c},G=function(b){return 0===b.length?a.none():a.some(b[0])},H=function(b){return 0===b.length?a.none():a.some(b[b.length-1])};return{map:k,each:l,eachr:m,partition:n,filter:o,groupBy:p,indexOf:f,foldr:q,foldl:r,find:s,findIndex:t,flatten:w,bind:x,forall:y,exists:h,contains:g,equal:z,reverse:B,chunk:j,difference:C,mapToObject:D,pure:E,sort:F,range:i,head:G,last:H}}),g("b",["5"],function(a){return a("tinymce.util.I18n")}),g("l",["5"],function(a){return a("tinymce.Env")}),g("c",["l"],function(a){var b=a.mac?"\u2318":"Ctrl",c=a.mac?"Ctrl + Alt":"Shift + Alt",d=[{shortcut:b+" + B",action:"Bold"},{shortcut:b+" + I",action:"Italic"},{shortcut:b+" + U",action:"Underline"},{shortcut:b+" + A",action:"Select all"},{shortcut:b+" + Y or "+b+" + Shift + Z",action:"Redo"},{shortcut:b+" + Z",action:"Undo"},{shortcut:c+" + 1",action:"Header 1"},{shortcut:c+" + 2",action:"Header 2"},{shortcut:c+" + 3",action:"Header 3"},{shortcut:c+" + 4",action:"Header 4"},{shortcut:c+" + 5",action:"Header 5"},{shortcut:c+" + 6",action:"Header 6"},{shortcut:c+" + 7",action:"Paragraph"},{shortcut:c+" + 8",action:"Div"},{shortcut:c+" + 9",action:"Address"},{shortcut:"Alt + F9",action:"Focus to menubar"},{shortcut:"Alt + F10",action:"Focus to toolbar"},{shortcut:"Alt + F11",action:"Focus to element path"},{shortcut:"Ctrl + Shift + P > Ctrl + Shift + P",action:"Focus to contextual toolbar"},{shortcut:b+" + K",action:"Insert link (if link plugin activated)"},{shortcut:b+" + S",action:"Save (if save plugin activated)"},{shortcut:b+" + F",action:"Find (if searchreplace plugin activated)"}];return{shortcuts:d}}),g("7",["a","b","c"],function(a,b,c){var d=function(){var d=function(a){return'aria-label="Action: '+a.action+", Shortcut: "+a.shortcut.replace(/Ctrl/g,"Control")+'"'},e=a.map(c.shortcuts,function(a){return'<tr data-mce-tabstop="1" tabindex="-1" '+d(a)+"><td>"+b.translate(a.action)+"</td><td>"+a.shortcut+"</td></tr>"}).join("");return{title:"Handy Shortcuts",type:"container",style:"overflow-y: auto; overflow-x: hidden; max-height: 250px",items:[{type:"container",html:'<div><table class="mce-table-striped"><thead><th>'+b.translate("Action")+"</th><th>"+b.translate("Shortcut")+"</th></thead>"+e+"</table></div>"}]}};return{makeTab:d}}),g("e",["h","m"],function(a,b){var c=function(){var a=b.keys,c=function(a){var b=[];for(var c in a)a.hasOwnProperty(c)&&b.push(c);return b};return void 0===a?c:a}(),d=function(a,b){for(var d=c(a),e=0,f=d.length;e<f;e++){var g=d[e],h=a[g];b(h,g,a)}},e=function(a,b){return f(a,function(a,c,d){return{k:c,v:b(a,c,d)}})},f=function(a,b){var c={};return d(a,function(d,e){var f=b(d,e,a);c[f.k]=f.v}),c},g=function(a,b){var c={},e={};return d(a,function(a,d){var f=b(a,d)?c:e;f[d]=a}),{t:c,f:e}},h=function(a,b){var c=[];return d(a,function(a,d){c.push(b(a,d))}),c},i=function(b,d){for(var e=c(b),f=0,g=e.length;f<g;f++){var h=e[f],i=b[h];if(d(i,h,b))return a.some(i)}return a.none()},j=function(a){return h(a,function(a){return a})},k=function(a){return j(a).length};return{bifilter:g,each:d,map:e,mapToArray:h,tupleMap:f,find:i,keys:c,values:j,size:k}}),g("n",[],function(){var a=function(a,b){return b+a},b=function(a,b){return a+b},c=function(a,b){return a.substring(b)},d=function(a,b){return a.substring(0,a.length-b)};return{addToStart:a,addToEnd:b,removeFromStart:c,removeFromEnd:d}}),g("o",["h","j"],function(a,b){var c=function(a,b){return a.substr(0,b)},d=function(a,b){return a.substr(a.length-b,a.length)},e=function(b){return""===b?a.none():a.some(b.substr(0,1))},f=function(b){return""===b?a.none():a.some(b.substring(1))};return{first:c,last:d,head:e,tail:f}}),g("f",["n","o","j"],function(a,b,c){var d=function(a,b,c){if(""===b)return!0;if(a.length<b.length)return!1;var d=a.substr(c,c+b.length);return d===b},e=function(a,b){var c=function(a){var b=typeof a;return"string"===b||"number"===b};return a.replace(/\${([^{}]*)}/g,function(a,d){var e=b[d];return c(e)?e:a})},f=function(b,c){return l(b,c)?a.removeFromStart(b,c.length):b},g=function(b,c){return m(b,c)?a.removeFromEnd(b,c.length):b},h=function(b,c){return l(b,c)?b:a.addToStart(b,c)},i=function(b,c){return m(b,c)?b:a.addToEnd(b,c)},j=function(a,b){return a.indexOf(b)!==-1},k=function(a){return b.head(a).bind(function(c){return b.tail(a).map(function(a){return c.toUpperCase()+a})}).getOr(a)},l=function(a,b){return d(a,b,0)},m=function(a,b){return d(a,b,a.length-b.length)},n=function(a){return a.replace(/^\s+|\s+$/g,"")},o=function(a){return a.replace(/^\s+/g,"")},p=function(a){return a.replace(/\s+$/g,"")};return{supplant:e,startsWith:l,removeLeading:f,removeTrailing:g,ensureLeading:h,ensureTrailing:i,endsWith:m,contains:j,trim:n,lTrim:o,rTrim:p,capitalize:k}}),g("g",[],function(){var a=[{key:"advlist",name:"Advanced List"},{key:"anchor",name:"Anchor"},{key:"autolink",name:"Autolink"},{key:"autoresize",name:"Autoresize"},{key:"autosave",name:"Autosave"},{key:"bbcode",name:"BBCode"},{key:"charmap",name:"Character Map"},{key:"code",name:"Code"},{key:"codesample",name:"Code Sample"},{key:"colorpicker",name:"Color Picker"},{key:"compat3x",name:"3.x Compatibility"},{key:"contextmenu",name:"Context Menu"},{key:"directionality",name:"Directionality"},{key:"emoticons",name:"Emoticons"},{key:"fullpage",name:"Full Page"},{key:"fullscreen",name:"Full Screen"},{key:"help",name:"Help"},{key:"hr",name:"Horizontal Rule"},{key:"image",name:"Image"},{key:"imagetools",name:"Image Tools"},{key:"importcss",name:"Import CSS"},{key:"insertdatetime",name:"Insert Date/Time"},{key:"legacyoutput",name:"Legacy Output"},{key:"link",name:"Link"},{key:"lists",name:"Lists"},{key:"media",name:"Media"},{key:"nonbreaking",name:"Nonbreaking"},{key:"noneditable",name:"Noneditable"},{key:"pagebreak",name:"Page Break"},{key:"paste",name:"Paste"},{key:"preview",name:"Preview"},{key:"print",name:"Print"},{key:"save",name:"Save"},{key:"searchreplace",name:"Search and Replace"},{key:"spellchecker",name:"Spell Checker"},{key:"tabfocus",name:"Tab Focus"},{key:"table",name:"Table"},{key:"template",name:"Template"},{key:"textcolor",name:"Text Color"},{key:"textpattern",name:"Text Pattern"},{key:"toc",name:"Table of Contents"},{key:"visualblocks",name:"Visual Blocks"},{key:"visualchars",name:"Visual Characters"},{key:"wordcount",name:"Word Count"}];return{urls:a}}),g("8",["a","d","e","f","6","b","g"],function(a,b,c,d,e,f,g){var h=b.curry(d.supplant,'<a href="${url}" target="_blank" rel="noopener">${name}</a>'),i=function(b,c){return a.find(g.urls,function(a){return a.key===c}).fold(function(){var a=b.plugins[c].getMetadata;return"function"==typeof a?h(a()):c},function(a){return h({name:a.name,url:"https://www.tinymce.com/docs/plugins/"+a.key})})},j=function(d){var e=c.keys(d.plugins);return void 0===d.settings.forced_plugins?e:a.filter(e,b.not(b.curry(a.contains,d.settings.forced_plugins)))},k=function(b){var c=j(b),d=a.map(c,function(a){return"<li>"+i(b,a)+"</li>"}),e=d.length,g=d.join("");return"<p><b>"+f.translate(["Plugins installed ({0}):",e])+"</b></p><ul>"+g+"</ul>"},l=function(a){return{type:"container",html:'<div style="overflow-y: auto; overflow-x: hidden; max-height: 230px; height: 230px;" data-mce-tabstop="1" tabindex="-1">'+k(a)+"</div>",flex:1}},m=function(){return{type:"container",html:'<div style="padding: 10px; background: #e3e7f4; height: 100%;" data-mce-tabstop="1" tabindex="-1"><p><b>'+f.translate("Premium plugins:")+'</b></p><ul><li>PowerPaste</li><li>Spell Checker Pro</li><li>Accessibility Checker</li><li>Advanced Code Editor</li><li>Enhanced Media Embed</li><li>Link Checker</li></ul><br /><p style="float: right;"><a href="https://www.tinymce.com/pricing/?utm_campaign=editor_referral&utm_medium=help_dialog&utm_source=tinymce" target="_blank">'+f.translate("Learn more...")+"</a></p></div>",flex:1}},n=function(a){return{title:"Plugins",type:"container",style:"overflow-y: auto; overflow-x: hidden;",layout:"flex",padding:10,spacing:10,items:[l(a),m()]}};return{makeTab:n}}),g("9",["6","b"],function(a,b){var c=function(a,b){return 0===a.indexOf("@")?"X.X.X":a+"."+b},d=function(){var d=c(a.majorVersion,a.minorVersion),e='<a href="https://www.tinymce.com/docs/changelog/?utm_campaign=editor_referral&utm_medium=help_dialog&utm_source=tinymce" target="_blank">TinyMCE '+d+"</a>";return[{type:"label",html:b.translate(["You are using {0}",e])},{type:"spacer",flex:1},{text:"Close",onclick:function(){this.parent().parent().close()}}]};return{makeRow:d}}),g("4",["6","7","8","9"],function(a,b,c,d){var e=function(a,e){return function(){a.windowManager.open({title:"Help",bodyType:"tabpanel",layout:"flex",body:[b.makeTab(),c.makeTab(a,e)],buttons:d.makeRow(),onPostRender:function(){var a=this.getEl("title");a.innerHTML='<img src="'+e+'/img/logo.png" alt="TinyMCE Logo" style="display: inline-block; width: 200px; height: 50px">'}})}};return{open:e}}),g("2",["4"],function(a){var b=function(b,c){b.addCommand("mceHelp",a.open(b,c))};return{register:b}}),g("3",["4"],function(a){var b=function(b,c){b.addButton("help",{icon:"help",onclick:a.open(b,c)}),b.addMenuItem("Help",{text:"Help",icon:"help",context:"help",onclick:a.open(b,c)})};return{register:b}}),g("0",["1","2","3","4"],function(a,b,c,d){return a.add("help",function(a,d){c.register(a,d),b.register(a,d),a.shortcuts.add("Alt+0","Open help dialog","mceHelp")}),function(){}}),d("0")()}();
|
@@ -0,0 +1,195 @@
|
|
1
|
+
(function () {
|
2
|
+
|
3
|
+
var defs = {}; // id -> {dependencies, definition, instance (possibly undefined)}
|
4
|
+
|
5
|
+
// Used when there is no 'main' module.
|
6
|
+
// The name is probably (hopefully) unique so minification removes for releases.
|
7
|
+
var register_3795 = function (id) {
|
8
|
+
var module = dem(id);
|
9
|
+
var fragments = id.split('.');
|
10
|
+
var target = Function('return this;')();
|
11
|
+
for (var i = 0; i < fragments.length - 1; ++i) {
|
12
|
+
if (target[fragments[i]] === undefined)
|
13
|
+
target[fragments[i]] = {};
|
14
|
+
target = target[fragments[i]];
|
15
|
+
}
|
16
|
+
target[fragments[fragments.length - 1]] = module;
|
17
|
+
};
|
18
|
+
|
19
|
+
var instantiate = function (id) {
|
20
|
+
var actual = defs[id];
|
21
|
+
var dependencies = actual.deps;
|
22
|
+
var definition = actual.defn;
|
23
|
+
var len = dependencies.length;
|
24
|
+
var instances = new Array(len);
|
25
|
+
for (var i = 0; i < len; ++i)
|
26
|
+
instances[i] = dem(dependencies[i]);
|
27
|
+
var defResult = definition.apply(null, instances);
|
28
|
+
if (defResult === undefined)
|
29
|
+
throw 'module [' + id + '] returned undefined';
|
30
|
+
actual.instance = defResult;
|
31
|
+
};
|
32
|
+
|
33
|
+
var def = function (id, dependencies, definition) {
|
34
|
+
if (typeof id !== 'string')
|
35
|
+
throw 'module id must be a string';
|
36
|
+
else if (dependencies === undefined)
|
37
|
+
throw 'no dependencies for ' + id;
|
38
|
+
else if (definition === undefined)
|
39
|
+
throw 'no definition function for ' + id;
|
40
|
+
defs[id] = {
|
41
|
+
deps: dependencies,
|
42
|
+
defn: definition,
|
43
|
+
instance: undefined
|
44
|
+
};
|
45
|
+
};
|
46
|
+
|
47
|
+
var dem = function (id) {
|
48
|
+
var actual = defs[id];
|
49
|
+
if (actual === undefined)
|
50
|
+
throw 'module [' + id + '] was undefined';
|
51
|
+
else if (actual.instance === undefined)
|
52
|
+
instantiate(id);
|
53
|
+
return actual.instance;
|
54
|
+
};
|
55
|
+
|
56
|
+
var req = function (ids, callback) {
|
57
|
+
var len = ids.length;
|
58
|
+
var instances = new Array(len);
|
59
|
+
for (var i = 0; i < len; ++i)
|
60
|
+
instances[i] = dem(ids[i]);
|
61
|
+
callback.apply(null, instances);
|
62
|
+
};
|
63
|
+
|
64
|
+
var ephox = {};
|
65
|
+
|
66
|
+
ephox.bolt = {
|
67
|
+
module: {
|
68
|
+
api: {
|
69
|
+
define: def,
|
70
|
+
require: req,
|
71
|
+
demand: dem
|
72
|
+
}
|
73
|
+
}
|
74
|
+
};
|
75
|
+
|
76
|
+
var define = def;
|
77
|
+
var require = req;
|
78
|
+
var demand = dem;
|
79
|
+
// this helps with minification when using a lot of global references
|
80
|
+
var defineGlobal = function (id, ref) {
|
81
|
+
define(id, [], function () { return ref; });
|
82
|
+
};
|
83
|
+
/*jsc
|
84
|
+
["tinymce.plugins.hr.Plugin","tinymce.core.PluginManager","tinymce.plugins.hr.api.Commands","tinymce.plugins.hr.ui.Buttons","global!tinymce.util.Tools.resolve"]
|
85
|
+
jsc*/
|
86
|
+
defineGlobal("global!tinymce.util.Tools.resolve", tinymce.util.Tools.resolve);
|
87
|
+
/**
|
88
|
+
* ResolveGlobal.js
|
89
|
+
*
|
90
|
+
* Released under LGPL License.
|
91
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
92
|
+
*
|
93
|
+
* License: http://www.tinymce.com/license
|
94
|
+
* Contributing: http://www.tinymce.com/contributing
|
95
|
+
*/
|
96
|
+
|
97
|
+
define(
|
98
|
+
'tinymce.core.PluginManager',
|
99
|
+
[
|
100
|
+
'global!tinymce.util.Tools.resolve'
|
101
|
+
],
|
102
|
+
function (resolve) {
|
103
|
+
return resolve('tinymce.PluginManager');
|
104
|
+
}
|
105
|
+
);
|
106
|
+
|
107
|
+
/**
|
108
|
+
* Commands.js
|
109
|
+
*
|
110
|
+
* Released under LGPL License.
|
111
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
112
|
+
*
|
113
|
+
* License: http://www.tinymce.com/license
|
114
|
+
* Contributing: http://www.tinymce.com/contributing
|
115
|
+
*/
|
116
|
+
|
117
|
+
define(
|
118
|
+
'tinymce.plugins.hr.api.Commands',
|
119
|
+
[
|
120
|
+
],
|
121
|
+
function () {
|
122
|
+
var register = function (editor) {
|
123
|
+
editor.addCommand('InsertHorizontalRule', function () {
|
124
|
+
editor.execCommand('mceInsertContent', false, '<hr />');
|
125
|
+
});
|
126
|
+
};
|
127
|
+
|
128
|
+
return {
|
129
|
+
register: register
|
130
|
+
};
|
131
|
+
}
|
132
|
+
);
|
133
|
+
/**
|
134
|
+
* Buttons.js
|
135
|
+
*
|
136
|
+
* Released under LGPL License.
|
137
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
138
|
+
*
|
139
|
+
* License: http://www.tinymce.com/license
|
140
|
+
* Contributing: http://www.tinymce.com/contributing
|
141
|
+
*/
|
142
|
+
|
143
|
+
define(
|
144
|
+
'tinymce.plugins.hr.ui.Buttons',
|
145
|
+
[
|
146
|
+
],
|
147
|
+
function () {
|
148
|
+
var register = function (editor) {
|
149
|
+
editor.addButton('hr', {
|
150
|
+
icon: 'hr',
|
151
|
+
tooltip: 'Horizontal line',
|
152
|
+
cmd: 'InsertHorizontalRule'
|
153
|
+
});
|
154
|
+
|
155
|
+
editor.addMenuItem('hr', {
|
156
|
+
icon: 'hr',
|
157
|
+
text: 'Horizontal line',
|
158
|
+
cmd: 'InsertHorizontalRule',
|
159
|
+
context: 'insert'
|
160
|
+
});
|
161
|
+
};
|
162
|
+
|
163
|
+
return {
|
164
|
+
register: register
|
165
|
+
};
|
166
|
+
}
|
167
|
+
);
|
168
|
+
/**
|
169
|
+
* Plugin.js
|
170
|
+
*
|
171
|
+
* Released under LGPL License.
|
172
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
173
|
+
*
|
174
|
+
* License: http://www.tinymce.com/license
|
175
|
+
* Contributing: http://www.tinymce.com/contributing
|
176
|
+
*/
|
177
|
+
|
178
|
+
define(
|
179
|
+
'tinymce.plugins.hr.Plugin',
|
180
|
+
[
|
181
|
+
'tinymce.core.PluginManager',
|
182
|
+
'tinymce.plugins.hr.api.Commands',
|
183
|
+
'tinymce.plugins.hr.ui.Buttons'
|
184
|
+
],
|
185
|
+
function (PluginManager, Commands, Buttons) {
|
186
|
+
PluginManager.add('hr', function (editor) {
|
187
|
+
Commands.register(editor);
|
188
|
+
Buttons.register(editor);
|
189
|
+
});
|
190
|
+
|
191
|
+
return function () { };
|
192
|
+
}
|
193
|
+
);
|
194
|
+
dem('tinymce.plugins.hr.Plugin')();
|
195
|
+
})();
|
@@ -0,0 +1 @@
|
|
1
|
+
!function(){var a={},b=function(b){for(var c=a[b],e=c.deps,f=c.defn,g=e.length,h=new Array(g),i=0;i<g;++i)h[i]=d(e[i]);var j=f.apply(null,h);if(void 0===j)throw"module ["+b+"] returned undefined";c.instance=j},c=function(b,c,d){if("string"!=typeof b)throw"module id must be a string";if(void 0===c)throw"no dependencies for "+b;if(void 0===d)throw"no definition function for "+b;a[b]={deps:c,defn:d,instance:void 0}},d=function(c){var d=a[c];if(void 0===d)throw"module ["+c+"] was undefined";return void 0===d.instance&&b(c),d.instance},e=function(a,b){for(var c=a.length,e=new Array(c),f=0;f<c;++f)e[f]=d(a[f]);b.apply(null,e)},f={};f.bolt={module:{api:{define:c,require:e,demand:d}}};var g=c,h=function(a,b){g(a,[],function(){return b})};h("4",tinymce.util.Tools.resolve),g("1",["4"],function(a){return a("tinymce.PluginManager")}),g("2",[],function(){var a=function(a){a.addCommand("InsertHorizontalRule",function(){a.execCommand("mceInsertContent",!1,"<hr />")})};return{register:a}}),g("3",[],function(){var a=function(a){a.addButton("hr",{icon:"hr",tooltip:"Horizontal line",cmd:"InsertHorizontalRule"}),a.addMenuItem("hr",{icon:"hr",text:"Horizontal line",cmd:"InsertHorizontalRule",context:"insert"})};return{register:a}}),g("0",["1","2","3"],function(a,b,c){return a.add("hr",function(a){b.register(a),c.register(a)}),function(){}}),d("0")()}();
|
@@ -0,0 +1,1572 @@
|
|
1
|
+
(function () {
|
2
|
+
|
3
|
+
var defs = {}; // id -> {dependencies, definition, instance (possibly undefined)}
|
4
|
+
|
5
|
+
// Used when there is no 'main' module.
|
6
|
+
// The name is probably (hopefully) unique so minification removes for releases.
|
7
|
+
var register_3795 = function (id) {
|
8
|
+
var module = dem(id);
|
9
|
+
var fragments = id.split('.');
|
10
|
+
var target = Function('return this;')();
|
11
|
+
for (var i = 0; i < fragments.length - 1; ++i) {
|
12
|
+
if (target[fragments[i]] === undefined)
|
13
|
+
target[fragments[i]] = {};
|
14
|
+
target = target[fragments[i]];
|
15
|
+
}
|
16
|
+
target[fragments[fragments.length - 1]] = module;
|
17
|
+
};
|
18
|
+
|
19
|
+
var instantiate = function (id) {
|
20
|
+
var actual = defs[id];
|
21
|
+
var dependencies = actual.deps;
|
22
|
+
var definition = actual.defn;
|
23
|
+
var len = dependencies.length;
|
24
|
+
var instances = new Array(len);
|
25
|
+
for (var i = 0; i < len; ++i)
|
26
|
+
instances[i] = dem(dependencies[i]);
|
27
|
+
var defResult = definition.apply(null, instances);
|
28
|
+
if (defResult === undefined)
|
29
|
+
throw 'module [' + id + '] returned undefined';
|
30
|
+
actual.instance = defResult;
|
31
|
+
};
|
32
|
+
|
33
|
+
var def = function (id, dependencies, definition) {
|
34
|
+
if (typeof id !== 'string')
|
35
|
+
throw 'module id must be a string';
|
36
|
+
else if (dependencies === undefined)
|
37
|
+
throw 'no dependencies for ' + id;
|
38
|
+
else if (definition === undefined)
|
39
|
+
throw 'no definition function for ' + id;
|
40
|
+
defs[id] = {
|
41
|
+
deps: dependencies,
|
42
|
+
defn: definition,
|
43
|
+
instance: undefined
|
44
|
+
};
|
45
|
+
};
|
46
|
+
|
47
|
+
var dem = function (id) {
|
48
|
+
var actual = defs[id];
|
49
|
+
if (actual === undefined)
|
50
|
+
throw 'module [' + id + '] was undefined';
|
51
|
+
else if (actual.instance === undefined)
|
52
|
+
instantiate(id);
|
53
|
+
return actual.instance;
|
54
|
+
};
|
55
|
+
|
56
|
+
var req = function (ids, callback) {
|
57
|
+
var len = ids.length;
|
58
|
+
var instances = new Array(len);
|
59
|
+
for (var i = 0; i < len; ++i)
|
60
|
+
instances[i] = dem(ids[i]);
|
61
|
+
callback.apply(null, instances);
|
62
|
+
};
|
63
|
+
|
64
|
+
var ephox = {};
|
65
|
+
|
66
|
+
ephox.bolt = {
|
67
|
+
module: {
|
68
|
+
api: {
|
69
|
+
define: def,
|
70
|
+
require: req,
|
71
|
+
demand: dem
|
72
|
+
}
|
73
|
+
}
|
74
|
+
};
|
75
|
+
|
76
|
+
var define = def;
|
77
|
+
var require = req;
|
78
|
+
var demand = dem;
|
79
|
+
// this helps with minification when using a lot of global references
|
80
|
+
var defineGlobal = function (id, ref) {
|
81
|
+
define(id, [], function () { return ref; });
|
82
|
+
};
|
83
|
+
/*jsc
|
84
|
+
["tinymce.plugins.image.Plugin","tinymce.core.PluginManager","tinymce.plugins.image.api.Commands","tinymce.plugins.image.core.FilterContent","tinymce.plugins.image.ui.Buttons","global!tinymce.util.Tools.resolve","tinymce.plugins.image.ui.Dialog","tinymce.core.util.Tools","global!Math","global!RegExp","tinymce.plugins.image.api.Settings","tinymce.plugins.image.core.Utils","tinymce.plugins.image.ui.AdvTab","tinymce.plugins.image.ui.MainTab","tinymce.plugins.image.ui.SizeManager","tinymce.plugins.image.ui.UploadTab","global!document","ephox.sand.api.FileReader","tinymce.core.util.Promise","tinymce.core.util.XHR","ephox.sand.api.URL","tinymce.core.ui.Factory","tinymce.plugins.image.core.Uploader","ephox.sand.util.Global","ephox.sand.api.XMLHttpRequest","global!window","ephox.katamari.api.Resolve","ephox.katamari.api.Global"]
|
85
|
+
jsc*/
|
86
|
+
defineGlobal("global!tinymce.util.Tools.resolve", tinymce.util.Tools.resolve);
|
87
|
+
/**
|
88
|
+
* ResolveGlobal.js
|
89
|
+
*
|
90
|
+
* Released under LGPL License.
|
91
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
92
|
+
*
|
93
|
+
* License: http://www.tinymce.com/license
|
94
|
+
* Contributing: http://www.tinymce.com/contributing
|
95
|
+
*/
|
96
|
+
|
97
|
+
define(
|
98
|
+
'tinymce.core.PluginManager',
|
99
|
+
[
|
100
|
+
'global!tinymce.util.Tools.resolve'
|
101
|
+
],
|
102
|
+
function (resolve) {
|
103
|
+
return resolve('tinymce.PluginManager');
|
104
|
+
}
|
105
|
+
);
|
106
|
+
|
107
|
+
defineGlobal("global!Math", Math);
|
108
|
+
defineGlobal("global!RegExp", RegExp);
|
109
|
+
/**
|
110
|
+
* ResolveGlobal.js
|
111
|
+
*
|
112
|
+
* Released under LGPL License.
|
113
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
114
|
+
*
|
115
|
+
* License: http://www.tinymce.com/license
|
116
|
+
* Contributing: http://www.tinymce.com/contributing
|
117
|
+
*/
|
118
|
+
|
119
|
+
define(
|
120
|
+
'tinymce.core.util.Tools',
|
121
|
+
[
|
122
|
+
'global!tinymce.util.Tools.resolve'
|
123
|
+
],
|
124
|
+
function (resolve) {
|
125
|
+
return resolve('tinymce.util.Tools');
|
126
|
+
}
|
127
|
+
);
|
128
|
+
|
129
|
+
/**
|
130
|
+
* Settings.js
|
131
|
+
*
|
132
|
+
* Released under LGPL License.
|
133
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
134
|
+
*
|
135
|
+
* License: http://www.tinymce.com/license
|
136
|
+
* Contributing: http://www.tinymce.com/contributing
|
137
|
+
*/
|
138
|
+
|
139
|
+
define(
|
140
|
+
'tinymce.plugins.image.api.Settings',
|
141
|
+
[
|
142
|
+
],
|
143
|
+
function () {
|
144
|
+
var hasDimensions = function (editor) {
|
145
|
+
return editor.settings.image_dimensions === false ? false : true;
|
146
|
+
};
|
147
|
+
|
148
|
+
var hasAdvTab = function (editor) {
|
149
|
+
return editor.settings.image_advtab === true ? true : false;
|
150
|
+
};
|
151
|
+
|
152
|
+
var getPrependUrl = function (editor) {
|
153
|
+
return editor.getParam('image_prepend_url', '');
|
154
|
+
};
|
155
|
+
|
156
|
+
var getClassList = function (editor) {
|
157
|
+
return editor.getParam('image_class_list');
|
158
|
+
};
|
159
|
+
|
160
|
+
var hasDescription = function (editor) {
|
161
|
+
return editor.settings.image_description === false ? false : true;
|
162
|
+
};
|
163
|
+
|
164
|
+
var hasImageTitle = function (editor) {
|
165
|
+
return editor.settings.image_title === true ? true : false;
|
166
|
+
};
|
167
|
+
|
168
|
+
var hasImageCaption = function (editor) {
|
169
|
+
return editor.settings.image_caption === true ? true : false;
|
170
|
+
};
|
171
|
+
|
172
|
+
var getImageList = function (editor) {
|
173
|
+
return editor.getParam('image_list', false);
|
174
|
+
};
|
175
|
+
|
176
|
+
var hasUploadUrl = function (editor) {
|
177
|
+
return editor.getParam('images_upload_url', false);
|
178
|
+
};
|
179
|
+
|
180
|
+
var hasUploadHandler = function (editor) {
|
181
|
+
return editor.getParam('images_upload_handler', false);
|
182
|
+
};
|
183
|
+
|
184
|
+
var getUploadUrl = function (editor) {
|
185
|
+
return editor.getParam('images_upload_url');
|
186
|
+
};
|
187
|
+
|
188
|
+
var getUploadHandler = function (editor) {
|
189
|
+
return editor.getParam('images_upload_handler');
|
190
|
+
};
|
191
|
+
|
192
|
+
var getUploadBasePath = function (editor) {
|
193
|
+
return editor.getParam('images_upload_base_path');
|
194
|
+
};
|
195
|
+
|
196
|
+
var getUploadCredentials = function (editor) {
|
197
|
+
return editor.getParam('images_upload_credentials');
|
198
|
+
};
|
199
|
+
|
200
|
+
return {
|
201
|
+
hasDimensions: hasDimensions,
|
202
|
+
hasAdvTab: hasAdvTab,
|
203
|
+
getPrependUrl: getPrependUrl,
|
204
|
+
getClassList: getClassList,
|
205
|
+
hasDescription: hasDescription,
|
206
|
+
hasImageTitle: hasImageTitle,
|
207
|
+
hasImageCaption: hasImageCaption,
|
208
|
+
getImageList: getImageList,
|
209
|
+
hasUploadUrl: hasUploadUrl,
|
210
|
+
hasUploadHandler: hasUploadHandler,
|
211
|
+
getUploadUrl: getUploadUrl,
|
212
|
+
getUploadHandler: getUploadHandler,
|
213
|
+
getUploadBasePath: getUploadBasePath,
|
214
|
+
getUploadCredentials: getUploadCredentials
|
215
|
+
};
|
216
|
+
}
|
217
|
+
);
|
218
|
+
defineGlobal("global!document", document);
|
219
|
+
define(
|
220
|
+
'ephox.katamari.api.Global',
|
221
|
+
|
222
|
+
[
|
223
|
+
],
|
224
|
+
|
225
|
+
function () {
|
226
|
+
// Use window object as the global if it's available since CSP will block script evals
|
227
|
+
var global = typeof window !== 'undefined' ? window : Function('return this;')();
|
228
|
+
return global;
|
229
|
+
}
|
230
|
+
);
|
231
|
+
|
232
|
+
|
233
|
+
define(
|
234
|
+
'ephox.katamari.api.Resolve',
|
235
|
+
|
236
|
+
[
|
237
|
+
'ephox.katamari.api.Global'
|
238
|
+
],
|
239
|
+
|
240
|
+
function (Global) {
|
241
|
+
/** path :: ([String], JsObj?) -> JsObj */
|
242
|
+
var path = function (parts, scope) {
|
243
|
+
var o = scope !== undefined ? scope : Global;
|
244
|
+
for (var i = 0; i < parts.length && o !== undefined && o !== null; ++i)
|
245
|
+
o = o[parts[i]];
|
246
|
+
return o;
|
247
|
+
};
|
248
|
+
|
249
|
+
/** resolve :: (String, JsObj?) -> JsObj */
|
250
|
+
var resolve = function (p, scope) {
|
251
|
+
var parts = p.split('.');
|
252
|
+
return path(parts, scope);
|
253
|
+
};
|
254
|
+
|
255
|
+
/** step :: (JsObj, String) -> JsObj */
|
256
|
+
var step = function (o, part) {
|
257
|
+
if (o[part] === undefined || o[part] === null)
|
258
|
+
o[part] = {};
|
259
|
+
return o[part];
|
260
|
+
};
|
261
|
+
|
262
|
+
/** forge :: ([String], JsObj?) -> JsObj */
|
263
|
+
var forge = function (parts, target) {
|
264
|
+
var o = target !== undefined ? target : Global;
|
265
|
+
for (var i = 0; i < parts.length; ++i)
|
266
|
+
o = step(o, parts[i]);
|
267
|
+
return o;
|
268
|
+
};
|
269
|
+
|
270
|
+
/** namespace :: (String, JsObj?) -> JsObj */
|
271
|
+
var namespace = function (name, target) {
|
272
|
+
var parts = name.split('.');
|
273
|
+
return forge(parts, target);
|
274
|
+
};
|
275
|
+
|
276
|
+
return {
|
277
|
+
path: path,
|
278
|
+
resolve: resolve,
|
279
|
+
forge: forge,
|
280
|
+
namespace: namespace
|
281
|
+
};
|
282
|
+
}
|
283
|
+
);
|
284
|
+
|
285
|
+
|
286
|
+
define(
|
287
|
+
'ephox.sand.util.Global',
|
288
|
+
|
289
|
+
[
|
290
|
+
'ephox.katamari.api.Resolve'
|
291
|
+
],
|
292
|
+
|
293
|
+
function (Resolve) {
|
294
|
+
var unsafe = function (name, scope) {
|
295
|
+
return Resolve.resolve(name, scope);
|
296
|
+
};
|
297
|
+
|
298
|
+
var getOrDie = function (name, scope) {
|
299
|
+
var actual = unsafe(name, scope);
|
300
|
+
|
301
|
+
if (actual === undefined) throw name + ' not available on this browser';
|
302
|
+
return actual;
|
303
|
+
};
|
304
|
+
|
305
|
+
return {
|
306
|
+
getOrDie: getOrDie
|
307
|
+
};
|
308
|
+
}
|
309
|
+
);
|
310
|
+
define(
|
311
|
+
'ephox.sand.api.FileReader',
|
312
|
+
|
313
|
+
[
|
314
|
+
'ephox.sand.util.Global'
|
315
|
+
],
|
316
|
+
|
317
|
+
function (Global) {
|
318
|
+
/*
|
319
|
+
* IE10 and above per
|
320
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/FileReader
|
321
|
+
*/
|
322
|
+
return function () {
|
323
|
+
var f = Global.getOrDie('FileReader');
|
324
|
+
return new f();
|
325
|
+
};
|
326
|
+
}
|
327
|
+
);
|
328
|
+
/**
|
329
|
+
* ResolveGlobal.js
|
330
|
+
*
|
331
|
+
* Released under LGPL License.
|
332
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
333
|
+
*
|
334
|
+
* License: http://www.tinymce.com/license
|
335
|
+
* Contributing: http://www.tinymce.com/contributing
|
336
|
+
*/
|
337
|
+
|
338
|
+
define(
|
339
|
+
'tinymce.core.util.Promise',
|
340
|
+
[
|
341
|
+
'global!tinymce.util.Tools.resolve'
|
342
|
+
],
|
343
|
+
function (resolve) {
|
344
|
+
return resolve('tinymce.util.Promise');
|
345
|
+
}
|
346
|
+
);
|
347
|
+
|
348
|
+
/**
|
349
|
+
* ResolveGlobal.js
|
350
|
+
*
|
351
|
+
* Released under LGPL License.
|
352
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
353
|
+
*
|
354
|
+
* License: http://www.tinymce.com/license
|
355
|
+
* Contributing: http://www.tinymce.com/contributing
|
356
|
+
*/
|
357
|
+
|
358
|
+
define(
|
359
|
+
'tinymce.core.util.XHR',
|
360
|
+
[
|
361
|
+
'global!tinymce.util.Tools.resolve'
|
362
|
+
],
|
363
|
+
function (resolve) {
|
364
|
+
return resolve('tinymce.util.XHR');
|
365
|
+
}
|
366
|
+
);
|
367
|
+
|
368
|
+
/**
|
369
|
+
* Utils.js
|
370
|
+
*
|
371
|
+
* Released under LGPL License.
|
372
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
373
|
+
*
|
374
|
+
* License: http://www.tinymce.com/license
|
375
|
+
* Contributing: http://www.tinymce.com/contributing
|
376
|
+
*/
|
377
|
+
|
378
|
+
/**
|
379
|
+
* @class tinymce.image.core.Utils
|
380
|
+
* @private
|
381
|
+
*/
|
382
|
+
define(
|
383
|
+
'tinymce.plugins.image.core.Utils',
|
384
|
+
[
|
385
|
+
'global!Math',
|
386
|
+
'global!document',
|
387
|
+
'ephox.sand.api.FileReader',
|
388
|
+
'tinymce.core.util.Promise',
|
389
|
+
'tinymce.core.util.Tools',
|
390
|
+
'tinymce.core.util.XHR',
|
391
|
+
'tinymce.plugins.image.api.Settings'
|
392
|
+
],
|
393
|
+
function (Math, document, FileReader, Promise, Tools, XHR, Settings) {
|
394
|
+
var parseIntAndGetMax = function (val1, val2) {
|
395
|
+
return Math.max(parseInt(val1, 10), parseInt(val2, 10));
|
396
|
+
};
|
397
|
+
|
398
|
+
var getImageSize = function (url, callback) {
|
399
|
+
var img = document.createElement('img');
|
400
|
+
|
401
|
+
function done(width, height) {
|
402
|
+
if (img.parentNode) {
|
403
|
+
img.parentNode.removeChild(img);
|
404
|
+
}
|
405
|
+
|
406
|
+
callback({ width: width, height: height });
|
407
|
+
}
|
408
|
+
|
409
|
+
img.onload = function () {
|
410
|
+
var width = parseIntAndGetMax(img.width, img.clientWidth);
|
411
|
+
var height = parseIntAndGetMax(img.height, img.clientHeight);
|
412
|
+
done(width, height);
|
413
|
+
};
|
414
|
+
|
415
|
+
img.onerror = function () {
|
416
|
+
done();
|
417
|
+
};
|
418
|
+
|
419
|
+
var style = img.style;
|
420
|
+
style.visibility = 'hidden';
|
421
|
+
style.position = 'fixed';
|
422
|
+
style.bottom = style.left = 0;
|
423
|
+
style.width = style.height = 'auto';
|
424
|
+
|
425
|
+
document.body.appendChild(img);
|
426
|
+
img.src = url;
|
427
|
+
};
|
428
|
+
|
429
|
+
|
430
|
+
var buildListItems = function (inputList, itemCallback, startItems) {
|
431
|
+
function appendItems(values, output) {
|
432
|
+
output = output || [];
|
433
|
+
|
434
|
+
Tools.each(values, function (item) {
|
435
|
+
var menuItem = { text: item.text || item.title };
|
436
|
+
|
437
|
+
if (item.menu) {
|
438
|
+
menuItem.menu = appendItems(item.menu);
|
439
|
+
} else {
|
440
|
+
menuItem.value = item.value;
|
441
|
+
itemCallback(menuItem);
|
442
|
+
}
|
443
|
+
|
444
|
+
output.push(menuItem);
|
445
|
+
});
|
446
|
+
|
447
|
+
return output;
|
448
|
+
}
|
449
|
+
|
450
|
+
return appendItems(inputList, startItems || []);
|
451
|
+
};
|
452
|
+
|
453
|
+
var removePixelSuffix = function (value) {
|
454
|
+
if (value) {
|
455
|
+
value = value.replace(/px$/, '');
|
456
|
+
}
|
457
|
+
return value;
|
458
|
+
};
|
459
|
+
|
460
|
+
var addPixelSuffix = function (value) {
|
461
|
+
if (value.length > 0 && /^[0-9]+$/.test(value)) {
|
462
|
+
value += 'px';
|
463
|
+
}
|
464
|
+
return value;
|
465
|
+
};
|
466
|
+
|
467
|
+
var mergeMargins = function (css) {
|
468
|
+
if (css.margin) {
|
469
|
+
|
470
|
+
var splitMargin = css.margin.split(" ");
|
471
|
+
|
472
|
+
switch (splitMargin.length) {
|
473
|
+
case 1: //margin: toprightbottomleft;
|
474
|
+
css['margin-top'] = css['margin-top'] || splitMargin[0];
|
475
|
+
css['margin-right'] = css['margin-right'] || splitMargin[0];
|
476
|
+
css['margin-bottom'] = css['margin-bottom'] || splitMargin[0];
|
477
|
+
css['margin-left'] = css['margin-left'] || splitMargin[0];
|
478
|
+
break;
|
479
|
+
case 2: //margin: topbottom rightleft;
|
480
|
+
css['margin-top'] = css['margin-top'] || splitMargin[0];
|
481
|
+
css['margin-right'] = css['margin-right'] || splitMargin[1];
|
482
|
+
css['margin-bottom'] = css['margin-bottom'] || splitMargin[0];
|
483
|
+
css['margin-left'] = css['margin-left'] || splitMargin[1];
|
484
|
+
break;
|
485
|
+
case 3: //margin: top rightleft bottom;
|
486
|
+
css['margin-top'] = css['margin-top'] || splitMargin[0];
|
487
|
+
css['margin-right'] = css['margin-right'] || splitMargin[1];
|
488
|
+
css['margin-bottom'] = css['margin-bottom'] || splitMargin[2];
|
489
|
+
css['margin-left'] = css['margin-left'] || splitMargin[1];
|
490
|
+
break;
|
491
|
+
case 4: //margin: top right bottom left;
|
492
|
+
css['margin-top'] = css['margin-top'] || splitMargin[0];
|
493
|
+
css['margin-right'] = css['margin-right'] || splitMargin[1];
|
494
|
+
css['margin-bottom'] = css['margin-bottom'] || splitMargin[2];
|
495
|
+
css['margin-left'] = css['margin-left'] || splitMargin[3];
|
496
|
+
}
|
497
|
+
delete css.margin;
|
498
|
+
}
|
499
|
+
return css;
|
500
|
+
};
|
501
|
+
|
502
|
+
var createImageList = function (editor, callback) {
|
503
|
+
var imageList = Settings.getImageList(editor);
|
504
|
+
|
505
|
+
if (typeof imageList === "string") {
|
506
|
+
XHR.send({
|
507
|
+
url: imageList,
|
508
|
+
success: function (text) {
|
509
|
+
callback(JSON.parse(text));
|
510
|
+
}
|
511
|
+
});
|
512
|
+
} else if (typeof imageList === "function") {
|
513
|
+
imageList(callback);
|
514
|
+
} else {
|
515
|
+
callback(imageList);
|
516
|
+
}
|
517
|
+
};
|
518
|
+
|
519
|
+
var waitLoadImage = function (editor, data, imgElm) {
|
520
|
+
function selectImage() {
|
521
|
+
imgElm.onload = imgElm.onerror = null;
|
522
|
+
|
523
|
+
if (editor.selection) {
|
524
|
+
editor.selection.select(imgElm);
|
525
|
+
editor.nodeChanged();
|
526
|
+
}
|
527
|
+
}
|
528
|
+
|
529
|
+
imgElm.onload = function () {
|
530
|
+
if (!data.width && !data.height && Settings.hasDimensions(editor)) {
|
531
|
+
editor.dom.setAttribs(imgElm, {
|
532
|
+
width: imgElm.clientWidth,
|
533
|
+
height: imgElm.clientHeight
|
534
|
+
});
|
535
|
+
}
|
536
|
+
|
537
|
+
selectImage();
|
538
|
+
};
|
539
|
+
|
540
|
+
imgElm.onerror = selectImage;
|
541
|
+
};
|
542
|
+
|
543
|
+
var blobToDataUri = function (blob) {
|
544
|
+
return new Promise(function (resolve, reject) {
|
545
|
+
var reader = new FileReader();
|
546
|
+
reader.onload = function () {
|
547
|
+
resolve(reader.result);
|
548
|
+
};
|
549
|
+
reader.onerror = function () {
|
550
|
+
reject(FileReader.error.message);
|
551
|
+
};
|
552
|
+
reader.readAsDataURL(blob);
|
553
|
+
});
|
554
|
+
};
|
555
|
+
|
556
|
+
return {
|
557
|
+
getImageSize: getImageSize,
|
558
|
+
buildListItems: buildListItems,
|
559
|
+
removePixelSuffix: removePixelSuffix,
|
560
|
+
addPixelSuffix: addPixelSuffix,
|
561
|
+
mergeMargins: mergeMargins,
|
562
|
+
createImageList: createImageList,
|
563
|
+
waitLoadImage: waitLoadImage,
|
564
|
+
blobToDataUri: blobToDataUri
|
565
|
+
};
|
566
|
+
}
|
567
|
+
);
|
568
|
+
|
569
|
+
define(
|
570
|
+
'tinymce.plugins.image.ui.AdvTab',
|
571
|
+
|
572
|
+
[
|
573
|
+
'tinymce.plugins.image.api.Settings',
|
574
|
+
'tinymce.plugins.image.core.Utils'
|
575
|
+
],
|
576
|
+
|
577
|
+
function (Settings, Utils) {
|
578
|
+
var updateVSpaceHSpaceBorder = function (editor) {
|
579
|
+
return function (evt) {
|
580
|
+
var dom = editor.dom;
|
581
|
+
var rootControl = evt.control.rootControl;
|
582
|
+
|
583
|
+
if (!Settings.hasAdvTab(editor)) {
|
584
|
+
return;
|
585
|
+
}
|
586
|
+
|
587
|
+
var data = rootControl.toJSON();
|
588
|
+
var css = dom.parseStyle(data.style);
|
589
|
+
|
590
|
+
rootControl.find('#vspace').value("");
|
591
|
+
rootControl.find('#hspace').value("");
|
592
|
+
|
593
|
+
css = Utils.mergeMargins(css);
|
594
|
+
|
595
|
+
//Move opposite equal margins to vspace/hspace field
|
596
|
+
if ((css['margin-top'] && css['margin-bottom']) || (css['margin-right'] && css['margin-left'])) {
|
597
|
+
if (css['margin-top'] === css['margin-bottom']) {
|
598
|
+
rootControl.find('#vspace').value(Utils.removePixelSuffix(css['margin-top']));
|
599
|
+
} else {
|
600
|
+
rootControl.find('#vspace').value('');
|
601
|
+
}
|
602
|
+
if (css['margin-right'] === css['margin-left']) {
|
603
|
+
rootControl.find('#hspace').value(Utils.removePixelSuffix(css['margin-right']));
|
604
|
+
} else {
|
605
|
+
rootControl.find('#hspace').value('');
|
606
|
+
}
|
607
|
+
}
|
608
|
+
|
609
|
+
//Move border-width
|
610
|
+
if (css['border-width']) {
|
611
|
+
rootControl.find('#border').value(Utils.removePixelSuffix(css['border-width']));
|
612
|
+
}
|
613
|
+
|
614
|
+
rootControl.find('#style').value(dom.serializeStyle(dom.parseStyle(dom.serializeStyle(css))));
|
615
|
+
};
|
616
|
+
};
|
617
|
+
|
618
|
+
var makeTab = function (editor, updateStyle) {
|
619
|
+
return {
|
620
|
+
title: 'Advanced',
|
621
|
+
type: 'form',
|
622
|
+
pack: 'start',
|
623
|
+
items: [
|
624
|
+
{
|
625
|
+
label: 'Style',
|
626
|
+
name: 'style',
|
627
|
+
type: 'textbox',
|
628
|
+
onchange: updateVSpaceHSpaceBorder(editor)
|
629
|
+
},
|
630
|
+
{
|
631
|
+
type: 'form',
|
632
|
+
layout: 'grid',
|
633
|
+
packV: 'start',
|
634
|
+
columns: 2,
|
635
|
+
padding: 0,
|
636
|
+
alignH: ['left', 'right'],
|
637
|
+
defaults: {
|
638
|
+
type: 'textbox',
|
639
|
+
maxWidth: 50,
|
640
|
+
onchange: function (evt) {
|
641
|
+
updateStyle(editor, evt.control.rootControl);
|
642
|
+
}
|
643
|
+
},
|
644
|
+
items: [
|
645
|
+
{ label: 'Vertical space', name: 'vspace' },
|
646
|
+
{ label: 'Horizontal space', name: 'hspace' },
|
647
|
+
{ label: 'Border', name: 'border' }
|
648
|
+
]
|
649
|
+
}
|
650
|
+
]
|
651
|
+
};
|
652
|
+
};
|
653
|
+
|
654
|
+
return {
|
655
|
+
makeTab: makeTab
|
656
|
+
};
|
657
|
+
}
|
658
|
+
);
|
659
|
+
|
660
|
+
define(
|
661
|
+
'tinymce.plugins.image.ui.SizeManager',
|
662
|
+
|
663
|
+
[
|
664
|
+
|
665
|
+
],
|
666
|
+
function () {
|
667
|
+
var doSyncSize = function (widthCtrl, heightCtrl) {
|
668
|
+
widthCtrl.state.set('oldVal', widthCtrl.value());
|
669
|
+
heightCtrl.state.set('oldVal', heightCtrl.value());
|
670
|
+
};
|
671
|
+
|
672
|
+
var doSizeControls = function (win, f) {
|
673
|
+
var widthCtrl = win.find('#width')[0];
|
674
|
+
var heightCtrl = win.find('#height')[0];
|
675
|
+
var constrained = win.find('#constrain')[0];
|
676
|
+
if (widthCtrl && heightCtrl && constrained) {
|
677
|
+
f(widthCtrl, heightCtrl, constrained.checked());
|
678
|
+
}
|
679
|
+
};
|
680
|
+
|
681
|
+
var doUpdateSize = function (widthCtrl, heightCtrl, isContrained) {
|
682
|
+
var oldWidth = widthCtrl.state.get('oldVal');
|
683
|
+
var oldHeight = heightCtrl.state.get('oldVal');
|
684
|
+
var newWidth = widthCtrl.value();
|
685
|
+
var newHeight = heightCtrl.value();
|
686
|
+
|
687
|
+
if (isContrained && oldWidth && oldHeight && newWidth && newHeight) {
|
688
|
+
if (newWidth !== oldWidth) {
|
689
|
+
newHeight = Math.round((newWidth / oldWidth) * newHeight);
|
690
|
+
|
691
|
+
if (!isNaN(newHeight)) {
|
692
|
+
heightCtrl.value(newHeight);
|
693
|
+
}
|
694
|
+
} else {
|
695
|
+
newWidth = Math.round((newHeight / oldHeight) * newWidth);
|
696
|
+
|
697
|
+
if (!isNaN(newWidth)) {
|
698
|
+
widthCtrl.value(newWidth);
|
699
|
+
}
|
700
|
+
}
|
701
|
+
}
|
702
|
+
|
703
|
+
doSyncSize(widthCtrl, heightCtrl);
|
704
|
+
};
|
705
|
+
|
706
|
+
var syncSize = function (win) {
|
707
|
+
doSizeControls(win, doSyncSize);
|
708
|
+
};
|
709
|
+
|
710
|
+
var updateSize = function (win) {
|
711
|
+
doSizeControls(win, doUpdateSize);
|
712
|
+
};
|
713
|
+
|
714
|
+
var createUi = function () {
|
715
|
+
var recalcSize = function (evt) {
|
716
|
+
updateSize(evt.control.rootControl);
|
717
|
+
};
|
718
|
+
|
719
|
+
return {
|
720
|
+
type: 'container',
|
721
|
+
label: 'Dimensions',
|
722
|
+
layout: 'flex',
|
723
|
+
align: 'center',
|
724
|
+
spacing: 5,
|
725
|
+
items: [
|
726
|
+
{
|
727
|
+
name: 'width', type: 'textbox', maxLength: 5, size: 5,
|
728
|
+
onchange: recalcSize, ariaLabel: 'Width'
|
729
|
+
},
|
730
|
+
{ type: 'label', text: 'x' },
|
731
|
+
{
|
732
|
+
name: 'height', type: 'textbox', maxLength: 5, size: 5,
|
733
|
+
onchange: recalcSize, ariaLabel: 'Height'
|
734
|
+
},
|
735
|
+
{ name: 'constrain', type: 'checkbox', checked: true, text: 'Constrain proportions' }
|
736
|
+
]
|
737
|
+
};
|
738
|
+
};
|
739
|
+
|
740
|
+
return {
|
741
|
+
createUi: createUi,
|
742
|
+
syncSize: syncSize,
|
743
|
+
updateSize: updateSize
|
744
|
+
};
|
745
|
+
}
|
746
|
+
);
|
747
|
+
define(
|
748
|
+
'tinymce.plugins.image.ui.MainTab',
|
749
|
+
|
750
|
+
[
|
751
|
+
'tinymce.core.util.Tools',
|
752
|
+
'tinymce.plugins.image.api.Settings',
|
753
|
+
'tinymce.plugins.image.core.Utils',
|
754
|
+
'tinymce.plugins.image.ui.SizeManager'
|
755
|
+
],
|
756
|
+
|
757
|
+
function (Tools, Settings, Utils, SizeManager) {
|
758
|
+
var onSrcChange = function (evt, editor) {
|
759
|
+
var srcURL, prependURL, absoluteURLPattern, meta = evt.meta || {};
|
760
|
+
var control = evt.control;
|
761
|
+
var rootControl = control.rootControl;
|
762
|
+
var imageListCtrl = rootControl.find('#image-list')[0];
|
763
|
+
|
764
|
+
if (imageListCtrl) {
|
765
|
+
imageListCtrl.value(editor.convertURL(control.value(), 'src'));
|
766
|
+
}
|
767
|
+
|
768
|
+
Tools.each(meta, function (value, key) {
|
769
|
+
rootControl.find('#' + key).value(value);
|
770
|
+
});
|
771
|
+
|
772
|
+
if (!meta.width && !meta.height) {
|
773
|
+
srcURL = editor.convertURL(control.value(), 'src');
|
774
|
+
|
775
|
+
// Pattern test the src url and make sure we haven't already prepended the url
|
776
|
+
prependURL = Settings.getPrependUrl(editor);
|
777
|
+
absoluteURLPattern = new RegExp('^(?:[a-z]+:)?//', 'i');
|
778
|
+
if (prependURL && !absoluteURLPattern.test(srcURL) && srcURL.substring(0, prependURL.length) !== prependURL) {
|
779
|
+
srcURL = prependURL + srcURL;
|
780
|
+
}
|
781
|
+
|
782
|
+
control.value(srcURL);
|
783
|
+
|
784
|
+
Utils.getImageSize(editor.documentBaseURI.toAbsolute(control.value()), function (data) {
|
785
|
+
if (data.width && data.height && Settings.hasDimensions(editor)) {
|
786
|
+
rootControl.find('#width').value(data.width);
|
787
|
+
rootControl.find('#height').value(data.height);
|
788
|
+
SizeManager.updateSize(rootControl);
|
789
|
+
}
|
790
|
+
});
|
791
|
+
}
|
792
|
+
};
|
793
|
+
|
794
|
+
var onBeforeCall = function (evt) {
|
795
|
+
evt.meta = evt.control.rootControl.toJSON();
|
796
|
+
};
|
797
|
+
|
798
|
+
var getGeneralItems = function (editor, imageListCtrl) {
|
799
|
+
var generalFormItems = [
|
800
|
+
{
|
801
|
+
name: 'src',
|
802
|
+
type: 'filepicker',
|
803
|
+
filetype: 'image',
|
804
|
+
label: 'Source',
|
805
|
+
autofocus: true,
|
806
|
+
onchange: function (evt) {
|
807
|
+
onSrcChange(evt, editor);
|
808
|
+
},
|
809
|
+
onbeforecall: onBeforeCall
|
810
|
+
},
|
811
|
+
imageListCtrl
|
812
|
+
];
|
813
|
+
|
814
|
+
if (Settings.hasDescription(editor)) {
|
815
|
+
generalFormItems.push({ name: 'alt', type: 'textbox', label: 'Image description' });
|
816
|
+
}
|
817
|
+
|
818
|
+
if (Settings.hasImageTitle(editor)) {
|
819
|
+
generalFormItems.push({ name: 'title', type: 'textbox', label: 'Image Title' });
|
820
|
+
}
|
821
|
+
|
822
|
+
if (Settings.hasDimensions(editor)) {
|
823
|
+
generalFormItems.push(
|
824
|
+
SizeManager.createUi()
|
825
|
+
);
|
826
|
+
}
|
827
|
+
|
828
|
+
if (Settings.getClassList(editor)) {
|
829
|
+
generalFormItems.push({
|
830
|
+
name: 'class',
|
831
|
+
type: 'listbox',
|
832
|
+
label: 'Class',
|
833
|
+
values: Utils.buildListItems(
|
834
|
+
Settings.getClassList(editor),
|
835
|
+
function (item) {
|
836
|
+
if (item.value) {
|
837
|
+
item.textStyle = function () {
|
838
|
+
return editor.formatter.getCssText({ inline: 'img', classes: [item.value] });
|
839
|
+
};
|
840
|
+
}
|
841
|
+
}
|
842
|
+
)
|
843
|
+
});
|
844
|
+
}
|
845
|
+
|
846
|
+
if (Settings.hasImageCaption(editor)) {
|
847
|
+
generalFormItems.push({ name: 'caption', type: 'checkbox', label: 'Caption' });
|
848
|
+
}
|
849
|
+
|
850
|
+
return generalFormItems;
|
851
|
+
};
|
852
|
+
|
853
|
+
var makeTab = function (editor, imageListCtrl) {
|
854
|
+
return {
|
855
|
+
title: 'General',
|
856
|
+
type: 'form',
|
857
|
+
items: getGeneralItems(editor, imageListCtrl)
|
858
|
+
};
|
859
|
+
};
|
860
|
+
|
861
|
+
return {
|
862
|
+
makeTab: makeTab,
|
863
|
+
getGeneralItems: getGeneralItems
|
864
|
+
};
|
865
|
+
}
|
866
|
+
);
|
867
|
+
|
868
|
+
define(
|
869
|
+
'ephox.sand.api.URL',
|
870
|
+
|
871
|
+
[
|
872
|
+
'ephox.sand.util.Global'
|
873
|
+
],
|
874
|
+
|
875
|
+
function (Global) {
|
876
|
+
/*
|
877
|
+
* IE10 and above per
|
878
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/URL.createObjectURL
|
879
|
+
*
|
880
|
+
* Also Safari 6.1+
|
881
|
+
* Safari 6.0 has 'webkitURL' instead, but doesn't support flexbox so we
|
882
|
+
* aren't supporting it anyway
|
883
|
+
*/
|
884
|
+
var url = function () {
|
885
|
+
return Global.getOrDie('URL');
|
886
|
+
};
|
887
|
+
|
888
|
+
var createObjectURL = function (blob) {
|
889
|
+
return url().createObjectURL(blob);
|
890
|
+
};
|
891
|
+
|
892
|
+
var revokeObjectURL = function (u) {
|
893
|
+
url().revokeObjectURL(u);
|
894
|
+
};
|
895
|
+
|
896
|
+
return {
|
897
|
+
createObjectURL: createObjectURL,
|
898
|
+
revokeObjectURL: revokeObjectURL
|
899
|
+
};
|
900
|
+
}
|
901
|
+
);
|
902
|
+
/**
|
903
|
+
* ResolveGlobal.js
|
904
|
+
*
|
905
|
+
* Released under LGPL License.
|
906
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
907
|
+
*
|
908
|
+
* License: http://www.tinymce.com/license
|
909
|
+
* Contributing: http://www.tinymce.com/contributing
|
910
|
+
*/
|
911
|
+
|
912
|
+
define(
|
913
|
+
'tinymce.core.ui.Factory',
|
914
|
+
[
|
915
|
+
'global!tinymce.util.Tools.resolve'
|
916
|
+
],
|
917
|
+
function (resolve) {
|
918
|
+
return resolve('tinymce.ui.Factory');
|
919
|
+
}
|
920
|
+
);
|
921
|
+
|
922
|
+
define(
|
923
|
+
'ephox.sand.api.XMLHttpRequest',
|
924
|
+
|
925
|
+
[
|
926
|
+
'ephox.sand.util.Global'
|
927
|
+
],
|
928
|
+
|
929
|
+
function (Global) {
|
930
|
+
/*
|
931
|
+
* IE8 and above per
|
932
|
+
* https://developer.mozilla.org/en/docs/XMLHttpRequest
|
933
|
+
*/
|
934
|
+
return function () {
|
935
|
+
var f = Global.getOrDie('XMLHttpRequest');
|
936
|
+
return new f();
|
937
|
+
};
|
938
|
+
}
|
939
|
+
);
|
940
|
+
defineGlobal("global!window", window);
|
941
|
+
/**
|
942
|
+
* Uploader.js
|
943
|
+
*
|
944
|
+
* Released under LGPL License.
|
945
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
946
|
+
*
|
947
|
+
* License: http://www.tinymce.com/license
|
948
|
+
* Contributing: http://www.tinymce.com/contributing
|
949
|
+
*/
|
950
|
+
|
951
|
+
/**
|
952
|
+
* This is basically cut down version of tinymce.core.file.Uploader, which we could use directly
|
953
|
+
* if it wasn't marked as private.
|
954
|
+
*/
|
955
|
+
define(
|
956
|
+
'tinymce.plugins.image.core.Uploader',
|
957
|
+
[
|
958
|
+
'ephox.sand.api.XMLHttpRequest',
|
959
|
+
'global!document',
|
960
|
+
'global!window',
|
961
|
+
'tinymce.core.util.Promise',
|
962
|
+
'tinymce.core.util.Tools'
|
963
|
+
],
|
964
|
+
function (XMLHttpRequest, document, window, Promise, Tools) {
|
965
|
+
var noop = function () {};
|
966
|
+
|
967
|
+
var pathJoin = function (path1, path2) {
|
968
|
+
if (path1) {
|
969
|
+
return path1.replace(/\/$/, '') + '/' + path2.replace(/^\//, '');
|
970
|
+
}
|
971
|
+
|
972
|
+
return path2;
|
973
|
+
};
|
974
|
+
|
975
|
+
return function (settings) {
|
976
|
+
var defaultHandler = function (blobInfo, success, failure, progress) {
|
977
|
+
var xhr, formData;
|
978
|
+
|
979
|
+
xhr = new XMLHttpRequest();
|
980
|
+
xhr.open('POST', settings.url);
|
981
|
+
xhr.withCredentials = settings.credentials;
|
982
|
+
|
983
|
+
xhr.upload.onprogress = function (e) {
|
984
|
+
progress(e.loaded / e.total * 100);
|
985
|
+
};
|
986
|
+
|
987
|
+
xhr.onerror = function () {
|
988
|
+
failure('Image upload failed due to a XHR Transport error. Code: ' + xhr.status);
|
989
|
+
};
|
990
|
+
|
991
|
+
xhr.onload = function () {
|
992
|
+
var json;
|
993
|
+
|
994
|
+
if (xhr.status < 200 || xhr.status >= 300) {
|
995
|
+
failure('HTTP Error: ' + xhr.status);
|
996
|
+
return;
|
997
|
+
}
|
998
|
+
|
999
|
+
json = JSON.parse(xhr.responseText);
|
1000
|
+
|
1001
|
+
if (!json || typeof json.location !== 'string') {
|
1002
|
+
failure('Invalid JSON: ' + xhr.responseText);
|
1003
|
+
return;
|
1004
|
+
}
|
1005
|
+
|
1006
|
+
success(pathJoin(settings.basePath, json.location));
|
1007
|
+
};
|
1008
|
+
|
1009
|
+
formData = new window.FormData();
|
1010
|
+
formData.append('file', blobInfo.blob(), blobInfo.filename());
|
1011
|
+
|
1012
|
+
xhr.send(formData);
|
1013
|
+
};
|
1014
|
+
|
1015
|
+
var uploadBlob = function (blobInfo, handler) {
|
1016
|
+
return new Promise(function (resolve, reject) {
|
1017
|
+
try {
|
1018
|
+
handler(blobInfo, resolve, reject, noop);
|
1019
|
+
} catch (ex) {
|
1020
|
+
reject(ex.message);
|
1021
|
+
}
|
1022
|
+
});
|
1023
|
+
};
|
1024
|
+
|
1025
|
+
var isDefaultHandler = function (handler) {
|
1026
|
+
return handler === defaultHandler;
|
1027
|
+
};
|
1028
|
+
|
1029
|
+
var upload = function (blobInfo) {
|
1030
|
+
return (!settings.url && isDefaultHandler(settings.handler)) ? Promise.reject('Upload url missing from the settings.') : uploadBlob(blobInfo, settings.handler);
|
1031
|
+
};
|
1032
|
+
|
1033
|
+
settings = Tools.extend({
|
1034
|
+
credentials: false,
|
1035
|
+
handler: defaultHandler
|
1036
|
+
}, settings);
|
1037
|
+
|
1038
|
+
return {
|
1039
|
+
upload: upload
|
1040
|
+
};
|
1041
|
+
};
|
1042
|
+
}
|
1043
|
+
);
|
1044
|
+
define(
|
1045
|
+
'tinymce.plugins.image.ui.UploadTab',
|
1046
|
+
|
1047
|
+
[
|
1048
|
+
'ephox.sand.api.URL',
|
1049
|
+
'tinymce.core.ui.Factory',
|
1050
|
+
'tinymce.plugins.image.api.Settings',
|
1051
|
+
'tinymce.plugins.image.core.Utils',
|
1052
|
+
'tinymce.plugins.image.core.Uploader'
|
1053
|
+
],
|
1054
|
+
|
1055
|
+
function (URL, Factory, Settings, Utils, Uploader) {
|
1056
|
+
var onFileInput = function (editor) {
|
1057
|
+
return function (evt) {
|
1058
|
+
var Throbber = Factory.get('Throbber');
|
1059
|
+
var rootControl = evt.control.rootControl;
|
1060
|
+
var throbber = new Throbber(rootControl.getEl());
|
1061
|
+
var file = evt.control.value();
|
1062
|
+
var blobUri = URL.createObjectURL(file);
|
1063
|
+
|
1064
|
+
var uploader = new Uploader({
|
1065
|
+
url: Settings.getUploadUrl(editor),
|
1066
|
+
basePath: Settings.getUploadBasePath(editor),
|
1067
|
+
credentials: Settings.getUploadCredentials(editor),
|
1068
|
+
handler: Settings.getUploadHandler(editor)
|
1069
|
+
});
|
1070
|
+
|
1071
|
+
var finalize = function () {
|
1072
|
+
throbber.hide();
|
1073
|
+
URL.revokeObjectURL(blobUri);
|
1074
|
+
};
|
1075
|
+
|
1076
|
+
throbber.show();
|
1077
|
+
|
1078
|
+
return Utils.blobToDataUri(file).then(function (dataUrl) {
|
1079
|
+
var blobInfo = editor.editorUpload.blobCache.create({
|
1080
|
+
blob: file,
|
1081
|
+
blobUri: blobUri,
|
1082
|
+
name: file.name ? file.name.replace(/\.[^\.]+$/, '') : null, // strip extension
|
1083
|
+
base64: dataUrl.split(',')[1]
|
1084
|
+
});
|
1085
|
+
return uploader.upload(blobInfo).then(function (url) {
|
1086
|
+
var src = rootControl.find('#src');
|
1087
|
+
src.value(url);
|
1088
|
+
rootControl.find('tabpanel')[0].activateTab(0); // switch to General tab
|
1089
|
+
src.fire('change'); // this will invoke onSrcChange (and any other handlers, if any).
|
1090
|
+
finalize();
|
1091
|
+
return url;
|
1092
|
+
});
|
1093
|
+
})['catch'](function (err) {
|
1094
|
+
editor.windowManager.alert(err);
|
1095
|
+
finalize();
|
1096
|
+
});
|
1097
|
+
};
|
1098
|
+
};
|
1099
|
+
|
1100
|
+
var acceptExts = '.jpg,.jpeg,.png,.gif';
|
1101
|
+
|
1102
|
+
var makeTab = function (editor) {
|
1103
|
+
return {
|
1104
|
+
title: 'Upload',
|
1105
|
+
type: 'form',
|
1106
|
+
layout: 'flex',
|
1107
|
+
direction: 'column',
|
1108
|
+
align: 'stretch',
|
1109
|
+
padding: '20 20 20 20',
|
1110
|
+
items: [
|
1111
|
+
{
|
1112
|
+
type: 'container',
|
1113
|
+
layout: 'flex',
|
1114
|
+
direction: 'column',
|
1115
|
+
align: 'center',
|
1116
|
+
spacing: 10,
|
1117
|
+
items: [
|
1118
|
+
{
|
1119
|
+
text: "Browse for an image",
|
1120
|
+
type: 'browsebutton',
|
1121
|
+
accept: acceptExts,
|
1122
|
+
onchange: onFileInput(editor)
|
1123
|
+
},
|
1124
|
+
{
|
1125
|
+
text: 'OR',
|
1126
|
+
type: 'label'
|
1127
|
+
}
|
1128
|
+
]
|
1129
|
+
},
|
1130
|
+
{
|
1131
|
+
text: "Drop an image here",
|
1132
|
+
type: 'dropzone',
|
1133
|
+
accept: acceptExts,
|
1134
|
+
height: 100,
|
1135
|
+
onchange: onFileInput(editor)
|
1136
|
+
}
|
1137
|
+
]
|
1138
|
+
};
|
1139
|
+
};
|
1140
|
+
|
1141
|
+
return {
|
1142
|
+
makeTab: makeTab
|
1143
|
+
};
|
1144
|
+
}
|
1145
|
+
);
|
1146
|
+
|
1147
|
+
/**
|
1148
|
+
* Dialog.js
|
1149
|
+
*
|
1150
|
+
* Released under LGPL License.
|
1151
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
1152
|
+
*
|
1153
|
+
* License: http://www.tinymce.com/license
|
1154
|
+
* Contributing: http://www.tinymce.com/contributing
|
1155
|
+
*/
|
1156
|
+
|
1157
|
+
/**
|
1158
|
+
* @class tinymce.image.ui.Dialog
|
1159
|
+
* @private
|
1160
|
+
*/
|
1161
|
+
define(
|
1162
|
+
'tinymce.plugins.image.ui.Dialog',
|
1163
|
+
[
|
1164
|
+
'global!Math',
|
1165
|
+
'global!RegExp',
|
1166
|
+
'tinymce.core.util.Tools',
|
1167
|
+
'tinymce.plugins.image.api.Settings',
|
1168
|
+
'tinymce.plugins.image.core.Utils',
|
1169
|
+
'tinymce.plugins.image.ui.AdvTab',
|
1170
|
+
'tinymce.plugins.image.ui.MainTab',
|
1171
|
+
'tinymce.plugins.image.ui.SizeManager',
|
1172
|
+
'tinymce.plugins.image.ui.UploadTab'
|
1173
|
+
],
|
1174
|
+
function (Math, RegExp, Tools, Settings, Utils, AdvTab, MainTab, SizeManager, UploadTab) {
|
1175
|
+
return function (editor) {
|
1176
|
+
var updateStyle = function (editor, rootControl) {
|
1177
|
+
if (!Settings.hasAdvTab(editor)) {
|
1178
|
+
return;
|
1179
|
+
}
|
1180
|
+
var dom = editor.dom;
|
1181
|
+
var data = rootControl.toJSON();
|
1182
|
+
var css = dom.parseStyle(data.style);
|
1183
|
+
|
1184
|
+
css = Utils.mergeMargins(css);
|
1185
|
+
|
1186
|
+
if (data.vspace) {
|
1187
|
+
css['margin-top'] = css['margin-bottom'] = Utils.addPixelSuffix(data.vspace);
|
1188
|
+
}
|
1189
|
+
if (data.hspace) {
|
1190
|
+
css['margin-left'] = css['margin-right'] = Utils.addPixelSuffix(data.hspace);
|
1191
|
+
}
|
1192
|
+
if (data.border) {
|
1193
|
+
css['border-width'] = Utils.addPixelSuffix(data.border);
|
1194
|
+
}
|
1195
|
+
|
1196
|
+
rootControl.find('#style').value(dom.serializeStyle(dom.parseStyle(dom.serializeStyle(css))));
|
1197
|
+
};
|
1198
|
+
|
1199
|
+
function showDialog(imageList) {
|
1200
|
+
var win, data = {}, imgElm, figureElm, dom = editor.dom;
|
1201
|
+
var imageListCtrl;
|
1202
|
+
|
1203
|
+
function onSubmitForm() {
|
1204
|
+
var figureElm, oldImg;
|
1205
|
+
|
1206
|
+
SizeManager.updateSize(win);
|
1207
|
+
updateStyle(editor, win);
|
1208
|
+
|
1209
|
+
data = Tools.extend(data, win.toJSON());
|
1210
|
+
|
1211
|
+
if (!data.alt) {
|
1212
|
+
data.alt = '';
|
1213
|
+
}
|
1214
|
+
|
1215
|
+
if (!data.title) {
|
1216
|
+
data.title = '';
|
1217
|
+
}
|
1218
|
+
|
1219
|
+
if (data.width === '') {
|
1220
|
+
data.width = null;
|
1221
|
+
}
|
1222
|
+
|
1223
|
+
if (data.height === '') {
|
1224
|
+
data.height = null;
|
1225
|
+
}
|
1226
|
+
|
1227
|
+
if (!data.style) {
|
1228
|
+
data.style = null;
|
1229
|
+
}
|
1230
|
+
|
1231
|
+
// Setup new data excluding style properties
|
1232
|
+
/*eslint dot-notation: 0*/
|
1233
|
+
data = {
|
1234
|
+
src: data.src,
|
1235
|
+
alt: data.alt,
|
1236
|
+
title: data.title,
|
1237
|
+
width: data.width,
|
1238
|
+
height: data.height,
|
1239
|
+
style: data.style,
|
1240
|
+
caption: data.caption,
|
1241
|
+
"class": data["class"]
|
1242
|
+
};
|
1243
|
+
|
1244
|
+
editor.undoManager.transact(function () {
|
1245
|
+
if (!data.src) {
|
1246
|
+
if (imgElm) {
|
1247
|
+
var elm = dom.is(imgElm.parentNode, 'figure.image') ? imgElm.parentNode : imgElm;
|
1248
|
+
dom.remove(elm);
|
1249
|
+
editor.focus();
|
1250
|
+
editor.nodeChanged();
|
1251
|
+
|
1252
|
+
if (dom.isEmpty(editor.getBody())) {
|
1253
|
+
editor.setContent('');
|
1254
|
+
editor.selection.setCursorLocation();
|
1255
|
+
}
|
1256
|
+
}
|
1257
|
+
|
1258
|
+
return;
|
1259
|
+
}
|
1260
|
+
|
1261
|
+
if (data.title === "") {
|
1262
|
+
data.title = null;
|
1263
|
+
}
|
1264
|
+
|
1265
|
+
if (!imgElm) {
|
1266
|
+
data.id = '__mcenew';
|
1267
|
+
editor.focus();
|
1268
|
+
editor.selection.setContent(dom.createHTML('img', data));
|
1269
|
+
imgElm = dom.get('__mcenew');
|
1270
|
+
dom.setAttrib(imgElm, 'id', null);
|
1271
|
+
} else {
|
1272
|
+
dom.setAttribs(imgElm, data);
|
1273
|
+
}
|
1274
|
+
|
1275
|
+
editor.editorUpload.uploadImagesAuto();
|
1276
|
+
|
1277
|
+
if (data.caption === false) {
|
1278
|
+
if (dom.is(imgElm.parentNode, 'figure.image')) {
|
1279
|
+
figureElm = imgElm.parentNode;
|
1280
|
+
dom.insertAfter(imgElm, figureElm);
|
1281
|
+
dom.remove(figureElm);
|
1282
|
+
}
|
1283
|
+
}
|
1284
|
+
|
1285
|
+
if (data.caption === true) {
|
1286
|
+
if (!dom.is(imgElm.parentNode, 'figure.image')) {
|
1287
|
+
oldImg = imgElm;
|
1288
|
+
imgElm = imgElm.cloneNode(true);
|
1289
|
+
figureElm = dom.create('figure', { 'class': 'image' });
|
1290
|
+
figureElm.appendChild(imgElm);
|
1291
|
+
figureElm.appendChild(dom.create('figcaption', { contentEditable: true }, 'Caption'));
|
1292
|
+
figureElm.contentEditable = false;
|
1293
|
+
|
1294
|
+
var textBlock = dom.getParent(oldImg, function (node) {
|
1295
|
+
return editor.schema.getTextBlockElements()[node.nodeName];
|
1296
|
+
});
|
1297
|
+
|
1298
|
+
if (textBlock) {
|
1299
|
+
dom.split(textBlock, oldImg, figureElm);
|
1300
|
+
} else {
|
1301
|
+
dom.replace(figureElm, oldImg);
|
1302
|
+
}
|
1303
|
+
|
1304
|
+
editor.selection.select(figureElm);
|
1305
|
+
}
|
1306
|
+
|
1307
|
+
return;
|
1308
|
+
}
|
1309
|
+
|
1310
|
+
Utils.waitLoadImage(editor, data, imgElm);
|
1311
|
+
});
|
1312
|
+
}
|
1313
|
+
|
1314
|
+
imgElm = editor.selection.getNode();
|
1315
|
+
figureElm = dom.getParent(imgElm, 'figure.image');
|
1316
|
+
if (figureElm) {
|
1317
|
+
imgElm = dom.select('img', figureElm)[0];
|
1318
|
+
}
|
1319
|
+
|
1320
|
+
if (imgElm &&
|
1321
|
+
(imgElm.nodeName !== 'IMG' ||
|
1322
|
+
imgElm.getAttribute('data-mce-object') ||
|
1323
|
+
imgElm.getAttribute('data-mce-placeholder'))) {
|
1324
|
+
imgElm = null;
|
1325
|
+
}
|
1326
|
+
|
1327
|
+
if (imgElm) {
|
1328
|
+
data = {
|
1329
|
+
src: dom.getAttrib(imgElm, 'src'),
|
1330
|
+
alt: dom.getAttrib(imgElm, 'alt'),
|
1331
|
+
title: dom.getAttrib(imgElm, 'title'),
|
1332
|
+
"class": dom.getAttrib(imgElm, 'class'),
|
1333
|
+
width: dom.getAttrib(imgElm, 'width'),
|
1334
|
+
height: dom.getAttrib(imgElm, 'height'),
|
1335
|
+
caption: !!figureElm
|
1336
|
+
};
|
1337
|
+
}
|
1338
|
+
|
1339
|
+
if (imageList) {
|
1340
|
+
imageListCtrl = {
|
1341
|
+
type: 'listbox',
|
1342
|
+
label: 'Image list',
|
1343
|
+
name: 'image-list',
|
1344
|
+
values: Utils.buildListItems(
|
1345
|
+
imageList,
|
1346
|
+
function (item) {
|
1347
|
+
item.value = editor.convertURL(item.value || item.url, 'src');
|
1348
|
+
},
|
1349
|
+
[{ text: 'None', value: '' }]
|
1350
|
+
),
|
1351
|
+
value: data.src && editor.convertURL(data.src, 'src'),
|
1352
|
+
onselect: function (e) {
|
1353
|
+
var altCtrl = win.find('#alt');
|
1354
|
+
|
1355
|
+
if (!altCtrl.value() || (e.lastControl && altCtrl.value() === e.lastControl.text())) {
|
1356
|
+
altCtrl.value(e.control.text());
|
1357
|
+
}
|
1358
|
+
|
1359
|
+
win.find('#src').value(e.control.value()).fire('change');
|
1360
|
+
},
|
1361
|
+
onPostRender: function () {
|
1362
|
+
/*eslint consistent-this: 0*/
|
1363
|
+
imageListCtrl = this;
|
1364
|
+
}
|
1365
|
+
};
|
1366
|
+
}
|
1367
|
+
|
1368
|
+
if (Settings.hasAdvTab(editor) || Settings.hasUploadUrl(editor) || Settings.hasUploadHandler(editor)) {
|
1369
|
+
var body = [
|
1370
|
+
MainTab.makeTab(editor, imageListCtrl)
|
1371
|
+
];
|
1372
|
+
|
1373
|
+
if (Settings.hasAdvTab(editor)) {
|
1374
|
+
// Parse styles from img
|
1375
|
+
if (imgElm) {
|
1376
|
+
if (imgElm.style.marginLeft && imgElm.style.marginRight && imgElm.style.marginLeft === imgElm.style.marginRight) {
|
1377
|
+
data.hspace = Utils.removePixelSuffix(imgElm.style.marginLeft);
|
1378
|
+
}
|
1379
|
+
if (imgElm.style.marginTop && imgElm.style.marginBottom && imgElm.style.marginTop === imgElm.style.marginBottom) {
|
1380
|
+
data.vspace = Utils.removePixelSuffix(imgElm.style.marginTop);
|
1381
|
+
}
|
1382
|
+
if (imgElm.style.borderWidth) {
|
1383
|
+
data.border = Utils.removePixelSuffix(imgElm.style.borderWidth);
|
1384
|
+
}
|
1385
|
+
|
1386
|
+
data.style = editor.dom.serializeStyle(editor.dom.parseStyle(editor.dom.getAttrib(imgElm, 'style')));
|
1387
|
+
}
|
1388
|
+
|
1389
|
+
body.push(AdvTab.makeTab(editor, updateStyle));
|
1390
|
+
}
|
1391
|
+
|
1392
|
+
if (Settings.hasUploadUrl(editor) || Settings.hasUploadHandler(editor)) {
|
1393
|
+
body.push(UploadTab.makeTab(editor));
|
1394
|
+
}
|
1395
|
+
|
1396
|
+
// Advanced dialog shows general+advanced tabs
|
1397
|
+
win = editor.windowManager.open({
|
1398
|
+
title: 'Insert/edit image',
|
1399
|
+
data: data,
|
1400
|
+
bodyType: 'tabpanel',
|
1401
|
+
body: body,
|
1402
|
+
onSubmit: onSubmitForm
|
1403
|
+
});
|
1404
|
+
} else {
|
1405
|
+
// Simple default dialog
|
1406
|
+
win = editor.windowManager.open({
|
1407
|
+
title: 'Insert/edit image',
|
1408
|
+
data: data,
|
1409
|
+
body: MainTab.getGeneralItems(editor, imageListCtrl),
|
1410
|
+
onSubmit: onSubmitForm
|
1411
|
+
});
|
1412
|
+
}
|
1413
|
+
|
1414
|
+
SizeManager.syncSize(win);
|
1415
|
+
}
|
1416
|
+
|
1417
|
+
function open() {
|
1418
|
+
Utils.createImageList(editor, showDialog);
|
1419
|
+
}
|
1420
|
+
|
1421
|
+
return {
|
1422
|
+
open: open
|
1423
|
+
};
|
1424
|
+
};
|
1425
|
+
}
|
1426
|
+
);
|
1427
|
+
|
1428
|
+
/**
|
1429
|
+
* Commands.js
|
1430
|
+
*
|
1431
|
+
* Released under LGPL License.
|
1432
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
1433
|
+
*
|
1434
|
+
* License: http://www.tinymce.com/license
|
1435
|
+
* Contributing: http://www.tinymce.com/contributing
|
1436
|
+
*/
|
1437
|
+
|
1438
|
+
define(
|
1439
|
+
'tinymce.plugins.image.api.Commands',
|
1440
|
+
[
|
1441
|
+
'tinymce.plugins.image.ui.Dialog'
|
1442
|
+
],
|
1443
|
+
function (Dialog) {
|
1444
|
+
var register = function (editor) {
|
1445
|
+
editor.addCommand('mceImage', Dialog(editor).open);
|
1446
|
+
};
|
1447
|
+
|
1448
|
+
return {
|
1449
|
+
register: register
|
1450
|
+
};
|
1451
|
+
}
|
1452
|
+
);
|
1453
|
+
/**
|
1454
|
+
* FilterContent.js
|
1455
|
+
*
|
1456
|
+
* Released under LGPL License.
|
1457
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
1458
|
+
*
|
1459
|
+
* License: http://www.tinymce.com/license
|
1460
|
+
* Contributing: http://www.tinymce.com/contributing
|
1461
|
+
*/
|
1462
|
+
|
1463
|
+
define(
|
1464
|
+
'tinymce.plugins.image.core.FilterContent',
|
1465
|
+
[
|
1466
|
+
'tinymce.core.util.Tools'
|
1467
|
+
],
|
1468
|
+
function (Tools) {
|
1469
|
+
var hasImageClass = function (node) {
|
1470
|
+
var className = node.attr('class');
|
1471
|
+
return className && /\bimage\b/.test(className);
|
1472
|
+
};
|
1473
|
+
|
1474
|
+
var toggleContentEditableState = function (state) {
|
1475
|
+
return function (nodes) {
|
1476
|
+
var i = nodes.length, node;
|
1477
|
+
|
1478
|
+
var toggleContentEditable = function (node) {
|
1479
|
+
node.attr('contenteditable', state ? 'true' : null);
|
1480
|
+
};
|
1481
|
+
|
1482
|
+
while (i--) {
|
1483
|
+
node = nodes[i];
|
1484
|
+
|
1485
|
+
if (hasImageClass(node)) {
|
1486
|
+
node.attr('contenteditable', state ? 'false' : null);
|
1487
|
+
Tools.each(node.getAll('figcaption'), toggleContentEditable);
|
1488
|
+
}
|
1489
|
+
}
|
1490
|
+
};
|
1491
|
+
};
|
1492
|
+
|
1493
|
+
var setup = function (editor) {
|
1494
|
+
editor.on('preInit', function () {
|
1495
|
+
editor.parser.addNodeFilter('figure', toggleContentEditableState(true));
|
1496
|
+
editor.serializer.addNodeFilter('figure', toggleContentEditableState(false));
|
1497
|
+
});
|
1498
|
+
};
|
1499
|
+
|
1500
|
+
return {
|
1501
|
+
setup: setup
|
1502
|
+
};
|
1503
|
+
}
|
1504
|
+
);
|
1505
|
+
/**
|
1506
|
+
* Buttons.js
|
1507
|
+
*
|
1508
|
+
* Released under LGPL License.
|
1509
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
1510
|
+
*
|
1511
|
+
* License: http://www.tinymce.com/license
|
1512
|
+
* Contributing: http://www.tinymce.com/contributing
|
1513
|
+
*/
|
1514
|
+
|
1515
|
+
define(
|
1516
|
+
'tinymce.plugins.image.ui.Buttons',
|
1517
|
+
[
|
1518
|
+
'tinymce.plugins.image.ui.Dialog'
|
1519
|
+
],
|
1520
|
+
function (Dialog) {
|
1521
|
+
var register = function (editor) {
|
1522
|
+
editor.addButton('image', {
|
1523
|
+
icon: 'image',
|
1524
|
+
tooltip: 'Insert/edit image',
|
1525
|
+
onclick: Dialog(editor).open,
|
1526
|
+
stateSelector: 'img:not([data-mce-object],[data-mce-placeholder]),figure.image'
|
1527
|
+
});
|
1528
|
+
|
1529
|
+
editor.addMenuItem('image', {
|
1530
|
+
icon: 'image',
|
1531
|
+
text: 'Image',
|
1532
|
+
onclick: Dialog(editor).open,
|
1533
|
+
context: 'insert',
|
1534
|
+
prependToContext: true
|
1535
|
+
});
|
1536
|
+
};
|
1537
|
+
|
1538
|
+
return {
|
1539
|
+
register: register
|
1540
|
+
};
|
1541
|
+
}
|
1542
|
+
);
|
1543
|
+
/**
|
1544
|
+
* Plugin.js
|
1545
|
+
*
|
1546
|
+
* Released under LGPL License.
|
1547
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
1548
|
+
*
|
1549
|
+
* License: http://www.tinymce.com/license
|
1550
|
+
* Contributing: http://www.tinymce.com/contributing
|
1551
|
+
*/
|
1552
|
+
|
1553
|
+
define(
|
1554
|
+
'tinymce.plugins.image.Plugin',
|
1555
|
+
[
|
1556
|
+
'tinymce.core.PluginManager',
|
1557
|
+
'tinymce.plugins.image.api.Commands',
|
1558
|
+
'tinymce.plugins.image.core.FilterContent',
|
1559
|
+
'tinymce.plugins.image.ui.Buttons'
|
1560
|
+
],
|
1561
|
+
function (PluginManager, Commands, FilterContent, Buttons) {
|
1562
|
+
PluginManager.add('image', function (editor) {
|
1563
|
+
FilterContent.setup(editor);
|
1564
|
+
Buttons.register(editor);
|
1565
|
+
Commands.register(editor);
|
1566
|
+
});
|
1567
|
+
|
1568
|
+
return function () { };
|
1569
|
+
}
|
1570
|
+
);
|
1571
|
+
dem('tinymce.plugins.image.Plugin')();
|
1572
|
+
})();
|