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,7 @@
1
+ // Exports the "codesample" plugin for usage with module loaders
2
+ // Usage:
3
+ // CommonJS:
4
+ // require('tinymce/plugins/codesample')
5
+ // ES2015:
6
+ // import 'tinymce/plugins/codesample'
7
+ require('./plugin.js');
@@ -0,0 +1,1582 @@
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.codesample.Plugin","ephox.katamari.api.Cell","tinymce.core.PluginManager","tinymce.plugins.codesample.api.Commands","tinymce.plugins.codesample.core.FilterContent","tinymce.plugins.codesample.core.LoadCss","tinymce.plugins.codesample.ui.Buttons","tinymce.plugins.codesample.ui.Dialog","tinymce.plugins.codesample.util.Utils","global!tinymce.util.Tools.resolve","tinymce.plugins.codesample.api.Settings","tinymce.plugins.codesample.core.CodeSample","tinymce.plugins.codesample.core.Languages","tinymce.plugins.codesample.core.Prism","tinymce.core.dom.DOMUtils"]
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
+ * ResolveGlobal.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.core.dom.DOMUtils',
152
+ [
153
+ 'global!tinymce.util.Tools.resolve'
154
+ ],
155
+ function (resolve) {
156
+ return resolve('tinymce.dom.DOMUtils');
157
+ }
158
+ );
159
+
160
+ /**
161
+ * Settings.js
162
+ *
163
+ * Released under LGPL License.
164
+ * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
165
+ *
166
+ * License: http://www.tinymce.com/license
167
+ * Contributing: http://www.tinymce.com/contributing
168
+ */
169
+
170
+ define(
171
+ 'tinymce.plugins.codesample.api.Settings',
172
+ [
173
+ 'tinymce.core.dom.DOMUtils'
174
+ ],
175
+ function (DOMUtils) {
176
+ var getContentCss = function (editor) {
177
+ return editor.settings.codesample_content_css;
178
+ };
179
+
180
+ var getLanguages = function (editor) {
181
+ return editor.settings.codesample_languages;
182
+ };
183
+
184
+ var getDialogMinWidth = function (editor) {
185
+ return Math.min(DOMUtils.DOM.getViewPort().w, editor.getParam('codesample_dialog_width', 800));
186
+ };
187
+
188
+ var getDialogMinHeight = function (editor) {
189
+ return Math.min(DOMUtils.DOM.getViewPort().w, editor.getParam('codesample_dialog_height', 650));
190
+ };
191
+
192
+ return {
193
+ getContentCss: getContentCss,
194
+ getLanguages: getLanguages,
195
+ getDialogMinWidth: getDialogMinWidth,
196
+ getDialogMinHeight: getDialogMinHeight
197
+ };
198
+ }
199
+ );
200
+ /**
201
+ * Prism.js
202
+ *
203
+ * Released under LGPL License.
204
+ * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
205
+ *
206
+ * License: http://www.tinymce.com/license
207
+ * Contributing: http://www.tinymce.com/contributing
208
+ *
209
+ * Import of prism. Disabled DOMContentLoaded event listener.
210
+ */
211
+
212
+ /*eslint-disable*/
213
+
214
+ define(
215
+ 'tinymce.plugins.codesample.core.Prism',
216
+ [
217
+ ],
218
+ function () {
219
+ var window = {};
220
+ // ------------------ Start wrap
221
+
222
+ /* http://prismjs.com/download.html?themes=prism-dark&languages=markup+css+clike+javascript+c+csharp+cpp+java+php+python+ruby */
223
+ var _self = (typeof window !== 'undefined')
224
+ ? window // if in browser
225
+ : (
226
+ (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope)
227
+ ? self // if in worker
228
+ : {} // if in node js
229
+ );
230
+
231
+ /**
232
+ * Prism: Lightweight, robust, elegant syntax highlighting
233
+ * MIT license http://www.opensource.org/licenses/mit-license.php/
234
+ * @author Lea Verou http://lea.verou.me
235
+ */
236
+
237
+ var Prism = (function () {
238
+
239
+ // Private helper vars
240
+ var lang = /\blang(?:uage)?-(?!\*)(\w+)\b/i;
241
+
242
+ var _ = _self.Prism = {
243
+ util: {
244
+ encode: function (tokens) {
245
+ if (tokens instanceof Token) {
246
+ return new Token(tokens.type, _.util.encode(tokens.content), tokens.alias);
247
+ } else if (_.util.type(tokens) === 'Array') {
248
+ return tokens.map(_.util.encode);
249
+ } else {
250
+ return tokens.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/\u00a0/g, ' ');
251
+ }
252
+ },
253
+
254
+ type: function (o) {
255
+ return Object.prototype.toString.call(o).match(/\[object (\w+)\]/)[1];
256
+ },
257
+
258
+ // Deep clone a language definition (e.g. to extend it)
259
+ clone: function (o) {
260
+ var type = _.util.type(o);
261
+
262
+ switch (type) {
263
+ case 'Object':
264
+ var clone = {};
265
+
266
+ for (var key in o) {
267
+ if (o.hasOwnProperty(key)) {
268
+ clone[key] = _.util.clone(o[key]);
269
+ }
270
+ }
271
+
272
+ return clone;
273
+
274
+ case 'Array':
275
+ // Check for existence for IE8
276
+ return o.map && o.map(function (v) { return _.util.clone(v); });
277
+ }
278
+
279
+ return o;
280
+ }
281
+ },
282
+
283
+ languages: {
284
+ extend: function (id, redef) {
285
+ var lang = _.util.clone(_.languages[id]);
286
+
287
+ for (var key in redef) {
288
+ lang[key] = redef[key];
289
+ }
290
+
291
+ return lang;
292
+ },
293
+
294
+ /**
295
+ * Insert a token before another token in a language literal
296
+ * As this needs to recreate the object (we cannot actually insert before keys in object literals),
297
+ * we cannot just provide an object, we need anobject and a key.
298
+ * @param inside The key (or language id) of the parent
299
+ * @param before The key to insert before. If not provided, the function appends instead.
300
+ * @param insert Object with the key/value pairs to insert
301
+ * @param root The object that contains `inside`. If equal to Prism.languages, it can be omitted.
302
+ */
303
+ insertBefore: function (inside, before, insert, root) {
304
+ root = root || _.languages;
305
+ var grammar = root[inside];
306
+
307
+ if (arguments.length == 2) {
308
+ insert = arguments[1];
309
+
310
+ for (var newToken in insert) {
311
+ if (insert.hasOwnProperty(newToken)) {
312
+ grammar[newToken] = insert[newToken];
313
+ }
314
+ }
315
+
316
+ return grammar;
317
+ }
318
+
319
+ var ret = {};
320
+
321
+ for (var token in grammar) {
322
+
323
+ if (grammar.hasOwnProperty(token)) {
324
+
325
+ if (token == before) {
326
+
327
+ for (var newToken in insert) {
328
+
329
+ if (insert.hasOwnProperty(newToken)) {
330
+ ret[newToken] = insert[newToken];
331
+ }
332
+ }
333
+ }
334
+
335
+ ret[token] = grammar[token];
336
+ }
337
+ }
338
+
339
+ // Update references in other language definitions
340
+ _.languages.DFS(_.languages, function (key, value) {
341
+ if (value === root[inside] && key != inside) {
342
+ this[key] = ret;
343
+ }
344
+ });
345
+
346
+ return root[inside] = ret;
347
+ },
348
+
349
+ // Traverse a language definition with Depth First Search
350
+ DFS: function (o, callback, type) {
351
+ for (var i in o) {
352
+ if (o.hasOwnProperty(i)) {
353
+ callback.call(o, i, o[i], type || i);
354
+
355
+ if (_.util.type(o[i]) === 'Object') {
356
+ _.languages.DFS(o[i], callback);
357
+ }
358
+ else if (_.util.type(o[i]) === 'Array') {
359
+ _.languages.DFS(o[i], callback, i);
360
+ }
361
+ }
362
+ }
363
+ }
364
+ },
365
+ plugins: {},
366
+
367
+ highlightAll: function (async, callback) {
368
+ var elements = document.querySelectorAll('code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code');
369
+
370
+ for (var i = 0, element; element = elements[i++];) {
371
+ _.highlightElement(element, async === true, callback);
372
+ }
373
+ },
374
+
375
+ highlightElement: function (element, async, callback) {
376
+ // Find language
377
+ var language, grammar, parent = element;
378
+
379
+ while (parent && !lang.test(parent.className)) {
380
+ parent = parent.parentNode;
381
+ }
382
+
383
+ if (parent) {
384
+ language = (parent.className.match(lang) || [, ''])[1];
385
+ grammar = _.languages[language];
386
+ }
387
+
388
+ // Set language on the element, if not present
389
+ element.className = element.className.replace(lang, '').replace(/\s+/g, ' ') + ' language-' + language;
390
+
391
+ // Set language on the parent, for styling
392
+ parent = element.parentNode;
393
+
394
+ if (/pre/i.test(parent.nodeName)) {
395
+ parent.className = parent.className.replace(lang, '').replace(/\s+/g, ' ') + ' language-' + language;
396
+ }
397
+
398
+ var code = element.textContent;
399
+
400
+ var env = {
401
+ element: element,
402
+ language: language,
403
+ grammar: grammar,
404
+ code: code
405
+ };
406
+
407
+ if (!code || !grammar) {
408
+ _.hooks.run('complete', env);
409
+ return;
410
+ }
411
+
412
+ _.hooks.run('before-highlight', env);
413
+
414
+ if (async && _self.Worker) {
415
+ var worker = new Worker(_.filename);
416
+
417
+ worker.onmessage = function (evt) {
418
+ env.highlightedCode = evt.data;
419
+
420
+ _.hooks.run('before-insert', env);
421
+
422
+ env.element.innerHTML = env.highlightedCode;
423
+
424
+ callback && callback.call(env.element);
425
+ _.hooks.run('after-highlight', env);
426
+ _.hooks.run('complete', env);
427
+ };
428
+
429
+ worker.postMessage(JSON.stringify({
430
+ language: env.language,
431
+ code: env.code,
432
+ immediateClose: true
433
+ }));
434
+ }
435
+ else {
436
+ env.highlightedCode = _.highlight(env.code, env.grammar, env.language);
437
+
438
+ _.hooks.run('before-insert', env);
439
+
440
+ env.element.innerHTML = env.highlightedCode;
441
+
442
+ callback && callback.call(element);
443
+
444
+ _.hooks.run('after-highlight', env);
445
+ _.hooks.run('complete', env);
446
+ }
447
+ },
448
+
449
+ highlight: function (text, grammar, language) {
450
+ var tokens = _.tokenize(text, grammar);
451
+ return Token.stringify(_.util.encode(tokens), language);
452
+ },
453
+
454
+ tokenize: function (text, grammar, language) {
455
+ var Token = _.Token;
456
+
457
+ var strarr = [text];
458
+
459
+ var rest = grammar.rest;
460
+
461
+ if (rest) {
462
+ for (var token in rest) {
463
+ grammar[token] = rest[token];
464
+ }
465
+
466
+ delete grammar.rest;
467
+ }
468
+
469
+ tokenloop: for (var token in grammar) {
470
+ if (!grammar.hasOwnProperty(token) || !grammar[token]) {
471
+ continue;
472
+ }
473
+
474
+ var patterns = grammar[token];
475
+ patterns = (_.util.type(patterns) === "Array") ? patterns : [patterns];
476
+
477
+ for (var j = 0; j < patterns.length; ++j) {
478
+ var pattern = patterns[j],
479
+ inside = pattern.inside,
480
+ lookbehind = !!pattern.lookbehind,
481
+ lookbehindLength = 0,
482
+ alias = pattern.alias;
483
+
484
+ pattern = pattern.pattern || pattern;
485
+
486
+ for (var i = 0; i < strarr.length; i++) { // Don’t cache length as it changes during the loop
487
+
488
+ var str = strarr[i];
489
+
490
+ if (strarr.length > text.length) {
491
+ // Something went terribly wrong, ABORT, ABORT!
492
+ break tokenloop;
493
+ }
494
+
495
+ if (str instanceof Token) {
496
+ continue;
497
+ }
498
+
499
+ pattern.lastIndex = 0;
500
+
501
+ var match = pattern.exec(str);
502
+
503
+ if (match) {
504
+ if (lookbehind) {
505
+ lookbehindLength = match[1].length;
506
+ }
507
+
508
+ var from = match.index - 1 + lookbehindLength,
509
+ match = match[0].slice(lookbehindLength),
510
+ len = match.length,
511
+ to = from + len,
512
+ before = str.slice(0, from + 1),
513
+ after = str.slice(to + 1);
514
+
515
+ var args = [i, 1];
516
+
517
+ if (before) {
518
+ args.push(before);
519
+ }
520
+
521
+ var wrapped = new Token(token, inside ? _.tokenize(match, inside) : match, alias);
522
+
523
+ args.push(wrapped);
524
+
525
+ if (after) {
526
+ args.push(after);
527
+ }
528
+
529
+ Array.prototype.splice.apply(strarr, args);
530
+ }
531
+ }
532
+ }
533
+ }
534
+
535
+ return strarr;
536
+ },
537
+
538
+ hooks: {
539
+ all: {},
540
+
541
+ add: function (name, callback) {
542
+ var hooks = _.hooks.all;
543
+
544
+ hooks[name] = hooks[name] || [];
545
+
546
+ hooks[name].push(callback);
547
+ },
548
+
549
+ run: function (name, env) {
550
+ var callbacks = _.hooks.all[name];
551
+
552
+ if (!callbacks || !callbacks.length) {
553
+ return;
554
+ }
555
+
556
+ for (var i = 0, callback; callback = callbacks[i++];) {
557
+ callback(env);
558
+ }
559
+ }
560
+ }
561
+ };
562
+
563
+ var Token = _.Token = function (type, content, alias) {
564
+ this.type = type;
565
+ this.content = content;
566
+ this.alias = alias;
567
+ };
568
+
569
+ Token.stringify = function (o, language, parent) {
570
+ if (typeof o == 'string') {
571
+ return o;
572
+ }
573
+
574
+ if (_.util.type(o) === 'Array') {
575
+ return o.map(function (element) {
576
+ return Token.stringify(element, language, o);
577
+ }).join('');
578
+ }
579
+
580
+ var env = {
581
+ type: o.type,
582
+ content: Token.stringify(o.content, language, parent),
583
+ tag: 'span',
584
+ classes: ['token', o.type],
585
+ attributes: {},
586
+ language: language,
587
+ parent: parent
588
+ };
589
+
590
+ if (env.type == 'comment') {
591
+ env.attributes['spellcheck'] = 'true';
592
+ }
593
+
594
+ if (o.alias) {
595
+ var aliases = _.util.type(o.alias) === 'Array' ? o.alias : [o.alias];
596
+ Array.prototype.push.apply(env.classes, aliases);
597
+ }
598
+
599
+ _.hooks.run('wrap', env);
600
+
601
+ var attributes = '';
602
+
603
+ for (var name in env.attributes) {
604
+ attributes += (attributes ? ' ' : '') + name + '="' + (env.attributes[name] || '') + '"';
605
+ }
606
+
607
+ return '<' + env.tag + ' class="' + env.classes.join(' ') + '" ' + attributes + '>' + env.content + '</' + env.tag + '>';
608
+
609
+ };
610
+
611
+ if (!_self.document) {
612
+ if (!_self.addEventListener) {
613
+ // in Node.js
614
+ return _self.Prism;
615
+ }
616
+ // In worker
617
+ _self.addEventListener('message', function (evt) {
618
+ var message = JSON.parse(evt.data),
619
+ lang = message.language,
620
+ code = message.code,
621
+ immediateClose = message.immediateClose;
622
+
623
+ _self.postMessage(_.highlight(code, _.languages[lang], lang));
624
+ if (immediateClose) {
625
+ _self.close();
626
+ }
627
+ }, false);
628
+
629
+ return _self.Prism;
630
+ }
631
+ /*
632
+ // Get current script and highlight
633
+ var script = document.getElementsByTagName('script');
634
+
635
+ script = script[script.length - 1];
636
+
637
+ if (script) {
638
+ _.filename = script.src;
639
+
640
+ if (document.addEventListener && !script.hasAttribute('data-manual')) {
641
+ document.addEventListener('DOMContentLoaded', _.highlightAll);
642
+ }
643
+ }
644
+
645
+ return _self.Prism;
646
+ */
647
+ })();
648
+
649
+ if (typeof module !== 'undefined' && module.exports) {
650
+ module.exports = Prism;
651
+ }
652
+
653
+ // hack for components to work correctly in node.js
654
+ if (typeof global !== 'undefined') {
655
+ global.Prism = Prism;
656
+ }
657
+ ;
658
+ Prism.languages.markup = {
659
+ 'comment': /<!--[\w\W]*?-->/,
660
+ 'prolog': /<\?[\w\W]+?\?>/,
661
+ 'doctype': /<!DOCTYPE[\w\W]+?>/,
662
+ 'cdata': /<!\[CDATA\[[\w\W]*?]]>/i,
663
+ 'tag': {
664
+ pattern: /<\/?[^\s>\/=.]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\\1|\\?(?!\1)[\w\W])*\1|[^\s'">=]+))?)*\s*\/?>/i,
665
+ inside: {
666
+ 'tag': {
667
+ pattern: /^<\/?[^\s>\/]+/i,
668
+ inside: {
669
+ 'punctuation': /^<\/?/,
670
+ 'namespace': /^[^\s>\/:]+:/
671
+ }
672
+ },
673
+ 'attr-value': {
674
+ pattern: /=(?:('|")[\w\W]*?(\1)|[^\s>]+)/i,
675
+ inside: {
676
+ 'punctuation': /[=>"']/
677
+ }
678
+ },
679
+ 'punctuation': /\/?>/,
680
+ 'attr-name': {
681
+ pattern: /[^\s>\/]+/,
682
+ inside: {
683
+ 'namespace': /^[^\s>\/:]+:/
684
+ }
685
+ }
686
+
687
+ }
688
+ },
689
+ 'entity': /&#?[\da-z]{1,8};/i
690
+ };
691
+
692
+ // Plugin to make entity title show the real entity, idea by Roman Komarov
693
+ Prism.hooks.add('wrap', function (env) {
694
+
695
+ if (env.type === 'entity') {
696
+ env.attributes['title'] = env.content.replace(/&amp;/, '&');
697
+ }
698
+ });
699
+
700
+ Prism.languages.xml = Prism.languages.markup;
701
+ Prism.languages.html = Prism.languages.markup;
702
+ Prism.languages.mathml = Prism.languages.markup;
703
+ Prism.languages.svg = Prism.languages.markup;
704
+
705
+ Prism.languages.css = {
706
+ 'comment': /\/\*[\w\W]*?\*\//,
707
+ 'atrule': {
708
+ pattern: /@[\w-]+?.*?(;|(?=\s*\{))/i,
709
+ inside: {
710
+ 'rule': /@[\w-]+/
711
+ // See rest below
712
+ }
713
+ },
714
+ 'url': /url\((?:(["'])(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1|.*?)\)/i,
715
+ 'selector': /[^\{\}\s][^\{\};]*?(?=\s*\{)/,
716
+ 'string': /("|')(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1/,
717
+ 'property': /(\b|\B)[\w-]+(?=\s*:)/i,
718
+ 'important': /\B!important\b/i,
719
+ 'function': /[-a-z0-9]+(?=\()/i,
720
+ 'punctuation': /[(){};:]/
721
+ };
722
+
723
+ Prism.languages.css['atrule'].inside.rest = Prism.util.clone(Prism.languages.css);
724
+
725
+ if (Prism.languages.markup) {
726
+ Prism.languages.insertBefore('markup', 'tag', {
727
+ 'style': {
728
+ pattern: /<style[\w\W]*?>[\w\W]*?<\/style>/i,
729
+ inside: {
730
+ 'tag': {
731
+ pattern: /<style[\w\W]*?>|<\/style>/i,
732
+ inside: Prism.languages.markup.tag.inside
733
+ },
734
+ rest: Prism.languages.css
735
+ },
736
+ alias: 'language-css'
737
+ }
738
+ });
739
+
740
+ Prism.languages.insertBefore('inside', 'attr-value', {
741
+ 'style-attr': {
742
+ pattern: /\s*style=("|').*?\1/i,
743
+ inside: {
744
+ 'attr-name': {
745
+ pattern: /^\s*style/i,
746
+ inside: Prism.languages.markup.tag.inside
747
+ },
748
+ 'punctuation': /^\s*=\s*['"]|['"]\s*$/,
749
+ 'attr-value': {
750
+ pattern: /.+/i,
751
+ inside: Prism.languages.css
752
+ }
753
+ },
754
+ alias: 'language-css'
755
+ }
756
+ }, Prism.languages.markup.tag);
757
+ };
758
+ Prism.languages.clike = {
759
+ 'comment': [
760
+ {
761
+ pattern: /(^|[^\\])\/\*[\w\W]*?\*\//,
762
+ lookbehind: true
763
+ },
764
+ {
765
+ pattern: /(^|[^\\:])\/\/.*/,
766
+ lookbehind: true
767
+ }
768
+ ],
769
+ 'string': /(["'])(\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
770
+ 'class-name': {
771
+ pattern: /((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[a-z0-9_\.\\]+/i,
772
+ lookbehind: true,
773
+ inside: {
774
+ punctuation: /(\.|\\)/
775
+ }
776
+ },
777
+ 'keyword': /\b(if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,
778
+ 'boolean': /\b(true|false)\b/,
779
+ 'function': /[a-z0-9_]+(?=\()/i,
780
+ 'number': /\b-?(?:0x[\da-f]+|\d*\.?\d+(?:e[+-]?\d+)?)\b/i,
781
+ 'operator': /--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/,
782
+ 'punctuation': /[{}[\];(),.:]/
783
+ };
784
+
785
+ Prism.languages.javascript = Prism.languages.extend('clike', {
786
+ 'keyword': /\b(as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|false|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|true|try|typeof|var|void|while|with|yield)\b/,
787
+ 'number': /\b-?(0x[\dA-Fa-f]+|0b[01]+|0o[0-7]+|\d*\.?\d+([Ee][+-]?\d+)?|NaN|Infinity)\b/,
788
+ // Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)
789
+ 'function': /[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*(?=\()/i
790
+ });
791
+
792
+ Prism.languages.insertBefore('javascript', 'keyword', {
793
+ 'regex': {
794
+ pattern: /(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\\\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})]))/,
795
+ lookbehind: true
796
+ }
797
+ });
798
+
799
+ Prism.languages.insertBefore('javascript', 'class-name', {
800
+ 'template-string': {
801
+ pattern: /`(?:\\`|\\?[^`])*`/,
802
+ inside: {
803
+ 'interpolation': {
804
+ pattern: /\$\{[^}]+\}/,
805
+ inside: {
806
+ 'interpolation-punctuation': {
807
+ pattern: /^\$\{|\}$/,
808
+ alias: 'punctuation'
809
+ },
810
+ rest: Prism.languages.javascript
811
+ }
812
+ },
813
+ 'string': /[\s\S]+/
814
+ }
815
+ }
816
+ });
817
+
818
+ if (Prism.languages.markup) {
819
+ Prism.languages.insertBefore('markup', 'tag', {
820
+ 'script': {
821
+ pattern: /<script[\w\W]*?>[\w\W]*?<\/script>/i,
822
+ inside: {
823
+ 'tag': {
824
+ pattern: /<script[\w\W]*?>|<\/script>/i,
825
+ inside: Prism.languages.markup.tag.inside
826
+ },
827
+ rest: Prism.languages.javascript
828
+ },
829
+ alias: 'language-javascript'
830
+ }
831
+ });
832
+ }
833
+
834
+ Prism.languages.js = Prism.languages.javascript;
835
+ Prism.languages.c = Prism.languages.extend('clike', {
836
+ 'keyword': /\b(asm|typeof|inline|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|union|unsigned|void|volatile|while)\b/,
837
+ 'operator': /\-[>-]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|?\||[~^%?*\/]/,
838
+ 'number': /\b-?(?:0x[\da-f]+|\d*\.?\d+(?:e[+-]?\d+)?)[ful]*\b/i
839
+ });
840
+
841
+ Prism.languages.insertBefore('c', 'string', {
842
+ 'macro': {
843
+ // allow for multiline macro definitions
844
+ // spaces after the # character compile fine with gcc
845
+ pattern: /(^\s*)#\s*[a-z]+([^\r\n\\]|\\.|\\(?:\r\n?|\n))*/im,
846
+ lookbehind: true,
847
+ alias: 'property',
848
+ inside: {
849
+ // highlight the path of the include statement as a string
850
+ 'string': {
851
+ pattern: /(#\s*include\s*)(<.+?>|("|')(\\?.)+?\3)/,
852
+ lookbehind: true
853
+ }
854
+ }
855
+ }
856
+ });
857
+
858
+ delete Prism.languages.c['class-name'];
859
+ delete Prism.languages.c['boolean'];
860
+
861
+ Prism.languages.csharp = Prism.languages.extend('clike', {
862
+ 'keyword': /\b(abstract|as|async|await|base|bool|break|byte|case|catch|char|checked|class|const|continue|decimal|default|delegate|do|double|else|enum|event|explicit|extern|false|finally|fixed|float|for|foreach|goto|if|implicit|in|int|interface|internal|is|lock|long|namespace|new|null|object|operator|out|override|params|private|protected|public|readonly|ref|return|sbyte|sealed|short|sizeof|stackalloc|static|string|struct|switch|this|throw|true|try|typeof|uint|ulong|unchecked|unsafe|ushort|using|virtual|void|volatile|while|add|alias|ascending|async|await|descending|dynamic|from|get|global|group|into|join|let|orderby|partial|remove|select|set|value|var|where|yield)\b/,
863
+ 'string': [
864
+ /@("|')(\1\1|\\\1|\\?(?!\1)[\s\S])*\1/,
865
+ /("|')(\\?.)*?\1/
866
+ ],
867
+ 'number': /\b-?(0x[\da-f]+|\d*\.?\d+)\b/i
868
+ });
869
+
870
+ Prism.languages.insertBefore('csharp', 'keyword', {
871
+ 'preprocessor': {
872
+ pattern: /(^\s*)#.*/m,
873
+ lookbehind: true
874
+ }
875
+ });
876
+
877
+ Prism.languages.cpp = Prism.languages.extend('c', {
878
+ 'keyword': /\b(alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|class|compl|const|constexpr|const_cast|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|float|for|friend|goto|if|inline|int|long|mutable|namespace|new|noexcept|nullptr|operator|private|protected|public|register|reinterpret_cast|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,
879
+ 'boolean': /\b(true|false)\b/,
880
+ 'operator': /[-+]{1,2}|!=?|<{1,2}=?|>{1,2}=?|\->|:{1,2}|={1,2}|\^|~|%|&{1,2}|\|?\||\?|\*|\/|\b(and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/
881
+ });
882
+
883
+ Prism.languages.insertBefore('cpp', 'keyword', {
884
+ 'class-name': {
885
+ pattern: /(class\s+)[a-z0-9_]+/i,
886
+ lookbehind: true
887
+ }
888
+ });
889
+ Prism.languages.java = Prism.languages.extend('clike', {
890
+ 'keyword': /\b(abstract|continue|for|new|switch|assert|default|goto|package|synchronized|boolean|do|if|private|this|break|double|implements|protected|throw|byte|else|import|public|throws|case|enum|instanceof|return|transient|catch|extends|int|short|try|char|final|interface|static|void|class|finally|long|strictfp|volatile|const|float|native|super|while)\b/,
891
+ 'number': /\b0b[01]+\b|\b0x[\da-f]*\.?[\da-fp\-]+\b|\b\d*\.?\d+(?:e[+-]?\d+)?[df]?\b/i,
892
+ 'operator': {
893
+ pattern: /(^|[^.])(?:\+[+=]?|-[-=]?|!=?|<<?=?|>>?>?=?|==?|&[&=]?|\|[|=]?|\*=?|\/=?|%=?|\^=?|[?:~])/m,
894
+ lookbehind: true
895
+ }
896
+ });
897
+ /**
898
+ * Original by Aaron Harun: http://aahacreative.com/2012/07/31/php-syntax-highlighting-prism/
899
+ * Modified by Miles Johnson: http://milesj.me
900
+ *
901
+ * Supports the following:
902
+ * - Extends clike syntax
903
+ * - Support for PHP 5.3+ (namespaces, traits, generators, etc)
904
+ * - Smarter constant and function matching
905
+ *
906
+ * Adds the following new token classes:
907
+ * constant, delimiter, variable, function, package
908
+ */
909
+
910
+ Prism.languages.php = Prism.languages.extend('clike', {
911
+ 'keyword': /\b(and|or|xor|array|as|break|case|cfunction|class|const|continue|declare|default|die|do|else|elseif|enddeclare|endfor|endforeach|endif|endswitch|endwhile|extends|for|foreach|function|include|include_once|global|if|new|return|static|switch|use|require|require_once|var|while|abstract|interface|public|implements|private|protected|parent|throw|null|echo|print|trait|namespace|final|yield|goto|instanceof|finally|try|catch)\b/i,
912
+ 'constant': /\b[A-Z0-9_]{2,}\b/,
913
+ 'comment': {
914
+ pattern: /(^|[^\\])(?:\/\*[\w\W]*?\*\/|\/\/.*)/,
915
+ lookbehind: true
916
+ }
917
+ });
918
+
919
+ // Shell-like comments are matched after strings, because they are less
920
+ // common than strings containing hashes...
921
+ Prism.languages.insertBefore('php', 'class-name', {
922
+ 'shell-comment': {
923
+ pattern: /(^|[^\\])#.*/,
924
+ lookbehind: true,
925
+ alias: 'comment'
926
+ }
927
+ });
928
+
929
+ Prism.languages.insertBefore('php', 'keyword', {
930
+ 'delimiter': /\?>|<\?(?:php)?/i,
931
+ 'variable': /\$\w+\b/i,
932
+ 'package': {
933
+ pattern: /(\\|namespace\s+|use\s+)[\w\\]+/,
934
+ lookbehind: true,
935
+ inside: {
936
+ punctuation: /\\/
937
+ }
938
+ }
939
+ });
940
+
941
+ // Must be defined after the function pattern
942
+ Prism.languages.insertBefore('php', 'operator', {
943
+ 'property': {
944
+ pattern: /(->)[\w]+/,
945
+ lookbehind: true
946
+ }
947
+ });
948
+
949
+ // Add HTML support of the markup language exists
950
+ if (Prism.languages.markup) {
951
+
952
+ // Tokenize all inline PHP blocks that are wrapped in <?php ?>
953
+ // This allows for easy PHP + markup highlighting
954
+ Prism.hooks.add('before-highlight', function (env) {
955
+ if (env.language !== 'php') {
956
+ return;
957
+ }
958
+
959
+ env.tokenStack = [];
960
+
961
+ env.backupCode = env.code;
962
+ env.code = env.code.replace(/(?:<\?php|<\?)[\w\W]*?(?:\?>)/ig, function (match) {
963
+ env.tokenStack.push(match);
964
+
965
+ return '{{{PHP' + env.tokenStack.length + '}}}';
966
+ });
967
+ });
968
+
969
+ // Restore env.code for other plugins (e.g. line-numbers)
970
+ Prism.hooks.add('before-insert', function (env) {
971
+ if (env.language === 'php') {
972
+ env.code = env.backupCode;
973
+ delete env.backupCode;
974
+ }
975
+ });
976
+
977
+ // Re-insert the tokens after highlighting
978
+ Prism.hooks.add('after-highlight', function (env) {
979
+ if (env.language !== 'php') {
980
+ return;
981
+ }
982
+
983
+ for (var i = 0, t; t = env.tokenStack[i]; i++) {
984
+ // The replace prevents $$, $&, $`, $', $n, $nn from being interpreted as special patterns
985
+ env.highlightedCode = env.highlightedCode.replace('{{{PHP' + (i + 1) + '}}}', Prism.highlight(t, env.grammar, 'php').replace(/\$/g, '$$$$'));
986
+ }
987
+
988
+ env.element.innerHTML = env.highlightedCode;
989
+ });
990
+
991
+ // Wrap tokens in classes that are missing them
992
+ Prism.hooks.add('wrap', function (env) {
993
+ if (env.language === 'php' && env.type === 'markup') {
994
+ env.content = env.content.replace(/(\{\{\{PHP[0-9]+\}\}\})/g, "<span class=\"token php\">$1</span>");
995
+ }
996
+ });
997
+
998
+ // Add the rules before all others
999
+ Prism.languages.insertBefore('php', 'comment', {
1000
+ 'markup': {
1001
+ pattern: /<[^?]\/?(.*?)>/,
1002
+ inside: Prism.languages.markup
1003
+ },
1004
+ 'php': /\{\{\{PHP[0-9]+\}\}\}/
1005
+ });
1006
+ }
1007
+ ;
1008
+ Prism.languages.python = {
1009
+ 'comment': {
1010
+ pattern: /(^|[^\\])#.*/,
1011
+ lookbehind: true
1012
+ },
1013
+ 'string': /"""[\s\S]+?"""|'''[\s\S]+?'''|("|')(?:\\?.)*?\1/,
1014
+ 'function': {
1015
+ pattern: /((?:^|\s)def[ \t]+)[a-zA-Z_][a-zA-Z0-9_]*(?=\()/g,
1016
+ lookbehind: true
1017
+ },
1018
+ 'class-name': {
1019
+ pattern: /(\bclass\s+)[a-z0-9_]+/i,
1020
+ lookbehind: true
1021
+ },
1022
+ 'keyword': /\b(?:as|assert|async|await|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|pass|print|raise|return|try|while|with|yield)\b/,
1023
+ 'boolean': /\b(?:True|False)\b/,
1024
+ 'number': /\b-?(?:0[bo])?(?:(?:\d|0x[\da-f])[\da-f]*\.?\d*|\.\d+)(?:e[+-]?\d+)?j?\b/i,
1025
+ 'operator': /[-+%=]=?|!=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]|\b(?:or|and|not)\b/,
1026
+ 'punctuation': /[{}[\];(),.:]/
1027
+ };
1028
+
1029
+ /**
1030
+ * Original by Samuel Flores
1031
+ *
1032
+ * Adds the following new token classes:
1033
+ * constant, builtin, variable, symbol, regex
1034
+ */
1035
+ (function (Prism) {
1036
+ Prism.languages.ruby = Prism.languages.extend('clike', {
1037
+ 'comment': /#(?!\{[^\r\n]*?\}).*/,
1038
+ 'keyword': /\b(alias|and|BEGIN|begin|break|case|class|def|define_method|defined|do|each|else|elsif|END|end|ensure|false|for|if|in|module|new|next|nil|not|or|raise|redo|require|rescue|retry|return|self|super|then|throw|true|undef|unless|until|when|while|yield)\b/
1039
+ });
1040
+
1041
+ var interpolation = {
1042
+ pattern: /#\{[^}]+\}/,
1043
+ inside: {
1044
+ 'delimiter': {
1045
+ pattern: /^#\{|\}$/,
1046
+ alias: 'tag'
1047
+ },
1048
+ rest: Prism.util.clone(Prism.languages.ruby)
1049
+ }
1050
+ };
1051
+
1052
+ Prism.languages.insertBefore('ruby', 'keyword', {
1053
+ 'regex': [
1054
+ {
1055
+ pattern: /%r([^a-zA-Z0-9\s\{\(\[<])(?:[^\\]|\\[\s\S])*?\1[gim]{0,3}/,
1056
+ inside: {
1057
+ 'interpolation': interpolation
1058
+ }
1059
+ },
1060
+ {
1061
+ pattern: /%r\((?:[^()\\]|\\[\s\S])*\)[gim]{0,3}/,
1062
+ inside: {
1063
+ 'interpolation': interpolation
1064
+ }
1065
+ },
1066
+ {
1067
+ // Here we need to specifically allow interpolation
1068
+ pattern: /%r\{(?:[^#{}\\]|#(?:\{[^}]+\})?|\\[\s\S])*\}[gim]{0,3}/,
1069
+ inside: {
1070
+ 'interpolation': interpolation
1071
+ }
1072
+ },
1073
+ {
1074
+ pattern: /%r\[(?:[^\[\]\\]|\\[\s\S])*\][gim]{0,3}/,
1075
+ inside: {
1076
+ 'interpolation': interpolation
1077
+ }
1078
+ },
1079
+ {
1080
+ pattern: /%r<(?:[^<>\\]|\\[\s\S])*>[gim]{0,3}/,
1081
+ inside: {
1082
+ 'interpolation': interpolation
1083
+ }
1084
+ },
1085
+ {
1086
+ pattern: /(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/,
1087
+ lookbehind: true
1088
+ }
1089
+ ],
1090
+ 'variable': /[@$]+[a-zA-Z_][a-zA-Z_0-9]*(?:[?!]|\b)/,
1091
+ 'symbol': /:[a-zA-Z_][a-zA-Z_0-9]*(?:[?!]|\b)/
1092
+ });
1093
+
1094
+ Prism.languages.insertBefore('ruby', 'number', {
1095
+ 'builtin': /\b(Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Stat|File|Fixnum|Fload|Hash|Integer|IO|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|String|Struct|TMS|Symbol|ThreadGroup|Thread|Time|TrueClass)\b/,
1096
+ 'constant': /\b[A-Z][a-zA-Z_0-9]*(?:[?!]|\b)/
1097
+ });
1098
+
1099
+ Prism.languages.ruby.string = [
1100
+ {
1101
+ pattern: /%[qQiIwWxs]?([^a-zA-Z0-9\s\{\(\[<])(?:[^\\]|\\[\s\S])*?\1/,
1102
+ inside: {
1103
+ 'interpolation': interpolation
1104
+ }
1105
+ },
1106
+ {
1107
+ pattern: /%[qQiIwWxs]?\((?:[^()\\]|\\[\s\S])*\)/,
1108
+ inside: {
1109
+ 'interpolation': interpolation
1110
+ }
1111
+ },
1112
+ {
1113
+ // Here we need to specifically allow interpolation
1114
+ pattern: /%[qQiIwWxs]?\{(?:[^#{}\\]|#(?:\{[^}]+\})?|\\[\s\S])*\}/,
1115
+ inside: {
1116
+ 'interpolation': interpolation
1117
+ }
1118
+ },
1119
+ {
1120
+ pattern: /%[qQiIwWxs]?\[(?:[^\[\]\\]|\\[\s\S])*\]/,
1121
+ inside: {
1122
+ 'interpolation': interpolation
1123
+ }
1124
+ },
1125
+ {
1126
+ pattern: /%[qQiIwWxs]?<(?:[^<>\\]|\\[\s\S])*>/,
1127
+ inside: {
1128
+ 'interpolation': interpolation
1129
+ }
1130
+ },
1131
+ {
1132
+ pattern: /("|')(#\{[^}]+\}|\\(?:\r?\n|\r)|\\?.)*?\1/,
1133
+ inside: {
1134
+ 'interpolation': interpolation
1135
+ }
1136
+ }
1137
+ ];
1138
+ }(Prism));
1139
+
1140
+ // ------------------ End wrap
1141
+ return Prism;
1142
+ }
1143
+ );
1144
+
1145
+ /*eslint-enable */
1146
+
1147
+ /**
1148
+ * Utils.js
1149
+ *
1150
+ * Released under LGPL License.
1151
+ * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
1152
+ *
1153
+ * License: http://www.tinymce.com/license
1154
+ * Contributing: http://www.tinymce.com/contributing
1155
+ */
1156
+
1157
+ define(
1158
+ 'tinymce.plugins.codesample.util.Utils',
1159
+ [
1160
+ ],
1161
+ function () {
1162
+ function isCodeSample(elm) {
1163
+ return elm && elm.nodeName === 'PRE' && elm.className.indexOf('language-') !== -1;
1164
+ }
1165
+
1166
+ function trimArg(predicateFn) {
1167
+ return function (arg1, arg2) {
1168
+ return predicateFn(arg2);
1169
+ };
1170
+ }
1171
+
1172
+ return {
1173
+ isCodeSample: isCodeSample,
1174
+ trimArg: trimArg
1175
+ };
1176
+ }
1177
+ );
1178
+ /**
1179
+ * CodeSample.js
1180
+ *
1181
+ * Released under LGPL License.
1182
+ * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
1183
+ *
1184
+ * License: http://www.tinymce.com/license
1185
+ * Contributing: http://www.tinymce.com/contributing
1186
+ */
1187
+
1188
+ define(
1189
+ 'tinymce.plugins.codesample.core.CodeSample',
1190
+ [
1191
+ 'tinymce.core.dom.DOMUtils',
1192
+ 'tinymce.plugins.codesample.core.Prism',
1193
+ 'tinymce.plugins.codesample.util.Utils'
1194
+ ],
1195
+ function (DOMUtils, Prism, Utils) {
1196
+ var getSelectedCodeSample = function (editor) {
1197
+ var node = editor.selection.getNode();
1198
+
1199
+ if (Utils.isCodeSample(node)) {
1200
+ return node;
1201
+ }
1202
+
1203
+ return null;
1204
+ };
1205
+
1206
+ var insertCodeSample = function (editor, language, code) {
1207
+ editor.undoManager.transact(function () {
1208
+ var node = getSelectedCodeSample(editor);
1209
+
1210
+ code = DOMUtils.DOM.encode(code);
1211
+
1212
+ if (node) {
1213
+ editor.dom.setAttrib(node, 'class', 'language-' + language);
1214
+ node.innerHTML = code;
1215
+ Prism.highlightElement(node);
1216
+ editor.selection.select(node);
1217
+ } else {
1218
+ editor.insertContent('<pre id="__new" class="language-' + language + '">' + code + '</pre>');
1219
+ editor.selection.select(editor.$('#__new').removeAttr('id')[0]);
1220
+ }
1221
+ });
1222
+ };
1223
+
1224
+ var getCurrentCode = function (editor) {
1225
+ var node = getSelectedCodeSample(editor);
1226
+
1227
+ if (node) {
1228
+ return node.textContent;
1229
+ }
1230
+
1231
+ return '';
1232
+ };
1233
+
1234
+ return {
1235
+ getSelectedCodeSample: getSelectedCodeSample,
1236
+ insertCodeSample: insertCodeSample,
1237
+ getCurrentCode: getCurrentCode
1238
+ };
1239
+ }
1240
+ );
1241
+ /**
1242
+ * Languages.js
1243
+ *
1244
+ * Released under LGPL License.
1245
+ * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
1246
+ *
1247
+ * License: http://www.tinymce.com/license
1248
+ * Contributing: http://www.tinymce.com/contributing
1249
+ */
1250
+
1251
+ define(
1252
+ 'tinymce.plugins.codesample.core.Languages',
1253
+ [
1254
+ 'tinymce.plugins.codesample.api.Settings',
1255
+ 'tinymce.plugins.codesample.core.CodeSample'
1256
+ ],
1257
+ function (Settings, CodeSample) {
1258
+ var getLanguages = function (editor) {
1259
+ var defaultLanguages = [
1260
+ { text: 'HTML/XML', value: 'markup' },
1261
+ { text: 'JavaScript', value: 'javascript' },
1262
+ { text: 'CSS', value: 'css' },
1263
+ { text: 'PHP', value: 'php' },
1264
+ { text: 'Ruby', value: 'ruby' },
1265
+ { text: 'Python', value: 'python' },
1266
+ { text: 'Java', value: 'java' },
1267
+ { text: 'C', value: 'c' },
1268
+ { text: 'C#', value: 'csharp' },
1269
+ { text: 'C++', value: 'cpp' }
1270
+ ];
1271
+
1272
+ var customLanguages = Settings.getLanguages(editor);
1273
+ return customLanguages ? customLanguages : defaultLanguages;
1274
+ };
1275
+
1276
+ var getCurrentLanguage = function (editor) {
1277
+ var matches, node = CodeSample.getSelectedCodeSample(editor);
1278
+
1279
+ if (node) {
1280
+ matches = node.className.match(/language-(\w+)/);
1281
+ return matches ? matches[1] : '';
1282
+ }
1283
+
1284
+ return '';
1285
+ };
1286
+
1287
+ return {
1288
+ getLanguages: getLanguages,
1289
+ getCurrentLanguage: getCurrentLanguage
1290
+ };
1291
+ }
1292
+ );
1293
+ /**
1294
+ * Dialog.js
1295
+ *
1296
+ * Released under LGPL License.
1297
+ * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
1298
+ *
1299
+ * License: http://www.tinymce.com/license
1300
+ * Contributing: http://www.tinymce.com/contributing
1301
+ */
1302
+
1303
+ define(
1304
+ 'tinymce.plugins.codesample.ui.Dialog',
1305
+ [
1306
+ 'tinymce.plugins.codesample.api.Settings',
1307
+ 'tinymce.plugins.codesample.core.CodeSample',
1308
+ 'tinymce.plugins.codesample.core.Languages'
1309
+ ],
1310
+ function (Settings, CodeSample, Languages) {
1311
+ return {
1312
+ open: function (editor) {
1313
+ var minWidth = Settings.getDialogMinWidth(editor);
1314
+ var minHeight = Settings.getDialogMinHeight(editor);
1315
+ var currentLanguage = Languages.getCurrentLanguage(editor);
1316
+ var currentLanguages = Languages.getLanguages(editor);
1317
+ var currentCode = CodeSample.getCurrentCode(editor);
1318
+
1319
+ editor.windowManager.open({
1320
+ title: "Insert/Edit code sample",
1321
+ minWidth: minWidth,
1322
+ minHeight: minHeight,
1323
+ layout: 'flex',
1324
+ direction: 'column',
1325
+ align: 'stretch',
1326
+ body: [
1327
+ {
1328
+ type: 'listbox',
1329
+ name: 'language',
1330
+ label: 'Language',
1331
+ maxWidth: 200,
1332
+ value: currentLanguage,
1333
+ values: currentLanguages
1334
+ },
1335
+
1336
+ {
1337
+ type: 'textbox',
1338
+ name: 'code',
1339
+ multiline: true,
1340
+ spellcheck: false,
1341
+ ariaLabel: 'Code view',
1342
+ flex: 1,
1343
+ style: 'direction: ltr; text-align: left',
1344
+ classes: 'monospace',
1345
+ value: currentCode,
1346
+ autofocus: true
1347
+ }
1348
+ ],
1349
+ onSubmit: function (e) {
1350
+ CodeSample.insertCodeSample(editor, e.data.language, e.data.code);
1351
+ }
1352
+ });
1353
+ }
1354
+ };
1355
+ }
1356
+ );
1357
+ /**
1358
+ * Commands.js
1359
+ *
1360
+ * Released under LGPL License.
1361
+ * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
1362
+ *
1363
+ * License: http://www.tinymce.com/license
1364
+ * Contributing: http://www.tinymce.com/contributing
1365
+ */
1366
+
1367
+ define(
1368
+ 'tinymce.plugins.codesample.api.Commands',
1369
+ [
1370
+ 'tinymce.plugins.codesample.ui.Dialog',
1371
+ 'tinymce.plugins.codesample.util.Utils'
1372
+ ],
1373
+ function (Dialog, Utils) {
1374
+ var register = function (editor) {
1375
+ editor.addCommand('codesample', function () {
1376
+ var node = editor.selection.getNode();
1377
+ if (editor.selection.isCollapsed() || Utils.isCodeSample(node)) {
1378
+ Dialog.open(editor);
1379
+ } else {
1380
+ editor.formatter.toggle('code');
1381
+ }
1382
+ });
1383
+ };
1384
+
1385
+ return {
1386
+ register: register
1387
+ };
1388
+ }
1389
+ );
1390
+ /**
1391
+ * FilterContent.js
1392
+ *
1393
+ * Released under LGPL License.
1394
+ * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
1395
+ *
1396
+ * License: http://www.tinymce.com/license
1397
+ * Contributing: http://www.tinymce.com/contributing
1398
+ */
1399
+
1400
+ define(
1401
+ 'tinymce.plugins.codesample.core.FilterContent',
1402
+ [
1403
+ 'tinymce.plugins.codesample.core.Prism',
1404
+ 'tinymce.plugins.codesample.util.Utils'
1405
+ ],
1406
+ function (Prism, Utils) {
1407
+ var setup = function (editor) {
1408
+ var $ = editor.$;
1409
+
1410
+ editor.on('PreProcess', function (e) {
1411
+ $('pre[contenteditable=false]', e.node).
1412
+ filter(Utils.trimArg(Utils.isCodeSample)).
1413
+ each(function (idx, elm) {
1414
+ var $elm = $(elm), code = elm.textContent;
1415
+
1416
+ $elm.attr('class', $.trim($elm.attr('class')));
1417
+ $elm.removeAttr('contentEditable');
1418
+
1419
+ $elm.empty().append($('<code></code>').each(function () {
1420
+ // Needs to be textContent since innerText produces BR:s
1421
+ this.textContent = code;
1422
+ }));
1423
+ });
1424
+ });
1425
+
1426
+ editor.on('SetContent', function () {
1427
+ var unprocessedCodeSamples = $('pre').filter(Utils.trimArg(Utils.isCodeSample)).filter(function (idx, elm) {
1428
+ return elm.contentEditable !== "false";
1429
+ });
1430
+
1431
+ if (unprocessedCodeSamples.length) {
1432
+ editor.undoManager.transact(function () {
1433
+ unprocessedCodeSamples.each(function (idx, elm) {
1434
+ $(elm).find('br').each(function (idx, elm) {
1435
+ elm.parentNode.replaceChild(editor.getDoc().createTextNode('\n'), elm);
1436
+ });
1437
+
1438
+ elm.contentEditable = false;
1439
+ elm.innerHTML = editor.dom.encode(elm.textContent);
1440
+ Prism.highlightElement(elm);
1441
+ elm.className = $.trim(elm.className);
1442
+ });
1443
+ });
1444
+ }
1445
+ });
1446
+ };
1447
+
1448
+ return {
1449
+ setup: setup
1450
+ };
1451
+ }
1452
+ );
1453
+ /**
1454
+ * LoadCss.js
1455
+ *
1456
+ * Released under LGPL License.
1457
+ * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
1458
+ *
1459
+ * License: http://www.tinymce.com/license
1460
+ * Contributing: http://www.tinymce.com/contributing
1461
+ */
1462
+
1463
+ define(
1464
+ 'tinymce.plugins.codesample.core.LoadCss',
1465
+ [
1466
+ 'tinymce.plugins.codesample.api.Settings'
1467
+ ],
1468
+ function (Settings) {
1469
+ // Todo: use a proper css loader here
1470
+ var loadCss = function (editor, pluginUrl, addedInlineCss, addedCss) {
1471
+ var linkElm, contentCss = Settings.getContentCss(editor);
1472
+
1473
+ if (editor.inline && addedInlineCss.get()) {
1474
+ return;
1475
+ }
1476
+
1477
+ if (!editor.inline && addedCss.get()) {
1478
+ return;
1479
+ }
1480
+
1481
+ if (editor.inline) {
1482
+ addedInlineCss.set(true);
1483
+ } else {
1484
+ addedCss.set(true);
1485
+ }
1486
+
1487
+ if (contentCss !== false) {
1488
+ linkElm = editor.dom.create('link', {
1489
+ rel: 'stylesheet',
1490
+ href: contentCss ? contentCss : pluginUrl + '/css/prism.css'
1491
+ });
1492
+
1493
+ editor.getDoc().getElementsByTagName('head')[0].appendChild(linkElm);
1494
+ }
1495
+ };
1496
+
1497
+ return {
1498
+ loadCss: loadCss
1499
+ };
1500
+ }
1501
+ );
1502
+ /**
1503
+ * Buttons.js
1504
+ *
1505
+ * Released under LGPL License.
1506
+ * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
1507
+ *
1508
+ * License: http://www.tinymce.com/license
1509
+ * Contributing: http://www.tinymce.com/contributing
1510
+ */
1511
+
1512
+ define(
1513
+ 'tinymce.plugins.codesample.ui.Buttons',
1514
+ [
1515
+ ],
1516
+ function () {
1517
+ var register = function (editor) {
1518
+ editor.addButton('codesample', {
1519
+ cmd: 'codesample',
1520
+ title: 'Insert/Edit code sample'
1521
+ });
1522
+
1523
+ editor.addMenuItem('codesample', {
1524
+ cmd: 'codesample',
1525
+ text: 'Code sample',
1526
+ icon: 'codesample'
1527
+ });
1528
+ };
1529
+
1530
+ return {
1531
+ register: register
1532
+ };
1533
+ }
1534
+ );
1535
+ /**
1536
+ * Plugin.js
1537
+ *
1538
+ * Released under LGPL License.
1539
+ * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
1540
+ *
1541
+ * License: http://www.tinymce.com/license
1542
+ * Contributing: http://www.tinymce.com/contributing
1543
+ */
1544
+
1545
+ define(
1546
+ 'tinymce.plugins.codesample.Plugin',
1547
+ [
1548
+ 'ephox.katamari.api.Cell',
1549
+ 'tinymce.core.PluginManager',
1550
+ 'tinymce.plugins.codesample.api.Commands',
1551
+ 'tinymce.plugins.codesample.core.FilterContent',
1552
+ 'tinymce.plugins.codesample.core.LoadCss',
1553
+ 'tinymce.plugins.codesample.ui.Buttons',
1554
+ 'tinymce.plugins.codesample.ui.Dialog',
1555
+ 'tinymce.plugins.codesample.util.Utils'
1556
+ ],
1557
+ function (Cell, PluginManager, Commands, FilterContent, LoadCss, Buttons, Dialog, Utils) {
1558
+ var addedInlineCss = Cell(false);
1559
+
1560
+ PluginManager.add('codesample', function (editor, pluginUrl) {
1561
+ var addedCss = Cell(false);
1562
+
1563
+ FilterContent.setup(editor);
1564
+ Buttons.register(editor);
1565
+ Commands.register(editor);
1566
+
1567
+ editor.on('init', function () {
1568
+ LoadCss.loadCss(editor, pluginUrl, addedInlineCss, addedCss);
1569
+ });
1570
+
1571
+ editor.on('dblclick', function (ev) {
1572
+ if (Utils.isCodeSample(ev.target)) {
1573
+ Dialog.open(editor);
1574
+ }
1575
+ });
1576
+ });
1577
+
1578
+ return function () { };
1579
+ }
1580
+ );
1581
+ dem('tinymce.plugins.codesample.Plugin')();
1582
+ })();