summernote-rails 0.8.1.1 → 0.8.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/summernote-rails/engine.rb +7 -1
- data/lib/summernote-rails/version.rb +1 -1
- data/vendor/assets/fonts/summernote.eot +0 -0
- data/vendor/assets/fonts/summernote.ttf +0 -0
- data/vendor/assets/fonts/summernote.woff +0 -0
- data/vendor/assets/javascripts/summernote/locales/ar-AR.js +1 -1
- data/vendor/assets/javascripts/summernote/locales/bg-BG.js +1 -1
- data/vendor/assets/javascripts/summernote/locales/ca-ES.js +3 -3
- data/vendor/assets/javascripts/summernote/locales/cs-CZ.js +1 -1
- data/vendor/assets/javascripts/summernote/locales/da-DK.js +1 -1
- data/vendor/assets/javascripts/summernote/locales/de-DE.js +2 -2
- data/vendor/assets/javascripts/summernote/locales/es-ES.js +3 -3
- data/vendor/assets/javascripts/summernote/locales/es-EU.js +2 -2
- data/vendor/assets/javascripts/summernote/locales/fa-IR.js +2 -2
- data/vendor/assets/javascripts/summernote/locales/fi-FI.js +1 -1
- data/vendor/assets/javascripts/summernote/locales/fr-FR.js +1 -1
- data/vendor/assets/javascripts/summernote/locales/gl-ES.js +147 -0
- data/vendor/assets/javascripts/summernote/locales/he-IL.js +1 -1
- data/vendor/assets/javascripts/summernote/locales/hr-HR.js +104 -0
- data/vendor/assets/javascripts/summernote/locales/hu-HU.js +2 -2
- data/vendor/assets/javascripts/summernote/locales/id-ID.js +2 -2
- data/vendor/assets/javascripts/summernote/locales/it-IT.js +1 -1
- data/vendor/assets/javascripts/summernote/locales/ja-JP.js +30 -1
- data/vendor/assets/javascripts/summernote/locales/ko-KR.js +1 -1
- data/vendor/assets/javascripts/summernote/locales/lt-LT.js +1 -1
- data/vendor/assets/javascripts/summernote/locales/lt-LV.js +135 -0
- data/vendor/assets/javascripts/summernote/locales/nb-NO.js +1 -1
- data/vendor/assets/javascripts/summernote/locales/nl-NL.js +1 -1
- data/vendor/assets/javascripts/summernote/locales/pl-PL.js +2 -2
- data/vendor/assets/javascripts/summernote/locales/pt-BR.js +37 -8
- data/vendor/assets/javascripts/summernote/locales/pt-PT.js +8 -1
- data/vendor/assets/javascripts/summernote/locales/ro-RO.js +2 -2
- data/vendor/assets/javascripts/summernote/locales/ru-RU.js +1 -1
- data/vendor/assets/javascripts/summernote/locales/sk-SK.js +1 -1
- data/vendor/assets/javascripts/summernote/locales/sl-SI.js +1 -1
- data/vendor/assets/javascripts/summernote/locales/sr-RS-Latin.js +1 -1
- data/vendor/assets/javascripts/summernote/locales/sr-RS.js +1 -1
- data/vendor/assets/javascripts/summernote/locales/sv-SE.js +1 -1
- data/vendor/assets/javascripts/summernote/locales/th-TH.js +1 -1
- data/vendor/assets/javascripts/summernote/locales/tr-TR.js +40 -4
- data/vendor/assets/javascripts/summernote/locales/uk-UA.js +1 -1
- data/vendor/assets/javascripts/summernote/locales/vi-VN.js +51 -51
- data/vendor/assets/javascripts/summernote/locales/zh-CN.js +1 -1
- data/vendor/assets/javascripts/summernote/locales/zh-TW.js +1 -1
- data/vendor/assets/javascripts/summernote/plugin/databasic/summernote-ext-databasic.css +16 -0
- data/vendor/assets/javascripts/summernote/plugin/databasic/summernote-ext-databasic.js +303 -0
- data/vendor/assets/javascripts/summernote/plugin/specialchars/summernote-ext-specialchars.js +3 -4
- data/vendor/assets/javascripts/summernote/summernote.js +175 -70
- data/vendor/assets/stylesheets/summernote.css +1 -1
- metadata +7 -2
@@ -27,7 +27,10 @@
|
|
27
27
|
shapeThumbnail: 'Şekil: K.Resim',
|
28
28
|
shapeNone: 'Şekil: Yok',
|
29
29
|
dragImageHere: 'Buraya sürükleyin',
|
30
|
+
dropImage: 'Resim veya metni bırakın',
|
30
31
|
selectFromFiles: 'Dosya seçin',
|
32
|
+
maximumFileSize: 'Maksimum dosya boyutu',
|
33
|
+
maximumFileSizeError: 'Maksimum dosya boyutu aşıldı.',
|
31
34
|
url: 'Resim bağlantısı',
|
32
35
|
remove: 'Resimi Kaldır'
|
33
36
|
},
|
@@ -55,7 +58,7 @@
|
|
55
58
|
},
|
56
59
|
style: {
|
57
60
|
style: 'Biçim',
|
58
|
-
|
61
|
+
p: 'p',
|
59
62
|
blockquote: 'Alıntı',
|
60
63
|
pre: 'Önbiçimli',
|
61
64
|
h1: 'Başlık 1',
|
@@ -99,13 +102,46 @@
|
|
99
102
|
textFormatting: 'Yazı biçimlendirme',
|
100
103
|
action: 'Eylem',
|
101
104
|
paragraphFormatting: 'Paragraf biçimlendirme',
|
102
|
-
documentStyle: 'Biçim'
|
105
|
+
documentStyle: 'Biçim',
|
106
|
+
extraKeys: 'İlave anahtarlar'
|
107
|
+
},
|
108
|
+
help: {
|
109
|
+
'insertParagraph': 'Paragraf ekler',
|
110
|
+
'undo': 'Son komudu geri alır',
|
111
|
+
'redo': 'Son komudu yineler',
|
112
|
+
'tab': 'Girintiyi artırır',
|
113
|
+
'untab': 'Girintiyi azaltır',
|
114
|
+
'bold': 'Kalın yazma stilini ayarlar',
|
115
|
+
'italic': 'İtalik yazma stilini ayarlar',
|
116
|
+
'underline': 'Altı çizgili yazma stilini ayarlar',
|
117
|
+
'strikethrough': 'Üstü çizgili yazma stilini ayarlar',
|
118
|
+
'removeFormat': 'Biçimlendirmeyi temizler',
|
119
|
+
'justifyLeft': 'Yazıyı sola hizalar',
|
120
|
+
'justifyCenter': 'Yazıyı ortalar',
|
121
|
+
'justifyRight': 'Yazıyı sağa hizalar',
|
122
|
+
'justifyFull': 'Yazıyı her iki tarafa yazlar',
|
123
|
+
'insertUnorderedList': 'Madde işaretli liste ekler',
|
124
|
+
'insertOrderedList': 'Numaralı liste ekler',
|
125
|
+
'outdent': 'Aktif paragrafın girintisini azaltır',
|
126
|
+
'indent': 'Aktif paragrafın girintisini artırır',
|
127
|
+
'formatPara': 'Aktif bloğun biçimini paragraf (p) olarak değiştirir',
|
128
|
+
'formatH1': 'Aktif bloğun biçimini başlık 1 (h1) olarak değiştirir',
|
129
|
+
'formatH2': 'Aktif bloğun biçimini başlık 2 (h2) olarak değiştirir',
|
130
|
+
'formatH3': 'Aktif bloğun biçimini başlık 3 (h3) olarak değiştirir',
|
131
|
+
'formatH4': 'Aktif bloğun biçimini başlık 4 (h4) olarak değiştirir',
|
132
|
+
'formatH5': 'Aktif bloğun biçimini başlık 5 (h5) olarak değiştirir',
|
133
|
+
'formatH6': 'Aktif bloğun biçimini başlık 6 (h6) olarak değiştirir',
|
134
|
+
'insertHorizontalRule': 'Yatay çizgi ekler',
|
135
|
+
'linkDialog.show': 'Bağlantı ayar kutusunu gösterir'
|
103
136
|
},
|
104
137
|
history: {
|
105
138
|
undo: 'Geri al',
|
106
|
-
redo: '
|
139
|
+
redo: 'Yinele'
|
140
|
+
},
|
141
|
+
specialChar: {
|
142
|
+
specialChar: 'ÖZEL KARAKTERLER',
|
143
|
+
select: 'Özel Karakterleri seçin'
|
107
144
|
}
|
108
|
-
|
109
145
|
}
|
110
146
|
});
|
111
147
|
})(jQuery);
|
@@ -3,54 +3,54 @@
|
|
3
3
|
'vi-VN': {
|
4
4
|
font: {
|
5
5
|
bold: 'In Đậm',
|
6
|
-
italic: 'In
|
7
|
-
underline: 'Gạch
|
8
|
-
clear: 'Bỏ
|
9
|
-
height: '
|
10
|
-
name: 'Phông
|
11
|
-
strikethrough: 'Gạch
|
12
|
-
size: 'Cỡ
|
6
|
+
italic: 'In Nghiêng',
|
7
|
+
underline: 'Gạch dưới',
|
8
|
+
clear: 'Bỏ định dạng',
|
9
|
+
height: 'Chiều cao dòng',
|
10
|
+
name: 'Phông chữ',
|
11
|
+
strikethrough: 'Gạch ngang',
|
12
|
+
size: 'Cỡ chữ'
|
13
13
|
},
|
14
14
|
image: {
|
15
|
-
image: 'Hình
|
15
|
+
image: 'Hình ảnh',
|
16
16
|
insert: 'Chèn',
|
17
17
|
resizeFull: '100%',
|
18
18
|
resizeHalf: '50%',
|
19
19
|
resizeQuarter: '25%',
|
20
|
-
floatLeft: '
|
21
|
-
floatRight: '
|
22
|
-
floatNone: '
|
23
|
-
dragImageHere: 'Thả Ảnh
|
24
|
-
selectFromFiles: 'Chọn
|
20
|
+
floatLeft: 'Trôi về trái',
|
21
|
+
floatRight: 'Trôi về phải',
|
22
|
+
floatNone: 'Không trôi',
|
23
|
+
dragImageHere: 'Thả Ảnh ở vùng này',
|
24
|
+
selectFromFiles: 'Chọn từ File',
|
25
25
|
url: 'URL',
|
26
|
-
remove: '
|
26
|
+
remove: 'Xóa'
|
27
27
|
},
|
28
28
|
video: {
|
29
29
|
video: 'Video',
|
30
|
-
videoLink: '
|
30
|
+
videoLink: 'Link đến Video',
|
31
31
|
insert: 'Chèn Video',
|
32
32
|
url: 'URL',
|
33
33
|
providers: '(YouTube, Vimeo, Vine, Instagram, DailyMotion và Youku)'
|
34
34
|
},
|
35
35
|
link: {
|
36
|
-
link: '
|
37
|
-
insert: 'Chèn
|
38
|
-
unlink: '
|
36
|
+
link: 'Link',
|
37
|
+
insert: 'Chèn Link',
|
38
|
+
unlink: 'Gỡ Link',
|
39
39
|
edit: 'Sửa',
|
40
|
-
textToDisplay: '
|
40
|
+
textToDisplay: 'Văn bản hiển thị',
|
41
41
|
url: 'URL',
|
42
|
-
openInNewWindow: 'Mở ở Cửa
|
42
|
+
openInNewWindow: 'Mở ở Cửa sổ mới'
|
43
43
|
},
|
44
44
|
table: {
|
45
45
|
table: 'Bảng'
|
46
46
|
},
|
47
47
|
hr: {
|
48
|
-
insert: 'Chèn
|
48
|
+
insert: 'Chèn'
|
49
49
|
},
|
50
50
|
style: {
|
51
|
-
style: 'Kiểu
|
52
|
-
|
53
|
-
blockquote: 'Đoạn
|
51
|
+
style: 'Kiểu chữ',
|
52
|
+
p: 'Chữ thường',
|
53
|
+
blockquote: 'Đoạn trích',
|
54
54
|
pre: 'Mã Code',
|
55
55
|
h1: 'H1',
|
56
56
|
h2: 'H2',
|
@@ -60,44 +60,44 @@
|
|
60
60
|
h6: 'H6'
|
61
61
|
},
|
62
62
|
lists: {
|
63
|
-
unordered: 'Liệt
|
64
|
-
ordered: 'Liệt
|
63
|
+
unordered: 'Liệt kê danh sách',
|
64
|
+
ordered: 'Liệt kê theo thứ tự'
|
65
65
|
},
|
66
66
|
options: {
|
67
|
-
help: 'Trợ
|
68
|
-
fullscreen: '
|
69
|
-
codeview: 'Xem
|
67
|
+
help: 'Trợ giúp',
|
68
|
+
fullscreen: 'Toàn Màn hình',
|
69
|
+
codeview: 'Xem Code'
|
70
70
|
},
|
71
71
|
paragraph: {
|
72
|
-
paragraph: 'Canh
|
73
|
-
outdent: 'Dịch
|
74
|
-
indent: 'Dịch
|
75
|
-
left: 'Canh
|
76
|
-
center: 'Canh
|
77
|
-
right: 'Canh
|
78
|
-
justify: 'Canh
|
72
|
+
paragraph: 'Canh lề',
|
73
|
+
outdent: 'Dịch sang trái',
|
74
|
+
indent: 'Dịch sang phải',
|
75
|
+
left: 'Canh trái',
|
76
|
+
center: 'Canh giữa',
|
77
|
+
right: 'Canh phải',
|
78
|
+
justify: 'Canh đều'
|
79
79
|
},
|
80
80
|
color: {
|
81
|
-
recent: 'Màu
|
82
|
-
more: 'Mở
|
83
|
-
background: 'Màu
|
84
|
-
foreground: 'Màu
|
85
|
-
transparent: '
|
86
|
-
setTransparent: 'Nền
|
87
|
-
reset: '
|
88
|
-
resetToDefault: 'Trở
|
81
|
+
recent: 'Màu chữ',
|
82
|
+
more: 'Mở rộng',
|
83
|
+
background: 'Màu nền',
|
84
|
+
foreground: 'Màu chữ',
|
85
|
+
transparent: 'trong suốt',
|
86
|
+
setTransparent: 'Nền trong suốt',
|
87
|
+
reset: 'Thiết lập lại',
|
88
|
+
resetToDefault: 'Trở lại ban đầu'
|
89
89
|
},
|
90
90
|
shortcut: {
|
91
|
-
shortcuts: 'Phím
|
91
|
+
shortcuts: 'Phím tắt',
|
92
92
|
close: 'Đóng',
|
93
|
-
textFormatting: 'Định
|
94
|
-
action: 'Hành
|
95
|
-
paragraphFormatting: 'Định
|
96
|
-
documentStyle: 'Kiểu
|
93
|
+
textFormatting: 'Định dạng Văn bản',
|
94
|
+
action: 'Hành động',
|
95
|
+
paragraphFormatting: 'Định dạng',
|
96
|
+
documentStyle: 'Kiểu văn bản'
|
97
97
|
},
|
98
98
|
history: {
|
99
|
-
undo: 'Lùi
|
100
|
-
redo: 'Làm
|
99
|
+
undo: 'Lùi lại',
|
100
|
+
redo: 'Làm lại'
|
101
101
|
}
|
102
102
|
}
|
103
103
|
});
|
@@ -0,0 +1,16 @@
|
|
1
|
+
.ext-databasic {
|
2
|
+
position: relative;
|
3
|
+
display: block;
|
4
|
+
min-height: 50px;
|
5
|
+
background-color: cyan;
|
6
|
+
text-align: center;
|
7
|
+
padding: 20px;
|
8
|
+
border: 1px solid white;
|
9
|
+
border-radius: 10px;
|
10
|
+
}
|
11
|
+
|
12
|
+
.ext-databasic p {
|
13
|
+
color: white;
|
14
|
+
font-size: 1.2em;
|
15
|
+
margin: 0;
|
16
|
+
}
|
@@ -0,0 +1,303 @@
|
|
1
|
+
(function (factory) {
|
2
|
+
/* global define */
|
3
|
+
if (typeof define === 'function' && define.amd) {
|
4
|
+
// AMD. Register as an anonymous module.
|
5
|
+
define(['jquery'], factory);
|
6
|
+
} else if (typeof module === 'object' && module.exports) {
|
7
|
+
// Node/CommonJS
|
8
|
+
module.exports = factory(require('jquery'));
|
9
|
+
} else {
|
10
|
+
// Browser globals
|
11
|
+
factory(window.jQuery);
|
12
|
+
}
|
13
|
+
}(function ($) {
|
14
|
+
|
15
|
+
// pull in some summernote core functions
|
16
|
+
var ui = $.summernote.ui;
|
17
|
+
var dom = $.summernote.dom;
|
18
|
+
|
19
|
+
// define the popover plugin
|
20
|
+
var DataBasicPlugin = function (context) {
|
21
|
+
var self = this;
|
22
|
+
var options = context.options;
|
23
|
+
var lang = options.langInfo;
|
24
|
+
|
25
|
+
self.icon = '<i class="fa fa-object-group"/>';
|
26
|
+
|
27
|
+
// add context menu button for dialog
|
28
|
+
context.memo('button.databasic', function () {
|
29
|
+
return ui.button({
|
30
|
+
contents: self.icon,
|
31
|
+
tooltip: lang.databasic.insert,
|
32
|
+
click: context.createInvokeHandler('databasic.showDialog')
|
33
|
+
}).render();
|
34
|
+
});
|
35
|
+
|
36
|
+
// add popover edit button
|
37
|
+
context.memo('button.databasicDialog', function () {
|
38
|
+
return ui.button({
|
39
|
+
contents: self.icon,
|
40
|
+
tooltip: lang.databasic.edit,
|
41
|
+
click: context.createInvokeHandler('databasic.showDialog')
|
42
|
+
}).render();
|
43
|
+
});
|
44
|
+
|
45
|
+
// add popover size buttons
|
46
|
+
context.memo('button.databasicSize100', function () {
|
47
|
+
return ui.button({
|
48
|
+
contents: '<span class="note-fontsize-10">100%</span>',
|
49
|
+
tooltip: lang.image.resizeFull,
|
50
|
+
click: context.createInvokeHandler('editor.resize', '1')
|
51
|
+
}).render();
|
52
|
+
});
|
53
|
+
context.memo('button.databasicSize50', function () {
|
54
|
+
return ui.button({
|
55
|
+
contents: '<span class="note-fontsize-10">50%</span>',
|
56
|
+
tooltip: lang.image.resizeHalf,
|
57
|
+
click: context.createInvokeHandler('editor.resize', '0.5')
|
58
|
+
}).render();
|
59
|
+
});
|
60
|
+
context.memo('button.databasicSize25', function () {
|
61
|
+
return ui.button({
|
62
|
+
contents: '<span class="note-fontsize-10">25%</span>',
|
63
|
+
tooltip: lang.image.resizeQuarter,
|
64
|
+
click: context.createInvokeHandler('editor.resize', '0.25')
|
65
|
+
}).render();
|
66
|
+
});
|
67
|
+
|
68
|
+
self.events = {
|
69
|
+
'summernote.init': function (we, e) {
|
70
|
+
// update existing containers
|
71
|
+
$('data.ext-databasic', e.editable).each(function () { self.setContent($(this)); });
|
72
|
+
// TODO: make this an undo snapshot...
|
73
|
+
},
|
74
|
+
'summernote.keyup summernote.mouseup summernote.change summernote.scroll': function () {
|
75
|
+
self.update();
|
76
|
+
},
|
77
|
+
'summernote.dialog.shown': function () {
|
78
|
+
self.hidePopover();
|
79
|
+
}
|
80
|
+
};
|
81
|
+
|
82
|
+
self.initialize = function () {
|
83
|
+
// create dialog markup
|
84
|
+
var $container = options.dialogsInBody ? $(document.body) : context.layoutInfo.editor;
|
85
|
+
|
86
|
+
var body = '<div class="form-group row-fluid">' +
|
87
|
+
'<label>' + lang.databasic.testLabel + '</label>' +
|
88
|
+
'<input class="ext-databasic-test form-control" type="text" />' +
|
89
|
+
'</div>';
|
90
|
+
var footer = '<button href="#" class="btn btn-primary ext-databasic-save">' + lang.databasic.insert + '</button>';
|
91
|
+
|
92
|
+
self.$dialog = ui.dialog({
|
93
|
+
title: lang.databasic.name,
|
94
|
+
fade: options.dialogsFade,
|
95
|
+
body: body,
|
96
|
+
footer: footer
|
97
|
+
}).render().appendTo($container);
|
98
|
+
|
99
|
+
// create popover
|
100
|
+
self.$popover = ui.popover({
|
101
|
+
className: 'ext-databasic-popover'
|
102
|
+
}).render().appendTo('body');
|
103
|
+
var $content = self.$popover.find('.popover-content');
|
104
|
+
|
105
|
+
context.invoke('buttons.build', $content, options.popover.databasic);
|
106
|
+
};
|
107
|
+
|
108
|
+
self.destroy = function () {
|
109
|
+
self.$popover.remove();
|
110
|
+
self.$popover = null;
|
111
|
+
self.$dialog.remove();
|
112
|
+
self.$dialog = null;
|
113
|
+
};
|
114
|
+
|
115
|
+
self.update = function () {
|
116
|
+
// Prevent focusing on editable when invoke('code') is executed
|
117
|
+
if (!context.invoke('editor.hasFocus')) {
|
118
|
+
self.hidePopover();
|
119
|
+
return;
|
120
|
+
}
|
121
|
+
|
122
|
+
var rng = context.invoke('editor.createRange');
|
123
|
+
var visible = false;
|
124
|
+
|
125
|
+
if (rng.isOnData())
|
126
|
+
{
|
127
|
+
var $data = $(rng.sc).closest('data.ext-databasic');
|
128
|
+
|
129
|
+
if ($data.length)
|
130
|
+
{
|
131
|
+
var pos = dom.posFromPlaceholder($data[0]);
|
132
|
+
|
133
|
+
self.$popover.css({
|
134
|
+
display: 'block',
|
135
|
+
left: pos.left,
|
136
|
+
top: pos.top
|
137
|
+
});
|
138
|
+
|
139
|
+
// save editor target to let size buttons resize the container
|
140
|
+
context.invoke('editor.saveTarget', $data[0]);
|
141
|
+
|
142
|
+
visible = true;
|
143
|
+
}
|
144
|
+
|
145
|
+
}
|
146
|
+
|
147
|
+
// hide if not visible
|
148
|
+
if (!visible) {
|
149
|
+
self.hidePopover();
|
150
|
+
}
|
151
|
+
|
152
|
+
};
|
153
|
+
|
154
|
+
self.hidePopover = function () {
|
155
|
+
self.$popover.hide();
|
156
|
+
};
|
157
|
+
|
158
|
+
// define plugin dialog
|
159
|
+
self.getInfo = function () {
|
160
|
+
var rng = context.invoke('editor.createRange');
|
161
|
+
|
162
|
+
if (rng.isOnData())
|
163
|
+
{
|
164
|
+
var $data = $(rng.sc).closest('data.ext-databasic');
|
165
|
+
|
166
|
+
if ($data.length)
|
167
|
+
{
|
168
|
+
// Get the first node on range(for edit).
|
169
|
+
return {
|
170
|
+
node: $data,
|
171
|
+
test: $data.attr('data-test')
|
172
|
+
};
|
173
|
+
}
|
174
|
+
}
|
175
|
+
|
176
|
+
return {};
|
177
|
+
};
|
178
|
+
|
179
|
+
self.setContent = function ($node) {
|
180
|
+
$node.html('<p contenteditable="false">' + self.icon + ' ' + lang.databasic.name + ': ' +
|
181
|
+
$node.attr('data-test') + '</p>');
|
182
|
+
};
|
183
|
+
|
184
|
+
self.updateNode = function (info) {
|
185
|
+
self.setContent(info.node
|
186
|
+
.attr('data-test', info.test));
|
187
|
+
};
|
188
|
+
|
189
|
+
self.createNode = function (info) {
|
190
|
+
var $node = $('<data class="ext-databasic"></data>');
|
191
|
+
|
192
|
+
if ($node) {
|
193
|
+
// save node to info structure
|
194
|
+
info.node = $node;
|
195
|
+
// insert node into editor dom
|
196
|
+
context.invoke('editor.insertNode', $node[0]);
|
197
|
+
}
|
198
|
+
|
199
|
+
return $node;
|
200
|
+
};
|
201
|
+
|
202
|
+
self.showDialog = function () {
|
203
|
+
var info = self.getInfo();
|
204
|
+
var newNode = !info.node;
|
205
|
+
context.invoke('editor.saveRange');
|
206
|
+
|
207
|
+
self
|
208
|
+
.openDialog(info)
|
209
|
+
.then(function (dialogInfo) {
|
210
|
+
// [workaround] hide dialog before restore range for IE range focus
|
211
|
+
ui.hideDialog(self.$dialog);
|
212
|
+
context.invoke('editor.restoreRange');
|
213
|
+
|
214
|
+
// insert a new node
|
215
|
+
if (newNode)
|
216
|
+
{
|
217
|
+
self.createNode(info);
|
218
|
+
}
|
219
|
+
|
220
|
+
// update info with dialog info
|
221
|
+
$.extend(info, dialogInfo);
|
222
|
+
|
223
|
+
self.updateNode(info);
|
224
|
+
})
|
225
|
+
.fail(function () {
|
226
|
+
context.invoke('editor.restoreRange');
|
227
|
+
});
|
228
|
+
|
229
|
+
};
|
230
|
+
|
231
|
+
self.openDialog = function (info) {
|
232
|
+
return $.Deferred(function (deferred) {
|
233
|
+
var $inpTest = self.$dialog.find('.ext-databasic-test');
|
234
|
+
var $saveBtn = self.$dialog.find('.ext-databasic-save');
|
235
|
+
var onKeyup = function (event) {
|
236
|
+
if (event.keyCode === 13)
|
237
|
+
{
|
238
|
+
$saveBtn.trigger('click');
|
239
|
+
}
|
240
|
+
};
|
241
|
+
|
242
|
+
ui.onDialogShown(self.$dialog, function () {
|
243
|
+
context.triggerEvent('dialog.shown');
|
244
|
+
|
245
|
+
$inpTest.val(info.test).on('input', function () {
|
246
|
+
ui.toggleBtn($saveBtn, $inpTest.val());
|
247
|
+
}).trigger('focus').on('keyup', onKeyup);
|
248
|
+
|
249
|
+
$saveBtn
|
250
|
+
.text(info.node ? lang.databasic.edit : lang.databasic.insert)
|
251
|
+
.click(function (event) {
|
252
|
+
event.preventDefault();
|
253
|
+
|
254
|
+
deferred.resolve({ test: $inpTest.val() });
|
255
|
+
});
|
256
|
+
|
257
|
+
// init save button
|
258
|
+
ui.toggleBtn($saveBtn, $inpTest.val());
|
259
|
+
});
|
260
|
+
|
261
|
+
ui.onDialogHidden(self.$dialog, function () {
|
262
|
+
$inpTest.off('input keyup');
|
263
|
+
$saveBtn.off('click');
|
264
|
+
|
265
|
+
if (deferred.state() === 'pending') {
|
266
|
+
deferred.reject();
|
267
|
+
}
|
268
|
+
});
|
269
|
+
|
270
|
+
ui.showDialog(self.$dialog);
|
271
|
+
});
|
272
|
+
};
|
273
|
+
};
|
274
|
+
|
275
|
+
// Extends summernote
|
276
|
+
$.extend(true, $.summernote, {
|
277
|
+
plugins: {
|
278
|
+
databasic: DataBasicPlugin
|
279
|
+
},
|
280
|
+
|
281
|
+
options: {
|
282
|
+
popover: {
|
283
|
+
databasic: [
|
284
|
+
['databasic', ['databasicDialog', 'databasicSize100', 'databasicSize50', 'databasicSize25']]
|
285
|
+
]
|
286
|
+
}
|
287
|
+
},
|
288
|
+
|
289
|
+
// add localization texts
|
290
|
+
lang: {
|
291
|
+
'en-US': {
|
292
|
+
databasic: {
|
293
|
+
name: 'Basic Data Container',
|
294
|
+
insert: 'insert basic data container',
|
295
|
+
edit: 'edit basic data container',
|
296
|
+
testLabel: 'test input'
|
297
|
+
}
|
298
|
+
}
|
299
|
+
}
|
300
|
+
|
301
|
+
});
|
302
|
+
|
303
|
+
}));
|