activeadmin_trumbowyg 0.1.8 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (144) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +3 -6
  3. data/app/assets/fonts/trumbowyg/icons.svg +1 -0
  4. data/app/assets/javascripts/activeadmin/trumbowyg/langs/ar.js +67 -0
  5. data/app/assets/javascripts/activeadmin/trumbowyg/langs/bg.js +54 -0
  6. data/app/assets/javascripts/activeadmin/trumbowyg/langs/by.js +61 -0
  7. data/app/assets/javascripts/activeadmin/trumbowyg/langs/ca.js +57 -0
  8. data/app/assets/javascripts/activeadmin/trumbowyg/langs/cs.js +54 -0
  9. data/app/assets/javascripts/activeadmin/trumbowyg/langs/da.js +64 -0
  10. data/app/assets/javascripts/activeadmin/trumbowyg/langs/de.js +57 -0
  11. data/app/assets/javascripts/activeadmin/trumbowyg/langs/de.min.js +1 -1
  12. data/app/assets/javascripts/activeadmin/trumbowyg/langs/el.js +59 -0
  13. data/app/assets/javascripts/activeadmin/trumbowyg/langs/es.js +63 -0
  14. data/app/assets/javascripts/activeadmin/trumbowyg/langs/es_ar.js +56 -0
  15. data/app/assets/javascripts/activeadmin/trumbowyg/langs/fa.js +58 -0
  16. data/app/assets/javascripts/activeadmin/trumbowyg/langs/fi.js +58 -0
  17. data/app/assets/javascripts/activeadmin/trumbowyg/langs/fr.js +66 -0
  18. data/app/assets/javascripts/activeadmin/trumbowyg/langs/he.js +57 -0
  19. data/app/assets/javascripts/activeadmin/trumbowyg/langs/hr.js +54 -0
  20. data/app/assets/javascripts/activeadmin/trumbowyg/langs/hu.js +58 -0
  21. data/app/assets/javascripts/activeadmin/trumbowyg/langs/id.js +57 -0
  22. data/app/assets/javascripts/activeadmin/trumbowyg/langs/it.js +59 -0
  23. data/app/assets/javascripts/activeadmin/trumbowyg/langs/ja.js +63 -0
  24. data/app/assets/javascripts/activeadmin/trumbowyg/langs/ko.js +63 -0
  25. data/app/assets/javascripts/activeadmin/trumbowyg/langs/ko.min.js +3 -4
  26. data/app/assets/javascripts/activeadmin/trumbowyg/langs/lt.js +59 -0
  27. data/app/assets/javascripts/activeadmin/trumbowyg/langs/mn.js +49 -0
  28. data/app/assets/javascripts/activeadmin/trumbowyg/langs/my.js +54 -0
  29. data/app/assets/javascripts/activeadmin/trumbowyg/langs/nl.js +61 -0
  30. data/app/assets/javascripts/activeadmin/trumbowyg/langs/nl.min.js +1 -1
  31. data/app/assets/javascripts/activeadmin/trumbowyg/langs/no_nb.js +56 -0
  32. data/app/assets/javascripts/activeadmin/trumbowyg/langs/ph.js +54 -0
  33. data/app/assets/javascripts/activeadmin/trumbowyg/langs/pl.js +55 -0
  34. data/app/assets/javascripts/activeadmin/trumbowyg/langs/pt.js +65 -0
  35. data/app/assets/javascripts/activeadmin/trumbowyg/langs/pt_br.js +65 -0
  36. data/app/assets/javascripts/activeadmin/trumbowyg/langs/pt_br.min.js +1 -1
  37. data/app/assets/javascripts/activeadmin/trumbowyg/langs/ro.js +58 -0
  38. data/app/assets/javascripts/activeadmin/trumbowyg/langs/rs.js +53 -0
  39. data/app/assets/javascripts/activeadmin/trumbowyg/langs/rs_latin.js +54 -0
  40. data/app/assets/javascripts/activeadmin/trumbowyg/langs/ru.js +61 -0
  41. data/app/assets/javascripts/activeadmin/trumbowyg/langs/ru.min.js +1 -1
  42. data/app/assets/javascripts/activeadmin/trumbowyg/langs/sk.js +54 -0
  43. data/app/assets/javascripts/activeadmin/trumbowyg/langs/sl.js +48 -0
  44. data/app/assets/javascripts/activeadmin/trumbowyg/langs/sl.min.js +1 -0
  45. data/app/assets/javascripts/activeadmin/trumbowyg/langs/sq.js +65 -0
  46. data/app/assets/javascripts/activeadmin/trumbowyg/langs/sv.js +58 -0
  47. data/app/assets/javascripts/activeadmin/trumbowyg/langs/th.js +55 -0
  48. data/app/assets/javascripts/activeadmin/trumbowyg/langs/th.min.js +1 -1
  49. data/app/assets/javascripts/activeadmin/trumbowyg/langs/tr.js +55 -0
  50. data/app/assets/javascripts/activeadmin/trumbowyg/langs/ua.js +54 -0
  51. data/app/assets/javascripts/activeadmin/trumbowyg/langs/vi.js +56 -0
  52. data/app/assets/javascripts/activeadmin/trumbowyg/langs/vi.min.js +1 -1
  53. data/app/assets/javascripts/activeadmin/trumbowyg/langs/zh_cn.js +57 -0
  54. data/app/assets/javascripts/activeadmin/trumbowyg/langs/zh_tw.js +66 -0
  55. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/allowtagsfrompaste/trumbowyg.allowtagsfrompaste.js +22 -3
  56. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/allowtagsfrompaste/trumbowyg.allowtagsfrompaste.min.js +1 -1
  57. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/base64/trumbowyg.base64.js +14 -2
  58. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/base64/trumbowyg.base64.min.js +1 -1
  59. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/cleanpaste/trumbowyg.cleanpaste.js +9 -10
  60. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/cleanpaste/trumbowyg.cleanpaste.min.js +1 -1
  61. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/colors/trumbowyg.colors.js +88 -36
  62. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/colors/trumbowyg.colors.min.js +1 -1
  63. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/colors/ui/sass/trumbowyg.colors.scss +30 -11
  64. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/colors/ui/trumbowyg.colors.css +27 -15
  65. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/colors/ui/trumbowyg.colors.min.css +2 -2
  66. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/emoji/trumbowyg.emoji.js +914 -840
  67. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/emoji/trumbowyg.emoji.min.js +1 -1
  68. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/emoji/ui/sass/trumbowyg.emoji.scss +1 -4
  69. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/emoji/ui/trumbowyg.emoji.css +2 -5
  70. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/emoji/ui/trumbowyg.emoji.min.css +2 -2
  71. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/fontfamily/trumbowyg.fontfamily.js +24 -11
  72. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/fontfamily/trumbowyg.fontfamily.min.js +1 -1
  73. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/fontsize/trumbowyg.fontsize.js +121 -24
  74. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/fontsize/trumbowyg.fontsize.min.js +1 -1
  75. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/giphy/trumbowyg.giphy.js +182 -0
  76. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/giphy/trumbowyg.giphy.min.js +1 -0
  77. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/giphy/ui/sass/trumbowyg.giphy.scss +111 -0
  78. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/giphy/ui/trumbowyg.giphy.css +90 -0
  79. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/giphy/ui/trumbowyg.giphy.min.css +2 -0
  80. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/highlight/trumbowyg.highlight.js +11 -3
  81. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/highlight/trumbowyg.highlight.min.js +1 -1
  82. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/highlight/ui/sass/trumbowyg.highlight.scss +1 -1
  83. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/highlight/ui/trumbowyg.highlight.css +1 -1
  84. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/highlight/ui/trumbowyg.highlight.min.css +1 -1
  85. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/history/trumbowyg.history.js +17 -3
  86. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/history/trumbowyg.history.min.js +1 -1
  87. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/insertaudio/trumbowyg.insertaudio.js +9 -1
  88. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/insertaudio/trumbowyg.insertaudio.min.js +1 -1
  89. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/lineheight/trumbowyg.lineheight.js +59 -19
  90. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/lineheight/trumbowyg.lineheight.min.js +1 -1
  91. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mathml/trumbowyg.mathml.js +25 -6
  92. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mathml/trumbowyg.mathml.min.js +1 -1
  93. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mathml/ui/sass/trumbowyg.mathml.scss +10 -10
  94. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mathml/ui/trumbowyg.mathml.css +9 -9
  95. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mathml/ui/trumbowyg.mathml.min.css +2 -2
  96. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mention/trumbowyg.mention.js +26 -21
  97. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mention/trumbowyg.mention.min.js +1 -1
  98. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mention/ui/sass/trumbowyg.mention.scss +1 -11
  99. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mention/ui/trumbowyg.mention.css +14 -22
  100. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mention/ui/trumbowyg.mention.min.css +2 -2
  101. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/noembed/trumbowyg.noembed.js +11 -1
  102. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/noembed/trumbowyg.noembed.min.js +1 -1
  103. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/pasteimage/trumbowyg.pasteimage.js +9 -1
  104. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/pasteimage/trumbowyg.pasteimage.min.js +1 -1
  105. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/preformatted/trumbowyg.preformatted.js +6 -0
  106. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/preformatted/trumbowyg.preformatted.min.js +1 -1
  107. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/resizimg/resizable-resolveconflict.js +20 -0
  108. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/resizimg/resizable-resolveconflict.min.js +1 -0
  109. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/resizimg/trumbowyg.resizimg.js +252 -18
  110. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/resizimg/trumbowyg.resizimg.min.js +1 -1
  111. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/ruby/trumbowyg.ruby.js +12 -0
  112. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/ruby/trumbowyg.ruby.min.js +1 -1
  113. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/specialchars/trumbowyg.specialchars.js +79 -0
  114. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/specialchars/trumbowyg.specialchars.min.js +1 -0
  115. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/specialchars/ui/sass/trumbowyg.specialchars.scss +56 -0
  116. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/specialchars/ui/trumbowyg.specialchars.css +47 -0
  117. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/specialchars/ui/trumbowyg.specialchars.min.css +2 -0
  118. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/table/trumbowyg.table.js +272 -157
  119. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/table/trumbowyg.table.min.js +1 -1
  120. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/table/ui/sass/trumbowyg.table.scss +5 -1
  121. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/table/ui/trumbowyg.table.css +4 -1
  122. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/table/ui/trumbowyg.table.min.css +2 -2
  123. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/template/trumbowyg.template.js +14 -3
  124. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/template/trumbowyg.template.min.js +1 -1
  125. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/upload/trumbowyg.upload.js +15 -4
  126. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/upload/trumbowyg.upload.min.js +1 -1
  127. data/app/assets/javascripts/activeadmin/trumbowyg/trumbowyg.js +234 -132
  128. data/app/assets/javascripts/activeadmin/trumbowyg/trumbowyg.min.js +2 -2
  129. data/app/assets/javascripts/activeadmin/trumbowyg_input.js +3 -3
  130. data/app/assets/stylesheets/activeadmin/trumbowyg/{ui/sass/trumbowyg.scss → trumbowyg.scss} +22 -7
  131. data/lib/activeadmin/trumbowyg/version.rb +1 -1
  132. metadata +192 -22
  133. data/.gitignore +0 -3
  134. data/Gemfile +0 -4
  135. data/activeadmin_trumbowyg.gemspec +0 -19
  136. data/app/assets/fonts/active_admin-trumbowyg.svg +0 -1
  137. data/app/assets/javascripts/activeadmin/trumbowyg/ui/icons.svg +0 -1
  138. data/app/assets/javascripts/activeadmin/trumbowyg/ui/sass/trumbowyg.scss +0 -809
  139. data/app/assets/javascripts/activeadmin/trumbowyg/ui/trumbowyg.css +0 -587
  140. data/app/assets/javascripts/activeadmin/trumbowyg/ui/trumbowyg.min.css +0 -2
  141. data/app/assets/stylesheets/activeadmin/trumbowyg/ui/icons.svg +0 -1
  142. data/app/assets/stylesheets/activeadmin/trumbowyg/ui/trumbowyg.css +0 -587
  143. data/app/assets/stylesheets/activeadmin/trumbowyg/ui/trumbowyg.min.css +0 -2
  144. data/screenshot.jpg +0 -0
@@ -1 +1 @@
1
- !function(i){"use strict";var e={minSize:32,step:4},n=function(i){return i.preventDefault()};i.extend(!0,i.trumbowyg,{plugins:{resizimg:{init:function(t){function o(){t.$ed.find("img:not(.resizable)").resizable(t.o.plugins.resizimg.resizable).on("mousedown",n)}function r(){t.$ed.find("img.resizable").resizable("destroy").off("mousedown",n),t.syncTextarea()}t.o.plugins.resizimg=i.extend(!0,{},e,t.o.plugins.resizimg||{},{resizable:{resizeWidth:!1,onDragStart:function(i,e){var n=t.o.plugins.resizimg,o=i.pageX-e.offset().left,r=i.pageY-e.offset().top;if(o<e.width()-n.minSize||r<e.height()-n.minSize)return!1},onDrag:function(i,e,n,o){var r=t.o.plugins.resizimg;return o<r.minSize&&(o=r.minSize),o-=o%r.step,e.height(o),!1},onDragEnd:function(){t.$c.trigger("tbwchange")}}}),t.$c.on("tbwinit",o),t.$c.on("tbwfocus",o),t.$c.on("tbwchange",o),t.$c.on("tbwblur",r),t.$c.on("tbwclose",r)}}}})}(jQuery);
1
+ !function(e){"use strict";function i(e){e.stopPropagation(),e.preventDefault()}function t(e){e.$ed.find("canvas.resizable").resizable("destroy").off("mousedown",i).removeClass("resizable"),r.reset(),e.syncCode()}var s={minSize:32,step:4},n=function(){this.resizeCanvas=document.createElement("canvas"),this.resizeCanvas.setAttribute("tabindex","0"),this.resizeCanvas.id="trumbowyg-resizimg-"+ +new Date,this.ctx=null,this.resizeImg=null,this.pressEscape=function(e){e.reset()},this.pressBackspaceOrDelete=function(i){e(i.resizeCanvas).replaceWith(""),i.resizeImg=null};var t,s,n=!1,r=!1,a=function(e){var i=e.getBoundingClientRect();t=i.left,s=i.top},h=function(e,i,t,s,n){return i.translate(.5,.5),i.lineWidth=1,i.drawImage(t,5,5,s-10,n-10),i.beginPath(),i.rect(5,5,s-10,n-10),i.stroke(),i.beginPath(),i.fillStyle="rgb(255, 255, 255)",i.rect(s-10,n-10,9,9),i.fill(),i.stroke(),a(e),i};this.init=function(){var i=this;e(window).on("scroll resize",function(){i.reCalcOffset()})},this.reCalcOffset=function(){a(this.resizeCanvas)},this.canvasId=function(){return this.resizeCanvas.id},this.isActive=function(){return null!==this.resizeImg},this.isFocusedNow=function(){return n},this.blurNow=function(){n=!1},this.reset=function(){null!==this.resizeImg&&(this.resizeImg.width=this.resizeCanvas.clientWidth-10,this.resizeImg.height=this.resizeCanvas.clientHeight-10,this.resizeImg.removeAttribute("style"),e(this.resizeCanvas).replaceWith(e(this.resizeImg)),this.resizeCanvas.removeAttribute("style"),this.resizeImg=null)},this.setup=function(a,o){if(this.resizeImg=a,!this.resizeCanvas.getContext)return!1;n=!0,this.resizeCanvas.width=e(this.resizeImg).width()+10,this.resizeCanvas.height=e(this.resizeImg).height()+10,this.resizeCanvas.style.margin="-5px",this.ctx=this.resizeCanvas.getContext("2d"),e(this.resizeImg).replaceWith(e(this.resizeCanvas)),h(this.resizeCanvas,this.ctx,this.resizeImg,this.resizeCanvas.width,this.resizeCanvas.height),e(this.resizeCanvas).resizable(o).on("mousedown",i);var c=this;return e(this.resizeCanvas).on("mousemove",function(e){var i=Math.round(e.clientX-t),n=Math.round(e.clientY-s),a=r;c.ctx.rect(c.resizeCanvas.width-10,c.resizeCanvas.height-10,9,9),r=c.ctx.isPointInPath(i,n),a!==r&&(this.style.cursor=r?"se-resize":"default")}).on("keydown",function(e){if(c.isActive()){var i=e.keyCode;27===i?c.pressEscape(c):8!==i&&46!==i||c.pressBackspaceOrDelete(c)}}).on("focus",i),this.resizeCanvas.focus(),!0},this.refresh=function(){this.resizeCanvas.getContext&&(this.resizeCanvas.width=this.resizeCanvas.clientWidth,this.resizeCanvas.height=this.resizeCanvas.clientHeight,h(this.resizeCanvas,this.ctx,this.resizeImg,this.resizeCanvas.width,this.resizeCanvas.height))}},r=new n;e.extend(!0,e.trumbowyg,{plugins:{resizimg:{init:function(n){function a(){n.$ed.find("img").off("click").on("click",function(e){r.isActive()&&r.reset(),r.setup(this,n.o.plugins.resizimg.resizable),i(e)})}n.o.plugins.resizimg=e.extend(!0,{},s,n.o.plugins.resizimg||{},{resizable:{resizeWidth:!1,onDragStart:function(e,i){var t=n.o.plugins.resizimg,s=e.pageX-i.offset().left,r=e.pageY-i.offset().top;if(s<i.width()-t.minSize||r<i.height()-t.minSize)return!1},onDrag:function(e,i,t,s){var r=n.o.plugins.resizimg;return s<r.minSize&&(s=r.minSize),s-=s%r.step,i.height(s),!1},onDragEnd:function(){r.refresh(),n.syncCode()}}}),n.$c.on("tbwinit",function(){a(),n.$ed.on("click",function(t){e(t.target).is("img")||t.target.id===r.canvasId()||(i(t),r.reset(),n.$c.trigger("tbwchange"))}),n.$ed.on("scroll",function(){r.reCalcOffset()})}),n.$c.on("tbwfocus tbwchange",a),n.$c.on("tbwresize",function(){r.reCalcOffset()}),n.$c.on("tbwblur",function(){r.isFocusedNow()?r.blurNow():t(n)})},destroy:function(e){t(e)}}}})}(jQuery);
@@ -13,6 +13,7 @@
13
13
 
14
14
  $.extend(true, $.trumbowyg, {
15
15
  langs: {
16
+ // jshint camelcase:false
16
17
  en: {
17
18
  ruby: 'Add ruby text',
18
19
  rubyModal: 'Ruby modal',
@@ -33,6 +34,16 @@
33
34
  rubyModal: 'Modal teks ruby',
34
35
  rubyText: 'Teks ruby'
35
36
  },
37
+ ko: {
38
+ ruby: '루비 문자 넣기',
39
+ rubyModal: '대상 문자',
40
+ rubyText: '루비 문자'
41
+ },
42
+ pt_br: {
43
+ ruby: 'Adicionar texto ruby',
44
+ rubyModal: 'Modal ruby',
45
+ rubyText: 'Texto ruby'
46
+ },
36
47
  tr: {
37
48
  ruby: 'Ruby metni ekle',
38
49
  rubyModal: 'Ruby modal',
@@ -43,6 +54,7 @@
43
54
  rubyModal: 'Ruby 彈跳視窗',
44
55
  rubyText: 'Ruby 文字'
45
56
  },
57
+ // jshint camelcase:true
46
58
  },
47
59
  plugins: {
48
60
  ruby: {
@@ -1 +1 @@
1
- !function(r){"use strict";r.extend(!0,r.trumbowyg,{langs:{en:{ruby:"Add ruby text",rubyModal:"Ruby modal",rubyText:"Ruby text"},da:{ruby:"Tilføj ruby tekst",rubyModal:"Ruby modal",rubyText:"Ruby tekst"},fr:{ruby:"Ajouter du texte ruby",rubyModal:"Modale ruby",rubyText:"Texte ruby"},id:{ruby:"Sisipkan teks ruby",rubyModal:"Modal teks ruby",rubyText:"Teks ruby"},tr:{ruby:"Ruby metni ekle",rubyModal:"Ruby modal",rubyText:"Ruby metni"},zh_tw:{ruby:"加入 ruby 文字",rubyModal:"Ruby 彈跳視窗",rubyText:"Ruby 文字"}},plugins:{ruby:{init:function(e){var u={fn:function(){e.saveRange(),e.openModalInsert(e.lang.ruby,{rubyText:{label:e.lang.rubyText,required:!1},modal:{label:e.lang.rubyModal,value:e.getRangeText(),required:!0}},function(u){var t=r('<ruby title="'+u.rubyText+'">'+u.modal+"<rp> (</rp><rt>"+u.rubyText+"</rt><rp>)</rp></ruby>")[0];return e.range.deleteContents(),e.range.insertNode(t),e.syncCode(),e.$c.trigger("tbwchange"),!0})}};e.addBtnDef("ruby",u)}}}})}(jQuery);
1
+ !function(r){"use strict";r.extend(!0,r.trumbowyg,{langs:{en:{ruby:"Add ruby text",rubyModal:"Ruby modal",rubyText:"Ruby text"},da:{ruby:"Tilføj ruby tekst",rubyModal:"Ruby modal",rubyText:"Ruby tekst"},fr:{ruby:"Ajouter du texte ruby",rubyModal:"Modale ruby",rubyText:"Texte ruby"},id:{ruby:"Sisipkan teks ruby",rubyModal:"Modal teks ruby",rubyText:"Teks ruby"},ko:{ruby:"루비 문자 넣기",rubyModal:"대상 문자",rubyText:"루비 문자"},pt_br:{ruby:"Adicionar texto ruby",rubyModal:"Modal ruby",rubyText:"Texto ruby"},tr:{ruby:"Ruby metni ekle",rubyModal:"Ruby modal",rubyText:"Ruby metni"},zh_tw:{ruby:"加入 ruby 文字",rubyModal:"Ruby 彈跳視窗",rubyText:"Ruby 文字"}},plugins:{ruby:{init:function(u){var e={fn:function(){u.saveRange(),u.openModalInsert(u.lang.ruby,{rubyText:{label:u.lang.rubyText,required:!1},modal:{label:u.lang.rubyModal,value:u.getRangeText(),required:!0}},function(e){var b=r('<ruby title="'+e.rubyText+'">'+e.modal+"<rp> (</rp><rt>"+e.rubyText+"</rt><rp>)</rp></ruby>")[0];return u.range.deleteContents(),u.range.insertNode(b),u.syncCode(),u.$c.trigger("tbwchange"),!0})}};u.addBtnDef("ruby",e)}}}})}(jQuery);
@@ -0,0 +1,79 @@
1
+ /* ===========================================================
2
+ * trumbowyg.specialchars.js v0.99
3
+ * Unicode characters picker plugin for Trumbowyg
4
+ * http://alex-d.github.com/Trumbowyg
5
+ * ===========================================================
6
+ * Author : Renaud Hoyoux (geektortoise)
7
+ */
8
+
9
+ (function ($) {
10
+ 'use strict';
11
+
12
+ var defaultOptions = {
13
+ symbolList: [
14
+ // currencies
15
+ '0024', '20AC', '00A3', '00A2', '00A5', '00A4', '2030', null,
16
+ // legal signs
17
+ '00A9', '00AE', '2122', null,
18
+ // textual sign
19
+ '00A7', '00B6', '00C6', '00E6', '0152', '0153', null,
20
+ '2022', '25CF', '2023', '25B6', '2B29', '25C6', null,
21
+ //maths
22
+ '00B1', '00D7', '00F7', '21D2', '21D4', '220F', '2211', '2243', '2264', '2265'
23
+ ]
24
+ };
25
+
26
+ $.extend(true, $.trumbowyg, {
27
+ langs: {
28
+ en: {
29
+ specialChars: 'Special characters'
30
+ },
31
+ fr: {
32
+ specialChars: 'Caractères spéciaux'
33
+ },
34
+ ko: {
35
+ specialChars: '특수문자'
36
+ },
37
+ },
38
+ plugins: {
39
+ specialchars: {
40
+ init: function (trumbowyg) {
41
+ trumbowyg.o.plugins.specialchars = trumbowyg.o.plugins.specialchars || defaultOptions;
42
+ var specialCharsBtnDef = {
43
+ dropdown: buildDropdown(trumbowyg)
44
+ };
45
+
46
+ trumbowyg.addBtnDef('specialChars', specialCharsBtnDef);
47
+ }
48
+ }
49
+ }
50
+ });
51
+
52
+ function buildDropdown(trumbowyg) {
53
+ var dropdown = [];
54
+ $.each(trumbowyg.o.plugins.specialchars.symbolList, function (i, symbol) {
55
+ if (symbol === null) {
56
+ symbol = '&nbsp';
57
+ } else {
58
+ symbol = '&#x' + symbol;
59
+ }
60
+
61
+ var btn = symbol.replace(/:/g, ''),
62
+ defaultSymbolBtnName = 'symbol-' + btn,
63
+ defaultSymbolBtnDef = {
64
+ text: symbol,
65
+ hasIcon: false,
66
+ fn: function () {
67
+ var encodedSymbol = String.fromCodePoint(parseInt(symbol.replace('&#', '0')));
68
+ trumbowyg.execCmd('insertText', encodedSymbol);
69
+ return true;
70
+ }
71
+ };
72
+
73
+ trumbowyg.addBtnDef(defaultSymbolBtnName, defaultSymbolBtnDef);
74
+ dropdown.push(defaultSymbolBtnName);
75
+ });
76
+
77
+ return dropdown;
78
+ }
79
+ })(jQuery);
@@ -0,0 +1 @@
1
+ !function(s){"use strict";function a(a){var n=[];return s.each(a.o.plugins.specialchars.symbolList,function(s,e){e=null===e?"&nbsp":"&#x"+e;var r=e.replace(/:/g,""),l="symbol-"+r,c={text:e,hasIcon:!1,fn:function(){var s=String.fromCodePoint(parseInt(e.replace("&#","0")));return a.execCmd("insertText",s),!0}};a.addBtnDef(l,c),n.push(l)}),n}var n={symbolList:["0024","20AC","00A3","00A2","00A5","00A4","2030",null,"00A9","00AE","2122",null,"00A7","00B6","00C6","00E6","0152","0153",null,"2022","25CF","2023","25B6","2B29","25C6",null,"00B1","00D7","00F7","21D2","21D4","220F","2211","2243","2264","2265"]};s.extend(!0,s.trumbowyg,{langs:{en:{specialChars:"Special characters"},fr:{specialChars:"Caractères spéciaux"},ko:{specialChars:"특수문자"}},plugins:{specialchars:{init:function(s){s.o.plugins.specialchars=s.o.plugins.specialchars||n;var e={dropdown:a(s)};s.addBtnDef("specialChars",e)}}}})}(jQuery);
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Trumbowyg v2.21.0 - A lightweight WYSIWYG editor
3
+ * Default stylesheet for Trumbowyg editor plugin
4
+ * ------------------------
5
+ * @link http://alex-d.github.io/Trumbowyg
6
+ * @license MIT
7
+ * @author Alexandre Demode (Alex-D)
8
+ * Twitter : @AlexandreDemode
9
+ * Website : alex-d.fr
10
+ */
11
+
12
+ .trumbowyg-symbol-\&nbsp-dropdown-button {
13
+ display: none !important;
14
+ }
15
+ .trumbowyg-symbol-\&nbsp-dropdown-button + button {
16
+ clear: both;
17
+ }
18
+
19
+ .trumbowyg-dropdown-specialChars {
20
+ width: 248px;
21
+ padding: 5px 3px 3px;
22
+ }
23
+
24
+ .trumbowyg-dropdown-specialChars button {
25
+ display: block;
26
+ position: relative;
27
+ float: left;
28
+ height: 26px;
29
+ width: 26px;
30
+ padding: 0;
31
+ margin: 2px;
32
+ line-height: 24px;
33
+ text-align: center;
34
+
35
+ &:hover,
36
+ &:focus {
37
+ &::after {
38
+ display: block;
39
+ position: absolute;
40
+ top: -5px;
41
+ left: -5px;
42
+ height: 27px;
43
+ width: 27px;
44
+ background: inherit;
45
+ box-shadow: #000 0 0 2px;
46
+ z-index: 10;
47
+ background-color: transparent;
48
+ }
49
+ }
50
+ }
51
+
52
+ .trumbowyg .specialChars {
53
+ width: 22px;
54
+ height: 22px;
55
+ display: inline-block;
56
+ }
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Trumbowyg v2.21.0 - A lightweight WYSIWYG editor
3
+ * Trumbowyg plugin stylesheet
4
+ * ------------------------
5
+ * @link http://alex-d.github.io/Trumbowyg
6
+ * @license MIT
7
+ * @author Alexandre Demode (Alex-D)
8
+ * Twitter : @AlexandreDemode
9
+ * Website : alex-d.fr
10
+ */
11
+
12
+ .trumbowyg-symbol-\&nbsp-dropdown-button {
13
+ display: none !important; }
14
+
15
+ .trumbowyg-symbol-\&nbsp-dropdown-button + button {
16
+ clear: both; }
17
+
18
+ .trumbowyg-dropdown-specialChars {
19
+ width: 248px;
20
+ padding: 5px 3px 3px; }
21
+
22
+ .trumbowyg-dropdown-specialChars button {
23
+ display: block;
24
+ position: relative;
25
+ float: left;
26
+ height: 26px;
27
+ width: 26px;
28
+ padding: 0;
29
+ margin: 2px;
30
+ line-height: 24px;
31
+ text-align: center; }
32
+ .trumbowyg-dropdown-specialChars button:hover::after, .trumbowyg-dropdown-specialChars button:focus::after {
33
+ display: block;
34
+ position: absolute;
35
+ top: -5px;
36
+ left: -5px;
37
+ height: 27px;
38
+ width: 27px;
39
+ background: inherit;
40
+ box-shadow: #000 0 0 2px;
41
+ z-index: 10;
42
+ background-color: transparent; }
43
+
44
+ .trumbowyg .specialChars {
45
+ width: 22px;
46
+ height: 22px;
47
+ display: inline-block; }
@@ -0,0 +1,2 @@
1
+ /** Trumbowyg v2.21.0 - A lightweight WYSIWYG editor - alex-d.github.io/Trumbowyg - License MIT - Author : Alexandre Demode (Alex-D) / alex-d.fr */
2
+ .trumbowyg-symbol-\&nbsp-dropdown-button{display:none!important}.trumbowyg-symbol-\&nbsp-dropdown-button+button{clear:both}.trumbowyg-dropdown-specialChars{width:248px;padding:5px 3px 3px}.trumbowyg-dropdown-specialChars button{display:block;position:relative;float:left;height:26px;width:26px;padding:0;margin:2px;line-height:24px;text-align:center}.trumbowyg-dropdown-specialChars button:focus::after,.trumbowyg-dropdown-specialChars button:hover::after{display:block;position:absolute;top:-5px;left:-5px;height:27px;width:27px;background:inherit;box-shadow:#000 0 0 2px;z-index:10;background-color:transparent}.trumbowyg .specialChars{width:22px;height:22px;display:inline-block}
@@ -17,54 +17,72 @@
17
17
 
18
18
  $.extend(true, $.trumbowyg, {
19
19
  langs: {
20
+ // jshint camelcase:false
20
21
  en: {
21
22
  table: 'Insert table',
22
23
  tableAddRow: 'Add row',
23
- tableAddColumn: 'Add column',
24
+ tableAddRowAbove: 'Add row above',
25
+ tableAddColumnLeft: 'Add column to the left',
26
+ tableAddColumn: 'Add column to the right',
24
27
  tableDeleteRow: 'Delete row',
25
28
  tableDeleteColumn: 'Delete column',
26
29
  tableDestroy: 'Delete table',
27
30
  error: 'Error'
28
31
  },
29
32
  da: {
30
- table: 'Indsæt tabel',
31
- tableAddRow: 'Tilføj række',
32
- tableAddColumn: 'Tilføj kolonne',
33
- tableDeleteRow: 'Slet række',
34
- tableDeleteColumn: 'Slet kolonne',
35
- tableDestroy: 'Slet tabel',
36
- error: 'Fejl'
33
+ table: 'Indsæt tabel',
34
+ tableAddRow: 'Tilføj række',
35
+ tableAddRowAbove: 'Tilføj række',
36
+ tableAddColumnLeft: 'Tilføj kolonne',
37
+ tableAddColumn: 'Tilføj kolonne',
38
+ tableDeleteRow: 'Slet række',
39
+ tableDeleteColumn: 'Slet kolonne',
40
+ tableDestroy: 'Slet tabel',
41
+ error: 'Fejl'
37
42
  },
38
43
  de: {
39
- table: 'Tabelle einfügen',
40
- tableAddRow: 'Zeile hinzufügen',
41
- tableAddColumn: 'Spalte hinzufügen',
42
- tableDeleteRow: 'Zeile löschen',
43
- tableDeleteColumn: 'Spalte löschen',
44
- tableDestroy: 'Tabelle löschen',
45
- error: 'Error'
44
+ table: 'Tabelle einfügen',
45
+ tableAddRow: 'Zeile hinzufügen',
46
+ tableAddRowAbove: 'Zeile hinzufügen',
47
+ tableAddColumnLeft: 'Spalte hinzufügen',
48
+ tableAddColumn: 'Spalte hinzufügen',
49
+ tableDeleteRow: 'Zeile löschen',
50
+ tableDeleteColumn: 'Spalte löschen',
51
+ tableDestroy: 'Tabelle löschen',
52
+ error: 'Error'
46
53
  },
47
54
  sk: {
48
55
  table: 'Vytvoriť tabuľky',
49
56
  tableAddRow: 'Pridať riadok',
57
+ tableAddRowAbove: 'Pridať riadok',
58
+ tableAddColumnLeft: 'Pridať stĺpec',
50
59
  tableAddColumn: 'Pridať stĺpec',
51
60
  error: 'Chyba'
52
61
  },
53
62
  fr: {
54
63
  table: 'Insérer un tableau',
55
64
  tableAddRow: 'Ajouter des lignes',
65
+ tableAddRowAbove: 'Ajouter des lignes',
66
+ tableAddColumnLeft: 'Ajouter des colonnes',
56
67
  tableAddColumn: 'Ajouter des colonnes',
68
+ tableDeleteRow: 'Effacer la ligne',
69
+ tableDeleteColumn: 'Effacer la colonne',
70
+ tableDestroy: 'Effacer le tableau',
57
71
  error: 'Erreur'
58
72
  },
59
73
  cs: {
60
74
  table: 'Vytvořit příkaz Table',
61
75
  tableAddRow: 'Přidat řádek',
76
+ tableAddRowAbove: 'Přidat řádek',
77
+ tableAddColumnLeft: 'Přidat sloupec',
62
78
  tableAddColumn: 'Přidat sloupec',
63
79
  error: 'Chyba'
64
80
  },
65
81
  ru: {
66
82
  table: 'Вставить таблицу',
67
83
  tableAddRow: 'Добавить строку',
84
+ tableAddRowAbove: 'Добавить строку',
85
+ tableAddColumnLeft: 'Добавить столбец',
68
86
  tableAddColumn: 'Добавить столбец',
69
87
  tableDeleteRow: 'Удалить строку',
70
88
  tableDeleteColumn: 'Удалить столбец',
@@ -74,24 +92,64 @@
74
92
  ja: {
75
93
  table: '表の挿入',
76
94
  tableAddRow: '行の追加',
95
+ tableAddRowAbove: '行の追加',
96
+ tableAddColumnLeft: '列の追加',
77
97
  tableAddColumn: '列の追加',
78
98
  error: 'エラー'
79
99
  },
80
100
  tr: {
81
101
  table: 'Tablo ekle',
82
102
  tableAddRow: 'Satır ekle',
103
+ tableAddRowAbove: 'Satır ekle',
104
+ tableAddColumnLeft: 'Kolon ekle',
83
105
  tableAddColumn: 'Kolon ekle',
84
106
  error: 'Hata'
85
107
  },
86
108
  zh_tw: {
87
- table: '插入表格',
88
- tableAddRow: '加入行',
89
- tableAddColumn: '加入列',
90
- tableDeleteRow: '刪除行',
91
- tableDeleteColumn: '刪除列',
92
- tableDestroy: '刪除表格',
93
- error: '錯誤'
109
+ table: '插入表格',
110
+ tableAddRow: '加入行',
111
+ tableAddRowAbove: '加入行',
112
+ tableAddColumnLeft: '加入列',
113
+ tableAddColumn: '加入列',
114
+ tableDeleteRow: '刪除行',
115
+ tableDeleteColumn: '刪除列',
116
+ tableDestroy: '刪除表格',
117
+ error: '錯誤'
118
+ },
119
+ id: {
120
+ table: 'Sisipkan tabel',
121
+ tableAddRow: 'Sisipkan baris',
122
+ tableAddRowAbove: 'Sisipkan baris',
123
+ tableAddColumnLeft: 'Sisipkan kolom',
124
+ tableAddColumn: 'Sisipkan kolom',
125
+ tableDeleteRow: 'Hapus baris',
126
+ tableDeleteColumn: 'Hapus kolom',
127
+ tableDestroy: 'Hapus tabel',
128
+ error: 'Galat'
129
+ },
130
+ pt_br: {
131
+ table: 'Inserir tabela',
132
+ tableAddRow: 'Adicionar linha',
133
+ tableAddRowAbove: 'Adicionar linha',
134
+ tableAddColumnLeft: 'Adicionar coluna',
135
+ tableAddColumn: 'Adicionar coluna',
136
+ tableDeleteRow: 'Deletar linha',
137
+ tableDeleteColumn: 'Deletar coluna',
138
+ tableDestroy: 'Deletar tabela',
139
+ error: 'Erro'
94
140
  },
141
+ ko: {
142
+ table: '표 넣기',
143
+ tableAddRow: '줄 추가',
144
+ tableAddRowAbove: '줄 추가',
145
+ tableAddColumnLeft: '칸 추가',
146
+ tableAddColumn: '칸 추가',
147
+ tableDeleteRow: '줄 삭제',
148
+ tableDeleteColumn: '칸 삭제',
149
+ tableDestroy: '표 지우기',
150
+ error: '에러'
151
+ },
152
+ // jshint camelcase:true
95
153
  },
96
154
 
97
155
  plugins: {
@@ -101,198 +159,255 @@
101
159
 
102
160
  var buildButtonDef = {
103
161
  fn: function () {
104
- t.saveRange();
105
-
106
- var btnName = 'table';
107
-
108
- var dropdownPrefix = t.o.prefix + 'dropdown',
109
- dropdownOptions = { // the dropdown
110
- class: dropdownPrefix + '-' + btnName + ' ' + dropdownPrefix + ' ' + t.o.prefix + 'fixed-top'
111
- };
112
- dropdownOptions['data-' + dropdownPrefix] = btnName;
113
- var $dropdown = $('<div/>', dropdownOptions);
114
-
115
- if (t.$box.find("." + dropdownPrefix + "-" + btnName).length === 0) {
116
- t.$box.append($dropdown.hide());
117
- } else {
118
- $dropdown = t.$box.find("." + dropdownPrefix + "-" + btnName);
119
- }
120
-
121
- // clear dropdown
122
- $dropdown.html('');
123
-
124
- // when active table show AddRow / AddColumn
125
- if (t.$box.find("." + t.o.prefix + "table-button").hasClass(t.o.prefix + 'active-button')) {
126
- $dropdown.append(t.buildSubBtn('tableAddRow'));
127
- $dropdown.append(t.buildSubBtn('tableAddColumn'));
128
- $dropdown.append(t.buildSubBtn('tableDeleteRow'));
129
- $dropdown.append(t.buildSubBtn('tableDeleteColumn'));
130
- $dropdown.append(t.buildSubBtn('tableDestroy'));
131
- } else {
132
- var tableSelect = $('<table></table>');
133
- for (var i = 0; i < t.o.plugins.table.rows; i += 1) {
134
- var row = $('<tr></tr>').appendTo(tableSelect);
135
- for (var j = 0; j < t.o.plugins.table.columns; j += 1) {
136
- $('<td></td>').appendTo(row);
137
- }
162
+ t.saveRange();
163
+
164
+ var btnName = 'table';
165
+
166
+ var dropdownPrefix = t.o.prefix + 'dropdown',
167
+ dropdownOptions = { // the dropdown
168
+ class: dropdownPrefix + '-' + btnName + ' ' + dropdownPrefix + ' ' + t.o.prefix + 'fixed-top'
169
+ };
170
+ dropdownOptions['data-' + dropdownPrefix] = btnName;
171
+ var $dropdown = $('<div/>', dropdownOptions);
172
+
173
+ if (t.$box.find('.' + dropdownPrefix + '-' + btnName).length === 0) {
174
+ t.$box.append($dropdown.hide());
175
+ } else {
176
+ $dropdown = t.$box.find('.' + dropdownPrefix + '-' + btnName);
138
177
  }
139
- tableSelect.find('td').on('mouseover', tableAnimate);
140
- tableSelect.find('td').on('mousedown', tableBuild);
141
178
 
142
- $dropdown.append(tableSelect);
143
- $dropdown.append($('<center>1x1</center>'));
144
- }
179
+ // clear dropdown
180
+ $dropdown.html('');
181
+
182
+ // when active table show AddRow / AddColumn
183
+ if (t.$box.find('.' + t.o.prefix + 'table-button').hasClass(t.o.prefix + 'active-button')) {
184
+ $dropdown.append(t.buildSubBtn('tableAddRowAbove'));
185
+ $dropdown.append(t.buildSubBtn('tableAddRow'));
186
+ $dropdown.append(t.buildSubBtn('tableAddColumnLeft'));
187
+ $dropdown.append(t.buildSubBtn('tableAddColumn'));
188
+ $dropdown.append(t.buildSubBtn('tableDeleteRow'));
189
+ $dropdown.append(t.buildSubBtn('tableDeleteColumn'));
190
+ $dropdown.append(t.buildSubBtn('tableDestroy'));
191
+ } else {
192
+ var tableSelect = $('<table/>');
193
+ $('<tbody/>').appendTo(tableSelect);
194
+ for (var i = 0; i < t.o.plugins.table.rows; i += 1) {
195
+ var row = $('<tr/>').appendTo(tableSelect);
196
+ for (var j = 0; j < t.o.plugins.table.columns; j += 1) {
197
+ $('<td/>').appendTo(row);
198
+ }
199
+ }
200
+ tableSelect.find('td').on('mouseover', tableAnimate);
201
+ tableSelect.find('td').on('mousedown', tableBuild);
202
+
203
+ $dropdown.append(tableSelect);
204
+ $dropdown.append($('<div class="trumbowyg-table-size">1x1</div>'));
205
+ }
145
206
 
146
- t.dropdown(btnName);
207
+ t.dropdown(btnName);
147
208
  }
148
209
  };
149
210
 
150
- var tableAnimate = function(column_event) {
151
- var column = $(column_event.target),
152
- table = column.parents('table'),
153
- colIndex = this.cellIndex,
154
- rowIndex = this.parentNode.rowIndex;
211
+ var tableAnimate = function(columnEvent) {
212
+ var column = $(columnEvent.target),
213
+ table = column.closest('table'),
214
+ colIndex = this.cellIndex,
215
+ rowIndex = this.parentNode.rowIndex;
155
216
 
156
- // reset all columns
157
- table.find('td').removeClass('active');
217
+ // reset all columns
218
+ table.find('td').removeClass('active');
158
219
 
159
- for (var i = 0; i <= rowIndex; i += 1) {
160
- for (var j = 0; j <= colIndex; j += 1) {
161
- table.find("tr:nth-of-type("+(i+1)+")").find("td:nth-of-type("+(j+1)+")").addClass('active');
220
+ for (var i = 0; i <= rowIndex; i += 1) {
221
+ for (var j = 0; j <= colIndex; j += 1) {
222
+ table.find('tr:nth-of-type('+(i+1)+')').find('td:nth-of-type('+(j+1)+')').addClass('active');
223
+ }
162
224
  }
163
- }
164
225
 
165
- // set label
166
- table.next('center').html((colIndex+1) + "x" + (rowIndex+1));
226
+ // set label
227
+ table.next('.trumbowyg-table-size').html((colIndex+1) + 'x' + (rowIndex+1));
167
228
  };
168
229
 
169
- var tableBuild = function(column_event) {
170
- t.saveRange();
230
+ var tableBuild = function() {
231
+ t.saveRange();
171
232
 
172
- var tabler = $('<table></table>');
173
- if (t.o.plugins.table.styler) {
174
- tabler.attr('class', t.o.plugins.table.styler);
175
- }
233
+ var tabler = $('<table/>');
234
+ $('<tbody/>').appendTo(tabler);
235
+ if (t.o.plugins.table.styler) {
236
+ tabler.attr('class', t.o.plugins.table.styler);
237
+ }
176
238
 
177
- var column = $(column_event.target),
178
- colIndex = this.cellIndex,
179
- rowIndex = this.parentNode.rowIndex;
239
+ var colIndex = this.cellIndex,
240
+ rowIndex = this.parentNode.rowIndex;
180
241
 
181
- for (var i = 0; i <= rowIndex; i += 1) {
182
- var row = $('<tr></tr>').appendTo(tabler);
183
- for (var j = 0; j <= colIndex; j += 1) {
184
- $('<td></td>').appendTo(row);
242
+ for (var i = 0; i <= rowIndex; i += 1) {
243
+ var row = $('<tr></tr>').appendTo(tabler);
244
+ for (var j = 0; j <= colIndex; j += 1) {
245
+ $('<td/>').appendTo(row);
246
+ }
185
247
  }
186
- }
187
248
 
188
- t.range.deleteContents();
189
- t.range.insertNode(tabler[0]);
190
- t.$c.trigger('tbwchange');
249
+ t.range.deleteContents();
250
+ t.range.insertNode(tabler[0]);
251
+ t.$c.trigger('tbwchange');
191
252
  };
192
253
 
193
254
  var addRow = {
194
- title: t.lang['tableAddRow'],
195
- text: t.lang['tableAddRow'],
196
- ico: 'row-below',
255
+ title: t.lang.tableAddRow,
256
+ text: t.lang.tableAddRow,
257
+ ico: 'row-below',
197
258
 
198
- fn: function () {
199
- t.saveRange();
259
+ fn: function () {
260
+ t.saveRange();
261
+
262
+ var node = t.doc.getSelection().focusNode;
263
+ var focusedRow = $(node).closest('tr');
264
+ var table = $(node).closest('table');
265
+
266
+ if(table.length > 0) {
267
+ var row = $('<tr/>');
268
+ // add columns according to current columns count
269
+ for (var i = 0; i < table.find('tr')[0].childElementCount; i += 1) {
270
+ $('<td/>').appendTo(row);
271
+ }
272
+ // add row to table
273
+ focusedRow.after(row);
274
+ }
200
275
 
201
- var node = t.doc.getSelection().focusNode;
202
- var table = $(node).closest('table');
203
-
204
- if(table.length > 0) {
205
- var row = $('<tr></tr>');
206
- // add columns according to current columns count
207
- for (var i = 0; i < table.find('tr')[0].childElementCount; i += 1) {
208
- $('<td></td>').appendTo(row);
209
- }
210
- // add row to table
211
- row.appendTo(table);
276
+ t.syncCode();
212
277
  }
278
+ };
213
279
 
214
- return true;
215
- }
280
+ var addRowAbove = {
281
+ title: t.lang.tableAddRowAbove,
282
+ text: t.lang.tableAddRowAbove,
283
+ ico: 'row-above',
284
+
285
+ fn: function () {
286
+ t.saveRange();
287
+
288
+ var node = t.doc.getSelection().focusNode;
289
+ var focusedRow = $(node).closest('tr');
290
+ var table = $(node).closest('table');
291
+
292
+ if(table.length > 0) {
293
+ var row = $('<tr/>');
294
+ // add columns according to current columns count
295
+ for (var i = 0; i < table.find('tr')[0].childElementCount; i += 1) {
296
+ $('<td/>').appendTo(row);
297
+ }
298
+ // add row to table
299
+ focusedRow.before(row);
300
+ }
301
+
302
+ t.syncCode();
303
+ }
216
304
  };
217
305
 
218
306
  var addColumn = {
219
- title: t.lang['tableAddColumn'],
220
- text: t.lang['tableAddColumn'],
221
- ico: 'col-right',
307
+ title: t.lang.tableAddColumn,
308
+ text: t.lang.tableAddColumn,
309
+ ico: 'col-right',
222
310
 
223
- fn: function () {
224
- t.saveRange();
311
+ fn: function () {
312
+ t.saveRange();
313
+
314
+ var node = t.doc.getSelection().focusNode;
315
+ var focusedCol = $(node).closest('td');
316
+ var table = $(node).closest('table');
317
+ var focusedColIdx = focusedCol.index();
225
318
 
226
- var node = t.doc.getSelection().focusNode;
227
- var table = $(node).closest('table');
319
+ if(table.length > 0) {
320
+ $(table).find('tr').each(function() {
321
+ $($(this).children()[focusedColIdx]).after('<td></td>');
322
+ });
323
+ }
228
324
 
229
- if(table.length > 0) {
230
- $(table).find('tr').each(function() {
231
- $(this).find('td:last').after('<td></td>');
232
- });
325
+ t.syncCode();
233
326
  }
327
+ };
328
+
329
+ var addColumnLeft = {
330
+ title: t.lang.tableAddColumnLeft,
331
+ text: t.lang.tableAddColumnLeft,
332
+ ico: 'col-left',
333
+
334
+ fn: function () {
335
+ t.saveRange();
336
+
337
+ var node = t.doc.getSelection().focusNode;
338
+ var focusedCol = $(node).closest('td');
339
+ var table = $(node).closest('table');
340
+ var focusedColIdx = focusedCol.index();
341
+
342
+ if(table.length > 0) {
343
+ $(table).find('tr').each(function() {
344
+ $($(this).children()[focusedColIdx]).before('<td></td>');
345
+ });
346
+ }
234
347
 
235
- return true;
236
- }
348
+ t.syncCode();
349
+ }
237
350
  };
238
351
 
239
352
  var destroy = {
240
- title: t.lang['tableDestroy'],
241
- text: t.lang['tableDestroy'],
242
- ico: 'table-delete',
353
+ title: t.lang.tableDestroy,
354
+ text: t.lang.tableDestroy,
355
+ ico: 'table-delete',
243
356
 
244
- fn: function () {
245
- t.saveRange();
357
+ fn: function () {
358
+ t.saveRange();
246
359
 
247
- var node = t.doc.getSelection().focusNode,
248
- table = $(node).closest('table');
360
+ var node = t.doc.getSelection().focusNode,
361
+ table = $(node).closest('table');
249
362
 
250
- table.remove();
363
+ table.remove();
251
364
 
252
- return true;
253
- }
365
+ t.syncCode();
366
+ }
254
367
  };
255
368
 
256
369
  var deleteRow = {
257
- title: t.lang['tableDeleteRow'],
258
- text: t.lang['tableDeleteRow'],
259
- ico: 'row-delete',
370
+ title: t.lang.tableDeleteRow,
371
+ text: t.lang.tableDeleteRow,
372
+ ico: 'row-delete',
260
373
 
261
- fn: function () {
262
- t.saveRange();
374
+ fn: function () {
375
+ t.saveRange();
263
376
 
264
- var node = t.doc.getSelection().focusNode,
265
- row = $(node).closest('tr');
377
+ var node = t.doc.getSelection().focusNode,
378
+ row = $(node).closest('tr');
266
379
 
267
- row.remove();
380
+ row.remove();
268
381
 
269
- return true;
270
- }
382
+ t.syncCode();
383
+ }
271
384
  };
272
385
 
273
386
  var deleteColumn = {
274
- title: t.lang['tableDeleteColumn'],
275
- text: t.lang['tableDeleteColumn'],
276
- ico: 'col-delete',
387
+ title: t.lang.tableDeleteColumn,
388
+ text: t.lang.tableDeleteColumn,
389
+ ico: 'col-delete',
277
390
 
278
- fn: function () {
279
- t.saveRange();
391
+ fn: function () {
392
+ t.saveRange();
280
393
 
281
- var node = t.doc.getSelection().focusNode,
282
- table = $(node).closest('table'),
283
- td = $(node).closest('td'),
284
- cellIndex = td.index();
394
+ var node = t.doc.getSelection().focusNode,
395
+ table = $(node).closest('table'),
396
+ td = $(node).closest('td'),
397
+ cellIndex = td.index();
285
398
 
286
- $(table).find('tr').each(function() {
287
- $(this).find('td:eq('+cellIndex+')').remove();
288
- });
399
+ $(table).find('tr').each(function() {
400
+ $(this).find('td:eq(' + cellIndex + ')').remove();
401
+ });
289
402
 
290
- return true;
291
- }
403
+ t.syncCode();
404
+ }
292
405
  };
293
406
 
294
407
  t.addBtnDef('table', buildButtonDef);
408
+ t.addBtnDef('tableAddRowAbove', addRowAbove);
295
409
  t.addBtnDef('tableAddRow', addRow);
410
+ t.addBtnDef('tableAddColumnLeft', addColumnLeft);
296
411
  t.addBtnDef('tableAddColumn', addColumn);
297
412
  t.addBtnDef('tableDeleteRow', deleteRow);
298
413
  t.addBtnDef('tableDeleteColumn', deleteColumn);