suneditor 2.43.4 → 2.43.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -1
- package/dist/suneditor.min.js +2 -2
- package/package.json +1 -1
- package/src/assets/defaultIcons.js +2 -2
- package/src/lib/constructor.js +49 -34
- package/src/lib/context.js +17 -17
- package/src/lib/core.d.ts +0 -17
- package/src/lib/core.js +418 -234
- package/src/lib/util.d.ts +13 -0
- package/src/lib/util.js +45 -1
- package/src/plugins/dialog/audio.js +12 -8
- package/src/plugins/dialog/image.js +14 -10
- package/src/plugins/dialog/link.js +2 -2
- package/src/plugins/dialog/math.js +2 -2
- package/src/plugins/dialog/mention.js +1 -1
- package/src/plugins/dialog/video.js +14 -10
- package/src/plugins/modules/_anchor.js +2 -2
- package/src/plugins/modules/_colorPicker.js +3 -3
- package/src/plugins/modules/fileBrowser.js +2 -2
- package/src/plugins/submenu/align.js +1 -1
- package/src/plugins/submenu/font.js +3 -14
- package/src/plugins/submenu/fontSize.js +2 -2
- package/src/plugins/submenu/formatBlock.js +1 -1
- package/src/plugins/submenu/horizontalRule.js +1 -1
- package/src/plugins/submenu/lineHeight.js +2 -2
- package/src/plugins/submenu/list.js +2 -2
- package/src/plugins/submenu/paragraphStyle.js +1 -1
- package/src/plugins/submenu/table.js +2 -2
- package/src/plugins/submenu/template.js +1 -1
- package/src/plugins/submenu/textStyle.js +1 -1
package/package.json
CHANGED
|
@@ -28,8 +28,8 @@ export default {
|
|
|
28
28
|
subscript: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.75 14.61"><g><path d="M15.38,4.33H12.74L11.19,7c-.28.46-.51.87-.69,1.21L10.07,9h0l-.44-.8c-.22-.4-.45-.81-.71-1.23L7.34,4.33H4.68L8.26,10,4.4,16.08H7.1l1.69-2.83c.38-.63.72-1.22,1-1.78l.25-.46h0l.49.92c.24.45.48.89.74,1.32L13,16.08h2.61L11.84,10l1.77-2.84,1.77-2.85Zm4.77,13.75H17v-.15c0-.4.05-.64.16-.72a4.42,4.42,0,0,1,1.16-.31,3.3,3.3,0,0,0,1.54-.56A1.84,1.84,0,0,0,20.15,15a1.78,1.78,0,0,0-.44-1.41A2.8,2.8,0,0,0,18,13.25a2.71,2.71,0,0,0-1.69.37,1.83,1.83,0,0,0-.44,1.43v.23H17v-.23q0-.63.18-.78a1.62,1.62,0,0,1,.88-.15,1.59,1.59,0,0,1,.88.15q.18.15.18.75t-.18.75a3.58,3.58,0,0,1-1.18.33,3.33,3.33,0,0,0-1.52.51,1.57,1.57,0,0,0-.32,1.18v1.15h4.27v-.86Z" transform="translate(-4.4 -4.33)"/></g></svg>',
|
|
29
29
|
superscript: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.75 15.42"><g><path d="M12,13.14l3.61-5.81H12.94L11.33,10c-.28.46-.51.88-.69,1.25l-.45.83h0l-.45-.85c-.22-.41-.45-.82-.71-1.24L7.4,7.33H4.68l3.66,5.81L4.4,19.33H7.14l1.74-2.87q.58-1,1-1.83l.25-.48h0l.51.94.75,1.37,1.72,2.87h2.67l-1.92-3.09c-1.12-1.8-1.76-2.83-1.92-3.1Zm4.84-4.41h0l0,.15h3.27v.86H15.77V8.58a1.66,1.66,0,0,1,.33-1.22,3.51,3.51,0,0,1,1.56-.51,3.68,3.68,0,0,0,1.21-.34c.13-.1.19-.36.19-.77S19,5.07,18.87,5A1.63,1.63,0,0,0,18,4.8a1.58,1.58,0,0,0-.91.17c-.13.11-.19.38-.19.8V6H15.78V5.76a1.87,1.87,0,0,1,.45-1.47A2.84,2.84,0,0,1,18,3.91a2.8,2.8,0,0,1,1.72.38,1.84,1.84,0,0,1,.45,1.44,1.91,1.91,0,0,1-.34,1.35,3.24,3.24,0,0,1-1.58.57A3.69,3.69,0,0,0,17,8c-.12.1-.17.35-.17.76Z" transform="translate(-4.4 -3.91)"/></g></svg>',
|
|
30
30
|
erase: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 13.76"><g><path d="M13.69,17.2h6.46v1.31H8.56L4.41,14.37,14,4.75l6.06,6.06L16.89,14l-3.2,3.19Zm-4.61,0h2.77L14.09,15,9.88,10.75,6.25,14.38l1.41,1.41c.84.82,1.31,1.29,1.42,1.41Z" transform="translate(-4.41 -4.75)"/></g></svg>',
|
|
31
|
-
indent: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 12.36"><g><path d="
|
|
32
|
-
outdent: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 12.36"><g><path d="
|
|
31
|
+
indent: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 12.36"><g><path d="M4.68,14.45a.27.27,0,0,1-.19-.08.3.3,0,0,1-.08-.21V9.1a.27.27,0,0,1,.08-.19.28.28,0,0,1,.2-.08.25.25,0,0,1,.19.07l2.54,2.54a.29.29,0,0,1,0,.4L4.88,14.36a.24.24,0,0,1-.2.09Zm15.19,1.12a.27.27,0,0,1,.19.08.25.25,0,0,1,.08.19v1.69a.27.27,0,0,1-.08.19.25.25,0,0,1-.19.08H4.68a.27.27,0,0,1-.19-.08.25.25,0,0,1-.08-.19V15.84a.27.27,0,0,1,.27-.27H19.87Zm0-3.38a.27.27,0,0,1,.19.08.28.28,0,0,1,.08.21v1.68a.32.32,0,0,1-.08.21.25.25,0,0,1-.19.08H10.31a.27.27,0,0,1-.19-.08.3.3,0,0,1-.08-.21V12.48a.32.32,0,0,1,.08-.21.24.24,0,0,1,.19-.08h9.56Zm0-3.37a.27.27,0,0,1,.19.08.25.25,0,0,1,.08.19v1.69a.27.27,0,0,1-.08.19.25.25,0,0,1-.19.08H10.31a.27.27,0,0,1-.27-.27V9.1a.27.27,0,0,1,.27-.27h9.56Zm.2-3.29a.28.28,0,0,1,.08.2V7.41a.32.32,0,0,1-.08.21.25.25,0,0,1-.19.08H4.68a.27.27,0,0,1-.19-.08.3.3,0,0,1-.08-.21V5.73a.32.32,0,0,1,.08-.21.25.25,0,0,1,.19-.08H19.87a.28.28,0,0,1,.2.09Z" transform="translate(-4.41 -5.44)"/></g></svg>',
|
|
32
|
+
outdent: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 12.36"><g><path d="M19.87,15.57a.27.27,0,0,1,.19.08.25.25,0,0,1,.08.19v1.69a.27.27,0,0,1-.08.19.25.25,0,0,1-.19.08H4.68a.27.27,0,0,1-.19-.08.25.25,0,0,1-.08-.19V15.84a.27.27,0,0,1,.27-.27H19.87ZM7.5,14.45a.25.25,0,0,1-.2-.09L4.76,11.84a.29.29,0,0,1,0-.4L7.3,8.9a.29.29,0,0,1,.4,0,.31.31,0,0,1,.07.2v5.06a.32.32,0,0,1-.08.21.26.26,0,0,1-.19.08ZM19.87,8.82a.27.27,0,0,1,.19.08.25.25,0,0,1,.08.19v1.69a.27.27,0,0,1-.08.19.25.25,0,0,1-.19.08H10.31a.27.27,0,0,1-.27-.27V9.1a.27.27,0,0,1,.27-.27h9.56Zm0,3.37a.27.27,0,0,1,.19.08.28.28,0,0,1,.08.21v1.68a.32.32,0,0,1-.08.21.25.25,0,0,1-.19.08H10.31a.27.27,0,0,1-.19-.08.3.3,0,0,1-.08-.21V12.48a.32.32,0,0,1,.08-.21.24.24,0,0,1,.19-.08h9.56Zm.2-6.66a.28.28,0,0,1,.08.2V7.41a.32.32,0,0,1-.08.21.25.25,0,0,1-.19.08H4.68a.27.27,0,0,1-.19-.08.3.3,0,0,1-.08-.21V5.73a.32.32,0,0,1,.08-.21.25.25,0,0,1,.19-.08H19.87a.28.28,0,0,1,.2.09Z" transform="translate(-4.41 -5.44)"/></g></svg>',
|
|
33
33
|
expansion: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 15.74"><g><path d="M11.8,13.06l-5.1,5.1H9.51V19.5H4.41V14.4H5.75v2.81L8.3,14.66q2.25-2.23,2.55-2.55Zm8.35-9.3v5.1H18.81V6.05l-5.1,5.1-1-1,5.1-5.1H15.05V3.76Z" transform="translate(-4.41 -3.76)"/></g></svg>',
|
|
34
34
|
reduction: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 15.74"><g><path d="M14.91,10h2.87v1.38H12.55V6.12h1.38V9l5.24-5.24.48.49.49.48ZM6.77,11.92H12v5.23H10.62V14.26L5.37,19.5l-1-1L9.63,13.3H6.77Z" transform="translate(-4.4 -3.76)"/></g></svg>',
|
|
35
35
|
code_view: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.73 11.8"><g><path d="M8.09,7.94a.76.76,0,0,1,.53.22.72.72,0,0,1,.21.52.76.76,0,0,1-.22.54L6.18,11.63l2.43,2.44a.69.69,0,0,1,.2.51.66.66,0,0,1-.21.51.75.75,0,0,1-.51.22.63.63,0,0,1-.51-.21h0L4.63,12.15a.7.7,0,0,1-.22-.53.67.67,0,0,1,.25-.55L7.57,8.16a.82.82,0,0,1,.52-.22Zm12.05,3.69a.7.7,0,0,1-.23.52L17,15.1h0a.66.66,0,0,1-.51.21.73.73,0,0,1-.51-.22.75.75,0,0,1-.22-.51.63.63,0,0,1,.21-.51l2.43-2.44L15.92,9.22a.73.73,0,0,1-.22-.53A.74.74,0,0,1,17,8.18h0l2.91,2.91a.67.67,0,0,1,.27.54Zm-5.9-5.9a.73.73,0,0,1,.61.32.71.71,0,0,1,.07.68L11,17a1,1,0,0,1-.22.32.6.6,0,0,1-.35.16.75.75,0,0,1-.69-.26.69.69,0,0,1-.12-.72L13.56,6.23a.75.75,0,0,1,.26-.35.74.74,0,0,1,.42-.15Z" transform="translate(-4.41 -5.73)"/></g></svg>',
|
package/src/lib/constructor.js
CHANGED
|
@@ -396,8 +396,21 @@ export default {
|
|
|
396
396
|
* @private
|
|
397
397
|
*/
|
|
398
398
|
_initOptions: function (element, options) {
|
|
399
|
+
const plugins = {};
|
|
400
|
+
if (options.plugins) {
|
|
401
|
+
const _plugins = options.plugins;
|
|
402
|
+
const pluginsValues = _plugins.length ? _plugins : Object.keys(_plugins).map(function(name) { return _plugins[name]; });
|
|
403
|
+
for (let i = 0, len = pluginsValues.length, p; i < len; i++) {
|
|
404
|
+
p = pluginsValues[i].default || pluginsValues[i];
|
|
405
|
+
plugins[p.name] = p;
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
options.plugins = plugins;
|
|
399
409
|
/** Values */
|
|
400
410
|
options.lang = options.lang || _defaultLang;
|
|
411
|
+
options.value = typeof options.value === 'string' ? options.value : null;
|
|
412
|
+
options.historyStackDelayTime = typeof options.historyStackDelayTime === 'number' ? options.historyStackDelayTime : 400;
|
|
413
|
+
// tag style
|
|
401
414
|
options.defaultTag = typeof options.defaultTag === 'string' && options.defaultTag.length > 0 ? options.defaultTag : 'p';
|
|
402
415
|
const textTags = options.textTags = [{bold: 'STRONG', underline: 'U', italic: 'EM', strike: 'DEL', sub: 'SUB', sup: 'SUP'}, (options.textTags || {})].reduce(function (_default, _new) {
|
|
403
416
|
for (let key in _new) {
|
|
@@ -418,8 +431,14 @@ export default {
|
|
|
418
431
|
'sub': textTags.sub.toLowerCase(),
|
|
419
432
|
'sup': textTags.sup.toLowerCase()
|
|
420
433
|
};
|
|
421
|
-
options.
|
|
422
|
-
|
|
434
|
+
options._defaultCommand = {
|
|
435
|
+
bold: options.textTags.bold,
|
|
436
|
+
underline: options.textTags.underline,
|
|
437
|
+
italic: options.textTags.italic,
|
|
438
|
+
strike: options.textTags.strike,
|
|
439
|
+
subscript: options.textTags.sub,
|
|
440
|
+
superscript: options.textTags.sup
|
|
441
|
+
};
|
|
423
442
|
/** Whitelist, Blacklist */
|
|
424
443
|
const whitelist = 'br|p|div|pre|blockquote|h1|h2|h3|h4|h5|h6|ol|ul|li|hr|figure|figcaption|img|iframe|audio|video|source|table|thead|tbody|tr|th|td|a|b|strong|var|i|em|u|ins|s|span|strike|del|sub|sup|code|svg|path|details|summary';
|
|
425
444
|
// tags
|
|
@@ -484,7 +503,7 @@ export default {
|
|
|
484
503
|
options.className = (typeof options.className === 'string' && options.className.length > 0) ? ' ' + options.className : '';
|
|
485
504
|
options.defaultStyle = typeof options.defaultStyle === 'string' ? options.defaultStyle : '';
|
|
486
505
|
/** Defining menu items */
|
|
487
|
-
options.font = !options.font ?
|
|
506
|
+
options.font = !options.font ? ['Arial', 'Comic Sans MS', 'Courier New', 'Impact', 'Georgia', 'tahoma', 'Trebuchet MS', 'Verdana'] : options.font;
|
|
488
507
|
options.fontSize = !options.fontSize ? null : options.fontSize;
|
|
489
508
|
options.formats = !options.formats ? null : options.formats;
|
|
490
509
|
options.colorList = !options.colorList ? null : options.colorList;
|
|
@@ -574,9 +593,6 @@ export default {
|
|
|
574
593
|
['fullScreen', 'showBlocks', 'codeView'],
|
|
575
594
|
['preview', 'print']
|
|
576
595
|
];
|
|
577
|
-
/** Private options */
|
|
578
|
-
options.__listCommonStyle = options.__listCommonStyle || ['fontSize', 'color', 'fontFamily'];
|
|
579
|
-
// options.__defaultFontSize;
|
|
580
596
|
|
|
581
597
|
/** RTL - buttons */
|
|
582
598
|
if (options.rtl) {
|
|
@@ -599,6 +615,10 @@ export default {
|
|
|
599
615
|
return _default;
|
|
600
616
|
}, {});
|
|
601
617
|
|
|
618
|
+
/** Private options */
|
|
619
|
+
// options.__defaultFontSize;
|
|
620
|
+
options.__listCommonStyle = options.__listCommonStyle || ['fontSize', 'color', 'fontFamily', 'fontWeight', 'fontStyle'];
|
|
621
|
+
|
|
602
622
|
/** _init options */
|
|
603
623
|
options._editorStyles = util._setDefaultOptionStyle(options, options.defaultStyle);
|
|
604
624
|
},
|
|
@@ -626,29 +646,30 @@ export default {
|
|
|
626
646
|
const addShift = util.isOSX_IOS ? '⇧' : '+SHIFT';
|
|
627
647
|
const shortcutsDisable = !options.shortcutsHint ? ['bold', 'strike', 'underline', 'italic', 'undo', 'indent', 'save'] : options.shortcutsDisable;
|
|
628
648
|
const indentKey = options.rtl ? ['[',']'] : [']','['];
|
|
649
|
+
const indentIcon = options.rtl ? [icons.outdent, icons.indent] : [icons.indent, icons.outdent];
|
|
629
650
|
|
|
630
651
|
return {
|
|
631
652
|
/** default command */
|
|
632
|
-
bold: ['
|
|
633
|
-
underline: ['
|
|
634
|
-
italic: ['
|
|
635
|
-
strike: ['
|
|
636
|
-
subscript: ['
|
|
637
|
-
superscript: ['
|
|
653
|
+
bold: ['', lang.toolbar.bold + '<span class="se-shortcut">' + (shortcutsDisable.indexOf('bold') > -1 ? '' : cmd + '+<span class="se-shortcut-key">B</span>') + '</span>', 'bold', '', icons.bold],
|
|
654
|
+
underline: ['', lang.toolbar.underline + '<span class="se-shortcut">' + (shortcutsDisable.indexOf('underline') > -1 ? '' : cmd + '+<span class="se-shortcut-key">U</span>') + '</span>', 'underline', '', icons.underline],
|
|
655
|
+
italic: ['', lang.toolbar.italic + '<span class="se-shortcut">' + (shortcutsDisable.indexOf('italic') > -1 ? '' : cmd + '+<span class="se-shortcut-key">I</span>') + '</span>', 'italic', '', icons.italic],
|
|
656
|
+
strike: ['', lang.toolbar.strike + '<span class="se-shortcut">' + (shortcutsDisable.indexOf('strike') > -1 ? '' : cmd + addShift + '+<span class="se-shortcut-key">S</span>') + '</span>', 'strike', '', icons.strike],
|
|
657
|
+
subscript: ['', lang.toolbar.subscript, 'SUB', '', icons.subscript],
|
|
658
|
+
superscript: ['', lang.toolbar.superscript, 'SUP', '', icons.superscript],
|
|
638
659
|
removeFormat: ['', lang.toolbar.removeFormat, 'removeFormat', '', icons.erase],
|
|
639
|
-
indent: ['
|
|
640
|
-
outdent: ['
|
|
641
|
-
fullScreen: ['se-code-view-enabled se-resizing-enabled
|
|
642
|
-
showBlocks: ['
|
|
643
|
-
codeView: ['se-code-view-enabled se-resizing-enabled
|
|
644
|
-
undo: ['
|
|
645
|
-
redo: ['
|
|
660
|
+
indent: ['', lang.toolbar.indent + '<span class="se-shortcut">' + (shortcutsDisable.indexOf('indent') > -1 ? '' : cmd + '+<span class="se-shortcut-key">' + indentKey[0] + '</span>') + '</span>', 'indent', '', indentIcon[0]],
|
|
661
|
+
outdent: ['', lang.toolbar.outdent + '<span class="se-shortcut">' + (shortcutsDisable.indexOf('indent') > -1 ? '' : cmd + '+<span class="se-shortcut-key">' + indentKey[1] + '</span>') + '</span>', 'outdent', '', indentIcon[1]],
|
|
662
|
+
fullScreen: ['se-code-view-enabled se-resizing-enabled', lang.toolbar.fullScreen, 'fullScreen', '', icons.expansion],
|
|
663
|
+
showBlocks: ['', lang.toolbar.showBlocks, 'showBlocks', '', icons.show_blocks],
|
|
664
|
+
codeView: ['se-code-view-enabled se-resizing-enabled', lang.toolbar.codeView, 'codeView', '', icons.code_view],
|
|
665
|
+
undo: ['', lang.toolbar.undo + '<span class="se-shortcut">' + (shortcutsDisable.indexOf('undo') > -1 ? '' : cmd + '+<span class="se-shortcut-key">Z</span>') + '</span>', 'undo', '', icons.undo],
|
|
666
|
+
redo: ['', lang.toolbar.redo + '<span class="se-shortcut">' + (shortcutsDisable.indexOf('undo') > -1 ? '' : cmd + '+<span class="se-shortcut-key">Y</span> / ' + cmd + addShift + '+<span class="se-shortcut-key">Z</span>') + '</span>', 'redo', '', icons.redo],
|
|
646
667
|
preview: ['se-resizing-enabled', lang.toolbar.preview, 'preview', '', icons.preview],
|
|
647
668
|
print: ['se-resizing-enabled', lang.toolbar.print, 'print', '', icons.print],
|
|
648
|
-
dir: ['
|
|
649
|
-
dir_ltr: ['
|
|
650
|
-
dir_rtl: ['
|
|
651
|
-
save: ['
|
|
669
|
+
dir: ['', lang.toolbar[options.rtl ? 'dir_ltr' : 'dir_rtl'], 'dir', '', icons[options.rtl ? 'dir_ltr' : 'dir_rtl']],
|
|
670
|
+
dir_ltr: ['', lang.toolbar.dir_ltr, 'dir_ltr', '', icons.dir_ltr],
|
|
671
|
+
dir_rtl: ['', lang.toolbar.dir_rtl, 'dir_rtl', '', icons.dir_rtl],
|
|
672
|
+
save: ['se-resizing-enabled', lang.toolbar.save + '<span class="se-shortcut">' + (shortcutsDisable.indexOf('save') > -1 ? '' : cmd + '+<span class="se-shortcut-key">S</span>') + '</span>', 'save', '', icons.save],
|
|
652
673
|
/** plugins - command */
|
|
653
674
|
blockquote: ['', lang.toolbar.tag_blockquote, 'blockquote', 'command', icons.blockquote],
|
|
654
675
|
/** plugins - submenu */
|
|
@@ -710,11 +731,13 @@ export default {
|
|
|
710
731
|
_createButton: function (buttonClass, title, dataCommand, dataDisplay, innerHTML, _disabled, _icons) {
|
|
711
732
|
const oLi = util.createElement('LI');
|
|
712
733
|
const oButton = util.createElement('BUTTON');
|
|
734
|
+
const label = (title || dataCommand);
|
|
713
735
|
|
|
714
736
|
oButton.setAttribute('type', 'button');
|
|
715
737
|
oButton.setAttribute('class', 'se-btn' + (buttonClass ? ' ' + buttonClass : '') + ' se-tooltip');
|
|
716
738
|
oButton.setAttribute('data-command', dataCommand);
|
|
717
739
|
oButton.setAttribute('data-display', dataDisplay);
|
|
740
|
+
oButton.setAttribute('aria-label', label.replace(/<span .+<\/span>/, ''));
|
|
718
741
|
oButton.setAttribute('tabindex', '-1');
|
|
719
742
|
|
|
720
743
|
if (!innerHTML) innerHTML = '<span class="se-icon-text">!</span>';
|
|
@@ -726,7 +749,7 @@ export default {
|
|
|
726
749
|
oButton.className += ' se-btn-more-text';
|
|
727
750
|
}
|
|
728
751
|
|
|
729
|
-
innerHTML += '<span class="se-tooltip-inner"><span class="se-tooltip-text">' +
|
|
752
|
+
innerHTML += '<span class="se-tooltip-inner"><span class="se-tooltip-text">' + label + '</span></span>';
|
|
730
753
|
|
|
731
754
|
if (_disabled) oButton.setAttribute('disabled', true);
|
|
732
755
|
|
|
@@ -743,12 +766,12 @@ export default {
|
|
|
743
766
|
* @description Create editor HTML
|
|
744
767
|
* @param {Array} doc document object
|
|
745
768
|
* @param {Array} buttonList option.buttonList
|
|
746
|
-
* @param {
|
|
769
|
+
* @param {Object|null} plugins Plugins
|
|
747
770
|
* @param {Array} options options
|
|
748
771
|
* @returns {Object} { element: (Element) Toolbar element, plugins: (Array|null) Plugins Array, pluginCallButtons: (Object), responsiveButtons: (Array) }
|
|
749
772
|
* @private
|
|
750
773
|
*/
|
|
751
|
-
_createToolBar: function (doc, buttonList,
|
|
774
|
+
_createToolBar: function (doc, buttonList, plugins, options) {
|
|
752
775
|
const separator_vertical = doc.createElement('DIV');
|
|
753
776
|
separator_vertical.className = 'se-toolbar-separator-vertical';
|
|
754
777
|
|
|
@@ -765,14 +788,6 @@ export default {
|
|
|
765
788
|
const defaultButtonList = this._defaultButtons(options);
|
|
766
789
|
const pluginCallButtons = {};
|
|
767
790
|
const responsiveButtons = [];
|
|
768
|
-
const plugins = {};
|
|
769
|
-
if (_plugins) {
|
|
770
|
-
const pluginsValues = _plugins.length ? _plugins : Object.keys(_plugins).map(function(name) { return _plugins[name]; });
|
|
771
|
-
for (let i = 0, len = pluginsValues.length, p; i < len; i++) {
|
|
772
|
-
p = pluginsValues[i].default || pluginsValues[i];
|
|
773
|
-
plugins[p.name] = p;
|
|
774
|
-
}
|
|
775
|
-
}
|
|
776
791
|
|
|
777
792
|
let module = null;
|
|
778
793
|
let button = null;
|
package/src/lib/context.js
CHANGED
|
@@ -44,23 +44,23 @@ const _Context = function (element, cons, options) {
|
|
|
44
44
|
},
|
|
45
45
|
tool: {
|
|
46
46
|
cover: cons._toolBar.querySelector('.se-toolbar-cover'),
|
|
47
|
-
bold: cons._toolBar.querySelector('
|
|
48
|
-
underline: cons._toolBar.querySelector('
|
|
49
|
-
italic: cons._toolBar.querySelector('
|
|
50
|
-
strike: cons._toolBar.querySelector('
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
undo: cons._toolBar.querySelector('
|
|
54
|
-
redo: cons._toolBar.querySelector('
|
|
55
|
-
save: cons._toolBar.querySelector('
|
|
56
|
-
outdent: cons._toolBar.querySelector('
|
|
57
|
-
indent: cons._toolBar.querySelector('
|
|
58
|
-
fullScreen: cons._toolBar.querySelector('
|
|
59
|
-
showBlocks: cons._toolBar.querySelector('
|
|
60
|
-
codeView: cons._toolBar.querySelector('
|
|
61
|
-
dir: cons._toolBar.querySelector('
|
|
62
|
-
dir_ltr: cons._toolBar.querySelector('
|
|
63
|
-
dir_rtl: cons._toolBar.querySelector('
|
|
47
|
+
bold: cons._toolBar.querySelector('[data-command="bold"]'),
|
|
48
|
+
underline: cons._toolBar.querySelector('[data-command="underline"]'),
|
|
49
|
+
italic: cons._toolBar.querySelector('[data-command="italic"]'),
|
|
50
|
+
strike: cons._toolBar.querySelector('[data-command="strike"]'),
|
|
51
|
+
sub: cons._toolBar.querySelector('[data-command="SUB"]'),
|
|
52
|
+
sup: cons._toolBar.querySelector('[data-command="SUP"]'),
|
|
53
|
+
undo: cons._toolBar.querySelector('[data-command="undo"]'),
|
|
54
|
+
redo: cons._toolBar.querySelector('[data-command="redo"]'),
|
|
55
|
+
save: cons._toolBar.querySelector('[data-command="save"]'),
|
|
56
|
+
outdent: cons._toolBar.querySelector('[data-command="outdent"]'),
|
|
57
|
+
indent: cons._toolBar.querySelector('[data-command="indent"]'),
|
|
58
|
+
fullScreen: cons._toolBar.querySelector('[data-command="fullScreen"]'),
|
|
59
|
+
showBlocks: cons._toolBar.querySelector('[data-command="showBlocks"]'),
|
|
60
|
+
codeView: cons._toolBar.querySelector('[data-command="codeView"]'),
|
|
61
|
+
dir: cons._toolBar.querySelector('[data-command="dir"]'),
|
|
62
|
+
dir_ltr: cons._toolBar.querySelector('[data-command="dir_ltr"]'),
|
|
63
|
+
dir_rtl: cons._toolBar.querySelector('[data-command="dir_rtl"]')
|
|
64
64
|
},
|
|
65
65
|
options: options,
|
|
66
66
|
option: options
|
package/src/lib/core.d.ts
CHANGED
|
@@ -192,23 +192,6 @@ interface Core {
|
|
|
192
192
|
*/
|
|
193
193
|
commandMap: Record<string, Element>;
|
|
194
194
|
|
|
195
|
-
/**
|
|
196
|
-
* @description Contains pairs of all "data-commands" and "elements" setted in toolbar over time
|
|
197
|
-
* Used primarily to save and recover button states after the toolbar re-creation
|
|
198
|
-
* Updates each "_cachingButtons()" invocation
|
|
199
|
-
*/
|
|
200
|
-
allCommandButtons: Record<string, Element>;
|
|
201
|
-
|
|
202
|
-
/**
|
|
203
|
-
* @description Save the current buttons states to "allCommandButtons" object
|
|
204
|
-
*/
|
|
205
|
-
saveButtonStates(): void;
|
|
206
|
-
|
|
207
|
-
/**
|
|
208
|
-
* @description Recover the current buttons states from "allCommandButtons" object
|
|
209
|
-
*/
|
|
210
|
-
recoverButtonStates(): void;
|
|
211
|
-
|
|
212
195
|
/**
|
|
213
196
|
* @description If the plugin is not added, add the plugin and call the 'add' function.
|
|
214
197
|
* If the plugin is added call callBack function.
|