summernote-rails 0.8.8.1 → 0.8.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/lib/summernote-rails/version.rb +1 -1
- data/vendor/assets/javascripts/summernote/index.js +1 -1
- data/vendor/assets/javascripts/summernote/{locales/ar-AR.js → lang/summernote-ar-AR.js} +55 -4
- data/vendor/assets/javascripts/summernote/{locales/bg-BG.js → lang/summernote-bg-BG.js} +60 -4
- data/vendor/assets/javascripts/summernote/{locales/ca-ES.js → lang/summernote-ca-ES.js} +12 -4
- data/vendor/assets/javascripts/summernote/{locales/cs-CZ.js → lang/summernote-cs-CZ.js} +50 -4
- data/vendor/assets/javascripts/summernote/{locales/da-DK.js → lang/summernote-da-DK.js} +46 -5
- data/vendor/assets/javascripts/summernote/{locales/de-DE.js → lang/summernote-de-DE.js} +48 -4
- data/vendor/assets/javascripts/summernote/{locales/el-GR.js → lang/summernote-el-GR.js} +11 -3
- data/vendor/assets/javascripts/summernote/{locales/es-ES.js → lang/summernote-es-ES.js} +12 -4
- data/vendor/assets/javascripts/summernote/{locales/es-EU.js → lang/summernote-es-EU.js} +55 -4
- data/vendor/assets/javascripts/summernote/{locales/fa-IR.js → lang/summernote-fa-IR.js} +55 -5
- data/vendor/assets/javascripts/summernote/{locales/fi-FI.js → lang/summernote-fi-FI.js} +52 -3
- data/vendor/assets/javascripts/summernote/{locales/fr-FR.js → lang/summernote-fr-FR.js} +3 -2
- data/vendor/assets/javascripts/summernote/{locales/gl-ES.js → lang/summernote-gl-ES.js} +12 -4
- data/vendor/assets/javascripts/summernote/{locales/he-IL.js → lang/summernote-he-IL.js} +51 -3
- data/vendor/assets/javascripts/summernote/{locales/hr-HR.js → lang/summernote-hr-HR.js} +54 -3
- data/vendor/assets/javascripts/summernote/{locales/hu-HU.js → lang/summernote-hu-HU.js} +25 -5
- data/vendor/assets/javascripts/summernote/{locales/id-ID.js → lang/summernote-id-ID.js} +56 -4
- data/vendor/assets/javascripts/summernote/{locales/it-IT.js → lang/summernote-it-IT.js} +55 -4
- data/vendor/assets/javascripts/summernote/{locales/ja-JP.js → lang/summernote-ja-JP.js} +32 -10
- data/vendor/assets/javascripts/summernote/{locales/ko-KR.js → lang/summernote-ko-KR.js} +44 -4
- data/vendor/assets/javascripts/summernote/{locales/lt-LT.js → lang/summernote-lt-LT.js} +52 -4
- data/vendor/assets/javascripts/summernote/{locales/lt-LV.js → lang/summernote-lt-LV.js} +27 -7
- data/vendor/assets/javascripts/summernote/{locales/mn-MN.js → lang/summernote-mn-MN.js} +43 -4
- data/vendor/assets/javascripts/summernote/{locales/nb-NO.js → lang/summernote-nb-NO.js} +53 -3
- data/vendor/assets/javascripts/summernote/{locales/nl-NL.js → lang/summernote-nl-NL.js} +55 -4
- data/vendor/assets/javascripts/summernote/{locales/pl-PL.js → lang/summernote-pl-PL.js} +46 -3
- data/vendor/assets/javascripts/summernote/{locales/pt-BR.js → lang/summernote-pt-BR.js} +25 -8
- data/vendor/assets/javascripts/summernote/{locales/pt-PT.js → lang/summernote-pt-PT.js} +54 -3
- data/vendor/assets/javascripts/summernote/lang/summernote-ro-RO.js +155 -0
- data/vendor/assets/javascripts/summernote/{locales/ru-RU.js → lang/summernote-ru-RU.js} +46 -3
- data/vendor/assets/javascripts/summernote/{locales/sk-SK.js → lang/summernote-sk-SK.js} +54 -3
- data/vendor/assets/javascripts/summernote/{locales/sl-SI.js → lang/summernote-sl-SI.js} +53 -4
- data/vendor/assets/javascripts/summernote/{locales/sr-RS-Latin.js → lang/summernote-sr-RS-Latin.js} +54 -3
- data/vendor/assets/javascripts/summernote/{locales/sr-RS.js → lang/summernote-sr-RS.js} +54 -3
- data/vendor/assets/javascripts/summernote/{locales/sv-SE.js → lang/summernote-sv-SE.js} +55 -4
- data/vendor/assets/javascripts/summernote/{locales/ta-IN.js → lang/summernote-ta-IN.js} +46 -4
- data/vendor/assets/javascripts/summernote/lang/summernote-th-TH.js +155 -0
- data/vendor/assets/javascripts/summernote/{locales/tr-TR.js → lang/summernote-tr-TR.js} +3 -2
- data/vendor/assets/javascripts/summernote/{locales/uk-UA.js → lang/summernote-uk-UA.js} +48 -4
- data/vendor/assets/javascripts/summernote/{locales/vi-VN.js → lang/summernote-vi-VN.js} +55 -4
- data/vendor/assets/javascripts/summernote/{locales/zh-CN.js → lang/summernote-zh-CN.js} +20 -7
- data/vendor/assets/javascripts/summernote/{locales/zh-TW.js → lang/summernote-zh-TW.js} +45 -3
- data/vendor/assets/javascripts/summernote/plugin/databasic/summernote-ext-databasic.js +62 -73
- data/vendor/assets/javascripts/summernote/plugin/hello/summernote-ext-hello.js +9 -10
- data/vendor/assets/javascripts/summernote/plugin/specialchars/summernote-ext-specialchars.js +22 -25
- data/vendor/assets/javascripts/summernote/summernote-bs4.js +6389 -7094
- data/vendor/assets/javascripts/summernote/summernote-bs4.min.js +3 -0
- data/vendor/assets/javascripts/summernote/summernote-lite.js +7149 -7949
- data/vendor/assets/javascripts/summernote/summernote.js +6382 -7091
- data/vendor/assets/javascripts/summernote/summernote.min.js +3 -0
- data/vendor/assets/stylesheets/summernote-bs4.css +1 -1
- data/vendor/assets/stylesheets/summernote-custom-theme.css +4 -3
- data/vendor/assets/stylesheets/summernote-custom-theme.min.css +1 -1
- data/vendor/assets/stylesheets/summernote-lite.css +1 -1
- data/vendor/assets/stylesheets/summernote.css +1 -1
- metadata +45 -44
- data/vendor/assets/javascripts/summernote/locales/index.js +0 -1
- data/vendor/assets/javascripts/summernote/locales/ro-RO.js +0 -102
- data/vendor/assets/javascripts/summernote/locales/th-TH.js +0 -106
@@ -1,4 +1,4 @@
|
|
1
|
-
(function
|
1
|
+
(function($) {
|
2
2
|
$.extend($.summernote.lang, {
|
3
3
|
'zh-TW': {
|
4
4
|
font: {
|
@@ -27,11 +27,13 @@
|
|
27
27
|
shapeThumbnail: '形狀: 縮略圖',
|
28
28
|
shapeNone: '形狀: 無',
|
29
29
|
dragImageHere: '將圖片拖曳至此處',
|
30
|
+
dropImage: 'Drop image or Text',
|
30
31
|
selectFromFiles: '從本機上傳',
|
31
32
|
maximumFileSize: '文件大小最大值',
|
32
33
|
maximumFileSizeError: '文件大小超出最大值。',
|
33
34
|
url: '圖片網址',
|
34
|
-
remove: '移除圖片'
|
35
|
+
remove: '移除圖片',
|
36
|
+
original: 'Original'
|
35
37
|
},
|
36
38
|
video: {
|
37
39
|
video: '影片',
|
@@ -50,7 +52,14 @@
|
|
50
52
|
openInNewWindow: '在新視窗開啟'
|
51
53
|
},
|
52
54
|
table: {
|
53
|
-
table: '表格'
|
55
|
+
table: '表格',
|
56
|
+
addRowAbove: 'Add row above',
|
57
|
+
addRowBelow: 'Add row below',
|
58
|
+
addColLeft: 'Add column left',
|
59
|
+
addColRight: 'Add column right',
|
60
|
+
delRow: 'Delete row',
|
61
|
+
delCol: 'Delete column',
|
62
|
+
delTable: 'Delete table'
|
54
63
|
},
|
55
64
|
hr: {
|
56
65
|
insert: '水平線'
|
@@ -104,9 +113,42 @@
|
|
104
113
|
documentStyle: '文件格式',
|
105
114
|
extraKeys: '額外按鍵'
|
106
115
|
},
|
116
|
+
help: {
|
117
|
+
'insertParagraph': 'Insert Paragraph',
|
118
|
+
'undo': 'Undoes the last command',
|
119
|
+
'redo': 'Redoes the last command',
|
120
|
+
'tab': 'Tab',
|
121
|
+
'untab': 'Untab',
|
122
|
+
'bold': 'Set a bold style',
|
123
|
+
'italic': 'Set a italic style',
|
124
|
+
'underline': 'Set a underline style',
|
125
|
+
'strikethrough': 'Set a strikethrough style',
|
126
|
+
'removeFormat': 'Clean a style',
|
127
|
+
'justifyLeft': 'Set left align',
|
128
|
+
'justifyCenter': 'Set center align',
|
129
|
+
'justifyRight': 'Set right align',
|
130
|
+
'justifyFull': 'Set full align',
|
131
|
+
'insertUnorderedList': 'Toggle unordered list',
|
132
|
+
'insertOrderedList': 'Toggle ordered list',
|
133
|
+
'outdent': 'Outdent on current paragraph',
|
134
|
+
'indent': 'Indent on current paragraph',
|
135
|
+
'formatPara': 'Change current block\'s format as a paragraph(P tag)',
|
136
|
+
'formatH1': 'Change current block\'s format as H1',
|
137
|
+
'formatH2': 'Change current block\'s format as H2',
|
138
|
+
'formatH3': 'Change current block\'s format as H3',
|
139
|
+
'formatH4': 'Change current block\'s format as H4',
|
140
|
+
'formatH5': 'Change current block\'s format as H5',
|
141
|
+
'formatH6': 'Change current block\'s format as H6',
|
142
|
+
'insertHorizontalRule': 'Insert horizontal rule',
|
143
|
+
'linkDialog.show': 'Show Link Dialog'
|
144
|
+
},
|
107
145
|
history: {
|
108
146
|
undo: '復原',
|
109
147
|
redo: '取消復原'
|
148
|
+
},
|
149
|
+
specialChar: {
|
150
|
+
specialChar: 'SPECIAL CHARACTERS',
|
151
|
+
select: 'Select Special characters'
|
110
152
|
}
|
111
153
|
}
|
112
154
|
});
|
@@ -1,4 +1,4 @@
|
|
1
|
-
(function
|
1
|
+
(function(factory) {
|
2
2
|
/* global define */
|
3
3
|
if (typeof define === 'function' && define.amd) {
|
4
4
|
// AMD. Register as an anonymous module.
|
@@ -10,22 +10,21 @@
|
|
10
10
|
// Browser globals
|
11
11
|
factory(window.jQuery);
|
12
12
|
}
|
13
|
-
}(function
|
14
|
-
|
13
|
+
}(function($) {
|
15
14
|
// pull in some summernote core functions
|
16
15
|
var ui = $.summernote.ui;
|
17
16
|
var dom = $.summernote.dom;
|
18
17
|
|
19
18
|
// define the popover plugin
|
20
|
-
var DataBasicPlugin = function
|
19
|
+
var DataBasicPlugin = function(context) {
|
21
20
|
var self = this;
|
22
21
|
var options = context.options;
|
23
22
|
var lang = options.langInfo;
|
24
|
-
|
23
|
+
|
25
24
|
self.icon = '<i class="fa fa-object-group"/>';
|
26
25
|
|
27
26
|
// add context menu button for dialog
|
28
|
-
context.memo('button.databasic', function
|
27
|
+
context.memo('button.databasic', function() {
|
29
28
|
return ui.button({
|
30
29
|
contents: self.icon,
|
31
30
|
tooltip: lang.databasic.insert,
|
@@ -34,7 +33,7 @@
|
|
34
33
|
});
|
35
34
|
|
36
35
|
// add popover edit button
|
37
|
-
context.memo('button.databasicDialog', function
|
36
|
+
context.memo('button.databasicDialog', function() {
|
38
37
|
return ui.button({
|
39
38
|
contents: self.icon,
|
40
39
|
tooltip: lang.databasic.edit,
|
@@ -43,21 +42,21 @@
|
|
43
42
|
});
|
44
43
|
|
45
44
|
// add popover size buttons
|
46
|
-
context.memo('button.databasicSize100', function
|
45
|
+
context.memo('button.databasicSize100', function() {
|
47
46
|
return ui.button({
|
48
47
|
contents: '<span class="note-fontsize-10">100%</span>',
|
49
48
|
tooltip: lang.image.resizeFull,
|
50
49
|
click: context.createInvokeHandler('editor.resize', '1')
|
51
50
|
}).render();
|
52
51
|
});
|
53
|
-
context.memo('button.databasicSize50', function
|
52
|
+
context.memo('button.databasicSize50', function() {
|
54
53
|
return ui.button({
|
55
54
|
contents: '<span class="note-fontsize-10">50%</span>',
|
56
55
|
tooltip: lang.image.resizeHalf,
|
57
56
|
click: context.createInvokeHandler('editor.resize', '0.5')
|
58
57
|
}).render();
|
59
58
|
});
|
60
|
-
context.memo('button.databasicSize25', function
|
59
|
+
context.memo('button.databasicSize25', function() {
|
61
60
|
return ui.button({
|
62
61
|
contents: '<span class="note-fontsize-10">25%</span>',
|
63
62
|
tooltip: lang.image.resizeQuarter,
|
@@ -66,20 +65,20 @@
|
|
66
65
|
});
|
67
66
|
|
68
67
|
self.events = {
|
69
|
-
'summernote.init': function
|
68
|
+
'summernote.init': function(we, e) {
|
70
69
|
// update existing containers
|
71
|
-
$('data.ext-databasic', e.editable).each(function
|
70
|
+
$('data.ext-databasic', e.editable).each(function() { self.setContent($(this)); });
|
72
71
|
// TODO: make this an undo snapshot...
|
73
72
|
},
|
74
|
-
'summernote.keyup summernote.mouseup summernote.change summernote.scroll': function
|
73
|
+
'summernote.keyup summernote.mouseup summernote.change summernote.scroll': function() {
|
75
74
|
self.update();
|
76
75
|
},
|
77
|
-
'summernote.dialog.shown': function
|
76
|
+
'summernote.dialog.shown': function() {
|
78
77
|
self.hidePopover();
|
79
78
|
}
|
80
79
|
};
|
81
80
|
|
82
|
-
self.initialize = function
|
81
|
+
self.initialize = function() {
|
83
82
|
// create dialog markup
|
84
83
|
var $container = options.dialogsInBody ? $(document.body) : context.layoutInfo.editor;
|
85
84
|
|
@@ -95,24 +94,24 @@
|
|
95
94
|
body: body,
|
96
95
|
footer: footer
|
97
96
|
}).render().appendTo($container);
|
98
|
-
|
97
|
+
|
99
98
|
// create popover
|
100
99
|
self.$popover = ui.popover({
|
101
100
|
className: 'ext-databasic-popover'
|
102
101
|
}).render().appendTo('body');
|
103
102
|
var $content = self.$popover.find('.popover-content');
|
104
|
-
|
103
|
+
|
105
104
|
context.invoke('buttons.build', $content, options.popover.databasic);
|
106
105
|
};
|
107
106
|
|
108
|
-
self.destroy = function
|
107
|
+
self.destroy = function() {
|
109
108
|
self.$popover.remove();
|
110
109
|
self.$popover = null;
|
111
110
|
self.$dialog.remove();
|
112
111
|
self.$dialog = null;
|
113
112
|
};
|
114
|
-
|
115
|
-
self.update = function
|
113
|
+
|
114
|
+
self.update = function() {
|
116
115
|
// Prevent focusing on editable when invoke('code') is executed
|
117
116
|
if (!context.invoke('editor.hasFocus')) {
|
118
117
|
self.hidePopover();
|
@@ -121,50 +120,44 @@
|
|
121
120
|
|
122
121
|
var rng = context.invoke('editor.createRange');
|
123
122
|
var visible = false;
|
124
|
-
|
125
|
-
if (rng.isOnData())
|
126
|
-
{
|
123
|
+
|
124
|
+
if (rng.isOnData()) {
|
127
125
|
var $data = $(rng.sc).closest('data.ext-databasic');
|
128
|
-
|
129
|
-
if ($data.length)
|
130
|
-
{
|
126
|
+
|
127
|
+
if ($data.length) {
|
131
128
|
var pos = dom.posFromPlaceholder($data[0]);
|
132
|
-
|
129
|
+
|
133
130
|
self.$popover.css({
|
134
131
|
display: 'block',
|
135
132
|
left: pos.left,
|
136
133
|
top: pos.top
|
137
134
|
});
|
138
|
-
|
135
|
+
|
139
136
|
// save editor target to let size buttons resize the container
|
140
137
|
context.invoke('editor.saveTarget', $data[0]);
|
141
138
|
|
142
139
|
visible = true;
|
143
140
|
}
|
144
|
-
|
145
141
|
}
|
146
|
-
|
142
|
+
|
147
143
|
// hide if not visible
|
148
144
|
if (!visible) {
|
149
145
|
self.hidePopover();
|
150
146
|
}
|
151
|
-
|
152
147
|
};
|
153
148
|
|
154
|
-
self.hidePopover = function
|
149
|
+
self.hidePopover = function() {
|
155
150
|
self.$popover.hide();
|
156
151
|
};
|
157
152
|
|
158
153
|
// define plugin dialog
|
159
|
-
self.getInfo = function
|
154
|
+
self.getInfo = function() {
|
160
155
|
var rng = context.invoke('editor.createRange');
|
161
|
-
|
162
|
-
if (rng.isOnData())
|
163
|
-
{
|
156
|
+
|
157
|
+
if (rng.isOnData()) {
|
164
158
|
var $data = $(rng.sc).closest('data.ext-databasic');
|
165
|
-
|
166
|
-
if ($data.length)
|
167
|
-
{
|
159
|
+
|
160
|
+
if ($data.length) {
|
168
161
|
// Get the first node on range(for edit).
|
169
162
|
return {
|
170
163
|
node: $data,
|
@@ -172,21 +165,21 @@
|
|
172
165
|
};
|
173
166
|
}
|
174
167
|
}
|
175
|
-
|
168
|
+
|
176
169
|
return {};
|
177
170
|
};
|
178
171
|
|
179
|
-
self.setContent = function
|
172
|
+
self.setContent = function($node) {
|
180
173
|
$node.html('<p contenteditable="false">' + self.icon + ' ' + lang.databasic.name + ': ' +
|
181
174
|
$node.attr('data-test') + '</p>');
|
182
175
|
};
|
183
176
|
|
184
|
-
self.updateNode = function
|
177
|
+
self.updateNode = function(info) {
|
185
178
|
self.setContent(info.node
|
186
179
|
.attr('data-test', info.test));
|
187
180
|
};
|
188
181
|
|
189
|
-
self.createNode = function
|
182
|
+
self.createNode = function(info) {
|
190
183
|
var $node = $('<data class="ext-databasic"></data>');
|
191
184
|
|
192
185
|
if ($node) {
|
@@ -198,67 +191,64 @@
|
|
198
191
|
|
199
192
|
return $node;
|
200
193
|
};
|
201
|
-
|
202
|
-
self.showDialog = function
|
194
|
+
|
195
|
+
self.showDialog = function() {
|
203
196
|
var info = self.getInfo();
|
204
197
|
var newNode = !info.node;
|
205
198
|
context.invoke('editor.saveRange');
|
206
|
-
|
199
|
+
|
207
200
|
self
|
208
201
|
.openDialog(info)
|
209
|
-
.then(function
|
202
|
+
.then(function(dialogInfo) {
|
210
203
|
// [workaround] hide dialog before restore range for IE range focus
|
211
204
|
ui.hideDialog(self.$dialog);
|
212
205
|
context.invoke('editor.restoreRange');
|
213
|
-
|
206
|
+
|
214
207
|
// insert a new node
|
215
|
-
if (newNode)
|
216
|
-
{
|
208
|
+
if (newNode) {
|
217
209
|
self.createNode(info);
|
218
210
|
}
|
219
|
-
|
211
|
+
|
220
212
|
// update info with dialog info
|
221
213
|
$.extend(info, dialogInfo);
|
222
|
-
|
214
|
+
|
223
215
|
self.updateNode(info);
|
224
216
|
})
|
225
|
-
.fail(function
|
217
|
+
.fail(function() {
|
226
218
|
context.invoke('editor.restoreRange');
|
227
219
|
});
|
228
|
-
|
229
220
|
};
|
230
|
-
|
231
|
-
self.openDialog = function
|
232
|
-
return $.Deferred(function
|
221
|
+
|
222
|
+
self.openDialog = function(info) {
|
223
|
+
return $.Deferred(function(deferred) {
|
233
224
|
var $inpTest = self.$dialog.find('.ext-databasic-test');
|
234
225
|
var $saveBtn = self.$dialog.find('.ext-databasic-save');
|
235
|
-
var onKeyup = function
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
ui.onDialogShown(self.$dialog, function () {
|
226
|
+
var onKeyup = function(event) {
|
227
|
+
if (event.keyCode === 13) {
|
228
|
+
$saveBtn.trigger('click');
|
229
|
+
}
|
230
|
+
};
|
231
|
+
|
232
|
+
ui.onDialogShown(self.$dialog, function() {
|
243
233
|
context.triggerEvent('dialog.shown');
|
244
234
|
|
245
|
-
$inpTest.val(info.test).on('input', function
|
235
|
+
$inpTest.val(info.test).on('input', function() {
|
246
236
|
ui.toggleBtn($saveBtn, $inpTest.val());
|
247
237
|
}).trigger('focus').on('keyup', onKeyup);
|
248
238
|
|
249
239
|
$saveBtn
|
250
240
|
.text(info.node ? lang.databasic.edit : lang.databasic.insert)
|
251
|
-
.click(function
|
241
|
+
.click(function(event) {
|
252
242
|
event.preventDefault();
|
253
243
|
|
254
244
|
deferred.resolve({ test: $inpTest.val() });
|
255
245
|
});
|
256
|
-
|
246
|
+
|
257
247
|
// init save button
|
258
248
|
ui.toggleBtn($saveBtn, $inpTest.val());
|
259
249
|
});
|
260
250
|
|
261
|
-
ui.onDialogHidden(self.$dialog, function
|
251
|
+
ui.onDialogHidden(self.$dialog, function() {
|
262
252
|
$inpTest.off('input keyup');
|
263
253
|
$saveBtn.off('click');
|
264
254
|
|
@@ -277,7 +267,7 @@
|
|
277
267
|
plugins: {
|
278
268
|
databasic: DataBasicPlugin
|
279
269
|
},
|
280
|
-
|
270
|
+
|
281
271
|
options: {
|
282
272
|
popover: {
|
283
273
|
databasic: [
|
@@ -285,7 +275,7 @@
|
|
285
275
|
]
|
286
276
|
}
|
287
277
|
},
|
288
|
-
|
278
|
+
|
289
279
|
// add localization texts
|
290
280
|
lang: {
|
291
281
|
'en-US': {
|
@@ -297,7 +287,6 @@
|
|
297
287
|
}
|
298
288
|
}
|
299
289
|
}
|
300
|
-
|
301
|
-
});
|
302
290
|
|
291
|
+
});
|
303
292
|
}));
|
@@ -1,4 +1,4 @@
|
|
1
|
-
(function
|
1
|
+
(function(factory) {
|
2
2
|
/* global define */
|
3
3
|
if (typeof define === 'function' && define.amd) {
|
4
4
|
// AMD. Register as an anonymous module.
|
@@ -10,15 +10,14 @@
|
|
10
10
|
// Browser globals
|
11
11
|
factory(window.jQuery);
|
12
12
|
}
|
13
|
-
}(function
|
14
|
-
|
13
|
+
}(function($) {
|
15
14
|
// Extends plugins for adding hello.
|
16
15
|
// - plugin is external module for customizing.
|
17
16
|
$.extend($.summernote.plugins, {
|
18
17
|
/**
|
19
18
|
* @param {Object} context - context object has status of editor.
|
20
19
|
*/
|
21
|
-
'hello': function
|
20
|
+
'hello': function(context) {
|
22
21
|
var self = this;
|
23
22
|
|
24
23
|
// ui has renders to build ui elements.
|
@@ -26,12 +25,12 @@
|
|
26
25
|
var ui = $.summernote.ui;
|
27
26
|
|
28
27
|
// add hello button
|
29
|
-
context.memo('button.hello', function
|
28
|
+
context.memo('button.hello', function() {
|
30
29
|
// create button
|
31
30
|
var button = ui.button({
|
32
31
|
contents: '<i class="fa fa-child"/> Hello',
|
33
32
|
tooltip: 'hello',
|
34
|
-
click: function
|
33
|
+
click: function() {
|
35
34
|
self.$panel.show();
|
36
35
|
self.$panel.hide(500);
|
37
36
|
// invoke insertText method with 'hello' on editor module.
|
@@ -47,18 +46,18 @@
|
|
47
46
|
// This events will be attached when editor is initialized.
|
48
47
|
this.events = {
|
49
48
|
// This will be called after modules are initialized.
|
50
|
-
'summernote.init': function
|
49
|
+
'summernote.init': function(we, e) {
|
51
50
|
console.log('summernote initialized', we, e);
|
52
51
|
},
|
53
52
|
// This will be called when user releases a key on editable.
|
54
|
-
'summernote.keyup': function
|
53
|
+
'summernote.keyup': function(we, e) {
|
55
54
|
console.log('summernote keyup', we, e);
|
56
55
|
}
|
57
56
|
};
|
58
57
|
|
59
58
|
// This method will be called when editor is initialized by $('..').summernote();
|
60
59
|
// You can create elements for plugin
|
61
|
-
this.initialize = function
|
60
|
+
this.initialize = function() {
|
62
61
|
this.$panel = $('<div class="hello-panel"/>').css({
|
63
62
|
position: 'absolute',
|
64
63
|
width: 100,
|
@@ -73,7 +72,7 @@
|
|
73
72
|
|
74
73
|
// This methods will be called when editor is destroyed by $('..').summernote('destroy');
|
75
74
|
// You should remove elements on `initialize`.
|
76
|
-
this.destroy = function
|
75
|
+
this.destroy = function() {
|
77
76
|
this.$panel.remove();
|
78
77
|
this.$panel = null;
|
79
78
|
};
|