MCPcopy Index your code
hub / github.com/summernote/summernote / DataBasicPlugin

Function DataBasicPlugin

plugin/databasic/summernote-ext-databasic.js:18–262  ·  view source on GitHub ↗
(context)

Source from the content-addressed store, hash-verified

16
17 // define the popover plugin
18 var DataBasicPlugin = function(context) {
19 var self = this;
20 var options = context.options;
21 var lang = options.langInfo;
22
23 self.icon = '<i class="fa fa-object-group"></i>';
24
25 // add context menu button for dialog
26 context.memo('button.databasic', function() {
27 return ui.button({
28 contents: self.icon,
29 tooltip: lang.databasic.insert,
30 click: context.createInvokeHandler('databasic.showDialog'),
31 }).render();
32 });
33
34 // add popover edit button
35 context.memo('button.databasicDialog', function() {
36 return ui.button({
37 contents: self.icon,
38 tooltip: lang.databasic.edit,
39 click: context.createInvokeHandler('databasic.showDialog'),
40 }).render();
41 });
42
43 // add popover size buttons
44 context.memo('button.databasicSize100', function() {
45 return ui.button({
46 contents: '<span class="note-fontsize-10">100%</span>',
47 tooltip: lang.image.resizeFull,
48 click: context.createInvokeHandler('editor.resize', '1'),
49 }).render();
50 });
51 context.memo('button.databasicSize50', function() {
52 return ui.button({
53 contents: '<span class="note-fontsize-10">50%</span>',
54 tooltip: lang.image.resizeHalf,
55 click: context.createInvokeHandler('editor.resize', '0.5'),
56 }).render();
57 });
58 context.memo('button.databasicSize25', function() {
59 return ui.button({
60 contents: '<span class="note-fontsize-10">25%</span>',
61 tooltip: lang.image.resizeQuarter,
62 click: context.createInvokeHandler('editor.resize', '0.25'),
63 }).render();
64 });
65
66 self.events = {
67 'summernote.init': function(we, e) {
68 // update existing containers
69 $('data.ext-databasic', e.editable).each(function() { self.setContent($(this)); });
70 // TODO: make this an undo snapshot...
71 },
72 'summernote.keyup summernote.mouseup summernote.change summernote.scroll': function() {
73 self.update();
74 },
75 'summernote.dialog.shown': function() {

Callers

nothing calls this directly

Calls 8

memoMethod · 0.80
renderMethod · 0.80
buttonMethod · 0.80
createInvokeHandlerMethod · 0.80
invokeMethod · 0.80
triggerEventMethod · 0.80
updateMethod · 0.45
hideMethod · 0.45

Tested by

no test coverage detected