activeadmin_trumbowyg 0.2.8 → 0.2.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +16 -3
- data/Rakefile +13 -0
- data/app/assets/fonts/trumbowyg/icons.svg +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/bn.js +62 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/bn.min.js +9 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/et.js +65 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/et.min.js +9 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/ko.js +4 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/ko.min.js +3 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/sl.js +9 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/sl.min.js +7 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/tr.js +7 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/tr.min.js +4 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/allowtagsfrompaste/trumbowyg.allowtagsfrompaste.js +3 -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 +36 -24
- 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 +41 -5
- 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 +44 -30
- 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 +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/colors/ui/trumbowyg.colors.css +3 -2
- 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 +159 -92
- 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 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/emoji/ui/trumbowyg.emoji.css +3 -2
- 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 +15 -9
- 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 +119 -75
- 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 +10 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/giphy/trumbowyg.giphy.min.js +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/giphy/ui/sass/trumbowyg.giphy.scss +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/giphy/ui/trumbowyg.giphy.css +13 -6
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/giphy/ui/trumbowyg.giphy.min.css +2 -2
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/highlight/trumbowyg.highlight.js +237 -20
- 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 +27 -15
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/history/trumbowyg.history.min.js +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/indent/trumbowyg.indent.js +60 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/indent/trumbowyg.indent.min.js +1 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/insertaudio/trumbowyg.insertaudio.js +12 -6
- 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 +45 -27
- 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 +20 -10
- 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 +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mathml/ui/trumbowyg.mathml.css +3 -2
- 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 +12 -6
- 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 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mention/ui/trumbowyg.mention.css +6 -2
- 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 +22 -14
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/noembed/trumbowyg.noembed.min.js +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/pasteembed/trumbowyg.pasteembed.min.js +1 -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 +17 -11
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/preformatted/trumbowyg.preformatted.min.js +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/resizimg/trumbowyg.resizimg.js +47 -39
- 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 +10 -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 +6 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/specialchars/trumbowyg.specialchars.min.js +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/specialchars/ui/sass/trumbowyg.specialchars.scss +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/specialchars/ui/trumbowyg.specialchars.css +3 -2
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/specialchars/ui/trumbowyg.specialchars.min.css +2 -2
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/table/trumbowyg.table.js +93 -58
- 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 +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/table/ui/trumbowyg.table.css +5 -3
- 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 +6 -0
- 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 +51 -29
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/upload/trumbowyg.upload.min.js +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/trumbowyg.js +165 -80
- data/app/assets/javascripts/activeadmin/trumbowyg/trumbowyg.min.js +12 -2
- data/app/assets/javascripts/activeadmin/trumbowyg_input.js +3 -7
- data/app/assets/stylesheets/activeadmin/trumbowyg/trumbowyg.scss +69 -57
- data/lib/activeadmin/trumbowyg/version.rb +1 -1
- metadata +13 -121
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/resizimg/resizable-resolveconflict.js +0 -20
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/resizimg/resizable-resolveconflict.min.js +0 -1
@@ -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",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"},
|
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"},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"},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"},et:{table:"Sisesta tabel",tableAddRow:"Lisa rida",tableAddRowAbove:"Lisa rida üles",tableAddColumnLeft:"Lisa tulp vasakule",tableAddColumn:"Lisa tulp paremale",tableDeleteRow:"Kustuta rida",tableDeleteColumn:"Kustuta tulp",tableDestroy:"Kustuta tabel",error:"Viga"},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"},hu:{table:"Táblázat beszúrás",tableAddRow:"Sor hozzáadás",tableAddRowAbove:"Sor beszúrás fönt",tableAddColumnLeft:"Sor beszúrás balra",tableAddColumn:"Sor beszúrás jobbra",tableDeleteRow:"Sor törlés",tableDeleteColumn:"Oszlop törlés",tableDestroy:"Táblázat törlés",error:"Hiba"},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"},ja:{table:"表の挿入",tableAddRow:"行の追加",tableAddRowAbove:"行の追加",tableAddColumnLeft:"列の追加",tableAddColumn:"列の追加",error:"エラー"},ko:{table:"표 넣기",tableAddRow:"줄 추가",tableAddRowAbove:"줄 추가",tableAddColumnLeft:"칸 추가",tableAddColumn:"칸 추가",tableDeleteRow:"줄 삭제",tableDeleteColumn:"칸 삭제",tableDestroy:"표 지우기",error:"에러"},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"},ru:{table:"Вставить таблицу",tableAddRow:"Добавить строку",tableAddRowAbove:"Добавить строку",tableAddColumnLeft:"Добавить столбец",tableAddColumn:"Добавить столбец",tableDeleteRow:"Удалить строку",tableDeleteColumn:"Удалить столбец",tableDestroy:"Удалить таблицу",error:"Ошибка"},sk:{table:"Vytvoriť tabuľky",tableAddRow:"Pridať riadok",tableAddRowAbove:"Pridať riadok",tableAddColumnLeft:"Pridať stĺpec",tableAddColumn:"Pridať stĺpec",error:"Chyba"},tr:{table:"Tablo ekle",tableAddRow:"Satır ekle",tableAddRowAbove:"Yukarıya satır ekle",tableAddColumnLeft:"Sola sütun ekle",tableAddColumn:"Sağa sütun ekle",tableDeleteRow:"Satırı sil",tableDeleteColumn:"Sütunu sil",tableDestroy:"Tabloyu sil",error:"Hata"},zh_tw:{table:"插入表格",tableAddRow:"加入行",tableAddRowAbove:"加入行",tableAddColumnLeft:"加入列",tableAddColumn:"加入列",tableDeleteRow:"刪除行",tableDeleteColumn:"刪除列",tableDestroy:"刪除表格",error:"錯誤"},es:{table:"Insertar tabla",tableAddRow:"Agregar fila",tableAddRowAbove:"Agregar fila arriba",tableAddColumnLeft:"Agregar columna a la izquierda",tableAddColumn:"Agregar columna a la derecha",tableDeleteRow:"Borrar fila",tableDeleteColumn:"Borrar columna",tableDestroy:"Borrar tabla",error:"Error"}},plugins:{table:{init:function(l){l.o.plugins.table=e.extend(!0,{},t,l.o.plugins.table||{});var a={fn:function(){l.saveRange();var t="table",a=l.o.prefix+"dropdown",n={class:a+"-"+"table "+a+" "+l.o.prefix+"fixed-top"};n["data-"+a]=t;var b=e("<div/>",n);if(0===l.$box.find("."+a+"-"+t).length?l.$box.append(b.hide()):b=l.$box.find("."+a+"-"+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",o),r.find("td").on("mousedown",d),b.append(r),b.append(e('<div class="trumbowyg-table-size">1x1</div>'))}l.dropdown(t)}},o=function(t){var l=e(t.target).closest("table"),a=this.cellIndex,o=this.parentNode.rowIndex;l.find("td").removeClass("active");for(var d=0;d<=o;d+=1)for(var n=0;n<=a;n+=1)l.find("tr:nth-of-type("+(d+1)+")").find("td:nth-of-type("+(n+1)+")").addClass("active");l.next(".trumbowyg-table-size").html(a+1+"x"+(o+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 a=this.cellIndex,o=this.parentNode.rowIndex,d=0;d<=o;d+=1)for(var n=e("<tr></tr>").appendTo(t),b=0;b<=a;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,a=e(t).closest("tr"),o=e(t).closest("table");if(o.length>0){for(var d=e("<tr/>"),n=0;n<o.find("tr")[0].childElementCount;n+=1)e("<td/>").appendTo(d);a.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,a=e(t).closest("tr"),o=e(t).closest("table");if(o.length>0){for(var d=e("<tr/>"),n=0;n<o.find("tr")[0].childElementCount;n+=1)e("<td/>").appendTo(d);a.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,a=e(t).closest("td"),o=e(t).closest("table"),d=a.index();o.length>0&&e(o).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,a=e(t).closest("td"),o=e(t).closest("table"),d=a.index();o.length>0&&e(o).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;e(t).closest("table").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;e(t).closest("tr").remove(),l.syncCode()}},f={title:l.lang.tableDeleteColumn,text:l.lang.tableDeleteColumn,ico:"col-delete",fn:function(){l.saveRange();var t=l.doc.getSelection().focusNode,a=e(t).closest("table"),o=e(t).closest("td").index();e(a).find("tr").each((function(){e(this).find("td:eq("+o+")").remove()})),l.syncCode()}};l.addBtnDef("table",a),l.addBtnDef("tableAddRowAbove",b),l.addBtnDef("tableAddRow",n),l.addBtnDef("tableAddColumnLeft",i),l.addBtnDef("tableAddColumn",r),l.addBtnDef("tableDeleteRow",u),l.addBtnDef("tableDeleteColumn",f),l.addBtnDef("tableDestroy",s)}}}})}(jQuery);
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* Trumbowyg v2.
|
2
|
+
* Trumbowyg v2.25.1 - A lightweight WYSIWYG editor
|
3
3
|
* Trumbowyg plugin stylesheet
|
4
4
|
* ------------------------
|
5
5
|
* @link http://alex-d.github.io/Trumbowyg
|
@@ -26,10 +26,12 @@
|
|
26
26
|
margin: 1px;
|
27
27
|
padding: 0;
|
28
28
|
background-color: #fff;
|
29
|
-
box-shadow: 0 0 0 1px #cecece inset;
|
29
|
+
-webkit-box-shadow: 0 0 0 1px #cecece inset;
|
30
|
+
box-shadow: 0 0 0 1px #cecece inset; }
|
30
31
|
.trumbowyg-dropdown-table table td.active {
|
31
32
|
background-color: #00b393;
|
32
|
-
box-shadow: none;
|
33
|
+
-webkit-box-shadow: none;
|
34
|
+
box-shadow: none;
|
33
35
|
cursor: pointer; }
|
34
36
|
|
35
37
|
.trumbowyg-dropdown-table .trumbowyg-table-size {
|
@@ -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}.trumbowyg-dropdown-table .trumbowyg-table-size{text-align:center}
|
1
|
+
/** Trumbowyg v2.25.1 - 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;-webkit-box-shadow:0 0 0 1px #cecece inset;box-shadow:0 0 0 1px #cecece inset}.trumbowyg-dropdown-table table td.active{background-color:#00b393;-webkit-box-shadow:none;box-shadow:none;cursor:pointer}.trumbowyg-dropdown-table .trumbowyg-table-size{text-align:center}
|
data/app/assets/javascripts/activeadmin/trumbowyg/plugins/template/trumbowyg.template.min.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
!function(t){"use strict";function e(e){var
|
1
|
+
!function(t){"use strict";function e(e){var a=e.o.plugins.templates,l=[];return t.each(a,(function(t,a){e.addBtnDef("template_"+t,{fn:function(){e.html(a.html)},hasIcon:!1,title:a.name}),l.push("template_"+t)})),l}t.extend(!0,t.trumbowyg,{langs:{en:{template:"Template"},da:{template:"Skabelon"},de:{template:"Vorlage"},et:{template:"Mall"},fr:{template:"Patron"},hu:{template:"Sablon"},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);
|
@@ -21,7 +21,7 @@
|
|
21
21
|
headers: {}, // Additional headers
|
22
22
|
xhrFields: {}, // Additional fields
|
23
23
|
urlPropertyName: 'file', // How to get url from the json response (for instance 'url' for {url: ....})
|
24
|
-
statusPropertyName: 'success', // How to get status from the json response
|
24
|
+
statusPropertyName: 'success', // How to get status from the json response
|
25
25
|
success: undefined, // Success callback: function (data, trumbowyg, $modal, values) {}
|
26
26
|
error: undefined, // Error callback: function () {}
|
27
27
|
imageWidthModalEdit: false // Add ability to edit image width
|
@@ -53,6 +53,11 @@
|
|
53
53
|
file: 'File',
|
54
54
|
uploadError: 'Error'
|
55
55
|
},
|
56
|
+
cs: {
|
57
|
+
upload: 'Nahrát obrázek',
|
58
|
+
file: 'Soubor',
|
59
|
+
uploadError: 'Chyba'
|
60
|
+
},
|
56
61
|
da: {
|
57
62
|
upload: 'Upload',
|
58
63
|
file: 'Fil',
|
@@ -63,55 +68,60 @@
|
|
63
68
|
file: 'Datei',
|
64
69
|
uploadError: 'Fehler'
|
65
70
|
},
|
66
|
-
|
67
|
-
upload: '
|
68
|
-
file: '
|
69
|
-
uploadError: '
|
71
|
+
et: {
|
72
|
+
upload: 'Lae üles',
|
73
|
+
file: 'Fail',
|
74
|
+
uploadError: 'Viga'
|
70
75
|
},
|
71
76
|
fr: {
|
72
77
|
upload: 'Envoi',
|
73
78
|
file: 'Fichier',
|
74
79
|
uploadError: 'Erreur'
|
75
80
|
},
|
76
|
-
|
77
|
-
upload: '
|
78
|
-
file: '
|
79
|
-
uploadError: '
|
80
|
-
},
|
81
|
-
zh_cn: {
|
82
|
-
upload: '上传',
|
83
|
-
file: '文件',
|
84
|
-
uploadError: '错误'
|
85
|
-
},
|
86
|
-
zh_tw: {
|
87
|
-
upload: '上傳',
|
88
|
-
file: '文件',
|
89
|
-
uploadError: '錯誤'
|
90
|
-
},
|
91
|
-
ru: {
|
92
|
-
upload: 'Загрузка',
|
93
|
-
file: 'Файл',
|
94
|
-
uploadError: 'Ошибка'
|
81
|
+
hu: {
|
82
|
+
upload: 'Feltöltés',
|
83
|
+
file: 'Fájl',
|
84
|
+
uploadError: 'Hiba'
|
95
85
|
},
|
96
86
|
ja: {
|
97
87
|
upload: 'アップロード',
|
98
88
|
file: 'ファイル',
|
99
89
|
uploadError: 'エラー'
|
100
90
|
},
|
91
|
+
ko: {
|
92
|
+
upload: '그림 올리기',
|
93
|
+
file: '파일',
|
94
|
+
uploadError: '에러'
|
95
|
+
},
|
101
96
|
pt_br: {
|
102
97
|
upload: 'Enviar do local',
|
103
98
|
file: 'Arquivo',
|
104
99
|
uploadError: 'Erro'
|
105
100
|
},
|
101
|
+
ru: {
|
102
|
+
upload: 'Загрузка',
|
103
|
+
file: 'Файл',
|
104
|
+
uploadError: 'Ошибка'
|
105
|
+
},
|
106
|
+
sk: {
|
107
|
+
upload: 'Nahrať',
|
108
|
+
file: 'Súbor',
|
109
|
+
uploadError: 'Chyba'
|
110
|
+
},
|
106
111
|
tr: {
|
107
112
|
upload: 'Yükle',
|
108
113
|
file: 'Dosya',
|
109
114
|
uploadError: 'Hata'
|
110
115
|
},
|
111
|
-
|
112
|
-
upload: '
|
113
|
-
file: '
|
114
|
-
uploadError: '
|
116
|
+
zh_cn: {
|
117
|
+
upload: '上传',
|
118
|
+
file: '文件',
|
119
|
+
uploadError: '错误'
|
120
|
+
},
|
121
|
+
zh_tw: {
|
122
|
+
upload: '上傳',
|
123
|
+
file: '文件',
|
124
|
+
uploadError: '錯誤'
|
115
125
|
},
|
116
126
|
},
|
117
127
|
// jshint camelcase:true
|
@@ -147,6 +157,9 @@
|
|
147
157
|
};
|
148
158
|
}
|
149
159
|
|
160
|
+
// Prevent multiple submissions while uploading
|
161
|
+
var isUploading = false;
|
162
|
+
|
150
163
|
var $modal = trumbowyg.openModalInsert(
|
151
164
|
// Title
|
152
165
|
trumbowyg.lang.upload,
|
@@ -156,6 +169,11 @@
|
|
156
169
|
|
157
170
|
// Callback
|
158
171
|
function (values) {
|
172
|
+
if (isUploading) {
|
173
|
+
return;
|
174
|
+
}
|
175
|
+
isUploading = true;
|
176
|
+
|
159
177
|
var data = new FormData();
|
160
178
|
data.append(trumbowyg.o.plugins.upload.fileFieldName, file);
|
161
179
|
|
@@ -206,7 +224,7 @@
|
|
206
224
|
trumbowyg.execCmd('insertImage', url, false, true);
|
207
225
|
var $img = $('img[src="' + url + '"]:not([alt])', trumbowyg.$box);
|
208
226
|
$img.attr('alt', values.alt);
|
209
|
-
if (trumbowyg.o.imageWidthModalEdit && parseInt(values.width) > 0) {
|
227
|
+
if (trumbowyg.o.plugins.upload.imageWidthModalEdit && parseInt(values.width) > 0) {
|
210
228
|
$img.attr({
|
211
229
|
width: values.width
|
212
230
|
});
|
@@ -223,6 +241,8 @@
|
|
223
241
|
trumbowyg.$c.trigger('tbwuploaderror', [trumbowyg, data]);
|
224
242
|
}
|
225
243
|
}
|
244
|
+
|
245
|
+
isUploading = false;
|
226
246
|
},
|
227
247
|
|
228
248
|
error: trumbowyg.o.plugins.upload.error || function () {
|
@@ -231,6 +251,8 @@
|
|
231
251
|
trumbowyg.lang.uploadError
|
232
252
|
);
|
233
253
|
trumbowyg.$c.trigger('tbwuploaderror', [trumbowyg]);
|
254
|
+
|
255
|
+
isUploading = false;
|
234
256
|
}
|
235
257
|
});
|
236
258
|
}
|
@@ -1 +1 @@
|
|
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
|
1
|
+
!function(r){"use strict";var a={serverPath:"",fileFieldName:"fileToUpload",data:[],headers:{},xhrFields:{},urlPropertyName:"file",statusPropertyName:"success",success:void 0,error:void 0,imageWidthModalEdit:!1};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(){if(!r.trumbowyg.addedXhrProgressEvent){var a=r.ajaxSettings.xhr;r.ajaxSetup({xhr:function(){var r=this,e=a();return e&&"object"==typeof e.upload&&void 0!==r.progressUpload&&e.upload.addEventListener("progress",(function(a){r.progressUpload(a)}),!1),e}}),r.trumbowyg.addedXhrProgressEvent=!0}}(),r.extend(!0,r.trumbowyg,{langs:{en:{upload:"Upload",file:"File",uploadError:"Error"},cs:{upload:"Nahrát obrázek",file:"Soubor",uploadError:"Chyba"},da:{upload:"Upload",file:"Fil",uploadError:"Fejl"},de:{upload:"Hochladen",file:"Datei",uploadError:"Fehler"},et:{upload:"Lae üles",file:"Fail",uploadError:"Viga"},fr:{upload:"Envoi",file:"Fichier",uploadError:"Erreur"},hu:{upload:"Feltöltés",file:"Fájl",uploadError:"Hiba"},ja:{upload:"アップロード",file:"ファイル",uploadError:"エラー"},ko:{upload:"그림 올리기",file:"파일",uploadError:"에러"},pt_br:{upload:"Enviar do local",file:"Arquivo",uploadError:"Erro"},ru:{upload:"Загрузка",file:"Файл",uploadError:"Ошибка"},sk:{upload:"Nahrať",file:"Súbor",uploadError:"Chyba"},tr:{upload:"Yükle",file:"Dosya",uploadError:"Hata"},zh_cn:{upload:"上传",file:"文件",uploadError:"错误"},zh_tw:{upload:"上傳",file:"文件",uploadError:"錯誤"}},plugins:{upload:{init:function(o){o.o.plugins.upload=r.extend(!0,{},a,o.o.plugins.upload||{});var l={fn:function(){o.saveRange();var a,l=o.o.prefix,t={file:{type:"file",required:!0,attributes:{accept:"image/*"}},alt:{label:"description",value:o.getRangeText()}};o.o.plugins.upload.imageWidthModalEdit&&(t.width={value:""});var d=!1,i=o.openModalInsert(o.lang.upload,t,(function(t){if(!d){d=!0;var u=new FormData;u.append(o.o.plugins.upload.fileFieldName,a),o.o.plugins.upload.data.map((function(r){u.append(r.name,r.value)})),r.map(t,(function(r,a){"file"!==a&&u.append(a,r)})),0===r("."+l+"progress",i).length&&r("."+l+"modal-title",i).after(r("<div/>",{class:l+"progress"}).append(r("<div/>",{class:l+"progress-bar"}))),r.ajax({url:o.o.plugins.upload.serverPath,headers:o.o.plugins.upload.headers,xhrFields:o.o.plugins.upload.xhrFields,type:"POST",data:u,cache:!1,dataType:"json",processData:!1,contentType:!1,progressUpload:function(a){r("."+l+"progress-bar").css("width",Math.round(100*a.loaded/a.total)+"%")},success:function(a){if(o.o.plugins.upload.success)o.o.plugins.upload.success(a,o,i,t);else if(e(a,o.o.plugins.upload.statusPropertyName.split("."))){var l=e(a,o.o.plugins.upload.urlPropertyName.split("."));o.execCmd("insertImage",l,!1,!0);var u=r('img[src="'+l+'"]:not([alt])',o.$box);u.attr("alt",t.alt),o.o.plugins.upload.imageWidthModalEdit&&parseInt(t.width)>0&&u.attr({width:t.width}),setTimeout((function(){o.closeModal()}),250),o.$c.trigger("tbwuploadsuccess",[o,a,l])}else o.addErrorOnModalField(r("input[type=file]",i),o.lang[a.message]),o.$c.trigger("tbwuploaderror",[o,a]);d=!1},error:o.o.plugins.upload.error||function(){o.addErrorOnModalField(r("input[type=file]",i),o.lang.uploadError),o.$c.trigger("tbwuploaderror",[o]),d=!1}})}}));r("input[type=file]").on("change",(function(r){try{a=r.target.files[0]}catch(e){a=r.target.value}}))}};o.addBtnDef("upload",l)}}}})}(jQuery);
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* Trumbowyg v2.
|
2
|
+
* Trumbowyg v2.25.1 - A lightweight WYSIWYG editor
|
3
3
|
* Trumbowyg core file
|
4
4
|
* ------------------------
|
5
5
|
* @link http://alex-d.github.io/Trumbowyg
|
@@ -72,6 +72,7 @@ jQuery.trumbowyg = {
|
|
72
72
|
|
73
73
|
// SVG Path globally
|
74
74
|
svgPath: null,
|
75
|
+
svgAbsoluteUseHref: false,
|
75
76
|
|
76
77
|
hideButtonTexts: null
|
77
78
|
};
|
@@ -86,9 +87,10 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
86
87
|
autogrow: false,
|
87
88
|
autogrowOnEnter: false,
|
88
89
|
imageWidthModalEdit: false,
|
90
|
+
hideButtonTexts: null,
|
89
91
|
|
90
92
|
prefix: 'trumbowyg-',
|
91
|
-
|
93
|
+
tagClasses: {},
|
92
94
|
semantic: true,
|
93
95
|
semanticKeepAttributes: false,
|
94
96
|
resetCss: false,
|
@@ -121,9 +123,12 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
121
123
|
// imgDblClickHandler: default is defined in constructor
|
122
124
|
|
123
125
|
plugins: {},
|
126
|
+
|
124
127
|
urlProtocol: false,
|
125
128
|
minimalLinks: false,
|
126
|
-
defaultLinkTarget: undefined
|
129
|
+
defaultLinkTarget: undefined,
|
130
|
+
|
131
|
+
svgPath: null
|
127
132
|
},
|
128
133
|
writable: false,
|
129
134
|
enumerable: true,
|
@@ -228,42 +233,48 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
228
233
|
// SVG path
|
229
234
|
var svgPathOption = $trumbowyg.svgPath != null ? $trumbowyg.svgPath : options.svgPath;
|
230
235
|
t.hasSvg = svgPathOption !== false;
|
231
|
-
|
232
|
-
if ($('#' + trumbowygIconsId, t.doc).length === 0
|
236
|
+
|
237
|
+
if (svgPathOption !== false && ($trumbowyg.svgAbsoluteUseHref || $('#' + trumbowygIconsId, t.doc).length === 0)) {
|
233
238
|
if (svgPathOption == null) {
|
234
239
|
// Hack to get svgPathOption based on trumbowyg.js path
|
235
|
-
var scriptElements =
|
236
|
-
|
237
|
-
var source =
|
240
|
+
var $scriptElements = $('script[src]');
|
241
|
+
$scriptElements.each(function (i, scriptElement) {
|
242
|
+
var source = scriptElement.src;
|
238
243
|
var matches = source.match('trumbowyg(\.min)?\.js');
|
239
244
|
if (matches != null) {
|
240
245
|
svgPathOption = source.substring(0, source.indexOf(matches[0])) + 'ui/icons.svg';
|
241
246
|
}
|
242
|
-
}
|
243
|
-
if (svgPathOption == null) {
|
244
|
-
console.warn('You must define svgPath: https://goo.gl/CfTY9U'); // jshint ignore:line
|
245
|
-
}
|
247
|
+
});
|
246
248
|
}
|
247
249
|
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
250
|
+
// Do not merge with previous if block: svgPathOption can be redefined in it.
|
251
|
+
// Here we are checking that we find a match
|
252
|
+
if (svgPathOption == null) {
|
253
|
+
console.warn('You must define svgPath: https://goo.gl/CfTY9U'); // jshint ignore:line
|
254
|
+
} else if (!$trumbowyg.svgAbsoluteUseHref) {
|
255
|
+
var div = t.doc.createElement('div');
|
256
|
+
div.id = trumbowygIconsId;
|
257
|
+
t.doc.body.insertBefore(div, t.doc.body.childNodes[0]);
|
258
|
+
$.ajax({
|
259
|
+
async: true,
|
260
|
+
type: 'GET',
|
261
|
+
contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
|
262
|
+
dataType: 'xml',
|
263
|
+
crossDomain: true,
|
264
|
+
url: svgPathOption,
|
265
|
+
data: null,
|
266
|
+
beforeSend: null,
|
267
|
+
complete: null,
|
268
|
+
success: function (data) {
|
269
|
+
div.innerHTML = new XMLSerializer().serializeToString(data.documentElement);
|
270
|
+
}
|
271
|
+
});
|
272
|
+
}
|
265
273
|
}
|
266
274
|
|
275
|
+
var baseHref = !!t.doc.querySelector('base') ? window.location.href.split(/[?#]/)[0] : '';
|
276
|
+
t.svgPath = $trumbowyg.svgAbsoluteUseHref ? svgPathOption : baseHref;
|
277
|
+
|
267
278
|
|
268
279
|
/**
|
269
280
|
* When the button is associated to a empty object
|
@@ -418,7 +429,7 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
418
429
|
}
|
419
430
|
};
|
420
431
|
|
421
|
-
//
|
432
|
+
// Default Options
|
422
433
|
t.o = $.extend(true, {}, $trumbowyg.defaultOptions, options);
|
423
434
|
if (!t.o.hasOwnProperty('imgDblClickHandler')) {
|
424
435
|
t.o.imgDblClickHandler = t.getDefaultImgDblClickHandler();
|
@@ -507,7 +518,7 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
507
518
|
return;
|
508
519
|
}
|
509
520
|
|
510
|
-
if (typeof(protocol) !== 'string') {
|
521
|
+
if (typeof (protocol) !== 'string') {
|
511
522
|
return 'https://';
|
512
523
|
}
|
513
524
|
return protocol.replace('://', '') + '://';
|
@@ -595,6 +606,11 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
595
606
|
t.$ed
|
596
607
|
.on('dblclick', 'img', t.o.imgDblClickHandler)
|
597
608
|
.on('keydown', function (e) {
|
609
|
+
// append flags to differentiate Chrome spans
|
610
|
+
var keyCode = e.which;
|
611
|
+
if (keyCode === 8 || keyCode === 13 || keyCode === 46) {
|
612
|
+
t.toggleSpan(true);
|
613
|
+
}
|
598
614
|
if ((e.ctrlKey || e.metaKey) && !e.altKey) {
|
599
615
|
ctrl = true;
|
600
616
|
var key = t.keys[String.fromCharCode(e.which).toUpperCase()];
|
@@ -602,7 +618,8 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
602
618
|
try {
|
603
619
|
t.execCmd(key.fn, key.param);
|
604
620
|
return false;
|
605
|
-
} catch (c) {
|
621
|
+
} catch (c) {
|
622
|
+
}
|
606
623
|
} else {
|
607
624
|
if (t.o.tabToIndent && e.key === 'Tab') {
|
608
625
|
try {
|
@@ -612,7 +629,8 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
612
629
|
t.execCmd('indent', true, null);
|
613
630
|
}
|
614
631
|
return false;
|
615
|
-
} catch (c) {
|
632
|
+
} catch (c) {
|
633
|
+
}
|
616
634
|
}
|
617
635
|
}
|
618
636
|
})
|
@@ -632,6 +650,11 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
632
650
|
return;
|
633
651
|
}
|
634
652
|
|
653
|
+
// remove Chrome generated span tags
|
654
|
+
if (keyCode === 8 || keyCode === 13 || keyCode === 46) {
|
655
|
+
t.toggleSpan();
|
656
|
+
}
|
657
|
+
|
635
658
|
if ((e.ctrlKey || e.metaKey) && (keyCode === 89 || keyCode === 90)) {
|
636
659
|
t.semanticCode(false, true);
|
637
660
|
t.$c.trigger('tbwchange');
|
@@ -670,15 +693,14 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
670
693
|
if (e.type === 'focus') {
|
671
694
|
t.autogrowOnEnterWasFocused = true;
|
672
695
|
t.autogrowEditorOnEnter();
|
673
|
-
}
|
674
|
-
else if (!t.o.autogrow) {
|
696
|
+
} else if (!t.o.autogrow) {
|
675
697
|
t.$ed.css({height: t.$ed.css('min-height')});
|
676
698
|
t.$c.trigger('tbwresize');
|
677
699
|
}
|
678
700
|
}
|
679
701
|
})
|
680
702
|
.on('keyup focus', function () {
|
681
|
-
|
703
|
+
if (!t.$ta.val().match(/<.*>/) && !t.$ed.html().match(/<.*>/)) {
|
682
704
|
setTimeout(function () {
|
683
705
|
var block = t.isIE ? '<p>' : 'p';
|
684
706
|
t.doc.execCommand('formatBlock', false, block);
|
@@ -883,8 +905,8 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
883
905
|
type: 'button',
|
884
906
|
class: prefix + btnName + '-dropdown-button ' + (btn.class || '') + (btn.ico ? ' ' + prefix + btn.ico + '-button' : ''),
|
885
907
|
html: t.hasSvg && hasIcon ?
|
886
|
-
|
887
|
-
|
908
|
+
'<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) :
|
909
|
+
(btn.text || btn.title || t.lang[btnName] || btnName),
|
888
910
|
title: (btn.key ? '(' + (t.isMac ? 'Cmd' : 'Ctrl') + ' + ' + btn.key + ')' : null),
|
889
911
|
style: btn.style || null,
|
890
912
|
mousedown: function () {
|
@@ -1072,6 +1094,22 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1072
1094
|
}, 0);
|
1073
1095
|
},
|
1074
1096
|
|
1097
|
+
// Remove or add flags to span tags to remove Chrome generated spans
|
1098
|
+
toggleSpan: function (addFlag) {
|
1099
|
+
var t = this;
|
1100
|
+
t.$ed.find('span').each(function () {
|
1101
|
+
if (addFlag === true) {
|
1102
|
+
$(this).attr('data-tbw-flag', true);
|
1103
|
+
} else {
|
1104
|
+
if ($(this).attr('data-tbw-flag')) {
|
1105
|
+
$(this).removeAttr('data-tbw-flag');
|
1106
|
+
} else {
|
1107
|
+
$(this).contents().unwrap();
|
1108
|
+
}
|
1109
|
+
}
|
1110
|
+
});
|
1111
|
+
},
|
1112
|
+
|
1075
1113
|
// Open dropdown when click on a button which open that
|
1076
1114
|
dropdown: function (name) {
|
1077
1115
|
var t = this,
|
@@ -1162,6 +1200,11 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1162
1200
|
t.saveRange();
|
1163
1201
|
t.syncCode(force);
|
1164
1202
|
|
1203
|
+
var restoreRange = true;
|
1204
|
+
if (t.range && t.range.collapsed) {
|
1205
|
+
restoreRange = false;
|
1206
|
+
}
|
1207
|
+
|
1165
1208
|
if (t.o.semantic) {
|
1166
1209
|
t.semanticTag('b', t.o.semanticKeepAttributes);
|
1167
1210
|
t.semanticTag('i', t.o.semanticKeepAttributes);
|
@@ -1197,7 +1240,7 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1197
1240
|
t.$ed.find('p:empty').remove();
|
1198
1241
|
}
|
1199
1242
|
|
1200
|
-
if (!keepRange) {
|
1243
|
+
if (!keepRange && restoreRange) {
|
1201
1244
|
t.restoreRange();
|
1202
1245
|
}
|
1203
1246
|
|
@@ -1205,8 +1248,9 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1205
1248
|
}
|
1206
1249
|
},
|
1207
1250
|
|
1208
|
-
semanticTag: function (oldTag, copyAttributes) {
|
1209
|
-
var newTag;
|
1251
|
+
semanticTag: function (oldTag, copyAttributes, revert) {
|
1252
|
+
var newTag, t = this;
|
1253
|
+
var tmpTag = oldTag;
|
1210
1254
|
|
1211
1255
|
if (this.o.semantic != null && typeof this.o.semantic === 'object' && this.o.semantic.hasOwnProperty(oldTag)) {
|
1212
1256
|
newTag = this.o.semantic[oldTag];
|
@@ -1216,19 +1260,34 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1216
1260
|
return;
|
1217
1261
|
}
|
1218
1262
|
|
1263
|
+
if(revert) {
|
1264
|
+
oldTag = newTag;
|
1265
|
+
newTag = tmpTag;
|
1266
|
+
}
|
1267
|
+
|
1219
1268
|
$(oldTag, this.$ed).each(function () {
|
1269
|
+
var resetRange = false;
|
1220
1270
|
var $oldTag = $(this);
|
1221
|
-
if($oldTag.contents().length === 0) {
|
1271
|
+
if ($oldTag.contents().length === 0) {
|
1222
1272
|
return false;
|
1223
1273
|
}
|
1224
1274
|
|
1225
|
-
|
1275
|
+
if (t.range && t.range.startContainer.parentNode === this) {
|
1276
|
+
resetRange = true;
|
1277
|
+
}
|
1278
|
+
var $newTag = $('<' + newTag + '/>');
|
1279
|
+
$newTag.insertBefore($oldTag);
|
1226
1280
|
if (copyAttributes) {
|
1227
1281
|
$.each($oldTag.prop('attributes'), function () {
|
1228
|
-
$
|
1282
|
+
$newTag.attr(this.name, this.value);
|
1229
1283
|
});
|
1230
1284
|
}
|
1231
|
-
$
|
1285
|
+
$newTag.html($oldTag.html());
|
1286
|
+
$oldTag.remove();
|
1287
|
+
if(resetRange === true) {
|
1288
|
+
t.range.selectNodeContents($newTag.get(0));
|
1289
|
+
t.range.collapse(false);
|
1290
|
+
}
|
1232
1291
|
});
|
1233
1292
|
},
|
1234
1293
|
|
@@ -1265,7 +1324,7 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1265
1324
|
|
1266
1325
|
var options = {
|
1267
1326
|
url: {
|
1268
|
-
label: 'URL',
|
1327
|
+
label: t.lang.linkUrl || 'URL',
|
1269
1328
|
required: true,
|
1270
1329
|
value: url
|
1271
1330
|
},
|
@@ -1423,6 +1482,10 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1423
1482
|
t.$ed.focus();
|
1424
1483
|
}
|
1425
1484
|
|
1485
|
+
if(cmd === 'strikethrough' && t.o.semantic) {
|
1486
|
+
t.semanticTag('strike', t.o.semanticKeepAttributes, true); // browsers cannot undo e.g. <del> as they expect <strike>
|
1487
|
+
}
|
1488
|
+
|
1426
1489
|
try {
|
1427
1490
|
t.doc.execCommand('styleWithCSS', false, forceCss || false);
|
1428
1491
|
} catch (c) {
|
@@ -1444,6 +1507,19 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1444
1507
|
|
1445
1508
|
t.syncCode();
|
1446
1509
|
t.semanticCode(false, true);
|
1510
|
+
try {
|
1511
|
+
var listId = window.getSelection().focusNode;
|
1512
|
+
if(!$(window.getSelection().focusNode.parentNode).hasClass('trumbowyg-editor')){
|
1513
|
+
listId = window.getSelection().focusNode.parentNode;
|
1514
|
+
}
|
1515
|
+
var classes = t.o.tagClasses[param];
|
1516
|
+
if (classes) {
|
1517
|
+
$(listId).addClass(classes);
|
1518
|
+
}
|
1519
|
+
} catch (e) {
|
1520
|
+
|
1521
|
+
}
|
1522
|
+
|
1447
1523
|
}
|
1448
1524
|
|
1449
1525
|
if (cmd !== 'dropdown') {
|
@@ -1496,19 +1572,19 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1496
1572
|
action: '',
|
1497
1573
|
html: content
|
1498
1574
|
})
|
1499
|
-
|
1500
|
-
|
1501
|
-
|
1502
|
-
|
1503
|
-
|
1504
|
-
|
1505
|
-
|
1506
|
-
|
1507
|
-
|
1508
|
-
|
1509
|
-
|
1510
|
-
|
1511
|
-
|
1575
|
+
.on('submit', function () {
|
1576
|
+
$modal.trigger(CONFIRM_EVENT);
|
1577
|
+
return false;
|
1578
|
+
})
|
1579
|
+
.on('reset', function () {
|
1580
|
+
$modal.trigger(CANCEL_EVENT);
|
1581
|
+
return false;
|
1582
|
+
})
|
1583
|
+
.on('submit reset', function () {
|
1584
|
+
if (t.o.autogrowOnEnter) {
|
1585
|
+
t.autogrowOnEnterDontClose = false;
|
1586
|
+
}
|
1587
|
+
});
|
1512
1588
|
} else {
|
1513
1589
|
formOrContent = content;
|
1514
1590
|
}
|
@@ -1541,7 +1617,7 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1541
1617
|
|
1542
1618
|
if (buildForm) {
|
1543
1619
|
// Focus in modal box
|
1544
|
-
$('input:first', $box).focus();
|
1620
|
+
$(':input:first', $box).focus();
|
1545
1621
|
|
1546
1622
|
// Append Confirm and Cancel buttons
|
1547
1623
|
t.buildModalBtn('submit', $box);
|
@@ -1592,22 +1668,31 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1592
1668
|
var t = this,
|
1593
1669
|
prefix = t.o.prefix,
|
1594
1670
|
lg = t.lang,
|
1595
|
-
html = ''
|
1671
|
+
html = '',
|
1672
|
+
idPrefix = prefix + 'form-' + Date.now() + '-';
|
1596
1673
|
|
1597
1674
|
$.each(fields, function (fieldName, field) {
|
1598
1675
|
var l = field.label || fieldName,
|
1599
1676
|
n = field.name || fieldName,
|
1600
|
-
a = field.attributes || {}
|
1677
|
+
a = field.attributes || {},
|
1678
|
+
fieldId = idPrefix + fieldName;
|
1601
1679
|
|
1602
1680
|
var attr = Object.keys(a).map(function (prop) {
|
1603
1681
|
return prop + '="' + a[prop] + '"';
|
1604
1682
|
}).join(' ');
|
1605
1683
|
|
1606
|
-
|
1607
|
-
|
1608
|
-
|
1609
|
-
|
1610
|
-
|
1684
|
+
if (typeof field.type === 'function') {
|
1685
|
+
if (!field.name) {
|
1686
|
+
field.name = n;
|
1687
|
+
}
|
1688
|
+
html += field.type(field, fieldId, prefix, lg);
|
1689
|
+
} else {
|
1690
|
+
html += '<div class="' + prefix + 'input-row">' +
|
1691
|
+
'<div class="' + prefix + 'input-infos"><label for="' + fieldId + '"><span>' + (lg[l] ? lg[l] : l) + '</span></label></div>' +
|
1692
|
+
'<div class="' + prefix + 'input-html"><input id="' + fieldId + '" type="' + (field.type || 'text') + '" name="' + n + '" ' + attr;
|
1693
|
+
html += (field.type === 'checkbox' && field.value ? ' checked="checked"' : '') + ' value="' + (field.value || '').replace(/"/g, '"') + '"></div>';
|
1694
|
+
html += '</div>';
|
1695
|
+
}
|
1611
1696
|
});
|
1612
1697
|
|
1613
1698
|
return t.openModal(title, html)
|
@@ -1619,8 +1704,8 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1619
1704
|
$.each(fields, function (fieldName, field) {
|
1620
1705
|
var n = field.name || fieldName;
|
1621
1706
|
|
1622
|
-
var $field = $('input[name="' + n + '"]', $form),
|
1623
|
-
inputType = $field.
|
1707
|
+
var $field = $(':input[name="' + n + '"]', $form),
|
1708
|
+
inputType = $field[0].type;
|
1624
1709
|
|
1625
1710
|
switch (inputType.toLowerCase()) {
|
1626
1711
|
case 'checkbox':
|
@@ -1662,19 +1747,19 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1662
1747
|
addErrorOnModalField: function ($field, err) {
|
1663
1748
|
var prefix = this.o.prefix,
|
1664
1749
|
spanErrorClass = prefix + 'msg-error',
|
1665
|
-
$
|
1750
|
+
$row = $field.closest('.' + prefix + 'input-row');
|
1666
1751
|
|
1667
1752
|
$field
|
1668
1753
|
.on('change keyup', function () {
|
1669
|
-
$
|
1754
|
+
$row.removeClass(prefix + 'input-error');
|
1670
1755
|
setTimeout(function () {
|
1671
|
-
$
|
1756
|
+
$row.find('.' + spanErrorClass).remove();
|
1672
1757
|
}, 150);
|
1673
1758
|
});
|
1674
1759
|
|
1675
|
-
$
|
1760
|
+
$row
|
1676
1761
|
.addClass(prefix + 'input-error')
|
1677
|
-
.find('
|
1762
|
+
.find('.' + prefix + 'input-infos label')
|
1678
1763
|
.append(
|
1679
1764
|
$('<span/>', {
|
1680
1765
|
class: spanErrorClass,
|
@@ -1820,9 +1905,9 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1820
1905
|
|
1821
1906
|
clearButtonPaneStatus: function () {
|
1822
1907
|
var t = this,
|
1823
|
-
|
1824
|
-
|
1825
|
-
|
1908
|
+
prefix = t.o.prefix,
|
1909
|
+
activeClasses = prefix + 'active-button ' + prefix + 'active',
|
1910
|
+
originalIconClass = prefix + 'original-icon';
|
1826
1911
|
|
1827
1912
|
// Reset all buttons and dropdown state
|
1828
1913
|
$('.' + prefix + 'active-button', t.$btnPane).removeClass(activeClasses);
|
@@ -1860,12 +1945,12 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
|
1860
1945
|
if (t.o.changeActiveDropdownIcon && $btnSvgUse.length > 0) {
|
1861
1946
|
// Save original icon
|
1862
1947
|
$dropdownBtn
|
1863
|
-
|
1864
|
-
|
1948
|
+
.addClass(originalIconClass)
|
1949
|
+
.data(originalIconClass, $dropdownBtnSvgUse.attr('xlink:href'));
|
1865
1950
|
|
1866
1951
|
// Put the active sub-button's icon
|
1867
1952
|
$dropdownBtnSvgUse
|
1868
|
-
|
1953
|
+
.attr('xlink:href', $btnSvgUse.attr('xlink:href'));
|
1869
1954
|
}
|
1870
1955
|
} catch (e) {
|
1871
1956
|
}
|