suneditor 2.42.0 → 2.43.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "suneditor",
3
- "version": "2.42.0",
3
+ "version": "2.43.2",
4
4
  "description": "Pure JavaScript based WYSIWYG web editor",
5
5
  "author": "JiHong.Lee",
6
6
  "license": "MIT",
@@ -9,7 +9,7 @@
9
9
  "./src/assets/css/*.css"
10
10
  ],
11
11
  "scripts": {
12
- "dev": "webpack-dev-server --open --config webpack.dev.js",
12
+ "dev": "webpack-dev-server --config webpack.dev.js",
13
13
  "start": "npm run dev",
14
14
  "build": "webpack --config webpack.prod.js",
15
15
  "lint": "jshint src",
@@ -40,8 +40,8 @@
40
40
  "html-webpack-plugin": "^3.2.0",
41
41
  "jasmine": "^2.99.0",
42
42
  "jasmine-core": "^2.99.1",
43
- "jshint": "^2.12.0",
44
- "karma": "^4.4.1",
43
+ "jshint": "^2.13.4",
44
+ "karma": "^6.3.19",
45
45
  "karma-chrome-launcher": "^2.2.0",
46
46
  "karma-jasmine": "^1.1.2",
47
47
  "katex": "^0.11.1",
@@ -374,7 +374,7 @@
374
374
  max-width: 100%;
375
375
  }
376
376
  /* image, video - select index */
377
- .sun-editor-editable[contenteditable="true"] figure::after {
377
+ .sun-editor-editable[contenteditable="true"]:not(.se-read-only) figure::after {
378
378
  position: absolute;
379
379
  content: '';
380
380
  z-index: 1;
@@ -137,6 +137,7 @@
137
137
 
138
138
  /** --- toolbar ---------------------------------------------------------- */
139
139
  .sun-editor .se-toolbar {display:block; position:relative; height:auto; width:100%; overflow:visible; padding:0; margin:0; background-color:#fafafa; outline:1px solid #dadada; z-index:5;}
140
+ .sun-editor .se-toolbar-shadow {display:block !important; height:0px !important; padding:0 !important; margin:0 !important; background-color:transparent !important; outline:none !important; border: none !important; z-index:0 !important;}
140
141
  .sun-editor .se-toolbar-cover {position:absolute; display:none; font-size:36px; width:100%; height:100%; top:0; left:0; background-color:#fefefe; opacity:.5; filter:alpha(opacity=50); cursor:not-allowed; z-index:4;}
141
142
  .sun-editor .se-toolbar-separator-vertical {display:inline-block; height:0px; width:0px; margin:0px; vertical-align:top;}
142
143
  /* inline toolbar */
@@ -334,7 +335,7 @@
334
335
  .sun-editor .se-dialog-tabs button.active {background-color:#fff;border-bottom:0;}
335
336
 
336
337
  /* dialog - modal - math */
337
- .sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-input-form.se-math-exp {resize:vertical; height:4rem; border:1px solid #ccc; font-size:13px; padding:4px; direction:ltr;}
338
+ .sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-input-form.se-math-exp {resize:vertical; height:14em; border:1px solid #ccc; font-size:13px; padding:4px; direction:ltr;}
338
339
  .sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-input-select.se-math-size {width:6em; height:28px; margin-left:1em;}
339
340
  .sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-math-preview {font-size:13px;}
340
341
  .sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-math-preview > span {display:inline-block; -webkit-box-shadow:0 0 0 0.1rem #c7deff; box-shadow:0 0 0 0.1rem #c7deff;}
package/src/lang/zh_cn.js CHANGED
@@ -83,7 +83,7 @@
83
83
  linkBox: {
84
84
  title: '插入超链接',
85
85
  url: '网址',
86
- text: '字体',
86
+ text: '要显示的文字',
87
87
  newWindowCheck: '在新标签页中打开',
88
88
  downloadLinkCheck: '下载链接',
89
89
  bookmark: '书签'
@@ -37,6 +37,8 @@ export default {
37
37
 
38
38
  // toolbar
39
39
  const tool_bar = this._createToolBar(doc, options.buttonList, options.plugins, options);
40
+ const toolbarShadow = tool_bar.element.cloneNode(false);
41
+ toolbarShadow.className += ' se-toolbar-shadow';
40
42
  tool_bar.element.style.visibility = 'hidden';
41
43
  if (tool_bar.pluginCallButtons.math) this._checkKatexMath(options.katex);
42
44
  const arrow = doc.createElement('DIV');
@@ -86,6 +88,7 @@ export default {
86
88
  const toolbarContainer = options.toolbarContainer;
87
89
  if (toolbarContainer) {
88
90
  toolbarContainer.appendChild(tool_bar.element);
91
+ toolbarContainer.appendChild(toolbarShadow);
89
92
  }
90
93
 
91
94
  // resizingbar
@@ -95,7 +98,10 @@ export default {
95
98
  /** append html */
96
99
  editor_div.appendChild(textarea);
97
100
  if (placeholder_span) editor_div.appendChild(placeholder_span);
98
- if (!toolbarContainer) relative.appendChild(tool_bar.element);
101
+ if (!toolbarContainer) {
102
+ relative.appendChild(tool_bar.element);
103
+ relative.appendChild(toolbarShadow);
104
+ }
99
105
  relative.appendChild(sticky_dummy);
100
106
  relative.appendChild(editor_div);
101
107
  relative.appendChild(resize_back);
@@ -113,6 +119,7 @@ export default {
113
119
  _top: top_div,
114
120
  _relative: relative,
115
121
  _toolBar: tool_bar.element,
122
+ _toolbarShadow: toolbarShadow,
116
123
  _menuTray: tool_bar._menuTray,
117
124
  _editorArea: editor_div,
118
125
  _wysiwygArea: wysiwyg_div,
@@ -306,15 +313,17 @@ export default {
306
313
  }
307
314
  wysiwygDiv.className += ' ' + options._editableClass;
308
315
  wysiwygDiv.style.cssText = options._editorStyles.frame + options._editorStyles.editor;
316
+ wysiwygDiv.className += options.className;
309
317
  } else {
310
318
  wysiwygDiv.allowFullscreen = true;
311
319
  wysiwygDiv.frameBorder = 0;
312
320
  wysiwygDiv.style.cssText = options._editorStyles.frame;
321
+ wysiwygDiv.className += options.className;
313
322
  }
314
323
 
315
324
  // textarea for code view
316
325
  const textarea = document.createElement('TEXTAREA');
317
- textarea.className = 'se-wrapper-inner se-wrapper-code';
326
+ textarea.className = 'se-wrapper-inner se-wrapper-code' + options.className;
318
327
  textarea.style.cssText = options._editorStyles.frame;
319
328
  textarea.style.display = 'none';
320
329
  if (options.height === 'auto') textarea.style.overflow = 'hidden';
@@ -471,7 +480,8 @@ export default {
471
480
  options.height = options.height ? (util.isNumber(options.height) ? options.height + 'px' : options.height) : (element.clientHeight ? element.clientHeight + 'px' : 'auto');
472
481
  options.minHeight = (util.isNumber(options.minHeight) ? options.minHeight + 'px' : options.minHeight) || '';
473
482
  options.maxHeight = (util.isNumber(options.maxHeight) ? options.maxHeight + 'px' : options.maxHeight) || '';
474
- /** Editing area default style */
483
+ /** Editing area */
484
+ options.className = (typeof options.className === 'string' && options.className.length > 0) ? ' ' + options.className : '';
475
485
  options.defaultStyle = typeof options.defaultStyle === 'string' ? options.defaultStyle : '';
476
486
  /** Defining menu items */
477
487
  options.font = !options.font ? null : options.font;
@@ -564,6 +574,9 @@ export default {
564
574
  ['fullScreen', 'showBlocks', 'codeView'],
565
575
  ['preview', 'print']
566
576
  ];
577
+ /** Private options */
578
+ options.__listCommonStyle = options.__listCommonStyle || ['fontSize', 'color', 'fontFamily'];
579
+ // options.__defaultFontSize;
567
580
 
568
581
  /** RTL - buttons */
569
582
  if (options.rtl) {
@@ -623,8 +636,8 @@ export default {
623
636
  subscript: ['_se_command_subscript', lang.toolbar.subscript, 'SUB', '', icons.subscript],
624
637
  superscript: ['_se_command_superscript', lang.toolbar.superscript, 'SUP', '', icons.superscript],
625
638
  removeFormat: ['', lang.toolbar.removeFormat, 'removeFormat', '', icons.erase],
626
- indent: ['_se_command_indent', lang.toolbar.indent + '<span class="se-shortcut">' + (shortcutsDisable.indexOf('indent') > -1 ? '' : cmd + '+<span class="se-shortcut-key">' + indentKey[0] + '</span>') + '</span>', 'indent', '', icons.outdent],
627
- outdent: ['_se_command_outdent', lang.toolbar.outdent + '<span class="se-shortcut">' + (shortcutsDisable.indexOf('indent') > -1 ? '' : cmd + '+<span class="se-shortcut-key">' + indentKey[1] + '</span>') + '</span>', 'outdent', '', icons.indent],
639
+ indent: ['_se_command_indent', lang.toolbar.indent + '<span class="se-shortcut">' + (shortcutsDisable.indexOf('indent') > -1 ? '' : cmd + '+<span class="se-shortcut-key">' + indentKey[0] + '</span>') + '</span>', 'indent', '', icons.indent],
640
+ outdent: ['_se_command_outdent', lang.toolbar.outdent + '<span class="se-shortcut">' + (shortcutsDisable.indexOf('indent') > -1 ? '' : cmd + '+<span class="se-shortcut-key">' + indentKey[1] + '</span>') + '</span>', 'outdent', '', icons.outdent],
628
641
  fullScreen: ['se-code-view-enabled se-resizing-enabled _se_command_fullScreen', lang.toolbar.fullScreen, 'fullScreen', '', icons.expansion],
629
642
  showBlocks: ['_se_command_showBlocks', lang.toolbar.showBlocks, 'showBlocks', '', icons.show_blocks],
630
643
  codeView: ['se-code-view-enabled se-resizing-enabled _se_command_codeView', lang.toolbar.codeView, 'codeView', '', icons.code_view],
@@ -22,6 +22,7 @@ const _Context = function (element, cons, options) {
22
22
  topArea: cons._top,
23
23
  relative: cons._relative,
24
24
  toolbar: cons._toolBar,
25
+ _toolbarShadow: cons._toolbarShadow,
25
26
  _buttonTray: cons._toolBar.querySelector('.se-btn-tray'),
26
27
  _menuTray: cons._menuTray,
27
28
  resizingBar: cons._resizingBar,
package/src/lib/core.d.ts CHANGED
@@ -578,6 +578,14 @@ interface Core {
578
578
  */
579
579
  getContents(onlyContents: boolean): string;
580
580
 
581
+ /**
582
+ * @description Gets the current contents with containing parent div(div.sun-editor-editable).
583
+ * <div class="sun-editor-editable">{contents}</div>
584
+ * @param onlyContents Return only the contents of the body without headers when the "fullPage" option is true
585
+ * @returns
586
+ */
587
+ getFullContents(onlyContents: boolean): string;
588
+
581
589
  /**
582
590
  * @description Gets the clean HTML code for editor
583
591
  * @param html HTML string
@@ -934,9 +942,10 @@ export default class SunEditor {
934
942
  * @param height Height after resized (px)
935
943
  * @param prevHeight Prev height before resized (px)
936
944
  * @param core Core object
945
+ * @param resizeObserverEntry ResizeObserverEntry object (This is not provided in IE Browser.)
937
946
  * @returns
938
947
  */
939
- onResizeEditor: (height: number, prevHeight: number, core: Core) => {};
948
+ onResizeEditor: (height: number, prevHeight: number, core: Core, resizeObserverEntry: ResizeObserverEntry | null) => {};
940
949
 
941
950
  /**
942
951
  * @description Called after the "setToolbarButtons" invocation.