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.
- checksums.yaml +4 -4
- data/README.md +7 -0
- data/app/assets/fonts/active_admin-trumbowyg.svg +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/da.min.js +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/de.min.js +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/fa.min.js +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/fr.min.js +3 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/lt.min.js +8 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/sq.min.js +8 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/th.min.js +9 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/langs/zh_tw.min.js +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/allowtagsfrompaste/trumbowyg.allowtagsfrompaste.js +143 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/allowtagsfrompaste/trumbowyg.allowtagsfrompaste.min.js +1 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/base64/trumbowyg.base64.js +21 -1
- 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 +23 -90
- 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 +24 -2
- 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 +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/colors/ui/trumbowyg.colors.min.css +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/emoji/trumbowyg.emoji.js +1190 -876
- 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 +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/emoji/ui/trumbowyg.emoji.min.css +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/fontfamily/trumbowyg.fontfamily.js +82 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/fontfamily/trumbowyg.fontfamily.min.js +1 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/fontsize/trumbowyg.fontsize.js +160 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/fontsize/trumbowyg.fontsize.min.js +1 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/highlight/trumbowyg.highlight.js +82 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/highlight/trumbowyg.highlight.min.js +1 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/highlight/ui/sass/trumbowyg.highlight.scss +25 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/highlight/ui/trumbowyg.highlight.css +20 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/highlight/ui/trumbowyg.highlight.min.css +2 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/history/trumbowyg.history.js +202 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/history/trumbowyg.history.min.js +1 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/insertaudio/trumbowyg.insertaudio.js +10 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/insertaudio/trumbowyg.insertaudio.min.js +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/lineheight/trumbowyg.lineheight.js +122 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/lineheight/trumbowyg.lineheight.min.js +1 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mathml/trumbowyg.mathml.js +98 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mathml/trumbowyg.mathml.min.js +1 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mathml/ui/sass/trumbowyg.mathml.scss +36 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mathml/ui/trumbowyg.mathml.css +29 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mathml/ui/trumbowyg.mathml.min.css +2 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mention/trumbowyg.mention.js +111 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mention/trumbowyg.mention.min.js +1 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mention/ui/sass/trumbowyg.mention.scss +39 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mention/ui/trumbowyg.mention.css +32 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mention/ui/trumbowyg.mention.min.css +2 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/noembed/trumbowyg.noembed.js +12 -2
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/noembed/trumbowyg.noembed.min.js +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/pasteembed/trumbowyg.pasteembed.js +96 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/pasteembed/trumbowyg.pasteembed.min.js +1 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/pasteimage/trumbowyg.pasteimage.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 +16 -3
- 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 +69 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/resizimg/trumbowyg.resizimg.min.js +1 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/ruby/trumbowyg.ruby.js +82 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/ruby/trumbowyg.ruby.min.js +1 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/table/trumbowyg.table.js +236 -86
- 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 +42 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/table/ui/trumbowyg.table.css +33 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/table/ui/trumbowyg.table.min.css +2 -0
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/template/trumbowyg.template.js +19 -7
- 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 +44 -20
- data/app/assets/javascripts/activeadmin/trumbowyg/plugins/upload/trumbowyg.upload.min.js +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/trumbowyg.js +215 -78
- data/app/assets/javascripts/activeadmin/trumbowyg/trumbowyg.min.js +2 -2
- data/app/assets/javascripts/activeadmin/trumbowyg/ui/icons.svg +1 -1
- data/app/assets/javascripts/activeadmin/trumbowyg/ui/sass/trumbowyg.scss +25 -12
- data/app/assets/javascripts/activeadmin/trumbowyg/ui/trumbowyg.css +23 -20
- data/app/assets/javascripts/activeadmin/trumbowyg/ui/trumbowyg.min.css +2 -2
- data/app/assets/stylesheets/activeadmin/_trumbowyg_input.sass +5 -3
- data/app/assets/stylesheets/activeadmin/trumbowyg/ui/icons.svg +1 -1
- data/app/assets/stylesheets/activeadmin/trumbowyg/ui/sass/trumbowyg.scss +25 -12
- data/app/assets/stylesheets/activeadmin/trumbowyg/ui/trumbowyg.css +23 -20
- data/app/assets/stylesheets/activeadmin/trumbowyg/ui/trumbowyg.min.css +2 -2
- data/lib/activeadmin/trumbowyg/version.rb +1 -1
- metadata +40 -72
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/ar.min.js +0 -11
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/bg.min.js +0 -8
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/by.min.js +0 -8
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/ca.min.js +0 -11
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/cs.min.js +0 -8
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/da.min.js +0 -9
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/de.min.js +0 -9
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/el.min.js +0 -12
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/es.min.js +0 -9
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/es_ar.min.js +0 -10
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/fa.min.js +0 -10
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/fi.min.js +0 -9
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/fr.min.js +0 -10
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/he.min.js +0 -9
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/hr.min.js +0 -9
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/hu.min.js +0 -10
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/id.min.js +0 -11
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/it.min.js +0 -8
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/ja.min.js +0 -10
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/ko.min.js +0 -10
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/mn.min.js +0 -8
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/my.min.js +0 -8
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/nl.min.js +0 -9
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/no_nb.min.js +0 -10
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/ph.min.js +0 -8
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/pl.min.js +0 -9
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/pt.min.js +0 -11
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/pt_br.min.js +0 -11
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/ro.min.js +0 -12
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/rs.min.js +0 -8
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/rs_latin.min.js +0 -9
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/ru.min.js +0 -8
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/sk.min.js +0 -8
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/sv.min.js +0 -12
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/tr.min.js +0 -9
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/ua.min.js +0 -8
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/vi.min.js +0 -9
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/zh_cn.min.js +0 -11
- data/app/assets/stylesheets/activeadmin/trumbowyg/langs/zh_tw.min.js +0 -11
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/base64/trumbowyg.base64.js +0 -121
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/base64/trumbowyg.base64.min.js +0 -1
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/cleanpaste/trumbowyg.cleanpaste.js +0 -179
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/cleanpaste/trumbowyg.cleanpaste.min.js +0 -1
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/colors/trumbowyg.colors.js +0 -176
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/colors/trumbowyg.colors.min.js +0 -1
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/colors/ui/sass/trumbowyg.colors.scss +0 -49
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/colors/ui/trumbowyg.colors.css +0 -43
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/colors/ui/trumbowyg.colors.min.css +0 -2
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/emoji/trumbowyg.emoji.js +0 -965
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/emoji/trumbowyg.emoji.min.js +0 -1
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/emoji/ui/sass/trumbowyg.emoji.scss +0 -56
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/emoji/ui/trumbowyg.emoji.css +0 -47
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/emoji/ui/trumbowyg.emoji.min.css +0 -2
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/insertaudio/trumbowyg.insertaudio.js +0 -83
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/insertaudio/trumbowyg.insertaudio.min.js +0 -1
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/noembed/trumbowyg.noembed.js +0 -101
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/noembed/trumbowyg.noembed.min.js +0 -1
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/pasteimage/trumbowyg.pasteimage.js +0 -41
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/pasteimage/trumbowyg.pasteimage.min.js +0 -1
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/preformatted/trumbowyg.preformatted.js +0 -123
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/preformatted/trumbowyg.preformatted.min.js +0 -1
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/table/trumbowyg.table.js +0 -154
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/table/trumbowyg.table.min.js +0 -1
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/template/trumbowyg.template.js +0 -58
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/template/trumbowyg.template.min.js +0 -1
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/upload/trumbowyg.upload.js +0 -242
- data/app/assets/stylesheets/activeadmin/trumbowyg/plugins/upload/trumbowyg.upload.min.js +0 -1
- data/app/assets/stylesheets/activeadmin/trumbowyg/trumbowyg.js +0 -1688
- data/app/assets/stylesheets/activeadmin/trumbowyg/trumbowyg.min.js +0 -2
@@ -0,0 +1,202 @@
|
|
1
|
+
/*/* ===========================================================
|
2
|
+
* trumbowyg.history.js v1.0
|
3
|
+
* history plugin for Trumbowyg
|
4
|
+
* http://alex-d.github.com/Trumbowyg
|
5
|
+
* ===========================================================
|
6
|
+
* Author : Sven Dunemann [dunemann@forelabs.eu]
|
7
|
+
*/
|
8
|
+
|
9
|
+
(function ($) {
|
10
|
+
'use strict';
|
11
|
+
$.extend(true, $.trumbowyg, {
|
12
|
+
langs: {
|
13
|
+
de: {
|
14
|
+
history: {
|
15
|
+
redo: 'Wiederholen',
|
16
|
+
undo: 'Rückgängig'
|
17
|
+
}
|
18
|
+
},
|
19
|
+
en: {
|
20
|
+
history: {
|
21
|
+
redo: 'Redo',
|
22
|
+
undo: 'Undo'
|
23
|
+
}
|
24
|
+
},
|
25
|
+
da: {
|
26
|
+
history: {
|
27
|
+
redo: 'Annuller fortryd',
|
28
|
+
undo: 'Fortryd'
|
29
|
+
}
|
30
|
+
},
|
31
|
+
fr: {
|
32
|
+
history: {
|
33
|
+
redo: 'Annuler',
|
34
|
+
undo: 'Rétablir'
|
35
|
+
}
|
36
|
+
},
|
37
|
+
zh_tw: {
|
38
|
+
history: {
|
39
|
+
redo: '重做',
|
40
|
+
undo: '復原'
|
41
|
+
}
|
42
|
+
}
|
43
|
+
},
|
44
|
+
plugins: {
|
45
|
+
history: {
|
46
|
+
init: function (t) {
|
47
|
+
t.o.plugins.history = $.extend(true, {
|
48
|
+
_stack: [],
|
49
|
+
_index: -1,
|
50
|
+
_focusEl: undefined
|
51
|
+
}, t.o.plugins.history || {});
|
52
|
+
|
53
|
+
var btnBuildDefRedo = {
|
54
|
+
title: t.lang.history.redo,
|
55
|
+
ico: 'redo',
|
56
|
+
key: 'Y',
|
57
|
+
fn: function () {
|
58
|
+
if (t.o.plugins.history._index < t.o.plugins.history._stack.length - 1) {
|
59
|
+
t.o.plugins.history._index += 1;
|
60
|
+
var index = t.o.plugins.history._index;
|
61
|
+
var newState = t.o.plugins.history._stack[index];
|
62
|
+
|
63
|
+
t.execCmd('html', newState);
|
64
|
+
// because of some semantic optimisations we have to save the state back
|
65
|
+
// to history
|
66
|
+
t.o.plugins.history._stack[index] = t.$ed.html();
|
67
|
+
|
68
|
+
carretToEnd();
|
69
|
+
toggleButtonStates();
|
70
|
+
}
|
71
|
+
}
|
72
|
+
};
|
73
|
+
|
74
|
+
var btnBuildDefUndo = {
|
75
|
+
title: t.lang.history.undo,
|
76
|
+
ico: 'undo',
|
77
|
+
key: 'Z',
|
78
|
+
fn: function () {
|
79
|
+
if (t.o.plugins.history._index > 0) {
|
80
|
+
t.o.plugins.history._index -= 1;
|
81
|
+
var index = t.o.plugins.history._index,
|
82
|
+
newState = t.o.plugins.history._stack[index];
|
83
|
+
|
84
|
+
t.execCmd('html', newState);
|
85
|
+
// because of some semantic optimisations we have to save the state back
|
86
|
+
// to history
|
87
|
+
t.o.plugins.history._stack[index] = t.$ed.html();
|
88
|
+
|
89
|
+
carretToEnd();
|
90
|
+
toggleButtonStates();
|
91
|
+
}
|
92
|
+
}
|
93
|
+
};
|
94
|
+
|
95
|
+
var pushToHistory = function () {
|
96
|
+
var index = t.o.plugins.history._index,
|
97
|
+
stack = t.o.plugins.history._stack,
|
98
|
+
latestState = stack.slice(-1)[0] || '<p></p>',
|
99
|
+
prevState = stack[index],
|
100
|
+
newState = t.$ed.html(),
|
101
|
+
focusEl = t.doc.getSelection().focusNode,
|
102
|
+
focusElText = '',
|
103
|
+
latestStateTagsList,
|
104
|
+
newStateTagsList,
|
105
|
+
prevFocusEl = t.o.plugins.history._focusEl;
|
106
|
+
|
107
|
+
latestStateTagsList = $('<div>' + latestState + '</div>').find('*').map(function () {
|
108
|
+
return this.localName;
|
109
|
+
});
|
110
|
+
newStateTagsList = $('<div>' + newState + '</div>').find('*').map(function () {
|
111
|
+
return this.localName;
|
112
|
+
});
|
113
|
+
if (focusEl) {
|
114
|
+
t.o.plugins.history._focusEl = focusEl;
|
115
|
+
focusElText = focusEl.outerHTML || focusEl.textContent;
|
116
|
+
}
|
117
|
+
|
118
|
+
if (newState !== prevState) {
|
119
|
+
// a new stack entry is defined when current insert ends on a whitespace character
|
120
|
+
// or count of node elements has been changed
|
121
|
+
// or focused element differs from previous one
|
122
|
+
if (focusElText.slice(-1).match(/\s/) ||
|
123
|
+
!arraysAreIdentical(latestStateTagsList, newStateTagsList) ||
|
124
|
+
t.o.plugins.history._index <= 0 || focusEl !== prevFocusEl)
|
125
|
+
{
|
126
|
+
t.o.plugins.history._index += 1;
|
127
|
+
// remove newer entries in history when something new was added
|
128
|
+
// because timeline was changes with interaction
|
129
|
+
t.o.plugins.history._stack = stack.slice(
|
130
|
+
0, t.o.plugins.history._index
|
131
|
+
);
|
132
|
+
// now add new state to modifed history
|
133
|
+
t.o.plugins.history._stack.push(newState);
|
134
|
+
} else {
|
135
|
+
// modify last stack entry
|
136
|
+
t.o.plugins.history._stack[index] = newState;
|
137
|
+
}
|
138
|
+
|
139
|
+
toggleButtonStates();
|
140
|
+
}
|
141
|
+
};
|
142
|
+
|
143
|
+
var toggleButtonStates = function () {
|
144
|
+
var index = t.o.plugins.history._index,
|
145
|
+
stackSize = t.o.plugins.history._stack.length,
|
146
|
+
undoState = (index > 0),
|
147
|
+
redoState = (stackSize !== 0 && index !== stackSize - 1);
|
148
|
+
|
149
|
+
toggleButtonState('historyUndo', undoState);
|
150
|
+
toggleButtonState('historyRedo', redoState);
|
151
|
+
};
|
152
|
+
|
153
|
+
var toggleButtonState = function (btn, enable) {
|
154
|
+
var button = t.$box.find('.trumbowyg-' + btn + '-button');
|
155
|
+
|
156
|
+
if (enable) {
|
157
|
+
button.removeClass('trumbowyg-disable');
|
158
|
+
} else if (!button.hasClass('trumbowyg-disable')) {
|
159
|
+
button.addClass('trumbowyg-disable');
|
160
|
+
}
|
161
|
+
};
|
162
|
+
|
163
|
+
var arraysAreIdentical = function (a, b) {
|
164
|
+
if (a === b) {
|
165
|
+
return true;
|
166
|
+
}
|
167
|
+
if (a == null || b == null) {
|
168
|
+
return false;
|
169
|
+
}
|
170
|
+
if (a.length !== b.length) {
|
171
|
+
return false;
|
172
|
+
}
|
173
|
+
|
174
|
+
for (var i = 0; i < a.length; i += 1) {
|
175
|
+
if (a[i] !== b[i]) {
|
176
|
+
return false;
|
177
|
+
}
|
178
|
+
}
|
179
|
+
return true;
|
180
|
+
};
|
181
|
+
|
182
|
+
var carretToEnd = function () {
|
183
|
+
var node = t.doc.getSelection().focusNode,
|
184
|
+
range = t.doc.createRange();
|
185
|
+
|
186
|
+
if (node.childNodes.length > 0) {
|
187
|
+
range.setStartAfter(node.childNodes[node.childNodes.length - 1]);
|
188
|
+
range.setEndAfter(node.childNodes[node.childNodes.length - 1]);
|
189
|
+
t.doc.getSelection().removeAllRanges();
|
190
|
+
t.doc.getSelection().addRange(range);
|
191
|
+
}
|
192
|
+
};
|
193
|
+
|
194
|
+
t.$c.on('tbwinit tbwchange', pushToHistory);
|
195
|
+
|
196
|
+
t.addBtnDef('historyRedo', btnBuildDefRedo);
|
197
|
+
t.addBtnDef('historyUndo', btnBuildDefUndo);
|
198
|
+
}
|
199
|
+
}
|
200
|
+
}
|
201
|
+
});
|
202
|
+
})(jQuery);
|
@@ -0,0 +1 @@
|
|
1
|
+
!function(o){"use strict";o.extend(!0,o.trumbowyg,{langs:{de:{history:{redo:"Wiederholen",undo:"Rückgängig"}},en:{history:{redo:"Redo",undo:"Undo"}},da:{history:{redo:"Annuller fortryd",undo:"Fortryd"}},fr:{history:{redo:"Annuler",undo:"Rétablir"}},zh_tw:{history:{redo:"重做",undo:"復原"}}},plugins:{history:{init:function(i){i.o.plugins.history=o.extend(!0,{_stack:[],_index:-1,_focusEl:void 0},i.o.plugins.history||{});var t={title:i.lang.history.redo,ico:"redo",key:"Y",fn:function(){if(i.o.plugins.history._index<i.o.plugins.history._stack.length-1){i.o.plugins.history._index+=1;var o=i.o.plugins.history._index,t=i.o.plugins.history._stack[o];i.execCmd("html",t),i.o.plugins.history._stack[o]=i.$ed.html(),l(),s()}}},n={title:i.lang.history.undo,ico:"undo",key:"Z",fn:function(){if(i.o.plugins.history._index>0){i.o.plugins.history._index-=1;var o=i.o.plugins.history._index,t=i.o.plugins.history._stack[o];i.execCmd("html",t),i.o.plugins.history._stack[o]=i.$ed.html(),l(),s()}}},e=function(){var t,n,e=i.o.plugins.history._index,r=i.o.plugins.history._stack,l=r.slice(-1)[0]||"<p></p>",u=r[e],h=i.$ed.html(),c=i.doc.getSelection().focusNode,g="",a=i.o.plugins.history._focusEl;t=o("<div>"+l+"</div>").find("*").map(function(){return this.localName}),n=o("<div>"+h+"</div>").find("*").map(function(){return this.localName}),c&&(i.o.plugins.history._focusEl=c,g=c.outerHTML||c.textContent),h!==u&&(g.slice(-1).match(/\s/)||!d(t,n)||i.o.plugins.history._index<=0||c!==a?(i.o.plugins.history._index+=1,i.o.plugins.history._stack=r.slice(0,i.o.plugins.history._index),i.o.plugins.history._stack.push(h)):i.o.plugins.history._stack[e]=h,s())},s=function(){var o=i.o.plugins.history._index,t=i.o.plugins.history._stack.length,n=o>0,e=0!==t&&o!==t-1;r("historyUndo",n),r("historyRedo",e)},r=function(o,t){var n=i.$box.find(".trumbowyg-"+o+"-button");t?n.removeClass("trumbowyg-disable"):n.hasClass("trumbowyg-disable")||n.addClass("trumbowyg-disable")},d=function(o,i){if(o===i)return!0;if(null==o||null==i)return!1;if(o.length!==i.length)return!1;for(var t=0;t<o.length;t+=1)if(o[t]!==i[t])return!1;return!0},l=function(){var o=i.doc.getSelection().focusNode,t=i.doc.createRange();o.childNodes.length>0&&(t.setStartAfter(o.childNodes[o.childNodes.length-1]),t.setEndAfter(o.childNodes[o.childNodes.length-1]),i.doc.getSelection().removeAllRanges(),i.doc.getSelection().addRange(t))};i.$c.on("tbwinit tbwchange",e),i.addBtnDef("historyRedo",t),i.addBtnDef("historyUndo",n)}}}})}(jQuery);
|
data/app/assets/javascripts/activeadmin/trumbowyg/plugins/insertaudio/trumbowyg.insertaudio.js
CHANGED
@@ -36,11 +36,20 @@
|
|
36
36
|
en: {
|
37
37
|
insertAudio: 'Insert Audio'
|
38
38
|
},
|
39
|
+
da: {
|
40
|
+
insertAudio: 'Indsæt lyd'
|
41
|
+
},
|
42
|
+
fr: {
|
43
|
+
insertAudio: 'Insérer un son'
|
44
|
+
},
|
39
45
|
ru: {
|
40
46
|
insertAudio: 'Вставить аудио'
|
41
47
|
},
|
42
48
|
ja: {
|
43
49
|
insertAudio: '音声の挿入'
|
50
|
+
},
|
51
|
+
tr: {
|
52
|
+
insertAudio: 'Ses Ekle'
|
44
53
|
}
|
45
54
|
},
|
46
55
|
plugins: {
|
@@ -80,4 +89,4 @@
|
|
80
89
|
}
|
81
90
|
}
|
82
91
|
});
|
83
|
-
})(jQuery);
|
92
|
+
})(jQuery);
|
data/app/assets/javascripts/activeadmin/trumbowyg/plugins/insertaudio/trumbowyg.insertaudio.min.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
!function(e){"use strict";var r={src:{label:"URL",required:!0},autoplay:{label:"AutoPlay",required:!1,type:"checkbox"},muted:{label:"Muted",required:!1,type:"checkbox"},preload:{label:"preload options",required:!1}};e.extend(!0,e.trumbowyg,{langs:{en:{insertAudio:"Insert Audio"},ru:{insertAudio:"Вставить аудио"},ja:{insertAudio:"音声の挿入"}},plugins:{insertAudio:{init:function(
|
1
|
+
!function(e){"use strict";var r={src:{label:"URL",required:!0},autoplay:{label:"AutoPlay",required:!1,type:"checkbox"},muted:{label:"Muted",required:!1,type:"checkbox"},preload:{label:"preload options",required:!1}};e.extend(!0,e.trumbowyg,{langs:{en:{insertAudio:"Insert Audio"},da:{insertAudio:"Indsæt lyd"},fr:{insertAudio:"Insérer un son"},ru:{insertAudio:"Вставить аудио"},ja:{insertAudio:"音声の挿入"},tr:{insertAudio:"Ses Ekle"}},plugins:{insertAudio:{init:function(n){var t={fn:function(){var t=function(r){var t="<audio controls";r.src&&(t+=" src='"+r.src+"'"),r.autoplay&&(t+=" autoplay"),r.muted&&(t+=" muted"),r.preload&&(t+=" preload='"+r+"'"),t+="></audio>";var o=e(t)[0];return n.range.deleteContents(),n.range.insertNode(o),!0};n.openModalInsert(n.lang.insertAudio,r,t)}};n.addBtnDef("insertAudio",t)}}}})}(jQuery);
|
@@ -0,0 +1,122 @@
|
|
1
|
+
(function ($) {
|
2
|
+
'use strict';
|
3
|
+
|
4
|
+
$.extend(true, $.trumbowyg, {
|
5
|
+
langs: {
|
6
|
+
// jshint camelcase:false
|
7
|
+
en: {
|
8
|
+
lineheight: 'Line height',
|
9
|
+
lineheights: {
|
10
|
+
'0.9': 'Small',
|
11
|
+
'normal': 'Regular',
|
12
|
+
'1.5': 'Large',
|
13
|
+
'2.0': 'Extra large'
|
14
|
+
}
|
15
|
+
},
|
16
|
+
da: {
|
17
|
+
lineheight: 'Linjehøjde',
|
18
|
+
lineheights: {
|
19
|
+
'0.9': 'Lille',
|
20
|
+
'normal': 'Normal',
|
21
|
+
'1.5': 'Stor',
|
22
|
+
'2.0': 'Ekstra stor'
|
23
|
+
}
|
24
|
+
},
|
25
|
+
fr: {
|
26
|
+
lineheight: 'Hauteur de ligne',
|
27
|
+
lineheights: {
|
28
|
+
'0.9': 'Petit',
|
29
|
+
'normal': 'Regular',
|
30
|
+
'1.5': 'Grand',
|
31
|
+
'2.0': 'Très grand'
|
32
|
+
}
|
33
|
+
},
|
34
|
+
nl: {
|
35
|
+
lineheight: 'Regelhoogte',
|
36
|
+
lineheights: {
|
37
|
+
'0.9': 'Klein',
|
38
|
+
'normal': 'Normaal',
|
39
|
+
'1.5': 'Groot',
|
40
|
+
'2.0': 'Extra groot'
|
41
|
+
}
|
42
|
+
},
|
43
|
+
tr: {
|
44
|
+
lineheight: 'Satır yüksekliği',
|
45
|
+
lineheights: {
|
46
|
+
'0.9': 'Küçük',
|
47
|
+
'normal': 'Normal',
|
48
|
+
'1.5': 'Büyük',
|
49
|
+
'2.0': 'Çok Büyük'
|
50
|
+
}
|
51
|
+
},
|
52
|
+
zh_tw: {
|
53
|
+
lineheight: '文字間距',
|
54
|
+
lineheights: {
|
55
|
+
'0.9': '小',
|
56
|
+
'normal': '正常',
|
57
|
+
'1.5': '大',
|
58
|
+
'2.0': '特大'
|
59
|
+
}
|
60
|
+
},
|
61
|
+
}
|
62
|
+
});
|
63
|
+
// jshint camelcase:true
|
64
|
+
|
65
|
+
// Add dropdown with font sizes
|
66
|
+
$.extend(true, $.trumbowyg, {
|
67
|
+
plugins: {
|
68
|
+
lineheight: {
|
69
|
+
init: function (trumbowyg) {
|
70
|
+
trumbowyg.addBtnDef('lineheight', {
|
71
|
+
dropdown: buildDropdown(trumbowyg)
|
72
|
+
});
|
73
|
+
}
|
74
|
+
}
|
75
|
+
}
|
76
|
+
});
|
77
|
+
|
78
|
+
// Build the dropdown
|
79
|
+
function buildDropdown(trumbowyg) {
|
80
|
+
var dropdown = [];
|
81
|
+
var sizes = ['0.9', 'normal', '1.5', '2.0'];
|
82
|
+
|
83
|
+
$.each(sizes, function(index, size) {
|
84
|
+
trumbowyg.addBtnDef('lineheight_' + size, {
|
85
|
+
text: '<span style="line-height: ' + size + ';">' + trumbowyg.lang.lineheights[size] + '</span>',
|
86
|
+
hasIcon: false,
|
87
|
+
fn: function(){
|
88
|
+
trumbowyg.saveRange();
|
89
|
+
var text = trumbowyg.getRangeText();
|
90
|
+
if (text.replace(/\s/g, '') !== '') {
|
91
|
+
try {
|
92
|
+
var parent = getSelectionParentElement();
|
93
|
+
$(parent).css('lineHeight', size);
|
94
|
+
} catch (e) {
|
95
|
+
}
|
96
|
+
}
|
97
|
+
}
|
98
|
+
});
|
99
|
+
dropdown.push('lineheight_' + size);
|
100
|
+
});
|
101
|
+
|
102
|
+
return dropdown;
|
103
|
+
}
|
104
|
+
|
105
|
+
// Get the selection's parent
|
106
|
+
function getSelectionParentElement() {
|
107
|
+
var parentEl = null,
|
108
|
+
selection;
|
109
|
+
if (window.getSelection) {
|
110
|
+
selection = window.getSelection();
|
111
|
+
if (selection.rangeCount) {
|
112
|
+
parentEl = selection.getRangeAt(0).commonAncestorContainer;
|
113
|
+
if (parentEl.nodeType !== 1) {
|
114
|
+
parentEl = parentEl.parentNode;
|
115
|
+
}
|
116
|
+
}
|
117
|
+
} else if ((selection = document.selection) && selection.type !== 'Control') {
|
118
|
+
parentEl = selection.createRange().parentElement();
|
119
|
+
}
|
120
|
+
return parentEl;
|
121
|
+
}
|
122
|
+
})(jQuery);
|
data/app/assets/javascripts/activeadmin/trumbowyg/plugins/lineheight/trumbowyg.lineheight.min.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
!function(e){"use strict";function n(n){var i=[],l=["0.9","normal","1.5","2.0"];return e.each(l,function(l,r){n.addBtnDef("lineheight_"+r,{text:'<span style="line-height: '+r+';">'+n.lang.lineheights[r]+"</span>",hasIcon:!1,fn:function(){n.saveRange();var i=n.getRangeText();if(""!==i.replace(/\s/g,""))try{var l=t();e(l).css("lineHeight",r)}catch(a){}}}),i.push("lineheight_"+r)}),i}function t(){var e,n=null;return window.getSelection?(e=window.getSelection(),e.rangeCount&&(n=e.getRangeAt(0).commonAncestorContainer,1!==n.nodeType&&(n=n.parentNode))):(e=document.selection)&&"Control"!==e.type&&(n=e.createRange().parentElement()),n}e.extend(!0,e.trumbowyg,{langs:{en:{lineheight:"Line height",lineheights:{.9:"Small",normal:"Regular",1.5:"Large","2.0":"Extra large"}},da:{lineheight:"Linjehøjde",lineheights:{.9:"Lille",normal:"Normal",1.5:"Stor","2.0":"Ekstra stor"}},fr:{lineheight:"Hauteur de ligne",lineheights:{.9:"Petit",normal:"Regular",1.5:"Grand","2.0":"Très grand"}},nl:{lineheight:"Regelhoogte",lineheights:{.9:"Klein",normal:"Normaal",1.5:"Groot","2.0":"Extra groot"}},tr:{lineheight:"Satır yüksekliği",lineheights:{.9:"Küçük",normal:"Normal",1.5:"Büyük","2.0":"Çok Büyük"}},zh_tw:{lineheight:"文字間距",lineheights:{.9:"小",normal:"正常",1.5:"大","2.0":"特大"}}}}),e.extend(!0,e.trumbowyg,{plugins:{lineheight:{init:function(e){e.addBtnDef("lineheight",{dropdown:n(e)})}}}})}(jQuery);
|
@@ -0,0 +1,98 @@
|
|
1
|
+
/* ===========================================================
|
2
|
+
* trumbowyg.mathMl.js v1.0
|
3
|
+
* MathML plugin for Trumbowyg
|
4
|
+
* https://github.com/loclamor/Trumbowyg/tree/mathml-plugin/plugins/mathml
|
5
|
+
* ===========================================================
|
6
|
+
* Author : loclamor
|
7
|
+
*/
|
8
|
+
|
9
|
+
/* globals MathJax */
|
10
|
+
(function($) {
|
11
|
+
'use strict';
|
12
|
+
$.extend(true, $.trumbowyg, {
|
13
|
+
langs: {
|
14
|
+
en: {
|
15
|
+
mathml: 'Insert Formulas',
|
16
|
+
formulas: 'Formulas',
|
17
|
+
inline: 'Inline'
|
18
|
+
},
|
19
|
+
da: {
|
20
|
+
mathml: 'Indsæt formler',
|
21
|
+
formulas: 'Formler',
|
22
|
+
inline: 'Inline'
|
23
|
+
},
|
24
|
+
fr: {
|
25
|
+
mathml: 'Inserer une formule',
|
26
|
+
formulas: 'Formule',
|
27
|
+
inline: 'En ligne'
|
28
|
+
},
|
29
|
+
tr: {
|
30
|
+
mathml: 'Formül Ekle',
|
31
|
+
formulas: 'Formüller',
|
32
|
+
inline: 'Satır içi'
|
33
|
+
},
|
34
|
+
zh_tw: {
|
35
|
+
mathml: '插入方程式',
|
36
|
+
formulas: '方程式',
|
37
|
+
inline: '內嵌'
|
38
|
+
},
|
39
|
+
},
|
40
|
+
plugins: {
|
41
|
+
mathml: {
|
42
|
+
init: function(trumbowyg) {
|
43
|
+
var btnDef = {
|
44
|
+
fn: function() {
|
45
|
+
trumbowyg.saveRange();
|
46
|
+
var mathMLoptions = {
|
47
|
+
formulas: {
|
48
|
+
label: trumbowyg.lang.formulas,
|
49
|
+
required: true,
|
50
|
+
value: ''
|
51
|
+
},
|
52
|
+
inline: {
|
53
|
+
label: trumbowyg.lang.inline,
|
54
|
+
attributes: {
|
55
|
+
checked: true
|
56
|
+
},
|
57
|
+
type: 'checkbox',
|
58
|
+
required: false,
|
59
|
+
}
|
60
|
+
};
|
61
|
+
|
62
|
+
var mathmlCallback = function(v) {
|
63
|
+
var delimitor = v.inline ? '$' : '$$';
|
64
|
+
if (trumbowyg.currentMathNode) {
|
65
|
+
$(trumbowyg.currentMathNode).html(delimitor + ' ' + v.formulas + ' ' + delimitor).attr('formulas', v.formulas).attr('inline', (v.inline ? 'true' : 'false'));
|
66
|
+
} else {
|
67
|
+
var html = '<span class="mathMlContainer" contenteditable="false" formulas="' + v.formulas + '" inline="' + (v.inline ? 'true' : 'false') + '" >' + delimitor + ' ' + v.formulas + ' ' + delimitor + '</span>';
|
68
|
+
var node = $(html)[0];
|
69
|
+
node.onclick = function(e) {
|
70
|
+
trumbowyg.currentMathNode = this;
|
71
|
+
mathMLoptions.formulas.value = $(this).attr('formulas');
|
72
|
+
if ($(this).attr('inline') === "true") {
|
73
|
+
mathMLoptions.inline.attributes.checked = true;
|
74
|
+
} else {
|
75
|
+
delete mathMLoptions.inline.attributes.checked;
|
76
|
+
}
|
77
|
+
trumbowyg.openModalInsert(trumbowyg.lang.mathml, mathMLoptions, mathmlCallback);
|
78
|
+
};
|
79
|
+
trumbowyg.range.deleteContents();
|
80
|
+
trumbowyg.range.insertNode(node);
|
81
|
+
}
|
82
|
+
|
83
|
+
trumbowyg.currentMathNode = false;
|
84
|
+
MathJax.Hub.Queue(['Typeset', MathJax.Hub]);
|
85
|
+
return true;
|
86
|
+
};
|
87
|
+
|
88
|
+
mathMLoptions.formulas.value = trumbowyg.getRangeText();
|
89
|
+
mathMLoptions.inline.attributes.checked = true;
|
90
|
+
trumbowyg.openModalInsert(trumbowyg.lang.mathml, mathMLoptions, mathmlCallback);
|
91
|
+
}
|
92
|
+
};
|
93
|
+
trumbowyg.addBtnDef('mathml', btnDef);
|
94
|
+
}
|
95
|
+
}
|
96
|
+
}
|
97
|
+
});
|
98
|
+
})(jQuery);
|
@@ -0,0 +1 @@
|
|
1
|
+
!function(e){"use strict";e.extend(!0,e.trumbowyg,{langs:{en:{mathml:"Insert Formulas",formulas:"Formulas",inline:"Inline"},da:{mathml:"Indsæt formler",formulas:"Formler",inline:"Inline"},fr:{mathml:"Inserer une formule",formulas:"Formule",inline:"En ligne"},tr:{mathml:"Formül Ekle",formulas:"Formüller",inline:"Satır içi"},zh_tw:{mathml:"插入方程式",formulas:"方程式",inline:"內嵌"}},plugins:{mathml:{init:function(n){var l={fn:function(){n.saveRange();var l={formulas:{label:n.lang.formulas,required:!0,value:""},inline:{label:n.lang.inline,attributes:{checked:!0},type:"checkbox",required:!1}},t=function(a){var r=a.inline?"$":"$$";if(n.currentMathNode)e(n.currentMathNode).html(r+" "+a.formulas+" "+r).attr("formulas",a.formulas).attr("inline",a.inline?"true":"false");else{var i='<span class="mathMlContainer" contenteditable="false" formulas="'+a.formulas+'" inline="'+(a.inline?"true":"false")+'" >'+r+" "+a.formulas+" "+r+"</span>",u=e(i)[0];u.onclick=function(a){n.currentMathNode=this,l.formulas.value=e(this).attr("formulas"),"true"===e(this).attr("inline")?l.inline.attributes.checked=!0:delete l.inline.attributes.checked,n.openModalInsert(n.lang.mathml,l,t)},n.range.deleteContents(),n.range.insertNode(u)}return n.currentMathNode=!1,MathJax.Hub.Queue(["Typeset",MathJax.Hub]),!0};l.formulas.value=n.getRangeText(),l.inline.attributes.checked=!0,n.openModalInsert(n.lang.mathml,l,t)}};n.addBtnDef("mathml",l)}}}})}(jQuery);
|
data/app/assets/javascripts/activeadmin/trumbowyg/plugins/mathml/ui/sass/trumbowyg.mathml.scss
ADDED
@@ -0,0 +1,36 @@
|
|
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
|
+
.mathMlContainer {
|
13
|
+
|
14
|
+
position: relative;
|
15
|
+
|
16
|
+
&[inline="false"] {
|
17
|
+
display: block;
|
18
|
+
width: 100%;
|
19
|
+
}
|
20
|
+
|
21
|
+
&:hover {
|
22
|
+
pointer-events: none;
|
23
|
+
&:after {
|
24
|
+
content: '\270E';
|
25
|
+
pointer-events: auto;
|
26
|
+
position: absolute;
|
27
|
+
left: 0px;
|
28
|
+
top: 0px;
|
29
|
+
background-color: #ffffffd4;
|
30
|
+
cursor: pointer;
|
31
|
+
bottom: 0px;
|
32
|
+
right: 0px;
|
33
|
+
box-shadow: 0 0 5px 5px #ffffffd4;
|
34
|
+
}
|
35
|
+
}
|
36
|
+
}
|
@@ -0,0 +1,29 @@
|
|
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
|
+
.mathMlContainer {
|
13
|
+
position: relative; }
|
14
|
+
.mathMlContainer[inline="false"] {
|
15
|
+
display: block;
|
16
|
+
width: 100%; }
|
17
|
+
.mathMlContainer:hover {
|
18
|
+
pointer-events: none; }
|
19
|
+
.mathMlContainer:hover:after {
|
20
|
+
content: '\270E';
|
21
|
+
pointer-events: auto;
|
22
|
+
position: absolute;
|
23
|
+
left: 0px;
|
24
|
+
top: 0px;
|
25
|
+
background-color: #ffffffd4;
|
26
|
+
cursor: pointer;
|
27
|
+
bottom: 0px;
|
28
|
+
right: 0px;
|
29
|
+
box-shadow: 0 0 5px 5px #ffffffd4; }
|
@@ -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
|
+
.mathMlContainer{position:relative}.mathMlContainer[inline=false]{display:block;width:100%}.mathMlContainer:hover{pointer-events:none}.mathMlContainer:hover:after{content:'\270E';pointer-events:auto;position:absolute;left:0;top:0;background-color:#fffd4;cursor:pointer;bottom:0;right:0;box-shadow:0 0 5px 5px #fffd4}
|
@@ -0,0 +1,111 @@
|
|
1
|
+
/* ===========================================================
|
2
|
+
* trumbowyg.mention.js v0.1
|
3
|
+
* Mention plugin for Trumbowyg
|
4
|
+
* http://alex-d.github.com/Trumbowyg
|
5
|
+
* ===========================================================
|
6
|
+
* Author : Viper
|
7
|
+
* Github: https://github.com/Globulopolis
|
8
|
+
* Website: http://киноархив.com
|
9
|
+
*/
|
10
|
+
|
11
|
+
(function ($) {
|
12
|
+
'use strict';
|
13
|
+
|
14
|
+
var defaultOptions = {
|
15
|
+
source: '',
|
16
|
+
formatDropdownItem: formatDropdownItem,
|
17
|
+
formatResult: formatResult
|
18
|
+
};
|
19
|
+
|
20
|
+
$.extend(true, $.trumbowyg, {
|
21
|
+
langs: {
|
22
|
+
en: {
|
23
|
+
mention: 'Mention'
|
24
|
+
},
|
25
|
+
da: {
|
26
|
+
mention: 'Nævn'
|
27
|
+
},
|
28
|
+
fr: {
|
29
|
+
mention: 'Mentioner'
|
30
|
+
},
|
31
|
+
ru: {
|
32
|
+
mention: 'Упомянуть'
|
33
|
+
},
|
34
|
+
tr: {
|
35
|
+
mention: 'Bahset'
|
36
|
+
},
|
37
|
+
zh_tw: {
|
38
|
+
mention: '標記'
|
39
|
+
},
|
40
|
+
},
|
41
|
+
|
42
|
+
plugins: {
|
43
|
+
mention: {
|
44
|
+
init: function (trumbowyg) {
|
45
|
+
trumbowyg.o.plugins.mention = $.extend(true, {}, defaultOptions, trumbowyg.o.plugins.mention || {});
|
46
|
+
|
47
|
+
var btnDef = {
|
48
|
+
dropdown: buildDropdown(trumbowyg.o.plugins.mention.source, trumbowyg)
|
49
|
+
};
|
50
|
+
|
51
|
+
trumbowyg.addBtnDef('mention', btnDef);
|
52
|
+
}
|
53
|
+
}
|
54
|
+
}
|
55
|
+
});
|
56
|
+
|
57
|
+
/**
|
58
|
+
* Build dropdown list
|
59
|
+
*
|
60
|
+
* @param {Array} items Items
|
61
|
+
* @param {object} trumbowyg Editor
|
62
|
+
*
|
63
|
+
* @return {Array}
|
64
|
+
*/
|
65
|
+
function buildDropdown(items, trumbowyg) {
|
66
|
+
var dropdown = [];
|
67
|
+
|
68
|
+
// Check if source is an array
|
69
|
+
if (items.constructor === Array) {
|
70
|
+
$.each(items, function (i, item) {
|
71
|
+
var btn = 'mention-' + i,
|
72
|
+
btnDef = {
|
73
|
+
hasIcon: false,
|
74
|
+
text: trumbowyg.o.plugins.mention.formatDropdownItem(item),
|
75
|
+
fn: function () {
|
76
|
+
trumbowyg.execCmd('insertHTML', trumbowyg.o.plugins.mention.formatResult(item));
|
77
|
+
|
78
|
+
return true;
|
79
|
+
}
|
80
|
+
};
|
81
|
+
|
82
|
+
trumbowyg.addBtnDef(btn, btnDef);
|
83
|
+
dropdown.push(btn);
|
84
|
+
});
|
85
|
+
}
|
86
|
+
|
87
|
+
return dropdown;
|
88
|
+
}
|
89
|
+
|
90
|
+
/**
|
91
|
+
* Format item in dropdown.
|
92
|
+
*
|
93
|
+
* @param {object} item Item object.
|
94
|
+
*
|
95
|
+
* @return {string}
|
96
|
+
*/
|
97
|
+
function formatDropdownItem(item) {
|
98
|
+
return item.login;
|
99
|
+
}
|
100
|
+
|
101
|
+
/**
|
102
|
+
* Format result pasted in editor.
|
103
|
+
*
|
104
|
+
* @param {object} item Item object.
|
105
|
+
*
|
106
|
+
* @return {string}
|
107
|
+
*/
|
108
|
+
function formatResult(item) {
|
109
|
+
return '@' + item.login + ' ';
|
110
|
+
}
|
111
|
+
})(jQuery);
|
@@ -0,0 +1 @@
|
|
1
|
+
!function(n){"use strict";function t(t,o){var e=[];return t.constructor===Array&&n.each(t,function(n,t){var i="mention-"+n,r={hasIcon:!1,text:o.o.plugins.mention.formatDropdownItem(t),fn:function(){return o.execCmd("insertHTML",o.o.plugins.mention.formatResult(t)),!0}};o.addBtnDef(i,r),e.push(i)}),e}function o(n){return n.login}function e(n){return"@"+n.login+" "}var i={source:"",formatDropdownItem:o,formatResult:e};n.extend(!0,n.trumbowyg,{langs:{en:{mention:"Mention"},da:{mention:"Nævn"},fr:{mention:"Mentioner"},ru:{mention:"Упомянуть"},tr:{mention:"Bahset"},zh_tw:{mention:"標記"}},plugins:{mention:{init:function(o){o.o.plugins.mention=n.extend(!0,{},i,o.o.plugins.mention||{});var e={dropdown:t(o.o.plugins.mention.source,o)};o.addBtnDef("mention",e)}}}})}(jQuery);
|