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("6",tinymce.util.Tools.resolve),g("2",["6"],function(a){return a("tinymce.PluginManager")}),g("9",[],function(){var a=function(a,b){a.fire("VisualBlocks",{state:b})};return{fireVisualBlocks:a}}),g("8",[],function(){var a=function(a){return a.getParam("visualblocks_default_state",!1)},b=function(a){return a.settings.visualblocks_content_css};return{isEnabledByDefault:a,getContentCss:b}}),g("b",["6"],function(a){return a("tinymce.dom.DOMUtils")}),g("c",["6"],function(a){return a("tinymce.util.Tools")}),g("a",["b","c"],function(a,b){var c=a.DOM.uniqueId(),d=function(d,e){var f=b.toArray(d.getElementsByTagName("link")),g=b.grep(f,function(a){return a.id===c});if(0===g.length){var h=a.DOM.create("link",{id:c,rel:"stylesheet",href:e});d.getElementsByTagName("head")[0].appendChild(h)}};return{load:d}}),g("7",["9","8","a"],function(a,b,c){var d=function(d,e,f){var g=d.dom,h=b.getContentCss(d);c.load(d.getDoc(),h?h:e+"/css/visualblocks.css"),g.toggleClass(d.getBody(),"mce-visualblocks"),f.set(!f.get()),a.fireVisualBlocks(d,f.get())};return{toggleVisualBlocks:d}}),g("3",["7"],function(a){var b=function(b,c,d){b.addCommand("mceVisualBlocks",function(){a.toggleVisualBlocks(b,c,d)})};return{register:b}}),g("4",["8","7"],function(a,b){var c=function(c,d,e){c.on("PreviewFormats AfterPreviewFormats",function(a){e.get()&&c.dom.toggleClass(c.getBody(),"mce-visualblocks","afterpreviewformats"===a.type)}),c.on("init",function(){a.isEnabledByDefault(c)&&b.toggleVisualBlocks(c,d,e)}),c.on("remove",function(){c.dom.removeClass(c.getBody(),"mce-visualblocks")})};return{setup:c}}),g("5",["7"],function(a){var b=function(a,b){return function(c){var d=c.control;d.active(b.get()),a.on("VisualBlocks",function(a){d.active(a.state)})}},c=function(a,c){a.addButton("visualblocks",{active:!1,title:"Show blocks",cmd:"mceVisualBlocks",onPostRender:b(a,c)}),a.addMenuItem("visualblocks",{text:"Show blocks",cmd:"mceVisualBlocks",onPostRender:b(a,c),selectable:!0,context:"view",prependToContext:!0})};return{register:c}}),g("0",["1","2","3","4","5"],function(a,b,c,d,e){return b.add("visualblocks",function(b,f){var g=a(!1);c.register(b,f,g),e.register(b,g),d.setup(b,f,g)}),function(){}}),d("0")()}();
@@ -0,0 +1,7 @@
1
+ // Exports the "visualchars" plugin for usage with module loaders
2
+ // Usage:
3
+ // CommonJS:
4
+ // require('tinymce/plugins/visualchars')
5
+ // ES2015:
6
+ // import 'tinymce/plugins/visualchars'
7
+ require('./plugin.js');
@@ -0,0 +1,1325 @@
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.visualchars.Plugin","ephox.katamari.api.Cell","tinymce.core.PluginManager","tinymce.plugins.visualchars.api.Api","tinymce.plugins.visualchars.api.Commands","tinymce.plugins.visualchars.core.Keyboard","tinymce.plugins.visualchars.ui.Buttons","global!tinymce.util.Tools.resolve","tinymce.plugins.visualchars.core.Actions","tinymce.core.util.Delay","tinymce.plugins.visualchars.core.VisualChars","tinymce.plugins.visualchars.api.Events","tinymce.plugins.visualchars.core.Data","tinymce.plugins.visualchars.core.Nodes","ephox.katamari.api.Arr","ephox.sugar.api.node.Element","ephox.sugar.api.node.Node","ephox.katamari.api.Option","global!Array","global!Error","global!String","ephox.katamari.api.Fun","global!console","global!document","ephox.sugar.api.node.NodeTypes","tinymce.plugins.visualchars.core.Html","global!Object"]
85
+ jsc*/
86
+ define(
87
+ 'ephox.katamari.api.Cell',
88
+
89
+ [
90
+ ],
91
+
92
+ function () {
93
+ var Cell = function (initial) {
94
+ var value = initial;
95
+
96
+ var get = function () {
97
+ return value;
98
+ };
99
+
100
+ var set = function (v) {
101
+ value = v;
102
+ };
103
+
104
+ var clone = function () {
105
+ return Cell(get());
106
+ };
107
+
108
+ return {
109
+ get: get,
110
+ set: set,
111
+ clone: clone
112
+ };
113
+ };
114
+
115
+ return Cell;
116
+ }
117
+ );
118
+
119
+ defineGlobal("global!tinymce.util.Tools.resolve", tinymce.util.Tools.resolve);
120
+ /**
121
+ * ResolveGlobal.js
122
+ *
123
+ * Released under LGPL License.
124
+ * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
125
+ *
126
+ * License: http://www.tinymce.com/license
127
+ * Contributing: http://www.tinymce.com/contributing
128
+ */
129
+
130
+ define(
131
+ 'tinymce.core.PluginManager',
132
+ [
133
+ 'global!tinymce.util.Tools.resolve'
134
+ ],
135
+ function (resolve) {
136
+ return resolve('tinymce.PluginManager');
137
+ }
138
+ );
139
+
140
+ /**
141
+ * Api.js
142
+ *
143
+ * Released under LGPL License.
144
+ * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
145
+ *
146
+ * License: http://www.tinymce.com/license
147
+ * Contributing: http://www.tinymce.com/contributing
148
+ */
149
+
150
+ define(
151
+ 'tinymce.plugins.visualchars.api.Api',
152
+ [
153
+ ],
154
+ function () {
155
+ var get = function (toggleState) {
156
+ var isEnabled = function () {
157
+ return toggleState.get();
158
+ };
159
+
160
+ return {
161
+ isEnabled: isEnabled
162
+ };
163
+ };
164
+
165
+ return {
166
+ get: get
167
+ };
168
+ }
169
+ );
170
+ /**
171
+ * Events.js
172
+ *
173
+ * Released under LGPL License.
174
+ * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
175
+ *
176
+ * License: http://www.tinymce.com/license
177
+ * Contributing: http://www.tinymce.com/contributing
178
+ */
179
+
180
+ define(
181
+ 'tinymce.plugins.visualchars.api.Events',
182
+ [
183
+ ],
184
+ function () {
185
+ var fireVisualChars = function (editor, state) {
186
+ return editor.fire('VisualChars', { state: state });
187
+ };
188
+
189
+ return {
190
+ fireVisualChars: fireVisualChars
191
+ };
192
+ }
193
+ );
194
+ /**
195
+ * Data.js
196
+ *
197
+ * Released under LGPL License.
198
+ * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
199
+ *
200
+ * License: http://www.tinymce.com/license
201
+ * Contributing: http://www.tinymce.com/contributing
202
+ */
203
+
204
+ define(
205
+ 'tinymce.plugins.visualchars.core.Data',
206
+ [
207
+ ],
208
+ function () {
209
+ var charMap = {
210
+ '\u00a0': 'nbsp',
211
+ '\u00ad': 'shy'
212
+ };
213
+
214
+ var charMapToRegExp = function (charMap, global) {
215
+ var key, regExp = '';
216
+
217
+ for (key in charMap) {
218
+ regExp += key;
219
+ }
220
+
221
+ return new RegExp('[' + regExp + ']', global ? 'g' : '');
222
+ };
223
+
224
+ var charMapToSelector = function (charMap) {
225
+ var key, selector = '';
226
+
227
+ for (key in charMap) {
228
+ if (selector) {
229
+ selector += ',';
230
+ }
231
+ selector += 'span.mce-' + charMap[key];
232
+ }
233
+
234
+ return selector;
235
+ };
236
+
237
+ return {
238
+ charMap: charMap,
239
+ regExp: charMapToRegExp(charMap),
240
+ regExpGlobal: charMapToRegExp(charMap, true),
241
+ selector: charMapToSelector(charMap),
242
+ charMapToRegExp: charMapToRegExp,
243
+ charMapToSelector: charMapToSelector
244
+ };
245
+ }
246
+ );
247
+ defineGlobal("global!Array", Array);
248
+ defineGlobal("global!Error", Error);
249
+ define(
250
+ 'ephox.katamari.api.Fun',
251
+
252
+ [
253
+ 'global!Array',
254
+ 'global!Error'
255
+ ],
256
+
257
+ function (Array, Error) {
258
+
259
+ var noop = function () { };
260
+
261
+ var noarg = function (f) {
262
+ return function () {
263
+ return f();
264
+ };
265
+ };
266
+
267
+ var compose = function (fa, fb) {
268
+ return function () {
269
+ return fa(fb.apply(null, arguments));
270
+ };
271
+ };
272
+
273
+ var constant = function (value) {
274
+ return function () {
275
+ return value;
276
+ };
277
+ };
278
+
279
+ var identity = function (x) {
280
+ return x;
281
+ };
282
+
283
+ var tripleEquals = function(a, b) {
284
+ return a === b;
285
+ };
286
+
287
+ // Don't use array slice(arguments), makes the whole function unoptimisable on Chrome
288
+ var curry = function (f) {
289
+ // equivalent to arguments.slice(1)
290
+ // starting at 1 because 0 is the f, makes things tricky.
291
+ // Pay attention to what variable is where, and the -1 magic.
292
+ // thankfully, we have tests for this.
293
+ var args = new Array(arguments.length - 1);
294
+ for (var i = 1; i < arguments.length; i++) args[i-1] = arguments[i];
295
+
296
+ return function () {
297
+ var newArgs = new Array(arguments.length);
298
+ for (var j = 0; j < newArgs.length; j++) newArgs[j] = arguments[j];
299
+
300
+ var all = args.concat(newArgs);
301
+ return f.apply(null, all);
302
+ };
303
+ };
304
+
305
+ var not = function (f) {
306
+ return function () {
307
+ return !f.apply(null, arguments);
308
+ };
309
+ };
310
+
311
+ var die = function (msg) {
312
+ return function () {
313
+ throw new Error(msg);
314
+ };
315
+ };
316
+
317
+ var apply = function (f) {
318
+ return f();
319
+ };
320
+
321
+ var call = function(f) {
322
+ f();
323
+ };
324
+
325
+ var never = constant(false);
326
+ var always = constant(true);
327
+
328
+
329
+ return {
330
+ noop: noop,
331
+ noarg: noarg,
332
+ compose: compose,
333
+ constant: constant,
334
+ identity: identity,
335
+ tripleEquals: tripleEquals,
336
+ curry: curry,
337
+ not: not,
338
+ die: die,
339
+ apply: apply,
340
+ call: call,
341
+ never: never,
342
+ always: always
343
+ };
344
+ }
345
+ );
346
+
347
+ defineGlobal("global!Object", Object);
348
+ define(
349
+ 'ephox.katamari.api.Option',
350
+
351
+ [
352
+ 'ephox.katamari.api.Fun',
353
+ 'global!Object'
354
+ ],
355
+
356
+ function (Fun, Object) {
357
+
358
+ var never = Fun.never;
359
+ var always = Fun.always;
360
+
361
+ /**
362
+ Option objects support the following methods:
363
+
364
+ fold :: this Option a -> ((() -> b, a -> b)) -> Option b
365
+
366
+ is :: this Option a -> a -> Boolean
367
+
368
+ isSome :: this Option a -> () -> Boolean
369
+
370
+ isNone :: this Option a -> () -> Boolean
371
+
372
+ getOr :: this Option a -> a -> a
373
+
374
+ getOrThunk :: this Option a -> (() -> a) -> a
375
+
376
+ getOrDie :: this Option a -> String -> a
377
+
378
+ or :: this Option a -> Option a -> Option a
379
+ - if some: return self
380
+ - if none: return opt
381
+
382
+ orThunk :: this Option a -> (() -> Option a) -> Option a
383
+ - Same as "or", but uses a thunk instead of a value
384
+
385
+ map :: this Option a -> (a -> b) -> Option b
386
+ - "fmap" operation on the Option Functor.
387
+ - same as 'each'
388
+
389
+ ap :: this Option a -> Option (a -> b) -> Option b
390
+ - "apply" operation on the Option Apply/Applicative.
391
+ - Equivalent to <*> in Haskell/PureScript.
392
+
393
+ each :: this Option a -> (a -> b) -> undefined
394
+ - similar to 'map', but doesn't return a value.
395
+ - intended for clarity when performing side effects.
396
+
397
+ bind :: this Option a -> (a -> Option b) -> Option b
398
+ - "bind"/"flatMap" operation on the Option Bind/Monad.
399
+ - Equivalent to >>= in Haskell/PureScript; flatMap in Scala.
400
+
401
+ flatten :: {this Option (Option a))} -> () -> Option a
402
+ - "flatten"/"join" operation on the Option Monad.
403
+
404
+ exists :: this Option a -> (a -> Boolean) -> Boolean
405
+
406
+ forall :: this Option a -> (a -> Boolean) -> Boolean
407
+
408
+ filter :: this Option a -> (a -> Boolean) -> Option a
409
+
410
+ equals :: this Option a -> Option a -> Boolean
411
+
412
+ equals_ :: this Option a -> (Option a, a -> Boolean) -> Boolean
413
+
414
+ toArray :: this Option a -> () -> [a]
415
+
416
+ */
417
+
418
+ var none = function () { return NONE; };
419
+
420
+ var NONE = (function () {
421
+ var eq = function (o) {
422
+ return o.isNone();
423
+ };
424
+
425
+ // inlined from peanut, maybe a micro-optimisation?
426
+ var call = function (thunk) { return thunk(); };
427
+ var id = function (n) { return n; };
428
+ var noop = function () { };
429
+
430
+ var me = {
431
+ fold: function (n, s) { return n(); },
432
+ is: never,
433
+ isSome: never,
434
+ isNone: always,
435
+ getOr: id,
436
+ getOrThunk: call,
437
+ getOrDie: function (msg) {
438
+ throw new Error(msg || 'error: getOrDie called on none.');
439
+ },
440
+ or: id,
441
+ orThunk: call,
442
+ map: none,
443
+ ap: none,
444
+ each: noop,
445
+ bind: none,
446
+ flatten: none,
447
+ exists: never,
448
+ forall: always,
449
+ filter: none,
450
+ equals: eq,
451
+ equals_: eq,
452
+ toArray: function () { return []; },
453
+ toString: Fun.constant("none()")
454
+ };
455
+ if (Object.freeze) Object.freeze(me);
456
+ return me;
457
+ })();
458
+
459
+
460
+ /** some :: a -> Option a */
461
+ var some = function (a) {
462
+
463
+ // inlined from peanut, maybe a micro-optimisation?
464
+ var constant_a = function () { return a; };
465
+
466
+ var self = function () {
467
+ // can't Fun.constant this one
468
+ return me;
469
+ };
470
+
471
+ var map = function (f) {
472
+ return some(f(a));
473
+ };
474
+
475
+ var bind = function (f) {
476
+ return f(a);
477
+ };
478
+
479
+ var me = {
480
+ fold: function (n, s) { return s(a); },
481
+ is: function (v) { return a === v; },
482
+ isSome: always,
483
+ isNone: never,
484
+ getOr: constant_a,
485
+ getOrThunk: constant_a,
486
+ getOrDie: constant_a,
487
+ or: self,
488
+ orThunk: self,
489
+ map: map,
490
+ ap: function (optfab) {
491
+ return optfab.fold(none, function(fab) {
492
+ return some(fab(a));
493
+ });
494
+ },
495
+ each: function (f) {
496
+ f(a);
497
+ },
498
+ bind: bind,
499
+ flatten: constant_a,
500
+ exists: bind,
501
+ forall: bind,
502
+ filter: function (f) {
503
+ return f(a) ? me : NONE;
504
+ },
505
+ equals: function (o) {
506
+ return o.is(a);
507
+ },
508
+ equals_: function (o, elementEq) {
509
+ return o.fold(
510
+ never,
511
+ function (b) { return elementEq(a, b); }
512
+ );
513
+ },
514
+ toArray: function () {
515
+ return [a];
516
+ },
517
+ toString: function () {
518
+ return 'some(' + a + ')';
519
+ }
520
+ };
521
+ return me;
522
+ };
523
+
524
+ /** from :: undefined|null|a -> Option a */
525
+ var from = function (value) {
526
+ return value === null || value === undefined ? NONE : some(value);
527
+ };
528
+
529
+ return {
530
+ some: some,
531
+ none: none,
532
+ from: from
533
+ };
534
+ }
535
+ );
536
+
537
+ defineGlobal("global!String", String);
538
+ define(
539
+ 'ephox.katamari.api.Arr',
540
+
541
+ [
542
+ 'ephox.katamari.api.Option',
543
+ 'global!Array',
544
+ 'global!Error',
545
+ 'global!String'
546
+ ],
547
+
548
+ function (Option, Array, Error, String) {
549
+ // Use the native Array.indexOf if it is available (IE9+) otherwise fall back to manual iteration
550
+ // https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf
551
+ var rawIndexOf = (function () {
552
+ var pIndexOf = Array.prototype.indexOf;
553
+
554
+ var fastIndex = function (xs, x) { return pIndexOf.call(xs, x); };
555
+
556
+ var slowIndex = function(xs, x) { return slowIndexOf(xs, x); };
557
+
558
+ return pIndexOf === undefined ? slowIndex : fastIndex;
559
+ })();
560
+
561
+ var indexOf = function (xs, x) {
562
+ // The rawIndexOf method does not wrap up in an option. This is for performance reasons.
563
+ var r = rawIndexOf(xs, x);
564
+ return r === -1 ? Option.none() : Option.some(r);
565
+ };
566
+
567
+ var contains = function (xs, x) {
568
+ return rawIndexOf(xs, x) > -1;
569
+ };
570
+
571
+ // Using findIndex is likely less optimal in Chrome (dynamic return type instead of bool)
572
+ // but if we need that micro-optimisation we can inline it later.
573
+ var exists = function (xs, pred) {
574
+ return findIndex(xs, pred).isSome();
575
+ };
576
+
577
+ var range = function (num, f) {
578
+ var r = [];
579
+ for (var i = 0; i < num; i++) {
580
+ r.push(f(i));
581
+ }
582
+ return r;
583
+ };
584
+
585
+ // It's a total micro optimisation, but these do make some difference.
586
+ // Particularly for browsers other than Chrome.
587
+ // - length caching
588
+ // http://jsperf.com/browser-diet-jquery-each-vs-for-loop/69
589
+ // - not using push
590
+ // http://jsperf.com/array-direct-assignment-vs-push/2
591
+
592
+ var chunk = function (array, size) {
593
+ var r = [];
594
+ for (var i = 0; i < array.length; i += size) {
595
+ var s = array.slice(i, i + size);
596
+ r.push(s);
597
+ }
598
+ return r;
599
+ };
600
+
601
+ var map = function(xs, f) {
602
+ // pre-allocating array size when it's guaranteed to be known
603
+ // http://jsperf.com/push-allocated-vs-dynamic/22
604
+ var len = xs.length;
605
+ var r = new Array(len);
606
+ for (var i = 0; i < len; i++) {
607
+ var x = xs[i];
608
+ r[i] = f(x, i, xs);
609
+ }
610
+ return r;
611
+ };
612
+
613
+ // Unwound implementing other functions in terms of each.
614
+ // The code size is roughly the same, and it should allow for better optimisation.
615
+ var each = function(xs, f) {
616
+ for (var i = 0, len = xs.length; i < len; i++) {
617
+ var x = xs[i];
618
+ f(x, i, xs);
619
+ }
620
+ };
621
+
622
+ var eachr = function (xs, f) {
623
+ for (var i = xs.length - 1; i >= 0; i--) {
624
+ var x = xs[i];
625
+ f(x, i, xs);
626
+ }
627
+ };
628
+
629
+ var partition = function(xs, pred) {
630
+ var pass = [];
631
+ var fail = [];
632
+ for (var i = 0, len = xs.length; i < len; i++) {
633
+ var x = xs[i];
634
+ var arr = pred(x, i, xs) ? pass : fail;
635
+ arr.push(x);
636
+ }
637
+ return { pass: pass, fail: fail };
638
+ };
639
+
640
+ var filter = function(xs, pred) {
641
+ var r = [];
642
+ for (var i = 0, len = xs.length; i < len; i++) {
643
+ var x = xs[i];
644
+ if (pred(x, i, xs)) {
645
+ r.push(x);
646
+ }
647
+ }
648
+ return r;
649
+ };
650
+
651
+ /*
652
+ * Groups an array into contiguous arrays of like elements. Whether an element is like or not depends on f.
653
+ *
654
+ * f is a function that derives a value from an element - e.g. true or false, or a string.
655
+ * Elements are like if this function generates the same value for them (according to ===).
656
+ *
657
+ *
658
+ * Order of the elements is preserved. Arr.flatten() on the result will return the original list, as with Haskell groupBy function.
659
+ * For a good explanation, see the group function (which is a special case of groupBy)
660
+ * http://hackage.haskell.org/package/base-4.7.0.0/docs/Data-List.html#v:group
661
+ */
662
+ var groupBy = function (xs, f) {
663
+ if (xs.length === 0) {
664
+ return [];
665
+ } else {
666
+ var wasType = f(xs[0]); // initial case for matching
667
+ var r = [];
668
+ var group = [];
669
+
670
+ for (var i = 0, len = xs.length; i < len; i++) {
671
+ var x = xs[i];
672
+ var type = f(x);
673
+ if (type !== wasType) {
674
+ r.push(group);
675
+ group = [];
676
+ }
677
+ wasType = type;
678
+ group.push(x);
679
+ }
680
+ if (group.length !== 0) {
681
+ r.push(group);
682
+ }
683
+ return r;
684
+ }
685
+ };
686
+
687
+ var foldr = function (xs, f, acc) {
688
+ eachr(xs, function (x) {
689
+ acc = f(acc, x);
690
+ });
691
+ return acc;
692
+ };
693
+
694
+ var foldl = function (xs, f, acc) {
695
+ each(xs, function (x) {
696
+ acc = f(acc, x);
697
+ });
698
+ return acc;
699
+ };
700
+
701
+ var find = function (xs, pred) {
702
+ for (var i = 0, len = xs.length; i < len; i++) {
703
+ var x = xs[i];
704
+ if (pred(x, i, xs)) {
705
+ return Option.some(x);
706
+ }
707
+ }
708
+ return Option.none();
709
+ };
710
+
711
+ var findIndex = function (xs, pred) {
712
+ for (var i = 0, len = xs.length; i < len; i++) {
713
+ var x = xs[i];
714
+ if (pred(x, i, xs)) {
715
+ return Option.some(i);
716
+ }
717
+ }
718
+
719
+ return Option.none();
720
+ };
721
+
722
+ var slowIndexOf = function (xs, x) {
723
+ for (var i = 0, len = xs.length; i < len; ++i) {
724
+ if (xs[i] === x) {
725
+ return i;
726
+ }
727
+ }
728
+
729
+ return -1;
730
+ };
731
+
732
+ var push = Array.prototype.push;
733
+ var flatten = function (xs) {
734
+ // Note, this is possible because push supports multiple arguments:
735
+ // http://jsperf.com/concat-push/6
736
+ // Note that in the past, concat() would silently work (very slowly) for array-like objects.
737
+ // With this change it will throw an error.
738
+ var r = [];
739
+ for (var i = 0, len = xs.length; i < len; ++i) {
740
+ // Ensure that each value is an array itself
741
+ if (! Array.prototype.isPrototypeOf(xs[i])) throw new Error('Arr.flatten item ' + i + ' was not an array, input: ' + xs);
742
+ push.apply(r, xs[i]);
743
+ }
744
+ return r;
745
+ };
746
+
747
+ var bind = function (xs, f) {
748
+ var output = map(xs, f);
749
+ return flatten(output);
750
+ };
751
+
752
+ var forall = function (xs, pred) {
753
+ for (var i = 0, len = xs.length; i < len; ++i) {
754
+ var x = xs[i];
755
+ if (pred(x, i, xs) !== true) {
756
+ return false;
757
+ }
758
+ }
759
+ return true;
760
+ };
761
+
762
+ var equal = function (a1, a2) {
763
+ return a1.length === a2.length && forall(a1, function (x, i) {
764
+ return x === a2[i];
765
+ });
766
+ };
767
+
768
+ var slice = Array.prototype.slice;
769
+ var reverse = function (xs) {
770
+ var r = slice.call(xs, 0);
771
+ r.reverse();
772
+ return r;
773
+ };
774
+
775
+ var difference = function (a1, a2) {
776
+ return filter(a1, function (x) {
777
+ return !contains(a2, x);
778
+ });
779
+ };
780
+
781
+ var mapToObject = function(xs, f) {
782
+ var r = {};
783
+ for (var i = 0, len = xs.length; i < len; i++) {
784
+ var x = xs[i];
785
+ r[String(x)] = f(x, i);
786
+ }
787
+ return r;
788
+ };
789
+
790
+ var pure = function(x) {
791
+ return [x];
792
+ };
793
+
794
+ var sort = function (xs, comparator) {
795
+ var copy = slice.call(xs, 0);
796
+ copy.sort(comparator);
797
+ return copy;
798
+ };
799
+
800
+ var head = function (xs) {
801
+ return xs.length === 0 ? Option.none() : Option.some(xs[0]);
802
+ };
803
+
804
+ var last = function (xs) {
805
+ return xs.length === 0 ? Option.none() : Option.some(xs[xs.length - 1]);
806
+ };
807
+
808
+ return {
809
+ map: map,
810
+ each: each,
811
+ eachr: eachr,
812
+ partition: partition,
813
+ filter: filter,
814
+ groupBy: groupBy,
815
+ indexOf: indexOf,
816
+ foldr: foldr,
817
+ foldl: foldl,
818
+ find: find,
819
+ findIndex: findIndex,
820
+ flatten: flatten,
821
+ bind: bind,
822
+ forall: forall,
823
+ exists: exists,
824
+ contains: contains,
825
+ equal: equal,
826
+ reverse: reverse,
827
+ chunk: chunk,
828
+ difference: difference,
829
+ mapToObject: mapToObject,
830
+ pure: pure,
831
+ sort: sort,
832
+ range: range,
833
+ head: head,
834
+ last: last
835
+ };
836
+ }
837
+ );
838
+ define("global!console", [], function () { if (typeof console === "undefined") console = { log: function () {} }; return console; });
839
+ defineGlobal("global!document", document);
840
+ define(
841
+ 'ephox.sugar.api.node.Element',
842
+
843
+ [
844
+ 'ephox.katamari.api.Fun',
845
+ 'ephox.katamari.api.Option',
846
+ 'global!Error',
847
+ 'global!console',
848
+ 'global!document'
849
+ ],
850
+
851
+ function (Fun, Option, Error, console, document) {
852
+ var fromHtml = function (html, scope) {
853
+ var doc = scope || document;
854
+ var div = doc.createElement('div');
855
+ div.innerHTML = html;
856
+ if (!div.hasChildNodes() || div.childNodes.length > 1) {
857
+ console.error('HTML does not have a single root node', html);
858
+ throw 'HTML must have a single root node';
859
+ }
860
+ return fromDom(div.childNodes[0]);
861
+ };
862
+
863
+ var fromTag = function (tag, scope) {
864
+ var doc = scope || document;
865
+ var node = doc.createElement(tag);
866
+ return fromDom(node);
867
+ };
868
+
869
+ var fromText = function (text, scope) {
870
+ var doc = scope || document;
871
+ var node = doc.createTextNode(text);
872
+ return fromDom(node);
873
+ };
874
+
875
+ var fromDom = function (node) {
876
+ if (node === null || node === undefined) throw new Error('Node cannot be null or undefined');
877
+ return {
878
+ dom: Fun.constant(node)
879
+ };
880
+ };
881
+
882
+ var fromPoint = function (doc, x, y) {
883
+ return Option.from(doc.dom().elementFromPoint(x, y)).map(fromDom);
884
+ };
885
+
886
+ return {
887
+ fromHtml: fromHtml,
888
+ fromTag: fromTag,
889
+ fromText: fromText,
890
+ fromDom: fromDom,
891
+ fromPoint: fromPoint
892
+ };
893
+ }
894
+ );
895
+
896
+ define(
897
+ 'ephox.sugar.api.node.NodeTypes',
898
+
899
+ [
900
+
901
+ ],
902
+
903
+ function () {
904
+ return {
905
+ ATTRIBUTE: 2,
906
+ CDATA_SECTION: 4,
907
+ COMMENT: 8,
908
+ DOCUMENT: 9,
909
+ DOCUMENT_TYPE: 10,
910
+ DOCUMENT_FRAGMENT: 11,
911
+ ELEMENT: 1,
912
+ TEXT: 3,
913
+ PROCESSING_INSTRUCTION: 7,
914
+ ENTITY_REFERENCE: 5,
915
+ ENTITY: 6,
916
+ NOTATION: 12
917
+ };
918
+ }
919
+ );
920
+ define(
921
+ 'ephox.sugar.api.node.Node',
922
+
923
+ [
924
+ 'ephox.sugar.api.node.NodeTypes'
925
+ ],
926
+
927
+ function (NodeTypes) {
928
+ var name = function (element) {
929
+ var r = element.dom().nodeName;
930
+ return r.toLowerCase();
931
+ };
932
+
933
+ var type = function (element) {
934
+ return element.dom().nodeType;
935
+ };
936
+
937
+ var value = function (element) {
938
+ return element.dom().nodeValue;
939
+ };
940
+
941
+ var isType = function (t) {
942
+ return function (element) {
943
+ return type(element) === t;
944
+ };
945
+ };
946
+
947
+ var isComment = function (element) {
948
+ return type(element) === NodeTypes.COMMENT || name(element) === '#comment';
949
+ };
950
+
951
+ var isElement = isType(NodeTypes.ELEMENT);
952
+ var isText = isType(NodeTypes.TEXT);
953
+ var isDocument = isType(NodeTypes.DOCUMENT);
954
+
955
+ return {
956
+ name: name,
957
+ type: type,
958
+ value: value,
959
+ isElement: isElement,
960
+ isText: isText,
961
+ isDocument: isDocument,
962
+ isComment: isComment
963
+ };
964
+ }
965
+ );
966
+
967
+ /**
968
+ * Html.js
969
+ *
970
+ * Released under LGPL License.
971
+ * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
972
+ *
973
+ * License: http://www.tinymce.com/license
974
+ * Contributing: http://www.tinymce.com/contributing
975
+ */
976
+
977
+ define(
978
+ 'tinymce.plugins.visualchars.core.Html',
979
+ [
980
+ 'tinymce.plugins.visualchars.core.Data'
981
+ ],
982
+ function (Data) {
983
+ var wrapCharWithSpan = function (value) {
984
+ return '<span data-mce-bogus="1" class="mce-' + Data.charMap[value] + '">' + value + '</span>';
985
+ };
986
+
987
+ return {
988
+ wrapCharWithSpan: wrapCharWithSpan
989
+ };
990
+ }
991
+ );
992
+
993
+ /**
994
+ * Nodes.js
995
+ *
996
+ * Released under LGPL License.
997
+ * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
998
+ *
999
+ * License: http://www.tinymce.com/license
1000
+ * Contributing: http://www.tinymce.com/contributing
1001
+ */
1002
+
1003
+ define(
1004
+ 'tinymce.plugins.visualchars.core.Nodes',
1005
+ [
1006
+ 'ephox.katamari.api.Arr',
1007
+ 'ephox.sugar.api.node.Element',
1008
+ 'ephox.sugar.api.node.Node',
1009
+ 'tinymce.plugins.visualchars.core.Data',
1010
+ 'tinymce.plugins.visualchars.core.Html'
1011
+ ],
1012
+ function (Arr, Element, Node, Data, Html) {
1013
+ var isMatch = function (n) {
1014
+ return Node.isText(n) &&
1015
+ Node.value(n) !== undefined &&
1016
+ Data.regExp.test(Node.value(n));
1017
+ };
1018
+
1019
+ // inlined sugars PredicateFilter.descendants for file size
1020
+ var filterDescendants = function (scope, predicate) {
1021
+ var result = [];
1022
+ var dom = scope.dom();
1023
+ var children = Arr.map(dom.childNodes, Element.fromDom);
1024
+
1025
+ Arr.each(children, function (x) {
1026
+ if (predicate(x)) {
1027
+ result = result.concat([ x ]);
1028
+ }
1029
+ result = result.concat(filterDescendants(x, predicate));
1030
+ });
1031
+ return result;
1032
+ };
1033
+
1034
+ var findParentElm = function (elm, rootElm) {
1035
+ while (elm.parentNode) {
1036
+ if (elm.parentNode === rootElm) {
1037
+ return elm;
1038
+ }
1039
+ elm = elm.parentNode;
1040
+ }
1041
+ };
1042
+
1043
+ var replaceWithSpans = function (html) {
1044
+ return html.replace(Data.regExpGlobal, Html.wrapCharWithSpan);
1045
+ };
1046
+
1047
+ return {
1048
+ isMatch: isMatch,
1049
+ filterDescendants: filterDescendants,
1050
+ findParentElm: findParentElm,
1051
+ replaceWithSpans: replaceWithSpans
1052
+ };
1053
+ }
1054
+ );
1055
+ /**
1056
+ * VisualChars.js
1057
+ *
1058
+ * Released under LGPL License.
1059
+ * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
1060
+ *
1061
+ * License: http://www.tinymce.com/license
1062
+ * Contributing: http://www.tinymce.com/contributing
1063
+ */
1064
+
1065
+ define(
1066
+ 'tinymce.plugins.visualchars.core.VisualChars',
1067
+ [
1068
+ 'tinymce.plugins.visualchars.core.Data',
1069
+ 'tinymce.plugins.visualchars.core.Nodes',
1070
+ 'ephox.katamari.api.Arr',
1071
+ 'ephox.sugar.api.node.Element',
1072
+ 'ephox.sugar.api.node.Node'
1073
+ ],
1074
+ function (Data, Nodes, Arr, Element, Node) {
1075
+ var show = function (editor, rootElm) {
1076
+ var node, div;
1077
+ var nodeList = Nodes.filterDescendants(Element.fromDom(rootElm), Nodes.isMatch);
1078
+
1079
+ Arr.each(nodeList, function (n) {
1080
+ var withSpans = Nodes.replaceWithSpans(Node.value(n));
1081
+
1082
+ div = editor.dom.create('div', null, withSpans);
1083
+ while ((node = div.lastChild)) {
1084
+ editor.dom.insertAfter(node, n.dom());
1085
+ }
1086
+
1087
+ editor.dom.remove(n.dom());
1088
+ });
1089
+ };
1090
+
1091
+ var hide = function (editor, body) {
1092
+ var nodeList = editor.dom.select(Data.selector, body);
1093
+
1094
+ Arr.each(nodeList, function (node) {
1095
+ editor.dom.remove(node, 1);
1096
+ });
1097
+ };
1098
+
1099
+ var toggle = function (editor) {
1100
+ var body = editor.getBody();
1101
+ var bookmark = editor.selection.getBookmark();
1102
+ var parentNode = Nodes.findParentElm(editor.selection.getNode(), body);
1103
+
1104
+ // if user does select all the parentNode will be undefined
1105
+ parentNode = parentNode !== undefined ? parentNode : body;
1106
+
1107
+ hide(editor, parentNode);
1108
+ show(editor, parentNode);
1109
+
1110
+ editor.selection.moveToBookmark(bookmark);
1111
+ };
1112
+
1113
+ return {
1114
+ show: show,
1115
+ hide: hide,
1116
+ toggle: toggle
1117
+ };
1118
+ }
1119
+ );
1120
+ /**
1121
+ * Actions.js
1122
+ *
1123
+ * Released under LGPL License.
1124
+ * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
1125
+ *
1126
+ * License: http://www.tinymce.com/license
1127
+ * Contributing: http://www.tinymce.com/contributing
1128
+ */
1129
+
1130
+ define(
1131
+ 'tinymce.plugins.visualchars.core.Actions',
1132
+ [
1133
+ 'tinymce.plugins.visualchars.api.Events',
1134
+ 'tinymce.plugins.visualchars.core.VisualChars'
1135
+ ],
1136
+ function (Events, VisualChars) {
1137
+ var toggleVisualChars = function (editor, toggleState) {
1138
+ var body = editor.getBody(), selection = editor.selection, bookmark;
1139
+
1140
+ toggleState.set(!toggleState.get());
1141
+ Events.fireVisualChars(editor, toggleState.get());
1142
+
1143
+ bookmark = selection.getBookmark();
1144
+
1145
+ if (toggleState.get() === true) {
1146
+ VisualChars.show(editor, body);
1147
+ } else {
1148
+ VisualChars.hide(editor, body);
1149
+ }
1150
+
1151
+ selection.moveToBookmark(bookmark);
1152
+ };
1153
+
1154
+ return {
1155
+ toggleVisualChars: toggleVisualChars
1156
+ };
1157
+ }
1158
+ );
1159
+ /**
1160
+ * Commands.js
1161
+ *
1162
+ * Released under LGPL License.
1163
+ * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
1164
+ *
1165
+ * License: http://www.tinymce.com/license
1166
+ * Contributing: http://www.tinymce.com/contributing
1167
+ */
1168
+
1169
+ define(
1170
+ 'tinymce.plugins.visualchars.api.Commands',
1171
+ [
1172
+ 'tinymce.plugins.visualchars.core.Actions'
1173
+ ],
1174
+ function (Actions) {
1175
+ var register = function (editor, toggleState) {
1176
+ editor.addCommand('mceVisualChars', function () {
1177
+ Actions.toggleVisualChars(editor, toggleState);
1178
+ });
1179
+ };
1180
+
1181
+ return {
1182
+ register: register
1183
+ };
1184
+ }
1185
+ );
1186
+ /**
1187
+ * ResolveGlobal.js
1188
+ *
1189
+ * Released under LGPL License.
1190
+ * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
1191
+ *
1192
+ * License: http://www.tinymce.com/license
1193
+ * Contributing: http://www.tinymce.com/contributing
1194
+ */
1195
+
1196
+ define(
1197
+ 'tinymce.core.util.Delay',
1198
+ [
1199
+ 'global!tinymce.util.Tools.resolve'
1200
+ ],
1201
+ function (resolve) {
1202
+ return resolve('tinymce.util.Delay');
1203
+ }
1204
+ );
1205
+
1206
+ /**
1207
+ * Keyboard.js
1208
+ *
1209
+ * Released under LGPL License.
1210
+ * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
1211
+ *
1212
+ * License: http://www.tinymce.com/license
1213
+ * Contributing: http://www.tinymce.com/contributing
1214
+ */
1215
+
1216
+ define(
1217
+ 'tinymce.plugins.visualchars.core.Keyboard',
1218
+ [
1219
+ 'tinymce.core.util.Delay',
1220
+ 'tinymce.plugins.visualchars.core.VisualChars'
1221
+ ],
1222
+ function (Delay, VisualChars) {
1223
+ var setup = function (editor, toggleState) {
1224
+ var debouncedToggle = Delay.debounce(function () {
1225
+ VisualChars.toggle(editor);
1226
+ }, 300);
1227
+
1228
+ if (editor.settings.forced_root_block !== false) {
1229
+ editor.on('keydown', function (e) {
1230
+ if (toggleState.get() === true) {
1231
+ e.keyCode === 13 ? VisualChars.toggle(editor) : debouncedToggle();
1232
+ }
1233
+ });
1234
+ }
1235
+ };
1236
+
1237
+ return {
1238
+ setup: setup
1239
+ };
1240
+ }
1241
+ );
1242
+ /**
1243
+ * Buttons.js
1244
+ *
1245
+ * Released under LGPL License.
1246
+ * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
1247
+ *
1248
+ * License: http://www.tinymce.com/license
1249
+ * Contributing: http://www.tinymce.com/contributing
1250
+ */
1251
+
1252
+ define(
1253
+ 'tinymce.plugins.visualchars.ui.Buttons',
1254
+ [
1255
+ ],
1256
+ function () {
1257
+ var toggleActiveState = function (editor) {
1258
+ return function (e) {
1259
+ var ctrl = e.control;
1260
+
1261
+ editor.on('VisualChars', function (e) {
1262
+ ctrl.active(e.state);
1263
+ });
1264
+ };
1265
+ };
1266
+
1267
+ var register = function (editor) {
1268
+ editor.addButton('visualchars', {
1269
+ active: false,
1270
+ title: 'Show invisible characters',
1271
+ cmd: 'mceVisualChars',
1272
+ onPostRender: toggleActiveState(editor)
1273
+ });
1274
+
1275
+ editor.addMenuItem('visualchars', {
1276
+ text: 'Show invisible characters',
1277
+ cmd: 'mceVisualChars',
1278
+ onPostRender: toggleActiveState(editor),
1279
+ selectable: true,
1280
+ context: 'view',
1281
+ prependToContext: true
1282
+ });
1283
+ };
1284
+
1285
+ return {
1286
+ register: register
1287
+ };
1288
+ }
1289
+ );
1290
+ /**
1291
+ * Plugin.js
1292
+ *
1293
+ * Released under LGPL License.
1294
+ * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
1295
+ *
1296
+ * License: http://www.tinymce.com/license
1297
+ * Contributing: http://www.tinymce.com/contributing
1298
+ */
1299
+
1300
+ define(
1301
+ 'tinymce.plugins.visualchars.Plugin',
1302
+ [
1303
+ 'ephox.katamari.api.Cell',
1304
+ 'tinymce.core.PluginManager',
1305
+ 'tinymce.plugins.visualchars.api.Api',
1306
+ 'tinymce.plugins.visualchars.api.Commands',
1307
+ 'tinymce.plugins.visualchars.core.Keyboard',
1308
+ 'tinymce.plugins.visualchars.ui.Buttons'
1309
+ ],
1310
+ function (Cell, PluginManager, Api, Commands, Keyboard, Buttons) {
1311
+ PluginManager.add('visualchars', function (editor) {
1312
+ var toggleState = Cell(false);
1313
+
1314
+ Commands.register(editor, toggleState);
1315
+ Buttons.register(editor);
1316
+ Keyboard.setup(editor, toggleState);
1317
+
1318
+ return Api.get(toggleState);
1319
+ });
1320
+
1321
+ return function () {};
1322
+ }
1323
+ );
1324
+ dem('tinymce.plugins.visualchars.Plugin')();
1325
+ })();