activeadmin_trumbowyg 0.1.8 → 0.2.10
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 +43 -40
- data/Rakefile +15 -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 +18 -18
- data/app/assets/stylesheets/activeadmin/_trumbowyg_input.scss +65 -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 +221 -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
@@ -1 +1 @@
|
|
1
|
-
!function(e){"use strict";var t={rows:8,columns:8,styler:"table"};e.extend(!0,e.trumbowyg,{langs:{en:{table:"Insert table",tableAddRow:"Add row",tableAddColumn:"Add column",tableDeleteRow:"Delete row",tableDeleteColumn:"Delete column",tableDestroy:"Delete table",error:"Error"},da:{table:"Indsæt tabel",tableAddRow:"Tilføj række",tableAddColumn:"Tilføj kolonne",tableDeleteRow:"Slet række",tableDeleteColumn:"Slet kolonne",tableDestroy:"Slet tabel",error:"Fejl"},de:{table:"Tabelle einfügen",tableAddRow:"Zeile hinzufügen",tableAddColumn:"Spalte hinzufügen",tableDeleteRow:"Zeile löschen",tableDeleteColumn:"Spalte löschen",tableDestroy:"Tabelle löschen",error:"Error"},sk:{table:"Vytvoriť tabuľky",tableAddRow:"Pridať riadok",tableAddColumn:"Pridať stĺpec",error:"Chyba"},fr:{table:"Insérer un tableau",tableAddRow:"Ajouter des lignes",tableAddColumn:"Ajouter des colonnes",error:"Erreur"},cs:{table:"Vytvořit příkaz Table",tableAddRow:"Přidat řádek",tableAddColumn:"Přidat sloupec",error:"Chyba"},ru:{table:"Вставить таблицу",tableAddRow:"Добавить строку",tableAddColumn:"Добавить столбец",tableDeleteRow:"Удалить строку",tableDeleteColumn:"Удалить столбец",tableDestroy:"Удалить таблицу",error:"Ошибка"},ja:{table:"表の挿入",tableAddRow:"行の追加",tableAddColumn:"列の追加",error:"エラー"},tr:{table:"Tablo ekle",tableAddRow:"Satır ekle",tableAddColumn:"Kolon ekle",error:"Hata"},zh_tw:{table:"插入表格",tableAddRow:"加入行",tableAddColumn:"加入列",tableDeleteRow:"刪除行",tableDeleteColumn:"刪除列",tableDestroy:"刪除表格",error:"錯誤"}},plugins:{table:{init:function(l){l.o.plugins.table=e.extend(!0,{},t,l.o.plugins.table||{});var
|
1
|
+
!function(e){"use strict";var t={rows:8,columns:8,styler:"table"};e.extend(!0,e.trumbowyg,{langs:{en:{table:"Insert table",tableAddRow:"Add row",tableAddRowAbove:"Add row above",tableAddColumnLeft:"Add column to the left",tableAddColumn:"Add column to the right",tableDeleteRow:"Delete row",tableDeleteColumn:"Delete column",tableDestroy:"Delete table",error:"Error"},da:{table:"Indsæt tabel",tableAddRow:"Tilføj række",tableAddRowAbove:"Tilføj række",tableAddColumnLeft:"Tilføj kolonne",tableAddColumn:"Tilføj kolonne",tableDeleteRow:"Slet række",tableDeleteColumn:"Slet kolonne",tableDestroy:"Slet tabel",error:"Fejl"},de:{table:"Tabelle einfügen",tableAddRow:"Zeile hinzufügen",tableAddRowAbove:"Zeile hinzufügen",tableAddColumnLeft:"Spalte hinzufügen",tableAddColumn:"Spalte hinzufügen",tableDeleteRow:"Zeile löschen",tableDeleteColumn:"Spalte löschen",tableDestroy:"Tabelle löschen",error:"Error"},sk:{table:"Vytvoriť tabuľky",tableAddRow:"Pridať riadok",tableAddRowAbove:"Pridať riadok",tableAddColumnLeft:"Pridať stĺpec",tableAddColumn:"Pridať stĺpec",error:"Chyba"},fr:{table:"Insérer un tableau",tableAddRow:"Ajouter des lignes",tableAddRowAbove:"Ajouter des lignes",tableAddColumnLeft:"Ajouter des colonnes",tableAddColumn:"Ajouter des colonnes",tableDeleteRow:"Effacer la ligne",tableDeleteColumn:"Effacer la colonne",tableDestroy:"Effacer le tableau",error:"Erreur"},cs:{table:"Vytvořit příkaz Table",tableAddRow:"Přidat řádek",tableAddRowAbove:"Přidat řádek",tableAddColumnLeft:"Přidat sloupec",tableAddColumn:"Přidat sloupec",error:"Chyba"},ru:{table:"Вставить таблицу",tableAddRow:"Добавить строку",tableAddRowAbove:"Добавить строку",tableAddColumnLeft:"Добавить столбец",tableAddColumn:"Добавить столбец",tableDeleteRow:"Удалить строку",tableDeleteColumn:"Удалить столбец",tableDestroy:"Удалить таблицу",error:"Ошибка"},ja:{table:"表の挿入",tableAddRow:"行の追加",tableAddRowAbove:"行の追加",tableAddColumnLeft:"列の追加",tableAddColumn:"列の追加",error:"エラー"},tr:{table:"Tablo ekle",tableAddRow:"Satır ekle",tableAddRowAbove:"Satır ekle",tableAddColumnLeft:"Kolon ekle",tableAddColumn:"Kolon ekle",error:"Hata"},zh_tw:{table:"插入表格",tableAddRow:"加入行",tableAddRowAbove:"加入行",tableAddColumnLeft:"加入列",tableAddColumn:"加入列",tableDeleteRow:"刪除行",tableDeleteColumn:"刪除列",tableDestroy:"刪除表格",error:"錯誤"},id:{table:"Sisipkan tabel",tableAddRow:"Sisipkan baris",tableAddRowAbove:"Sisipkan baris",tableAddColumnLeft:"Sisipkan kolom",tableAddColumn:"Sisipkan kolom",tableDeleteRow:"Hapus baris",tableDeleteColumn:"Hapus kolom",tableDestroy:"Hapus tabel",error:"Galat"},pt_br:{table:"Inserir tabela",tableAddRow:"Adicionar linha",tableAddRowAbove:"Adicionar linha",tableAddColumnLeft:"Adicionar coluna",tableAddColumn:"Adicionar coluna",tableDeleteRow:"Deletar linha",tableDeleteColumn:"Deletar coluna",tableDestroy:"Deletar tabela",error:"Erro"},ko:{table:"표 넣기",tableAddRow:"줄 추가",tableAddRowAbove:"줄 추가",tableAddColumnLeft:"칸 추가",tableAddColumn:"칸 추가",tableDeleteRow:"줄 삭제",tableDeleteColumn:"칸 삭제",tableDestroy:"표 지우기",error:"에러"}},plugins:{table:{init:function(l){l.o.plugins.table=e.extend(!0,{},t,l.o.plugins.table||{});var o={fn:function(){l.saveRange();var t="table",o=l.o.prefix+"dropdown",n={"class":o+"-"+t+" "+o+" "+l.o.prefix+"fixed-top"};n["data-"+o]=t;var b=e("<div/>",n);if(0===l.$box.find("."+o+"-"+t).length?l.$box.append(b.hide()):b=l.$box.find("."+o+"-"+t),b.html(""),l.$box.find("."+l.o.prefix+"table-button").hasClass(l.o.prefix+"active-button"))b.append(l.buildSubBtn("tableAddRowAbove")),b.append(l.buildSubBtn("tableAddRow")),b.append(l.buildSubBtn("tableAddColumnLeft")),b.append(l.buildSubBtn("tableAddColumn")),b.append(l.buildSubBtn("tableDeleteRow")),b.append(l.buildSubBtn("tableDeleteColumn")),b.append(l.buildSubBtn("tableDestroy"));else{var r=e("<table/>");e("<tbody/>").appendTo(r);for(var i=0;i<l.o.plugins.table.rows;i+=1)for(var s=e("<tr/>").appendTo(r),u=0;u<l.o.plugins.table.columns;u+=1)e("<td/>").appendTo(s);r.find("td").on("mouseover",a),r.find("td").on("mousedown",d),b.append(r),b.append(e('<div class="trumbowyg-table-size">1x1</div>'))}l.dropdown(t)}},a=function(t){var l=e(t.target),o=l.closest("table"),a=this.cellIndex,d=this.parentNode.rowIndex;o.find("td").removeClass("active");for(var n=0;n<=d;n+=1)for(var b=0;b<=a;b+=1)o.find("tr:nth-of-type("+(n+1)+")").find("td:nth-of-type("+(b+1)+")").addClass("active");o.next(".trumbowyg-table-size").html(a+1+"x"+(d+1))},d=function(){l.saveRange();var t=e("<table/>");e("<tbody/>").appendTo(t),l.o.plugins.table.styler&&t.attr("class",l.o.plugins.table.styler);for(var o=this.cellIndex,a=this.parentNode.rowIndex,d=0;d<=a;d+=1)for(var n=e("<tr></tr>").appendTo(t),b=0;b<=o;b+=1)e("<td/>").appendTo(n);l.range.deleteContents(),l.range.insertNode(t[0]),l.$c.trigger("tbwchange")},n={title:l.lang.tableAddRow,text:l.lang.tableAddRow,ico:"row-below",fn:function(){l.saveRange();var t=l.doc.getSelection().focusNode,o=e(t).closest("tr"),a=e(t).closest("table");if(a.length>0){for(var d=e("<tr/>"),n=0;n<a.find("tr")[0].childElementCount;n+=1)e("<td/>").appendTo(d);o.after(d)}l.syncCode()}},b={title:l.lang.tableAddRowAbove,text:l.lang.tableAddRowAbove,ico:"row-above",fn:function(){l.saveRange();var t=l.doc.getSelection().focusNode,o=e(t).closest("tr"),a=e(t).closest("table");if(a.length>0){for(var d=e("<tr/>"),n=0;n<a.find("tr")[0].childElementCount;n+=1)e("<td/>").appendTo(d);o.before(d)}l.syncCode()}},r={title:l.lang.tableAddColumn,text:l.lang.tableAddColumn,ico:"col-right",fn:function(){l.saveRange();var t=l.doc.getSelection().focusNode,o=e(t).closest("td"),a=e(t).closest("table"),d=o.index();a.length>0&&e(a).find("tr").each(function(){e(e(this).children()[d]).after("<td></td>")}),l.syncCode()}},i={title:l.lang.tableAddColumnLeft,text:l.lang.tableAddColumnLeft,ico:"col-left",fn:function(){l.saveRange();var t=l.doc.getSelection().focusNode,o=e(t).closest("td"),a=e(t).closest("table"),d=o.index();a.length>0&&e(a).find("tr").each(function(){e(e(this).children()[d]).before("<td></td>")}),l.syncCode()}},s={title:l.lang.tableDestroy,text:l.lang.tableDestroy,ico:"table-delete",fn:function(){l.saveRange();var t=l.doc.getSelection().focusNode,o=e(t).closest("table");o.remove(),l.syncCode()}},u={title:l.lang.tableDeleteRow,text:l.lang.tableDeleteRow,ico:"row-delete",fn:function(){l.saveRange();var t=l.doc.getSelection().focusNode,o=e(t).closest("tr");o.remove(),l.syncCode()}},c={title:l.lang.tableDeleteColumn,text:l.lang.tableDeleteColumn,ico:"col-delete",fn:function(){l.saveRange();var t=l.doc.getSelection().focusNode,o=e(t).closest("table"),a=e(t).closest("td"),d=a.index();e(o).find("tr").each(function(){e(this).find("td:eq("+d+")").remove()}),l.syncCode()}};l.addBtnDef("table",o),l.addBtnDef("tableAddRowAbove",b),l.addBtnDef("tableAddRow",n),l.addBtnDef("tableAddColumnLeft",i),l.addBtnDef("tableAddColumn",r),l.addBtnDef("tableDeleteRow",u),l.addBtnDef("tableDeleteColumn",c),l.addBtnDef("tableDestroy",s)}}}})}(jQuery);
|
data/app/assets/javascripts/activeadmin/trumbowyg/plugins/table/ui/sass/trumbowyg.table.scss
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* Trumbowyg v2.
|
2
|
+
* Trumbowyg v2.21.0 - A lightweight WYSIWYG editor
|
3
3
|
* Default stylesheet for Trumbowyg editor plugin
|
4
4
|
* ------------------------
|
5
5
|
* @link http://alex-d.github.io/Trumbowyg
|
@@ -39,4 +39,8 @@
|
|
39
39
|
cursor: pointer;
|
40
40
|
}
|
41
41
|
}
|
42
|
+
|
43
|
+
.trumbowyg-table-size {
|
44
|
+
text-align: center;
|
45
|
+
}
|
42
46
|
}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* Trumbowyg v2.
|
2
|
+
* Trumbowyg v2.21.0 - A lightweight WYSIWYG editor
|
3
3
|
* Trumbowyg plugin stylesheet
|
4
4
|
* ------------------------
|
5
5
|
* @link http://alex-d.github.io/Trumbowyg
|
@@ -31,3 +31,6 @@
|
|
31
31
|
background-color: #00b393;
|
32
32
|
box-shadow: none;
|
33
33
|
cursor: pointer; }
|
34
|
+
|
35
|
+
.trumbowyg-dropdown-table .trumbowyg-table-size {
|
36
|
+
text-align: center; }
|
@@ -1,2 +1,2 @@
|
|
1
|
-
/** Trumbowyg v2.
|
2
|
-
.trumbowyg-editor table{width:100%}.trumbowyg-editor table td{border:1px dotted #e7eaec;padding:8px}.trumbowyg-dropdown-table table{margin:10px;display:inline-block}.trumbowyg-dropdown-table table td{display:inline-block;height:20px;width:20px;margin:1px;padding:0;background-color:#fff;box-shadow:0 0 0 1px #cecece inset}.trumbowyg-dropdown-table table td.active{background-color:#00b393;box-shadow:none;cursor:pointer}
|
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-editor table{width:100%}.trumbowyg-editor table td{border:1px dotted #e7eaec;padding:8px}.trumbowyg-dropdown-table table{margin:10px;display:inline-block}.trumbowyg-dropdown-table table td{display:inline-block;height:20px;width:20px;margin:1px;padding:0;background-color:#fff;box-shadow:0 0 0 1px #cecece inset}.trumbowyg-dropdown-table table td.active{background-color:#00b393;box-shadow:none;cursor:pointer}.trumbowyg-dropdown-table .trumbowyg-table-size{text-align:center}
|
@@ -4,30 +4,41 @@
|
|
4
4
|
// Adds the language variables
|
5
5
|
$.extend(true, $.trumbowyg, {
|
6
6
|
langs: {
|
7
|
+
// jshint camelcase:false
|
7
8
|
en: {
|
8
9
|
template: 'Template'
|
9
10
|
},
|
10
11
|
da: {
|
11
12
|
template: 'Skabelon'
|
12
13
|
},
|
14
|
+
de: {
|
15
|
+
template: 'Vorlage'
|
16
|
+
},
|
13
17
|
fr: {
|
14
18
|
template: 'Patron'
|
15
19
|
},
|
20
|
+
ja: {
|
21
|
+
template: 'テンプレート'
|
22
|
+
},
|
23
|
+
ko: {
|
24
|
+
template: '서식'
|
25
|
+
},
|
16
26
|
nl: {
|
17
27
|
template: 'Sjabloon'
|
18
28
|
},
|
29
|
+
pt_br: {
|
30
|
+
template: 'Modelo'
|
31
|
+
},
|
19
32
|
ru: {
|
20
33
|
template: 'Шаблон'
|
21
34
|
},
|
22
|
-
ja: {
|
23
|
-
template: 'テンプレート'
|
24
|
-
},
|
25
35
|
tr: {
|
26
36
|
template: 'Şablon'
|
27
37
|
},
|
28
38
|
zh_tw: {
|
29
39
|
template: '模板',
|
30
40
|
},
|
41
|
+
// jshint camelcase:true
|
31
42
|
}
|
32
43
|
});
|
33
44
|
|
data/app/assets/javascripts/activeadmin/trumbowyg/plugins/template/trumbowyg.template.min.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
!function(t){"use strict";function e(e){var n=e.o.plugins.templates,a=[];return t.each(n,function(t,n){e.addBtnDef("template_"+t,{fn:function(){e.html(n.html)},hasIcon:!1,title:n.name}),a.push("template_"+t)}),a}t.extend(!0,t.trumbowyg,{langs:{en:{template:"Template"},da:{template:"Skabelon"},fr:{template:"Patron"},nl:{template:"Sjabloon"},
|
1
|
+
!function(t){"use strict";function e(e){var n=e.o.plugins.templates,a=[];return t.each(n,function(t,n){e.addBtnDef("template_"+t,{fn:function(){e.html(n.html)},hasIcon:!1,title:n.name}),a.push("template_"+t)}),a}t.extend(!0,t.trumbowyg,{langs:{en:{template:"Template"},da:{template:"Skabelon"},de:{template:"Vorlage"},fr:{template:"Patron"},ja:{template:"テンプレート"},ko:{template:"서식"},nl:{template:"Sjabloon"},pt_br:{template:"Modelo"},ru:{template:"Шаблон"},tr:{template:"Şablon"},zh_tw:{template:"模板"}}}),t.extend(!0,t.trumbowyg,{plugins:{template:{shouldInit:function(t){return t.o.plugins.hasOwnProperty("templates")},init:function(t){t.addBtnDef("template",{dropdown:e(t),hasIcon:!1,text:t.lang.template})}}}})}(jQuery);
|
@@ -58,6 +58,11 @@
|
|
58
58
|
file: 'Fil',
|
59
59
|
uploadError: 'Fejl'
|
60
60
|
},
|
61
|
+
de: {
|
62
|
+
upload: 'Hochladen',
|
63
|
+
file: 'Datei',
|
64
|
+
uploadError: 'Fehler'
|
65
|
+
},
|
61
66
|
sk: {
|
62
67
|
upload: 'Nahrať',
|
63
68
|
file: 'Súbor',
|
@@ -102,7 +107,12 @@
|
|
102
107
|
upload: 'Yükle',
|
103
108
|
file: 'Dosya',
|
104
109
|
uploadError: 'Hata'
|
105
|
-
}
|
110
|
+
},
|
111
|
+
ko: {
|
112
|
+
upload: '그림 올리기',
|
113
|
+
file: '파일',
|
114
|
+
uploadError: '에러'
|
115
|
+
},
|
106
116
|
},
|
107
117
|
// jshint camelcase:true
|
108
118
|
|
@@ -193,7 +203,7 @@
|
|
193
203
|
} else {
|
194
204
|
if (!!getDeep(data, trumbowyg.o.plugins.upload.statusPropertyName.split('.'))) {
|
195
205
|
var url = getDeep(data, trumbowyg.o.plugins.upload.urlPropertyName.split('.'));
|
196
|
-
trumbowyg.execCmd('insertImage', url);
|
206
|
+
trumbowyg.execCmd('insertImage', url, false, true);
|
197
207
|
var $img = $('img[src="' + url + '"]:not([alt])', trumbowyg.$box);
|
198
208
|
$img.attr('alt', values.alt);
|
199
209
|
if (trumbowyg.o.imageWidthModalEdit && parseInt(values.width) > 0) {
|
@@ -249,8 +259,9 @@
|
|
249
259
|
var originalXhr = $.ajaxSettings.xhr;
|
250
260
|
$.ajaxSetup({
|
251
261
|
xhr: function () {
|
252
|
-
var
|
253
|
-
|
262
|
+
var that = this,
|
263
|
+
req = originalXhr();
|
264
|
+
|
254
265
|
if (req && typeof req.upload === 'object' && that.progressUpload !== undefined) {
|
255
266
|
req.upload.addEventListener('progress', function (e) {
|
256
267
|
that.progressUpload(e);
|
@@ -1 +1 @@
|
|
1
|
-
!function(r){"use strict";function
|
1
|
+
!function(r){"use strict";function e(r,a){var o=a.shift(),l=a;if(null!==r){if(0===l.length)return r[o];if("object"==typeof r)return e(r[o],l)}return r}function a(){if(!r.trumbowyg.addedXhrProgressEvent){var e=r.ajaxSettings.xhr;r.ajaxSetup({xhr:function(){var r=this,a=e();return a&&"object"==typeof a.upload&&void 0!==r.progressUpload&&a.upload.addEventListener("progress",function(e){r.progressUpload(e)},!1),a}}),r.trumbowyg.addedXhrProgressEvent=!0}}var o={serverPath:"",fileFieldName:"fileToUpload",data:[],headers:{},xhrFields:{},urlPropertyName:"file",statusPropertyName:"success",success:void 0,error:void 0,imageWidthModalEdit:!1};a(),r.extend(!0,r.trumbowyg,{langs:{en:{upload:"Upload",file:"File",uploadError:"Error"},da:{upload:"Upload",file:"Fil",uploadError:"Fejl"},de:{upload:"Hochladen",file:"Datei",uploadError:"Fehler"},sk:{upload:"Nahrať",file:"Súbor",uploadError:"Chyba"},fr:{upload:"Envoi",file:"Fichier",uploadError:"Erreur"},cs:{upload:"Nahrát obrázek",file:"Soubor",uploadError:"Chyba"},zh_cn:{upload:"上传",file:"文件",uploadError:"错误"},zh_tw:{upload:"上傳",file:"文件",uploadError:"錯誤"},ru:{upload:"Загрузка",file:"Файл",uploadError:"Ошибка"},ja:{upload:"アップロード",file:"ファイル",uploadError:"エラー"},pt_br:{upload:"Enviar do local",file:"Arquivo",uploadError:"Erro"},tr:{upload:"Yükle",file:"Dosya",uploadError:"Hata"},ko:{upload:"그림 올리기",file:"파일",uploadError:"에러"}},plugins:{upload:{init:function(a){a.o.plugins.upload=r.extend(!0,{},o,a.o.plugins.upload||{});var l={fn:function(){a.saveRange();var o,l=a.o.prefix,t={file:{type:"file",required:!0,attributes:{accept:"image/*"}},alt:{label:"description",value:a.getRangeText()}};a.o.plugins.upload.imageWidthModalEdit&&(t.width={value:""});var d=a.openModalInsert(a.lang.upload,t,function(t){var i=new FormData;i.append(a.o.plugins.upload.fileFieldName,o),a.o.plugins.upload.data.map(function(r){i.append(r.name,r.value)}),r.map(t,function(r,e){"file"!==e&&i.append(e,r)}),0===r("."+l+"progress",d).length&&r("."+l+"modal-title",d).after(r("<div/>",{"class":l+"progress"}).append(r("<div/>",{"class":l+"progress-bar"}))),r.ajax({url:a.o.plugins.upload.serverPath,headers:a.o.plugins.upload.headers,xhrFields:a.o.plugins.upload.xhrFields,type:"POST",data:i,cache:!1,dataType:"json",processData:!1,contentType:!1,progressUpload:function(e){r("."+l+"progress-bar").css("width",Math.round(100*e.loaded/e.total)+"%")},success:function(o){if(a.o.plugins.upload.success)a.o.plugins.upload.success(o,a,d,t);else if(e(o,a.o.plugins.upload.statusPropertyName.split("."))){var l=e(o,a.o.plugins.upload.urlPropertyName.split("."));a.execCmd("insertImage",l,!1,!0);var i=r('img[src="'+l+'"]:not([alt])',a.$box);i.attr("alt",t.alt),a.o.imageWidthModalEdit&&parseInt(t.width)>0&&i.attr({width:t.width}),setTimeout(function(){a.closeModal()},250),a.$c.trigger("tbwuploadsuccess",[a,o,l])}else a.addErrorOnModalField(r("input[type=file]",d),a.lang[o.message]),a.$c.trigger("tbwuploaderror",[a,o])},error:a.o.plugins.upload.error||function(){a.addErrorOnModalField(r("input[type=file]",d),a.lang.uploadError),a.$c.trigger("tbwuploaderror",[a])}})});r("input[type=file]").on("change",function(r){try{o=r.target.files[0]}catch(e){o=r.target.value}})}};a.addBtnDef("upload",l)}}}})}(jQuery);
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* Trumbowyg v2.
|
2
|
+
* Trumbowyg v2.21.0 - A lightweight WYSIWYG editor
|
3
3
|
* Trumbowyg core file
|
4
4
|
* ------------------------
|
5
5
|
* @link http://alex-d.github.io/Trumbowyg
|
@@ -25,7 +25,7 @@ jQuery.trumbowyg = {
|
|
25
25
|
|
26
26
|
bold: 'Bold',
|
27
27
|
italic: 'Italic',
|
28
|
-
strikethrough: '
|
28
|
+
strikethrough: 'Strikethrough',
|
29
29
|
underline: 'Underline',
|
30
30
|
|
31
31
|
strong: 'Strong',
|
@@ -90,9 +90,12 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
90
90
|
prefix: 'trumbowyg-',
|
91
91
|
|
92
92
|
semantic: true,
|
93
|
+
semanticKeepAttributes: false,
|
93
94
|
resetCss: false,
|
94
95
|
removeformatPasted: false,
|
96
|
+
tabToIndent: false,
|
95
97
|
tagsToRemove: [],
|
98
|
+
tagsToKeep: ['hr', 'img', 'embed', 'iframe', 'input'],
|
96
99
|
btns: [
|
97
100
|
['viewHTML'],
|
98
101
|
['undo', 'redo'], // Only supported in Blink browsers
|
@@ -109,6 +112,7 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
109
112
|
],
|
110
113
|
// For custom button definitions
|
111
114
|
btnsDef: {},
|
115
|
+
changeActiveDropdownIcon: false,
|
112
116
|
|
113
117
|
inlineElementsSelector: 'a,abbr,acronym,b,caption,cite,code,col,dfn,dir,dt,dd,em,font,hr,i,kbd,li,q,span,strikeout,strong,sub,sup,u',
|
114
118
|
|
@@ -118,14 +122,14 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
118
122
|
|
119
123
|
plugins: {},
|
120
124
|
urlProtocol: false,
|
121
|
-
minimalLinks: false
|
125
|
+
minimalLinks: false,
|
126
|
+
defaultLinkTarget: undefined
|
122
127
|
},
|
123
128
|
writable: false,
|
124
129
|
enumerable: true,
|
125
130
|
configurable: false
|
126
131
|
});
|
127
132
|
|
128
|
-
|
129
133
|
(function (navigator, window, document, $) {
|
130
134
|
'use strict';
|
131
135
|
|
@@ -147,7 +151,7 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
147
151
|
switch (options) {
|
148
152
|
// Exec command
|
149
153
|
case 'execCmd':
|
150
|
-
return t.execCmd(params.cmd, params.param, params.forceCss);
|
154
|
+
return t.execCmd(params.cmd, params.param, params.forceCss, params.skipTrumbowyg);
|
151
155
|
|
152
156
|
// Modal box
|
153
157
|
case 'openModal':
|
@@ -263,7 +267,7 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
263
267
|
|
264
268
|
/**
|
265
269
|
* When the button is associated to a empty object
|
266
|
-
* fn and title
|
270
|
+
* fn and title attributes are defined from the button key value
|
267
271
|
*
|
268
272
|
* For example
|
269
273
|
* foo: {}
|
@@ -314,6 +318,14 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
314
318
|
fn: 'formatBlock',
|
315
319
|
title: h + ' 4'
|
316
320
|
},
|
321
|
+
h5: {
|
322
|
+
fn: 'formatBlock',
|
323
|
+
title: h + ' 5'
|
324
|
+
},
|
325
|
+
h6: {
|
326
|
+
fn: 'formatBlock',
|
327
|
+
title: h + ' 6'
|
328
|
+
},
|
317
329
|
subscript: {
|
318
330
|
tag: 'sub'
|
319
331
|
},
|
@@ -440,7 +452,10 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
440
452
|
t.pasteHandlers = [].concat(t.o.pasteHandlers);
|
441
453
|
|
442
454
|
// Check if browser is IE
|
443
|
-
t.isIE =
|
455
|
+
t.isIE = navigator.userAgent.indexOf('MSIE') !== -1 || navigator.appVersion.indexOf('Trident/') !== -1;
|
456
|
+
|
457
|
+
// Check if we are on macOs
|
458
|
+
t.isMac = navigator.platform.toUpperCase().indexOf('MAC') !== -1;
|
444
459
|
|
445
460
|
t.init();
|
446
461
|
};
|
@@ -483,7 +498,7 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
483
498
|
},
|
484
499
|
|
485
500
|
addBtnDef: function (btnName, btnDef) {
|
486
|
-
this.btnsDef[btnName] = btnDef;
|
501
|
+
this.btnsDef[btnName] = $.extend(btnDef, this.btnsDef[btnName] || {});
|
487
502
|
},
|
488
503
|
|
489
504
|
setupUrlPrefix: function () {
|
@@ -495,7 +510,7 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
495
510
|
if (typeof(protocol) !== 'string') {
|
496
511
|
return 'https://';
|
497
512
|
}
|
498
|
-
return
|
513
|
+
return protocol.replace('://', '') + '://';
|
499
514
|
},
|
500
515
|
|
501
516
|
buildEditor: function () {
|
@@ -575,8 +590,7 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
575
590
|
|
576
591
|
var ctrl = false,
|
577
592
|
composition = false,
|
578
|
-
debounceButtonPaneStatus
|
579
|
-
updateEventName = 'keyup';
|
593
|
+
debounceButtonPaneStatus;
|
580
594
|
|
581
595
|
t.$ed
|
582
596
|
.on('dblclick', 'img', t.o.imgDblClickHandler)
|
@@ -588,14 +602,24 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
588
602
|
try {
|
589
603
|
t.execCmd(key.fn, key.param);
|
590
604
|
return false;
|
591
|
-
} catch (c) {
|
605
|
+
} catch (c) {}
|
606
|
+
} else {
|
607
|
+
if (t.o.tabToIndent && e.key === 'Tab') {
|
608
|
+
try {
|
609
|
+
if (e.shiftKey) {
|
610
|
+
t.execCmd('outdent', true, null);
|
611
|
+
} else {
|
612
|
+
t.execCmd('indent', true, null);
|
613
|
+
}
|
614
|
+
return false;
|
615
|
+
} catch (c) {}
|
592
616
|
}
|
593
617
|
}
|
594
618
|
})
|
595
619
|
.on('compositionstart compositionupdate', function () {
|
596
620
|
composition = true;
|
597
621
|
})
|
598
|
-
.on(
|
622
|
+
.on('keyup compositionend', function (e) {
|
599
623
|
if (e.type === 'compositionend') {
|
600
624
|
composition = false;
|
601
625
|
} else if (composition) {
|
@@ -609,6 +633,7 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
609
633
|
}
|
610
634
|
|
611
635
|
if ((e.ctrlKey || e.metaKey) && (keyCode === 89 || keyCode === 90)) {
|
636
|
+
t.semanticCode(false, true);
|
612
637
|
t.$c.trigger('tbwchange');
|
613
638
|
} else if (!ctrl && keyCode !== 17) {
|
614
639
|
var compositionEndIE = t.isIE ? e.type === 'compositionend' : true;
|
@@ -634,10 +659,10 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
634
659
|
}, 50);
|
635
660
|
})
|
636
661
|
.on('focus blur', function (e) {
|
637
|
-
t.$c.trigger('tbw' + e.type);
|
638
662
|
if (e.type === 'blur') {
|
639
|
-
|
663
|
+
t.clearButtonPaneStatus();
|
640
664
|
}
|
665
|
+
t.$c.trigger('tbw' + e.type);
|
641
666
|
if (t.o.autogrowOnEnter) {
|
642
667
|
if (t.autogrowOnEnterDontClose) {
|
643
668
|
return;
|
@@ -652,7 +677,16 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
652
677
|
}
|
653
678
|
}
|
654
679
|
})
|
655
|
-
.on('
|
680
|
+
.on('keyup focus', function () {
|
681
|
+
if (!t.$ta.val().match(/<.*>/)) {
|
682
|
+
setTimeout(function () {
|
683
|
+
var block = t.isIE ? '<p>' : 'p';
|
684
|
+
t.doc.execCommand('formatBlock', false, block);
|
685
|
+
t.syncCode();
|
686
|
+
}, 0);
|
687
|
+
}
|
688
|
+
})
|
689
|
+
.on('cut drop', function () {
|
656
690
|
setTimeout(function () {
|
657
691
|
t.semanticCode(false, true);
|
658
692
|
t.$c.trigger('tbwchange');
|
@@ -692,6 +726,7 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
692
726
|
setTimeout(function () {
|
693
727
|
t.semanticCode(false, true);
|
694
728
|
t.$c.trigger('tbwpaste', e);
|
729
|
+
t.$c.trigger('tbwchange');
|
695
730
|
}, 0);
|
696
731
|
});
|
697
732
|
|
@@ -705,8 +740,8 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
705
740
|
}, 0);
|
706
741
|
});
|
707
742
|
|
708
|
-
t
|
709
|
-
if (e.which === 27 && $('.' + prefix + 'modal-box'
|
743
|
+
$(t.doc.body).on('keydown.' + t.eventNamespace, function (e) {
|
744
|
+
if (e.which === 27 && $('.' + prefix + 'modal-box').length >= 1) {
|
710
745
|
t.closeModal();
|
711
746
|
return false;
|
712
747
|
}
|
@@ -781,7 +816,7 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
781
816
|
html: t.hasSvg && hasIcon ?
|
782
817
|
'<svg><use xlink:href="' + t.svgPath + '#' + prefix + (btn.ico || btnName).replace(/([A-Z]+)/g, '-$1').toLowerCase() + '"/></svg>' :
|
783
818
|
t.hideButtonTexts ? '' : (btn.text || btn.title || t.lang[btnName] || btnName),
|
784
|
-
title: (btn.title || btn.text || textDef) + (
|
819
|
+
title: (btn.title || btn.text || textDef) + (btn.key ? ' (' + (t.isMac ? 'Cmd' : 'Ctrl') + ' + ' + btn.key + ')' : ''),
|
785
820
|
tabindex: -1,
|
786
821
|
mousedown: function () {
|
787
822
|
if (!isDropdown || $('.' + btnName + '-' + prefix + 'dropdown', t.$box).is(':hidden')) {
|
@@ -804,7 +839,7 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
804
839
|
$btn.addClass(prefix + 'open-dropdown');
|
805
840
|
var dropdownPrefix = prefix + 'dropdown',
|
806
841
|
dropdownOptions = { // the dropdown
|
807
|
-
class: dropdownPrefix + '-' + btnName + ' ' + dropdownPrefix + ' ' + prefix + 'fixed-top'
|
842
|
+
class: dropdownPrefix + '-' + btnName + ' ' + dropdownPrefix + ' ' + prefix + 'fixed-top ' + (btn.dropdownClass || '')
|
808
843
|
};
|
809
844
|
dropdownOptions['data-' + dropdownPrefix] = btnName;
|
810
845
|
var $dropdown = $('<div/>', dropdownOptions);
|
@@ -846,9 +881,11 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
846
881
|
|
847
882
|
return $('<button/>', {
|
848
883
|
type: 'button',
|
849
|
-
class: prefix + btnName + '-dropdown-button' + (btn.ico ? ' ' + prefix + btn.ico + '-button' : ''),
|
850
|
-
html: t.hasSvg && hasIcon ?
|
851
|
-
|
884
|
+
class: prefix + btnName + '-dropdown-button ' + (btn.class || '') + (btn.ico ? ' ' + prefix + btn.ico + '-button' : ''),
|
885
|
+
html: t.hasSvg && hasIcon ?
|
886
|
+
'<svg><use xlink:href="' + t.svgPath + '#' + prefix + (btn.ico || btnName).replace(/([A-Z]+)/g, '-$1').toLowerCase() + '"/></svg>' + (btn.text || btn.title || t.lang[btnName] || btnName) :
|
887
|
+
(btn.text || btn.title || t.lang[btnName] || btnName),
|
888
|
+
title: (btn.key ? '(' + (t.isMac ? 'Cmd' : 'Ctrl') + ' + ' + btn.key + ')' : null),
|
852
889
|
style: btn.style || null,
|
853
890
|
mousedown: function () {
|
854
891
|
$('body', t.doc).trigger('mousedown');
|
@@ -860,10 +897,10 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
860
897
|
});
|
861
898
|
},
|
862
899
|
// Check if button is supported
|
863
|
-
isSupportedBtn: function (
|
900
|
+
isSupportedBtn: function (btnName) {
|
864
901
|
try {
|
865
|
-
return this.btnsDef[
|
866
|
-
} catch (
|
902
|
+
return this.btnsDef[btnName].isSupported();
|
903
|
+
} catch (e) {
|
867
904
|
}
|
868
905
|
return true;
|
869
906
|
},
|
@@ -910,36 +947,36 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
910
947
|
|
911
948
|
var scrollTop = $(window).scrollTop(),
|
912
949
|
offset = $box.offset().top + 1,
|
913
|
-
|
914
|
-
|
950
|
+
$buttonPane = t.$btnPane,
|
951
|
+
buttonPaneOuterHeight = $buttonPane.outerHeight() - 2;
|
915
952
|
|
916
953
|
if ((scrollTop - offset > 0) && ((scrollTop - offset - t.height) < 0)) {
|
917
954
|
if (!t.isFixed) {
|
918
955
|
t.isFixed = true;
|
919
|
-
|
956
|
+
$buttonPane.css({
|
920
957
|
position: 'fixed',
|
921
958
|
top: 0,
|
922
|
-
left: fixedFullWidth ?
|
959
|
+
left: fixedFullWidth ? 0 : 'auto',
|
923
960
|
zIndex: 7
|
924
961
|
});
|
925
|
-
|
962
|
+
t.$box.css({paddingTop: $buttonPane.height()});
|
926
963
|
}
|
927
|
-
|
928
|
-
width: fixedFullWidth ? '100%' : (($box.width() - 1)
|
964
|
+
$buttonPane.css({
|
965
|
+
width: fixedFullWidth ? '100%' : (($box.width() - 1))
|
929
966
|
});
|
930
967
|
|
931
968
|
$('.' + t.o.prefix + 'fixed-top', $box).css({
|
932
969
|
position: fixedFullWidth ? 'fixed' : 'absolute',
|
933
|
-
top: fixedFullWidth ?
|
970
|
+
top: fixedFullWidth ? buttonPaneOuterHeight : buttonPaneOuterHeight + (scrollTop - offset),
|
934
971
|
zIndex: 15
|
935
972
|
});
|
936
973
|
} else if (t.isFixed) {
|
937
974
|
t.isFixed = false;
|
938
|
-
|
939
|
-
|
975
|
+
$buttonPane.removeAttr('style');
|
976
|
+
t.$box.css({paddingTop: 0});
|
940
977
|
$('.' + t.o.prefix + 'fixed-top', $box).css({
|
941
978
|
position: 'absolute',
|
942
|
-
top:
|
979
|
+
top: buttonPaneOuterHeight
|
943
980
|
});
|
944
981
|
}
|
945
982
|
});
|
@@ -995,6 +1032,7 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
995
1032
|
$('body').removeClass(prefix + 'body-fullscreen');
|
996
1033
|
t.$c.trigger('tbwclose');
|
997
1034
|
$(window).off('scroll.' + t.eventNamespace + ' resize.' + t.eventNamespace);
|
1035
|
+
$(t.doc.body).off('keydown.' + t.eventNamespace);
|
998
1036
|
},
|
999
1037
|
|
1000
1038
|
|
@@ -1015,6 +1053,7 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1015
1053
|
}
|
1016
1054
|
|
1017
1055
|
t.semanticCode(false, true);
|
1056
|
+
t.$c.trigger('tbwchange');
|
1018
1057
|
|
1019
1058
|
setTimeout(function () {
|
1020
1059
|
t.doc.activeElement.blur();
|
@@ -1036,31 +1075,31 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1036
1075
|
// Open dropdown when click on a button which open that
|
1037
1076
|
dropdown: function (name) {
|
1038
1077
|
var t = this,
|
1039
|
-
|
1078
|
+
$body = $('body', t.doc),
|
1040
1079
|
prefix = t.o.prefix,
|
1041
1080
|
$dropdown = $('[data-' + prefix + 'dropdown=' + name + ']', t.$box),
|
1042
1081
|
$btn = $('.' + prefix + name + '-button', t.$btnPane),
|
1043
1082
|
show = $dropdown.is(':hidden');
|
1044
1083
|
|
1045
|
-
$
|
1084
|
+
$body.trigger('mousedown');
|
1046
1085
|
|
1047
1086
|
if (show) {
|
1048
|
-
var
|
1087
|
+
var btnOffsetLeft = $btn.offset().left;
|
1049
1088
|
$btn.addClass(prefix + 'active');
|
1050
1089
|
|
1051
1090
|
$dropdown.css({
|
1052
1091
|
position: 'absolute',
|
1053
1092
|
top: $btn.offset().top - t.$btnPane.offset().top + $btn.outerHeight(),
|
1054
|
-
left: (t.o.fixedFullWidth && t.isFixed) ?
|
1093
|
+
left: (t.o.fixedFullWidth && t.isFixed) ? btnOffsetLeft : (btnOffsetLeft - t.$btnPane.offset().left)
|
1055
1094
|
}).show();
|
1056
1095
|
|
1057
1096
|
$(window).trigger('scroll');
|
1058
1097
|
|
1059
|
-
$
|
1098
|
+
$body.on('mousedown.' + t.eventNamespace, function (e) {
|
1060
1099
|
if (!$dropdown.is(e.target)) {
|
1061
1100
|
$('.' + prefix + 'dropdown', t.$box).hide();
|
1062
1101
|
$('.' + prefix + 'active', t.$btnPane).removeClass(prefix + 'active');
|
1063
|
-
$
|
1102
|
+
$body.off('mousedown.' + t.eventNamespace);
|
1064
1103
|
}
|
1065
1104
|
});
|
1066
1105
|
}
|
@@ -1082,16 +1121,16 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1082
1121
|
},
|
1083
1122
|
syncTextarea: function () {
|
1084
1123
|
var t = this;
|
1085
|
-
t.$ta.val(t.$ed.text().trim().length > 0 || t.$ed.find('
|
1124
|
+
t.$ta.val(t.$ed.text().trim().length > 0 || t.$ed.find(t.o.tagsToKeep.join(',')).length > 0 ? t.$ed.html() : '');
|
1086
1125
|
},
|
1087
1126
|
syncCode: function (force) {
|
1088
1127
|
var t = this;
|
1089
1128
|
if (!force && t.$ed.is(':visible')) {
|
1090
1129
|
t.syncTextarea();
|
1091
1130
|
} else {
|
1092
|
-
// wrap the content in a div it's easier to get the
|
1131
|
+
// wrap the content in a div it's easier to get the inner html
|
1093
1132
|
var html = $('<div>').html(t.$ta.val());
|
1094
|
-
//scrub the html before loading into the doc
|
1133
|
+
// scrub the html before loading into the doc
|
1095
1134
|
var safe = $('<div>').append(html);
|
1096
1135
|
$(t.o.tagsToRemove.join(','), safe).remove();
|
1097
1136
|
t.$ed.html(safe.contents().html());
|
@@ -1105,11 +1144,10 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1105
1144
|
}
|
1106
1145
|
}
|
1107
1146
|
if (t.o.autogrowOnEnter) {
|
1108
|
-
// t.autogrowEditorOnEnter();
|
1109
1147
|
t.$ed.height('auto');
|
1110
|
-
var
|
1111
|
-
if (
|
1112
|
-
t.$ed.css({height:
|
1148
|
+
var totalHeight = t.autogrowOnEnterWasFocused ? t.$ed[0].scrollHeight : t.$ed.css('min-height');
|
1149
|
+
if (totalHeight !== t.$ta.css('height')) {
|
1150
|
+
t.$ed.css({height: totalHeight});
|
1113
1151
|
t.$c.trigger('tbwresize');
|
1114
1152
|
}
|
1115
1153
|
}
|
@@ -1125,10 +1163,10 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1125
1163
|
t.syncCode(force);
|
1126
1164
|
|
1127
1165
|
if (t.o.semantic) {
|
1128
|
-
t.semanticTag('b');
|
1129
|
-
t.semanticTag('i');
|
1130
|
-
t.semanticTag('s');
|
1131
|
-
t.semanticTag('strike');
|
1166
|
+
t.semanticTag('b', t.o.semanticKeepAttributes);
|
1167
|
+
t.semanticTag('i', t.o.semanticKeepAttributes);
|
1168
|
+
t.semanticTag('s', t.o.semanticKeepAttributes);
|
1169
|
+
t.semanticTag('strike', t.o.semanticKeepAttributes);
|
1132
1170
|
|
1133
1171
|
if (full) {
|
1134
1172
|
var inlineElementsSelector = t.o.inlineElementsSelector,
|
@@ -1152,16 +1190,7 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1152
1190
|
|
1153
1191
|
t.semanticTag('div', true);
|
1154
1192
|
|
1155
|
-
//
|
1156
|
-
t.$ed.find('p').filter(function () {
|
1157
|
-
// Don't remove currently being edited element
|
1158
|
-
if (t.range && this === t.range.startContainer) {
|
1159
|
-
return false;
|
1160
|
-
}
|
1161
|
-
return $(this).text().trim().length === 0 && $(this).children().not('br,span').length === 0;
|
1162
|
-
}).contents().unwrap();
|
1163
|
-
|
1164
|
-
// Get rid of temporial span's
|
1193
|
+
// Get rid of temporary span's
|
1165
1194
|
$('[data-tbw]', t.$ed).contents().unwrap();
|
1166
1195
|
|
1167
1196
|
// Remove empty <p>
|
@@ -1189,6 +1218,10 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1189
1218
|
|
1190
1219
|
$(oldTag, this.$ed).each(function () {
|
1191
1220
|
var $oldTag = $(this);
|
1221
|
+
if($oldTag.contents().length === 0) {
|
1222
|
+
return false;
|
1223
|
+
}
|
1224
|
+
|
1192
1225
|
$oldTag.wrap('<' + newTag + '/>');
|
1193
1226
|
if (copyAttributes) {
|
1194
1227
|
$.each($oldTag.prop('attributes'), function () {
|
@@ -1203,8 +1236,9 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1203
1236
|
createLink: function () {
|
1204
1237
|
var t = this,
|
1205
1238
|
documentSelection = t.doc.getSelection(),
|
1239
|
+
selectedRange = documentSelection.getRangeAt(0),
|
1206
1240
|
node = documentSelection.focusNode,
|
1207
|
-
text = new XMLSerializer().serializeToString(
|
1241
|
+
text = new XMLSerializer().serializeToString(selectedRange.cloneContents()) || selectedRange + '',
|
1208
1242
|
url,
|
1209
1243
|
title,
|
1210
1244
|
target;
|
@@ -1219,7 +1253,7 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1219
1253
|
url = $a.attr('href');
|
1220
1254
|
if (!t.o.minimalLinks) {
|
1221
1255
|
title = $a.attr('title');
|
1222
|
-
target = $a.attr('target');
|
1256
|
+
target = $a.attr('target') || t.o.defaultLinkTarget;
|
1223
1257
|
}
|
1224
1258
|
var range = t.doc.createRange();
|
1225
1259
|
range.selectNode(node);
|
@@ -1241,7 +1275,7 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1241
1275
|
}
|
1242
1276
|
};
|
1243
1277
|
if (!t.o.minimalLinks) {
|
1244
|
-
|
1278
|
+
$.extend(options, {
|
1245
1279
|
title: {
|
1246
1280
|
label: t.lang.title,
|
1247
1281
|
value: title
|
@@ -1261,13 +1295,11 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1261
1295
|
|
1262
1296
|
var link = $(['<a href="', url, '">', v.text || v.url, '</a>'].join(''));
|
1263
1297
|
|
1264
|
-
if (
|
1265
|
-
|
1266
|
-
|
1267
|
-
|
1268
|
-
|
1269
|
-
link.attr('target', v.target);
|
1270
|
-
}
|
1298
|
+
if (v.title) {
|
1299
|
+
link.attr('title', v.title);
|
1300
|
+
}
|
1301
|
+
if (v.target || t.o.defaultLinkTarget) {
|
1302
|
+
link.attr('target', v.target || t.o.defaultLinkTarget);
|
1271
1303
|
}
|
1272
1304
|
t.range.deleteContents();
|
1273
1305
|
t.range.insertNode(link[0]);
|
@@ -1333,7 +1365,7 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1333
1365
|
}
|
1334
1366
|
|
1335
1367
|
t.openModalInsert(t.lang.insertImage, options, function (v) { // v are values
|
1336
|
-
t.execCmd('insertImage', v.url);
|
1368
|
+
t.execCmd('insertImage', v.url, false, true);
|
1337
1369
|
var $img = $('img[src="' + v.url + '"]:not([alt])', t.$box);
|
1338
1370
|
$img.attr('alt', v.alt);
|
1339
1371
|
|
@@ -1353,10 +1385,25 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1353
1385
|
var t = this,
|
1354
1386
|
prefix = t.o.prefix,
|
1355
1387
|
fullscreenCssClass = prefix + 'fullscreen',
|
1356
|
-
|
1388
|
+
fullscreenPlaceholderClass = fullscreenCssClass + '-placeholder',
|
1389
|
+
isFullscreen,
|
1390
|
+
editorHeight = t.$box.outerHeight();
|
1357
1391
|
|
1358
1392
|
t.$box.toggleClass(fullscreenCssClass);
|
1359
1393
|
isFullscreen = t.$box.hasClass(fullscreenCssClass);
|
1394
|
+
|
1395
|
+
if (isFullscreen) {
|
1396
|
+
t.$box.before(
|
1397
|
+
$('<div/>', {
|
1398
|
+
class: fullscreenPlaceholderClass
|
1399
|
+
}).css({
|
1400
|
+
height: editorHeight
|
1401
|
+
})
|
1402
|
+
);
|
1403
|
+
} else {
|
1404
|
+
$('.' + fullscreenPlaceholderClass).remove();
|
1405
|
+
}
|
1406
|
+
|
1360
1407
|
$('body').toggleClass(prefix + 'body-fullscreen', isFullscreen);
|
1361
1408
|
$(window).trigger('scroll');
|
1362
1409
|
t.$c.trigger('tbw' + (isFullscreen ? 'open' : 'close') + 'fullscreen');
|
@@ -1366,7 +1413,7 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1366
1413
|
/*
|
1367
1414
|
* Call method of trumbowyg if exist
|
1368
1415
|
* else try to call anonymous function
|
1369
|
-
* and
|
1416
|
+
* and finally native execCommand
|
1370
1417
|
*/
|
1371
1418
|
execCmd: function (cmd, param, forceCss, skipTrumbowyg) {
|
1372
1419
|
var t = this;
|
@@ -1408,10 +1455,12 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1408
1455
|
|
1409
1456
|
|
1410
1457
|
// Open a modal box
|
1411
|
-
openModal: function (title, content) {
|
1458
|
+
openModal: function (title, content, buildForm) {
|
1412
1459
|
var t = this,
|
1413
1460
|
prefix = t.o.prefix;
|
1414
1461
|
|
1462
|
+
buildForm = buildForm !== false;
|
1463
|
+
|
1415
1464
|
// No open a modal box when exist other modal box
|
1416
1465
|
if ($('.' + prefix + 'modal-box', t.$box).length > 0) {
|
1417
1466
|
return false;
|
@@ -1432,7 +1481,7 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1432
1481
|
}).css({
|
1433
1482
|
top: t.$box.offset().top + t.$btnPane.height(),
|
1434
1483
|
zIndex: 99999
|
1435
|
-
}).appendTo($(
|
1484
|
+
}).appendTo($(t.doc.body));
|
1436
1485
|
|
1437
1486
|
// Click on overlay close modal by cancelling them
|
1438
1487
|
t.$overlay.one('click', function () {
|
@@ -1441,33 +1490,39 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1441
1490
|
});
|
1442
1491
|
|
1443
1492
|
// Build the form
|
1444
|
-
var
|
1445
|
-
|
1446
|
-
|
1447
|
-
|
1448
|
-
|
1449
|
-
$modal.trigger(CONFIRM_EVENT);
|
1450
|
-
return false;
|
1451
|
-
})
|
1452
|
-
.on('reset', function () {
|
1453
|
-
$modal.trigger(CANCEL_EVENT);
|
1454
|
-
return false;
|
1493
|
+
var formOrContent;
|
1494
|
+
if (buildForm) {
|
1495
|
+
formOrContent = $('<form/>', {
|
1496
|
+
action: '',
|
1497
|
+
html: content
|
1455
1498
|
})
|
1456
|
-
|
1457
|
-
|
1458
|
-
|
1459
|
-
|
1460
|
-
|
1499
|
+
.on('submit', function () {
|
1500
|
+
$modal.trigger(CONFIRM_EVENT);
|
1501
|
+
return false;
|
1502
|
+
})
|
1503
|
+
.on('reset', function () {
|
1504
|
+
$modal.trigger(CANCEL_EVENT);
|
1505
|
+
return false;
|
1506
|
+
})
|
1507
|
+
.on('submit reset', function () {
|
1508
|
+
if (t.o.autogrowOnEnter) {
|
1509
|
+
t.autogrowOnEnterDontClose = false;
|
1510
|
+
}
|
1511
|
+
});
|
1512
|
+
} else {
|
1513
|
+
formOrContent = content;
|
1514
|
+
}
|
1461
1515
|
|
1462
1516
|
|
1463
1517
|
// Build ModalBox and animate to show them
|
1464
1518
|
var $box = $('<div/>', {
|
1465
1519
|
class: prefix + 'modal-box',
|
1466
|
-
html:
|
1520
|
+
html: formOrContent
|
1467
1521
|
})
|
1468
1522
|
.css({
|
1469
|
-
top: '-' + t.$btnPane.outerHeight()
|
1470
|
-
opacity: 0
|
1523
|
+
top: '-' + t.$btnPane.outerHeight(),
|
1524
|
+
opacity: 0,
|
1525
|
+
paddingBottom: buildForm ? null : '5%',
|
1471
1526
|
})
|
1472
1527
|
.appendTo($modal)
|
1473
1528
|
.animate({
|
@@ -1477,24 +1532,26 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1477
1532
|
|
1478
1533
|
|
1479
1534
|
// Append title
|
1480
|
-
|
1481
|
-
|
1482
|
-
|
1483
|
-
|
1484
|
-
|
1485
|
-
|
1486
|
-
|
1487
|
-
|
1488
|
-
// Focus in modal box
|
1489
|
-
$('input:first', $box).focus();
|
1535
|
+
if (title) {
|
1536
|
+
$('<span/>', {
|
1537
|
+
text: title,
|
1538
|
+
class: prefix + 'modal-title'
|
1539
|
+
}).prependTo($box);
|
1540
|
+
}
|
1490
1541
|
|
1542
|
+
if (buildForm) {
|
1543
|
+
// Focus in modal box
|
1544
|
+
$('input:first', $box).focus();
|
1491
1545
|
|
1492
|
-
|
1493
|
-
|
1494
|
-
|
1546
|
+
// Append Confirm and Cancel buttons
|
1547
|
+
t.buildModalBtn('submit', $box);
|
1548
|
+
t.buildModalBtn('reset', $box);
|
1495
1549
|
|
1550
|
+
$modal.height($box.outerHeight() + 10);
|
1551
|
+
}
|
1496
1552
|
|
1497
1553
|
$(window).trigger('scroll');
|
1554
|
+
t.$c.trigger('tbwmodalopen');
|
1498
1555
|
|
1499
1556
|
return $modal;
|
1500
1557
|
},
|
@@ -1518,18 +1575,19 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1518
1575
|
t.$overlay.off();
|
1519
1576
|
|
1520
1577
|
// Find the modal box
|
1521
|
-
var $modalBox = $('.' + prefix + 'modal-box', $(
|
1578
|
+
var $modalBox = $('.' + prefix + 'modal-box', $(t.doc.body));
|
1522
1579
|
|
1523
1580
|
$modalBox.animate({
|
1524
1581
|
top: '-' + $modalBox.height()
|
1525
1582
|
}, 100, function () {
|
1526
1583
|
$modalBox.parent().remove();
|
1527
1584
|
t.hideOverlay();
|
1585
|
+
t.$c.trigger('tbwmodalclose');
|
1528
1586
|
});
|
1529
1587
|
|
1530
1588
|
t.restoreRange();
|
1531
1589
|
},
|
1532
|
-
//
|
1590
|
+
// Pre-formatted build and management modal
|
1533
1591
|
openModalInsert: function (title, fields, cmd) {
|
1534
1592
|
var t = this,
|
1535
1593
|
prefix = t.o.prefix,
|
@@ -1603,11 +1661,15 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1603
1661
|
},
|
1604
1662
|
addErrorOnModalField: function ($field, err) {
|
1605
1663
|
var prefix = this.o.prefix,
|
1664
|
+
spanErrorClass = prefix + 'msg-error',
|
1606
1665
|
$label = $field.parent();
|
1607
1666
|
|
1608
1667
|
$field
|
1609
1668
|
.on('change keyup', function () {
|
1610
1669
|
$label.removeClass(prefix + 'input-error');
|
1670
|
+
setTimeout(function () {
|
1671
|
+
$label.find('.' + spanErrorClass).remove();
|
1672
|
+
}, 150);
|
1611
1673
|
});
|
1612
1674
|
|
1613
1675
|
$label
|
@@ -1615,7 +1677,7 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1615
1677
|
.find('input+span')
|
1616
1678
|
.append(
|
1617
1679
|
$('<span/>', {
|
1618
|
-
class:
|
1680
|
+
class: spanErrorClass,
|
1619
1681
|
text: err
|
1620
1682
|
})
|
1621
1683
|
);
|
@@ -1684,18 +1746,20 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1684
1746
|
|
1685
1747
|
t.range = null;
|
1686
1748
|
|
1687
|
-
if (documentSelection.rangeCount) {
|
1688
|
-
|
1689
|
-
range = t.doc.createRange(),
|
1690
|
-
rangeStart;
|
1691
|
-
range.selectNodeContents(t.$ed[0]);
|
1692
|
-
range.setEnd(savedRange.startContainer, savedRange.startOffset);
|
1693
|
-
rangeStart = (range + '').length;
|
1694
|
-
t.metaRange = {
|
1695
|
-
start: rangeStart,
|
1696
|
-
end: rangeStart + (savedRange + '').length
|
1697
|
-
};
|
1749
|
+
if (!documentSelection || !documentSelection.rangeCount) {
|
1750
|
+
return;
|
1698
1751
|
}
|
1752
|
+
|
1753
|
+
var savedRange = t.range = documentSelection.getRangeAt(0),
|
1754
|
+
range = t.doc.createRange(),
|
1755
|
+
rangeStart;
|
1756
|
+
range.selectNodeContents(t.$ed[0]);
|
1757
|
+
range.setEnd(savedRange.startContainer, savedRange.startOffset);
|
1758
|
+
rangeStart = (range + '').length;
|
1759
|
+
t.metaRange = {
|
1760
|
+
start: rangeStart,
|
1761
|
+
end: rangeStart + (savedRange + '').length
|
1762
|
+
};
|
1699
1763
|
},
|
1700
1764
|
restoreRange: function () {
|
1701
1765
|
var t = this,
|
@@ -1741,20 +1805,40 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1741
1805
|
}
|
1742
1806
|
}
|
1743
1807
|
|
1744
|
-
|
1808
|
+
// Fix IE11 Error 'Could not complete the operation due to error 800a025e'.
|
1809
|
+
// https://stackoverflow.com/questions/16160996/could-not-complete-the-operation-due-to-error-800a025e
|
1810
|
+
try {
|
1811
|
+
documentSelection.removeAllRanges();
|
1812
|
+
} catch (e) {
|
1813
|
+
}
|
1814
|
+
|
1745
1815
|
documentSelection.addRange(range || savedRange);
|
1746
1816
|
},
|
1747
1817
|
getRangeText: function () {
|
1748
1818
|
return this.range + '';
|
1749
1819
|
},
|
1750
1820
|
|
1821
|
+
clearButtonPaneStatus: function () {
|
1822
|
+
var t = this,
|
1823
|
+
prefix = t.o.prefix,
|
1824
|
+
activeClasses = prefix + 'active-button ' + prefix + 'active',
|
1825
|
+
originalIconClass = prefix + 'original-icon';
|
1826
|
+
|
1827
|
+
// Reset all buttons and dropdown state
|
1828
|
+
$('.' + prefix + 'active-button', t.$btnPane).removeClass(activeClasses);
|
1829
|
+
$('.' + originalIconClass, t.$btnPane).each(function () {
|
1830
|
+
$(this).find('svg use').attr('xlink:href', $(this).data(originalIconClass));
|
1831
|
+
});
|
1832
|
+
},
|
1751
1833
|
updateButtonPaneStatus: function () {
|
1752
1834
|
var t = this,
|
1753
1835
|
prefix = t.o.prefix,
|
1754
|
-
|
1755
|
-
|
1836
|
+
activeClasses = prefix + 'active-button ' + prefix + 'active',
|
1837
|
+
originalIconClass = prefix + 'original-icon',
|
1838
|
+
tags = t.getTagsRecursive(t.doc.getSelection().focusNode);
|
1839
|
+
|
1840
|
+
t.clearButtonPaneStatus();
|
1756
1841
|
|
1757
|
-
$('.' + prefix + 'active-button', t.$btnPane).removeClass(activeClasses);
|
1758
1842
|
$.each(tags, function (i, tag) {
|
1759
1843
|
var btnName = t.tagToButton[tag.toLowerCase()],
|
1760
1844
|
$btn = $('.' + prefix + btnName + '-button', t.$btnPane);
|
@@ -1764,8 +1848,25 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1764
1848
|
} else {
|
1765
1849
|
try {
|
1766
1850
|
$btn = $('.' + prefix + 'dropdown .' + prefix + btnName + '-dropdown-button', t.$box);
|
1767
|
-
var
|
1768
|
-
|
1851
|
+
var $btnSvgUse = $btn.find('svg use'),
|
1852
|
+
dropdownBtnName = $btn.parent().data(prefix + 'dropdown'),
|
1853
|
+
$dropdownBtn = $('.' + prefix + dropdownBtnName + '-button', t.$box),
|
1854
|
+
$dropdownBtnSvgUse = $dropdownBtn.find('svg use');
|
1855
|
+
|
1856
|
+
// Highlight the dropdown button
|
1857
|
+
$dropdownBtn.addClass(activeClasses);
|
1858
|
+
|
1859
|
+
// Switch dropdown icon to the active sub-icon one
|
1860
|
+
if (t.o.changeActiveDropdownIcon && $btnSvgUse.length > 0) {
|
1861
|
+
// Save original icon
|
1862
|
+
$dropdownBtn
|
1863
|
+
.addClass(originalIconClass)
|
1864
|
+
.data(originalIconClass, $dropdownBtnSvgUse.attr('xlink:href'));
|
1865
|
+
|
1866
|
+
// Put the active sub-button's icon
|
1867
|
+
$dropdownBtnSvgUse
|
1868
|
+
.attr('xlink:href', $btnSvgUse.attr('xlink:href'));
|
1869
|
+
}
|
1769
1870
|
} catch (e) {
|
1770
1871
|
}
|
1771
1872
|
}
|
@@ -1815,9 +1916,10 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1815
1916
|
});
|
1816
1917
|
},
|
1817
1918
|
destroyPlugins: function () {
|
1919
|
+
var t = this;
|
1818
1920
|
$.each(this.loadedPlugins, function (i, plugin) {
|
1819
1921
|
if (plugin.destroy) {
|
1820
|
-
plugin.destroy();
|
1922
|
+
plugin.destroy(t);
|
1821
1923
|
}
|
1822
1924
|
});
|
1823
1925
|
}
|