suneditor 3.1.2 → 3.1.3
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 +1 -1
- package/dist/suneditor.min.css +1 -1
- package/dist/suneditor.min.js +1 -1
- package/package.json +9 -6
- package/src/assets/suneditor.css +28 -2
- package/src/core/event/handlers/handler_ww_dragDrop.js +20 -0
- package/src/core/logic/panel/menu.js +4 -0
- package/src/core/logic/shell/ui.js +13 -2
- package/src/core/schema/options.js +1 -1
- package/src/core/section/constructor.js +29 -12
- package/src/core/section/documentType.js +55 -29
- package/src/modules/contract/Browser.js +3 -0
- package/src/modules/contract/Controller.js +3 -0
- package/src/modules/contract/Figure.js +23 -4
- package/src/modules/contract/Modal.js +2 -0
- package/src/plugins/dropdown/table/services/table.style.js +21 -12
- package/types/core/schema/options.d.ts +2 -2
- package/types/core/section/documentType.d.ts +17 -1
|
@@ -598,16 +598,25 @@ export class TableStyleService {
|
|
|
598
598
|
this._propsCache = [];
|
|
599
599
|
|
|
600
600
|
for (let i = 0, t, isBreak; (t = targets[i]); i++) {
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
601
|
+
const {
|
|
602
|
+
cssText: t_cssText,
|
|
603
|
+
border: t_border,
|
|
604
|
+
backgroundColor: t_backgroundColor,
|
|
605
|
+
color: t_color,
|
|
606
|
+
textAlign: t_textAlign,
|
|
607
|
+
verticalAlign: t_verticalAlign,
|
|
608
|
+
fontWeight: t_fontWeight,
|
|
609
|
+
textDecoration: t_textDecoration,
|
|
610
|
+
fontStyle: t_fontStyle,
|
|
611
|
+
} = t.style;
|
|
612
|
+
this._propsCache.push([t, t_cssText]);
|
|
604
613
|
if (isBreak) continue;
|
|
605
614
|
|
|
606
|
-
const { c, s, w } = this.#getBorderStyle(
|
|
615
|
+
const { c, s, w } = this.#getBorderStyle(t_border);
|
|
607
616
|
|
|
608
617
|
// use getComputedStyle to normalize any CSS color format to rgb
|
|
609
|
-
let hexBackColor =
|
|
610
|
-
let hexColor =
|
|
618
|
+
let hexBackColor = t_backgroundColor;
|
|
619
|
+
let hexColor = t_color;
|
|
611
620
|
if (hexBackColor || hexColor) {
|
|
612
621
|
const computed = _w.getComputedStyle(t);
|
|
613
622
|
if (hexBackColor) hexBackColor = computed.backgroundColor;
|
|
@@ -619,12 +628,12 @@ export class TableStyleService {
|
|
|
619
628
|
if (b_width && cellBorder.w !== w) b_width = '';
|
|
620
629
|
if (backColor !== converter.rgb2hex(hexBackColor)) backColor = '';
|
|
621
630
|
if (fontColor !== converter.rgb2hex(hexColor)) fontColor = '';
|
|
622
|
-
if (align !== (isTable ? this.#state.figureElement?.style.float :
|
|
623
|
-
if (align_v && align_v !==
|
|
624
|
-
if (bold && bold !== /.+/.test(
|
|
625
|
-
if (underline && underline !== /underline/i.test(
|
|
626
|
-
if (strike && strike !== /line-through/i.test(
|
|
627
|
-
if (italic && italic !== /italic/i.test(
|
|
631
|
+
if (align !== (isTable ? this.#state.figureElement?.style.float : t_textAlign)) align = '';
|
|
632
|
+
if (align_v && align_v !== t_verticalAlign) align_v = '';
|
|
633
|
+
if (bold && bold !== /.+/.test(t_fontWeight)) bold = false;
|
|
634
|
+
if (underline && underline !== /underline/i.test(t_textDecoration)) underline = false;
|
|
635
|
+
if (strike && strike !== /line-through/i.test(t_textDecoration)) strike = false;
|
|
636
|
+
if (italic && italic !== /italic/i.test(t_fontStyle)) italic = false;
|
|
628
637
|
if (!b_color || !b_style || !b_width || !backColor || !fontColor) {
|
|
629
638
|
isBreak = true;
|
|
630
639
|
}
|
|
@@ -309,7 +309,7 @@ export namespace DEFAULTS {
|
|
|
309
309
|
* attributeWhitelist: {
|
|
310
310
|
* a: 'href|target',
|
|
311
311
|
* img: 'src|alt',
|
|
312
|
-
* '*': 'id|data
|
|
312
|
+
* '*': 'id|data-[^\s]+'
|
|
313
313
|
* }
|
|
314
314
|
* }
|
|
315
315
|
* ```
|
|
@@ -1055,7 +1055,7 @@ export type EditorBaseOptions = {
|
|
|
1055
1055
|
* attributeWhitelist: {
|
|
1056
1056
|
* a: 'href|target',
|
|
1057
1057
|
* img: 'src|alt',
|
|
1058
|
-
* '*': 'id|data
|
|
1058
|
+
* '*': 'id|data-[^\s]+'
|
|
1059
1059
|
* }
|
|
1060
1060
|
* }
|
|
1061
1061
|
* ```
|
|
@@ -30,9 +30,19 @@ declare class DocumentType {
|
|
|
30
30
|
* @param {number} t - The initial top position value to be adjusted.
|
|
31
31
|
* @param {HTMLCollection} chr - The elements array in the current (main) page.
|
|
32
32
|
* @param {HTMLCollection} mChr - The elements array in the mirrored page.
|
|
33
|
+
* @param {Array.<{number: number, top: number, isBreak?: boolean}>} [pages] - The pages array containing page break info.
|
|
33
34
|
* @returns {number|null} The adjusted top value.
|
|
34
35
|
*/
|
|
35
|
-
_calcPageBreakTop(
|
|
36
|
+
_calcPageBreakTop(
|
|
37
|
+
t: number,
|
|
38
|
+
chr: HTMLCollection,
|
|
39
|
+
mChr: HTMLCollection,
|
|
40
|
+
pages?: Array<{
|
|
41
|
+
number: number;
|
|
42
|
+
top: number;
|
|
43
|
+
isBreak?: boolean;
|
|
44
|
+
}>,
|
|
45
|
+
): number | null;
|
|
36
46
|
/**
|
|
37
47
|
* @internal
|
|
38
48
|
* @description Initializes the cache for document elements.
|
|
@@ -44,6 +54,7 @@ declare class DocumentType {
|
|
|
44
54
|
* @description Retrieves the element at a given position.
|
|
45
55
|
* @param {number} pageTop - The vertical position to check.
|
|
46
56
|
* @param {HTMLCollection} mChr - List of mirrored elements.
|
|
57
|
+
* @param {Array.<{number: number, top: number, isBreak?: boolean}>} [pages] - The pages array containing page break info for skipping break elements.
|
|
47
58
|
* @returns {{ci: number, cm: number, ch: number}} The closest element and its related data.
|
|
48
59
|
* - ci: The index of the closest element.
|
|
49
60
|
* - cm: The distance between the top of the closest element and the given position.
|
|
@@ -52,6 +63,11 @@ declare class DocumentType {
|
|
|
52
63
|
_getElementAtPosition(
|
|
53
64
|
pageTop: number,
|
|
54
65
|
mChr: HTMLCollection,
|
|
66
|
+
pages?: Array<{
|
|
67
|
+
number: number;
|
|
68
|
+
top: number;
|
|
69
|
+
isBreak?: boolean;
|
|
70
|
+
}>,
|
|
55
71
|
): {
|
|
56
72
|
ci: number;
|
|
57
73
|
cm: number;
|