suneditor 3.0.0-beta.6 → 3.0.0-beta.8
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/dist/suneditor.min.css +1 -1
- package/dist/suneditor.min.js +1 -1
- package/package.json +1 -1
- package/src/assets/suneditor.css +1 -1
- package/src/core/class/format.js +2 -2
- package/src/core/section/constructor.js +5 -2
- package/src/helper/converter.js +8 -8
- package/src/helper/dom/domUtils.js +1 -1
- package/src/plugins/dropdown/table.js +24 -3
package/package.json
CHANGED
package/src/assets/suneditor.css
CHANGED
package/src/core/class/format.js
CHANGED
|
@@ -1138,9 +1138,9 @@ Format.prototype = {
|
|
|
1138
1138
|
let end = {};
|
|
1139
1139
|
|
|
1140
1140
|
/** @type {string|RegExp} */
|
|
1141
|
-
let styleRegExp;
|
|
1141
|
+
let styleRegExp = '';
|
|
1142
1142
|
/** @type {string|RegExp} */
|
|
1143
|
-
let classRegExp;
|
|
1143
|
+
let classRegExp = '';
|
|
1144
1144
|
/** @type {string|RegExp} */
|
|
1145
1145
|
let removeNodeRegExp;
|
|
1146
1146
|
|
|
@@ -21,7 +21,7 @@ const DEFAULT_BUTTON_LIST = [
|
|
|
21
21
|
const REQUIRED_FORMAT_LINE = 'div';
|
|
22
22
|
const REQUIRED_ELEMENT_WHITELIST = 'br|div';
|
|
23
23
|
const DEFAULT_ELEMENT_WHITELIST =
|
|
24
|
-
'p|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|caption|a|b|strong|var|i|em|u|ins|s|span|strike|del|sub|sup|code|svg|path|details|summary';
|
|
24
|
+
'p|pre|blockquote|h1|h2|h3|h4|h5|h6|ol|ul|li|hr|figure|figcaption|img|iframe|audio|video|source|table|colgroup|col|thead|tbody|tr|th|td|caption|a|b|strong|var|i|em|u|ins|s|span|strike|del|sub|sup|code|svg|path|details|summary';
|
|
25
25
|
const DEFAULT_TEXT_STYLE_TAGS = 'strong|span|font|b|var|i|em|u|ins|s|strike|del|sub|sup|mark|a|label|code|summary';
|
|
26
26
|
|
|
27
27
|
/* scopeSelectionTags */
|
|
@@ -46,7 +46,10 @@ const DEFAULT_CLASS_MJX = 'mjx-container|mjx-math|mjx-mrow|mjx-mi|mjx-mo|mjx-mn|
|
|
|
46
46
|
const DEFAULT_EXTRA_TAG_MAP = { script: false, style: false, meta: false, link: false, '[a-z]+:[a-z]+': false };
|
|
47
47
|
|
|
48
48
|
const DEFAULT_TAG_STYLES = {
|
|
49
|
-
'table|th|td': 'border|border-[a-z]+|background-color|text-align|float|font-weight|text-decoration|font-style',
|
|
49
|
+
'table|th|td|tr': 'border|border-[a-z]+|background-color|text-align|float|font-weight|text-decoration|font-style|vertical-align|text-align',
|
|
50
|
+
'table|td': 'width',
|
|
51
|
+
tr: 'height',
|
|
52
|
+
col: 'width',
|
|
50
53
|
'ol|ul': 'list-style-type'
|
|
51
54
|
};
|
|
52
55
|
const DEFAULT_TEXT_STYLES = 'font-family|font-size|color|background-color';
|
package/src/helper/converter.js
CHANGED
|
@@ -2,14 +2,14 @@ import { _d, _w } from './env';
|
|
|
2
2
|
|
|
3
3
|
const URLPattern = /https?:\/\/[^\s]+/g;
|
|
4
4
|
const FONT_VALUES_MAP = {
|
|
5
|
-
'xx-small':
|
|
6
|
-
'x-small':
|
|
7
|
-
small:
|
|
8
|
-
medium:
|
|
9
|
-
large:
|
|
10
|
-
'x-large':
|
|
11
|
-
'xx-large':
|
|
12
|
-
'xxx-large':
|
|
5
|
+
'xx-small': 0.5625,
|
|
6
|
+
'x-small': 0.625,
|
|
7
|
+
small: 0.8333,
|
|
8
|
+
medium: 1,
|
|
9
|
+
large: 1.125,
|
|
10
|
+
'x-large': 1.5,
|
|
11
|
+
'xx-large': 2,
|
|
12
|
+
'xxx-large': 2.5
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
function NodeToJson(node) {
|
|
@@ -264,7 +264,7 @@ export function setStyle(elements, styleName, value) {
|
|
|
264
264
|
for (let i = 0, len = elements.length, e; i < len; i++) {
|
|
265
265
|
e = /** @type {HTMLElement} */ (elements[i]);
|
|
266
266
|
e.style[styleName] = value;
|
|
267
|
-
if (!
|
|
267
|
+
if (!e.style.cssText) {
|
|
268
268
|
e.removeAttribute('style');
|
|
269
269
|
}
|
|
270
270
|
}
|
|
@@ -423,13 +423,28 @@ class Table extends EditorInjector {
|
|
|
423
423
|
query: 'table',
|
|
424
424
|
method: (element) => {
|
|
425
425
|
const ColgroupEl = element.querySelector('colgroup');
|
|
426
|
-
let FigureEl = dom.check.isFigure(element.parentNode) ? element.parentNode : null;
|
|
427
|
-
if (ColgroupEl && FigureEl) return;
|
|
426
|
+
let FigureEl = /** @type {HTMLElement} */ (dom.check.isFigure(element.parentNode) ? element.parentNode : null);
|
|
428
427
|
|
|
429
428
|
// create colgroup
|
|
430
429
|
if (!ColgroupEl) {
|
|
430
|
+
const rows = element.rows;
|
|
431
|
+
const firstRow = rows[0];
|
|
431
432
|
const maxCount = GetMaxColumns(element);
|
|
432
|
-
const
|
|
433
|
+
const colHTML = [];
|
|
434
|
+
|
|
435
|
+
for (let i = 0; i < maxCount; i++) {
|
|
436
|
+
let colStyle = '';
|
|
437
|
+
if (firstRow && firstRow.cells[i]) {
|
|
438
|
+
const styleWidth = firstRow.cells[i].style.width;
|
|
439
|
+
if (styleWidth) {
|
|
440
|
+
colStyle = ` style="width: ${styleWidth};"`;
|
|
441
|
+
dom.utils.setStyle(firstRow.cells[i], 'width', '');
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
colHTML.push(`<col${colStyle}>`);
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
const colGroup = dom.utils.createElement('colgroup', null, colHTML.join(''));
|
|
433
448
|
element.insertBefore(colGroup, element.firstElementChild);
|
|
434
449
|
}
|
|
435
450
|
|
|
@@ -442,6 +457,12 @@ class Table extends EditorInjector {
|
|
|
442
457
|
dom.utils.addClass(FigureEl, 'se-flex-component|se-input-component');
|
|
443
458
|
}
|
|
444
459
|
|
|
460
|
+
// table width
|
|
461
|
+
if (element.style.width) {
|
|
462
|
+
FigureEl.style.width = element.style.width;
|
|
463
|
+
dom.utils.setStyle(element, 'width', '');
|
|
464
|
+
}
|
|
465
|
+
|
|
445
466
|
// scroll
|
|
446
467
|
if (!this.figureScroll) {
|
|
447
468
|
dom.utils.removeClass(FigureEl, this.figureScrollList.join('|'));
|