mirador_rails 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (206) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +12 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +5 -0
  5. data/Gemfile +4 -0
  6. data/LICENSE.txt +13 -0
  7. data/README.md +97 -0
  8. data/Rakefile +6 -0
  9. data/bin/console +14 -0
  10. data/bin/setup +8 -0
  11. data/lib/mirador_rails.rb +16 -0
  12. data/lib/mirador_rails/version.rb +3 -0
  13. data/lib/mirador_rails/view_helpers.rb +30 -0
  14. data/mirador_rails.gemspec +30 -0
  15. data/vendor/assets/images/border_type_1.png +0 -0
  16. data/vendor/assets/images/border_type_2.png +0 -0
  17. data/vendor/assets/images/border_type_3.png +0 -0
  18. data/vendor/assets/images/debut_dark.png +0 -0
  19. data/vendor/assets/javascripts/mirador.js +1 -0
  20. data/vendor/assets/javascripts/mirador.min.js +88 -0
  21. data/vendor/assets/javascripts/mirador.min.js.map +1 -0
  22. data/vendor/assets/locales/ar/translation.json +42 -0
  23. data/vendor/assets/locales/de/translation.json +77 -0
  24. data/vendor/assets/locales/en/translation.json +82 -0
  25. data/vendor/assets/locales/es/translation.json +35 -0
  26. data/vendor/assets/locales/fr/translation.json +77 -0
  27. data/vendor/assets/locales/ga/translation.json +39 -0
  28. data/vendor/assets/locales/ja/translation.json +82 -0
  29. data/vendor/assets/locales/ko/translation.json +74 -0
  30. data/vendor/assets/locales/nl/translation.json +39 -0
  31. data/vendor/assets/locales/zh-CN/translation.json +74 -0
  32. data/vendor/assets/locales/zh-TW/translation.json +74 -0
  33. data/vendor/assets/locales/zh/translation.json +74 -0
  34. data/vendor/assets/plugins/plugins/advlist/plugin.js +97 -0
  35. data/vendor/assets/plugins/plugins/advlist/plugin.min.js +1 -0
  36. data/vendor/assets/plugins/plugins/anchor/plugin.js +45 -0
  37. data/vendor/assets/plugins/plugins/anchor/plugin.min.js +1 -0
  38. data/vendor/assets/plugins/plugins/autolink/plugin.js +194 -0
  39. data/vendor/assets/plugins/plugins/autolink/plugin.min.js +1 -0
  40. data/vendor/assets/plugins/plugins/autoresize/plugin.js +152 -0
  41. data/vendor/assets/plugins/plugins/autoresize/plugin.min.js +1 -0
  42. data/vendor/assets/plugins/plugins/autosave/plugin.js +165 -0
  43. data/vendor/assets/plugins/plugins/autosave/plugin.min.js +1 -0
  44. data/vendor/assets/plugins/plugins/bbcode/plugin.js +123 -0
  45. data/vendor/assets/plugins/plugins/bbcode/plugin.min.js +1 -0
  46. data/vendor/assets/plugins/plugins/charmap/plugin.js +370 -0
  47. data/vendor/assets/plugins/plugins/charmap/plugin.min.js +1 -0
  48. data/vendor/assets/plugins/plugins/code/plugin.js +60 -0
  49. data/vendor/assets/plugins/plugins/code/plugin.min.js +1 -0
  50. data/vendor/assets/plugins/plugins/colorpicker/plugin.js +112 -0
  51. data/vendor/assets/plugins/plugins/colorpicker/plugin.min.js +1 -0
  52. data/vendor/assets/plugins/plugins/compat3x/css/dialog.css +118 -0
  53. data/vendor/assets/plugins/plugins/compat3x/img/buttons.png +0 -0
  54. data/vendor/assets/plugins/plugins/compat3x/img/icons.gif +0 -0
  55. data/vendor/assets/plugins/plugins/compat3x/img/items.gif +0 -0
  56. data/vendor/assets/plugins/plugins/compat3x/img/menu_arrow.gif +0 -0
  57. data/vendor/assets/plugins/plugins/compat3x/img/menu_check.gif +0 -0
  58. data/vendor/assets/plugins/plugins/compat3x/img/progress.gif +0 -0
  59. data/vendor/assets/plugins/plugins/compat3x/img/tabs.gif +0 -0
  60. data/vendor/assets/plugins/plugins/compat3x/plugin.js +297 -0
  61. data/vendor/assets/plugins/plugins/compat3x/plugin.min.js +1 -0
  62. data/vendor/assets/plugins/plugins/compat3x/tiny_mce_popup.js +542 -0
  63. data/vendor/assets/plugins/plugins/compat3x/utils/editable_selects.js +70 -0
  64. data/vendor/assets/plugins/plugins/compat3x/utils/form_utils.js +210 -0
  65. data/vendor/assets/plugins/plugins/compat3x/utils/mctabs.js +164 -0
  66. data/vendor/assets/plugins/plugins/compat3x/utils/validate.js +252 -0
  67. data/vendor/assets/plugins/plugins/contextmenu/plugin.js +87 -0
  68. data/vendor/assets/plugins/plugins/contextmenu/plugin.min.js +1 -0
  69. data/vendor/assets/plugins/plugins/directionality/plugin.js +64 -0
  70. data/vendor/assets/plugins/plugins/directionality/plugin.min.js +1 -0
  71. data/vendor/assets/plugins/plugins/emoticons/img/smiley-cool.gif +0 -0
  72. data/vendor/assets/plugins/plugins/emoticons/img/smiley-cry.gif +0 -0
  73. data/vendor/assets/plugins/plugins/emoticons/img/smiley-embarassed.gif +0 -0
  74. data/vendor/assets/plugins/plugins/emoticons/img/smiley-foot-in-mouth.gif +0 -0
  75. data/vendor/assets/plugins/plugins/emoticons/img/smiley-frown.gif +0 -0
  76. data/vendor/assets/plugins/plugins/emoticons/img/smiley-innocent.gif +0 -0
  77. data/vendor/assets/plugins/plugins/emoticons/img/smiley-kiss.gif +0 -0
  78. data/vendor/assets/plugins/plugins/emoticons/img/smiley-laughing.gif +0 -0
  79. data/vendor/assets/plugins/plugins/emoticons/img/smiley-money-mouth.gif +0 -0
  80. data/vendor/assets/plugins/plugins/emoticons/img/smiley-sealed.gif +0 -0
  81. data/vendor/assets/plugins/plugins/emoticons/img/smiley-smile.gif +0 -0
  82. data/vendor/assets/plugins/plugins/emoticons/img/smiley-surprised.gif +0 -0
  83. data/vendor/assets/plugins/plugins/emoticons/img/smiley-tongue-out.gif +0 -0
  84. data/vendor/assets/plugins/plugins/emoticons/img/smiley-undecided.gif +0 -0
  85. data/vendor/assets/plugins/plugins/emoticons/img/smiley-wink.gif +0 -0
  86. data/vendor/assets/plugins/plugins/emoticons/img/smiley-yell.gif +0 -0
  87. data/vendor/assets/plugins/plugins/emoticons/plugin.js +65 -0
  88. data/vendor/assets/plugins/plugins/emoticons/plugin.min.js +1 -0
  89. data/vendor/assets/plugins/plugins/example/dialog.html +8 -0
  90. data/vendor/assets/plugins/plugins/example/plugin.js +68 -0
  91. data/vendor/assets/plugins/plugins/example/plugin.min.js +1 -0
  92. data/vendor/assets/plugins/plugins/example_dependency/plugin.js +22 -0
  93. data/vendor/assets/plugins/plugins/example_dependency/plugin.min.js +1 -0
  94. data/vendor/assets/plugins/plugins/fullpage/plugin.js +490 -0
  95. data/vendor/assets/plugins/plugins/fullpage/plugin.min.js +1 -0
  96. data/vendor/assets/plugins/plugins/fullscreen/plugin.js +136 -0
  97. data/vendor/assets/plugins/plugins/fullscreen/plugin.min.js +1 -0
  98. data/vendor/assets/plugins/plugins/hr/plugin.js +30 -0
  99. data/vendor/assets/plugins/plugins/hr/plugin.min.js +1 -0
  100. data/vendor/assets/plugins/plugins/image/plugin.js +439 -0
  101. data/vendor/assets/plugins/plugins/image/plugin.min.js +1 -0
  102. data/vendor/assets/plugins/plugins/importcss/plugin.js +195 -0
  103. data/vendor/assets/plugins/plugins/importcss/plugin.min.js +1 -0
  104. data/vendor/assets/plugins/plugins/insertdatetime/plugin.js +121 -0
  105. data/vendor/assets/plugins/plugins/insertdatetime/plugin.min.js +1 -0
  106. data/vendor/assets/plugins/plugins/layer/plugin.js +225 -0
  107. data/vendor/assets/plugins/plugins/layer/plugin.min.js +1 -0
  108. data/vendor/assets/plugins/plugins/legacyoutput/plugin.js +211 -0
  109. data/vendor/assets/plugins/plugins/legacyoutput/plugin.min.js +1 -0
  110. data/vendor/assets/plugins/plugins/link/plugin.js +400 -0
  111. data/vendor/assets/plugins/plugins/link/plugin.min.js +1 -0
  112. data/vendor/assets/plugins/plugins/lists/plugin.js +791 -0
  113. data/vendor/assets/plugins/plugins/lists/plugin.min.js +1 -0
  114. data/vendor/assets/plugins/plugins/media/moxieplayer.swf +0 -0
  115. data/vendor/assets/plugins/plugins/media/plugin.js +774 -0
  116. data/vendor/assets/plugins/plugins/media/plugin.min.js +1 -0
  117. data/vendor/assets/plugins/plugins/nonbreaking/plugin.js +53 -0
  118. data/vendor/assets/plugins/plugins/nonbreaking/plugin.min.js +1 -0
  119. data/vendor/assets/plugins/plugins/noneditable/plugin.js +540 -0
  120. data/vendor/assets/plugins/plugins/noneditable/plugin.min.js +1 -0
  121. data/vendor/assets/plugins/plugins/pagebreak/plugin.js +88 -0
  122. data/vendor/assets/plugins/plugins/pagebreak/plugin.min.js +1 -0
  123. data/vendor/assets/plugins/plugins/paste/classes/Clipboard.js +634 -0
  124. data/vendor/assets/plugins/plugins/paste/classes/Plugin.js +110 -0
  125. data/vendor/assets/plugins/plugins/paste/classes/Quirks.js +159 -0
  126. data/vendor/assets/plugins/plugins/paste/classes/Utils.js +130 -0
  127. data/vendor/assets/plugins/plugins/paste/classes/WordFilter.js +493 -0
  128. data/vendor/assets/plugins/plugins/paste/plugin.dev.js +120 -0
  129. data/vendor/assets/plugins/plugins/paste/plugin.js +1625 -0
  130. data/vendor/assets/plugins/plugins/paste/plugin.min.js +1 -0
  131. data/vendor/assets/plugins/plugins/preview/plugin.js +88 -0
  132. data/vendor/assets/plugins/plugins/preview/plugin.min.js +1 -0
  133. data/vendor/assets/plugins/plugins/print/plugin.js +32 -0
  134. data/vendor/assets/plugins/plugins/print/plugin.min.js +1 -0
  135. data/vendor/assets/plugins/plugins/save/plugin.js +94 -0
  136. data/vendor/assets/plugins/plugins/save/plugin.min.js +1 -0
  137. data/vendor/assets/plugins/plugins/searchreplace/plugin.js +594 -0
  138. data/vendor/assets/plugins/plugins/searchreplace/plugin.min.js +1 -0
  139. data/vendor/assets/plugins/plugins/spellchecker/classes/DomTextMatcher.js +470 -0
  140. data/vendor/assets/plugins/plugins/spellchecker/classes/Plugin.js +436 -0
  141. data/vendor/assets/plugins/plugins/spellchecker/plugin.dev.js +117 -0
  142. data/vendor/assets/plugins/plugins/spellchecker/plugin.js +996 -0
  143. data/vendor/assets/plugins/plugins/spellchecker/plugin.min.js +1 -0
  144. data/vendor/assets/plugins/plugins/tabfocus/plugin.js +120 -0
  145. data/vendor/assets/plugins/plugins/tabfocus/plugin.min.js +1 -0
  146. data/vendor/assets/plugins/plugins/table/classes/CellSelection.js +176 -0
  147. data/vendor/assets/plugins/plugins/table/classes/Dialogs.js +749 -0
  148. data/vendor/assets/plugins/plugins/table/classes/Plugin.js +422 -0
  149. data/vendor/assets/plugins/plugins/table/classes/Quirks.js +372 -0
  150. data/vendor/assets/plugins/plugins/table/classes/TableGrid.js +864 -0
  151. data/vendor/assets/plugins/plugins/table/plugin.dev.js +118 -0
  152. data/vendor/assets/plugins/plugins/table/plugin.js +2680 -0
  153. data/vendor/assets/plugins/plugins/table/plugin.min.js +1 -0
  154. data/vendor/assets/plugins/plugins/template/plugin.js +262 -0
  155. data/vendor/assets/plugins/plugins/template/plugin.min.js +1 -0
  156. data/vendor/assets/plugins/plugins/textcolor/plugin.js +272 -0
  157. data/vendor/assets/plugins/plugins/textcolor/plugin.min.js +1 -0
  158. data/vendor/assets/plugins/plugins/textpattern/plugin.js +268 -0
  159. data/vendor/assets/plugins/plugins/textpattern/plugin.min.js +1 -0
  160. data/vendor/assets/plugins/plugins/visualblocks/css/visualblocks.css +135 -0
  161. data/vendor/assets/plugins/plugins/visualblocks/img/address.gif +0 -0
  162. data/vendor/assets/plugins/plugins/visualblocks/img/article.gif +0 -0
  163. data/vendor/assets/plugins/plugins/visualblocks/img/aside.gif +0 -0
  164. data/vendor/assets/plugins/plugins/visualblocks/img/blockquote.gif +0 -0
  165. data/vendor/assets/plugins/plugins/visualblocks/img/div.gif +0 -0
  166. data/vendor/assets/plugins/plugins/visualblocks/img/dl.gif +0 -0
  167. data/vendor/assets/plugins/plugins/visualblocks/img/figure.gif +0 -0
  168. data/vendor/assets/plugins/plugins/visualblocks/img/h1.gif +0 -0
  169. data/vendor/assets/plugins/plugins/visualblocks/img/h2.gif +0 -0
  170. data/vendor/assets/plugins/plugins/visualblocks/img/h3.gif +0 -0
  171. data/vendor/assets/plugins/plugins/visualblocks/img/h4.gif +0 -0
  172. data/vendor/assets/plugins/plugins/visualblocks/img/h5.gif +0 -0
  173. data/vendor/assets/plugins/plugins/visualblocks/img/h6.gif +0 -0
  174. data/vendor/assets/plugins/plugins/visualblocks/img/hgroup.gif +0 -0
  175. data/vendor/assets/plugins/plugins/visualblocks/img/ol.gif +0 -0
  176. data/vendor/assets/plugins/plugins/visualblocks/img/p.gif +0 -0
  177. data/vendor/assets/plugins/plugins/visualblocks/img/pre.gif +0 -0
  178. data/vendor/assets/plugins/plugins/visualblocks/img/section.gif +0 -0
  179. data/vendor/assets/plugins/plugins/visualblocks/img/ul.gif +0 -0
  180. data/vendor/assets/plugins/plugins/visualblocks/plugin.js +86 -0
  181. data/vendor/assets/plugins/plugins/visualblocks/plugin.min.js +1 -0
  182. data/vendor/assets/plugins/plugins/visualchars/plugin.js +88 -0
  183. data/vendor/assets/plugins/plugins/visualchars/plugin.min.js +1 -0
  184. data/vendor/assets/plugins/plugins/wordcount/plugin.js +69 -0
  185. data/vendor/assets/plugins/plugins/wordcount/plugin.min.js +1 -0
  186. data/vendor/assets/skins/skins/lightgray/content.inline.min.css +1 -0
  187. data/vendor/assets/skins/skins/lightgray/content.min.css +1 -0
  188. data/vendor/assets/skins/skins/lightgray/fonts/tinymce-small.eot +0 -0
  189. data/vendor/assets/skins/skins/lightgray/fonts/tinymce-small.svg +62 -0
  190. data/vendor/assets/skins/skins/lightgray/fonts/tinymce-small.ttf +0 -0
  191. data/vendor/assets/skins/skins/lightgray/fonts/tinymce-small.woff +0 -0
  192. data/vendor/assets/skins/skins/lightgray/fonts/tinymce.eot +0 -0
  193. data/vendor/assets/skins/skins/lightgray/fonts/tinymce.svg +63 -0
  194. data/vendor/assets/skins/skins/lightgray/fonts/tinymce.ttf +0 -0
  195. data/vendor/assets/skins/skins/lightgray/fonts/tinymce.woff +0 -0
  196. data/vendor/assets/skins/skins/lightgray/img/anchor.gif +0 -0
  197. data/vendor/assets/skins/skins/lightgray/img/loader.gif +0 -0
  198. data/vendor/assets/skins/skins/lightgray/img/object.gif +0 -0
  199. data/vendor/assets/skins/skins/lightgray/img/trans.gif +0 -0
  200. data/vendor/assets/skins/skins/lightgray/skin.ie7.min.css +1 -0
  201. data/vendor/assets/skins/skins/lightgray/skin.min.css +1 -0
  202. data/vendor/assets/stylesheets/mirador-combined.css +3969 -0
  203. data/vendor/assets/stylesheets/mirador.css +11 -0
  204. data/vendor/assets/themes/themes/modern/theme.js +617 -0
  205. data/vendor/assets/themes/themes/modern/theme.min.js +1 -0
  206. metadata +318 -0
@@ -0,0 +1 @@
1
+ tinymce.PluginManager.add("autolink",function(a){function b(a){e(a,-1,"(",!0)}function c(a){e(a,0,"",!0)}function d(a){e(a,-1,"",!1)}function e(a,b,c){function d(a,b){if(0>b&&(b=0),3==a.nodeType){var c=a.data.length;b>c&&(b=c)}return b}function e(a,b){1!=a.nodeType||a.hasChildNodes()?g.setStart(a,d(a,b)):g.setStartBefore(a)}function f(a,b){1!=a.nodeType||a.hasChildNodes()?g.setEnd(a,d(a,b)):g.setEndAfter(a)}var g,h,i,j,k,l,m,n,o,p;if(g=a.selection.getRng(!0).cloneRange(),g.startOffset<5){if(n=g.endContainer.previousSibling,!n){if(!g.endContainer.firstChild||!g.endContainer.firstChild.nextSibling)return;n=g.endContainer.firstChild.nextSibling}if(o=n.length,e(n,o),f(n,o),g.endOffset<5)return;h=g.endOffset,j=n}else{if(j=g.endContainer,3!=j.nodeType&&j.firstChild){for(;3!=j.nodeType&&j.firstChild;)j=j.firstChild;3==j.nodeType&&(e(j,0),f(j,j.nodeValue.length))}h=1==g.endOffset?2:g.endOffset-1-b}i=h;do e(j,h>=2?h-2:0),f(j,h>=1?h-1:0),h-=1,p=g.toString();while(" "!=p&&""!==p&&160!=p.charCodeAt(0)&&h-2>=0&&p!=c);g.toString()==c||160==g.toString().charCodeAt(0)?(e(j,h),f(j,i),h+=1):0===g.startOffset?(e(j,0),f(j,i)):(e(j,h),f(j,i)),l=g.toString(),"."==l.charAt(l.length-1)&&f(j,i-1),l=g.toString(),m=l.match(/^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.|(?:mailto:)?[A-Z0-9._%+\-]+@)(.+)$/i),m&&("www."==m[1]?m[1]="http://www.":/@$/.test(m[1])&&!/^mailto:/.test(m[1])&&(m[1]="mailto:"+m[1]),k=a.selection.getBookmark(),a.selection.setRng(g),a.execCommand("createlink",!1,m[1]+m[2]),a.selection.moveToBookmark(k),a.nodeChanged())}var f;return a.on("keydown",function(b){return 13==b.keyCode?d(a):void 0}),tinymce.Env.ie?void a.on("focus",function(){if(!f){f=!0;try{a.execCommand("AutoUrlDetect",!1,!0)}catch(b){}}}):(a.on("keypress",function(c){return 41==c.keyCode?b(a):void 0}),void a.on("keyup",function(b){return 32==b.keyCode?c(a):void 0}))});
@@ -0,0 +1,152 @@
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
+ /*global tinymce:true */
12
+ /*eslint no-nested-ternary:0 */
13
+
14
+ /**
15
+ * Auto Resize
16
+ *
17
+ * This plugin automatically resizes the content area to fit its content height.
18
+ * It will retain a minimum height, which is the height of the content area when
19
+ * it's initialized.
20
+ */
21
+ tinymce.PluginManager.add('autoresize', function(editor) {
22
+ var settings = editor.settings, oldSize = 0;
23
+
24
+ function isFullscreen() {
25
+ return editor.plugins.fullscreen && editor.plugins.fullscreen.isFullscreen();
26
+ }
27
+
28
+ if (editor.settings.inline) {
29
+ return;
30
+ }
31
+
32
+ /**
33
+ * This method gets executed each time the editor needs to resize.
34
+ */
35
+ function resize(e) {
36
+ var deltaSize, doc, body, docElm, DOM = tinymce.DOM, resizeHeight, myHeight,
37
+ marginTop, marginBottom, paddingTop, paddingBottom, borderTop, borderBottom;
38
+
39
+ doc = editor.getDoc();
40
+ if (!doc) {
41
+ return;
42
+ }
43
+
44
+ body = doc.body;
45
+ docElm = doc.documentElement;
46
+ resizeHeight = settings.autoresize_min_height;
47
+
48
+ if (!body || (e && e.type === "setcontent" && e.initial) || isFullscreen()) {
49
+ if (body && docElm) {
50
+ body.style.overflowY = "auto";
51
+ docElm.style.overflowY = "auto"; // Old IE
52
+ }
53
+
54
+ return;
55
+ }
56
+
57
+ // Calculate outer height of the body element using CSS styles
58
+ marginTop = editor.dom.getStyle(body, 'margin-top', true);
59
+ marginBottom = editor.dom.getStyle(body, 'margin-bottom', true);
60
+ paddingTop = editor.dom.getStyle(body, 'padding-top', true);
61
+ paddingBottom = editor.dom.getStyle(body, 'padding-bottom', true);
62
+ borderTop = editor.dom.getStyle(body, 'border-top-width', true);
63
+ borderBottom = editor.dom.getStyle(body, 'border-bottom-width', true);
64
+ myHeight = body.offsetHeight + parseInt(marginTop, 10) + parseInt(marginBottom, 10) +
65
+ parseInt(paddingTop, 10) + parseInt(paddingBottom, 10) +
66
+ parseInt(borderTop, 10) + parseInt(borderBottom, 10);
67
+
68
+ // Make sure we have a valid height
69
+ if (isNaN(myHeight) || myHeight <= 0) {
70
+ // Get height differently depending on the browser used
71
+ myHeight = tinymce.Env.ie ? body.scrollHeight : (tinymce.Env.webkit && body.clientHeight === 0 ? 0 : body.offsetHeight);
72
+ }
73
+
74
+ // Don't make it smaller than the minimum height
75
+ if (myHeight > settings.autoresize_min_height) {
76
+ resizeHeight = myHeight;
77
+ }
78
+
79
+ // If a maximum height has been defined don't exceed this height
80
+ if (settings.autoresize_max_height && myHeight > settings.autoresize_max_height) {
81
+ resizeHeight = settings.autoresize_max_height;
82
+ body.style.overflowY = "auto";
83
+ docElm.style.overflowY = "auto"; // Old IE
84
+ } else {
85
+ body.style.overflowY = "hidden";
86
+ docElm.style.overflowY = "hidden"; // Old IE
87
+ body.scrollTop = 0;
88
+ }
89
+
90
+ // Resize content element
91
+ if (resizeHeight !== oldSize) {
92
+ deltaSize = resizeHeight - oldSize;
93
+ DOM.setStyle(editor.iframeElement, 'height', resizeHeight + 'px');
94
+ oldSize = resizeHeight;
95
+
96
+ // WebKit doesn't decrease the size of the body element until the iframe gets resized
97
+ // So we need to continue to resize the iframe down until the size gets fixed
98
+ if (tinymce.isWebKit && deltaSize < 0) {
99
+ resize(e);
100
+ }
101
+ }
102
+ }
103
+
104
+ /**
105
+ * Calls the resize x times in 100ms intervals. We can't wait for load events since
106
+ * the CSS files might load async.
107
+ */
108
+ function wait(times, interval, callback) {
109
+ setTimeout(function() {
110
+ resize({});
111
+
112
+ if (times--) {
113
+ wait(times, interval, callback);
114
+ } else if (callback) {
115
+ callback();
116
+ }
117
+ }, interval);
118
+ }
119
+
120
+ // Define minimum height
121
+ settings.autoresize_min_height = parseInt(editor.getParam('autoresize_min_height', editor.getElement().offsetHeight), 10);
122
+
123
+ // Define maximum height
124
+ settings.autoresize_max_height = parseInt(editor.getParam('autoresize_max_height', 0), 10);
125
+
126
+ // Add padding at the bottom for better UX
127
+ editor.on("init", function() {
128
+ var overflowPadding = editor.getParam('autoresize_overflow_padding', 1);
129
+
130
+ editor.dom.setStyles(editor.getBody(), {
131
+ paddingBottom: editor.getParam('autoresize_bottom_margin', 50),
132
+ paddingLeft: overflowPadding,
133
+ paddingRight: overflowPadding
134
+ });
135
+ });
136
+
137
+ // Add appropriate listeners for resizing content area
138
+ editor.on("nodechange setcontent keyup FullscreenStateChanged", resize);
139
+
140
+ if (editor.getParam('autoresize_on_init', true)) {
141
+ editor.on('init', function() {
142
+ // Hit it 20 times in 100 ms intervals
143
+ wait(20, 100, function() {
144
+ // Hit it 5 times in 1 sec intervals
145
+ wait(5, 1000);
146
+ });
147
+ });
148
+ }
149
+
150
+ // Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
151
+ editor.addCommand('mceAutoResize', resize);
152
+ });
@@ -0,0 +1 @@
1
+ tinymce.PluginManager.add("autoresize",function(a){function b(){return a.plugins.fullscreen&&a.plugins.fullscreen.isFullscreen()}function c(d){var g,h,i,j,k,l,m,n,o,p,q,r,s=tinymce.DOM;if(h=a.getDoc()){if(i=h.body,j=h.documentElement,k=e.autoresize_min_height,!i||d&&"setcontent"===d.type&&d.initial||b())return void(i&&j&&(i.style.overflowY="auto",j.style.overflowY="auto"));m=a.dom.getStyle(i,"margin-top",!0),n=a.dom.getStyle(i,"margin-bottom",!0),o=a.dom.getStyle(i,"padding-top",!0),p=a.dom.getStyle(i,"padding-bottom",!0),q=a.dom.getStyle(i,"border-top-width",!0),r=a.dom.getStyle(i,"border-bottom-width",!0),l=i.offsetHeight+parseInt(m,10)+parseInt(n,10)+parseInt(o,10)+parseInt(p,10)+parseInt(q,10)+parseInt(r,10),(isNaN(l)||0>=l)&&(l=tinymce.Env.ie?i.scrollHeight:tinymce.Env.webkit&&0===i.clientHeight?0:i.offsetHeight),l>e.autoresize_min_height&&(k=l),e.autoresize_max_height&&l>e.autoresize_max_height?(k=e.autoresize_max_height,i.style.overflowY="auto",j.style.overflowY="auto"):(i.style.overflowY="hidden",j.style.overflowY="hidden",i.scrollTop=0),k!==f&&(g=k-f,s.setStyle(a.iframeElement,"height",k+"px"),f=k,tinymce.isWebKit&&0>g&&c(d))}}function d(a,b,e){setTimeout(function(){c({}),a--?d(a,b,e):e&&e()},b)}var e=a.settings,f=0;a.settings.inline||(e.autoresize_min_height=parseInt(a.getParam("autoresize_min_height",a.getElement().offsetHeight),10),e.autoresize_max_height=parseInt(a.getParam("autoresize_max_height",0),10),a.on("init",function(){var b=a.getParam("autoresize_overflow_padding",1);a.dom.setStyles(a.getBody(),{paddingBottom:a.getParam("autoresize_bottom_margin",50),paddingLeft:b,paddingRight:b})}),a.on("nodechange setcontent keyup FullscreenStateChanged",c),a.getParam("autoresize_on_init",!0)&&a.on("init",function(){d(20,100,function(){d(5,1e3)})}),a.addCommand("mceAutoResize",c))});
@@ -0,0 +1,165 @@
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
+ /*global tinymce:true */
12
+
13
+ // Internal unload handler will be called before the page is unloaded
14
+ // Needs to be outside the plugin since it would otherwise keep
15
+ // a reference to editor in closue scope
16
+ /*eslint no-func-assign:0 */
17
+ tinymce._beforeUnloadHandler = function() {
18
+ var msg;
19
+
20
+ tinymce.each(tinymce.editors, function(editor) {
21
+ // Store a draft for each editor instance
22
+ if (editor.plugins.autosave) {
23
+ editor.plugins.autosave.storeDraft();
24
+ }
25
+
26
+ // Setup a return message if the editor is dirty
27
+ if (!msg && editor.isDirty() && editor.getParam("autosave_ask_before_unload", true)) {
28
+ msg = editor.translate("You have unsaved changes are you sure you want to navigate away?");
29
+ }
30
+ });
31
+
32
+ return msg;
33
+ };
34
+
35
+ tinymce.PluginManager.add('autosave', function(editor) {
36
+ var settings = editor.settings, LocalStorage = tinymce.util.LocalStorage, prefix, started;
37
+
38
+ prefix = settings.autosave_prefix || 'tinymce-autosave-{path}{query}-{id}-';
39
+ prefix = prefix.replace(/\{path\}/g, document.location.pathname);
40
+ prefix = prefix.replace(/\{query\}/g, document.location.search);
41
+ prefix = prefix.replace(/\{id\}/g, editor.id);
42
+
43
+ function parseTime(time, defaultTime) {
44
+ var multipels = {
45
+ s: 1000,
46
+ m: 60000
47
+ };
48
+
49
+ time = /^(\d+)([ms]?)$/.exec('' + (time || defaultTime));
50
+
51
+ return (time[2] ? multipels[time[2]] : 1) * parseInt(time, 10);
52
+ }
53
+
54
+ function hasDraft() {
55
+ var time = parseInt(LocalStorage.getItem(prefix + "time"), 10) || 0;
56
+
57
+ if (new Date().getTime() - time > settings.autosave_retention) {
58
+ removeDraft(false);
59
+ return false;
60
+ }
61
+
62
+ return true;
63
+ }
64
+
65
+ function removeDraft(fire) {
66
+ LocalStorage.removeItem(prefix + "draft");
67
+ LocalStorage.removeItem(prefix + "time");
68
+
69
+ if (fire !== false) {
70
+ editor.fire('RemoveDraft');
71
+ }
72
+ }
73
+
74
+ function storeDraft() {
75
+ if (!isEmpty() && editor.isDirty()) {
76
+ LocalStorage.setItem(prefix + "draft", editor.getContent({format: 'raw', no_events: true}));
77
+ LocalStorage.setItem(prefix + "time", new Date().getTime());
78
+ editor.fire('StoreDraft');
79
+ }
80
+ }
81
+
82
+ function restoreDraft() {
83
+ if (hasDraft()) {
84
+ editor.setContent(LocalStorage.getItem(prefix + "draft"), {format: 'raw'});
85
+ editor.fire('RestoreDraft');
86
+ }
87
+ }
88
+
89
+ function startStoreDraft() {
90
+ if (!started) {
91
+ setInterval(function() {
92
+ if (!editor.removed) {
93
+ storeDraft();
94
+ }
95
+ }, settings.autosave_interval);
96
+
97
+ started = true;
98
+ }
99
+ }
100
+
101
+ settings.autosave_interval = parseTime(settings.autosave_interval, '30s');
102
+ settings.autosave_retention = parseTime(settings.autosave_retention, '20m');
103
+
104
+ function postRender() {
105
+ var self = this;
106
+
107
+ self.disabled(!hasDraft());
108
+
109
+ editor.on('StoreDraft RestoreDraft RemoveDraft', function() {
110
+ self.disabled(!hasDraft());
111
+ });
112
+
113
+ startStoreDraft();
114
+ }
115
+
116
+ function restoreLastDraft() {
117
+ editor.undoManager.beforeChange();
118
+ restoreDraft();
119
+ removeDraft();
120
+ editor.undoManager.add();
121
+ }
122
+
123
+ editor.addButton('restoredraft', {
124
+ title: 'Restore last draft',
125
+ onclick: restoreLastDraft,
126
+ onPostRender: postRender
127
+ });
128
+
129
+ editor.addMenuItem('restoredraft', {
130
+ text: 'Restore last draft',
131
+ onclick: restoreLastDraft,
132
+ onPostRender: postRender,
133
+ context: 'file'
134
+ });
135
+
136
+ function isEmpty(html) {
137
+ var forcedRootBlockName = editor.settings.forced_root_block;
138
+
139
+ html = tinymce.trim(typeof(html) == "undefined" ? editor.getBody().innerHTML : html);
140
+
141
+ return html === '' || new RegExp(
142
+ '^<' + forcedRootBlockName + '[^>]*>((\u00a0|&nbsp;|[ \t]|<br[^>]*>)+?|)<\/' + forcedRootBlockName + '>|<br>$', 'i'
143
+ ).test(html);
144
+ }
145
+
146
+ if (editor.settings.autosave_restore_when_empty !== false) {
147
+ editor.on('init', function() {
148
+ if (hasDraft() && isEmpty()) {
149
+ restoreDraft();
150
+ }
151
+ });
152
+
153
+ editor.on('saveContent', function() {
154
+ removeDraft();
155
+ });
156
+ }
157
+
158
+ window.onbeforeunload = tinymce._beforeUnloadHandler;
159
+
160
+ this.hasDraft = hasDraft;
161
+ this.storeDraft = storeDraft;
162
+ this.restoreDraft = restoreDraft;
163
+ this.removeDraft = removeDraft;
164
+ this.isEmpty = isEmpty;
165
+ });
@@ -0,0 +1 @@
1
+ tinymce._beforeUnloadHandler=function(){var a;return tinymce.each(tinymce.editors,function(b){b.plugins.autosave&&b.plugins.autosave.storeDraft(),!a&&b.isDirty()&&b.getParam("autosave_ask_before_unload",!0)&&(a=b.translate("You have unsaved changes are you sure you want to navigate away?"))}),a},tinymce.PluginManager.add("autosave",function(a){function b(a,b){var c={s:1e3,m:6e4};return a=/^(\d+)([ms]?)$/.exec(""+(a||b)),(a[2]?c[a[2]]:1)*parseInt(a,10)}function c(){var a=parseInt(n.getItem(k+"time"),10)||0;return(new Date).getTime()-a>m.autosave_retention?(d(!1),!1):!0}function d(b){n.removeItem(k+"draft"),n.removeItem(k+"time"),b!==!1&&a.fire("RemoveDraft")}function e(){!j()&&a.isDirty()&&(n.setItem(k+"draft",a.getContent({format:"raw",no_events:!0})),n.setItem(k+"time",(new Date).getTime()),a.fire("StoreDraft"))}function f(){c()&&(a.setContent(n.getItem(k+"draft"),{format:"raw"}),a.fire("RestoreDraft"))}function g(){l||(setInterval(function(){a.removed||e()},m.autosave_interval),l=!0)}function h(){var b=this;b.disabled(!c()),a.on("StoreDraft RestoreDraft RemoveDraft",function(){b.disabled(!c())}),g()}function i(){a.undoManager.beforeChange(),f(),d(),a.undoManager.add()}function j(b){var c=a.settings.forced_root_block;return b=tinymce.trim("undefined"==typeof b?a.getBody().innerHTML:b),""===b||new RegExp("^<"+c+"[^>]*>((\xa0|&nbsp;|[ ]|<br[^>]*>)+?|)</"+c+">|<br>$","i").test(b)}var k,l,m=a.settings,n=tinymce.util.LocalStorage;k=m.autosave_prefix||"tinymce-autosave-{path}{query}-{id}-",k=k.replace(/\{path\}/g,document.location.pathname),k=k.replace(/\{query\}/g,document.location.search),k=k.replace(/\{id\}/g,a.id),m.autosave_interval=b(m.autosave_interval,"30s"),m.autosave_retention=b(m.autosave_retention,"20m"),a.addButton("restoredraft",{title:"Restore last draft",onclick:i,onPostRender:h}),a.addMenuItem("restoredraft",{text:"Restore last draft",onclick:i,onPostRender:h,context:"file"}),a.settings.autosave_restore_when_empty!==!1&&(a.on("init",function(){c()&&j()&&f()}),a.on("saveContent",function(){d()})),window.onbeforeunload=tinymce._beforeUnloadHandler,this.hasDraft=c,this.storeDraft=e,this.restoreDraft=f,this.removeDraft=d,this.isEmpty=j});
@@ -0,0 +1,123 @@
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
+ /*global tinymce:true */
12
+
13
+ (function() {
14
+ tinymce.create('tinymce.plugins.BBCodePlugin', {
15
+ init : function(ed) {
16
+ var self = this, dialect = ed.getParam('bbcode_dialect', 'punbb').toLowerCase();
17
+
18
+ ed.on('beforeSetContent', function(e) {
19
+ e.content = self['_' + dialect + '_bbcode2html'](e.content);
20
+ });
21
+
22
+ ed.on('postProcess', function(e) {
23
+ if (e.set) {
24
+ e.content = self['_' + dialect + '_bbcode2html'](e.content);
25
+ }
26
+
27
+ if (e.get) {
28
+ e.content = self['_' + dialect + '_html2bbcode'](e.content);
29
+ }
30
+ });
31
+ },
32
+
33
+ getInfo: function() {
34
+ return {
35
+ longname: 'BBCode Plugin',
36
+ author: 'Moxiecode Systems AB',
37
+ authorurl: 'http://www.tinymce.com',
38
+ infourl: 'http://www.tinymce.com/wiki.php/Plugin:bbcode'
39
+ };
40
+ },
41
+
42
+ // Private methods
43
+
44
+ // HTML -> BBCode in PunBB dialect
45
+ _punbb_html2bbcode : function(s) {
46
+ s = tinymce.trim(s);
47
+
48
+ function rep(re, str) {
49
+ s = s.replace(re, str);
50
+ }
51
+
52
+ // example: <strong> to [b]
53
+ rep(/<a.*?href=\"(.*?)\".*?>(.*?)<\/a>/gi, "[url=$1]$2[/url]");
54
+ rep(/<font.*?color=\"(.*?)\".*?class=\"codeStyle\".*?>(.*?)<\/font>/gi, "[code][color=$1]$2[/color][/code]");
55
+ rep(/<font.*?color=\"(.*?)\".*?class=\"quoteStyle\".*?>(.*?)<\/font>/gi, "[quote][color=$1]$2[/color][/quote]");
56
+ rep(/<font.*?class=\"codeStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi, "[code][color=$1]$2[/color][/code]");
57
+ rep(/<font.*?class=\"quoteStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi, "[quote][color=$1]$2[/color][/quote]");
58
+ rep(/<span style=\"color: ?(.*?);\">(.*?)<\/span>/gi, "[color=$1]$2[/color]");
59
+ rep(/<font.*?color=\"(.*?)\".*?>(.*?)<\/font>/gi, "[color=$1]$2[/color]");
60
+ rep(/<span style=\"font-size:(.*?);\">(.*?)<\/span>/gi, "[size=$1]$2[/size]");
61
+ rep(/<font>(.*?)<\/font>/gi, "$1");
62
+ rep(/<img.*?src=\"(.*?)\".*?\/>/gi, "[img]$1[/img]");
63
+ rep(/<span class=\"codeStyle\">(.*?)<\/span>/gi, "[code]$1[/code]");
64
+ rep(/<span class=\"quoteStyle\">(.*?)<\/span>/gi, "[quote]$1[/quote]");
65
+ rep(/<strong class=\"codeStyle\">(.*?)<\/strong>/gi, "[code][b]$1[/b][/code]");
66
+ rep(/<strong class=\"quoteStyle\">(.*?)<\/strong>/gi, "[quote][b]$1[/b][/quote]");
67
+ rep(/<em class=\"codeStyle\">(.*?)<\/em>/gi, "[code][i]$1[/i][/code]");
68
+ rep(/<em class=\"quoteStyle\">(.*?)<\/em>/gi, "[quote][i]$1[/i][/quote]");
69
+ rep(/<u class=\"codeStyle\">(.*?)<\/u>/gi, "[code][u]$1[/u][/code]");
70
+ rep(/<u class=\"quoteStyle\">(.*?)<\/u>/gi, "[quote][u]$1[/u][/quote]");
71
+ rep(/<\/(strong|b)>/gi, "[/b]");
72
+ rep(/<(strong|b)>/gi, "[b]");
73
+ rep(/<\/(em|i)>/gi, "[/i]");
74
+ rep(/<(em|i)>/gi, "[i]");
75
+ rep(/<\/u>/gi, "[/u]");
76
+ rep(/<span style=\"text-decoration: ?underline;\">(.*?)<\/span>/gi, "[u]$1[/u]");
77
+ rep(/<u>/gi, "[u]");
78
+ rep(/<blockquote[^>]*>/gi, "[quote]");
79
+ rep(/<\/blockquote>/gi, "[/quote]");
80
+ rep(/<br \/>/gi, "\n");
81
+ rep(/<br\/>/gi, "\n");
82
+ rep(/<br>/gi, "\n");
83
+ rep(/<p>/gi, "");
84
+ rep(/<\/p>/gi, "\n");
85
+ rep(/&nbsp;|\u00a0/gi, " ");
86
+ rep(/&quot;/gi, "\"");
87
+ rep(/&lt;/gi, "<");
88
+ rep(/&gt;/gi, ">");
89
+ rep(/&amp;/gi, "&");
90
+
91
+ return s;
92
+ },
93
+
94
+ // BBCode -> HTML from PunBB dialect
95
+ _punbb_bbcode2html : function(s) {
96
+ s = tinymce.trim(s);
97
+
98
+ function rep(re, str) {
99
+ s = s.replace(re, str);
100
+ }
101
+
102
+ // example: [b] to <strong>
103
+ rep(/\n/gi, "<br />");
104
+ rep(/\[b\]/gi, "<strong>");
105
+ rep(/\[\/b\]/gi, "</strong>");
106
+ rep(/\[i\]/gi, "<em>");
107
+ rep(/\[\/i\]/gi, "</em>");
108
+ rep(/\[u\]/gi, "<u>");
109
+ rep(/\[\/u\]/gi, "</u>");
110
+ rep(/\[url=([^\]]+)\](.*?)\[\/url\]/gi, "<a href=\"$1\">$2</a>");
111
+ rep(/\[url\](.*?)\[\/url\]/gi, "<a href=\"$1\">$1</a>");
112
+ rep(/\[img\](.*?)\[\/img\]/gi, "<img src=\"$1\" />");
113
+ rep(/\[color=(.*?)\](.*?)\[\/color\]/gi, "<font color=\"$1\">$2</font>");
114
+ rep(/\[code\](.*?)\[\/code\]/gi, "<span class=\"codeStyle\">$1</span>&nbsp;");
115
+ rep(/\[quote.*?\](.*?)\[\/quote\]/gi, "<span class=\"quoteStyle\">$1</span>&nbsp;");
116
+
117
+ return s;
118
+ }
119
+ });
120
+
121
+ // Register plugin
122
+ tinymce.PluginManager.add('bbcode', tinymce.plugins.BBCodePlugin);
123
+ })();