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
+ !function(a,b){"use strict";function c(a,b){for(var c,d=[],f=0;f<a.length;++f){if(c=g[a[f]]||e(a[f]),!c)throw"module definition dependecy not found: "+a[f];d.push(c)}b.apply(null,d)}function d(a,d,e){if("string"!=typeof a)throw"invalid module definition, module id must be defined and be a string";if(d===b)throw"invalid module definition, dependencies must be specified";if(e===b)throw"invalid module definition, definition function must be specified";c(d,function(){g[a]=e.apply(null,arguments)})}function e(b){for(var c=a,d=b.split(/[.\/]/),e=0;e<d.length;++e){if(!c[d[e]])return;c=c[d[e]]}return c}function f(c){for(var d=0;d<c.length;d++){for(var e=a,f=c[d],h=f.split(/[.\/]/),i=0;i<h.length-1;++i)e[h[i]]===b&&(e[h[i]]={}),e=e[h[i]];e[h[h.length-1]]=g[f]}}var g={};d("tinymce/pasteplugin/Utils",["tinymce/util/Tools","tinymce/html/DomParser","tinymce/html/Schema"],function(a,b,c){function d(b,c){return a.each(c,function(a){b=a.constructor==RegExp?b.replace(a,""):b.replace(a[0],a[1])}),b}function e(e){function f(a){var b=a.name,c=a;if("br"===b)return void(i+="\n");if(j[b]&&(i+=" "),k[b])return void(i+=" ");if(3==a.type&&(i+=a.value),!a.shortEnded&&(a=a.firstChild))do f(a);while(a=a.next);l[b]&&c.next&&(i+="\n","p"==b&&(i+="\n"))}var g=new c,h=new b({},g),i="",j=g.getShortEndedElements(),k=a.makeMap("script noscript style textarea video audio iframe object"," "),l=g.getBlockElements();return e=d(e,[/<!\[[^\]]+\]>/g]),f(h.parse(e)),i}function f(a){function b(a,b,c){return b||c?"\xa0":" "}return a=d(a,[/^[\s\S]*<body[^>]*>\s*|\s*<\/body[^>]*>[\s\S]*$/g,/<!--StartFragment-->|<!--EndFragment-->/g,[/( ?)<span class="Apple-converted-space">\u00a0<\/span>( ?)/g,b],/<br>$/i])}return{filter:d,innerText:e,trimHtml:f}}),d("tinymce/pasteplugin/Clipboard",["tinymce/Env","tinymce/util/VK","tinymce/pasteplugin/Utils"],function(a,b,c){return function(d){function e(a){var b,c=d.dom;if(b=d.fire("BeforePastePreProcess",{content:a}),b=d.fire("PastePreProcess",b),a=b.content,!b.isDefaultPrevented()){if(d.hasEventListeners("PastePostProcess")&&!b.isDefaultPrevented()){var e=c.add(d.getBody(),"div",{style:"display:none"},a);b=d.fire("PastePostProcess",{node:e}),c.remove(e),a=b.node.innerHTML}b.isDefaultPrevented()||d.insertContent(a,{merge:d.settings.paste_merge_formats!==!1})}}function f(a){a=d.dom.encode(a).replace(/\r\n/g,"\n");var b,f=d.dom.getParent(d.selection.getStart(),d.dom.isBlock),g=d.settings.forced_root_block;g&&(b=d.dom.createHTML(g,d.settings.forced_root_block_attrs),b=b.substr(0,b.length-3)+">"),f&&/^(PRE|DIV)$/.test(f.nodeName)||!g?a=c.filter(a,[[/\n/g,"<br>"]]):(a=c.filter(a,[[/\n\n/g,"</p>"+b],[/^(.*<\/p>)(<p>)$/,b+"$1"],[/\n/g,"<br />"]]),-1!=a.indexOf("<p>")&&(a=b+a)),e(a)}function g(){function b(a){var b,c,d,f=a.startContainer;if(b=a.getClientRects(),b.length)return b[0];if(a.collapsed&&1==f.nodeType){for(d=f.childNodes[s.startOffset];d&&3==d.nodeType&&!d.data.length;)d=d.nextSibling;if(d)return"BR"==d.tagName&&(c=e.doc.createTextNode("\ufeff"),d.parentNode.insertBefore(c,d),a=e.createRng(),a.setStartBefore(c),a.setEndAfter(c),b=a.getClientRects(),e.remove(c)),b.length?b[0]:void 0}}var c,e=d.dom,f=d.getBody(),g=d.dom.getViewPort(d.getWin()),h=g.y,i=20;if(s=d.selection.getRng(),d.inline&&(c=d.selection.getScrollContainer(),c&&c.scrollTop>0&&(h=c.scrollTop)),s.getClientRects){var j=b(s);if(j)i=h+(j.top-e.getPos(f).y);else{i=h;var k=s.startContainer;k&&(3==k.nodeType&&k.parentNode!=f&&(k=k.parentNode),1==k.nodeType&&(i=e.getPos(k,c||f).y))}}r=e.add(d.getBody(),"div",{id:"mcepastebin",contentEditable:!0,"data-mce-bogus":"all",style:"position: absolute; top: "+i+"px;width: 10px; height: 10px; overflow: hidden; opacity: 0"},x),(a.ie||a.gecko)&&e.setStyle(r,"left","rtl"==e.getStyle(f,"direction",!0)?65535:-65535),e.bind(r,"beforedeactivate focusin focusout",function(a){a.stopPropagation()}),r.focus(),d.selection.select(r,!0)}function h(){if(r){for(var a;a=d.dom.get("mcepastebin");)d.dom.remove(a),d.dom.unbind(a);s&&d.selection.setRng(s)}r=s=null}function i(){var a,b,c,e,f="";for(a=d.dom.select("div[id=mcepastebin]"),b=0;b<a.length;b++)c=a[b],c.firstChild&&"mcepastebin"==c.firstChild.id&&(c=c.firstChild),e=c.innerHTML,f!=x&&(f+=e);return f}function j(a){var b={};if(a){if(a.getData){var c=a.getData("Text");c&&c.length>0&&(b["text/plain"]=c)}if(a.types)for(var d=0;d<a.types.length;d++){var e=a.types[d];b[e]=a.getData(e)}}return b}function k(a){return j(a.clipboardData||d.getDoc().dataTransfer)}function l(a,b){function c(c){function f(){b&&(d.selection.setRng(b),b=null),e('<img src="'+i.result+'">')}var g,h,i;if(c)for(g=0;g<c.length;g++)if(h=c[g],/^image\/(jpeg|png|gif)$/.test(h.type))return i=new FileReader,i.onload=f,i.readAsDataURL(h.getAsFile?h.getAsFile():h),a.preventDefault(),!0}var f=a.clipboardData||a.dataTransfer;return d.settings.paste_data_images&&f?c(f.items)||c(f.files):void 0}function m(a){var b=a.clipboardData;return-1!=navigator.userAgent.indexOf("Android")&&b&&b.items&&0===b.items.length}function n(a){var b,c,e=d.getDoc();if(e.caretPositionFromPoint)c=e.caretPositionFromPoint(a.clientX,a.clientY),b=e.createRange(),b.setStart(c.offsetNode,c.offset),b.collapse(!0);else if(e.caretRangeFromPoint)b=e.caretRangeFromPoint(a.clientX,a.clientY);else if(e.body.createTextRange){b=e.body.createTextRange();try{b.moveToPoint(a.clientX,a.clientY),b.collapse(!0)}catch(f){b.collapse(a.clientY<e.body.clientHeight)}}return b}function o(a,b){return b in a&&a[b].length>0}function p(a){return b.metaKeyPressed(a)&&86==a.keyCode||a.shiftKey&&45==a.keyCode}function q(){d.on("keydown",function(b){function c(a){p(a)&&!a.isDefaultPrevented()&&h()}if(p(b)&&!b.isDefaultPrevented()){if(t=b.shiftKey&&86==b.keyCode,t&&a.webkit&&-1!=navigator.userAgent.indexOf("Version/"))return;if(b.stopImmediatePropagation(),v=(new Date).getTime(),a.ie&&t)return b.preventDefault(),void d.fire("paste",{ieFake:!0});h(),g(),d.once("keyup",c),d.once("paste",function(){d.off("keyup",c)})}}),d.on("paste",function(b){var j=(new Date).getTime(),n=k(b),p=(new Date).getTime()-j,q=(new Date).getTime()-v-p<1e3,s="text"==u.pasteFormat||t;return t=!1,b.isDefaultPrevented()||m(b)?void h():l(b)?void h():(q||b.preventDefault(),!a.ie||q&&!b.ieFake||(g(),d.dom.bind(r,"paste",function(a){a.stopPropagation()}),d.getDoc().execCommand("Paste",!1,null),n["text/html"]=i()),void setTimeout(function(){var a;return o(n,"text/html")?a=n["text/html"]:(a=i(),a==x&&(s=!0)),a=c.trimHtml(a),r&&r.firstChild&&"mcepastebin"===r.firstChild.id&&(s=!0),h(),a.length||(s=!0),s&&(a=o(n,"text/plain")&&-1==a.indexOf("</p>")?n["text/plain"]:c.innerText(a)),a==x?void(q||d.windowManager.alert("Please use Ctrl+V/Cmd+V keyboard shortcuts to paste contents.")):void(s?f(a):e(a))},0))}),d.on("dragstart dragend",function(a){w="dragstart"==a.type}),d.on("drop",function(a){var b=n(a);if(!a.isDefaultPrevented()&&!w&&!l(a,b)&&b&&d.settings.paste_filter_drop!==!1){var g=j(a.dataTransfer),h=g["mce-internal"]||g["text/html"]||g["text/plain"];h&&(a.preventDefault(),d.undoManager.transact(function(){g["mce-internal"]&&d.execCommand("Delete"),d.selection.setRng(b),h=c.trimHtml(h),g["text/html"]?e(h):f(h)}))}}),d.on("dragover dragend",function(a){var b,c=a.dataTransfer;if(d.settings.paste_data_images&&c)for(b=0;b<c.types.length;b++)if("Files"==c.types[b])return a.preventDefault(),!1})}var r,s,t,u=this,v=0,w=!1,x="%MCEPASTEBIN%";u.pasteHtml=e,u.pasteText=f,d.on("preInit",function(){q(),d.parser.addNodeFilter("img",function(b){if(!d.settings.paste_data_images)for(var c=b.length;c--;){var e=b[c].attributes.map.src;e&&/^(data:image|webkit\-fake\-url)/.test(e)&&(b[c].attr("data-mce-object")||e===a.transparentSrc||b[c].remove())}})})}}),d("tinymce/pasteplugin/WordFilter",["tinymce/util/Tools","tinymce/html/DomParser","tinymce/html/Schema","tinymce/html/Serializer","tinymce/html/Node","tinymce/pasteplugin/Utils"],function(a,b,c,d,e,f){function g(a){return/<font face="Times New Roman"|class="?Mso|style="[^"]*\bmso-|style='[^'']*\bmso-|w:WordDocument/i.test(a)||/class="OutlineElement/.test(a)||/id="?docs\-internal\-guid\-/.test(a)}function h(b){var c,d;return d=[/^[IVXLMCD]{1,2}\.[ \u00a0]/,/^[ivxlmcd]{1,2}\.[ \u00a0]/,/^[a-z]{1,2}[\.\)][ \u00a0]/,/^[A-Z]{1,2}[\.\)][ \u00a0]/,/^[0-9]+\.[ \u00a0]/,/^[\u3007\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d]+\.[ \u00a0]/,/^[\u58f1\u5f10\u53c2\u56db\u4f0d\u516d\u4e03\u516b\u4e5d\u62fe]+\.[ \u00a0]/],b=b.replace(/^[\u00a0 ]+/,""),a.each(d,function(a){return a.test(b)?(c=!0,!1):void 0}),c}function i(a){return/^[\s\u00a0]*[\u2022\u00b7\u00a7\u00d8\u25CF]\s*/.test(a)}function j(j){var k=j.settings;j.on("BeforePastePreProcess",function(l){function m(a){function b(a){var c="";if(3===a.type)return a.value;if(a=a.firstChild)do c+=b(a);while(a=a.next);return c}function c(a,b){if(3===a.type&&b.test(a.value))return a.value=a.value.replace(b,""),!1;if(a=a.firstChild)do if(!c(a,b))return!1;while(a=a.next);return!0}function d(a){if(a._listIgnore)return void a.remove();if(a=a.firstChild)do d(a);while(a=a.next)}function f(a,b,f){var h=a._listLevel||k;h!=k&&(k>h?g&&(g=g.parent.parent):(j=g,g=null)),g&&g.name==b?g.append(a):(j=j||g,g=new e(b,1),f>1&&g.attr("start",""+f),a.wrap(g)),a.name="li",h>k&&j&&j.lastChild.append(g),k=h,d(a),c(a,/^\u00a0+/),c(a,/^\s*([\u2022\u00b7\u00a7\u00d8\u25CF]|\w+\.)/),c(a,/^\u00a0+/)}for(var g,j,k=1,l=[],m=a.firstChild;"undefined"!=typeof m&&null!==m;)if(l.push(m),m=m.walk(),null!==m)for(;"undefined"!=typeof m&&m.parent!==a;)m=m.walk();for(var n=0;n<l.length;n++)if(a=l[n],"p"==a.name&&a.firstChild){var o=b(a);if(i(o)){f(a,"ul");continue}if(h(o)){var p=/([0-9]+)\./.exec(o),q=1;p&&(q=parseInt(p[1],10)),f(a,"ol",q);continue}if(a._listLevel){f(a,"ul",1);continue}g=null}else j=g,g=null}function n(b,c){var d,f={},g=j.dom.parseStyle(c);return a.each(g,function(a,e){switch(e){case"mso-list":d=/\w+ \w+([0-9]+)/i.exec(c),d&&(b._listLevel=parseInt(d[1],10)),/Ignore/i.test(a)&&b.firstChild&&(b._listIgnore=!0,b.firstChild._listIgnore=!0);break;case"horiz-align":e="text-align";break;case"vert-align":e="vertical-align";break;case"font-color":case"mso-foreground":e="color";break;case"mso-background":case"mso-highlight":e="background";break;case"font-weight":case"font-style":return void("normal"!=a&&(f[e]=a));case"mso-element":if(/^(comment|comment-list)$/i.test(a))return void b.remove()}return 0===e.indexOf("mso-comment")?void b.remove():void(0!==e.indexOf("mso-")&&("all"==o||p&&p[e])&&(f[e]=a))}),/(bold)/i.test(f["font-weight"])&&(delete f["font-weight"],b.wrap(new e("b",1))),/(italic)/i.test(f["font-style"])&&(delete f["font-style"],b.wrap(new e("i",1))),f=j.dom.serializeStyle(f,b.name),f?f:null}var o,p,q=l.content;if(o=k.paste_retain_style_properties,o&&(p=a.makeMap(o.split(/[, ]/))),k.paste_enable_default_filters!==!1&&g(l.content)){l.wordContent=!0,q=f.filter(q,[/<!--[\s\S]+?-->/gi,/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi,[/<(\/?)s>/gi,"<$1strike>"],[/&nbsp;/gi,"\xa0"],[/<span\s+style\s*=\s*"\s*mso-spacerun\s*:\s*yes\s*;?\s*"\s*>([\s\u00a0]*)<\/span>/gi,function(a,b){return b.length>0?b.replace(/./," ").slice(Math.floor(b.length/2)).split("").join("\xa0"):""}]]);var r=k.paste_word_valid_elements;r||(r="-strong/b,-em/i,-u,-span,-p,-ol,-ul,-li,-h1,-h2,-h3,-h4,-h5,-h6,-p/div,-a[href|name],sub,sup,strike,br,del,table[width],tr,td[colspan|rowspan|width],th[colspan|rowspan|width],thead,tfoot,tbody");var s=new c({valid_elements:r,valid_children:"-li[p]"});a.each(s.elements,function(a){a.attributes["class"]||(a.attributes["class"]={},a.attributesOrder.push("class")),a.attributes.style||(a.attributes.style={},a.attributesOrder.push("style"))});var t=new b({},s);t.addAttributeFilter("style",function(a){for(var b,c=a.length;c--;)b=a[c],b.attr("style",n(b,b.attr("style"))),"span"==b.name&&b.parent&&!b.attributes.length&&b.unwrap()}),t.addAttributeFilter("class",function(a){for(var b,c,d=a.length;d--;)b=a[d],c=b.attr("class"),/^(MsoCommentReference|MsoCommentText|msoDel|MsoCaption)$/i.test(c)&&b.remove(),b.attr("class",null)}),t.addNodeFilter("del",function(a){for(var b=a.length;b--;)a[b].remove()}),t.addNodeFilter("a",function(a){for(var b,c,d,e=a.length;e--;)if(b=a[e],c=b.attr("href"),d=b.attr("name"),c&&-1!=c.indexOf("#_msocom_"))b.remove();else if(c&&0===c.indexOf("file://")&&(c=c.split("#")[1],c&&(c="#"+c)),c||d){if(d&&!/^_?(?:toc|edn|ftn)/i.test(d)){b.unwrap();continue}b.attr({href:c,name:d})}else b.unwrap()});var u=t.parse(q);k.paste_convert_word_fake_lists!==!1&&m(u),l.content=new d({},s).serialize(u)}})}return j.isWordContent=g,j}),d("tinymce/pasteplugin/Quirks",["tinymce/Env","tinymce/util/Tools","tinymce/pasteplugin/WordFilter","tinymce/pasteplugin/Utils"],function(a,b,c,d){return function(e){function f(a){e.on("BeforePastePreProcess",function(b){b.content=a(b.content)})}function g(a){if(!c.isWordContent(a))return a;var f=[];b.each(e.schema.getBlockElements(),function(a,b){f.push(b)});var g=new RegExp("(?:<br>&nbsp;[\\s\\r\\n]+|<br>)*(<\\/?("+f.join("|")+")[^>]*>)(?:<br>&nbsp;[\\s\\r\\n]+|<br>)*","g");return a=d.filter(a,[[g,"$1"]]),a=d.filter(a,[[/<br><br>/g,"<BR><BR>"],[/<br>/g," "],[/<BR><BR>/g,"<br>"]])}function h(a){if(c.isWordContent(a))return a;var b=e.settings.paste_webkit_styles;if(e.settings.paste_remove_styles_if_webkit===!1||"all"==b)return a;if(b&&(b=b.split(/[, ]/)),b){var d=e.dom,f=e.selection.getNode();a=a.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi,function(a,c,e,g){var h=d.parseStyle(e,"span"),i={};if("none"===b)return c+g;for(var j=0;j<b.length;j++){var k=h[b[j]],l=d.getStyle(f,b[j],!0);/color/.test(b[j])&&(k=d.toHex(k),l=d.toHex(l)),l!=k&&(i[b[j]]=k)}return i=d.serializeStyle(i,"span"),i?c+' style="'+i+'"'+g:c+g})}else a=a.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi,"$1$3");return a=a.replace(/(<[^>]+) data-mce-style="([^"]+)"([^>]*>)/gi,function(a,b,c,d){return b+' style="'+c+'"'+d})}a.webkit&&f(h),a.ie&&f(g)}}),d("tinymce/pasteplugin/Plugin",["tinymce/PluginManager","tinymce/pasteplugin/Clipboard","tinymce/pasteplugin/WordFilter","tinymce/pasteplugin/Quirks"],function(a,b,c,d){var e;a.add("paste",function(a){function f(){"text"==g.pasteFormat?(this.active(!1),g.pasteFormat="html"):(g.pasteFormat="text",this.active(!0),e||(a.windowManager.alert("Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off."),e=!0))}var g,h=this,i=a.settings;h.clipboard=g=new b(a),h.quirks=new d(a),h.wordFilter=new c(a),a.settings.paste_as_text&&(h.clipboard.pasteFormat="text"),i.paste_preprocess&&a.on("PastePreProcess",function(a){i.paste_preprocess.call(h,h,a)}),i.paste_postprocess&&a.on("PastePostProcess",function(a){i.paste_postprocess.call(h,h,a)}),a.addCommand("mceInsertClipboardContent",function(a,b){b.content&&h.clipboard.pasteHtml(b.content),b.text&&h.clipboard.pasteText(b.text)}),a.paste_block_drop&&a.on("dragend dragover draggesture dragdrop drop drag",function(a){a.preventDefault(),a.stopPropagation()}),a.settings.paste_data_images||a.on("drop",function(a){var b=a.dataTransfer;b&&b.files&&b.files.length>0&&a.preventDefault()}),a.addButton("pastetext",{icon:"pastetext",tooltip:"Paste as text",onclick:f,active:"text"==h.clipboard.pasteFormat}),a.addMenuItem("pastetext",{text:"Paste as text",selectable:!0,active:g.pasteFormat,onclick:f})})}),f(["tinymce/pasteplugin/Utils","tinymce/pasteplugin/WordFilter"])}(this);
@@ -0,0 +1,88 @@
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
+ tinymce.PluginManager.add('preview', function(editor) {
14
+ var settings = editor.settings, sandbox = !tinymce.Env.ie;
15
+
16
+ editor.addCommand('mcePreview', function() {
17
+ editor.windowManager.open({
18
+ title: 'Preview',
19
+ width : parseInt(editor.getParam("plugin_preview_width", "650"), 10),
20
+ height : parseInt(editor.getParam("plugin_preview_height", "500"), 10),
21
+ html: '<iframe src="javascript:\'\'" frameborder="0"' + (sandbox ? ' sandbox="allow-scripts"' : '') + '></iframe>',
22
+ buttons: {
23
+ text: 'Close',
24
+ onclick: function() {
25
+ this.parent().parent().close();
26
+ }
27
+ },
28
+ onPostRender: function() {
29
+ var previewHtml, headHtml = '';
30
+
31
+ headHtml += '<base href="' + editor.documentBaseURI.getURI() + '">';
32
+
33
+ tinymce.each(editor.contentCSS, function(url) {
34
+ headHtml += '<link type="text/css" rel="stylesheet" href="' + editor.documentBaseURI.toAbsolute(url) + '">';
35
+ });
36
+
37
+ var bodyId = settings.body_id || 'tinymce';
38
+ if (bodyId.indexOf('=') != -1) {
39
+ bodyId = editor.getParam('body_id', '', 'hash');
40
+ bodyId = bodyId[editor.id] || bodyId;
41
+ }
42
+
43
+ var bodyClass = settings.body_class || '';
44
+ if (bodyClass.indexOf('=') != -1) {
45
+ bodyClass = editor.getParam('body_class', '', 'hash');
46
+ bodyClass = bodyClass[editor.id] || '';
47
+ }
48
+
49
+ var dirAttr = editor.settings.directionality ? ' dir="' + editor.settings.directionality + '"' : '';
50
+
51
+ previewHtml = (
52
+ '<!DOCTYPE html>' +
53
+ '<html>' +
54
+ '<head>' +
55
+ headHtml +
56
+ '</head>' +
57
+ '<body id="' + bodyId + '" class="mce-content-body ' + bodyClass + '"' + dirAttr + '>' +
58
+ editor.getContent() +
59
+ '</body>' +
60
+ '</html>'
61
+ );
62
+
63
+ if (!sandbox) {
64
+ // IE 6-11 doesn't support data uris on iframes
65
+ // so I guess they will have to be less secure since we can't sandbox on those
66
+ // TODO: Use sandbox if future versions of IE supports iframes with data: uris.
67
+ var doc = this.getEl('body').firstChild.contentWindow.document;
68
+ doc.open();
69
+ doc.write(previewHtml);
70
+ doc.close();
71
+ } else {
72
+ this.getEl('body').firstChild.src = 'data:text/html;charset=utf-8,' + encodeURIComponent(previewHtml);
73
+ }
74
+ }
75
+ });
76
+ });
77
+
78
+ editor.addButton('preview', {
79
+ title : 'Preview',
80
+ cmd : 'mcePreview'
81
+ });
82
+
83
+ editor.addMenuItem('preview', {
84
+ text : 'Preview',
85
+ cmd : 'mcePreview',
86
+ context: 'view'
87
+ });
88
+ });
@@ -0,0 +1 @@
1
+ tinymce.PluginManager.add("preview",function(a){var b=a.settings,c=!tinymce.Env.ie;a.addCommand("mcePreview",function(){a.windowManager.open({title:"Preview",width:parseInt(a.getParam("plugin_preview_width","650"),10),height:parseInt(a.getParam("plugin_preview_height","500"),10),html:'<iframe src="javascript:\'\'" frameborder="0"'+(c?' sandbox="allow-scripts"':"")+"></iframe>",buttons:{text:"Close",onclick:function(){this.parent().parent().close()}},onPostRender:function(){var d,e="";e+='<base href="'+a.documentBaseURI.getURI()+'">',tinymce.each(a.contentCSS,function(b){e+='<link type="text/css" rel="stylesheet" href="'+a.documentBaseURI.toAbsolute(b)+'">'});var f=b.body_id||"tinymce";-1!=f.indexOf("=")&&(f=a.getParam("body_id","","hash"),f=f[a.id]||f);var g=b.body_class||"";-1!=g.indexOf("=")&&(g=a.getParam("body_class","","hash"),g=g[a.id]||"");var h=a.settings.directionality?' dir="'+a.settings.directionality+'"':"";if(d="<!DOCTYPE html><html><head>"+e+'</head><body id="'+f+'" class="mce-content-body '+g+'"'+h+">"+a.getContent()+"</body></html>",c)this.getEl("body").firstChild.src="data:text/html;charset=utf-8,"+encodeURIComponent(d);else{var i=this.getEl("body").firstChild.contentWindow.document;i.open(),i.write(d),i.close()}}})}),a.addButton("preview",{title:"Preview",cmd:"mcePreview"}),a.addMenuItem("preview",{text:"Preview",cmd:"mcePreview",context:"view"})});
@@ -0,0 +1,32 @@
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
+ tinymce.PluginManager.add('print', function(editor) {
14
+ editor.addCommand('mcePrint', function() {
15
+ editor.getWin().print();
16
+ });
17
+
18
+ editor.addButton('print', {
19
+ title: 'Print',
20
+ cmd: 'mcePrint'
21
+ });
22
+
23
+ editor.addShortcut('Ctrl+P', '', 'mcePrint');
24
+
25
+ editor.addMenuItem('print', {
26
+ text: 'Print',
27
+ cmd: 'mcePrint',
28
+ icon: 'print',
29
+ shortcut: 'Ctrl+P',
30
+ context: 'file'
31
+ });
32
+ });
@@ -0,0 +1 @@
1
+ tinymce.PluginManager.add("print",function(a){a.addCommand("mcePrint",function(){a.getWin().print()}),a.addButton("print",{title:"Print",cmd:"mcePrint"}),a.addShortcut("Ctrl+P","","mcePrint"),a.addMenuItem("print",{text:"Print",cmd:"mcePrint",icon:"print",shortcut:"Ctrl+P",context:"file"})});
@@ -0,0 +1,94 @@
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
+ tinymce.PluginManager.add('save', function(editor) {
14
+ function save() {
15
+ var formObj;
16
+
17
+ formObj = tinymce.DOM.getParent(editor.id, 'form');
18
+
19
+ if (editor.getParam("save_enablewhendirty", true) && !editor.isDirty()) {
20
+ return;
21
+ }
22
+
23
+ tinymce.triggerSave();
24
+
25
+ // Use callback instead
26
+ if (editor.getParam("save_onsavecallback")) {
27
+ if (editor.execCallback('save_onsavecallback', editor)) {
28
+ editor.startContent = tinymce.trim(editor.getContent({format: 'raw'}));
29
+ editor.nodeChanged();
30
+ }
31
+
32
+ return;
33
+ }
34
+
35
+ if (formObj) {
36
+ editor.isNotDirty = true;
37
+
38
+ if (!formObj.onsubmit || formObj.onsubmit()) {
39
+ if (typeof(formObj.submit) == "function") {
40
+ formObj.submit();
41
+ } else {
42
+ editor.windowManager.alert("Error: Form submit field collision.");
43
+ }
44
+ }
45
+
46
+ editor.nodeChanged();
47
+ } else {
48
+ editor.windowManager.alert("Error: No form element found.");
49
+ }
50
+ }
51
+
52
+ function cancel() {
53
+ var h = tinymce.trim(editor.startContent);
54
+
55
+ // Use callback instead
56
+ if (editor.getParam("save_oncancelcallback")) {
57
+ editor.execCallback('save_oncancelcallback', editor);
58
+ return;
59
+ }
60
+
61
+ editor.setContent(h);
62
+ editor.undoManager.clear();
63
+ editor.nodeChanged();
64
+ }
65
+
66
+ function stateToggle() {
67
+ var self = this;
68
+
69
+ editor.on('nodeChange', function() {
70
+ self.disabled(editor.getParam("save_enablewhendirty", true) && !editor.isDirty());
71
+ });
72
+ }
73
+
74
+ editor.addCommand('mceSave', save);
75
+ editor.addCommand('mceCancel', cancel);
76
+
77
+ editor.addButton('save', {
78
+ icon: 'save',
79
+ text: 'Save',
80
+ cmd: 'mceSave',
81
+ disabled: true,
82
+ onPostRender: stateToggle
83
+ });
84
+
85
+ editor.addButton('cancel', {
86
+ text: 'Cancel',
87
+ icon: false,
88
+ cmd: 'mceCancel',
89
+ disabled: true,
90
+ onPostRender: stateToggle
91
+ });
92
+
93
+ editor.addShortcut('ctrl+s', '', 'mceSave');
94
+ });
@@ -0,0 +1 @@
1
+ tinymce.PluginManager.add("save",function(a){function b(){var b;return b=tinymce.DOM.getParent(a.id,"form"),!a.getParam("save_enablewhendirty",!0)||a.isDirty()?(tinymce.triggerSave(),a.getParam("save_onsavecallback")?void(a.execCallback("save_onsavecallback",a)&&(a.startContent=tinymce.trim(a.getContent({format:"raw"})),a.nodeChanged())):void(b?(a.isNotDirty=!0,(!b.onsubmit||b.onsubmit())&&("function"==typeof b.submit?b.submit():a.windowManager.alert("Error: Form submit field collision.")),a.nodeChanged()):a.windowManager.alert("Error: No form element found."))):void 0}function c(){var b=tinymce.trim(a.startContent);return a.getParam("save_oncancelcallback")?void a.execCallback("save_oncancelcallback",a):(a.setContent(b),a.undoManager.clear(),void a.nodeChanged())}function d(){var b=this;a.on("nodeChange",function(){b.disabled(a.getParam("save_enablewhendirty",!0)&&!a.isDirty())})}a.addCommand("mceSave",b),a.addCommand("mceCancel",c),a.addButton("save",{icon:"save",text:"Save",cmd:"mceSave",disabled:!0,onPostRender:d}),a.addButton("cancel",{text:"Cancel",icon:!1,cmd:"mceCancel",disabled:!0,onPostRender:d}),a.addShortcut("ctrl+s","","mceSave")});
@@ -0,0 +1,594 @@
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 smarttabs:true, undef:true, unused:true, latedef:true, curly:true, bitwise:true */
12
+ /*eslint no-labels:0, no-constant-condition: 0 */
13
+ /*global tinymce:true */
14
+
15
+ (function() {
16
+ // Based on work developed by: James Padolsey http://james.padolsey.com
17
+ // released under UNLICENSE that is compatible with LGPL
18
+ // TODO: Handle contentEditable edgecase:
19
+ // <p>text<span contentEditable="false">text<span contentEditable="true">text</span>text</span>text</p>
20
+ function findAndReplaceDOMText(regex, node, replacementNode, captureGroup, schema) {
21
+ var m, matches = [], text, count = 0, doc;
22
+ var blockElementsMap, hiddenTextElementsMap, shortEndedElementsMap;
23
+
24
+ doc = node.ownerDocument;
25
+ blockElementsMap = schema.getBlockElements(); // H1-H6, P, TD etc
26
+ hiddenTextElementsMap = schema.getWhiteSpaceElements(); // TEXTAREA, PRE, STYLE, SCRIPT
27
+ shortEndedElementsMap = schema.getShortEndedElements(); // BR, IMG, INPUT
28
+
29
+ function getMatchIndexes(m, captureGroup) {
30
+ captureGroup = captureGroup || 0;
31
+
32
+ if (!m[0]) {
33
+ throw 'findAndReplaceDOMText cannot handle zero-length matches';
34
+ }
35
+
36
+ var index = m.index;
37
+
38
+ if (captureGroup > 0) {
39
+ var cg = m[captureGroup];
40
+
41
+ if (!cg) {
42
+ throw 'Invalid capture group';
43
+ }
44
+
45
+ index += m[0].indexOf(cg);
46
+ m[0] = cg;
47
+ }
48
+
49
+ return [index, index + m[0].length, [m[0]]];
50
+ }
51
+
52
+ function getText(node) {
53
+ var txt;
54
+
55
+ if (node.nodeType === 3) {
56
+ return node.data;
57
+ }
58
+
59
+ if (hiddenTextElementsMap[node.nodeName] && !blockElementsMap[node.nodeName]) {
60
+ return '';
61
+ }
62
+
63
+ txt = '';
64
+
65
+ if (blockElementsMap[node.nodeName] || shortEndedElementsMap[node.nodeName]) {
66
+ txt += '\n';
67
+ }
68
+
69
+ if ((node = node.firstChild)) {
70
+ do {
71
+ txt += getText(node);
72
+ } while ((node = node.nextSibling));
73
+ }
74
+
75
+ return txt;
76
+ }
77
+
78
+ function stepThroughMatches(node, matches, replaceFn) {
79
+ var startNode, endNode, startNodeIndex,
80
+ endNodeIndex, innerNodes = [], atIndex = 0, curNode = node,
81
+ matchLocation = matches.shift(), matchIndex = 0;
82
+
83
+ out: while (true) {
84
+ if (blockElementsMap[curNode.nodeName] || shortEndedElementsMap[curNode.nodeName]) {
85
+ atIndex++;
86
+ }
87
+
88
+ if (curNode.nodeType === 3) {
89
+ if (!endNode && curNode.length + atIndex >= matchLocation[1]) {
90
+ // We've found the ending
91
+ endNode = curNode;
92
+ endNodeIndex = matchLocation[1] - atIndex;
93
+ } else if (startNode) {
94
+ // Intersecting node
95
+ innerNodes.push(curNode);
96
+ }
97
+
98
+ if (!startNode && curNode.length + atIndex > matchLocation[0]) {
99
+ // We've found the match start
100
+ startNode = curNode;
101
+ startNodeIndex = matchLocation[0] - atIndex;
102
+ }
103
+
104
+ atIndex += curNode.length;
105
+ }
106
+
107
+ if (startNode && endNode) {
108
+ curNode = replaceFn({
109
+ startNode: startNode,
110
+ startNodeIndex: startNodeIndex,
111
+ endNode: endNode,
112
+ endNodeIndex: endNodeIndex,
113
+ innerNodes: innerNodes,
114
+ match: matchLocation[2],
115
+ matchIndex: matchIndex
116
+ });
117
+
118
+ // replaceFn has to return the node that replaced the endNode
119
+ // and then we step back so we can continue from the end of the
120
+ // match:
121
+ atIndex -= (endNode.length - endNodeIndex);
122
+ startNode = null;
123
+ endNode = null;
124
+ innerNodes = [];
125
+ matchLocation = matches.shift();
126
+ matchIndex++;
127
+
128
+ if (!matchLocation) {
129
+ break; // no more matches
130
+ }
131
+ } else if ((!hiddenTextElementsMap[curNode.nodeName] || blockElementsMap[curNode.nodeName]) && curNode.firstChild) {
132
+ // Move down
133
+ curNode = curNode.firstChild;
134
+ continue;
135
+ } else if (curNode.nextSibling) {
136
+ // Move forward:
137
+ curNode = curNode.nextSibling;
138
+ continue;
139
+ }
140
+
141
+ // Move forward or up:
142
+ while (true) {
143
+ if (curNode.nextSibling) {
144
+ curNode = curNode.nextSibling;
145
+ break;
146
+ } else if (curNode.parentNode !== node) {
147
+ curNode = curNode.parentNode;
148
+ } else {
149
+ break out;
150
+ }
151
+ }
152
+ }
153
+ }
154
+
155
+ /**
156
+ * Generates the actual replaceFn which splits up text nodes
157
+ * and inserts the replacement element.
158
+ */
159
+ function genReplacer(nodeName) {
160
+ var makeReplacementNode;
161
+
162
+ if (typeof nodeName != 'function') {
163
+ var stencilNode = nodeName.nodeType ? nodeName : doc.createElement(nodeName);
164
+
165
+ makeReplacementNode = function(fill, matchIndex) {
166
+ var clone = stencilNode.cloneNode(false);
167
+
168
+ clone.setAttribute('data-mce-index', matchIndex);
169
+
170
+ if (fill) {
171
+ clone.appendChild(doc.createTextNode(fill));
172
+ }
173
+
174
+ return clone;
175
+ };
176
+ } else {
177
+ makeReplacementNode = nodeName;
178
+ }
179
+
180
+ return function(range) {
181
+ var before, after, parentNode, startNode = range.startNode,
182
+ endNode = range.endNode, matchIndex = range.matchIndex;
183
+
184
+ if (startNode === endNode) {
185
+ var node = startNode;
186
+
187
+ parentNode = node.parentNode;
188
+ if (range.startNodeIndex > 0) {
189
+ // Add `before` text node (before the match)
190
+ before = doc.createTextNode(node.data.substring(0, range.startNodeIndex));
191
+ parentNode.insertBefore(before, node);
192
+ }
193
+
194
+ // Create the replacement node:
195
+ var el = makeReplacementNode(range.match[0], matchIndex);
196
+ parentNode.insertBefore(el, node);
197
+ if (range.endNodeIndex < node.length) {
198
+ // Add `after` text node (after the match)
199
+ after = doc.createTextNode(node.data.substring(range.endNodeIndex));
200
+ parentNode.insertBefore(after, node);
201
+ }
202
+
203
+ node.parentNode.removeChild(node);
204
+
205
+ return el;
206
+ } else {
207
+ // Replace startNode -> [innerNodes...] -> endNode (in that order)
208
+ before = doc.createTextNode(startNode.data.substring(0, range.startNodeIndex));
209
+ after = doc.createTextNode(endNode.data.substring(range.endNodeIndex));
210
+ var elA = makeReplacementNode(startNode.data.substring(range.startNodeIndex), matchIndex);
211
+ var innerEls = [];
212
+
213
+ for (var i = 0, l = range.innerNodes.length; i < l; ++i) {
214
+ var innerNode = range.innerNodes[i];
215
+ var innerEl = makeReplacementNode(innerNode.data, matchIndex);
216
+ innerNode.parentNode.replaceChild(innerEl, innerNode);
217
+ innerEls.push(innerEl);
218
+ }
219
+
220
+ var elB = makeReplacementNode(endNode.data.substring(0, range.endNodeIndex), matchIndex);
221
+
222
+ parentNode = startNode.parentNode;
223
+ parentNode.insertBefore(before, startNode);
224
+ parentNode.insertBefore(elA, startNode);
225
+ parentNode.removeChild(startNode);
226
+
227
+ parentNode = endNode.parentNode;
228
+ parentNode.insertBefore(elB, endNode);
229
+ parentNode.insertBefore(after, endNode);
230
+ parentNode.removeChild(endNode);
231
+
232
+ return elB;
233
+ }
234
+ };
235
+ }
236
+
237
+ text = getText(node);
238
+ if (!text) {
239
+ return;
240
+ }
241
+
242
+ if (regex.global) {
243
+ while ((m = regex.exec(text))) {
244
+ matches.push(getMatchIndexes(m, captureGroup));
245
+ }
246
+ } else {
247
+ m = text.match(regex);
248
+ matches.push(getMatchIndexes(m, captureGroup));
249
+ }
250
+
251
+ if (matches.length) {
252
+ count = matches.length;
253
+ stepThroughMatches(node, matches, genReplacer(replacementNode));
254
+ }
255
+
256
+ return count;
257
+ }
258
+
259
+ function Plugin(editor) {
260
+ var self = this, currentIndex = -1;
261
+
262
+ function showDialog() {
263
+ var last = {};
264
+
265
+ function updateButtonStates() {
266
+ win.statusbar.find('#next').disabled(!findSpansByIndex(currentIndex + 1).length);
267
+ win.statusbar.find('#prev').disabled(!findSpansByIndex(currentIndex - 1).length);
268
+ }
269
+
270
+ function notFoundAlert() {
271
+ tinymce.ui.MessageBox.alert('Could not find the specified string.', function() {
272
+ win.find('#find')[0].focus();
273
+ });
274
+ }
275
+
276
+ var win = tinymce.ui.Factory.create({
277
+ type: 'window',
278
+ layout: "flex",
279
+ pack: "center",
280
+ align: "center",
281
+ onClose: function() {
282
+ editor.focus();
283
+ self.done();
284
+ },
285
+ onSubmit: function(e) {
286
+ var count, caseState, text, wholeWord;
287
+
288
+ e.preventDefault();
289
+
290
+ caseState = win.find('#case').checked();
291
+ wholeWord = win.find('#words').checked();
292
+
293
+ text = win.find('#find').value();
294
+ if (!text.length) {
295
+ self.done(false);
296
+ win.statusbar.items().slice(1).disabled(true);
297
+ return;
298
+ }
299
+
300
+ if (last.text == text && last.caseState == caseState && last.wholeWord == wholeWord) {
301
+ if (findSpansByIndex(currentIndex + 1).length === 0) {
302
+ notFoundAlert();
303
+ return;
304
+ }
305
+
306
+ self.next();
307
+ updateButtonStates();
308
+ return;
309
+ }
310
+
311
+ count = self.find(text, caseState, wholeWord);
312
+ if (!count) {
313
+ notFoundAlert();
314
+ }
315
+
316
+ win.statusbar.items().slice(1).disabled(count === 0);
317
+ updateButtonStates();
318
+
319
+ last = {
320
+ text: text,
321
+ caseState: caseState,
322
+ wholeWord: wholeWord
323
+ };
324
+ },
325
+ buttons: [
326
+ {text: "Find", onclick: function() {
327
+ win.submit();
328
+ }},
329
+ {text: "Replace", disabled: true, onclick: function() {
330
+ if (!self.replace(win.find('#replace').value())) {
331
+ win.statusbar.items().slice(1).disabled(true);
332
+ currentIndex = -1;
333
+ last = {};
334
+ }
335
+ }},
336
+ {text: "Replace all", disabled: true, onclick: function() {
337
+ self.replace(win.find('#replace').value(), true, true);
338
+ win.statusbar.items().slice(1).disabled(true);
339
+ last = {};
340
+ }},
341
+ {type: "spacer", flex: 1},
342
+ {text: "Prev", name: 'prev', disabled: true, onclick: function() {
343
+ self.prev();
344
+ updateButtonStates();
345
+ }},
346
+ {text: "Next", name: 'next', disabled: true, onclick: function() {
347
+ self.next();
348
+ updateButtonStates();
349
+ }}
350
+ ],
351
+ title: "Find and replace",
352
+ items: {
353
+ type: "form",
354
+ padding: 20,
355
+ labelGap: 30,
356
+ spacing: 10,
357
+ items: [
358
+ {type: 'textbox', name: 'find', size: 40, label: 'Find', value: editor.selection.getNode().src},
359
+ {type: 'textbox', name: 'replace', size: 40, label: 'Replace with'},
360
+ {type: 'checkbox', name: 'case', text: 'Match case', label: ' '},
361
+ {type: 'checkbox', name: 'words', text: 'Whole words', label: ' '}
362
+ ]
363
+ }
364
+ }).renderTo().reflow();
365
+ }
366
+
367
+ self.init = function(ed) {
368
+ ed.addMenuItem('searchreplace', {
369
+ text: 'Find and replace',
370
+ shortcut: 'Ctrl+F',
371
+ onclick: showDialog,
372
+ separator: 'before',
373
+ context: 'edit'
374
+ });
375
+
376
+ ed.addButton('searchreplace', {
377
+ tooltip: 'Find and replace',
378
+ shortcut: 'Ctrl+F',
379
+ onclick: showDialog
380
+ });
381
+
382
+ ed.addCommand("SearchReplace", showDialog);
383
+ ed.shortcuts.add('Ctrl+F', '', showDialog);
384
+ };
385
+
386
+ function getElmIndex(elm) {
387
+ var value = elm.getAttribute('data-mce-index');
388
+
389
+ if (typeof(value) == "number") {
390
+ return "" + value;
391
+ }
392
+
393
+ return value;
394
+ }
395
+
396
+ function markAllMatches(regex) {
397
+ var node, marker;
398
+
399
+ marker = editor.dom.create('span', {
400
+ "data-mce-bogus": 1
401
+ });
402
+
403
+ marker.className = 'mce-match-marker'; // IE 7 adds class="mce-match-marker" and class=mce-match-marker
404
+ node = editor.getBody();
405
+
406
+ self.done(false);
407
+
408
+ return findAndReplaceDOMText(regex, node, marker, false, editor.schema);
409
+ }
410
+
411
+ function unwrap(node) {
412
+ var parentNode = node.parentNode;
413
+
414
+ if (node.firstChild) {
415
+ parentNode.insertBefore(node.firstChild, node);
416
+ }
417
+
418
+ node.parentNode.removeChild(node);
419
+ }
420
+
421
+ function findSpansByIndex(index) {
422
+ var nodes, spans = [];
423
+
424
+ nodes = tinymce.toArray(editor.getBody().getElementsByTagName('span'));
425
+ if (nodes.length) {
426
+ for (var i = 0; i < nodes.length; i++) {
427
+ var nodeIndex = getElmIndex(nodes[i]);
428
+
429
+ if (nodeIndex === null || !nodeIndex.length) {
430
+ continue;
431
+ }
432
+
433
+ if (nodeIndex === index.toString()) {
434
+ spans.push(nodes[i]);
435
+ }
436
+ }
437
+ }
438
+
439
+ return spans;
440
+ }
441
+
442
+ function moveSelection(forward) {
443
+ var testIndex = currentIndex, dom = editor.dom;
444
+
445
+ forward = forward !== false;
446
+
447
+ if (forward) {
448
+ testIndex++;
449
+ } else {
450
+ testIndex--;
451
+ }
452
+
453
+ dom.removeClass(findSpansByIndex(currentIndex), 'mce-match-marker-selected');
454
+
455
+ var spans = findSpansByIndex(testIndex);
456
+ if (spans.length) {
457
+ dom.addClass(findSpansByIndex(testIndex), 'mce-match-marker-selected');
458
+ editor.selection.scrollIntoView(spans[0]);
459
+ return testIndex;
460
+ }
461
+
462
+ return -1;
463
+ }
464
+
465
+ function removeNode(node) {
466
+ node.parentNode.removeChild(node);
467
+ }
468
+
469
+ self.find = function(text, matchCase, wholeWord) {
470
+ text = text.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
471
+ text = wholeWord ? '\\b' + text + '\\b' : text;
472
+
473
+ var count = markAllMatches(new RegExp(text, matchCase ? 'g' : 'gi'));
474
+
475
+ if (count) {
476
+ currentIndex = -1;
477
+ currentIndex = moveSelection(true);
478
+ }
479
+
480
+ return count;
481
+ };
482
+
483
+ self.next = function() {
484
+ var index = moveSelection(true);
485
+
486
+ if (index !== -1) {
487
+ currentIndex = index;
488
+ }
489
+ };
490
+
491
+ self.prev = function() {
492
+ var index = moveSelection(false);
493
+
494
+ if (index !== -1) {
495
+ currentIndex = index;
496
+ }
497
+ };
498
+
499
+ self.replace = function(text, forward, all) {
500
+ var i, nodes, node, matchIndex, currentMatchIndex, nextIndex = currentIndex, hasMore;
501
+
502
+ forward = forward !== false;
503
+
504
+ node = editor.getBody();
505
+ nodes = tinymce.toArray(node.getElementsByTagName('span'));
506
+ for (i = 0; i < nodes.length; i++) {
507
+ var nodeIndex = getElmIndex(nodes[i]);
508
+
509
+ if (nodeIndex === null || !nodeIndex.length) {
510
+ continue;
511
+ }
512
+
513
+ matchIndex = currentMatchIndex = parseInt(nodeIndex, 10);
514
+ if (all || matchIndex === currentIndex) {
515
+ if (text.length) {
516
+ nodes[i].firstChild.nodeValue = text;
517
+ unwrap(nodes[i]);
518
+ } else {
519
+ removeNode(nodes[i]);
520
+ }
521
+
522
+ while (nodes[++i]) {
523
+ matchIndex = getElmIndex(nodes[i]);
524
+
525
+ if (nodeIndex === null || !nodeIndex.length) {
526
+ continue;
527
+ }
528
+
529
+ if (matchIndex === currentMatchIndex) {
530
+ removeNode(nodes[i]);
531
+ } else {
532
+ i--;
533
+ break;
534
+ }
535
+ }
536
+
537
+ if (forward) {
538
+ nextIndex--;
539
+ }
540
+ } else if (currentMatchIndex > currentIndex) {
541
+ nodes[i].setAttribute('data-mce-index', currentMatchIndex - 1);
542
+ }
543
+ }
544
+
545
+ editor.undoManager.add();
546
+ currentIndex = nextIndex;
547
+
548
+ if (forward) {
549
+ hasMore = findSpansByIndex(nextIndex + 1).length > 0;
550
+ self.next();
551
+ } else {
552
+ hasMore = findSpansByIndex(nextIndex - 1).length > 0;
553
+ self.prev();
554
+ }
555
+
556
+ return !all && hasMore;
557
+ };
558
+
559
+ self.done = function(keepEditorSelection) {
560
+ var i, nodes, startContainer, endContainer;
561
+
562
+ nodes = tinymce.toArray(editor.getBody().getElementsByTagName('span'));
563
+ for (i = 0; i < nodes.length; i++) {
564
+ var nodeIndex = getElmIndex(nodes[i]);
565
+
566
+ if (nodeIndex !== null && nodeIndex.length) {
567
+ if (nodeIndex === currentIndex.toString()) {
568
+ if (!startContainer) {
569
+ startContainer = nodes[i].firstChild;
570
+ }
571
+
572
+ endContainer = nodes[i].firstChild;
573
+ }
574
+
575
+ unwrap(nodes[i]);
576
+ }
577
+ }
578
+
579
+ if (startContainer && endContainer) {
580
+ var rng = editor.dom.createRng();
581
+ rng.setStart(startContainer, 0);
582
+ rng.setEnd(endContainer, endContainer.data.length);
583
+
584
+ if (keepEditorSelection !== false) {
585
+ editor.selection.setRng(rng);
586
+ }
587
+
588
+ return rng;
589
+ }
590
+ };
591
+ }
592
+
593
+ tinymce.PluginManager.add('searchreplace', Plugin);
594
+ })();