activeadmin_trumbowyg 0.1.6 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/LICENSE.txt +1 -1
- data/README.md +42 -39
- data/Rakefile +2 -2
- data/app/assets/fonts/trumbowyg/icons.svg +1 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/ar.js +67 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/bg.js +54 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/by.js +61 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/ca.js +57 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/cs.js +54 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/da.js +64 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/de.js +57 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/de.min.js +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/el.js +59 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/es.js +63 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/es_ar.js +56 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/fa.js +58 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/fi.js +58 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/fr.js +66 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/he.js +57 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/hr.js +54 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/hu.js +58 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/id.js +57 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/it.js +59 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/ja.js +63 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/ko.js +63 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/ko.min.js +3 -4
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/lt.js +59 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/mn.js +49 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/my.js +54 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/nl.js +61 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/nl.min.js +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/no_nb.js +56 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/ph.js +54 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/pl.js +55 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/pt.js +65 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/pt_br.js +65 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/pt_br.min.js +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/ro.js +58 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/rs.js +53 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/rs_latin.js +54 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/ru.js +61 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/ru.min.js +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/sk.js +54 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/sl.js +48 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/sl.min.js +1 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/sq.js +65 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/sv.js +58 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/th.js +55 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/th.min.js +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/tr.js +55 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/ua.js +54 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/vi.js +56 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/vi.min.js +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/zh_cn.js +57 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/zh_tw.js +66 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/allowtagsfrompaste/trumbowyg.allowtagsfrompaste.js +22 -3
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/allowtagsfrompaste/trumbowyg.allowtagsfrompaste.min.js +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/base64/trumbowyg.base64.js +14 -2
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/base64/trumbowyg.base64.min.js +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/cleanpaste/trumbowyg.cleanpaste.js +9 -10
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/cleanpaste/trumbowyg.cleanpaste.min.js +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/colors/trumbowyg.colors.js +88 -36
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/colors/trumbowyg.colors.min.js +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/colors/ui/sass/trumbowyg.colors.scss +30 -11
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/colors/ui/trumbowyg.colors.css +27 -15
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/colors/ui/trumbowyg.colors.min.css +2 -2
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/emoji/trumbowyg.emoji.js +914 -840
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/emoji/trumbowyg.emoji.min.js +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/emoji/ui/sass/trumbowyg.emoji.scss +1 -4
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/emoji/ui/trumbowyg.emoji.css +2 -5
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/emoji/ui/trumbowyg.emoji.min.css +2 -2
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/fontfamily/trumbowyg.fontfamily.js +24 -11
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/fontfamily/trumbowyg.fontfamily.min.js +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/fontsize/trumbowyg.fontsize.js +121 -24
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/fontsize/trumbowyg.fontsize.min.js +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/giphy/trumbowyg.giphy.js +182 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/giphy/trumbowyg.giphy.min.js +1 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/giphy/ui/sass/trumbowyg.giphy.scss +111 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/giphy/ui/trumbowyg.giphy.css +90 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/giphy/ui/trumbowyg.giphy.min.css +2 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/highlight/trumbowyg.highlight.js +11 -3
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/highlight/trumbowyg.highlight.min.js +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/highlight/ui/sass/trumbowyg.highlight.scss +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/highlight/ui/trumbowyg.highlight.css +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/highlight/ui/trumbowyg.highlight.min.css +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/history/trumbowyg.history.js +17 -3
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/history/trumbowyg.history.min.js +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/insertaudio/trumbowyg.insertaudio.js +9 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/insertaudio/trumbowyg.insertaudio.min.js +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/lineheight/trumbowyg.lineheight.js +59 -19
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/lineheight/trumbowyg.lineheight.min.js +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mathml/trumbowyg.mathml.js +25 -6
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mathml/trumbowyg.mathml.min.js +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mathml/ui/sass/trumbowyg.mathml.scss +10 -10
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mathml/ui/trumbowyg.mathml.css +9 -9
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mathml/ui/trumbowyg.mathml.min.css +2 -2
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mention/trumbowyg.mention.js +26 -21
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mention/trumbowyg.mention.min.js +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mention/ui/sass/trumbowyg.mention.scss +1 -11
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mention/ui/trumbowyg.mention.css +14 -22
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mention/ui/trumbowyg.mention.min.css +2 -2
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/noembed/trumbowyg.noembed.js +11 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/noembed/trumbowyg.noembed.min.js +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/pasteimage/trumbowyg.pasteimage.js +9 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/pasteimage/trumbowyg.pasteimage.min.js +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/preformatted/trumbowyg.preformatted.js +6 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/preformatted/trumbowyg.preformatted.min.js +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/resizimg/resizable-resolveconflict.js +20 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/resizimg/resizable-resolveconflict.min.js +1 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/resizimg/trumbowyg.resizimg.js +252 -18
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/resizimg/trumbowyg.resizimg.min.js +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/ruby/trumbowyg.ruby.js +12 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/ruby/trumbowyg.ruby.min.js +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/specialchars/trumbowyg.specialchars.js +79 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/specialchars/trumbowyg.specialchars.min.js +1 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/specialchars/ui/sass/trumbowyg.specialchars.scss +56 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/specialchars/ui/trumbowyg.specialchars.css +47 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/specialchars/ui/trumbowyg.specialchars.min.css +2 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/table/trumbowyg.table.js +272 -157
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/table/trumbowyg.table.min.js +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/table/ui/sass/trumbowyg.table.scss +5 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/table/ui/trumbowyg.table.css +4 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/table/ui/trumbowyg.table.min.css +2 -2
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/template/trumbowyg.template.js +14 -3
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/template/trumbowyg.template.min.js +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/upload/trumbowyg.upload.js +15 -4
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/upload/trumbowyg.upload.min.js +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/trumbowyg.js +234 -132
- data/app/assets/javascripts/activeadmin/trumbowyg/trumbowyg.min.js +2 -2
- data/app/assets/javascripts/activeadmin/trumbowyg_input.js +22 -9
- data/app/assets/stylesheets/activeadmin/_trumbowyg_input.scss +67 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/{ui/sass/trumbowyg.scss → trumbowyg.scss} +22 -7
- data/lib/activeadmin/trumbowyg.rb +2 -0
- data/lib/activeadmin/trumbowyg/engine.rb +2 -0
- data/lib/activeadmin/trumbowyg/version.rb +3 -1
- data/lib/activeadmin_trumbowyg.rb +2 -1
- data/lib/formtastic/inputs/trumbowyg_input.rb +3 -2
- data/lib/tasks/trumbowyg.rake +4 -2
- metadata +193 -23
- data/.gitignore +0 -3
- data/Gemfile +0 -4
- data/activeadmin_trumbowyg.gemspec +0 -19
- data/app/assets/fonts/active_admin-trumbowyg.svg +0 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/ui/icons.svg +0 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/ui/sass/trumbowyg.scss +0 -809
- data/app/assets/javascripts/activeadmin/trumbowyg/ui/trumbowyg.css +0 -587
- data/app/assets/javascripts/activeadmin/trumbowyg/ui/trumbowyg.min.css +0 -2
- data/app/assets/stylesheets/activeadmin/_trumbowyg_input.sass +0 -56
- data/app/assets/stylesheets/activeadmin/trumbowyg/ui/icons.svg +0 -1
- data/app/assets/stylesheets/activeadmin/trumbowyg/ui/trumbowyg.css +0 -587
- data/app/assets/stylesheets/activeadmin/trumbowyg/ui/trumbowyg.min.css +0 -2
- data/screenshot.jpg +0 -0
data/app/assets/javascripts/activeadmin/trumbowyg/plugins/resizimg/trumbowyg.resizimg.min.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
!function(
|
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(
|
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);
|
data/app/assets/javascripts/activeadmin/trumbowyg/plugins/specialchars/trumbowyg.specialchars.js
ADDED
@@ -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 = ' ';
|
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);
|
data/app/assets/javascripts/activeadmin/trumbowyg/plugins/specialchars/trumbowyg.specialchars.min.js
ADDED
@@ -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?" ":"&#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-\ -dropdown-button {
|
13
|
+
display: none !important;
|
14
|
+
}
|
15
|
+
.trumbowyg-symbol-\ -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
|
+
}
|
data/app/assets/javascripts/activeadmin/trumbowyg/plugins/specialchars/ui/trumbowyg.specialchars.css
ADDED
@@ -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-\ -dropdown-button {
|
13
|
+
display: none !important; }
|
14
|
+
|
15
|
+
.trumbowyg-symbol-\ -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-\ -dropdown-button{display:none!important}.trumbowyg-symbol-\ -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
|
-
|
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
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
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
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
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
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
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
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
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
|
-
|
143
|
-
$dropdown.
|
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
|
-
|
207
|
+
t.dropdown(btnName);
|
147
208
|
}
|
148
209
|
};
|
149
210
|
|
150
|
-
var tableAnimate = function(
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
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
|
-
|
157
|
-
|
217
|
+
// reset all columns
|
218
|
+
table.find('td').removeClass('active');
|
158
219
|
|
159
|
-
|
160
|
-
|
161
|
-
|
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
|
-
|
166
|
-
|
226
|
+
// set label
|
227
|
+
table.next('.trumbowyg-table-size').html((colIndex+1) + 'x' + (rowIndex+1));
|
167
228
|
};
|
168
229
|
|
169
|
-
var tableBuild = function(
|
170
|
-
|
230
|
+
var tableBuild = function() {
|
231
|
+
t.saveRange();
|
171
232
|
|
172
|
-
|
173
|
-
|
174
|
-
|
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
|
-
|
178
|
-
|
179
|
-
rowIndex = this.parentNode.rowIndex;
|
239
|
+
var colIndex = this.cellIndex,
|
240
|
+
rowIndex = this.parentNode.rowIndex;
|
180
241
|
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
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
|
-
|
189
|
-
|
190
|
-
|
249
|
+
t.range.deleteContents();
|
250
|
+
t.range.insertNode(tabler[0]);
|
251
|
+
t.$c.trigger('tbwchange');
|
191
252
|
};
|
192
253
|
|
193
254
|
var addRow = {
|
194
|
-
|
195
|
-
|
196
|
-
|
255
|
+
title: t.lang.tableAddRow,
|
256
|
+
text: t.lang.tableAddRow,
|
257
|
+
ico: 'row-below',
|
197
258
|
|
198
|
-
|
199
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
220
|
-
|
221
|
-
|
307
|
+
title: t.lang.tableAddColumn,
|
308
|
+
text: t.lang.tableAddColumn,
|
309
|
+
ico: 'col-right',
|
222
310
|
|
223
|
-
|
224
|
-
|
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
|
-
|
227
|
-
|
319
|
+
if(table.length > 0) {
|
320
|
+
$(table).find('tr').each(function() {
|
321
|
+
$($(this).children()[focusedColIdx]).after('<td></td>');
|
322
|
+
});
|
323
|
+
}
|
228
324
|
|
229
|
-
|
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
|
-
|
236
|
-
|
348
|
+
t.syncCode();
|
349
|
+
}
|
237
350
|
};
|
238
351
|
|
239
352
|
var destroy = {
|
240
|
-
|
241
|
-
|
242
|
-
|
353
|
+
title: t.lang.tableDestroy,
|
354
|
+
text: t.lang.tableDestroy,
|
355
|
+
ico: 'table-delete',
|
243
356
|
|
244
|
-
|
245
|
-
|
357
|
+
fn: function () {
|
358
|
+
t.saveRange();
|
246
359
|
|
247
|
-
|
248
|
-
|
360
|
+
var node = t.doc.getSelection().focusNode,
|
361
|
+
table = $(node).closest('table');
|
249
362
|
|
250
|
-
|
363
|
+
table.remove();
|
251
364
|
|
252
|
-
|
253
|
-
|
365
|
+
t.syncCode();
|
366
|
+
}
|
254
367
|
};
|
255
368
|
|
256
369
|
var deleteRow = {
|
257
|
-
|
258
|
-
|
259
|
-
|
370
|
+
title: t.lang.tableDeleteRow,
|
371
|
+
text: t.lang.tableDeleteRow,
|
372
|
+
ico: 'row-delete',
|
260
373
|
|
261
|
-
|
262
|
-
|
374
|
+
fn: function () {
|
375
|
+
t.saveRange();
|
263
376
|
|
264
|
-
|
265
|
-
|
377
|
+
var node = t.doc.getSelection().focusNode,
|
378
|
+
row = $(node).closest('tr');
|
266
379
|
|
267
|
-
|
380
|
+
row.remove();
|
268
381
|
|
269
|
-
|
270
|
-
|
382
|
+
t.syncCode();
|
383
|
+
}
|
271
384
|
};
|
272
385
|
|
273
386
|
var deleteColumn = {
|
274
|
-
|
275
|
-
|
276
|
-
|
387
|
+
title: t.lang.tableDeleteColumn,
|
388
|
+
text: t.lang.tableDeleteColumn,
|
389
|
+
ico: 'col-delete',
|
277
390
|
|
278
|
-
|
279
|
-
|
391
|
+
fn: function () {
|
392
|
+
t.saveRange();
|
280
393
|
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
394
|
+
var node = t.doc.getSelection().focusNode,
|
395
|
+
table = $(node).closest('table'),
|
396
|
+
td = $(node).closest('td'),
|
397
|
+
cellIndex = td.index();
|
285
398
|
|
286
|
-
|
287
|
-
|
288
|
-
|
399
|
+
$(table).find('tr').each(function() {
|
400
|
+
$(this).find('td:eq(' + cellIndex + ')').remove();
|
401
|
+
});
|
289
402
|
|
290
|
-
|
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);
|