activeadmin_trumbowyg 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +3 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +20 -0
- data/README.md +60 -0
- data/Rakefile +3 -0
- data/activeadmin_trumbowyg.gemspec +19 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/ar.min.js +11 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/bg.min.js +8 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/by.min.js +8 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/ca.min.js +11 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/cs.min.js +8 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/da.min.js +9 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/de.min.js +9 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/el.min.js +12 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/es.min.js +9 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/es_ar.min.js +10 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/fa.min.js +10 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/fi.min.js +9 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/fr.min.js +10 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/he.min.js +9 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/hr.min.js +9 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/hu.min.js +10 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/id.min.js +11 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/it.min.js +8 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/ja.min.js +10 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/ko.min.js +10 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/mn.min.js +8 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/my.min.js +8 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/nl.min.js +9 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/no_nb.min.js +10 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/ph.min.js +8 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/pl.min.js +9 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/pt.min.js +11 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/pt_br.min.js +11 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/ro.min.js +12 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/rs.min.js +8 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/rs_latin.min.js +9 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/ru.min.js +8 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/sk.min.js +8 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/sv.min.js +12 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/tr.min.js +9 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/ua.min.js +8 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/vi.min.js +9 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/zh_cn.min.js +11 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/zh_tw.min.js +11 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/base64/trumbowyg.base64.js +121 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/base64/trumbowyg.base64.min.js +1 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/cleanpaste/trumbowyg.cleanpaste.js +179 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/cleanpaste/trumbowyg.cleanpaste.min.js +1 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/colors/trumbowyg.colors.js +176 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/colors/trumbowyg.colors.min.js +1 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/colors/ui/sass/trumbowyg.colors.scss +49 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/colors/ui/trumbowyg.colors.css +43 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/colors/ui/trumbowyg.colors.min.css +2 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/emoji/trumbowyg.emoji.js +965 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/emoji/trumbowyg.emoji.min.js +1 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/emoji/ui/sass/trumbowyg.emoji.scss +56 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/emoji/ui/trumbowyg.emoji.css +47 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/emoji/ui/trumbowyg.emoji.min.css +2 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/insertaudio/trumbowyg.insertaudio.js +83 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/insertaudio/trumbowyg.insertaudio.min.js +1 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/noembed/trumbowyg.noembed.js +101 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/noembed/trumbowyg.noembed.min.js +1 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/pasteimage/trumbowyg.pasteimage.js +41 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/pasteimage/trumbowyg.pasteimage.min.js +1 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/preformatted/trumbowyg.preformatted.js +123 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/preformatted/trumbowyg.preformatted.min.js +1 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/table/trumbowyg.table.js +154 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/table/trumbowyg.table.min.js +1 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/template/trumbowyg.template.js +58 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/template/trumbowyg.template.min.js +1 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/upload/trumbowyg.upload.js +242 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/upload/trumbowyg.upload.min.js +1 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/trumbowyg.js +1688 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/trumbowyg.min.js +2 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/ui/icons.svg +1 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/ui/sass/trumbowyg.scss +796 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/ui/trumbowyg.css +584 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/ui/trumbowyg.min.css +2 -0
- data/app/assets/javascripts/activeadmin/trumbowyg_input.js +7 -0
- data/app/assets/stylesheets/activeadmin/_trumbowyg_input.sass +48 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/ar.min.js +11 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/bg.min.js +8 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/by.min.js +8 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/ca.min.js +11 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/cs.min.js +8 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/da.min.js +9 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/de.min.js +9 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/el.min.js +12 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/es.min.js +9 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/es_ar.min.js +10 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/fa.min.js +10 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/fi.min.js +9 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/fr.min.js +10 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/he.min.js +9 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/hr.min.js +9 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/hu.min.js +10 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/id.min.js +11 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/it.min.js +8 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/ja.min.js +10 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/ko.min.js +10 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/mn.min.js +8 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/my.min.js +8 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/nl.min.js +9 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/no_nb.min.js +10 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/ph.min.js +8 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/pl.min.js +9 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/pt.min.js +11 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/pt_br.min.js +11 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/ro.min.js +12 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/rs.min.js +8 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/rs_latin.min.js +9 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/ru.min.js +8 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/sk.min.js +8 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/sv.min.js +12 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/tr.min.js +9 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/ua.min.js +8 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/vi.min.js +9 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/zh_cn.min.js +11 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/zh_tw.min.js +11 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/base64/trumbowyg.base64.js +121 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/base64/trumbowyg.base64.min.js +1 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/cleanpaste/trumbowyg.cleanpaste.js +179 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/cleanpaste/trumbowyg.cleanpaste.min.js +1 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/colors/trumbowyg.colors.js +176 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/colors/trumbowyg.colors.min.js +1 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/colors/ui/sass/trumbowyg.colors.scss +49 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/colors/ui/trumbowyg.colors.css +43 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/colors/ui/trumbowyg.colors.min.css +2 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/emoji/trumbowyg.emoji.js +965 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/emoji/trumbowyg.emoji.min.js +1 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/emoji/ui/sass/trumbowyg.emoji.scss +56 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/emoji/ui/trumbowyg.emoji.css +47 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/emoji/ui/trumbowyg.emoji.min.css +2 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/insertaudio/trumbowyg.insertaudio.js +83 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/insertaudio/trumbowyg.insertaudio.min.js +1 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/noembed/trumbowyg.noembed.js +101 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/noembed/trumbowyg.noembed.min.js +1 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/pasteimage/trumbowyg.pasteimage.js +41 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/pasteimage/trumbowyg.pasteimage.min.js +1 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/preformatted/trumbowyg.preformatted.js +123 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/preformatted/trumbowyg.preformatted.min.js +1 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/table/trumbowyg.table.js +154 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/table/trumbowyg.table.min.js +1 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/template/trumbowyg.template.js +58 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/template/trumbowyg.template.min.js +1 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/upload/trumbowyg.upload.js +242 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/upload/trumbowyg.upload.min.js +1 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/trumbowyg.js +1688 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/trumbowyg.min.js +2 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/ui/icons.svg +1 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/ui/sass/trumbowyg.scss +796 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/ui/trumbowyg.css +584 -0
- data/app/assets/stylesheets/activeadmin/trumbowyg/ui/trumbowyg.min.css +2 -0
- data/lib/activeadmin/trumbowyg/engine.rb +9 -0
- data/lib/activeadmin/trumbowyg/version.rb +5 -0
- data/lib/activeadmin/trumbowyg.rb +1 -0
- data/lib/activeadmin_trumbowyg.rb +3 -0
- data/lib/formtastic/inputs/trumbowyg_input.rb +12 -0
- data/screenshot.jpg +0 -0
- metadata +217 -0
@@ -0,0 +1,154 @@
|
|
1
|
+
/* ===========================================================
|
2
|
+
* trumbowyg.table.js v1.2
|
3
|
+
* Table plugin for Trumbowyg
|
4
|
+
* http://alex-d.github.com/Trumbowyg
|
5
|
+
* ===========================================================
|
6
|
+
* Author : Lawrence Meckan
|
7
|
+
* Twitter : @absalomedia
|
8
|
+
* Website : absalom.biz
|
9
|
+
*/
|
10
|
+
|
11
|
+
(function ($) {
|
12
|
+
'use strict';
|
13
|
+
|
14
|
+
var defaultOptions = {
|
15
|
+
rows: 0,
|
16
|
+
columns: 0,
|
17
|
+
styler: ''
|
18
|
+
};
|
19
|
+
|
20
|
+
$.extend(true, $.trumbowyg, {
|
21
|
+
langs: {
|
22
|
+
en: {
|
23
|
+
table: 'Insert table',
|
24
|
+
tableAddRow: 'Add rows',
|
25
|
+
tableAddColumn: 'Add columns',
|
26
|
+
rows: 'Rows',
|
27
|
+
columns: 'Columns',
|
28
|
+
styler: 'Table class',
|
29
|
+
error: 'Error'
|
30
|
+
},
|
31
|
+
sk: {
|
32
|
+
table: 'Vytvoriť tabuľky',
|
33
|
+
tableAddRow: 'Pridať riadok',
|
34
|
+
tableAddColumn: 'Pridať stĺpec',
|
35
|
+
rows: 'Riadky',
|
36
|
+
columns: 'Stĺpce',
|
37
|
+
styler: 'Tabuľku triedy',
|
38
|
+
error: 'Chyba'
|
39
|
+
},
|
40
|
+
fr: {
|
41
|
+
table: 'Insérer un tableau',
|
42
|
+
tableAddRow: 'Ajouter des lignes',
|
43
|
+
tableAddColumn: 'Ajouter des colonnes',
|
44
|
+
rows: 'Lignes',
|
45
|
+
columns: 'Colonnes',
|
46
|
+
styler: 'Classes CSS sur la table',
|
47
|
+
error: 'Erreur'
|
48
|
+
},
|
49
|
+
cs: {
|
50
|
+
table: 'Vytvořit příkaz Table',
|
51
|
+
tableAddRow: 'Přidat řádek',
|
52
|
+
tableAddColumn: 'Přidat sloupec',
|
53
|
+
rows: 'Řádky',
|
54
|
+
columns: 'Sloupce',
|
55
|
+
styler: 'Tabulku třída',
|
56
|
+
error: 'Chyba'
|
57
|
+
},
|
58
|
+
ru: {
|
59
|
+
table: 'Вставить таблицу',
|
60
|
+
tableAddRow: 'Добавить строки',
|
61
|
+
tableAddColumn: 'Добавить столбцы',
|
62
|
+
rows: 'Строки',
|
63
|
+
columns: 'Столбцы',
|
64
|
+
styler: 'Имя CSS класса для таблицы',
|
65
|
+
error: 'Ошибка'
|
66
|
+
},
|
67
|
+
ja: {
|
68
|
+
table: '表の挿入',
|
69
|
+
tableAddRow: '行の追加',
|
70
|
+
tableAddColumn: '列の追加',
|
71
|
+
rows: '行',
|
72
|
+
columns: '列',
|
73
|
+
styler: '表のクラス',
|
74
|
+
error: 'エラー'
|
75
|
+
}
|
76
|
+
},
|
77
|
+
|
78
|
+
plugins: {
|
79
|
+
table: {
|
80
|
+
init: function (trumbowyg) {
|
81
|
+
trumbowyg.o.plugins.table = $.extend(true, {}, defaultOptions, trumbowyg.o.plugins.table || {});
|
82
|
+
|
83
|
+
var tableBuild = {
|
84
|
+
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
|
+
});
|
122
|
+
}
|
123
|
+
};
|
124
|
+
|
125
|
+
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;
|
132
|
+
|
133
|
+
}
|
134
|
+
};
|
135
|
+
|
136
|
+
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;
|
143
|
+
|
144
|
+
}
|
145
|
+
};
|
146
|
+
|
147
|
+
trumbowyg.addBtnDef('table', tableBuild);
|
148
|
+
trumbowyg.addBtnDef('tableAddRow', addRow);
|
149
|
+
trumbowyg.addBtnDef('tableAddColumn', addColumn);
|
150
|
+
}
|
151
|
+
}
|
152
|
+
}
|
153
|
+
});
|
154
|
+
})(jQuery);
|
@@ -0,0 +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);
|
@@ -0,0 +1,58 @@
|
|
1
|
+
(function($) {
|
2
|
+
'use strict';
|
3
|
+
|
4
|
+
// Adds the language variables
|
5
|
+
$.extend(true, $.trumbowyg, {
|
6
|
+
langs: {
|
7
|
+
en: {
|
8
|
+
template: 'Template'
|
9
|
+
},
|
10
|
+
nl: {
|
11
|
+
template: 'Sjabloon'
|
12
|
+
},
|
13
|
+
ru: {
|
14
|
+
template: 'Шаблон'
|
15
|
+
},
|
16
|
+
ja: {
|
17
|
+
template: 'テンプレート'
|
18
|
+
}
|
19
|
+
}
|
20
|
+
});
|
21
|
+
|
22
|
+
// Adds the extra button definition
|
23
|
+
$.extend(true, $.trumbowyg, {
|
24
|
+
plugins: {
|
25
|
+
template: {
|
26
|
+
shouldInit: function(trumbowyg) {
|
27
|
+
return trumbowyg.o.plugins.hasOwnProperty('templates');
|
28
|
+
},
|
29
|
+
init: function(trumbowyg) {
|
30
|
+
trumbowyg.addBtnDef('template', {
|
31
|
+
dropdown: templateSelector(trumbowyg),
|
32
|
+
hasIcon: false,
|
33
|
+
text: trumbowyg.lang.template
|
34
|
+
});
|
35
|
+
}
|
36
|
+
}
|
37
|
+
}
|
38
|
+
});
|
39
|
+
|
40
|
+
// Creates the template-selector dropdown.
|
41
|
+
function templateSelector(trumbowyg) {
|
42
|
+
var available = trumbowyg.o.plugins.templates;
|
43
|
+
var templates = [];
|
44
|
+
|
45
|
+
$.each(available, function(index, template) {
|
46
|
+
trumbowyg.addBtnDef('template_' + index, {
|
47
|
+
fn: function(){
|
48
|
+
trumbowyg.html(template.html);
|
49
|
+
},
|
50
|
+
hasIcon: false,
|
51
|
+
title: template.name
|
52
|
+
});
|
53
|
+
templates.push('template_' + index);
|
54
|
+
});
|
55
|
+
|
56
|
+
return templates;
|
57
|
+
}
|
58
|
+
})(jQuery);
|
@@ -0,0 +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);
|
@@ -0,0 +1,242 @@
|
|
1
|
+
/* ===========================================================
|
2
|
+
* trumbowyg.upload.js v1.2
|
3
|
+
* Upload plugin for Trumbowyg
|
4
|
+
* http://alex-d.github.com/Trumbowyg
|
5
|
+
* ===========================================================
|
6
|
+
* Author : Alexandre Demode (Alex-D)
|
7
|
+
* Twitter : @AlexandreDemode
|
8
|
+
* Website : alex-d.fr
|
9
|
+
* Mod by : Aleksandr-ru
|
10
|
+
* Twitter : @Aleksandr_ru
|
11
|
+
* Website : aleksandr.ru
|
12
|
+
*/
|
13
|
+
|
14
|
+
(function ($) {
|
15
|
+
'use strict';
|
16
|
+
|
17
|
+
var defaultOptions = {
|
18
|
+
serverPath: '',
|
19
|
+
fileFieldName: 'fileToUpload',
|
20
|
+
data: [], // Additional data for ajax [{name: 'key', value: 'value'}]
|
21
|
+
headers: {}, // Additional headers
|
22
|
+
xhrFields: {}, // Additional fields
|
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
|
25
|
+
success: undefined, // Success callback: function (data, trumbowyg, $modal, values) {}
|
26
|
+
error: undefined // Error callback: function () {}
|
27
|
+
};
|
28
|
+
|
29
|
+
function getDeep(object, propertyParts) {
|
30
|
+
var mainProperty = propertyParts.shift(),
|
31
|
+
otherProperties = propertyParts;
|
32
|
+
|
33
|
+
if (object !== null) {
|
34
|
+
if (otherProperties.length === 0) {
|
35
|
+
return object[mainProperty];
|
36
|
+
}
|
37
|
+
|
38
|
+
if (typeof object === 'object') {
|
39
|
+
return getDeep(object[mainProperty], otherProperties);
|
40
|
+
}
|
41
|
+
}
|
42
|
+
return object;
|
43
|
+
}
|
44
|
+
|
45
|
+
addXhrProgressEvent();
|
46
|
+
|
47
|
+
$.extend(true, $.trumbowyg, {
|
48
|
+
langs: {
|
49
|
+
// jshint camelcase:false
|
50
|
+
en: {
|
51
|
+
upload: 'Upload',
|
52
|
+
file: 'File',
|
53
|
+
uploadError: 'Error'
|
54
|
+
},
|
55
|
+
sk: {
|
56
|
+
upload: 'Nahrať',
|
57
|
+
file: 'Súbor',
|
58
|
+
uploadError: 'Chyba'
|
59
|
+
},
|
60
|
+
fr: {
|
61
|
+
upload: 'Envoi',
|
62
|
+
file: 'Fichier',
|
63
|
+
uploadError: 'Erreur'
|
64
|
+
},
|
65
|
+
cs: {
|
66
|
+
upload: 'Nahrát obrázek',
|
67
|
+
file: 'Soubor',
|
68
|
+
uploadError: 'Chyba'
|
69
|
+
},
|
70
|
+
zh_cn: {
|
71
|
+
upload: '上传',
|
72
|
+
file: '文件',
|
73
|
+
uploadError: '错误'
|
74
|
+
},
|
75
|
+
zh_tw: {
|
76
|
+
upload: '上傳',
|
77
|
+
file: '文件',
|
78
|
+
uploadError: '錯誤'
|
79
|
+
},
|
80
|
+
ru: {
|
81
|
+
upload: 'Загрузка',
|
82
|
+
file: 'Файл',
|
83
|
+
uploadError: 'Ошибка'
|
84
|
+
},
|
85
|
+
ja: {
|
86
|
+
upload: 'アップロード',
|
87
|
+
file: 'ファイル',
|
88
|
+
uploadError: 'エラー'
|
89
|
+
},
|
90
|
+
pt_br: {
|
91
|
+
upload: 'Enviar do local',
|
92
|
+
file: 'Arquivo',
|
93
|
+
uploadError: 'Erro'
|
94
|
+
},
|
95
|
+
},
|
96
|
+
// jshint camelcase:true
|
97
|
+
|
98
|
+
plugins: {
|
99
|
+
upload: {
|
100
|
+
init: function (trumbowyg) {
|
101
|
+
trumbowyg.o.plugins.upload = $.extend(true, {}, defaultOptions, trumbowyg.o.plugins.upload || {});
|
102
|
+
var btnDef = {
|
103
|
+
fn: function () {
|
104
|
+
trumbowyg.saveRange();
|
105
|
+
|
106
|
+
var file,
|
107
|
+
prefix = trumbowyg.o.prefix;
|
108
|
+
|
109
|
+
var $modal = trumbowyg.openModalInsert(
|
110
|
+
// Title
|
111
|
+
trumbowyg.lang.upload,
|
112
|
+
|
113
|
+
// Fields
|
114
|
+
{
|
115
|
+
file: {
|
116
|
+
type: 'file',
|
117
|
+
required: true,
|
118
|
+
attributes: {
|
119
|
+
accept: 'image/*'
|
120
|
+
}
|
121
|
+
},
|
122
|
+
alt: {
|
123
|
+
label: 'description',
|
124
|
+
value: trumbowyg.getRangeText()
|
125
|
+
}
|
126
|
+
},
|
127
|
+
|
128
|
+
// Callback
|
129
|
+
function (values) {
|
130
|
+
var data = new FormData();
|
131
|
+
data.append(trumbowyg.o.plugins.upload.fileFieldName, file);
|
132
|
+
|
133
|
+
trumbowyg.o.plugins.upload.data.map(function (cur) {
|
134
|
+
data.append(cur.name, cur.value);
|
135
|
+
});
|
136
|
+
|
137
|
+
$.map(values, function(curr, key){
|
138
|
+
if(key !== 'file') {
|
139
|
+
data.append(key, curr);
|
140
|
+
}
|
141
|
+
});
|
142
|
+
|
143
|
+
if ($('.' + prefix + 'progress', $modal).length === 0) {
|
144
|
+
$('.' + prefix + 'modal-title', $modal)
|
145
|
+
.after(
|
146
|
+
$('<div/>', {
|
147
|
+
'class': prefix + 'progress'
|
148
|
+
}).append(
|
149
|
+
$('<div/>', {
|
150
|
+
'class': prefix + 'progress-bar'
|
151
|
+
})
|
152
|
+
)
|
153
|
+
);
|
154
|
+
}
|
155
|
+
|
156
|
+
$.ajax({
|
157
|
+
url: trumbowyg.o.plugins.upload.serverPath,
|
158
|
+
headers: trumbowyg.o.plugins.upload.headers,
|
159
|
+
xhrFields: trumbowyg.o.plugins.upload.xhrFields,
|
160
|
+
type: 'POST',
|
161
|
+
data: data,
|
162
|
+
cache: false,
|
163
|
+
dataType: 'json',
|
164
|
+
processData: false,
|
165
|
+
contentType: false,
|
166
|
+
|
167
|
+
progressUpload: function (e) {
|
168
|
+
$('.' + prefix + 'progress-bar').css('width', Math.round(e.loaded * 100 / e.total) + '%');
|
169
|
+
},
|
170
|
+
|
171
|
+
success: function (data) {
|
172
|
+
if (trumbowyg.o.plugins.upload.success) {
|
173
|
+
trumbowyg.o.plugins.upload.success(data, trumbowyg, $modal, values);
|
174
|
+
} else {
|
175
|
+
if (!!getDeep(data, trumbowyg.o.plugins.upload.statusPropertyName.split('.'))) {
|
176
|
+
var url = getDeep(data, trumbowyg.o.plugins.upload.urlPropertyName.split('.'));
|
177
|
+
trumbowyg.execCmd('insertImage', url);
|
178
|
+
$('img[src="' + url + '"]:not([alt])', trumbowyg.$box).attr('alt', values.alt);
|
179
|
+
setTimeout(function () {
|
180
|
+
trumbowyg.closeModal();
|
181
|
+
}, 250);
|
182
|
+
trumbowyg.$c.trigger('tbwuploadsuccess', [trumbowyg, data, url]);
|
183
|
+
} else {
|
184
|
+
trumbowyg.addErrorOnModalField(
|
185
|
+
$('input[type=file]', $modal),
|
186
|
+
trumbowyg.lang[data.message]
|
187
|
+
);
|
188
|
+
trumbowyg.$c.trigger('tbwuploaderror', [trumbowyg, data]);
|
189
|
+
}
|
190
|
+
}
|
191
|
+
},
|
192
|
+
|
193
|
+
error: trumbowyg.o.plugins.upload.error || function () {
|
194
|
+
trumbowyg.addErrorOnModalField(
|
195
|
+
$('input[type=file]', $modal),
|
196
|
+
trumbowyg.lang.uploadError
|
197
|
+
);
|
198
|
+
trumbowyg.$c.trigger('tbwuploaderror', [trumbowyg]);
|
199
|
+
}
|
200
|
+
});
|
201
|
+
}
|
202
|
+
);
|
203
|
+
|
204
|
+
$('input[type=file]').on('change', function (e) {
|
205
|
+
try {
|
206
|
+
// If multiple files allowed, we just get the first.
|
207
|
+
file = e.target.files[0];
|
208
|
+
} catch (err) {
|
209
|
+
// In IE8, multiple files not allowed
|
210
|
+
file = e.target.value;
|
211
|
+
}
|
212
|
+
});
|
213
|
+
}
|
214
|
+
};
|
215
|
+
|
216
|
+
trumbowyg.addBtnDef('upload', btnDef);
|
217
|
+
}
|
218
|
+
}
|
219
|
+
}
|
220
|
+
});
|
221
|
+
|
222
|
+
|
223
|
+
function addXhrProgressEvent() {
|
224
|
+
if (!$.trumbowyg.addedXhrProgressEvent) { // Avoid adding progress event multiple times
|
225
|
+
var originalXhr = $.ajaxSettings.xhr;
|
226
|
+
$.ajaxSetup({
|
227
|
+
xhr: function () {
|
228
|
+
var req = originalXhr(),
|
229
|
+
that = this;
|
230
|
+
if (req && typeof req.upload === 'object' && that.progressUpload !== undefined) {
|
231
|
+
req.upload.addEventListener('progress', function (e) {
|
232
|
+
that.progressUpload(e);
|
233
|
+
}, false);
|
234
|
+
}
|
235
|
+
|
236
|
+
return req;
|
237
|
+
}
|
238
|
+
});
|
239
|
+
$.trumbowyg.addedXhrProgressEvent = true;
|
240
|
+
}
|
241
|
+
}
|
242
|
+
})(jQuery);
|
@@ -0,0 +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 a(){if(!r.trumbowyg.addedXhrProgressEvent){var e=r.ajaxSettings.xhr;r.ajaxSetup({xhr:function(){var r=e(),a=this;return r&&"object"==typeof r.upload&&void 0!==a.progressUpload&&r.upload.addEventListener("progress",function(r){a.progressUpload(r)},!1),r}}),r.trumbowyg.addedXhrProgressEvent=!0}}var o={serverPath:"",fileFieldName:"fileToUpload",data:[],headers:{},xhrFields:{},urlPropertyName:"file",statusPropertyName:"success",success:void 0,error:void 0};a(),r.extend(!0,r.trumbowyg,{langs:{en:{upload:"Upload",file:"File",uploadError:"Error"},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"}},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=a.openModalInsert(a.lang.upload,{file:{type:"file",required:!0,attributes:{accept:"image/*"}},alt:{label:"description",value:a.getRangeText()}},function(u){var p=new FormData;p.append(a.o.plugins.upload.fileFieldName,o),a.o.plugins.upload.data.map(function(r){p.append(r.name,r.value)}),r.map(u,function(r,e){"file"!==e&&p.append(e,r)}),0===r("."+l+"progress",t).length&&r("."+l+"modal-title",t).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:p,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,t,u);else if(e(o,a.o.plugins.upload.statusPropertyName.split("."))){var l=e(o,a.o.plugins.upload.urlPropertyName.split("."));a.execCmd("insertImage",l),r('img[src="'+l+'"]:not([alt])',a.$box).attr("alt",u.alt),setTimeout(function(){a.closeModal()},250),a.$c.trigger("tbwuploadsuccess",[a,o,l])}else a.addErrorOnModalField(r("input[type=file]",t),a.lang[o.message]),a.$c.trigger("tbwuploaderror",[a,o])},error:a.o.plugins.upload.error||function(){a.addErrorOnModalField(r("input[type=file]",t),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);
|