mirador_rails 0.3.3 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (193) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +6 -0
  3. data/app/controllers/mirador_rails/locales_controller.rb +10 -0
  4. data/config/routes.rb +7 -0
  5. data/lib/mirador_rails/exceptions.rb +6 -0
  6. data/lib/mirador_rails/locale.rb +24 -0
  7. data/lib/mirador_rails/version.rb +1 -1
  8. data/lib/mirador_rails.rb +9 -2
  9. data/mirador_rails.gemspec +3 -0
  10. data/tasks/mirador_rails.rake +44 -10
  11. data/vendor/assets/images/border_type_4.png +0 -0
  12. data/vendor/assets/images/border_type_5.png +0 -0
  13. data/vendor/assets/javascripts/mirador/mirador.js.erb +20105 -0
  14. data/vendor/assets/javascripts/mirador.js +4 -1
  15. data/vendor/assets/locales/de/translation.json +3 -0
  16. data/vendor/assets/locales/en/translation.json +11 -7
  17. data/vendor/assets/locales/ko/translation.json +18 -9
  18. data/vendor/assets/stylesheets/enhancements.scss +36 -0
  19. data/vendor/assets/stylesheets/mirador-combined.css +1488 -1642
  20. data/vendor/assets/stylesheets/mirador.css +1 -0
  21. metadata +52 -174
  22. data/vendor/assets/javascripts/mirador.min.js +0 -89
  23. data/vendor/assets/javascripts/mirador.min.js.map +0 -1
  24. data/vendor/assets/plugins/plugins/advlist/plugin.js +0 -97
  25. data/vendor/assets/plugins/plugins/advlist/plugin.min.js +0 -1
  26. data/vendor/assets/plugins/plugins/anchor/plugin.js +0 -45
  27. data/vendor/assets/plugins/plugins/anchor/plugin.min.js +0 -1
  28. data/vendor/assets/plugins/plugins/autolink/plugin.js +0 -194
  29. data/vendor/assets/plugins/plugins/autolink/plugin.min.js +0 -1
  30. data/vendor/assets/plugins/plugins/autoresize/plugin.js +0 -152
  31. data/vendor/assets/plugins/plugins/autoresize/plugin.min.js +0 -1
  32. data/vendor/assets/plugins/plugins/autosave/plugin.js +0 -165
  33. data/vendor/assets/plugins/plugins/autosave/plugin.min.js +0 -1
  34. data/vendor/assets/plugins/plugins/bbcode/plugin.js +0 -123
  35. data/vendor/assets/plugins/plugins/bbcode/plugin.min.js +0 -1
  36. data/vendor/assets/plugins/plugins/charmap/plugin.js +0 -370
  37. data/vendor/assets/plugins/plugins/charmap/plugin.min.js +0 -1
  38. data/vendor/assets/plugins/plugins/code/plugin.js +0 -60
  39. data/vendor/assets/plugins/plugins/code/plugin.min.js +0 -1
  40. data/vendor/assets/plugins/plugins/colorpicker/plugin.js +0 -112
  41. data/vendor/assets/plugins/plugins/colorpicker/plugin.min.js +0 -1
  42. data/vendor/assets/plugins/plugins/compat3x/css/dialog.css +0 -118
  43. data/vendor/assets/plugins/plugins/compat3x/img/buttons.png +0 -0
  44. data/vendor/assets/plugins/plugins/compat3x/img/icons.gif +0 -0
  45. data/vendor/assets/plugins/plugins/compat3x/img/items.gif +0 -0
  46. data/vendor/assets/plugins/plugins/compat3x/img/menu_arrow.gif +0 -0
  47. data/vendor/assets/plugins/plugins/compat3x/img/menu_check.gif +0 -0
  48. data/vendor/assets/plugins/plugins/compat3x/img/progress.gif +0 -0
  49. data/vendor/assets/plugins/plugins/compat3x/img/tabs.gif +0 -0
  50. data/vendor/assets/plugins/plugins/compat3x/plugin.js +0 -297
  51. data/vendor/assets/plugins/plugins/compat3x/plugin.min.js +0 -1
  52. data/vendor/assets/plugins/plugins/compat3x/tiny_mce_popup.js +0 -542
  53. data/vendor/assets/plugins/plugins/compat3x/utils/editable_selects.js +0 -70
  54. data/vendor/assets/plugins/plugins/compat3x/utils/form_utils.js +0 -210
  55. data/vendor/assets/plugins/plugins/compat3x/utils/mctabs.js +0 -164
  56. data/vendor/assets/plugins/plugins/compat3x/utils/validate.js +0 -252
  57. data/vendor/assets/plugins/plugins/contextmenu/plugin.js +0 -87
  58. data/vendor/assets/plugins/plugins/contextmenu/plugin.min.js +0 -1
  59. data/vendor/assets/plugins/plugins/directionality/plugin.js +0 -64
  60. data/vendor/assets/plugins/plugins/directionality/plugin.min.js +0 -1
  61. data/vendor/assets/plugins/plugins/emoticons/img/smiley-cool.gif +0 -0
  62. data/vendor/assets/plugins/plugins/emoticons/img/smiley-cry.gif +0 -0
  63. data/vendor/assets/plugins/plugins/emoticons/img/smiley-embarassed.gif +0 -0
  64. data/vendor/assets/plugins/plugins/emoticons/img/smiley-foot-in-mouth.gif +0 -0
  65. data/vendor/assets/plugins/plugins/emoticons/img/smiley-frown.gif +0 -0
  66. data/vendor/assets/plugins/plugins/emoticons/img/smiley-innocent.gif +0 -0
  67. data/vendor/assets/plugins/plugins/emoticons/img/smiley-kiss.gif +0 -0
  68. data/vendor/assets/plugins/plugins/emoticons/img/smiley-laughing.gif +0 -0
  69. data/vendor/assets/plugins/plugins/emoticons/img/smiley-money-mouth.gif +0 -0
  70. data/vendor/assets/plugins/plugins/emoticons/img/smiley-sealed.gif +0 -0
  71. data/vendor/assets/plugins/plugins/emoticons/img/smiley-smile.gif +0 -0
  72. data/vendor/assets/plugins/plugins/emoticons/img/smiley-surprised.gif +0 -0
  73. data/vendor/assets/plugins/plugins/emoticons/img/smiley-tongue-out.gif +0 -0
  74. data/vendor/assets/plugins/plugins/emoticons/img/smiley-undecided.gif +0 -0
  75. data/vendor/assets/plugins/plugins/emoticons/img/smiley-wink.gif +0 -0
  76. data/vendor/assets/plugins/plugins/emoticons/img/smiley-yell.gif +0 -0
  77. data/vendor/assets/plugins/plugins/emoticons/plugin.js +0 -65
  78. data/vendor/assets/plugins/plugins/emoticons/plugin.min.js +0 -1
  79. data/vendor/assets/plugins/plugins/example/dialog.html +0 -8
  80. data/vendor/assets/plugins/plugins/example/plugin.js +0 -68
  81. data/vendor/assets/plugins/plugins/example/plugin.min.js +0 -1
  82. data/vendor/assets/plugins/plugins/example_dependency/plugin.js +0 -22
  83. data/vendor/assets/plugins/plugins/example_dependency/plugin.min.js +0 -1
  84. data/vendor/assets/plugins/plugins/fullpage/plugin.js +0 -490
  85. data/vendor/assets/plugins/plugins/fullpage/plugin.min.js +0 -1
  86. data/vendor/assets/plugins/plugins/fullscreen/plugin.js +0 -136
  87. data/vendor/assets/plugins/plugins/fullscreen/plugin.min.js +0 -1
  88. data/vendor/assets/plugins/plugins/hr/plugin.js +0 -30
  89. data/vendor/assets/plugins/plugins/hr/plugin.min.js +0 -1
  90. data/vendor/assets/plugins/plugins/image/plugin.js +0 -439
  91. data/vendor/assets/plugins/plugins/image/plugin.min.js +0 -1
  92. data/vendor/assets/plugins/plugins/importcss/plugin.js +0 -195
  93. data/vendor/assets/plugins/plugins/importcss/plugin.min.js +0 -1
  94. data/vendor/assets/plugins/plugins/insertdatetime/plugin.js +0 -121
  95. data/vendor/assets/plugins/plugins/insertdatetime/plugin.min.js +0 -1
  96. data/vendor/assets/plugins/plugins/layer/plugin.js +0 -225
  97. data/vendor/assets/plugins/plugins/layer/plugin.min.js +0 -1
  98. data/vendor/assets/plugins/plugins/legacyoutput/plugin.js +0 -211
  99. data/vendor/assets/plugins/plugins/legacyoutput/plugin.min.js +0 -1
  100. data/vendor/assets/plugins/plugins/link/plugin.js +0 -400
  101. data/vendor/assets/plugins/plugins/link/plugin.min.js +0 -1
  102. data/vendor/assets/plugins/plugins/lists/plugin.js +0 -791
  103. data/vendor/assets/plugins/plugins/lists/plugin.min.js +0 -1
  104. data/vendor/assets/plugins/plugins/media/moxieplayer.swf +0 -0
  105. data/vendor/assets/plugins/plugins/media/plugin.js +0 -774
  106. data/vendor/assets/plugins/plugins/media/plugin.min.js +0 -1
  107. data/vendor/assets/plugins/plugins/nonbreaking/plugin.js +0 -53
  108. data/vendor/assets/plugins/plugins/nonbreaking/plugin.min.js +0 -1
  109. data/vendor/assets/plugins/plugins/noneditable/plugin.js +0 -540
  110. data/vendor/assets/plugins/plugins/noneditable/plugin.min.js +0 -1
  111. data/vendor/assets/plugins/plugins/pagebreak/plugin.js +0 -88
  112. data/vendor/assets/plugins/plugins/pagebreak/plugin.min.js +0 -1
  113. data/vendor/assets/plugins/plugins/paste/classes/Clipboard.js +0 -634
  114. data/vendor/assets/plugins/plugins/paste/classes/Plugin.js +0 -110
  115. data/vendor/assets/plugins/plugins/paste/classes/Quirks.js +0 -159
  116. data/vendor/assets/plugins/plugins/paste/classes/Utils.js +0 -130
  117. data/vendor/assets/plugins/plugins/paste/classes/WordFilter.js +0 -493
  118. data/vendor/assets/plugins/plugins/paste/plugin.dev.js +0 -120
  119. data/vendor/assets/plugins/plugins/paste/plugin.js +0 -1625
  120. data/vendor/assets/plugins/plugins/paste/plugin.min.js +0 -1
  121. data/vendor/assets/plugins/plugins/preview/plugin.js +0 -88
  122. data/vendor/assets/plugins/plugins/preview/plugin.min.js +0 -1
  123. data/vendor/assets/plugins/plugins/print/plugin.js +0 -32
  124. data/vendor/assets/plugins/plugins/print/plugin.min.js +0 -1
  125. data/vendor/assets/plugins/plugins/save/plugin.js +0 -94
  126. data/vendor/assets/plugins/plugins/save/plugin.min.js +0 -1
  127. data/vendor/assets/plugins/plugins/searchreplace/plugin.js +0 -594
  128. data/vendor/assets/plugins/plugins/searchreplace/plugin.min.js +0 -1
  129. data/vendor/assets/plugins/plugins/spellchecker/classes/DomTextMatcher.js +0 -470
  130. data/vendor/assets/plugins/plugins/spellchecker/classes/Plugin.js +0 -436
  131. data/vendor/assets/plugins/plugins/spellchecker/plugin.dev.js +0 -117
  132. data/vendor/assets/plugins/plugins/spellchecker/plugin.js +0 -996
  133. data/vendor/assets/plugins/plugins/spellchecker/plugin.min.js +0 -1
  134. data/vendor/assets/plugins/plugins/tabfocus/plugin.js +0 -120
  135. data/vendor/assets/plugins/plugins/tabfocus/plugin.min.js +0 -1
  136. data/vendor/assets/plugins/plugins/table/classes/CellSelection.js +0 -176
  137. data/vendor/assets/plugins/plugins/table/classes/Dialogs.js +0 -749
  138. data/vendor/assets/plugins/plugins/table/classes/Plugin.js +0 -422
  139. data/vendor/assets/plugins/plugins/table/classes/Quirks.js +0 -372
  140. data/vendor/assets/plugins/plugins/table/classes/TableGrid.js +0 -864
  141. data/vendor/assets/plugins/plugins/table/plugin.dev.js +0 -118
  142. data/vendor/assets/plugins/plugins/table/plugin.js +0 -2680
  143. data/vendor/assets/plugins/plugins/table/plugin.min.js +0 -1
  144. data/vendor/assets/plugins/plugins/template/plugin.js +0 -262
  145. data/vendor/assets/plugins/plugins/template/plugin.min.js +0 -1
  146. data/vendor/assets/plugins/plugins/textcolor/plugin.js +0 -272
  147. data/vendor/assets/plugins/plugins/textcolor/plugin.min.js +0 -1
  148. data/vendor/assets/plugins/plugins/textpattern/plugin.js +0 -268
  149. data/vendor/assets/plugins/plugins/textpattern/plugin.min.js +0 -1
  150. data/vendor/assets/plugins/plugins/visualblocks/css/visualblocks.css +0 -135
  151. data/vendor/assets/plugins/plugins/visualblocks/img/address.gif +0 -0
  152. data/vendor/assets/plugins/plugins/visualblocks/img/article.gif +0 -0
  153. data/vendor/assets/plugins/plugins/visualblocks/img/aside.gif +0 -0
  154. data/vendor/assets/plugins/plugins/visualblocks/img/blockquote.gif +0 -0
  155. data/vendor/assets/plugins/plugins/visualblocks/img/div.gif +0 -0
  156. data/vendor/assets/plugins/plugins/visualblocks/img/dl.gif +0 -0
  157. data/vendor/assets/plugins/plugins/visualblocks/img/figure.gif +0 -0
  158. data/vendor/assets/plugins/plugins/visualblocks/img/h1.gif +0 -0
  159. data/vendor/assets/plugins/plugins/visualblocks/img/h2.gif +0 -0
  160. data/vendor/assets/plugins/plugins/visualblocks/img/h3.gif +0 -0
  161. data/vendor/assets/plugins/plugins/visualblocks/img/h4.gif +0 -0
  162. data/vendor/assets/plugins/plugins/visualblocks/img/h5.gif +0 -0
  163. data/vendor/assets/plugins/plugins/visualblocks/img/h6.gif +0 -0
  164. data/vendor/assets/plugins/plugins/visualblocks/img/hgroup.gif +0 -0
  165. data/vendor/assets/plugins/plugins/visualblocks/img/ol.gif +0 -0
  166. data/vendor/assets/plugins/plugins/visualblocks/img/p.gif +0 -0
  167. data/vendor/assets/plugins/plugins/visualblocks/img/pre.gif +0 -0
  168. data/vendor/assets/plugins/plugins/visualblocks/img/section.gif +0 -0
  169. data/vendor/assets/plugins/plugins/visualblocks/img/ul.gif +0 -0
  170. data/vendor/assets/plugins/plugins/visualblocks/plugin.js +0 -86
  171. data/vendor/assets/plugins/plugins/visualblocks/plugin.min.js +0 -1
  172. data/vendor/assets/plugins/plugins/visualchars/plugin.js +0 -88
  173. data/vendor/assets/plugins/plugins/visualchars/plugin.min.js +0 -1
  174. data/vendor/assets/plugins/plugins/wordcount/plugin.js +0 -69
  175. data/vendor/assets/plugins/plugins/wordcount/plugin.min.js +0 -1
  176. data/vendor/assets/skins/skins/lightgray/content.inline.min.css +0 -1
  177. data/vendor/assets/skins/skins/lightgray/content.min.css +0 -1
  178. data/vendor/assets/skins/skins/lightgray/fonts/tinymce-small.eot +0 -0
  179. data/vendor/assets/skins/skins/lightgray/fonts/tinymce-small.svg +0 -62
  180. data/vendor/assets/skins/skins/lightgray/fonts/tinymce-small.ttf +0 -0
  181. data/vendor/assets/skins/skins/lightgray/fonts/tinymce-small.woff +0 -0
  182. data/vendor/assets/skins/skins/lightgray/fonts/tinymce.eot +0 -0
  183. data/vendor/assets/skins/skins/lightgray/fonts/tinymce.svg +0 -63
  184. data/vendor/assets/skins/skins/lightgray/fonts/tinymce.ttf +0 -0
  185. data/vendor/assets/skins/skins/lightgray/fonts/tinymce.woff +0 -0
  186. data/vendor/assets/skins/skins/lightgray/img/anchor.gif +0 -0
  187. data/vendor/assets/skins/skins/lightgray/img/loader.gif +0 -0
  188. data/vendor/assets/skins/skins/lightgray/img/object.gif +0 -0
  189. data/vendor/assets/skins/skins/lightgray/img/trans.gif +0 -0
  190. data/vendor/assets/skins/skins/lightgray/skin.ie7.min.css +0 -1
  191. data/vendor/assets/skins/skins/lightgray/skin.min.css +0 -1
  192. data/vendor/assets/themes/themes/modern/theme.js +0 -617
  193. data/vendor/assets/themes/themes/modern/theme.min.js +0 -1
@@ -1,493 +0,0 @@
1
- /**
2
- * WordFilter.js
3
- *
4
- * Copyright, Moxiecode Systems AB
5
- * Released under LGPL License.
6
- *
7
- * License: http://www.tinymce.com/license
8
- * Contributing: http://www.tinymce.com/contributing
9
- */
10
-
11
- /**
12
- * This class parses word HTML into proper TinyMCE markup.
13
- *
14
- * @class tinymce.pasteplugin.Quirks
15
- * @private
16
- */
17
- define("tinymce/pasteplugin/WordFilter", [
18
- "tinymce/util/Tools",
19
- "tinymce/html/DomParser",
20
- "tinymce/html/Schema",
21
- "tinymce/html/Serializer",
22
- "tinymce/html/Node",
23
- "tinymce/pasteplugin/Utils"
24
- ], function(Tools, DomParser, Schema, Serializer, Node, Utils) {
25
- /**
26
- * Checks if the specified content is from any of the following sources: MS Word/Office 365/Google docs.
27
- */
28
- function isWordContent(content) {
29
- return (
30
- (/<font face="Times New Roman"|class="?Mso|style="[^"]*\bmso-|style='[^'']*\bmso-|w:WordDocument/i).test(content) ||
31
- (/class="OutlineElement/).test(content) ||
32
- (/id="?docs\-internal\-guid\-/.test(content))
33
- );
34
- }
35
-
36
- /**
37
- * Checks if the specified text starts with "1. " or "a. " etc.
38
- */
39
- function isNumericList(text) {
40
- var found, patterns;
41
-
42
- patterns = [
43
- /^[IVXLMCD]{1,2}\.[ \u00a0]/, // Roman upper case
44
- /^[ivxlmcd]{1,2}\.[ \u00a0]/, // Roman lower case
45
- /^[a-z]{1,2}[\.\)][ \u00a0]/, // Alphabetical a-z
46
- /^[A-Z]{1,2}[\.\)][ \u00a0]/, // Alphabetical A-Z
47
- /^[0-9]+\.[ \u00a0]/, // Numeric lists
48
- /^[\u3007\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d]+\.[ \u00a0]/, // Japanese
49
- /^[\u58f1\u5f10\u53c2\u56db\u4f0d\u516d\u4e03\u516b\u4e5d\u62fe]+\.[ \u00a0]/ // Chinese
50
- ];
51
-
52
- text = text.replace(/^[\u00a0 ]+/, '');
53
-
54
- Tools.each(patterns, function(pattern) {
55
- if (pattern.test(text)) {
56
- found = true;
57
- return false;
58
- }
59
- });
60
-
61
- return found;
62
- }
63
-
64
- function isBulletList(text) {
65
- return /^[\s\u00a0]*[\u2022\u00b7\u00a7\u00d8\u25CF]\s*/.test(text);
66
- }
67
-
68
- function WordFilter(editor) {
69
- var settings = editor.settings;
70
-
71
- editor.on('BeforePastePreProcess', function(e) {
72
- var content = e.content, retainStyleProperties, validStyles;
73
-
74
- retainStyleProperties = settings.paste_retain_style_properties;
75
- if (retainStyleProperties) {
76
- validStyles = Tools.makeMap(retainStyleProperties.split(/[, ]/));
77
- }
78
-
79
- /**
80
- * Converts fake bullet and numbered lists to real semantic OL/UL.
81
- *
82
- * @param {tinymce.html.Node} node Root node to convert children of.
83
- */
84
- function convertFakeListsToProperLists(node) {
85
- var currentListNode, prevListNode, lastLevel = 1;
86
-
87
- function getText(node) {
88
- var txt = '';
89
-
90
- if (node.type === 3) {
91
- return node.value;
92
- }
93
-
94
- if ((node = node.firstChild)) {
95
- do {
96
- txt += getText(node);
97
- } while ((node = node.next));
98
- }
99
-
100
- return txt;
101
- }
102
-
103
- function trimListStart(node, regExp) {
104
- if (node.type === 3) {
105
- if (regExp.test(node.value)) {
106
- node.value = node.value.replace(regExp, '');
107
- return false;
108
- }
109
- }
110
-
111
- if ((node = node.firstChild)) {
112
- do {
113
- if (!trimListStart(node, regExp)) {
114
- return false;
115
- }
116
- } while ((node = node.next));
117
- }
118
-
119
- return true;
120
- }
121
-
122
- function removeIgnoredNodes(node) {
123
- if (node._listIgnore) {
124
- node.remove();
125
- return;
126
- }
127
-
128
- if ((node = node.firstChild)) {
129
- do {
130
- removeIgnoredNodes(node);
131
- } while ((node = node.next));
132
- }
133
- }
134
-
135
- function convertParagraphToLi(paragraphNode, listName, start) {
136
- var level = paragraphNode._listLevel || lastLevel;
137
-
138
- // Handle list nesting
139
- if (level != lastLevel) {
140
- if (level < lastLevel) {
141
- // Move to parent list
142
- if (currentListNode) {
143
- currentListNode = currentListNode.parent.parent;
144
- }
145
- } else {
146
- // Create new list
147
- prevListNode = currentListNode;
148
- currentListNode = null;
149
- }
150
- }
151
-
152
- if (!currentListNode || currentListNode.name != listName) {
153
- prevListNode = prevListNode || currentListNode;
154
- currentListNode = new Node(listName, 1);
155
-
156
- if (start > 1) {
157
- currentListNode.attr('start', '' + start);
158
- }
159
-
160
- paragraphNode.wrap(currentListNode);
161
- } else {
162
- currentListNode.append(paragraphNode);
163
- }
164
-
165
- paragraphNode.name = 'li';
166
-
167
- // Append list to previous list if it exists
168
- if (level > lastLevel && prevListNode) {
169
- prevListNode.lastChild.append(currentListNode);
170
- }
171
-
172
- lastLevel = level;
173
-
174
- // Remove start of list item "1. " or "&middot; " etc
175
- removeIgnoredNodes(paragraphNode);
176
- trimListStart(paragraphNode, /^\u00a0+/);
177
- trimListStart(paragraphNode, /^\s*([\u2022\u00b7\u00a7\u00d8\u25CF]|\w+\.)/);
178
- trimListStart(paragraphNode, /^\u00a0+/);
179
- }
180
-
181
- // Build a list of all root level elements before we start
182
- // altering them in the loop below.
183
- var elements = [], child = node.firstChild;
184
- while (typeof child !== 'undefined' && child !== null) {
185
- elements.push(child);
186
-
187
- child = child.walk();
188
- if (child !== null) {
189
- while (typeof child !== 'undefined' && child.parent !== node) {
190
- child = child.walk();
191
- }
192
- }
193
- }
194
-
195
- for (var i = 0; i < elements.length; i++) {
196
- node = elements[i];
197
-
198
- if (node.name == 'p' && node.firstChild) {
199
- // Find first text node in paragraph
200
- var nodeText = getText(node);
201
-
202
- // Detect unordered lists look for bullets
203
- if (isBulletList(nodeText)) {
204
- convertParagraphToLi(node, 'ul');
205
- continue;
206
- }
207
-
208
- // Detect ordered lists 1., a. or ixv.
209
- if (isNumericList(nodeText)) {
210
- // Parse OL start number
211
- var matches = /([0-9]+)\./.exec(nodeText);
212
- var start = 1;
213
- if (matches) {
214
- start = parseInt(matches[1], 10);
215
- }
216
-
217
- convertParagraphToLi(node, 'ol', start);
218
- continue;
219
- }
220
-
221
- // Convert paragraphs marked as lists but doesn't look like anything
222
- if (node._listLevel) {
223
- convertParagraphToLi(node, 'ul', 1);
224
- continue;
225
- }
226
-
227
- currentListNode = null;
228
- } else {
229
- // If the root level element isn't a p tag which can be
230
- // processed by convertParagraphToLi, it interrupts the
231
- // lists, causing a new list to start instead of having
232
- // elements from the next list inserted above this tag.
233
- prevListNode = currentListNode;
234
- currentListNode = null;
235
- }
236
- }
237
- }
238
-
239
- function filterStyles(node, styleValue) {
240
- var outputStyles = {}, matches, styles = editor.dom.parseStyle(styleValue);
241
-
242
- Tools.each(styles, function(value, name) {
243
- // Convert various MS styles to W3C styles
244
- switch (name) {
245
- case 'mso-list':
246
- // Parse out list indent level for lists
247
- matches = /\w+ \w+([0-9]+)/i.exec(styleValue);
248
- if (matches) {
249
- node._listLevel = parseInt(matches[1], 10);
250
- }
251
-
252
- // Remove these nodes <span style="mso-list:Ignore">o</span>
253
- // Since the span gets removed we mark the text node and the span
254
- if (/Ignore/i.test(value) && node.firstChild) {
255
- node._listIgnore = true;
256
- node.firstChild._listIgnore = true;
257
- }
258
-
259
- break;
260
-
261
- case "horiz-align":
262
- name = "text-align";
263
- break;
264
-
265
- case "vert-align":
266
- name = "vertical-align";
267
- break;
268
-
269
- case "font-color":
270
- case "mso-foreground":
271
- name = "color";
272
- break;
273
-
274
- case "mso-background":
275
- case "mso-highlight":
276
- name = "background";
277
- break;
278
-
279
- case "font-weight":
280
- case "font-style":
281
- if (value != "normal") {
282
- outputStyles[name] = value;
283
- }
284
- return;
285
-
286
- case "mso-element":
287
- // Remove track changes code
288
- if (/^(comment|comment-list)$/i.test(value)) {
289
- node.remove();
290
- return;
291
- }
292
-
293
- break;
294
- }
295
-
296
- if (name.indexOf('mso-comment') === 0) {
297
- node.remove();
298
- return;
299
- }
300
-
301
- // Never allow mso- prefixed names
302
- if (name.indexOf('mso-') === 0) {
303
- return;
304
- }
305
-
306
- // Output only valid styles
307
- if (retainStyleProperties == "all" || (validStyles && validStyles[name])) {
308
- outputStyles[name] = value;
309
- }
310
- });
311
-
312
- // Convert bold style to "b" element
313
- if (/(bold)/i.test(outputStyles["font-weight"])) {
314
- delete outputStyles["font-weight"];
315
- node.wrap(new Node("b", 1));
316
- }
317
-
318
- // Convert italic style to "i" element
319
- if (/(italic)/i.test(outputStyles["font-style"])) {
320
- delete outputStyles["font-style"];
321
- node.wrap(new Node("i", 1));
322
- }
323
-
324
- // Serialize the styles and see if there is something left to keep
325
- outputStyles = editor.dom.serializeStyle(outputStyles, node.name);
326
- if (outputStyles) {
327
- return outputStyles;
328
- }
329
-
330
- return null;
331
- }
332
-
333
- if (settings.paste_enable_default_filters === false) {
334
- return;
335
- }
336
-
337
- // Detect is the contents is Word junk HTML
338
- if (isWordContent(e.content)) {
339
- e.wordContent = true; // Mark it for other processors
340
-
341
- // Remove basic Word junk
342
- content = Utils.filter(content, [
343
- // Word comments like conditional comments etc
344
- /<!--[\s\S]+?-->/gi,
345
-
346
- // Remove comments, scripts (e.g., msoShowComment), XML tag, VML content,
347
- // MS Office namespaced tags, and a few other tags
348
- /<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi,
349
-
350
- // Convert <s> into <strike> for line-though
351
- [/<(\/?)s>/gi, "<$1strike>"],
352
-
353
- // Replace nsbp entites to char since it's easier to handle
354
- [/&nbsp;/gi, "\u00a0"],
355
-
356
- // Convert <span style="mso-spacerun:yes">___</span> to string of alternating
357
- // breaking/non-breaking spaces of same length
358
- [/<span\s+style\s*=\s*"\s*mso-spacerun\s*:\s*yes\s*;?\s*"\s*>([\s\u00a0]*)<\/span>/gi,
359
- function(str, spaces) {
360
- return (spaces.length > 0) ?
361
- spaces.replace(/./, " ").slice(Math.floor(spaces.length / 2)).split("").join("\u00a0") : "";
362
- }
363
- ]
364
- ]);
365
-
366
- var validElements = settings.paste_word_valid_elements;
367
- if (!validElements) {
368
- validElements = (
369
- '-strong/b,-em/i,-u,-span,-p,-ol,-ul,-li,-h1,-h2,-h3,-h4,-h5,-h6,' +
370
- '-p/div,-a[href|name],sub,sup,strike,br,del,table[width],tr,' +
371
- 'td[colspan|rowspan|width],th[colspan|rowspan|width],thead,tfoot,tbody'
372
- );
373
- }
374
-
375
- // Setup strict schema
376
- var schema = new Schema({
377
- valid_elements: validElements,
378
- valid_children: '-li[p]'
379
- });
380
-
381
- // Add style/class attribute to all element rules since the user might have removed them from
382
- // paste_word_valid_elements config option and we need to check them for properties
383
- Tools.each(schema.elements, function(rule) {
384
- if (!rule.attributes["class"]) {
385
- rule.attributes["class"] = {};
386
- rule.attributesOrder.push("class");
387
- }
388
-
389
- if (!rule.attributes.style) {
390
- rule.attributes.style = {};
391
- rule.attributesOrder.push("style");
392
- }
393
- });
394
-
395
- // Parse HTML into DOM structure
396
- var domParser = new DomParser({}, schema);
397
-
398
- // Filter styles to remove "mso" specific styles and convert some of them
399
- domParser.addAttributeFilter('style', function(nodes) {
400
- var i = nodes.length, node;
401
-
402
- while (i--) {
403
- node = nodes[i];
404
- node.attr('style', filterStyles(node, node.attr('style')));
405
-
406
- // Remove pointess spans
407
- if (node.name == 'span' && node.parent && !node.attributes.length) {
408
- node.unwrap();
409
- }
410
- }
411
- });
412
-
413
- // Check the class attribute for comments or del items and remove those
414
- domParser.addAttributeFilter('class', function(nodes) {
415
- var i = nodes.length, node, className;
416
-
417
- while (i--) {
418
- node = nodes[i];
419
-
420
- className = node.attr('class');
421
- if (/^(MsoCommentReference|MsoCommentText|msoDel|MsoCaption)$/i.test(className)) {
422
- node.remove();
423
- }
424
-
425
- node.attr('class', null);
426
- }
427
- });
428
-
429
- // Remove all del elements since we don't want the track changes code in the editor
430
- domParser.addNodeFilter('del', function(nodes) {
431
- var i = nodes.length;
432
-
433
- while (i--) {
434
- nodes[i].remove();
435
- }
436
- });
437
-
438
- // Keep some of the links and anchors
439
- domParser.addNodeFilter('a', function(nodes) {
440
- var i = nodes.length, node, href, name;
441
-
442
- while (i--) {
443
- node = nodes[i];
444
- href = node.attr('href');
445
- name = node.attr('name');
446
-
447
- if (href && href.indexOf('#_msocom_') != -1) {
448
- node.remove();
449
- continue;
450
- }
451
-
452
- if (href && href.indexOf('file://') === 0) {
453
- href = href.split('#')[1];
454
- if (href) {
455
- href = '#' + href;
456
- }
457
- }
458
-
459
- if (!href && !name) {
460
- node.unwrap();
461
- } else {
462
- // Remove all named anchors that aren't specific to TOC, Footnotes or Endnotes
463
- if (name && !/^_?(?:toc|edn|ftn)/i.test(name)) {
464
- node.unwrap();
465
- continue;
466
- }
467
-
468
- node.attr({
469
- href: href,
470
- name: name
471
- });
472
- }
473
- }
474
- });
475
-
476
- // Parse into DOM structure
477
- var rootNode = domParser.parse(content);
478
-
479
- // Process DOM
480
- if (settings.paste_convert_word_fake_lists !== false) {
481
- convertFakeListsToProperLists(rootNode);
482
- }
483
-
484
- // Serialize DOM back to HTML
485
- e.content = new Serializer({}, schema).serialize(rootNode);
486
- }
487
- });
488
- }
489
-
490
- WordFilter.isWordContent = isWordContent;
491
-
492
- return WordFilter;
493
- });
@@ -1,120 +0,0 @@
1
- /**
2
- * Inline development version. Only to be used while developing since it uses document.write to load scripts.
3
- */
4
-
5
- /*jshint smarttabs:true, undef:true, latedef:true, curly:true, bitwise:true, camelcase:true */
6
- /*globals $code */
7
-
8
- (function(exports) {
9
- "use strict";
10
-
11
- var html = "", baseDir;
12
- var modules = {}, exposedModules = [], moduleCount = 0;
13
-
14
- var scripts = document.getElementsByTagName('script');
15
- for (var i = 0; i < scripts.length; i++) {
16
- var src = scripts[i].src;
17
-
18
- if (src.indexOf('/plugin.dev.js') != -1) {
19
- baseDir = src.substring(0, src.lastIndexOf('/'));
20
- }
21
- }
22
-
23
- function require(ids, callback) {
24
- var module, defs = [];
25
-
26
- for (var i = 0; i < ids.length; ++i) {
27
- module = modules[ids[i]] || resolve(ids[i]);
28
- if (!module) {
29
- throw 'module definition dependecy not found: ' + ids[i];
30
- }
31
-
32
- defs.push(module);
33
- }
34
-
35
- callback.apply(null, defs);
36
- }
37
-
38
- function resolve(id) {
39
- var target = exports;
40
- var fragments = id.split(/[.\/]/);
41
-
42
- for (var fi = 0; fi < fragments.length; ++fi) {
43
- if (!target[fragments[fi]]) {
44
- return;
45
- }
46
-
47
- target = target[fragments[fi]];
48
- }
49
-
50
- return target;
51
- }
52
-
53
- function register(id) {
54
- var target = exports;
55
- var fragments = id.split(/[.\/]/);
56
-
57
- for (var fi = 0; fi < fragments.length - 1; ++fi) {
58
- if (target[fragments[fi]] === undefined) {
59
- target[fragments[fi]] = {};
60
- }
61
-
62
- target = target[fragments[fi]];
63
- }
64
-
65
- target[fragments[fragments.length - 1]] = modules[id];
66
- }
67
-
68
- function define(id, dependencies, definition) {
69
- if (typeof id !== 'string') {
70
- throw 'invalid module definition, module id must be defined and be a string';
71
- }
72
-
73
- if (dependencies === undefined) {
74
- throw 'invalid module definition, dependencies must be specified';
75
- }
76
-
77
- if (definition === undefined) {
78
- throw 'invalid module definition, definition function must be specified';
79
- }
80
-
81
- require(dependencies, function() {
82
- modules[id] = definition.apply(null, arguments);
83
- });
84
-
85
- if (--moduleCount === 0) {
86
- for (var i = 0; i < exposedModules.length; i++) {
87
- register(exposedModules[i]);
88
- }
89
- }
90
- }
91
-
92
- function expose(ids) {
93
- exposedModules = ids;
94
- }
95
-
96
- function writeScripts() {
97
- document.write(html);
98
- }
99
-
100
- function load(path) {
101
- html += '<script type="text/javascript" src="' + baseDir + '/' + path + '"></script>\n';
102
- moduleCount++;
103
- }
104
-
105
- // Expose globally
106
- exports.define = define;
107
- exports.require = require;
108
-
109
- expose(["tinymce/pasteplugin/Utils","tinymce/pasteplugin/WordFilter"]);
110
-
111
- load('classes/Utils.js');
112
- load('classes/Clipboard.js');
113
- load('classes/WordFilter.js');
114
- load('classes/Quirks.js');
115
- load('classes/Plugin.js');
116
-
117
- writeScripts();
118
- })(this);
119
-
120
- // $hash: 8403b8385314b80e512b060ca1712a1e