activeadmin_trumbowyg 0.1.3 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (155) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +7 -0
  3. data/app/assets/fonts/active_admin-trumbowyg.svg +1 -1
  4. data/app/assets/javascripts/activeadmin/trumbowyg/langs/da.min.js +1 -1
  5. data/app/assets/javascripts/activeadmin/trumbowyg/langs/de.min.js +1 -1
  6. data/app/assets/javascripts/activeadmin/trumbowyg/langs/fa.min.js +1 -1
  7. data/app/assets/javascripts/activeadmin/trumbowyg/langs/fr.min.js +3 -1
  8. data/app/assets/javascripts/activeadmin/trumbowyg/langs/lt.min.js +8 -0
  9. data/app/assets/javascripts/activeadmin/trumbowyg/langs/sq.min.js +8 -0
  10. data/app/assets/javascripts/activeadmin/trumbowyg/langs/th.min.js +9 -0
  11. data/app/assets/javascripts/activeadmin/trumbowyg/langs/zh_tw.min.js +1 -1
  12. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/allowtagsfrompaste/trumbowyg.allowtagsfrompaste.js +143 -0
  13. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/allowtagsfrompaste/trumbowyg.allowtagsfrompaste.min.js +1 -0
  14. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/base64/trumbowyg.base64.js +21 -1
  15. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/base64/trumbowyg.base64.min.js +1 -1
  16. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/cleanpaste/trumbowyg.cleanpaste.js +23 -90
  17. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/cleanpaste/trumbowyg.cleanpaste.min.js +1 -1
  18. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/colors/trumbowyg.colors.js +24 -2
  19. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/colors/trumbowyg.colors.min.js +1 -1
  20. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/colors/ui/sass/trumbowyg.colors.scss +1 -1
  21. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/colors/ui/trumbowyg.colors.css +1 -1
  22. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/colors/ui/trumbowyg.colors.min.css +1 -1
  23. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/emoji/trumbowyg.emoji.js +1190 -876
  24. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/emoji/trumbowyg.emoji.min.js +1 -1
  25. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/emoji/ui/sass/trumbowyg.emoji.scss +1 -1
  26. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/emoji/ui/trumbowyg.emoji.css +1 -1
  27. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/emoji/ui/trumbowyg.emoji.min.css +1 -1
  28. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/fontfamily/trumbowyg.fontfamily.js +82 -0
  29. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/fontfamily/trumbowyg.fontfamily.min.js +1 -0
  30. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/fontsize/trumbowyg.fontsize.js +160 -0
  31. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/fontsize/trumbowyg.fontsize.min.js +1 -0
  32. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/highlight/trumbowyg.highlight.js +82 -0
  33. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/highlight/trumbowyg.highlight.min.js +1 -0
  34. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/highlight/ui/sass/trumbowyg.highlight.scss +25 -0
  35. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/highlight/ui/trumbowyg.highlight.css +20 -0
  36. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/highlight/ui/trumbowyg.highlight.min.css +2 -0
  37. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/history/trumbowyg.history.js +202 -0
  38. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/history/trumbowyg.history.min.js +1 -0
  39. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/insertaudio/trumbowyg.insertaudio.js +10 -1
  40. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/insertaudio/trumbowyg.insertaudio.min.js +1 -1
  41. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/lineheight/trumbowyg.lineheight.js +122 -0
  42. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/lineheight/trumbowyg.lineheight.min.js +1 -0
  43. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mathml/trumbowyg.mathml.js +98 -0
  44. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mathml/trumbowyg.mathml.min.js +1 -0
  45. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mathml/ui/sass/trumbowyg.mathml.scss +36 -0
  46. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mathml/ui/trumbowyg.mathml.css +29 -0
  47. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mathml/ui/trumbowyg.mathml.min.css +2 -0
  48. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mention/trumbowyg.mention.js +111 -0
  49. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mention/trumbowyg.mention.min.js +1 -0
  50. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mention/ui/sass/trumbowyg.mention.scss +39 -0
  51. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mention/ui/trumbowyg.mention.css +32 -0
  52. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mention/ui/trumbowyg.mention.min.css +2 -0
  53. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/noembed/trumbowyg.noembed.js +12 -2
  54. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/noembed/trumbowyg.noembed.min.js +1 -1
  55. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/pasteembed/trumbowyg.pasteembed.js +96 -0
  56. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/pasteembed/trumbowyg.pasteembed.min.js +1 -0
  57. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/pasteimage/trumbowyg.pasteimage.js +1 -1
  58. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/pasteimage/trumbowyg.pasteimage.min.js +1 -1
  59. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/preformatted/trumbowyg.preformatted.js +16 -3
  60. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/preformatted/trumbowyg.preformatted.min.js +1 -1
  61. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/resizimg/trumbowyg.resizimg.js +69 -0
  62. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/resizimg/trumbowyg.resizimg.min.js +1 -0
  63. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/ruby/trumbowyg.ruby.js +82 -0
  64. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/ruby/trumbowyg.ruby.min.js +1 -0
  65. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/table/trumbowyg.table.js +236 -86
  66. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/table/trumbowyg.table.min.js +1 -1
  67. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/table/ui/sass/trumbowyg.table.scss +42 -0
  68. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/table/ui/trumbowyg.table.css +33 -0
  69. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/table/ui/trumbowyg.table.min.css +2 -0
  70. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/template/trumbowyg.template.js +19 -7
  71. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/template/trumbowyg.template.min.js +1 -1
  72. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/upload/trumbowyg.upload.js +44 -20
  73. data/app/assets/javascripts/activeadmin/trumbowyg/plugins/upload/trumbowyg.upload.min.js +1 -1
  74. data/app/assets/javascripts/activeadmin/trumbowyg/trumbowyg.js +215 -78
  75. data/app/assets/javascripts/activeadmin/trumbowyg/trumbowyg.min.js +2 -2
  76. data/app/assets/javascripts/activeadmin/trumbowyg/ui/icons.svg +1 -1
  77. data/app/assets/javascripts/activeadmin/trumbowyg/ui/sass/trumbowyg.scss +25 -12
  78. data/app/assets/javascripts/activeadmin/trumbowyg/ui/trumbowyg.css +23 -20
  79. data/app/assets/javascripts/activeadmin/trumbowyg/ui/trumbowyg.min.css +2 -2
  80. data/app/assets/stylesheets/activeadmin/_trumbowyg_input.sass +5 -3
  81. data/app/assets/stylesheets/activeadmin/trumbowyg/ui/icons.svg +1 -1
  82. data/app/assets/stylesheets/activeadmin/trumbowyg/ui/sass/trumbowyg.scss +25 -12
  83. data/app/assets/stylesheets/activeadmin/trumbowyg/ui/trumbowyg.css +23 -20
  84. data/app/assets/stylesheets/activeadmin/trumbowyg/ui/trumbowyg.min.css +2 -2
  85. data/lib/activeadmin/trumbowyg/version.rb +1 -1
  86. metadata +40 -72
  87. data/app/assets/stylesheets/activeadmin/trumbowyg/langs/ar.min.js +0 -11
  88. data/app/assets/stylesheets/activeadmin/trumbowyg/langs/bg.min.js +0 -8
  89. data/app/assets/stylesheets/activeadmin/trumbowyg/langs/by.min.js +0 -8
  90. data/app/assets/stylesheets/activeadmin/trumbowyg/langs/ca.min.js +0 -11
  91. data/app/assets/stylesheets/activeadmin/trumbowyg/langs/cs.min.js +0 -8
  92. data/app/assets/stylesheets/activeadmin/trumbowyg/langs/da.min.js +0 -9
  93. data/app/assets/stylesheets/activeadmin/trumbowyg/langs/de.min.js +0 -9
  94. data/app/assets/stylesheets/activeadmin/trumbowyg/langs/el.min.js +0 -12
  95. data/app/assets/stylesheets/activeadmin/trumbowyg/langs/es.min.js +0 -9
  96. data/app/assets/stylesheets/activeadmin/trumbowyg/langs/es_ar.min.js +0 -10
  97. data/app/assets/stylesheets/activeadmin/trumbowyg/langs/fa.min.js +0 -10
  98. data/app/assets/stylesheets/activeadmin/trumbowyg/langs/fi.min.js +0 -9
  99. data/app/assets/stylesheets/activeadmin/trumbowyg/langs/fr.min.js +0 -10
  100. data/app/assets/stylesheets/activeadmin/trumbowyg/langs/he.min.js +0 -9
  101. data/app/assets/stylesheets/activeadmin/trumbowyg/langs/hr.min.js +0 -9
  102. data/app/assets/stylesheets/activeadmin/trumbowyg/langs/hu.min.js +0 -10
  103. data/app/assets/stylesheets/activeadmin/trumbowyg/langs/id.min.js +0 -11
  104. data/app/assets/stylesheets/activeadmin/trumbowyg/langs/it.min.js +0 -8
  105. data/app/assets/stylesheets/activeadmin/trumbowyg/langs/ja.min.js +0 -10
  106. data/app/assets/stylesheets/activeadmin/trumbowyg/langs/ko.min.js +0 -10
  107. data/app/assets/stylesheets/activeadmin/trumbowyg/langs/mn.min.js +0 -8
  108. data/app/assets/stylesheets/activeadmin/trumbowyg/langs/my.min.js +0 -8
  109. data/app/assets/stylesheets/activeadmin/trumbowyg/langs/nl.min.js +0 -9
  110. data/app/assets/stylesheets/activeadmin/trumbowyg/langs/no_nb.min.js +0 -10
  111. data/app/assets/stylesheets/activeadmin/trumbowyg/langs/ph.min.js +0 -8
  112. data/app/assets/stylesheets/activeadmin/trumbowyg/langs/pl.min.js +0 -9
  113. data/app/assets/stylesheets/activeadmin/trumbowyg/langs/pt.min.js +0 -11
  114. data/app/assets/stylesheets/activeadmin/trumbowyg/langs/pt_br.min.js +0 -11
  115. data/app/assets/stylesheets/activeadmin/trumbowyg/langs/ro.min.js +0 -12
  116. data/app/assets/stylesheets/activeadmin/trumbowyg/langs/rs.min.js +0 -8
  117. data/app/assets/stylesheets/activeadmin/trumbowyg/langs/rs_latin.min.js +0 -9
  118. data/app/assets/stylesheets/activeadmin/trumbowyg/langs/ru.min.js +0 -8
  119. data/app/assets/stylesheets/activeadmin/trumbowyg/langs/sk.min.js +0 -8
  120. data/app/assets/stylesheets/activeadmin/trumbowyg/langs/sv.min.js +0 -12
  121. data/app/assets/stylesheets/activeadmin/trumbowyg/langs/tr.min.js +0 -9
  122. data/app/assets/stylesheets/activeadmin/trumbowyg/langs/ua.min.js +0 -8
  123. data/app/assets/stylesheets/activeadmin/trumbowyg/langs/vi.min.js +0 -9
  124. data/app/assets/stylesheets/activeadmin/trumbowyg/langs/zh_cn.min.js +0 -11
  125. data/app/assets/stylesheets/activeadmin/trumbowyg/langs/zh_tw.min.js +0 -11
  126. data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/base64/trumbowyg.base64.js +0 -121
  127. data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/base64/trumbowyg.base64.min.js +0 -1
  128. data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/cleanpaste/trumbowyg.cleanpaste.js +0 -179
  129. data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/cleanpaste/trumbowyg.cleanpaste.min.js +0 -1
  130. data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/colors/trumbowyg.colors.js +0 -176
  131. data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/colors/trumbowyg.colors.min.js +0 -1
  132. data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/colors/ui/sass/trumbowyg.colors.scss +0 -49
  133. data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/colors/ui/trumbowyg.colors.css +0 -43
  134. data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/colors/ui/trumbowyg.colors.min.css +0 -2
  135. data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/emoji/trumbowyg.emoji.js +0 -965
  136. data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/emoji/trumbowyg.emoji.min.js +0 -1
  137. data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/emoji/ui/sass/trumbowyg.emoji.scss +0 -56
  138. data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/emoji/ui/trumbowyg.emoji.css +0 -47
  139. data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/emoji/ui/trumbowyg.emoji.min.css +0 -2
  140. data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/insertaudio/trumbowyg.insertaudio.js +0 -83
  141. data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/insertaudio/trumbowyg.insertaudio.min.js +0 -1
  142. data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/noembed/trumbowyg.noembed.js +0 -101
  143. data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/noembed/trumbowyg.noembed.min.js +0 -1
  144. data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/pasteimage/trumbowyg.pasteimage.js +0 -41
  145. data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/pasteimage/trumbowyg.pasteimage.min.js +0 -1
  146. data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/preformatted/trumbowyg.preformatted.js +0 -123
  147. data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/preformatted/trumbowyg.preformatted.min.js +0 -1
  148. data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/table/trumbowyg.table.js +0 -154
  149. data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/table/trumbowyg.table.min.js +0 -1
  150. data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/template/trumbowyg.template.js +0 -58
  151. data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/template/trumbowyg.template.min.js +0 -1
  152. data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/upload/trumbowyg.upload.js +0 -242
  153. data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/upload/trumbowyg.upload.min.js +0 -1
  154. data/app/assets/stylesheets/activeadmin/trumbowyg/trumbowyg.js +0 -1688
  155. data/app/assets/stylesheets/activeadmin/trumbowyg/trumbowyg.min.js +0 -2
@@ -1,154 +1,304 @@
1
1
  /* ===========================================================
2
- * trumbowyg.table.js v1.2
2
+ * trumbowyg.table.custom.js v2.0
3
3
  * Table plugin for Trumbowyg
4
4
  * http://alex-d.github.com/Trumbowyg
5
5
  * ===========================================================
6
- * Author : Lawrence Meckan
7
- * Twitter : @absalomedia
8
- * Website : absalom.biz
6
+ * Author : Sven Dunemann [dunemann@forelabs.eu]
9
7
  */
10
8
 
11
9
  (function ($) {
12
10
  'use strict';
13
11
 
14
12
  var defaultOptions = {
15
- rows: 0,
16
- columns: 0,
17
- styler: ''
13
+ rows: 8,
14
+ columns: 8,
15
+ styler: 'table'
18
16
  };
19
17
 
20
18
  $.extend(true, $.trumbowyg, {
21
19
  langs: {
22
20
  en: {
23
21
  table: 'Insert table',
24
- tableAddRow: 'Add rows',
25
- tableAddColumn: 'Add columns',
26
- rows: 'Rows',
27
- columns: 'Columns',
28
- styler: 'Table class',
22
+ tableAddRow: 'Add row',
23
+ tableAddColumn: 'Add column',
24
+ tableDeleteRow: 'Delete row',
25
+ tableDeleteColumn: 'Delete column',
26
+ tableDestroy: 'Delete table',
29
27
  error: 'Error'
30
28
  },
29
+ da: {
30
+ table: 'Indsæt tabel',
31
+ tableAddRow: 'Tilføj række',
32
+ tableAddColumn: 'Tilføj kolonne',
33
+ tableDeleteRow: 'Slet række',
34
+ tableDeleteColumn: 'Slet kolonne',
35
+ tableDestroy: 'Slet tabel',
36
+ error: 'Fejl'
37
+ },
38
+ de: {
39
+ table: 'Tabelle einfügen',
40
+ tableAddRow: 'Zeile hinzufügen',
41
+ tableAddColumn: 'Spalte hinzufügen',
42
+ tableDeleteRow: 'Zeile löschen',
43
+ tableDeleteColumn: 'Spalte löschen',
44
+ tableDestroy: 'Tabelle löschen',
45
+ error: 'Error'
46
+ },
31
47
  sk: {
32
48
  table: 'Vytvoriť tabuľky',
33
49
  tableAddRow: 'Pridať riadok',
34
50
  tableAddColumn: 'Pridať stĺpec',
35
- rows: 'Riadky',
36
- columns: 'Stĺpce',
37
- styler: 'Tabuľku triedy',
38
51
  error: 'Chyba'
39
52
  },
40
53
  fr: {
41
54
  table: 'Insérer un tableau',
42
55
  tableAddRow: 'Ajouter des lignes',
43
56
  tableAddColumn: 'Ajouter des colonnes',
44
- rows: 'Lignes',
45
- columns: 'Colonnes',
46
- styler: 'Classes CSS sur la table',
47
57
  error: 'Erreur'
48
58
  },
49
59
  cs: {
50
60
  table: 'Vytvořit příkaz Table',
51
61
  tableAddRow: 'Přidat řádek',
52
62
  tableAddColumn: 'Přidat sloupec',
53
- rows: 'Řádky',
54
- columns: 'Sloupce',
55
- styler: 'Tabulku třída',
56
63
  error: 'Chyba'
57
64
  },
58
65
  ru: {
59
66
  table: 'Вставить таблицу',
60
- tableAddRow: 'Добавить строки',
61
- tableAddColumn: 'Добавить столбцы',
62
- rows: 'Строки',
63
- columns: 'Столбцы',
64
- styler: 'Имя CSS класса для таблицы',
67
+ tableAddRow: 'Добавить строку',
68
+ tableAddColumn: 'Добавить столбец',
69
+ tableDeleteRow: 'Удалить строку',
70
+ tableDeleteColumn: 'Удалить столбец',
71
+ tableDestroy: 'Удалить таблицу',
65
72
  error: 'Ошибка'
66
73
  },
67
74
  ja: {
68
75
  table: '表の挿入',
69
76
  tableAddRow: '行の追加',
70
77
  tableAddColumn: '列の追加',
71
- rows: '行',
72
- columns: '列',
73
- styler: '表のクラス',
74
78
  error: 'エラー'
75
- }
79
+ },
80
+ tr: {
81
+ table: 'Tablo ekle',
82
+ tableAddRow: 'Satır ekle',
83
+ tableAddColumn: 'Kolon ekle',
84
+ error: 'Hata'
85
+ },
86
+ zh_tw: {
87
+ table: '插入表格',
88
+ tableAddRow: '加入行',
89
+ tableAddColumn: '加入列',
90
+ tableDeleteRow: '刪除行',
91
+ tableDeleteColumn: '刪除列',
92
+ tableDestroy: '刪除表格',
93
+ error: '錯誤'
94
+ },
76
95
  },
77
96
 
78
97
  plugins: {
79
98
  table: {
80
- init: function (trumbowyg) {
81
- trumbowyg.o.plugins.table = $.extend(true, {}, defaultOptions, trumbowyg.o.plugins.table || {});
99
+ init: function (t) {
100
+ t.o.plugins.table = $.extend(true, {}, defaultOptions, t.o.plugins.table || {});
82
101
 
83
- var tableBuild = {
102
+ var buildButtonDef = {
84
103
  fn: function () {
85
- trumbowyg.saveRange();
86
- trumbowyg.openModalInsert(
87
- // Title
88
- trumbowyg.lang.table,
89
-
90
- // Fields
91
- {
92
- rows: {
93
- type: 'number',
94
- required: true
95
- },
96
- columns: {
97
- type: 'number',
98
- required: true
99
- },
100
- styler: {
101
- label: trumbowyg.lang.styler,
102
- type: 'text'
103
- }
104
- },
105
- function (v) { // v is value
106
- var tabler = $('<table></table>');
107
- if (v.styler.length !== 0) {
108
- tabler.addClass(v.styler);
109
- }
110
-
111
- for (var i = 0; i < v.rows; i += 1) {
112
- var row = $('<tr></tr>').appendTo(tabler);
113
- for (var j = 0; j < v.columns; j += 1) {
114
- $('<td></td>').appendTo(row);
115
- }
116
- }
117
-
118
- trumbowyg.range.deleteContents();
119
- trumbowyg.range.insertNode(tabler[0]);
120
- return true;
121
- });
104
+ t.saveRange();
105
+
106
+ var btnName = 'table';
107
+
108
+ var dropdownPrefix = t.o.prefix + 'dropdown',
109
+ dropdownOptions = { // the dropdown
110
+ class: dropdownPrefix + '-' + btnName + ' ' + dropdownPrefix + ' ' + t.o.prefix + 'fixed-top'
111
+ };
112
+ dropdownOptions['data-' + dropdownPrefix] = btnName;
113
+ var $dropdown = $('<div/>', dropdownOptions);
114
+
115
+ if (t.$box.find("." + dropdownPrefix + "-" + btnName).length === 0) {
116
+ t.$box.append($dropdown.hide());
117
+ } else {
118
+ $dropdown = t.$box.find("." + dropdownPrefix + "-" + btnName);
119
+ }
120
+
121
+ // clear dropdown
122
+ $dropdown.html('');
123
+
124
+ // when active table show AddRow / AddColumn
125
+ if (t.$box.find("." + t.o.prefix + "table-button").hasClass(t.o.prefix + 'active-button')) {
126
+ $dropdown.append(t.buildSubBtn('tableAddRow'));
127
+ $dropdown.append(t.buildSubBtn('tableAddColumn'));
128
+ $dropdown.append(t.buildSubBtn('tableDeleteRow'));
129
+ $dropdown.append(t.buildSubBtn('tableDeleteColumn'));
130
+ $dropdown.append(t.buildSubBtn('tableDestroy'));
131
+ } else {
132
+ var tableSelect = $('<table></table>');
133
+ for (var i = 0; i < t.o.plugins.table.rows; i += 1) {
134
+ var row = $('<tr></tr>').appendTo(tableSelect);
135
+ for (var j = 0; j < t.o.plugins.table.columns; j += 1) {
136
+ $('<td></td>').appendTo(row);
137
+ }
138
+ }
139
+ tableSelect.find('td').on('mouseover', tableAnimate);
140
+ tableSelect.find('td').on('mousedown', tableBuild);
141
+
142
+ $dropdown.append(tableSelect);
143
+ $dropdown.append($('<center>1x1</center>'));
144
+ }
145
+
146
+ t.dropdown(btnName);
122
147
  }
123
148
  };
124
149
 
150
+ var tableAnimate = function(column_event) {
151
+ var column = $(column_event.target),
152
+ table = column.parents('table'),
153
+ colIndex = this.cellIndex,
154
+ rowIndex = this.parentNode.rowIndex;
155
+
156
+ // reset all columns
157
+ table.find('td').removeClass('active');
158
+
159
+ for (var i = 0; i <= rowIndex; i += 1) {
160
+ for (var j = 0; j <= colIndex; j += 1) {
161
+ table.find("tr:nth-of-type("+(i+1)+")").find("td:nth-of-type("+(j+1)+")").addClass('active');
162
+ }
163
+ }
164
+
165
+ // set label
166
+ table.next('center').html((colIndex+1) + "x" + (rowIndex+1));
167
+ };
168
+
169
+ var tableBuild = function(column_event) {
170
+ t.saveRange();
171
+
172
+ var tabler = $('<table></table>');
173
+ if (t.o.plugins.table.styler) {
174
+ tabler.attr('class', t.o.plugins.table.styler);
175
+ }
176
+
177
+ var column = $(column_event.target),
178
+ colIndex = this.cellIndex,
179
+ rowIndex = this.parentNode.rowIndex;
180
+
181
+ for (var i = 0; i <= rowIndex; i += 1) {
182
+ var row = $('<tr></tr>').appendTo(tabler);
183
+ for (var j = 0; j <= colIndex; j += 1) {
184
+ $('<td></td>').appendTo(row);
185
+ }
186
+ }
187
+
188
+ t.range.deleteContents();
189
+ t.range.insertNode(tabler[0]);
190
+ t.$c.trigger('tbwchange');
191
+ };
192
+
125
193
  var addRow = {
126
- fn: function () {
127
- trumbowyg.saveRange();
128
- var rower = $('<tr></tr>');
129
- trumbowyg.range.deleteContents();
130
- trumbowyg.range.insertNode(rower[0]);
131
- return true;
194
+ title: t.lang['tableAddRow'],
195
+ text: t.lang['tableAddRow'],
196
+ ico: 'row-below',
197
+
198
+ fn: function () {
199
+ t.saveRange();
132
200
 
201
+ var node = t.doc.getSelection().focusNode;
202
+ var table = $(node).closest('table');
203
+
204
+ if(table.length > 0) {
205
+ var row = $('<tr></tr>');
206
+ // add columns according to current columns count
207
+ for (var i = 0; i < table.find('tr')[0].childElementCount; i += 1) {
208
+ $('<td></td>').appendTo(row);
209
+ }
210
+ // add row to table
211
+ row.appendTo(table);
133
212
  }
213
+
214
+ return true;
215
+ }
134
216
  };
135
217
 
136
218
  var addColumn = {
137
- fn: function () {
138
- trumbowyg.saveRange();
139
- var columner = $('<td></td>');
140
- trumbowyg.range.deleteContents();
141
- trumbowyg.range.insertNode(columner[0]);
142
- return true;
219
+ title: t.lang['tableAddColumn'],
220
+ text: t.lang['tableAddColumn'],
221
+ ico: 'col-right',
222
+
223
+ fn: function () {
224
+ t.saveRange();
225
+
226
+ var node = t.doc.getSelection().focusNode;
227
+ var table = $(node).closest('table');
143
228
 
229
+ if(table.length > 0) {
230
+ $(table).find('tr').each(function() {
231
+ $(this).find('td:last').after('<td></td>');
232
+ });
144
233
  }
234
+
235
+ return true;
236
+ }
237
+ };
238
+
239
+ var destroy = {
240
+ title: t.lang['tableDestroy'],
241
+ text: t.lang['tableDestroy'],
242
+ ico: 'table-delete',
243
+
244
+ fn: function () {
245
+ t.saveRange();
246
+
247
+ var node = t.doc.getSelection().focusNode,
248
+ table = $(node).closest('table');
249
+
250
+ table.remove();
251
+
252
+ return true;
253
+ }
254
+ };
255
+
256
+ var deleteRow = {
257
+ title: t.lang['tableDeleteRow'],
258
+ text: t.lang['tableDeleteRow'],
259
+ ico: 'row-delete',
260
+
261
+ fn: function () {
262
+ t.saveRange();
263
+
264
+ var node = t.doc.getSelection().focusNode,
265
+ row = $(node).closest('tr');
266
+
267
+ row.remove();
268
+
269
+ return true;
270
+ }
271
+ };
272
+
273
+ var deleteColumn = {
274
+ title: t.lang['tableDeleteColumn'],
275
+ text: t.lang['tableDeleteColumn'],
276
+ ico: 'col-delete',
277
+
278
+ fn: function () {
279
+ t.saveRange();
280
+
281
+ var node = t.doc.getSelection().focusNode,
282
+ table = $(node).closest('table'),
283
+ td = $(node).closest('td'),
284
+ cellIndex = td.index();
285
+
286
+ $(table).find('tr').each(function() {
287
+ $(this).find('td:eq('+cellIndex+')').remove();
288
+ });
289
+
290
+ return true;
291
+ }
145
292
  };
146
293
 
147
- trumbowyg.addBtnDef('table', tableBuild);
148
- trumbowyg.addBtnDef('tableAddRow', addRow);
149
- trumbowyg.addBtnDef('tableAddColumn', addColumn);
294
+ t.addBtnDef('table', buildButtonDef);
295
+ t.addBtnDef('tableAddRow', addRow);
296
+ t.addBtnDef('tableAddColumn', addColumn);
297
+ t.addBtnDef('tableDeleteRow', deleteRow);
298
+ t.addBtnDef('tableDeleteColumn', deleteColumn);
299
+ t.addBtnDef('tableDestroy', destroy);
150
300
  }
151
301
  }
152
302
  }
153
303
  });
154
- })(jQuery);
304
+ })(jQuery);
@@ -1 +1 @@
1
- !function(e){"use strict";var t={rows:0,columns:0,styler:""};e.extend(!0,e.trumbowyg,{langs:{en:{table:"Insert table",tableAddRow:"Add rows",tableAddColumn:"Add columns",rows:"Rows",columns:"Columns",styler:"Table class",error:"Error"},sk:{table:"Vytvoriť tabuľky",tableAddRow:"Pridať riadok",tableAddColumn:"Pridať stĺpec",rows:"Riadky",columns:"Stĺpce",styler:"Tabuľku triedy",error:"Chyba"},fr:{table:"Insérer un tableau",tableAddRow:"Ajouter des lignes",tableAddColumn:"Ajouter des colonnes",rows:"Lignes",columns:"Colonnes",styler:"Classes CSS sur la table",error:"Erreur"},cs:{table:"Vytvořit příkaz Table",tableAddRow:"Přidat řádek",tableAddColumn:"Přidat sloupec",rows:"Řádky",columns:"Sloupce",styler:"Tabulku třída",error:"Chyba"},ru:{table:"Вставить таблицу",tableAddRow:"Добавить строки",tableAddColumn:"Добавить столбцы",rows:"Строки",columns:"Столбцы",styler:"Имя CSS класса для таблицы",error:"Ошибка"},ja:{table:"表の挿入",tableAddRow:"行の追加",tableAddColumn:"列の追加",rows:"",columns:"",styler:"表のクラス",error:"エラー"}},plugins:{table:{init:function(r){r.o.plugins.table=e.extend(!0,{},t,r.o.plugins.table||{});var l={fn:function(){r.saveRange(),r.openModalInsert(r.lang.table,{rows:{type:"number",required:!0},columns:{type:"number",required:!0},styler:{label:r.lang.styler,type:"text"}},function(t){var l=e("<table></table>");0!==t.styler.length&&l.addClass(t.styler);for(var n=0;n<t.rows;n+=1)for(var a=e("<tr></tr>").appendTo(l),o=0;o<t.columns;o+=1)e("<td></td>").appendTo(a);return r.range.deleteContents(),r.range.insertNode(l[0]),!0})}},n={fn:function(){r.saveRange();var t=e("<tr></tr>");return r.range.deleteContents(),r.range.insertNode(t[0]),!0}},a={fn:function(){r.saveRange();var t=e("<td></td>");return r.range.deleteContents(),r.range.insertNode(t[0]),!0}};r.addBtnDef("table",l),r.addBtnDef("tableAddRow",n),r.addBtnDef("tableAddColumn",a)}}}})}(jQuery);
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 a={fn:function(){l.saveRange();var t="table",a=l.o.prefix+"dropdown",d={"class":a+"-"+t+" "+a+" "+l.o.prefix+"fixed-top"};d["data-"+a]=t;var r=e("<div/>",d);if(0===l.$box.find("."+a+"-"+t).length?l.$box.append(r.hide()):r=l.$box.find("."+a+"-"+t),r.html(""),l.$box.find("."+l.o.prefix+"table-button").hasClass(l.o.prefix+"active-button"))r.append(l.buildSubBtn("tableAddRow")),r.append(l.buildSubBtn("tableAddColumn")),r.append(l.buildSubBtn("tableDeleteRow")),r.append(l.buildSubBtn("tableDeleteColumn")),r.append(l.buildSubBtn("tableDestroy"));else{for(var b=e("<table></table>"),i=0;i<l.o.plugins.table.rows;i+=1)for(var s=e("<tr></tr>").appendTo(b),u=0;u<l.o.plugins.table.columns;u+=1)e("<td></td>").appendTo(s);b.find("td").on("mouseover",o),b.find("td").on("mousedown",n),r.append(b),r.append(e("<center>1x1</center>"))}l.dropdown(t)}},o=function(t){var l=e(t.target),a=l.parents("table"),o=this.cellIndex,n=this.parentNode.rowIndex;a.find("td").removeClass("active");for(var d=0;d<=n;d+=1)for(var r=0;r<=o;r+=1)a.find("tr:nth-of-type("+(d+1)+")").find("td:nth-of-type("+(r+1)+")").addClass("active");a.next("center").html(o+1+"x"+(n+1))},n=function(t){l.saveRange();var a=e("<table></table>");l.o.plugins.table.styler&&a.attr("class",l.o.plugins.table.styler);for(var o=(e(t.target),this.cellIndex),n=this.parentNode.rowIndex,d=0;d<=n;d+=1)for(var r=e("<tr></tr>").appendTo(a),b=0;b<=o;b+=1)e("<td></td>").appendTo(r);l.range.deleteContents(),l.range.insertNode(a[0]),l.$c.trigger("tbwchange")},d={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("table");if(a.length>0){for(var o=e("<tr></tr>"),n=0;n<a.find("tr")[0].childElementCount;n+=1)e("<td></td>").appendTo(o);o.appendTo(a)}return!0}},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("table");return a.length>0&&e(a).find("tr").each(function(){e(this).find("td:last").after("<td></td>")}),!0}},b={title:l.lang.tableDestroy,text:l.lang.tableDestroy,ico:"table-delete",fn:function(){l.saveRange();var t=l.doc.getSelection().focusNode,a=e(t).closest("table");return a.remove(),!0}},i={title:l.lang.tableDeleteRow,text:l.lang.tableDeleteRow,ico:"row-delete",fn:function(){l.saveRange();var t=l.doc.getSelection().focusNode,a=e(t).closest("tr");return a.remove(),!0}},s={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"),n=o.index();return e(a).find("tr").each(function(){e(this).find("td:eq("+n+")").remove()}),!0}};l.addBtnDef("table",a),l.addBtnDef("tableAddRow",d),l.addBtnDef("tableAddColumn",r),l.addBtnDef("tableDeleteRow",i),l.addBtnDef("tableDeleteColumn",s),l.addBtnDef("tableDestroy",b)}}}})}(jQuery);
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Trumbowyg v2.11.1 - A lightweight WYSIWYG editor
3
+ * Default stylesheet for Trumbowyg editor plugin
4
+ * ------------------------
5
+ * @link http://alex-d.github.io/Trumbowyg
6
+ * @license MIT
7
+ * @author Alexandre Demode (Alex-D)
8
+ * Twitter : @AlexandreDemode
9
+ * Website : alex-d.fr
10
+ */
11
+
12
+ .trumbowyg-editor table {
13
+ width: 100%;
14
+
15
+ td {
16
+ border: 1px dotted #e7eaec;
17
+ padding: 8px;
18
+ }
19
+ }
20
+
21
+ .trumbowyg-dropdown-table {
22
+ table {
23
+ margin: 10px;
24
+ display: inline-block;
25
+ }
26
+
27
+ table td {
28
+ display: inline-block;
29
+ height: 20px;
30
+ width: 20px;
31
+ margin: 1px;
32
+ padding: 0;
33
+ background-color: #fff;
34
+ box-shadow: 0 0 0 1px #cecece inset;
35
+
36
+ &.active {
37
+ background-color: #00b393;
38
+ box-shadow: none;
39
+ cursor: pointer;
40
+ }
41
+ }
42
+ }
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Trumbowyg v2.11.1 - A lightweight WYSIWYG editor
3
+ * Trumbowyg plugin stylesheet
4
+ * ------------------------
5
+ * @link http://alex-d.github.io/Trumbowyg
6
+ * @license MIT
7
+ * @author Alexandre Demode (Alex-D)
8
+ * Twitter : @AlexandreDemode
9
+ * Website : alex-d.fr
10
+ */
11
+
12
+ .trumbowyg-editor table {
13
+ width: 100%; }
14
+ .trumbowyg-editor table td {
15
+ border: 1px dotted #e7eaec;
16
+ padding: 8px; }
17
+
18
+ .trumbowyg-dropdown-table table {
19
+ margin: 10px;
20
+ display: inline-block; }
21
+
22
+ .trumbowyg-dropdown-table table td {
23
+ display: inline-block;
24
+ height: 20px;
25
+ width: 20px;
26
+ margin: 1px;
27
+ padding: 0;
28
+ background-color: #fff;
29
+ box-shadow: 0 0 0 1px #cecece inset; }
30
+ .trumbowyg-dropdown-table table td.active {
31
+ background-color: #00b393;
32
+ box-shadow: none;
33
+ cursor: pointer; }
@@ -0,0 +1,2 @@
1
+ /** Trumbowyg v2.11.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;box-shadow:0 0 0 1px #cecece inset}.trumbowyg-dropdown-table table td.active{background-color:#00b393;box-shadow:none;cursor:pointer}
@@ -1,4 +1,4 @@
1
- (function($) {
1
+ (function ($) {
2
2
  'use strict';
3
3
 
4
4
  // Adds the language variables
@@ -7,6 +7,12 @@
7
7
  en: {
8
8
  template: 'Template'
9
9
  },
10
+ da: {
11
+ template: 'Skabelon'
12
+ },
13
+ fr: {
14
+ template: 'Patron'
15
+ },
10
16
  nl: {
11
17
  template: 'Sjabloon'
12
18
  },
@@ -15,7 +21,13 @@
15
21
  },
16
22
  ja: {
17
23
  template: 'テンプレート'
18
- }
24
+ },
25
+ tr: {
26
+ template: 'Şablon'
27
+ },
28
+ zh_tw: {
29
+ template: '模板',
30
+ },
19
31
  }
20
32
  });
21
33
 
@@ -23,10 +35,10 @@
23
35
  $.extend(true, $.trumbowyg, {
24
36
  plugins: {
25
37
  template: {
26
- shouldInit: function(trumbowyg) {
38
+ shouldInit: function (trumbowyg) {
27
39
  return trumbowyg.o.plugins.hasOwnProperty('templates');
28
40
  },
29
- init: function(trumbowyg) {
41
+ init: function (trumbowyg) {
30
42
  trumbowyg.addBtnDef('template', {
31
43
  dropdown: templateSelector(trumbowyg),
32
44
  hasIcon: false,
@@ -42,9 +54,9 @@
42
54
  var available = trumbowyg.o.plugins.templates;
43
55
  var templates = [];
44
56
 
45
- $.each(available, function(index, template) {
57
+ $.each(available, function (index, template) {
46
58
  trumbowyg.addBtnDef('template_' + index, {
47
- fn: function(){
59
+ fn: function () {
48
60
  trumbowyg.html(template.html);
49
61
  },
50
62
  hasIcon: false,
@@ -55,4 +67,4 @@
55
67
 
56
68
  return templates;
57
69
  }
58
- })(jQuery);
70
+ })(jQuery);
@@ -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"},nl:{template:"Sjabloon"},ru:{template:"Шаблон"},ja:{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);
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"},ru:{template:"Шаблон"},ja:{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);