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/spellcheckerplugin/DomTextMatcher",[],function(){return function(a,b){function c(a,b){if(!a[0])throw"findAndReplaceDOMText cannot handle zero-length matches";return{start:a.index,end:a.index+a[0].length,text:a[0],data:b}}function d(a){var b;if(3===a.nodeType)return a.data;if(x[a.nodeName]&&!w[a.nodeName])return"";if(b="",(w[a.nodeName]||y[a.nodeName])&&(b+="\n"),a=a.firstChild)do b+=d(a);while(a=a.nextSibling);return b}function e(a,b,c){var d,e,f,g,h,i=[],j=0,k=a,l=0;b=b.slice(0),b.sort(function(a,b){return a.start-b.start}),h=b.shift();a:for(;;){if((w[k.nodeName]||y[k.nodeName])&&j++,3===k.nodeType&&(!e&&k.length+j>=h.end?(e=k,g=h.end-j):d&&i.push(k),!d&&k.length+j>h.start&&(d=k,f=h.start-j),j+=k.length),d&&e){if(k=c({startNode:d,startNodeIndex:f,endNode:e,endNodeIndex:g,innerNodes:i,match:h.text,matchIndex:l}),j-=e.length-g,d=null,e=null,i=[],h=b.shift(),l++,!h)break}else{if((!x[k.nodeName]||w[k.nodeName])&&k.firstChild){k=k.firstChild;continue}if(k.nextSibling){k=k.nextSibling;continue}}for(;;){if(k.nextSibling){k=k.nextSibling;break}if(k.parentNode===a)break a;k=k.parentNode}}}function f(a){function b(b,c){var d=z[c];d.stencil||(d.stencil=a(d));var e=d.stencil.cloneNode(!1);return e.setAttribute("data-mce-index",c),b&&e.appendChild(A.doc.createTextNode(b)),e}return function(a){var c,d,e,f=a.startNode,g=a.endNode,h=a.matchIndex,i=A.doc;if(f===g){var j=f;e=j.parentNode,a.startNodeIndex>0&&(c=i.createTextNode(j.data.substring(0,a.startNodeIndex)),e.insertBefore(c,j));var k=b(a.match,h);return e.insertBefore(k,j),a.endNodeIndex<j.length&&(d=i.createTextNode(j.data.substring(a.endNodeIndex)),e.insertBefore(d,j)),j.parentNode.removeChild(j),k}c=i.createTextNode(f.data.substring(0,a.startNodeIndex)),d=i.createTextNode(g.data.substring(a.endNodeIndex));for(var l=b(f.data.substring(a.startNodeIndex),h),m=[],n=0,o=a.innerNodes.length;o>n;++n){var p=a.innerNodes[n],q=b(p.data,h);p.parentNode.replaceChild(q,p),m.push(q)}var r=b(g.data.substring(0,a.endNodeIndex),h);return e=f.parentNode,e.insertBefore(c,f),e.insertBefore(l,f),e.removeChild(f),e=g.parentNode,e.insertBefore(r,g),e.insertBefore(d,g),e.removeChild(g),r}}function g(a){var b=a.parentNode;b.insertBefore(a.firstChild,a),a.parentNode.removeChild(a)}function h(b){var c=a.getElementsByTagName("*"),d=[];b="number"==typeof b?""+b:null;for(var e=0;e<c.length;e++){var f=c[e],g=f.getAttribute("data-mce-index");null!==g&&g.length&&(g===b||null===b)&&d.push(f)}return d}function i(a){for(var b=z.length;b--;)if(z[b]===a)return b;return-1}function j(a){var b=[];return k(function(c,d){a(c,d)&&b.push(c)}),z=b,this}function k(a){for(var b=0,c=z.length;c>b&&a(z[b],b)!==!1;b++);return this}function l(b){return z.length&&e(a,z,f(b)),this}function m(a,b){if(v&&a.global)for(;u=a.exec(v);)z.push(c(u,b));return this}function n(a){var b,c=h(a?i(a):null);for(b=c.length;b--;)g(c[b]);return this}function o(a){return z[a.getAttribute("data-mce-index")]}function p(a){return h(i(a))[0]}function q(a,b,c){return z.push({start:a,end:a+b,text:v.substr(a,b),data:c}),this}function r(a){var c=h(i(a)),d=b.dom.createRng();return d.setStartBefore(c[0]),d.setEndAfter(c[c.length-1]),d}function s(a,c){var d=r(a);return d.deleteContents(),c.length>0&&d.insertNode(b.dom.doc.createTextNode(c)),d}function t(){return z.splice(0,z.length),n(),this}var u,v,w,x,y,z=[],A=b.dom;return w=b.schema.getBlockElements(),x=b.schema.getWhiteSpaceElements(),y=b.schema.getShortEndedElements(),v=d(a),{text:v,matches:z,each:k,filter:j,reset:t,matchFromElement:o,elementFromMatch:p,find:m,add:q,wrap:l,unwrap:n,replace:s,rangeFromMatch:r,indexOf:i}}}),d("tinymce/spellcheckerplugin/Plugin",["tinymce/spellcheckerplugin/DomTextMatcher","tinymce/PluginManager","tinymce/util/Tools","tinymce/ui/Menu","tinymce/dom/DOMUtils","tinymce/util/XHR","tinymce/util/URI","tinymce/util/JSON"],function(a,b,c,d,e,f,g,h){b.add("spellchecker",function(b,i){function j(){return E.textMatcher||(E.textMatcher=new a(b.getBody(),b)),E.textMatcher}function k(a,b){var d=[];return c.each(b,function(a){d.push({selectable:!0,text:a.name,data:a.value})}),d}function l(a){for(var b in a)return!1;return!0}function m(a,f){var g=[],h=A[a];c.each(h,function(a){g.push({text:a,onclick:function(){b.insertContent(b.dom.encode(a)),b.dom.remove(f),r()}})}),g.push({text:"-"}),D&&g.push({text:"Add to Dictionary",onclick:function(){s(a,f)}}),g.push.apply(g,[{text:"Ignore",onclick:function(){t(a,f)}},{text:"Ignore all",onclick:function(){t(a,f,!0)}}]),C=new d({items:g,context:"contextmenu",onautohide:function(a){-1!=a.target.className.indexOf("spellchecker")&&a.preventDefault()},onhide:function(){C.remove(),C=null}}),C.renderTo(document.body);var i=e.DOM.getPos(b.getContentAreaContainer()),j=b.dom.getPos(f[0]),k=b.dom.getRoot();"BODY"==k.nodeName?(j.x-=k.ownerDocument.documentElement.scrollLeft||k.scrollLeft,j.y-=k.ownerDocument.documentElement.scrollTop||k.scrollTop):(j.x-=k.scrollLeft,j.y-=k.scrollTop),i.x+=j.x,i.y+=j.y,C.moveTo(i.x,i.y+f[0].offsetHeight)}function n(){return b.getParam("spellchecker_wordchar_pattern")||new RegExp('[^\\s!"#$%&()*+,-./:;<=>?@[\\]^_{|}`\xa7\xa9\xab\xae\xb1\xb6\xb7\xb8\xbb\xbc\xbd\xbe\xbf\xd7\xf7\xa4\u201d\u201c\u201e\xa0\u2002\u2003\u2009]+',"g")}function o(a,b,d,e){var j={method:a},k="";"spellcheck"==a&&(j.text=b,j.lang=F.spellchecker_language),"addToDictionary"==a&&(j.word=b),c.each(j,function(a,b){k&&(k+="&"),k+=b+"="+encodeURIComponent(a)}),f.send({url:new g(i).toAbsolute(F.spellchecker_rpc_url),type:"post",content_type:"application/x-www-form-urlencoded",data:k,success:function(a){a=h.parse(a),a?a.error?e(a.error):d(a):e("Sever response wasn't proper JSON.")},error:function(a,b){e("Spellchecker request error: "+b.status)}})}function p(a,b,c,d){var e=F.spellchecker_callback||o;e.call(E,a,b,c,d)}function q(){function a(a){b.windowManager.alert(a),b.setProgressState(!1),u()}return B?void u():(u(),b.setProgressState(!0),p("spellcheck",j().text,y,a),void b.focus())}function r(){b.dom.select("span.mce-spellchecker-word").length||u()}function s(a,c){b.setProgressState(!0),p("addToDictionary",a,function(){b.setProgressState(!1),b.dom.remove(c,!0),r()},function(a){b.windowManager.alert(a),b.setProgressState(!1)})}function t(a,d,e){b.selection.collapse(),e?c.each(b.dom.select("span.mce-spellchecker-word"),function(c){c.getAttribute("data-mce-word")==a&&b.dom.remove(c,!0)}):b.dom.remove(d,!0),r()}function u(){j().reset(),E.textMatcher=null,B&&(B=!1,b.fire("SpellcheckEnd"))}function v(a){var b=a.getAttribute("data-mce-index");return"number"==typeof b?""+b:b}function w(a){var d,e=[];if(d=c.toArray(b.getBody().getElementsByTagName("span")),d.length)for(var f=0;f<d.length;f++){var g=v(d[f]);null!==g&&g.length&&g===a.toString()&&e.push(d[f])}return e}function x(a){var b=F.spellchecker_language;a.control.items().each(function(a){a.active(a.settings.data===b)})}function y(a){var c;return a.words?(D=!!a.dictionary,c=a.words):c=a,b.setProgressState(!1),l(c)?(b.windowManager.alert("No misspellings found"),void(B=!1)):(A=c,j().find(n()).filter(function(a){return!!c[a.text]}).wrap(function(a){return b.dom.create("span",{"class":"mce-spellchecker-word","data-mce-bogus":1,"data-mce-word":a.text})}),B=!0,void b.fire("SpellcheckStart"))}var z,A,B,C,D,E=this,F=b.settings,G=F.spellchecker_languages||"English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr_FR,German=de,Italian=it,Polish=pl,Portuguese=pt_BR,Spanish=es,Swedish=sv";z=k("Language",c.map(G.split(","),function(a){return a=a.split("="),{name:a[0],value:a[1]}})),b.on("click",function(a){var c=a.target;if("mce-spellchecker-word"==c.className){a.preventDefault();var d=w(v(c));if(d.length>0){var e=b.dom.createRng();e.setStartBefore(d[0]),e.setEndAfter(d[d.length-1]),b.selection.setRng(e),m(c.getAttribute("data-mce-word"),d)}}}),b.addMenuItem("spellchecker",{text:"Spellcheck",context:"tools",onclick:q,selectable:!0,onPostRender:function(){var a=this;a.active(B),b.on("SpellcheckStart SpellcheckEnd",function(){a.active(B)})}});var H={tooltip:"Spellcheck",onclick:q,onPostRender:function(){var a=this;b.on("SpellcheckStart SpellcheckEnd",function(){a.active(B)})}};z.length>1&&(H.type="splitbutton",H.menu=z,H.onshow=x,H.onselect=function(a){F.spellchecker_language=a.control.settings.data}),b.addButton("spellchecker",H),b.addCommand("mceSpellCheck",q),b.on("remove",function(){C&&(C.remove(),C=null)}),b.on("change",r),this.getTextMatcher=j,this.getWordCharPattern=n,this.markErrors=y,this.getLanguage=function(){return F.spellchecker_language},F.spellchecker_language=F.spellchecker_language||F.language||"en"})}),f(["tinymce/spellcheckerplugin/DomTextMatcher"])}(this);
@@ -0,0 +1,120 @@
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('tabfocus', function(editor) {
14
+ var DOM = tinymce.DOM, each = tinymce.each, explode = tinymce.explode;
15
+
16
+ function tabCancel(e) {
17
+ if (e.keyCode === 9 && !e.ctrlKey && !e.altKey && !e.metaKey) {
18
+ e.preventDefault();
19
+ }
20
+ }
21
+
22
+ function tabHandler(e) {
23
+ var x, el, v, i;
24
+
25
+ if (e.keyCode !== 9 || e.ctrlKey || e.altKey || e.metaKey || e.isDefaultPrevented()) {
26
+ return;
27
+ }
28
+
29
+ function find(direction) {
30
+ el = DOM.select(':input:enabled,*[tabindex]:not(iframe)');
31
+
32
+ function canSelectRecursive(e) {
33
+ return e.nodeName === "BODY" || (e.type != 'hidden' &&
34
+ e.style.display != "none" &&
35
+ e.style.visibility != "hidden" && canSelectRecursive(e.parentNode));
36
+ }
37
+
38
+ function canSelect(el) {
39
+ return /INPUT|TEXTAREA|BUTTON/.test(el.tagName) && tinymce.get(e.id) && el.tabIndex != -1 && canSelectRecursive(el);
40
+ }
41
+
42
+ each(el, function(e, i) {
43
+ if (e.id == editor.id) {
44
+ x = i;
45
+ return false;
46
+ }
47
+ });
48
+ if (direction > 0) {
49
+ for (i = x + 1; i < el.length; i++) {
50
+ if (canSelect(el[i])) {
51
+ return el[i];
52
+ }
53
+ }
54
+ } else {
55
+ for (i = x - 1; i >= 0; i--) {
56
+ if (canSelect(el[i])) {
57
+ return el[i];
58
+ }
59
+ }
60
+ }
61
+
62
+ return null;
63
+ }
64
+
65
+ v = explode(editor.getParam('tab_focus', editor.getParam('tabfocus_elements', ':prev,:next')));
66
+
67
+ if (v.length == 1) {
68
+ v[1] = v[0];
69
+ v[0] = ':prev';
70
+ }
71
+
72
+ // Find element to focus
73
+ if (e.shiftKey) {
74
+ if (v[0] == ':prev') {
75
+ el = find(-1);
76
+ } else {
77
+ el = DOM.get(v[0]);
78
+ }
79
+ } else {
80
+ if (v[1] == ':next') {
81
+ el = find(1);
82
+ } else {
83
+ el = DOM.get(v[1]);
84
+ }
85
+ }
86
+
87
+ if (el) {
88
+ var focusEditor = tinymce.get(el.id || el.name);
89
+
90
+ if (el.id && focusEditor) {
91
+ focusEditor.focus();
92
+ } else {
93
+ window.setTimeout(function() {
94
+ if (!tinymce.Env.webkit) {
95
+ window.focus();
96
+ }
97
+
98
+ el.focus();
99
+ }, 10);
100
+ }
101
+
102
+ e.preventDefault();
103
+ }
104
+ }
105
+
106
+ editor.on('init', function() {
107
+ if (editor.inline) {
108
+ // Remove default tabIndex in inline mode
109
+ tinymce.DOM.setAttrib(editor.getBody(), 'tabIndex', null);
110
+ }
111
+
112
+ editor.on('keyup', tabCancel);
113
+
114
+ if (tinymce.Env.gecko) {
115
+ editor.on('keypress keydown', tabHandler);
116
+ } else {
117
+ editor.on('keydown', tabHandler);
118
+ }
119
+ });
120
+ });
@@ -0,0 +1 @@
1
+ tinymce.PluginManager.add("tabfocus",function(a){function b(a){9!==a.keyCode||a.ctrlKey||a.altKey||a.metaKey||a.preventDefault()}function c(b){function c(c){function f(a){return"BODY"===a.nodeName||"hidden"!=a.type&&"none"!=a.style.display&&"hidden"!=a.style.visibility&&f(a.parentNode)}function i(a){return/INPUT|TEXTAREA|BUTTON/.test(a.tagName)&&tinymce.get(b.id)&&-1!=a.tabIndex&&f(a)}if(h=d.select(":input:enabled,*[tabindex]:not(iframe)"),e(h,function(b,c){return b.id==a.id?(g=c,!1):void 0}),c>0){for(j=g+1;j<h.length;j++)if(i(h[j]))return h[j]}else for(j=g-1;j>=0;j--)if(i(h[j]))return h[j];return null}var g,h,i,j;if(!(9!==b.keyCode||b.ctrlKey||b.altKey||b.metaKey||b.isDefaultPrevented())&&(i=f(a.getParam("tab_focus",a.getParam("tabfocus_elements",":prev,:next"))),1==i.length&&(i[1]=i[0],i[0]=":prev"),h=b.shiftKey?":prev"==i[0]?c(-1):d.get(i[0]):":next"==i[1]?c(1):d.get(i[1]))){var k=tinymce.get(h.id||h.name);h.id&&k?k.focus():window.setTimeout(function(){tinymce.Env.webkit||window.focus(),h.focus()},10),b.preventDefault()}}var d=tinymce.DOM,e=tinymce.each,f=tinymce.explode;a.on("init",function(){a.inline&&tinymce.DOM.setAttrib(a.getBody(),"tabIndex",null),a.on("keyup",b),tinymce.Env.gecko?a.on("keypress keydown",c):a.on("keydown",c)})});
@@ -0,0 +1,176 @@
1
+ /**
2
+ * CellSelection.js
3
+ *
4
+ * Copyright, Moxiecode Systems AB
5
+ * Released under LGPL License.
6
+ *
7
+ * License: http://www.tinymce.com/license
8
+ * Contributing: http://www.tinymce.com/contributing
9
+ */
10
+
11
+ /**
12
+ * This class handles table cell selection by faking it using a css class that gets applied
13
+ * to cells when dragging the mouse from one cell to another.
14
+ *
15
+ * @class tinymce.tableplugin.CellSelection
16
+ * @private
17
+ */
18
+ define("tinymce/tableplugin/CellSelection", [
19
+ "tinymce/tableplugin/TableGrid",
20
+ "tinymce/dom/TreeWalker",
21
+ "tinymce/util/Tools"
22
+ ], function(TableGrid, TreeWalker, Tools) {
23
+ return function(editor) {
24
+ var dom = editor.dom, tableGrid, startCell, startTable, hasCellSelection = true, resizing;
25
+
26
+ function clear(force) {
27
+ // Restore selection possibilities
28
+ editor.getBody().style.webkitUserSelect = '';
29
+
30
+ if (force || hasCellSelection) {
31
+ editor.dom.removeClass(
32
+ editor.dom.select('td.mce-item-selected,th.mce-item-selected'),
33
+ 'mce-item-selected'
34
+ );
35
+
36
+ hasCellSelection = false;
37
+ }
38
+ }
39
+
40
+ function cellSelectionHandler(e) {
41
+ var sel, table, target = e.target;
42
+
43
+ if (resizing) {
44
+ return;
45
+ }
46
+
47
+ if (startCell && (tableGrid || target != startCell) && (target.nodeName == 'TD' || target.nodeName == 'TH')) {
48
+ table = dom.getParent(target, 'table');
49
+ if (table == startTable) {
50
+ if (!tableGrid) {
51
+ tableGrid = new TableGrid(editor, table);
52
+ tableGrid.setStartCell(startCell);
53
+
54
+ editor.getBody().style.webkitUserSelect = 'none';
55
+ }
56
+
57
+ tableGrid.setEndCell(target);
58
+ hasCellSelection = true;
59
+ }
60
+
61
+ // Remove current selection
62
+ sel = editor.selection.getSel();
63
+
64
+ try {
65
+ if (sel.removeAllRanges) {
66
+ sel.removeAllRanges();
67
+ } else {
68
+ sel.empty();
69
+ }
70
+ } catch (ex) {
71
+ // IE9 might throw errors here
72
+ }
73
+
74
+ e.preventDefault();
75
+ }
76
+ }
77
+
78
+ // Add cell selection logic
79
+ editor.on('MouseDown', function(e) {
80
+ if (e.button != 2 && !resizing) {
81
+ clear();
82
+
83
+ startCell = dom.getParent(e.target, 'td,th');
84
+ startTable = dom.getParent(startCell, 'table');
85
+ }
86
+ });
87
+
88
+ editor.on('mouseover', cellSelectionHandler);
89
+
90
+ editor.on('remove', function() {
91
+ dom.unbind(editor.getDoc(), 'mouseover', cellSelectionHandler);
92
+ });
93
+
94
+ editor.on('MouseUp', function() {
95
+ var rng, sel = editor.selection, selectedCells, walker, node, lastNode;
96
+
97
+ function setPoint(node, start) {
98
+ var walker = new TreeWalker(node, node);
99
+
100
+ do {
101
+ // Text node
102
+ if (node.nodeType == 3 && Tools.trim(node.nodeValue).length !== 0) {
103
+ if (start) {
104
+ rng.setStart(node, 0);
105
+ } else {
106
+ rng.setEnd(node, node.nodeValue.length);
107
+ }
108
+
109
+ return;
110
+ }
111
+
112
+ // BR element
113
+ if (node.nodeName == 'BR') {
114
+ if (start) {
115
+ rng.setStartBefore(node);
116
+ } else {
117
+ rng.setEndBefore(node);
118
+ }
119
+
120
+ return;
121
+ }
122
+ } while ((node = (start ? walker.next() : walker.prev())));
123
+ }
124
+
125
+ // Move selection to startCell
126
+ if (startCell) {
127
+ if (tableGrid) {
128
+ editor.getBody().style.webkitUserSelect = '';
129
+ }
130
+
131
+ // Try to expand text selection as much as we can only Gecko supports cell selection
132
+ selectedCells = dom.select('td.mce-item-selected,th.mce-item-selected');
133
+ if (selectedCells.length > 0) {
134
+ rng = dom.createRng();
135
+ node = selectedCells[0];
136
+ rng.setStartBefore(node);
137
+ rng.setEndAfter(node);
138
+
139
+ setPoint(node, 1);
140
+ walker = new TreeWalker(node, dom.getParent(selectedCells[0], 'table'));
141
+
142
+ do {
143
+ if (node.nodeName == 'TD' || node.nodeName == 'TH') {
144
+ if (!dom.hasClass(node, 'mce-item-selected')) {
145
+ break;
146
+ }
147
+
148
+ lastNode = node;
149
+ }
150
+ } while ((node = walker.next()));
151
+
152
+ setPoint(lastNode);
153
+
154
+ sel.setRng(rng);
155
+ }
156
+
157
+ editor.nodeChanged();
158
+ startCell = tableGrid = startTable = null;
159
+ }
160
+ });
161
+
162
+ editor.on('KeyUp Drop SetContent', function(e) {
163
+ clear(e.type == 'setcontent');
164
+ startCell = tableGrid = startTable = null;
165
+ resizing = false;
166
+ });
167
+
168
+ editor.on('ObjectResizeStart ObjectResized', function(e) {
169
+ resizing = e.type != 'objectresized';
170
+ });
171
+
172
+ return {
173
+ clear: clear
174
+ };
175
+ };
176
+ });
@@ -0,0 +1,749 @@
1
+ /**
2
+ * Dialogs.js
3
+ *
4
+ * Copyright, Moxiecode Systems AB
5
+ * Released under LGPL License.
6
+ *
7
+ * License: http://www.tinymce.com/license
8
+ * Contributing: http://www.tinymce.com/contributing
9
+ */
10
+
11
+ /**
12
+ * ...
13
+ *
14
+ * @class tinymce.tableplugin.Dialogs
15
+ * @private
16
+ */
17
+ define("tinymce/tableplugin/Dialogs", [
18
+ "tinymce/util/Tools",
19
+ "tinymce/Env"
20
+ ], function(Tools, Env) {
21
+ var each = Tools.each;
22
+
23
+ return function(editor) {
24
+ var self = this;
25
+
26
+ function createColorPickAction() {
27
+ var colorPickerCallback = editor.settings.color_picker_callback;
28
+
29
+ if (colorPickerCallback) {
30
+ return function() {
31
+ var self = this;
32
+
33
+ colorPickerCallback.call(
34
+ editor,
35
+ function(value) {
36
+ self.value(value).fire('change');
37
+ },
38
+ self.value()
39
+ );
40
+ };
41
+ }
42
+ }
43
+
44
+ function createStyleForm(dom) {
45
+ return {
46
+ title: 'Advanced',
47
+ type: 'form',
48
+ defaults: {
49
+ onchange: function() {
50
+ updateStyle(dom, this.parents().reverse()[0], this.name() == "style");
51
+ }
52
+ },
53
+ items: [
54
+ {
55
+ label: 'Style',
56
+ name: 'style',
57
+ type: 'textbox'
58
+ },
59
+
60
+ {
61
+ type: 'form',
62
+ padding: 0,
63
+ formItemDefaults: {
64
+ layout: 'grid',
65
+ alignH: ['start', 'right']
66
+ },
67
+ defaults: {
68
+ size: 7
69
+ },
70
+ items: [
71
+ {
72
+ label: 'Border color',
73
+ type: 'colorbox',
74
+ name: 'borderColor',
75
+ onaction: createColorPickAction()
76
+ },
77
+
78
+ {
79
+ label: 'Background color',
80
+ type: 'colorbox',
81
+ name: 'backgroundColor',
82
+ onaction: createColorPickAction()
83
+ }
84
+ ]
85
+ }
86
+ ]
87
+ };
88
+ }
89
+
90
+ function removePxSuffix(size) {
91
+ return size ? size.replace(/px$/, '') : "";
92
+ }
93
+
94
+ function addSizeSuffix(size) {
95
+ if (/^[0-9]+$/.test(size)) {
96
+ size += "px";
97
+ }
98
+
99
+ return size;
100
+ }
101
+
102
+ function unApplyAlign(elm) {
103
+ each('left center right'.split(' '), function(name) {
104
+ editor.formatter.remove('align' + name, {}, elm);
105
+ });
106
+ }
107
+
108
+ function unApplyVAlign(elm) {
109
+ each('top middle bottom'.split(' '), function(name) {
110
+ editor.formatter.remove('valign' + name, {}, elm);
111
+ });
112
+ }
113
+
114
+ function buildListItems(inputList, itemCallback, startItems) {
115
+ function appendItems(values, output) {
116
+ output = output || [];
117
+
118
+ Tools.each(values, function(item) {
119
+ var menuItem = {text: item.text || item.title};
120
+
121
+ if (item.menu) {
122
+ menuItem.menu = appendItems(item.menu);
123
+ } else {
124
+ menuItem.value = item.value;
125
+
126
+ if (itemCallback) {
127
+ itemCallback(menuItem);
128
+ }
129
+ }
130
+
131
+ output.push(menuItem);
132
+ });
133
+
134
+ return output;
135
+ }
136
+
137
+ return appendItems(inputList, startItems || []);
138
+ }
139
+
140
+ function updateStyle(dom, win, isStyleCtrl) {
141
+ var data = win.toJSON();
142
+ var css = dom.parseStyle(data.style);
143
+
144
+ if (isStyleCtrl) {
145
+ win.find('#borderColor').value(css["border-color"] || '')[0].fire('change');
146
+ win.find('#backgroundColor').value(css["background-color"] || '')[0].fire('change');
147
+ } else {
148
+ css["border-color"] = data.borderColor;
149
+ css["background-color"] = data.backgroundColor;
150
+ }
151
+
152
+ win.find('#style').value(dom.serializeStyle(dom.parseStyle(dom.serializeStyle(css))));
153
+ }
154
+
155
+ function appendStylesToData(dom, data, elm) {
156
+ var css = dom.parseStyle(dom.getAttrib(elm, 'style'));
157
+
158
+ if (css["border-color"]) {
159
+ data.borderColor = css["border-color"];
160
+ }
161
+
162
+ if (css["background-color"]) {
163
+ data.backgroundColor = css["background-color"];
164
+ }
165
+
166
+ data.style = dom.serializeStyle(css);
167
+ }
168
+
169
+ self.tableProps = function() {
170
+ self.table(true);
171
+ };
172
+
173
+ self.table = function(isProps) {
174
+ var dom = editor.dom, tableElm, colsCtrl, rowsCtrl, classListCtrl, data = {}, generalTableForm;
175
+
176
+ function onSubmitTableForm() {
177
+ var captionElm;
178
+
179
+ updateStyle(dom, this);
180
+ data = Tools.extend(data, this.toJSON());
181
+
182
+ Tools.each('backgroundColor borderColor'.split(' '), function(name) {
183
+ delete data[name];
184
+ });
185
+
186
+ if (data["class"] === false) {
187
+ delete data["class"];
188
+ }
189
+
190
+ editor.undoManager.transact(function() {
191
+ if (!tableElm) {
192
+ tableElm = editor.plugins.table.insertTable(data.cols || 1, data.rows || 1);
193
+ }
194
+
195
+ editor.dom.setAttribs(tableElm, {
196
+ cellspacing: data.cellspacing,
197
+ cellpadding: data.cellpadding,
198
+ border: data.border,
199
+ style: data.style,
200
+ 'class': data['class']
201
+ });
202
+
203
+ if (dom.getAttrib(tableElm, 'width')) {
204
+ dom.setAttrib(tableElm, 'width', removePxSuffix(data.width));
205
+ } else {
206
+ dom.setStyle(tableElm, 'width', addSizeSuffix(data.width));
207
+ }
208
+
209
+ dom.setStyle(tableElm, 'height', addSizeSuffix(data.height));
210
+
211
+ // Toggle caption on/off
212
+ captionElm = dom.select('caption', tableElm)[0];
213
+
214
+ if (captionElm && !data.caption) {
215
+ dom.remove(captionElm);
216
+ }
217
+
218
+ if (!captionElm && data.caption) {
219
+ captionElm = dom.create('caption');
220
+ captionElm.innerHTML = !Env.ie ? '<br data-mce-bogus="1"/>' : '\u00a0';
221
+ tableElm.insertBefore(captionElm, tableElm.firstChild);
222
+ }
223
+
224
+ unApplyAlign(tableElm);
225
+ if (data.align) {
226
+ editor.formatter.apply('align' + data.align, {}, tableElm);
227
+ }
228
+
229
+ editor.focus();
230
+ editor.addVisual();
231
+ });
232
+ }
233
+
234
+ if (isProps === true) {
235
+ tableElm = dom.getParent(editor.selection.getStart(), 'table');
236
+
237
+ if (tableElm) {
238
+ data = {
239
+ width: removePxSuffix(dom.getStyle(tableElm, 'width') || dom.getAttrib(tableElm, 'width')),
240
+ height: removePxSuffix(dom.getStyle(tableElm, 'height') || dom.getAttrib(tableElm, 'height')),
241
+ cellspacing: tableElm ? dom.getAttrib(tableElm, 'cellspacing') : '',
242
+ cellpadding: tableElm ? dom.getAttrib(tableElm, 'cellpadding') : '',
243
+ border: tableElm ? dom.getAttrib(tableElm, 'border') : '',
244
+ caption: !!dom.select('caption', tableElm)[0],
245
+ 'class': dom.getAttrib(tableElm, 'class')
246
+ };
247
+
248
+ each('left center right'.split(' '), function(name) {
249
+ if (editor.formatter.matchNode(tableElm, 'align' + name)) {
250
+ data.align = name;
251
+ }
252
+ });
253
+ }
254
+ } else {
255
+ colsCtrl = {label: 'Cols', name: 'cols'};
256
+ rowsCtrl = {label: 'Rows', name: 'rows'};
257
+ }
258
+
259
+ if (editor.settings.table_class_list) {
260
+ if (data["class"]) {
261
+ data["class"] = data["class"].replace(/\s*mce\-item\-table\s*/g, '');
262
+ }
263
+
264
+ classListCtrl = {
265
+ name: 'class',
266
+ type: 'listbox',
267
+ label: 'Class',
268
+ values: buildListItems(
269
+ editor.settings.table_class_list,
270
+ function(item) {
271
+ if (item.value) {
272
+ item.textStyle = function() {
273
+ return editor.formatter.getCssText({block: 'table', classes: [item.value]});
274
+ };
275
+ }
276
+ }
277
+ )
278
+ };
279
+ }
280
+
281
+ generalTableForm = {
282
+ type: 'form',
283
+ layout: 'flex',
284
+ direction: 'column',
285
+ labelGapCalc: 'children',
286
+ padding: 0,
287
+ items: [
288
+ {
289
+ type: 'form',
290
+ labelGapCalc: false,
291
+ padding: 0,
292
+ layout: 'grid',
293
+ columns: 2,
294
+ defaults: {
295
+ type: 'textbox',
296
+ maxWidth: 50
297
+ },
298
+ items: [
299
+ colsCtrl,
300
+ rowsCtrl,
301
+ {label: 'Width', name: 'width'},
302
+ {label: 'Height', name: 'height'},
303
+ {label: 'Cell spacing', name: 'cellspacing'},
304
+ {label: 'Cell padding', name: 'cellpadding'},
305
+ {label: 'Border', name: 'border'},
306
+ {label: 'Caption', name: 'caption', type: 'checkbox'}
307
+ ]
308
+ },
309
+
310
+ {
311
+ label: 'Alignment',
312
+ name: 'align',
313
+ type: 'listbox',
314
+ text: 'None',
315
+ values: [
316
+ {text: 'None', value: ''},
317
+ {text: 'Left', value: 'left'},
318
+ {text: 'Center', value: 'center'},
319
+ {text: 'Right', value: 'right'}
320
+ ]
321
+ },
322
+
323
+ classListCtrl
324
+ ]
325
+ };
326
+
327
+ if (editor.settings.table_advtab !== false) {
328
+ appendStylesToData(dom, data, tableElm);
329
+
330
+ editor.windowManager.open({
331
+ title: "Table properties",
332
+ data: data,
333
+ bodyType: 'tabpanel',
334
+ body: [
335
+ {
336
+ title: 'General',
337
+ type: 'form',
338
+ items: generalTableForm
339
+ },
340
+ createStyleForm(dom)
341
+ ],
342
+
343
+ onsubmit: onSubmitTableForm
344
+ });
345
+ } else {
346
+ editor.windowManager.open({
347
+ title: "Table properties",
348
+ data: data,
349
+ body: generalTableForm,
350
+ onsubmit: onSubmitTableForm
351
+ });
352
+ }
353
+ };
354
+
355
+ self.merge = function(grid, cell) {
356
+ editor.windowManager.open({
357
+ title: "Merge cells",
358
+ body: [
359
+ {label: 'Cols', name: 'cols', type: 'textbox', value: '1', size: 10},
360
+ {label: 'Rows', name: 'rows', type: 'textbox', value: '1', size: 10}
361
+ ],
362
+ onsubmit: function() {
363
+ var data = this.toJSON();
364
+
365
+ editor.undoManager.transact(function() {
366
+ grid.merge(cell, data.cols, data.rows);
367
+ });
368
+ }
369
+ });
370
+ };
371
+
372
+ self.cell = function() {
373
+ var dom = editor.dom, cellElm, data, classListCtrl, cells = [];
374
+
375
+ function onSubmitCellForm() {
376
+ updateStyle(dom, this);
377
+ data = Tools.extend(data, this.toJSON());
378
+
379
+ editor.undoManager.transact(function() {
380
+ each(cells, function(cellElm) {
381
+ editor.dom.setAttribs(cellElm, {
382
+ scope: data.scope,
383
+ style: data.style,
384
+ 'class': data['class']
385
+ });
386
+
387
+ editor.dom.setStyles(cellElm, {
388
+ width: addSizeSuffix(data.width),
389
+ height: addSizeSuffix(data.height)
390
+ });
391
+
392
+ // Switch cell type
393
+ if (data.type && cellElm.nodeName.toLowerCase() != data.type) {
394
+ cellElm = dom.rename(cellElm, data.type);
395
+ }
396
+
397
+ // Apply/remove alignment
398
+ unApplyAlign(cellElm);
399
+ if (data.align) {
400
+ editor.formatter.apply('align' + data.align, {}, cellElm);
401
+ }
402
+
403
+ // Apply/remove vertical alignment
404
+ unApplyVAlign(cellElm);
405
+ if (data.valign) {
406
+ editor.formatter.apply('valign' + data.valign, {}, cellElm);
407
+ }
408
+ });
409
+
410
+ editor.focus();
411
+ });
412
+ }
413
+
414
+ // Get selected cells or the current cell
415
+ cells = editor.dom.select('td.mce-item-selected,th.mce-item-selected');
416
+ cellElm = editor.dom.getParent(editor.selection.getStart(), 'td,th');
417
+ if (!cells.length && cellElm) {
418
+ cells.push(cellElm);
419
+ }
420
+
421
+ cellElm = cellElm || cells[0];
422
+
423
+ if (!cellElm) {
424
+ // If this element is null, return now to avoid crashing.
425
+ return;
426
+ }
427
+
428
+ data = {
429
+ width: removePxSuffix(dom.getStyle(cellElm, 'width') || dom.getAttrib(cellElm, 'width')),
430
+ height: removePxSuffix(dom.getStyle(cellElm, 'height') || dom.getAttrib(cellElm, 'height')),
431
+ scope: dom.getAttrib(cellElm, 'scope'),
432
+ 'class': dom.getAttrib(cellElm, 'class')
433
+ };
434
+
435
+ data.type = cellElm.nodeName.toLowerCase();
436
+
437
+ each('left center right'.split(' '), function(name) {
438
+ if (editor.formatter.matchNode(cellElm, 'align' + name)) {
439
+ data.align = name;
440
+ }
441
+ });
442
+
443
+ each('top middle bottom'.split(' '), function(name) {
444
+ if (editor.formatter.matchNode(cellElm, 'valign' + name)) {
445
+ data.valign = name;
446
+ }
447
+ });
448
+
449
+ if (editor.settings.table_cell_class_list) {
450
+ classListCtrl = {
451
+ name: 'class',
452
+ type: 'listbox',
453
+ label: 'Class',
454
+ values: buildListItems(
455
+ editor.settings.table_cell_class_list,
456
+ function(item) {
457
+ if (item.value) {
458
+ item.textStyle = function() {
459
+ return editor.formatter.getCssText({block: 'td', classes: [item.value]});
460
+ };
461
+ }
462
+ }
463
+ )
464
+ };
465
+ }
466
+
467
+ var generalCellForm = {
468
+ type: 'form',
469
+ layout: 'flex',
470
+ direction: 'column',
471
+ labelGapCalc: 'children',
472
+ padding: 0,
473
+ items: [
474
+ {
475
+ type: 'form',
476
+ layout: 'grid',
477
+ columns: 2,
478
+ labelGapCalc: false,
479
+ padding: 0,
480
+ defaults: {
481
+ type: 'textbox',
482
+ maxWidth: 50
483
+ },
484
+ items: [
485
+ {label: 'Width', name: 'width'},
486
+ {label: 'Height', name: 'height'},
487
+ {
488
+ label: 'Cell type',
489
+ name: 'type',
490
+ type: 'listbox',
491
+ text: 'None',
492
+ minWidth: 90,
493
+ maxWidth: null,
494
+ values: [
495
+ {text: 'Cell', value: 'td'},
496
+ {text: 'Header cell', value: 'th'}
497
+ ]
498
+ },
499
+ {
500
+ label: 'Scope',
501
+ name: 'scope',
502
+ type: 'listbox',
503
+ text: 'None',
504
+ minWidth: 90,
505
+ maxWidth: null,
506
+ values: [
507
+ {text: 'None', value: ''},
508
+ {text: 'Row', value: 'row'},
509
+ {text: 'Column', value: 'col'},
510
+ {text: 'Row group', value: 'rowgroup'},
511
+ {text: 'Column group', value: 'colgroup'}
512
+ ]
513
+ },
514
+ {
515
+ label: 'H Align',
516
+ name: 'align',
517
+ type: 'listbox',
518
+ text: 'None',
519
+ minWidth: 90,
520
+ maxWidth: null,
521
+ values: [
522
+ {text: 'None', value: ''},
523
+ {text: 'Left', value: 'left'},
524
+ {text: 'Center', value: 'center'},
525
+ {text: 'Right', value: 'right'}
526
+ ]
527
+ },
528
+ {
529
+ label: 'V Align',
530
+ name: 'valign',
531
+ type: 'listbox',
532
+ text: 'None',
533
+ minWidth: 90,
534
+ maxWidth: null,
535
+ values: [
536
+ {text: 'None', value: ''},
537
+ {text: 'Top', value: 'top'},
538
+ {text: 'Middle', value: 'middle'},
539
+ {text: 'Bottom', value: 'bottom'}
540
+ ]
541
+ }
542
+ ]
543
+ },
544
+
545
+ classListCtrl
546
+ ]
547
+ };
548
+
549
+ if (editor.settings.table_cell_advtab !== false) {
550
+ appendStylesToData(dom, data, cellElm);
551
+
552
+ editor.windowManager.open({
553
+ title: "Cell properties",
554
+ bodyType: 'tabpanel',
555
+ data: data,
556
+ body: [
557
+ {
558
+ title: 'General',
559
+ type: 'form',
560
+ items: generalCellForm
561
+ },
562
+
563
+ createStyleForm(dom)
564
+ ],
565
+
566
+ onsubmit: onSubmitCellForm
567
+ });
568
+ } else {
569
+ editor.windowManager.open({
570
+ title: "Cell properties",
571
+ data: data,
572
+ body: generalCellForm,
573
+ onsubmit: onSubmitCellForm
574
+ });
575
+ }
576
+ };
577
+
578
+ self.row = function() {
579
+ var dom = editor.dom, tableElm, cellElm, rowElm, classListCtrl, data, rows = [], generalRowForm;
580
+
581
+ function onSubmitRowForm() {
582
+ var tableElm, oldParentElm, parentElm;
583
+
584
+ updateStyle(dom, this);
585
+ data = Tools.extend(data, this.toJSON());
586
+
587
+ editor.undoManager.transact(function() {
588
+ var toType = data.type;
589
+
590
+ each(rows, function(rowElm) {
591
+ editor.dom.setAttribs(rowElm, {
592
+ scope: data.scope,
593
+ style: data.style,
594
+ 'class': data['class']
595
+ });
596
+
597
+ editor.dom.setStyles(rowElm, {
598
+ height: addSizeSuffix(data.height)
599
+ });
600
+
601
+ if (toType != rowElm.parentNode.nodeName.toLowerCase()) {
602
+ tableElm = dom.getParent(rowElm, 'table');
603
+
604
+ oldParentElm = rowElm.parentNode;
605
+ parentElm = dom.select(toType, tableElm)[0];
606
+ if (!parentElm) {
607
+ parentElm = dom.create(toType);
608
+ if (tableElm.firstChild) {
609
+ tableElm.insertBefore(parentElm, tableElm.firstChild);
610
+ } else {
611
+ tableElm.appendChild(parentElm);
612
+ }
613
+ }
614
+
615
+ parentElm.appendChild(rowElm);
616
+
617
+ if (!oldParentElm.hasChildNodes()) {
618
+ dom.remove(oldParentElm);
619
+ }
620
+ }
621
+
622
+ // Apply/remove alignment
623
+ unApplyAlign(rowElm);
624
+ if (data.align) {
625
+ editor.formatter.apply('align' + data.align, {}, rowElm);
626
+ }
627
+ });
628
+
629
+ editor.focus();
630
+ });
631
+ }
632
+
633
+ tableElm = editor.dom.getParent(editor.selection.getStart(), 'table');
634
+ cellElm = editor.dom.getParent(editor.selection.getStart(), 'td,th');
635
+
636
+ each(tableElm.rows, function(row) {
637
+ each(row.cells, function(cell) {
638
+ if (dom.hasClass(cell, 'mce-item-selected') || cell == cellElm) {
639
+ rows.push(row);
640
+ return false;
641
+ }
642
+ });
643
+ });
644
+
645
+ rowElm = rows[0];
646
+ if (!rowElm) {
647
+ // If this element is null, return now to avoid crashing.
648
+ return;
649
+ }
650
+
651
+ data = {
652
+ height: removePxSuffix(dom.getStyle(rowElm, 'height') || dom.getAttrib(rowElm, 'height')),
653
+ scope: dom.getAttrib(rowElm, 'scope'),
654
+ 'class': dom.getAttrib(rowElm, 'class')
655
+ };
656
+
657
+ data.type = rowElm.parentNode.nodeName.toLowerCase();
658
+
659
+ each('left center right'.split(' '), function(name) {
660
+ if (editor.formatter.matchNode(rowElm, 'align' + name)) {
661
+ data.align = name;
662
+ }
663
+ });
664
+
665
+ if (editor.settings.table_row_class_list) {
666
+ classListCtrl = {
667
+ name: 'class',
668
+ type: 'listbox',
669
+ label: 'Class',
670
+ values: buildListItems(
671
+ editor.settings.table_row_class_list,
672
+ function(item) {
673
+ if (item.value) {
674
+ item.textStyle = function() {
675
+ return editor.formatter.getCssText({block: 'tr', classes: [item.value]});
676
+ };
677
+ }
678
+ }
679
+ )
680
+ };
681
+ }
682
+
683
+ generalRowForm = {
684
+ type: 'form',
685
+ columns: 2,
686
+ padding: 0,
687
+ defaults: {
688
+ type: 'textbox'
689
+ },
690
+ items: [
691
+ {
692
+ type: 'listbox',
693
+ name: 'type',
694
+ label: 'Row type',
695
+ text: 'None',
696
+ maxWidth: null,
697
+ values: [
698
+ {text: 'Header', value: 'thead'},
699
+ {text: 'Body', value: 'tbody'},
700
+ {text: 'Footer', value: 'tfoot'}
701
+ ]
702
+ },
703
+ {
704
+ type: 'listbox',
705
+ name: 'align',
706
+ label: 'Alignment',
707
+ text: 'None',
708
+ maxWidth: null,
709
+ values: [
710
+ {text: 'None', value: ''},
711
+ {text: 'Left', value: 'left'},
712
+ {text: 'Center', value: 'center'},
713
+ {text: 'Right', value: 'right'}
714
+ ]
715
+ },
716
+ {label: 'Height', name: 'height'},
717
+ classListCtrl
718
+ ]
719
+ };
720
+
721
+ if (editor.settings.table_row_advtab !== false) {
722
+ appendStylesToData(dom, data, rowElm);
723
+
724
+ editor.windowManager.open({
725
+ title: "Row properties",
726
+ data: data,
727
+ bodyType: 'tabpanel',
728
+ body: [
729
+ {
730
+ title: 'General',
731
+ type: 'form',
732
+ items: generalRowForm
733
+ },
734
+ createStyleForm(dom)
735
+ ],
736
+
737
+ onsubmit: onSubmitRowForm
738
+ });
739
+ } else {
740
+ editor.windowManager.open({
741
+ title: "Row properties",
742
+ data: data,
743
+ body: generalRowForm,
744
+ onsubmit: onSubmitRowForm
745
+ });
746
+ }
747
+ };
748
+ };
749
+ });