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,436 +0,0 @@
1
- /**
2
- * Plugin.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
- /*jshint camelcase:false */
12
-
13
- /**
14
- * This class contains all core logic for the spellchecker plugin.
15
- *
16
- * @class tinymce.spellcheckerplugin.Plugin
17
- * @private
18
- */
19
- define("tinymce/spellcheckerplugin/Plugin", [
20
- "tinymce/spellcheckerplugin/DomTextMatcher",
21
- "tinymce/PluginManager",
22
- "tinymce/util/Tools",
23
- "tinymce/ui/Menu",
24
- "tinymce/dom/DOMUtils",
25
- "tinymce/util/XHR",
26
- "tinymce/util/URI",
27
- "tinymce/util/JSON"
28
- ], function(DomTextMatcher, PluginManager, Tools, Menu, DOMUtils, XHR, URI, JSON) {
29
- PluginManager.add('spellchecker', function(editor, url) {
30
- var languageMenuItems, self = this, lastSuggestions, started, suggestionsMenu, settings = editor.settings;
31
- var hasDictionarySupport;
32
-
33
- function getTextMatcher() {
34
- if (!self.textMatcher) {
35
- self.textMatcher = new DomTextMatcher(editor.getBody(), editor);
36
- }
37
-
38
- return self.textMatcher;
39
- }
40
-
41
- function buildMenuItems(listName, languageValues) {
42
- var items = [];
43
-
44
- Tools.each(languageValues, function(languageValue) {
45
- items.push({
46
- selectable: true,
47
- text: languageValue.name,
48
- data: languageValue.value
49
- });
50
- });
51
-
52
- return items;
53
- }
54
-
55
- var languagesString = settings.spellchecker_languages ||
56
- 'English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr_FR,' +
57
- 'German=de,Italian=it,Polish=pl,Portuguese=pt_BR,' +
58
- 'Spanish=es,Swedish=sv';
59
-
60
- languageMenuItems = buildMenuItems('Language',
61
- Tools.map(languagesString.split(','), function(langPair) {
62
- langPair = langPair.split('=');
63
-
64
- return {
65
- name: langPair[0],
66
- value: langPair[1]
67
- };
68
- })
69
- );
70
-
71
- function isEmpty(obj) {
72
- /*jshint unused:false*/
73
- /*eslint no-unused-vars:0 */
74
- for (var name in obj) {
75
- return false;
76
- }
77
-
78
- return true;
79
- }
80
-
81
- function showSuggestions(word, spans) {
82
- var items = [], suggestions = lastSuggestions[word];
83
-
84
- Tools.each(suggestions, function(suggestion) {
85
- items.push({
86
- text: suggestion,
87
- onclick: function() {
88
- editor.insertContent(editor.dom.encode(suggestion));
89
- editor.dom.remove(spans);
90
- checkIfFinished();
91
- }
92
- });
93
- });
94
-
95
- items.push({text: '-'});
96
-
97
- if (hasDictionarySupport) {
98
- items.push({text: 'Add to Dictionary', onclick: function() {
99
- addToDictionary(word, spans);
100
- }});
101
- }
102
-
103
- items.push.apply(items, [
104
- {text: 'Ignore', onclick: function() {
105
- ignoreWord(word, spans);
106
- }},
107
-
108
- {text: 'Ignore all', onclick: function() {
109
- ignoreWord(word, spans, true);
110
- }}
111
- ]);
112
-
113
- // Render menu
114
- suggestionsMenu = new Menu({
115
- items: items,
116
- context: 'contextmenu',
117
- onautohide: function(e) {
118
- if (e.target.className.indexOf('spellchecker') != -1) {
119
- e.preventDefault();
120
- }
121
- },
122
- onhide: function() {
123
- suggestionsMenu.remove();
124
- suggestionsMenu = null;
125
- }
126
- });
127
-
128
- suggestionsMenu.renderTo(document.body);
129
-
130
- // Position menu
131
- var pos = DOMUtils.DOM.getPos(editor.getContentAreaContainer());
132
- var targetPos = editor.dom.getPos(spans[0]);
133
- var root = editor.dom.getRoot();
134
-
135
- // Adjust targetPos for scrolling in the editor
136
- if (root.nodeName == 'BODY') {
137
- targetPos.x -= root.ownerDocument.documentElement.scrollLeft || root.scrollLeft;
138
- targetPos.y -= root.ownerDocument.documentElement.scrollTop || root.scrollTop;
139
- } else {
140
- targetPos.x -= root.scrollLeft;
141
- targetPos.y -= root.scrollTop;
142
- }
143
-
144
- pos.x += targetPos.x;
145
- pos.y += targetPos.y;
146
-
147
- suggestionsMenu.moveTo(pos.x, pos.y + spans[0].offsetHeight);
148
- }
149
-
150
- function getWordCharPattern() {
151
- // Regexp for finding word specific characters this will split words by
152
- // spaces, quotes, copy right characters etc. It's escaped with unicode characters
153
- // to make it easier to output scripts on servers using different encodings
154
- // so if you add any characters outside the 128 byte range make sure to escape it
155
- return editor.getParam('spellchecker_wordchar_pattern') || new RegExp("[^" +
156
- "\\s!\"#$%&()*+,-./:;<=>?@[\\]^_{|}`" +
157
- "\u00a7\u00a9\u00ab\u00ae\u00b1\u00b6\u00b7\u00b8\u00bb" +
158
- "\u00bc\u00bd\u00be\u00bf\u00d7\u00f7\u00a4\u201d\u201c\u201e\u00a0\u2002\u2003\u2009" +
159
- "]+", "g");
160
- }
161
-
162
- function defaultSpellcheckCallback(method, text, doneCallback, errorCallback) {
163
- var data = {method: method}, postData = '';
164
-
165
- if (method == "spellcheck") {
166
- data.text = text;
167
- data.lang = settings.spellchecker_language;
168
- }
169
-
170
- if (method == "addToDictionary") {
171
- data.word = text;
172
- }
173
-
174
- Tools.each(data, function(value, key) {
175
- if (postData) {
176
- postData += '&';
177
- }
178
-
179
- postData += key + '=' + encodeURIComponent(value);
180
- });
181
-
182
- XHR.send({
183
- url: new URI(url).toAbsolute(settings.spellchecker_rpc_url),
184
- type: "post",
185
- content_type: 'application/x-www-form-urlencoded',
186
- data: postData,
187
- success: function(result) {
188
- result = JSON.parse(result);
189
-
190
- if (!result) {
191
- errorCallback("Sever response wasn't proper JSON.");
192
- } else if (result.error) {
193
- errorCallback(result.error);
194
- } else {
195
- doneCallback(result);
196
- }
197
- },
198
- error: function(type, xhr) {
199
- errorCallback("Spellchecker request error: " + xhr.status);
200
- }
201
- });
202
- }
203
-
204
- function sendRpcCall(name, data, successCallback, errorCallback) {
205
- var spellCheckCallback = settings.spellchecker_callback || defaultSpellcheckCallback;
206
- spellCheckCallback.call(self, name, data, successCallback, errorCallback);
207
- }
208
-
209
- function spellcheck() {
210
- if (started) {
211
- finish();
212
- return;
213
- } else {
214
- finish();
215
- }
216
-
217
- function errorCallback(message) {
218
- editor.windowManager.alert(message);
219
- editor.setProgressState(false);
220
- finish();
221
- }
222
-
223
- editor.setProgressState(true);
224
- sendRpcCall("spellcheck", getTextMatcher().text, markErrors, errorCallback);
225
- editor.focus();
226
- }
227
-
228
- function checkIfFinished() {
229
- if (!editor.dom.select('span.mce-spellchecker-word').length) {
230
- finish();
231
- }
232
- }
233
-
234
- function addToDictionary(word, spans) {
235
- editor.setProgressState(true);
236
-
237
- sendRpcCall("addToDictionary", word, function() {
238
- editor.setProgressState(false);
239
- editor.dom.remove(spans, true);
240
- checkIfFinished();
241
- }, function(message) {
242
- editor.windowManager.alert(message);
243
- editor.setProgressState(false);
244
- });
245
- }
246
-
247
- function ignoreWord(word, spans, all) {
248
- editor.selection.collapse();
249
-
250
- if (all) {
251
- Tools.each(editor.dom.select('span.mce-spellchecker-word'), function(span) {
252
- if (span.getAttribute('data-mce-word') == word) {
253
- editor.dom.remove(span, true);
254
- }
255
- });
256
- } else {
257
- editor.dom.remove(spans, true);
258
- }
259
-
260
- checkIfFinished();
261
- }
262
-
263
- function finish() {
264
- getTextMatcher().reset();
265
- self.textMatcher = null;
266
-
267
- if (started) {
268
- started = false;
269
- editor.fire('SpellcheckEnd');
270
- }
271
- }
272
-
273
- function getElmIndex(elm) {
274
- var value = elm.getAttribute('data-mce-index');
275
-
276
- if (typeof(value) == "number") {
277
- return "" + value;
278
- }
279
-
280
- return value;
281
- }
282
-
283
- function findSpansByIndex(index) {
284
- var nodes, spans = [];
285
-
286
- nodes = Tools.toArray(editor.getBody().getElementsByTagName('span'));
287
- if (nodes.length) {
288
- for (var i = 0; i < nodes.length; i++) {
289
- var nodeIndex = getElmIndex(nodes[i]);
290
-
291
- if (nodeIndex === null || !nodeIndex.length) {
292
- continue;
293
- }
294
-
295
- if (nodeIndex === index.toString()) {
296
- spans.push(nodes[i]);
297
- }
298
- }
299
- }
300
-
301
- return spans;
302
- }
303
-
304
- editor.on('click', function(e) {
305
- var target = e.target;
306
-
307
- if (target.className == "mce-spellchecker-word") {
308
- e.preventDefault();
309
-
310
- var spans = findSpansByIndex(getElmIndex(target));
311
-
312
- if (spans.length > 0) {
313
- var rng = editor.dom.createRng();
314
- rng.setStartBefore(spans[0]);
315
- rng.setEndAfter(spans[spans.length - 1]);
316
- editor.selection.setRng(rng);
317
- showSuggestions(target.getAttribute('data-mce-word'), spans);
318
- }
319
- }
320
- });
321
-
322
- editor.addMenuItem('spellchecker', {
323
- text: 'Spellcheck',
324
- context: 'tools',
325
- onclick: spellcheck,
326
- selectable: true,
327
- onPostRender: function() {
328
- var self = this;
329
-
330
- self.active(started);
331
-
332
- editor.on('SpellcheckStart SpellcheckEnd', function() {
333
- self.active(started);
334
- });
335
- }
336
- });
337
-
338
- function updateSelection(e) {
339
- var selectedLanguage = settings.spellchecker_language;
340
-
341
- e.control.items().each(function(ctrl) {
342
- ctrl.active(ctrl.settings.data === selectedLanguage);
343
- });
344
- }
345
-
346
- /**
347
- * Find the specified words and marks them. It will also show suggestions for those words.
348
- *
349
- * @example
350
- * editor.plugins.spellchecker.markErrors({
351
- * dictionary: true,
352
- * words: {
353
- * "word1": ["suggestion 1", "Suggestion 2"]
354
- * }
355
- * });
356
- * @param {Object} data Data object containing the words with suggestions.
357
- */
358
- function markErrors(data) {
359
- var suggestions;
360
-
361
- if (data.words) {
362
- hasDictionarySupport = !!data.dictionary;
363
- suggestions = data.words;
364
- } else {
365
- // Fallback to old format
366
- suggestions = data;
367
- }
368
-
369
- editor.setProgressState(false);
370
-
371
- if (isEmpty(suggestions)) {
372
- editor.windowManager.alert('No misspellings found');
373
- started = false;
374
- return;
375
- }
376
-
377
- lastSuggestions = suggestions;
378
-
379
- getTextMatcher().find(getWordCharPattern()).filter(function(match) {
380
- return !!suggestions[match.text];
381
- }).wrap(function(match) {
382
- return editor.dom.create('span', {
383
- "class": 'mce-spellchecker-word',
384
- "data-mce-bogus": 1,
385
- "data-mce-word": match.text
386
- });
387
- });
388
-
389
- started = true;
390
- editor.fire('SpellcheckStart');
391
- }
392
-
393
- var buttonArgs = {
394
- tooltip: 'Spellcheck',
395
- onclick: spellcheck,
396
- onPostRender: function() {
397
- var self = this;
398
-
399
- editor.on('SpellcheckStart SpellcheckEnd', function() {
400
- self.active(started);
401
- });
402
- }
403
- };
404
-
405
- if (languageMenuItems.length > 1) {
406
- buttonArgs.type = 'splitbutton';
407
- buttonArgs.menu = languageMenuItems;
408
- buttonArgs.onshow = updateSelection;
409
- buttonArgs.onselect = function(e) {
410
- settings.spellchecker_language = e.control.settings.data;
411
- };
412
- }
413
-
414
- editor.addButton('spellchecker', buttonArgs);
415
- editor.addCommand('mceSpellCheck', spellcheck);
416
-
417
- editor.on('remove', function() {
418
- if (suggestionsMenu) {
419
- suggestionsMenu.remove();
420
- suggestionsMenu = null;
421
- }
422
- });
423
-
424
- editor.on('change', checkIfFinished);
425
-
426
- this.getTextMatcher = getTextMatcher;
427
- this.getWordCharPattern = getWordCharPattern;
428
- this.markErrors = markErrors;
429
- this.getLanguage = function() {
430
- return settings.spellchecker_language;
431
- };
432
-
433
- // Set default spellchecker language if it's not specified
434
- settings.spellchecker_language = settings.spellchecker_language || settings.language || 'en';
435
- });
436
- });
@@ -1,117 +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/spellcheckerplugin/DomTextMatcher"]);
110
-
111
- load('classes/DomTextMatcher.js');
112
- load('classes/Plugin.js');
113
-
114
- writeScripts();
115
- })(this);
116
-
117
- // $hash: 8869896f1265f5c8b422a19894956678