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.
Files changed (198) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/assets/_vendor/tinymce/plugins/advlist/index.js +7 -0
  4. data/assets/_vendor/tinymce/plugins/advlist/plugin.js +428 -0
  5. data/assets/_vendor/tinymce/plugins/advlist/plugin.min.js +1 -0
  6. data/assets/_vendor/tinymce/plugins/anchor/index.js +7 -0
  7. data/assets/_vendor/tinymce/plugins/anchor/plugin.js +338 -0
  8. data/assets/_vendor/tinymce/plugins/anchor/plugin.min.js +1 -0
  9. data/assets/_vendor/tinymce/plugins/autolink/index.js +7 -0
  10. data/assets/_vendor/tinymce/plugins/autolink/plugin.js +404 -0
  11. data/assets/_vendor/tinymce/plugins/autolink/plugin.min.js +1 -0
  12. data/assets/_vendor/tinymce/plugins/autoresize/index.js +7 -0
  13. data/assets/_vendor/tinymce/plugins/autoresize/plugin.js +451 -0
  14. data/assets/_vendor/tinymce/plugins/autoresize/plugin.min.js +1 -0
  15. data/assets/_vendor/tinymce/plugins/autosave/index.js +7 -0
  16. data/assets/_vendor/tinymce/plugins/autosave/plugin.js +608 -0
  17. data/assets/_vendor/tinymce/plugins/autosave/plugin.min.js +1 -0
  18. data/assets/_vendor/tinymce/plugins/bbcode/index.js +7 -0
  19. data/assets/_vendor/tinymce/plugins/bbcode/plugin.js +264 -0
  20. data/assets/_vendor/tinymce/plugins/bbcode/plugin.min.js +1 -0
  21. data/assets/_vendor/tinymce/plugins/charmap/index.js +7 -0
  22. data/assets/_vendor/tinymce/plugins/charmap/plugin.js +850 -0
  23. data/assets/_vendor/tinymce/plugins/charmap/plugin.min.js +1 -0
  24. data/assets/_vendor/tinymce/plugins/code/index.js +7 -0
  25. data/assets/_vendor/tinymce/plugins/code/plugin.js +338 -0
  26. data/assets/_vendor/tinymce/plugins/code/plugin.min.js +1 -0
  27. data/assets/_vendor/tinymce/plugins/codesample/css/prism.css +138 -0
  28. data/assets/_vendor/tinymce/plugins/codesample/index.js +7 -0
  29. data/assets/_vendor/tinymce/plugins/codesample/plugin.js +1582 -0
  30. data/assets/_vendor/tinymce/plugins/codesample/plugin.min.js +1 -0
  31. data/assets/_vendor/tinymce/plugins/colorpicker/index.js +7 -0
  32. data/assets/_vendor/tinymce/plugins/colorpicker/plugin.js +272 -0
  33. data/assets/_vendor/tinymce/plugins/colorpicker/plugin.min.js +1 -0
  34. data/assets/_vendor/tinymce/plugins/contextmenu/index.js +7 -0
  35. data/assets/_vendor/tinymce/plugins/contextmenu/plugin.js +496 -0
  36. data/assets/_vendor/tinymce/plugins/contextmenu/plugin.min.js +1 -0
  37. data/assets/_vendor/tinymce/plugins/directionality/index.js +7 -0
  38. data/assets/_vendor/tinymce/plugins/directionality/plugin.js +270 -0
  39. data/assets/_vendor/tinymce/plugins/directionality/plugin.min.js +1 -0
  40. data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-cool.gif +0 -0
  41. data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-cry.gif +0 -0
  42. data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-embarassed.gif +0 -0
  43. data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-foot-in-mouth.gif +0 -0
  44. data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-frown.gif +0 -0
  45. data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-innocent.gif +0 -0
  46. data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-kiss.gif +0 -0
  47. data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-laughing.gif +0 -0
  48. data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-money-mouth.gif +0 -0
  49. data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-sealed.gif +0 -0
  50. data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-smile.gif +0 -0
  51. data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-surprised.gif +0 -0
  52. data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-tongue-out.gif +0 -0
  53. data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-undecided.gif +0 -0
  54. data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-wink.gif +0 -0
  55. data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-yell.gif +0 -0
  56. data/assets/_vendor/tinymce/plugins/emoticons/index.js +7 -0
  57. data/assets/_vendor/tinymce/plugins/emoticons/plugin.js +256 -0
  58. data/assets/_vendor/tinymce/plugins/emoticons/plugin.min.js +1 -0
  59. data/assets/_vendor/tinymce/plugins/fullpage/index.js +7 -0
  60. data/assets/_vendor/tinymce/plugins/fullpage/plugin.js +962 -0
  61. data/assets/_vendor/tinymce/plugins/fullpage/plugin.min.js +1 -0
  62. data/assets/_vendor/tinymce/plugins/fullscreen/index.js +7 -0
  63. data/assets/_vendor/tinymce/plugins/fullscreen/plugin.js +455 -0
  64. data/assets/_vendor/tinymce/plugins/fullscreen/plugin.min.js +1 -0
  65. data/assets/_vendor/tinymce/plugins/help/img/logo.png +0 -0
  66. data/assets/_vendor/tinymce/plugins/help/index.js +7 -0
  67. data/assets/_vendor/tinymce/plugins/help/plugin.js +1527 -0
  68. data/assets/_vendor/tinymce/plugins/help/plugin.min.js +1 -0
  69. data/assets/_vendor/tinymce/plugins/hr/index.js +7 -0
  70. data/assets/_vendor/tinymce/plugins/hr/plugin.js +195 -0
  71. data/assets/_vendor/tinymce/plugins/hr/plugin.min.js +1 -0
  72. data/assets/_vendor/tinymce/plugins/image/index.js +7 -0
  73. data/assets/_vendor/tinymce/plugins/image/plugin.js +1572 -0
  74. data/assets/_vendor/tinymce/plugins/image/plugin.min.js +1 -0
  75. data/assets/_vendor/tinymce/plugins/imagetools/index.js +7 -0
  76. data/assets/_vendor/tinymce/plugins/imagetools/plugin.js +4444 -0
  77. data/assets/_vendor/tinymce/plugins/imagetools/plugin.min.js +2 -0
  78. data/assets/_vendor/tinymce/plugins/importcss/index.js +7 -0
  79. data/assets/_vendor/tinymce/plugins/importcss/plugin.js +577 -0
  80. data/assets/_vendor/tinymce/plugins/importcss/plugin.min.js +1 -0
  81. data/assets/_vendor/tinymce/plugins/insertdatetime/index.js +7 -0
  82. data/assets/_vendor/tinymce/plugins/insertdatetime/plugin.js +482 -0
  83. data/assets/_vendor/tinymce/plugins/insertdatetime/plugin.min.js +1 -0
  84. data/assets/_vendor/tinymce/plugins/legacyoutput/index.js +7 -0
  85. data/assets/_vendor/tinymce/plugins/legacyoutput/plugin.js +395 -0
  86. data/assets/_vendor/tinymce/plugins/legacyoutput/plugin.min.js +1 -0
  87. data/assets/_vendor/tinymce/plugins/link/index.js +7 -0
  88. data/assets/_vendor/tinymce/plugins/link/plugin.js +1231 -0
  89. data/assets/_vendor/tinymce/plugins/link/plugin.min.js +1 -0
  90. data/assets/_vendor/tinymce/plugins/lists/index.js +7 -0
  91. data/assets/_vendor/tinymce/plugins/lists/plugin.js +1985 -0
  92. data/assets/_vendor/tinymce/plugins/lists/plugin.min.js +1 -0
  93. data/assets/_vendor/tinymce/plugins/media/index.js +7 -0
  94. data/assets/_vendor/tinymce/plugins/media/plugin.js +2026 -0
  95. data/assets/_vendor/tinymce/plugins/media/plugin.min.js +1 -0
  96. data/assets/_vendor/tinymce/plugins/nonbreaking/index.js +7 -0
  97. data/assets/_vendor/tinymce/plugins/nonbreaking/plugin.js +313 -0
  98. data/assets/_vendor/tinymce/plugins/nonbreaking/plugin.min.js +1 -0
  99. data/assets/_vendor/tinymce/plugins/noneditable/index.js +7 -0
  100. data/assets/_vendor/tinymce/plugins/noneditable/plugin.js +316 -0
  101. data/assets/_vendor/tinymce/plugins/noneditable/plugin.min.js +1 -0
  102. data/assets/_vendor/tinymce/plugins/pagebreak/index.js +7 -0
  103. data/assets/_vendor/tinymce/plugins/pagebreak/plugin.js +354 -0
  104. data/assets/_vendor/tinymce/plugins/pagebreak/plugin.min.js +1 -0
  105. data/assets/_vendor/tinymce/plugins/paste/index.js +7 -0
  106. data/assets/_vendor/tinymce/plugins/paste/plugin.js +2935 -0
  107. data/assets/_vendor/tinymce/plugins/paste/plugin.min.js +1 -0
  108. data/assets/_vendor/tinymce/plugins/preview/index.js +7 -0
  109. data/assets/_vendor/tinymce/plugins/preview/plugin.js +410 -0
  110. data/assets/_vendor/tinymce/plugins/preview/plugin.min.js +1 -0
  111. data/assets/_vendor/tinymce/plugins/print/index.js +7 -0
  112. data/assets/_vendor/tinymce/plugins/print/plugin.js +194 -0
  113. data/assets/_vendor/tinymce/plugins/print/plugin.min.js +1 -0
  114. data/assets/_vendor/tinymce/plugins/save/index.js +7 -0
  115. data/assets/_vendor/tinymce/plugins/save/plugin.js +370 -0
  116. data/assets/_vendor/tinymce/plugins/save/plugin.min.js +1 -0
  117. data/assets/_vendor/tinymce/plugins/searchreplace/index.js +7 -0
  118. data/assets/_vendor/tinymce/plugins/searchreplace/plugin.js +977 -0
  119. data/assets/_vendor/tinymce/plugins/searchreplace/plugin.min.js +1 -0
  120. data/assets/_vendor/tinymce/plugins/spellchecker/index.js +7 -0
  121. data/assets/_vendor/tinymce/plugins/spellchecker/plugin.js +1419 -0
  122. data/assets/_vendor/tinymce/plugins/spellchecker/plugin.min.js +1 -0
  123. data/assets/_vendor/tinymce/plugins/tabfocus/index.js +7 -0
  124. data/assets/_vendor/tinymce/plugins/tabfocus/plugin.js +419 -0
  125. data/assets/_vendor/tinymce/plugins/tabfocus/plugin.min.js +1 -0
  126. data/assets/_vendor/tinymce/plugins/table/index.js +7 -0
  127. data/assets/_vendor/tinymce/plugins/table/plugin.js +15527 -0
  128. data/assets/_vendor/tinymce/plugins/table/plugin.min.js +5 -0
  129. data/assets/_vendor/tinymce/plugins/template/index.js +7 -0
  130. data/assets/_vendor/tinymce/plugins/template/plugin.js +807 -0
  131. data/assets/_vendor/tinymce/plugins/template/plugin.min.js +1 -0
  132. data/assets/_vendor/tinymce/plugins/textcolor/index.js +7 -0
  133. data/assets/_vendor/tinymce/plugins/textcolor/plugin.js +619 -0
  134. data/assets/_vendor/tinymce/plugins/textcolor/plugin.min.js +1 -0
  135. data/assets/_vendor/tinymce/plugins/textpattern/index.js +7 -0
  136. data/assets/_vendor/tinymce/plugins/textpattern/plugin.js +718 -0
  137. data/assets/_vendor/tinymce/plugins/textpattern/plugin.min.js +1 -0
  138. data/assets/_vendor/tinymce/plugins/toc/index.js +7 -0
  139. data/assets/_vendor/tinymce/plugins/toc/plugin.js +559 -0
  140. data/assets/_vendor/tinymce/plugins/toc/plugin.min.js +1 -0
  141. data/assets/_vendor/tinymce/plugins/visualblocks/css/visualblocks.css +154 -0
  142. data/assets/_vendor/tinymce/plugins/visualblocks/index.js +7 -0
  143. data/assets/_vendor/tinymce/plugins/visualblocks/plugin.js +459 -0
  144. data/assets/_vendor/tinymce/plugins/visualblocks/plugin.min.js +1 -0
  145. data/assets/_vendor/tinymce/plugins/visualchars/index.js +7 -0
  146. data/assets/_vendor/tinymce/plugins/visualchars/plugin.js +1325 -0
  147. data/assets/_vendor/tinymce/plugins/visualchars/plugin.min.js +1 -0
  148. data/assets/_vendor/tinymce/plugins/wordcount/index.js +7 -0
  149. data/assets/_vendor/tinymce/plugins/wordcount/plugin.js +735 -0
  150. data/assets/_vendor/tinymce/plugins/wordcount/plugin.min.js +1 -0
  151. data/assets/_vendor/tinymce/skins/lightgray/content.inline.min.css +1 -0
  152. data/assets/_vendor/tinymce/skins/lightgray/content.min.css +1 -0
  153. data/assets/_vendor/tinymce/skins/lightgray/content.mobile.min.css +1 -0
  154. data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce-mobile.woff +0 -0
  155. data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce-small.eot +0 -0
  156. data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce-small.svg +63 -0
  157. data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce-small.ttf +0 -0
  158. data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce-small.woff +0 -0
  159. data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce.eot +0 -0
  160. data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce.svg +131 -0
  161. data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce.ttf +0 -0
  162. data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce.woff +0 -0
  163. data/assets/_vendor/tinymce/skins/lightgray/img/anchor.gif +0 -0
  164. data/assets/_vendor/tinymce/skins/lightgray/img/loader.gif +0 -0
  165. data/assets/_vendor/tinymce/skins/lightgray/img/object.gif +0 -0
  166. data/assets/_vendor/tinymce/skins/lightgray/img/trans.gif +0 -0
  167. data/assets/_vendor/tinymce/skins/lightgray/skin.min.css +1 -0
  168. data/assets/_vendor/tinymce/skins/lightgray/skin.mobile.min.css +2 -0
  169. data/assets/_vendor/tinymce/themes/inlite/index.js +7 -0
  170. data/assets/_vendor/tinymce/themes/inlite/theme.js +18787 -0
  171. data/assets/_vendor/tinymce/themes/inlite/theme.min.js +5 -0
  172. data/assets/_vendor/tinymce/themes/mobile/index.js +7 -0
  173. data/assets/_vendor/tinymce/themes/mobile/theme.js +23384 -0
  174. data/assets/_vendor/tinymce/themes/mobile/theme.min.js +8 -0
  175. data/assets/_vendor/tinymce/themes/modern/index.js +7 -0
  176. data/assets/_vendor/tinymce/themes/modern/theme.js +18311 -0
  177. data/assets/_vendor/tinymce/themes/modern/theme.min.js +5 -0
  178. data/assets/_vendor/tinymce/tinymce.js +44399 -0
  179. data/assets/bedrock/js/bedrock.js +16587 -6193
  180. data/assets/bedrock/scss/_bedrock-components.scss +16 -0
  181. data/assets/bedrock/scss/_bedrock-settings.scss +15 -0
  182. data/assets/bedrock/scss/components/attachments-grid.scss +138 -0
  183. data/assets/bedrock/scss/components/dropzone-upload.scss +158 -0
  184. data/assets/bedrock/scss/components/global.scss +16 -8
  185. data/assets/bedrock/scss/components/helper-classes.scss +59 -0
  186. data/assets/bedrock/scss/components/inline-edit-box.scss +80 -0
  187. data/assets/bedrock/scss/components/login-box.scss +48 -0
  188. data/assets/bedrock/scss/components/no-content.scss +31 -0
  189. data/assets/bedrock/scss/components/off-canvas-menu.scss +1 -1
  190. data/assets/bedrock/scss/components/page-content.scss +51 -0
  191. data/assets/bedrock/scss/components/reveal-panel.scss +89 -0
  192. data/assets/bedrock/scss/components/select-box.scss +332 -0
  193. data/assets/bedrock/scss/components/tiny-mce-editor.scss +14 -7
  194. data/lib/bedrock_sass.rb +6 -0
  195. data/lib/bedrock_sass/engine.rb +8 -0
  196. data/lib/bedrock_sass/version.rb +1 -1
  197. data/lib/tasks/before_assets_precompile.rake +11 -0
  198. 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})};g("1",[],function(){var a=function(b){var c=b,d=function(){return c},e=function(a){c=a},f=function(){return a(d())};return{get:d,set:e,clone:f}};return a}),h("5",tinymce.util.Tools.resolve),g("2",["5"],function(a){return a("tinymce.PluginManager")}),g("6",[],function(){var a=function(a){return a.getParam("fullpage_hide_in_source_view")},b=function(a){return a.getParam("fullpage_default_xml_pi")},c=function(a){return a.getParam("fullpage_default_encoding")},d=function(a){return a.getParam("fullpage_default_font_family")},e=function(a){return a.getParam("fullpage_default_font_size")},f=function(a){return a.getParam("fullpage_default_text_color")},g=function(a){return a.getParam("fullpage_default_title")},h=function(a){return a.getParam("fullpage_default_doctype","<!DOCTYPE html>")};return{shouldHideInSourceView:a,getDefaultXmlPi:b,getDefaultEncoding:c,getDefaultFontFamily:d,getDefaultFontSize:e,getDefaultTextColor:f,getDefaultTitle:g,getDefaultDocType:h}}),g("8",["5"],function(a){return a("tinymce.util.Tools")}),g("9",[],function(){var a=function(a){return a.getParam("insertdatetime_dateformat",a.translate("%Y-%m-%d"))},b=function(a){return a.getParam("insertdatetime_timeformat",a.translate("%H:%M:%S"))},c=function(a){return a.getParam("insertdatetime_formats",["%H:%M:%S","%Y-%m-%d","%I:%M:%S %p","%D"])},d=function(a){var d=c(a);return d.length>0?d[0]:b(a)},e=function(a){return a.getParam("insertdatetime_element",!1)};return{getDateFormat:a,getTimeFormat:b,getFormats:c,getDefaultDateTime:d,shouldInsertTimeElement:e}}),g("7",["8","9"],function(a,b){var c="Sun Mon Tue Wed Thu Fri Sat Sun".split(" "),d="Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sunday".split(" "),e="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),f="January February March April May June July August September October November December".split(" "),g=function(a,b){if(a=""+a,a.length<b)for(var c=0;c<b-a.length;c++)a="0"+a;return a},h=function(a,b,h){return h=h||new Date,b=b.replace("%D","%m/%d/%Y"),b=b.replace("%r","%I:%M:%S %p"),b=b.replace("%Y",""+h.getFullYear()),b=b.replace("%y",""+h.getYear()),b=b.replace("%m",g(h.getMonth()+1,2)),b=b.replace("%d",g(h.getDate(),2)),b=b.replace("%H",""+g(h.getHours(),2)),b=b.replace("%M",""+g(h.getMinutes(),2)),b=b.replace("%S",""+g(h.getSeconds(),2)),b=b.replace("%I",""+((h.getHours()+11)%12+1)),b=b.replace("%p",""+(h.getHours()<12?"AM":"PM")),b=b.replace("%B",""+a.translate(f[h.getMonth()])),b=b.replace("%b",""+a.translate(e[h.getMonth()])),b=b.replace("%A",""+a.translate(d[h.getDay()])),b=b.replace("%a",""+a.translate(c[h.getDay()])),b=b.replace("%%","%")},i=function(a,b,c,d){var e=a.dom.create("time",{datetime:c},d);b.parentNode.insertBefore(e,b),a.dom.remove(b),a.selection.select(e,!0),a.selection.collapse(!1)},j=function(a,c){if(b.shouldInsertTimeElement(a)){var d,e=h(a,c);d=/%[HMSIp]/.test(c)?h(a,"%Y-%m-%dT%H:%M"):h(a,"%Y-%m-%d");var f=a.dom.getParent(a.selection.getStart(),"time");f?i(a,f,d,e):a.insertContent('<time datetime="'+d+'">'+e+"</time>")}else a.insertContent(h(a,c))};return{insertDateTime:j,getDateTime:h}}),g("3",["6","7"],function(a,b){var c=function(c){c.addCommand("mceInsertDate",function(){b.insertDateTime(c,a.getDateFormat())}),c.addCommand("mceInsertTime",function(){b.insertDateTime(c,a.getTimeFormat())})};return{register:c}}),g("4",["8","9","7"],function(a,b,c){var d=function(d,e){var f=b.getFormats(d);return a.map(f,function(a){return{text:c.getDateTime(d,a),onclick:function(){e.set(a),c.insertDateTime(d,a)}}})},e=function(a,e){var f=d(a,e);a.addButton("insertdatetime",{type:"splitbutton",title:"Insert date/time",menu:f,onclick:function(){var d=e.get();c.insertDateTime(a,d?d:b.getDefaultDateTime(a))}}),a.addMenuItem("insertdatetime",{icon:"date",text:"Date/time",menu:f,context:"insert"})};return{register:e}}),g("0",["1","2","3","4"],function(a,b,c,d){return b.add("insertdatetime",function(b){var e=a(null);c.register(b),d.register(b,e)}),function(){}}),d("0")()}();
@@ -0,0 +1,7 @@
1
+ // Exports the "legacyoutput" plugin for usage with module loaders
2
+ // Usage:
3
+ // CommonJS:
4
+ // require('tinymce/plugins/legacyoutput')
5
+ // ES2015:
6
+ // import 'tinymce/plugins/legacyoutput'
7
+ require('./plugin.js');
@@ -0,0 +1,395 @@
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.legacyoutput.Plugin","tinymce.core.PluginManager","tinymce.plugins.legacyoutput.core.Formats","tinymce.plugins.legacyoutput.ui.Buttons","global!tinymce.util.Tools.resolve","tinymce.core.util.Tools"]
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
+ * ResolveGlobal.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.core.util.Tools',
119
+ [
120
+ 'global!tinymce.util.Tools.resolve'
121
+ ],
122
+ function (resolve) {
123
+ return resolve('tinymce.util.Tools');
124
+ }
125
+ );
126
+
127
+ /**
128
+ * Formats.js
129
+ *
130
+ * Released under LGPL License.
131
+ * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
132
+ *
133
+ * License: http://www.tinymce.com/license
134
+ * Contributing: http://www.tinymce.com/contributing
135
+ */
136
+
137
+ define(
138
+ 'tinymce.plugins.legacyoutput.core.Formats',
139
+ [
140
+ 'tinymce.core.util.Tools'
141
+ ],
142
+ function (Tools) {
143
+ var overrideFormats = function (editor) {
144
+ var alignElements = 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img',
145
+ fontSizes = Tools.explode(editor.settings.font_size_style_values),
146
+ schema = editor.schema;
147
+
148
+ // Override some internal formats to produce legacy elements and attributes
149
+ editor.formatter.register({
150
+ // Change alignment formats to use the deprecated align attribute
151
+ alignleft: { selector: alignElements, attributes: { align: 'left' } },
152
+ aligncenter: { selector: alignElements, attributes: { align: 'center' } },
153
+ alignright: { selector: alignElements, attributes: { align: 'right' } },
154
+ alignjustify: { selector: alignElements, attributes: { align: 'justify' } },
155
+
156
+ // Change the basic formatting elements to use deprecated element types
157
+ bold: [
158
+ { inline: 'b', remove: 'all' },
159
+ { inline: 'strong', remove: 'all' },
160
+ { inline: 'span', styles: { fontWeight: 'bold' } }
161
+ ],
162
+ italic: [
163
+ { inline: 'i', remove: 'all' },
164
+ { inline: 'em', remove: 'all' },
165
+ { inline: 'span', styles: { fontStyle: 'italic' } }
166
+ ],
167
+ underline: [
168
+ { inline: 'u', remove: 'all' },
169
+ { inline: 'span', styles: { textDecoration: 'underline' }, exact: true }
170
+ ],
171
+ strikethrough: [
172
+ { inline: 'strike', remove: 'all' },
173
+ { inline: 'span', styles: { textDecoration: 'line-through' }, exact: true }
174
+ ],
175
+
176
+ // Change font size and font family to use the deprecated font element
177
+ fontname: { inline: 'font', attributes: { face: '%value' } },
178
+ fontsize: {
179
+ inline: 'font',
180
+ attributes: {
181
+ size: function (vars) {
182
+ return Tools.inArray(fontSizes, vars.value) + 1;
183
+ }
184
+ }
185
+ },
186
+
187
+ // Setup font elements for colors as well
188
+ forecolor: { inline: 'font', attributes: { color: '%value' } },
189
+ hilitecolor: { inline: 'font', styles: { backgroundColor: '%value' } }
190
+ });
191
+
192
+ // Check that deprecated elements are allowed if not add them
193
+ Tools.each('b,i,u,strike'.split(','), function (name) {
194
+ schema.addValidElements(name + '[*]');
195
+ });
196
+
197
+ // Add font element if it's missing
198
+ if (!schema.getElementRule("font")) {
199
+ schema.addValidElements("font[face|size|color|style]");
200
+ }
201
+
202
+ // Add the missing and depreacted align attribute for the serialization engine
203
+ Tools.each(alignElements.split(','), function (name) {
204
+ var rule = schema.getElementRule(name);
205
+
206
+ if (rule) {
207
+ if (!rule.attributes.align) {
208
+ rule.attributes.align = {};
209
+ rule.attributesOrder.push('align');
210
+ }
211
+ }
212
+ });
213
+ };
214
+
215
+ var setup = function (editor) {
216
+ editor.settings.inline_styles = false;
217
+ editor.on('init', function () {
218
+ overrideFormats(editor);
219
+ });
220
+ };
221
+
222
+ return {
223
+ setup: setup
224
+ };
225
+ }
226
+ );
227
+ /**
228
+ * Buttons.js
229
+ *
230
+ * Released under LGPL License.
231
+ * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
232
+ *
233
+ * License: http://www.tinymce.com/license
234
+ * Contributing: http://www.tinymce.com/contributing
235
+ */
236
+
237
+ define(
238
+ 'tinymce.plugins.legacyoutput.ui.Buttons',
239
+ [
240
+ ],
241
+ function () {
242
+ var register = function (editor) {
243
+ editor.addButton('fontsizeselect', function () {
244
+ var items = [], defaultFontsizeFormats = '8pt=1 10pt=2 12pt=3 14pt=4 18pt=5 24pt=6 36pt=7';
245
+ var fontsizeFormats = editor.settings.fontsizeFormats || defaultFontsizeFormats;
246
+
247
+ editor.$.each(fontsizeFormats.split(' '), function (i, item) {
248
+ var text = item, value = item;
249
+ var values = item.split('=');
250
+
251
+ if (values.length > 1) {
252
+ text = values[0];
253
+ value = values[1];
254
+ }
255
+
256
+ items.push({ text: text, value: value });
257
+ });
258
+
259
+ return {
260
+ type: 'listbox',
261
+ text: 'Font Sizes',
262
+ tooltip: 'Font Sizes',
263
+ values: items,
264
+ fixedWidth: true,
265
+ onPostRender: function () {
266
+ var self = this;
267
+
268
+ editor.on('NodeChange', function () {
269
+ var fontElm;
270
+
271
+ fontElm = editor.dom.getParent(editor.selection.getNode(), 'font');
272
+ if (fontElm) {
273
+ self.value(fontElm.size);
274
+ } else {
275
+ self.value('');
276
+ }
277
+ });
278
+ },
279
+ onclick: function (e) {
280
+ if (e.control.settings.value) {
281
+ editor.execCommand('FontSize', false, e.control.settings.value);
282
+ }
283
+ }
284
+ };
285
+ });
286
+
287
+ editor.addButton('fontselect', function () {
288
+ function createFormats(formats) {
289
+ formats = formats.replace(/;$/, '').split(';');
290
+
291
+ var i = formats.length;
292
+ while (i--) {
293
+ formats[i] = formats[i].split('=');
294
+ }
295
+
296
+ return formats;
297
+ }
298
+
299
+ var defaultFontsFormats =
300
+ 'Andale Mono=andale mono,monospace;' +
301
+ 'Arial=arial,helvetica,sans-serif;' +
302
+ 'Arial Black=arial black,sans-serif;' +
303
+ 'Book Antiqua=book antiqua,palatino,serif;' +
304
+ 'Comic Sans MS=comic sans ms,sans-serif;' +
305
+ 'Courier New=courier new,courier,monospace;' +
306
+ 'Georgia=georgia,palatino,serif;' +
307
+ 'Helvetica=helvetica,arial,sans-serif;' +
308
+ 'Impact=impact,sans-serif;' +
309
+ 'Symbol=symbol;' +
310
+ 'Tahoma=tahoma,arial,helvetica,sans-serif;' +
311
+ 'Terminal=terminal,monaco,monospace;' +
312
+ 'Times New Roman=times new roman,times,serif;' +
313
+ 'Trebuchet MS=trebuchet ms,geneva,sans-serif;' +
314
+ 'Verdana=verdana,geneva,sans-serif;' +
315
+ 'Webdings=webdings;' +
316
+ 'Wingdings=wingdings,zapf dingbats';
317
+
318
+ var items = [], fonts = createFormats(editor.settings.font_formats || defaultFontsFormats);
319
+
320
+ editor.$.each(fonts, function (i, font) {
321
+ items.push({
322
+ text: { raw: font[0] },
323
+ value: font[1],
324
+ textStyle: font[1].indexOf('dings') === -1 ? 'font-family:' + font[1] : ''
325
+ });
326
+ });
327
+
328
+ return {
329
+ type: 'listbox',
330
+ text: 'Font Family',
331
+ tooltip: 'Font Family',
332
+ values: items,
333
+ fixedWidth: true,
334
+ onPostRender: function () {
335
+ var self = this;
336
+
337
+ editor.on('NodeChange', function () {
338
+ var fontElm;
339
+
340
+ fontElm = editor.dom.getParent(editor.selection.getNode(), 'font');
341
+ if (fontElm) {
342
+ self.value(fontElm.face);
343
+ } else {
344
+ self.value('');
345
+ }
346
+ });
347
+ },
348
+ onselect: function (e) {
349
+ if (e.control.settings.value) {
350
+ editor.execCommand('FontName', false, e.control.settings.value);
351
+ }
352
+ }
353
+ };
354
+ });
355
+ };
356
+
357
+ return {
358
+ register: register
359
+ };
360
+ }
361
+ );
362
+ /**
363
+ * Plugin.js
364
+ *
365
+ * Released under LGPL License.
366
+ * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
367
+ *
368
+ * License: http://www.tinymce.com/license
369
+ * Contributing: http://www.tinymce.com/contributing
370
+ */
371
+
372
+ /**
373
+ * This class contains all core logic for the legacyoutput plugin.
374
+ *
375
+ * @class tinymce.legacyoutput.Plugin
376
+ * @private
377
+ */
378
+ define(
379
+ 'tinymce.plugins.legacyoutput.Plugin',
380
+ [
381
+ 'tinymce.core.PluginManager',
382
+ 'tinymce.plugins.legacyoutput.core.Formats',
383
+ 'tinymce.plugins.legacyoutput.ui.Buttons'
384
+ ],
385
+ function (PluginManager, Formats, Buttons) {
386
+ PluginManager.add('legacyoutput', function (editor) {
387
+ Formats.setup(editor);
388
+ Buttons.register(editor);
389
+ });
390
+
391
+ return function () { };
392
+ }
393
+ );
394
+ dem('tinymce.plugins.legacyoutput.Plugin')();
395
+ })();
@@ -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("5",["4"],function(a){return a("tinymce.util.Tools")}),g("2",["5"],function(a){var b=function(b){var c="p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img",d=a.explode(b.settings.font_size_style_values),e=b.schema;b.formatter.register({alignleft:{selector:c,attributes:{align:"left"}},aligncenter:{selector:c,attributes:{align:"center"}},alignright:{selector:c,attributes:{align:"right"}},alignjustify:{selector:c,attributes:{align:"justify"}},bold:[{inline:"b",remove:"all"},{inline:"strong",remove:"all"},{inline:"span",styles:{fontWeight:"bold"}}],italic:[{inline:"i",remove:"all"},{inline:"em",remove:"all"},{inline:"span",styles:{fontStyle:"italic"}}],underline:[{inline:"u",remove:"all"},{inline:"span",styles:{textDecoration:"underline"},exact:!0}],strikethrough:[{inline:"strike",remove:"all"},{inline:"span",styles:{textDecoration:"line-through"},exact:!0}],fontname:{inline:"font",attributes:{face:"%value"}},fontsize:{inline:"font",attributes:{size:function(b){return a.inArray(d,b.value)+1}}},forecolor:{inline:"font",attributes:{color:"%value"}},hilitecolor:{inline:"font",styles:{backgroundColor:"%value"}}}),a.each("b,i,u,strike".split(","),function(a){e.addValidElements(a+"[*]")}),e.getElementRule("font")||e.addValidElements("font[face|size|color|style]"),a.each(c.split(","),function(a){var b=e.getElementRule(a);b&&(b.attributes.align||(b.attributes.align={},b.attributesOrder.push("align")))})},c=function(a){a.settings.inline_styles=!1,a.on("init",function(){b(a)})};return{setup:c}}),g("3",[],function(){var a=function(a){a.addButton("fontsizeselect",function(){var b=[],c="8pt=1 10pt=2 12pt=3 14pt=4 18pt=5 24pt=6 36pt=7",d=a.settings.fontsizeFormats||c;return a.$.each(d.split(" "),function(a,c){var d=c,e=c,f=c.split("=");f.length>1&&(d=f[0],e=f[1]),b.push({text:d,value:e})}),{type:"listbox",text:"Font Sizes",tooltip:"Font Sizes",values:b,fixedWidth:!0,onPostRender:function(){var b=this;a.on("NodeChange",function(){var c;c=a.dom.getParent(a.selection.getNode(),"font"),c?b.value(c.size):b.value("")})},onclick:function(b){b.control.settings.value&&a.execCommand("FontSize",!1,b.control.settings.value)}}}),a.addButton("fontselect",function(){function b(a){a=a.replace(/;$/,"").split(";");for(var b=a.length;b--;)a[b]=a[b].split("=");return a}var c="Andale Mono=andale mono,monospace;Arial=arial,helvetica,sans-serif;Arial Black=arial black,sans-serif;Book Antiqua=book antiqua,palatino,serif;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,palatino,serif;Helvetica=helvetica,arial,sans-serif;Impact=impact,sans-serif;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco,monospace;Times New Roman=times new roman,times,serif;Trebuchet MS=trebuchet ms,geneva,sans-serif;Verdana=verdana,geneva,sans-serif;Webdings=webdings;Wingdings=wingdings,zapf dingbats",d=[],e=b(a.settings.font_formats||c);return a.$.each(e,function(a,b){d.push({text:{raw:b[0]},value:b[1],textStyle:b[1].indexOf("dings")===-1?"font-family:"+b[1]:""})}),{type:"listbox",text:"Font Family",tooltip:"Font Family",values:d,fixedWidth:!0,onPostRender:function(){var b=this;a.on("NodeChange",function(){var c;c=a.dom.getParent(a.selection.getNode(),"font"),c?b.value(c.face):b.value("")})},onselect:function(b){b.control.settings.value&&a.execCommand("FontName",!1,b.control.settings.value)}}})};return{register:a}}),g("0",["1","2","3"],function(a,b,c){return a.add("legacyoutput",function(a){b.setup(a),c.register(a)}),function(){}}),d("0")()}();
@@ -0,0 +1,7 @@
1
+ // Exports the "link" plugin for usage with module loaders
2
+ // Usage:
3
+ // CommonJS:
4
+ // require('tinymce/plugins/link')
5
+ // ES2015:
6
+ // import 'tinymce/plugins/link'
7
+ require('./plugin.js');
@@ -0,0 +1,1231 @@
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.link.Plugin","tinymce.core.PluginManager","tinymce.plugins.link.api.Commands","tinymce.plugins.link.core.Actions","tinymce.plugins.link.core.Keyboard","tinymce.plugins.link.ui.Controls","global!tinymce.util.Tools.resolve","tinymce.core.util.VK","tinymce.plugins.link.api.Settings","tinymce.plugins.link.core.OpenUrl","tinymce.plugins.link.core.Utils","tinymce.plugins.link.ui.Dialog","global!document","global!window","tinymce.core.dom.DOMUtils","tinymce.core.Env","global!RegExp","tinymce.core.util.Tools","tinymce.core.util.Delay","tinymce.core.util.XHR"]
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
+ * ResolveGlobal.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.core.util.VK',
119
+ [
120
+ 'global!tinymce.util.Tools.resolve'
121
+ ],
122
+ function (resolve) {
123
+ return resolve('tinymce.util.VK');
124
+ }
125
+ );
126
+
127
+ /**
128
+ * Settings.js
129
+ *
130
+ * Released under LGPL License.
131
+ * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
132
+ *
133
+ * License: http://www.tinymce.com/license
134
+ * Contributing: http://www.tinymce.com/contributing
135
+ */
136
+
137
+ define(
138
+ 'tinymce.plugins.link.api.Settings',
139
+ [
140
+ ],
141
+ function () {
142
+ var assumeExternalTargets = function (editorSettings) {
143
+ return typeof editorSettings.link_assume_external_targets === 'boolean' ? editorSettings.link_assume_external_targets : false;
144
+ };
145
+
146
+ var hasContextToolbar = function (editorSettings) {
147
+ return typeof editorSettings.link_context_toolbar === 'boolean' ? editorSettings.link_context_toolbar : false;
148
+ };
149
+
150
+ var getLinkList = function (editorSettings) {
151
+ return editorSettings.link_list;
152
+ };
153
+
154
+ var hasDefaultLinkTarget = function (editorSettings) {
155
+ return typeof editorSettings.default_link_target === 'string';
156
+ };
157
+
158
+ var getDefaultLinkTarget = function (editorSettings) {
159
+ return editorSettings.default_link_target;
160
+ };
161
+
162
+ var getTargetList = function (editorSettings) {
163
+ return editorSettings.target_list;
164
+ };
165
+
166
+ var setTargetList = function (editor, list) {
167
+ editor.settings.target_list = list;
168
+ };
169
+
170
+ var shouldShowTargetList = function (editorSettings) {
171
+ return getTargetList(editorSettings) !== false;
172
+ };
173
+
174
+ var getRelList = function (editorSettings) {
175
+ return editorSettings.rel_list;
176
+ };
177
+
178
+ var hasRelList = function (editorSettings) {
179
+ return getRelList(editorSettings) !== undefined;
180
+ };
181
+
182
+ var getLinkClassList = function (editorSettings) {
183
+ return editorSettings.link_class_list;
184
+ };
185
+
186
+ var hasLinkClassList = function (editorSettings) {
187
+ return getLinkClassList(editorSettings) !== undefined;
188
+ };
189
+
190
+ var shouldShowLinkTitle = function (editorSettings) {
191
+ return editorSettings.link_title !== false;
192
+ };
193
+
194
+ var allowUnsafeLinkTarget = function (editorSettings) {
195
+ return typeof editorSettings.allow_unsafe_link_target === 'boolean' ? editorSettings.allow_unsafe_link_target : false;
196
+ };
197
+
198
+ return {
199
+ assumeExternalTargets: assumeExternalTargets,
200
+ hasContextToolbar: hasContextToolbar,
201
+ getLinkList: getLinkList,
202
+ hasDefaultLinkTarget: hasDefaultLinkTarget,
203
+ getDefaultLinkTarget: getDefaultLinkTarget,
204
+ getTargetList: getTargetList,
205
+ setTargetList: setTargetList,
206
+ shouldShowTargetList: shouldShowTargetList,
207
+ getRelList: getRelList,
208
+ hasRelList: hasRelList,
209
+ getLinkClassList: getLinkClassList,
210
+ hasLinkClassList: hasLinkClassList,
211
+ shouldShowLinkTitle: shouldShowLinkTitle,
212
+ allowUnsafeLinkTarget: allowUnsafeLinkTarget
213
+ };
214
+ }
215
+ );
216
+
217
+ defineGlobal("global!document", document);
218
+ defineGlobal("global!window", window);
219
+ /**
220
+ * ResolveGlobal.js
221
+ *
222
+ * Released under LGPL License.
223
+ * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
224
+ *
225
+ * License: http://www.tinymce.com/license
226
+ * Contributing: http://www.tinymce.com/contributing
227
+ */
228
+
229
+ define(
230
+ 'tinymce.core.dom.DOMUtils',
231
+ [
232
+ 'global!tinymce.util.Tools.resolve'
233
+ ],
234
+ function (resolve) {
235
+ return resolve('tinymce.dom.DOMUtils');
236
+ }
237
+ );
238
+
239
+ /**
240
+ * ResolveGlobal.js
241
+ *
242
+ * Released under LGPL License.
243
+ * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
244
+ *
245
+ * License: http://www.tinymce.com/license
246
+ * Contributing: http://www.tinymce.com/contributing
247
+ */
248
+
249
+ define(
250
+ 'tinymce.core.Env',
251
+ [
252
+ 'global!tinymce.util.Tools.resolve'
253
+ ],
254
+ function (resolve) {
255
+ return resolve('tinymce.Env');
256
+ }
257
+ );
258
+
259
+ /**
260
+ * OpenUrl.js
261
+ *
262
+ * Released under LGPL License.
263
+ * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
264
+ *
265
+ * License: http://www.tinymce.com/license
266
+ * Contributing: http://www.tinymce.com/contributing
267
+ */
268
+
269
+ define(
270
+ 'tinymce.plugins.link.core.OpenUrl',
271
+ [
272
+ 'global!document',
273
+ 'global!window',
274
+ 'tinymce.core.dom.DOMUtils',
275
+ 'tinymce.core.Env'
276
+ ],
277
+ function (document, window, DOMUtils, Env) {
278
+ var appendClickRemove = function (link, evt) {
279
+ document.body.appendChild(link);
280
+ link.dispatchEvent(evt);
281
+ document.body.removeChild(link);
282
+ };
283
+
284
+ var open = function (url) {
285
+ // Chrome and Webkit has implemented noopener and works correctly with/without popup blocker
286
+ // Firefox has it implemented noopener but when the popup blocker is activated it doesn't work
287
+ // Edge has only implemented noreferrer and it seems to remove opener as well
288
+ // Older IE versions pre IE 11 falls back to a window.open approach
289
+ if (!Env.ie || Env.ie > 10) {
290
+ var link = document.createElement('a');
291
+ link.target = '_blank';
292
+ link.href = url;
293
+ link.rel = 'noreferrer noopener';
294
+
295
+ var evt = document.createEvent('MouseEvents');
296
+ evt.initMouseEvent('click', true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
297
+
298
+ appendClickRemove(link, evt);
299
+ } else {
300
+ var win = window.open('', '_blank');
301
+ if (win) {
302
+ win.opener = null;
303
+ var doc = win.document;
304
+ doc.open();
305
+ doc.write('<meta http-equiv="refresh" content="0; url=' + DOMUtils.DOM.encode(url) + '">');
306
+ doc.close();
307
+ }
308
+ }
309
+ };
310
+
311
+ return {
312
+ open: open
313
+ };
314
+ }
315
+ );
316
+ defineGlobal("global!RegExp", RegExp);
317
+ /**
318
+ * ResolveGlobal.js
319
+ *
320
+ * Released under LGPL License.
321
+ * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
322
+ *
323
+ * License: http://www.tinymce.com/license
324
+ * Contributing: http://www.tinymce.com/contributing
325
+ */
326
+
327
+ define(
328
+ 'tinymce.core.util.Tools',
329
+ [
330
+ 'global!tinymce.util.Tools.resolve'
331
+ ],
332
+ function (resolve) {
333
+ return resolve('tinymce.util.Tools');
334
+ }
335
+ );
336
+
337
+ /**
338
+ * Utils.js
339
+ *
340
+ * Released under LGPL License.
341
+ * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
342
+ *
343
+ * License: http://www.tinymce.com/license
344
+ * Contributing: http://www.tinymce.com/contributing
345
+ */
346
+
347
+ define(
348
+ 'tinymce.plugins.link.core.Utils',
349
+ [
350
+ 'global!RegExp',
351
+ 'tinymce.core.util.Tools',
352
+ 'tinymce.plugins.link.api.Settings'
353
+ ],
354
+ function (RegExp, Tools, Settings) {
355
+ var toggleTargetRules = function (rel, isUnsafe) {
356
+ var rules = ['noopener'];
357
+ var newRel = rel ? rel.split(/\s+/) : [];
358
+
359
+ var toString = function (rel) {
360
+ return Tools.trim(rel.sort().join(' '));
361
+ };
362
+
363
+ var addTargetRules = function (rel) {
364
+ rel = removeTargetRules(rel);
365
+ return rel.length ? rel.concat(rules) : rules;
366
+ };
367
+
368
+ var removeTargetRules = function (rel) {
369
+ return rel.filter(function (val) {
370
+ return Tools.inArray(rules, val) === -1;
371
+ });
372
+ };
373
+
374
+ newRel = isUnsafe ? addTargetRules(newRel) : removeTargetRules(newRel);
375
+ return newRel.length ? toString(newRel) : null;
376
+ };
377
+
378
+ var trimCaretContainers = function (text) {
379
+ return text.replace(/\uFEFF/g, '');
380
+ };
381
+
382
+ var getAnchorElement = function (editor, selectedElm) {
383
+ selectedElm = selectedElm || editor.selection.getNode();
384
+ if (isImageFigure(selectedElm)) {
385
+ // for an image conained in a figure we look for a link inside the selected element
386
+ return editor.dom.select('a[href]', selectedElm)[0];
387
+ } else {
388
+ return editor.dom.getParent(selectedElm, 'a[href]');
389
+ }
390
+ };
391
+
392
+ var getAnchorText = function (selection, anchorElm) {
393
+ var text = anchorElm ? (anchorElm.innerText || anchorElm.textContent) : selection.getContent({ format: 'text' });
394
+ return trimCaretContainers(text);
395
+ };
396
+
397
+ var isLink = function (elm) {
398
+ return elm && elm.nodeName === 'A' && elm.href;
399
+ };
400
+
401
+ var hasLinks = function (elements) {
402
+ return Tools.grep(elements, isLink).length > 0;
403
+ };
404
+
405
+ var isOnlyTextSelected = function (html) {
406
+ // Partial html and not a fully selected anchor element
407
+ if (/</.test(html) && (!/^<a [^>]+>[^<]+<\/a>$/.test(html) || html.indexOf('href=') === -1)) {
408
+ return false;
409
+ }
410
+
411
+ return true;
412
+ };
413
+
414
+ var isImageFigure = function (node) {
415
+ return node && node.nodeName === 'FIGURE' && /\bimage\b/i.test(node.className);
416
+ };
417
+
418
+ var link = function (editor, attachState) {
419
+ return function (data) {
420
+ editor.undoManager.transact(function () {
421
+ var selectedElm = editor.selection.getNode();
422
+ var anchorElm = getAnchorElement(editor, selectedElm);
423
+
424
+ var linkAttrs = {
425
+ href: data.href,
426
+ target: data.target ? data.target : null,
427
+ rel: data.rel ? data.rel : null,
428
+ "class": data["class"] ? data["class"] : null,
429
+ title: data.title ? data.title : null
430
+ };
431
+
432
+ if (!Settings.hasRelList(editor.settings) && Settings.allowUnsafeLinkTarget(editor.settings) === false) {
433
+ linkAttrs.rel = toggleTargetRules(linkAttrs.rel, linkAttrs.target === '_blank');
434
+ }
435
+
436
+ if (data.href === attachState.href) {
437
+ attachState.attach();
438
+ attachState = {};
439
+ }
440
+
441
+ if (anchorElm) {
442
+ editor.focus();
443
+
444
+ if (data.hasOwnProperty('text')) {
445
+ if ("innerText" in anchorElm) {
446
+ anchorElm.innerText = data.text;
447
+ } else {
448
+ anchorElm.textContent = data.text;
449
+ }
450
+ }
451
+
452
+ editor.dom.setAttribs(anchorElm, linkAttrs);
453
+
454
+ editor.selection.select(anchorElm);
455
+ editor.undoManager.add();
456
+ } else {
457
+ if (isImageFigure(selectedElm)) {
458
+ linkImageFigure(editor, selectedElm, linkAttrs);
459
+ } else if (data.hasOwnProperty('text')) {
460
+ editor.insertContent(editor.dom.createHTML('a', linkAttrs, editor.dom.encode(data.text)));
461
+ } else {
462
+ editor.execCommand('mceInsertLink', false, linkAttrs);
463
+ }
464
+ }
465
+ });
466
+ };
467
+ };
468
+
469
+ var unlink = function (editor) {
470
+ return function () {
471
+ editor.undoManager.transact(function () {
472
+ var node = editor.selection.getNode();
473
+ if (isImageFigure(node)) {
474
+ unlinkImageFigure(editor, node);
475
+ } else {
476
+ editor.execCommand('unlink');
477
+ }
478
+ });
479
+ };
480
+ };
481
+
482
+ var unlinkImageFigure = function (editor, fig) {
483
+ var a, img;
484
+ img = editor.dom.select('img', fig)[0];
485
+ if (img) {
486
+ a = editor.dom.getParents(img, 'a[href]', fig)[0];
487
+ if (a) {
488
+ a.parentNode.insertBefore(img, a);
489
+ editor.dom.remove(a);
490
+ }
491
+ }
492
+ };
493
+
494
+ var linkImageFigure = function (editor, fig, attrs) {
495
+ var a, img;
496
+ img = editor.dom.select('img', fig)[0];
497
+ if (img) {
498
+ a = editor.dom.create('a', attrs);
499
+ img.parentNode.insertBefore(a, img);
500
+ a.appendChild(img);
501
+ }
502
+ };
503
+
504
+ return {
505
+ link: link,
506
+ unlink: unlink,
507
+ isLink: isLink,
508
+ hasLinks: hasLinks,
509
+ isOnlyTextSelected: isOnlyTextSelected,
510
+ getAnchorElement: getAnchorElement,
511
+ getAnchorText: getAnchorText,
512
+ toggleTargetRules: toggleTargetRules
513
+ };
514
+ }
515
+ );
516
+ /**
517
+ * ResolveGlobal.js
518
+ *
519
+ * Released under LGPL License.
520
+ * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
521
+ *
522
+ * License: http://www.tinymce.com/license
523
+ * Contributing: http://www.tinymce.com/contributing
524
+ */
525
+
526
+ define(
527
+ 'tinymce.core.util.Delay',
528
+ [
529
+ 'global!tinymce.util.Tools.resolve'
530
+ ],
531
+ function (resolve) {
532
+ return resolve('tinymce.util.Delay');
533
+ }
534
+ );
535
+
536
+ /**
537
+ * ResolveGlobal.js
538
+ *
539
+ * Released under LGPL License.
540
+ * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
541
+ *
542
+ * License: http://www.tinymce.com/license
543
+ * Contributing: http://www.tinymce.com/contributing
544
+ */
545
+
546
+ define(
547
+ 'tinymce.core.util.XHR',
548
+ [
549
+ 'global!tinymce.util.Tools.resolve'
550
+ ],
551
+ function (resolve) {
552
+ return resolve('tinymce.util.XHR');
553
+ }
554
+ );
555
+
556
+ /**
557
+ * Dialog.js
558
+ *
559
+ * Released under LGPL License.
560
+ * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
561
+ *
562
+ * License: http://www.tinymce.com/license
563
+ * Contributing: http://www.tinymce.com/contributing
564
+ */
565
+
566
+ define(
567
+ 'tinymce.plugins.link.ui.Dialog',
568
+ [
569
+ 'tinymce.core.util.Delay',
570
+ 'tinymce.core.util.Tools',
571
+ 'tinymce.core.util.XHR',
572
+ 'tinymce.plugins.link.api.Settings',
573
+ 'tinymce.plugins.link.core.Utils'
574
+ ],
575
+ function (Delay, Tools, XHR, Settings, Utils) {
576
+ var attachState = {};
577
+
578
+ var createLinkList = function (editor, callback) {
579
+ var linkList = Settings.getLinkList(editor.settings);
580
+
581
+ if (typeof linkList === "string") {
582
+ XHR.send({
583
+ url: linkList,
584
+ success: function (text) {
585
+ callback(editor, JSON.parse(text));
586
+ }
587
+ });
588
+ } else if (typeof linkList === "function") {
589
+ linkList(function (list) {
590
+ callback(editor, list);
591
+ });
592
+ } else {
593
+ callback(editor, linkList);
594
+ }
595
+ };
596
+
597
+ var buildListItems = function (inputList, itemCallback, startItems) {
598
+ var appendItems = function (values, output) {
599
+ output = output || [];
600
+
601
+ Tools.each(values, function (item) {
602
+ var menuItem = { text: item.text || item.title };
603
+
604
+ if (item.menu) {
605
+ menuItem.menu = appendItems(item.menu);
606
+ } else {
607
+ menuItem.value = item.value;
608
+
609
+ if (itemCallback) {
610
+ itemCallback(menuItem);
611
+ }
612
+ }
613
+
614
+ output.push(menuItem);
615
+ });
616
+
617
+ return output;
618
+ };
619
+
620
+ return appendItems(inputList, startItems || []);
621
+ };
622
+
623
+ // Delay confirm since onSubmit will move focus
624
+ var delayedConfirm = function (editor, message, callback) {
625
+ var rng = editor.selection.getRng();
626
+
627
+ Delay.setEditorTimeout(editor, function () {
628
+ editor.windowManager.confirm(message, function (state) {
629
+ editor.selection.setRng(rng);
630
+ callback(state);
631
+ });
632
+ });
633
+ };
634
+
635
+ var showDialog = function (editor, linkList) {
636
+ var data = {}, selection = editor.selection, dom = editor.dom, anchorElm, initialText;
637
+ var win, onlyText, textListCtrl, linkListCtrl, relListCtrl, targetListCtrl, classListCtrl, linkTitleCtrl, value;
638
+
639
+ var linkListChangeHandler = function (e) {
640
+ var textCtrl = win.find('#text');
641
+
642
+ if (!textCtrl.value() || (e.lastControl && textCtrl.value() === e.lastControl.text())) {
643
+ textCtrl.value(e.control.text());
644
+ }
645
+
646
+ win.find('#href').value(e.control.value());
647
+ };
648
+
649
+ var buildAnchorListControl = function (url) {
650
+ var anchorList = [];
651
+
652
+ Tools.each(editor.dom.select('a:not([href])'), function (anchor) {
653
+ var id = anchor.name || anchor.id;
654
+
655
+ if (id) {
656
+ anchorList.push({
657
+ text: id,
658
+ value: '#' + id,
659
+ selected: url.indexOf('#' + id) !== -1
660
+ });
661
+ }
662
+ });
663
+
664
+ if (anchorList.length) {
665
+ anchorList.unshift({ text: 'None', value: '' });
666
+
667
+ return {
668
+ name: 'anchor',
669
+ type: 'listbox',
670
+ label: 'Anchors',
671
+ values: anchorList,
672
+ onselect: linkListChangeHandler
673
+ };
674
+ }
675
+ };
676
+
677
+ var updateText = function () {
678
+ if (!initialText && onlyText && !data.text) {
679
+ this.parent().parent().find('#text')[0].value(this.value());
680
+ }
681
+ };
682
+
683
+ var urlChange = function (e) {
684
+ var meta = e.meta || {};
685
+
686
+ if (linkListCtrl) {
687
+ linkListCtrl.value(editor.convertURL(this.value(), 'href'));
688
+ }
689
+
690
+ Tools.each(e.meta, function (value, key) {
691
+ var inp = win.find('#' + key);
692
+
693
+ if (key === 'text') {
694
+ if (initialText.length === 0) {
695
+ inp.value(value);
696
+ data.text = value;
697
+ }
698
+ } else {
699
+ inp.value(value);
700
+ }
701
+ });
702
+
703
+ if (meta.attach) {
704
+ attachState = {
705
+ href: this.value(),
706
+ attach: meta.attach
707
+ };
708
+ }
709
+
710
+ if (!meta.text) {
711
+ updateText.call(this);
712
+ }
713
+ };
714
+
715
+ var onBeforeCall = function (e) {
716
+ e.meta = win.toJSON();
717
+ };
718
+
719
+ onlyText = Utils.isOnlyTextSelected(selection.getContent());
720
+ anchorElm = Utils.getAnchorElement(editor);
721
+
722
+ data.text = initialText = Utils.getAnchorText(editor.selection, anchorElm);
723
+ data.href = anchorElm ? dom.getAttrib(anchorElm, 'href') : '';
724
+
725
+ if (anchorElm) {
726
+ data.target = dom.getAttrib(anchorElm, 'target');
727
+ } else if (Settings.hasDefaultLinkTarget(editor.settings)) {
728
+ data.target = Settings.getDefaultLinkTarget(editor.settings);
729
+ }
730
+
731
+ if ((value = dom.getAttrib(anchorElm, 'rel'))) {
732
+ data.rel = value;
733
+ }
734
+
735
+ if ((value = dom.getAttrib(anchorElm, 'class'))) {
736
+ data['class'] = value;
737
+ }
738
+
739
+ if ((value = dom.getAttrib(anchorElm, 'title'))) {
740
+ data.title = value;
741
+ }
742
+
743
+ if (onlyText) {
744
+ textListCtrl = {
745
+ name: 'text',
746
+ type: 'textbox',
747
+ size: 40,
748
+ label: 'Text to display',
749
+ onchange: function () {
750
+ data.text = this.value();
751
+ }
752
+ };
753
+ }
754
+
755
+ if (linkList) {
756
+ linkListCtrl = {
757
+ type: 'listbox',
758
+ label: 'Link list',
759
+ values: buildListItems(
760
+ linkList,
761
+ function (item) {
762
+ item.value = editor.convertURL(item.value || item.url, 'href');
763
+ },
764
+ [{ text: 'None', value: '' }]
765
+ ),
766
+ onselect: linkListChangeHandler,
767
+ value: editor.convertURL(data.href, 'href'),
768
+ onPostRender: function () {
769
+ /*eslint consistent-this:0*/
770
+ linkListCtrl = this;
771
+ }
772
+ };
773
+ }
774
+
775
+ if (Settings.shouldShowTargetList(editor.settings)) {
776
+ if (Settings.getTargetList(editor.settings) === undefined) {
777
+ Settings.setTargetList(editor, [
778
+ { text: 'None', value: '' },
779
+ { text: 'New window', value: '_blank' }
780
+ ]);
781
+ }
782
+
783
+ targetListCtrl = {
784
+ name: 'target',
785
+ type: 'listbox',
786
+ label: 'Target',
787
+ values: buildListItems(Settings.getTargetList(editor.settings))
788
+ };
789
+ }
790
+
791
+ if (Settings.hasRelList(editor.settings)) {
792
+ relListCtrl = {
793
+ name: 'rel',
794
+ type: 'listbox',
795
+ label: 'Rel',
796
+ values: buildListItems(
797
+ Settings.getRelList(editor.settings),
798
+ function (item) {
799
+ if (Settings.allowUnsafeLinkTarget(editor.settings) === false) {
800
+ item.value = Utils.toggleTargetRules(item.value, data.target === '_blank');
801
+ }
802
+ }
803
+ )
804
+ };
805
+ }
806
+
807
+ if (Settings.hasLinkClassList(editor.settings)) {
808
+ classListCtrl = {
809
+ name: 'class',
810
+ type: 'listbox',
811
+ label: 'Class',
812
+ values: buildListItems(
813
+ Settings.getLinkClassList(editor.settings),
814
+ function (item) {
815
+ if (item.value) {
816
+ item.textStyle = function () {
817
+ return editor.formatter.getCssText({ inline: 'a', classes: [item.value] });
818
+ };
819
+ }
820
+ }
821
+ )
822
+ };
823
+ }
824
+
825
+ if (Settings.shouldShowLinkTitle(editor.settings)) {
826
+ linkTitleCtrl = {
827
+ name: 'title',
828
+ type: 'textbox',
829
+ label: 'Title',
830
+ value: data.title
831
+ };
832
+ }
833
+
834
+ win = editor.windowManager.open({
835
+ title: 'Insert link',
836
+ data: data,
837
+ body: [
838
+ {
839
+ name: 'href',
840
+ type: 'filepicker',
841
+ filetype: 'file',
842
+ size: 40,
843
+ autofocus: true,
844
+ label: 'Url',
845
+ onchange: urlChange,
846
+ onkeyup: updateText,
847
+ onbeforecall: onBeforeCall
848
+ },
849
+ textListCtrl,
850
+ linkTitleCtrl,
851
+ buildAnchorListControl(data.href),
852
+ linkListCtrl,
853
+ relListCtrl,
854
+ targetListCtrl,
855
+ classListCtrl
856
+ ],
857
+ onSubmit: function (e) {
858
+ var assumeExternalTargets = Settings.assumeExternalTargets(editor.settings);
859
+ var insertLink = Utils.link(editor, attachState);
860
+ var removeLink = Utils.unlink(editor);
861
+
862
+ var resultData = Tools.extend({}, data, e.data);
863
+ /*eslint dot-notation: 0*/
864
+ var href = resultData.href;
865
+
866
+ if (!href) {
867
+ removeLink();
868
+ return;
869
+ }
870
+
871
+ if (!onlyText || resultData.text === initialText) {
872
+ delete resultData.text;
873
+ }
874
+
875
+ // Is email and not //user@domain.com
876
+ if (href.indexOf('@') > 0 && href.indexOf('//') === -1 && href.indexOf('mailto:') === -1) {
877
+ delayedConfirm(
878
+ editor,
879
+ 'The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?',
880
+ function (state) {
881
+ if (state) {
882
+ resultData.href = 'mailto:' + href;
883
+ }
884
+ insertLink(resultData);
885
+ }
886
+ );
887
+ return;
888
+ }
889
+
890
+ // Is not protocol prefixed
891
+ if ((assumeExternalTargets === true && !/^\w+:/i.test(href)) ||
892
+ (assumeExternalTargets === false && /^\s*www[\.|\d\.]/i.test(href))) {
893
+ delayedConfirm(
894
+ editor,
895
+ 'The URL you entered seems to be an external link. Do you want to add the required http:// prefix?',
896
+ function (state) {
897
+ if (state) {
898
+ resultData.href = 'http://' + href;
899
+ }
900
+ insertLink(resultData);
901
+ }
902
+ );
903
+ return;
904
+ }
905
+
906
+ insertLink(resultData);
907
+ }
908
+ });
909
+ };
910
+
911
+ var open = function (editor) {
912
+ createLinkList(editor, showDialog);
913
+ };
914
+
915
+ return {
916
+ open: open
917
+ };
918
+ }
919
+ );
920
+ /**
921
+ * Actions.js
922
+ *
923
+ * Released under LGPL License.
924
+ * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
925
+ *
926
+ * License: http://www.tinymce.com/license
927
+ * Contributing: http://www.tinymce.com/contributing
928
+ */
929
+
930
+ define(
931
+ 'tinymce.plugins.link.core.Actions',
932
+ [
933
+ 'tinymce.core.util.VK',
934
+ 'tinymce.plugins.link.api.Settings',
935
+ 'tinymce.plugins.link.core.OpenUrl',
936
+ 'tinymce.plugins.link.core.Utils',
937
+ 'tinymce.plugins.link.ui.Dialog'
938
+ ],
939
+ function (VK, Settings, OpenUrl, Utils, Dialog) {
940
+ var getLink = function (editor, elm) {
941
+ return editor.dom.getParent(elm, 'a[href]');
942
+ };
943
+
944
+ var getSelectedLink = function (editor) {
945
+ return getLink(editor, editor.selection.getStart());
946
+ };
947
+
948
+ var getHref = function (elm) {
949
+ // Returns the real href value not the resolved a.href value
950
+ var href = elm.getAttribute('data-mce-href');
951
+ return href ? href : elm.getAttribute('href');
952
+ };
953
+
954
+ var isContextMenuVisible = function (editor) {
955
+ var contextmenu = editor.plugins.contextmenu;
956
+ return contextmenu ? contextmenu.isContextMenuVisible() : false;
957
+ };
958
+
959
+ var hasOnlyAltModifier = function (e) {
960
+ return e.altKey === true && e.shiftKey === false && e.ctrlKey === false && e.metaKey === false;
961
+ };
962
+
963
+ var gotoLink = function (editor, a) {
964
+ if (a) {
965
+ var href = getHref(a);
966
+ if (/^#/.test(href)) {
967
+ var targetEl = editor.$(href);
968
+ if (targetEl.length) {
969
+ editor.selection.scrollIntoView(targetEl[0], true);
970
+ }
971
+ } else {
972
+ OpenUrl.open(a.href);
973
+ }
974
+ }
975
+ };
976
+
977
+ var openDialog = function (editor) {
978
+ return function () {
979
+ Dialog.open(editor);
980
+ };
981
+ };
982
+
983
+ var gotoSelectedLink = function (editor) {
984
+ return function () {
985
+ gotoLink(editor, getSelectedLink(editor));
986
+ };
987
+ };
988
+
989
+ var leftClickedOnAHref = function (editor) {
990
+ return function (elm) {
991
+ var sel, rng, node;
992
+ if (Settings.hasContextToolbar(editor.settings) && !isContextMenuVisible(editor) && Utils.isLink(elm)) {
993
+ sel = editor.selection;
994
+ rng = sel.getRng();
995
+ node = rng.startContainer;
996
+ // ignore cursor positions at the beginning/end (to make context toolbar less noisy)
997
+ if (node.nodeType === 3 && sel.isCollapsed() && rng.startOffset > 0 && rng.startOffset < node.data.length) {
998
+ return true;
999
+ }
1000
+ }
1001
+ return false;
1002
+ };
1003
+ };
1004
+
1005
+ var setupGotoLinks = function (editor) {
1006
+ editor.on('click', function (e) {
1007
+ var link = getLink(editor, e.target);
1008
+ if (link && VK.metaKeyPressed(e)) {
1009
+ e.preventDefault();
1010
+ gotoLink(editor, link);
1011
+ }
1012
+ });
1013
+
1014
+ editor.on('keydown', function (e) {
1015
+ var link = getSelectedLink(editor);
1016
+ if (link && e.keyCode === 13 && hasOnlyAltModifier(e)) {
1017
+ e.preventDefault();
1018
+ gotoLink(editor, link);
1019
+ }
1020
+ });
1021
+ };
1022
+
1023
+ var toggleActiveState = function (editor) {
1024
+ return function () {
1025
+ var self = this;
1026
+ editor.on('nodechange', function (e) {
1027
+ self.active(!editor.readonly && !!Utils.getAnchorElement(editor, e.element));
1028
+ });
1029
+ };
1030
+ };
1031
+
1032
+ var toggleViewLinkState = function (editor) {
1033
+ return function () {
1034
+ var self = this;
1035
+
1036
+ var toggleVisibility = function (e) {
1037
+ if (Utils.hasLinks(e.parents)) {
1038
+ self.show();
1039
+ } else {
1040
+ self.hide();
1041
+ }
1042
+ };
1043
+
1044
+ if (!Utils.hasLinks(editor.dom.getParents(editor.selection.getStart()))) {
1045
+ self.hide();
1046
+ }
1047
+
1048
+ editor.on('nodechange', toggleVisibility);
1049
+
1050
+ self.on('remove', function () {
1051
+ editor.off('nodechange', toggleVisibility);
1052
+ });
1053
+ };
1054
+ };
1055
+
1056
+ return {
1057
+ openDialog: openDialog,
1058
+ gotoSelectedLink: gotoSelectedLink,
1059
+ leftClickedOnAHref: leftClickedOnAHref,
1060
+ setupGotoLinks: setupGotoLinks,
1061
+ toggleActiveState: toggleActiveState,
1062
+ toggleViewLinkState: toggleViewLinkState
1063
+ };
1064
+ }
1065
+ );
1066
+ /**
1067
+ * Commands.js
1068
+ *
1069
+ * Released under LGPL License.
1070
+ * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
1071
+ *
1072
+ * License: http://www.tinymce.com/license
1073
+ * Contributing: http://www.tinymce.com/contributing
1074
+ */
1075
+
1076
+ define(
1077
+ 'tinymce.plugins.link.api.Commands',
1078
+ [
1079
+ 'tinymce.plugins.link.core.Actions'
1080
+ ],
1081
+ function (Actions) {
1082
+ var register = function (editor) {
1083
+ editor.addCommand('mceLink', Actions.openDialog(editor));
1084
+ };
1085
+
1086
+ return {
1087
+ register: register
1088
+ };
1089
+ }
1090
+ );
1091
+
1092
+ /**
1093
+ * Keyboard.js
1094
+ *
1095
+ * Released under LGPL License.
1096
+ * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
1097
+ *
1098
+ * License: http://www.tinymce.com/license
1099
+ * Contributing: http://www.tinymce.com/contributing
1100
+ */
1101
+
1102
+ define(
1103
+ 'tinymce.plugins.link.core.Keyboard',
1104
+ [
1105
+ 'tinymce.plugins.link.core.Actions'
1106
+ ],
1107
+ function (Actions) {
1108
+ var setup = function (editor) {
1109
+ editor.addShortcut('Meta+K', '', Actions.openDialog(editor));
1110
+ };
1111
+
1112
+ return {
1113
+ setup: setup
1114
+ };
1115
+ }
1116
+ );
1117
+
1118
+ /**
1119
+ * Controls.js
1120
+ *
1121
+ * Released under LGPL License.
1122
+ * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
1123
+ *
1124
+ * License: http://www.tinymce.com/license
1125
+ * Contributing: http://www.tinymce.com/contributing
1126
+ */
1127
+
1128
+ define(
1129
+ 'tinymce.plugins.link.ui.Controls',
1130
+ [
1131
+ 'tinymce.plugins.link.core.Actions',
1132
+ 'tinymce.plugins.link.core.Utils'
1133
+ ],
1134
+ function (Actions, Utils) {
1135
+
1136
+ var setupButtons = function (editor) {
1137
+ editor.addButton('link', {
1138
+ active: false,
1139
+ icon: 'link',
1140
+ tooltip: 'Insert/edit link',
1141
+ onclick: Actions.openDialog(editor),
1142
+ onpostrender: Actions.toggleActiveState(editor)
1143
+ });
1144
+
1145
+ editor.addButton('unlink', {
1146
+ active: false,
1147
+ icon: 'unlink',
1148
+ tooltip: 'Remove link',
1149
+ onclick: Utils.unlink(editor),
1150
+ onpostrender: Actions.toggleActiveState(editor)
1151
+ });
1152
+
1153
+ if (editor.addContextToolbar) {
1154
+ editor.addButton('openlink', {
1155
+ icon: 'newtab',
1156
+ tooltip: 'Open link',
1157
+ onclick: Actions.gotoSelectedLink(editor)
1158
+ });
1159
+ }
1160
+ };
1161
+
1162
+ var setupMenuItems = function (editor) {
1163
+ editor.addMenuItem('openlink', {
1164
+ text: 'Open link',
1165
+ icon: 'newtab',
1166
+ onclick: Actions.gotoSelectedLink(editor),
1167
+ onPostRender: Actions.toggleViewLinkState(editor),
1168
+ prependToContext: true
1169
+ });
1170
+
1171
+ editor.addMenuItem('link', {
1172
+ icon: 'link',
1173
+ text: 'Link',
1174
+ shortcut: 'Meta+K',
1175
+ onclick: Actions.openDialog(editor),
1176
+ stateSelector: 'a[href]',
1177
+ context: 'insert',
1178
+ prependToContext: true
1179
+ });
1180
+ };
1181
+
1182
+ var setupContextToolbars = function (editor) {
1183
+ if (editor.addContextToolbar) {
1184
+ editor.addContextToolbar(
1185
+ Actions.leftClickedOnAHref(editor),
1186
+ 'openlink | link unlink'
1187
+ );
1188
+ }
1189
+ };
1190
+
1191
+ return {
1192
+ setupButtons: setupButtons,
1193
+ setupMenuItems: setupMenuItems,
1194
+ setupContextToolbars: setupContextToolbars
1195
+ };
1196
+ }
1197
+ );
1198
+ /**
1199
+ * Plugin.js
1200
+ *
1201
+ * Released under LGPL License.
1202
+ * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
1203
+ *
1204
+ * License: http://www.tinymce.com/license
1205
+ * Contributing: http://www.tinymce.com/contributing
1206
+ */
1207
+
1208
+ define(
1209
+ 'tinymce.plugins.link.Plugin',
1210
+ [
1211
+ 'tinymce.core.PluginManager',
1212
+ 'tinymce.plugins.link.api.Commands',
1213
+ 'tinymce.plugins.link.core.Actions',
1214
+ 'tinymce.plugins.link.core.Keyboard',
1215
+ 'tinymce.plugins.link.ui.Controls'
1216
+ ],
1217
+ function (PluginManager, Commands, Actions, Keyboard, Controls) {
1218
+ PluginManager.add('link', function (editor) {
1219
+ Controls.setupButtons(editor);
1220
+ Controls.setupMenuItems(editor);
1221
+ Controls.setupContextToolbars(editor);
1222
+ Actions.setupGotoLinks(editor);
1223
+ Commands.register(editor);
1224
+ Keyboard.setup(editor);
1225
+ });
1226
+
1227
+ return function () { };
1228
+ }
1229
+ );
1230
+ dem('tinymce.plugins.link.Plugin')();
1231
+ })();