@sd-angular/core 19.0.0-beta.3 → 19.0.0-beta.30
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/assets/scss/ckeditor5.scss +60 -2
- package/components/avatar/index.d.ts +1 -0
- package/components/avatar/src/avatar.component.d.ts +14 -0
- package/components/document-builder/src/document-builder.component.d.ts +29 -7
- package/components/document-builder/src/document-builder.config.d.ts +21 -0
- package/components/document-builder/src/document-builder.model.d.ts +14 -2
- package/components/document-builder/src/document-builder.utils.d.ts +10 -0
- package/components/document-builder/src/plugins/block-space/block-space.plugin.d.ts +9 -0
- package/components/document-builder/src/plugins/heading/heading.plugin.d.ts +5 -0
- package/components/document-builder/src/plugins/highlight-range/highlight-range.plugin.d.ts +4 -0
- package/components/document-builder/src/plugins/image-custom/image-custom.plugin.d.ts +31 -0
- package/components/document-builder/src/plugins/{image-upload.plugin.d.ts → image-upload/image-upload.plugin.d.ts} +0 -4
- package/components/document-builder/src/plugins/index.d.ts +10 -5
- package/components/document-builder/src/plugins/{page-orientation.plugin.d.ts → page-orientation/page-orientation.plugin.d.ts} +2 -2
- package/components/document-builder/src/plugins/paste-handler/filters/bookmark.d.ts +14 -0
- package/components/document-builder/src/plugins/paste-handler/filters/br.d.ts +15 -0
- package/components/document-builder/src/plugins/paste-handler/filters/image.d.ts +25 -0
- package/components/document-builder/src/plugins/paste-handler/filters/list.d.ts +29 -0
- package/components/document-builder/src/plugins/paste-handler/filters/parse.d.ts +35 -0
- package/components/document-builder/src/plugins/paste-handler/filters/removeboldwrapper.d.ts +15 -0
- package/components/document-builder/src/plugins/paste-handler/filters/removegooglesheetstag.d.ts +15 -0
- package/components/document-builder/src/plugins/paste-handler/filters/removeinvalidtablewidth.d.ts +15 -0
- package/components/document-builder/src/plugins/paste-handler/filters/removemsattributes.d.ts +15 -0
- package/components/document-builder/src/plugins/paste-handler/filters/removestyleblock.d.ts +15 -0
- package/components/document-builder/src/plugins/paste-handler/filters/removexmlns.d.ts +15 -0
- package/components/document-builder/src/plugins/paste-handler/filters/replacemsfootnotes.d.ts +54 -0
- package/components/document-builder/src/plugins/paste-handler/filters/replacetabswithinprewithspaces.d.ts +24 -0
- package/components/document-builder/src/plugins/paste-handler/filters/space.d.ts +27 -0
- package/components/document-builder/src/plugins/paste-handler/filters/table.d.ts +16 -0
- package/components/document-builder/src/plugins/paste-handler/filters/utils.d.ts +25 -0
- package/components/document-builder/src/plugins/paste-handler/index.d.ts +35 -0
- package/components/document-builder/src/plugins/paste-handler/normalizers/googledocsnormalizer.d.ts +31 -0
- package/components/document-builder/src/plugins/paste-handler/normalizers/googlesheetsnormalizer.d.ts +31 -0
- package/components/document-builder/src/plugins/paste-handler/normalizers/mswordnormalizer.d.ts +29 -0
- package/components/document-builder/src/plugins/paste-handler/types.d.ts +30 -0
- package/components/document-builder/src/plugins/table-custom/index.d.ts +34 -0
- package/components/index.d.ts +3 -0
- package/components/mini-editor/index.d.ts +2 -0
- package/components/mini-editor/src/mini-editor.component.d.ts +90 -0
- package/components/mini-editor/src/mini-editor.model.d.ts +42 -0
- package/components/table/src/directives/index.d.ts +2 -0
- package/components/table/src/directives/sd-table-column-filter-def.directive.d.ts +9 -0
- package/components/table/src/directives/sticky-shadow.directive.d.ts +17 -0
- package/components/table/src/models/table-column.model.d.ts +7 -7
- package/components/table/src/models/table-command.model.d.ts +4 -0
- package/components/table/src/models/table-item.model.d.ts +2 -1
- package/components/table/src/models/table-option-export.model.d.ts +3 -2
- package/components/table/src/models/table-option.model.d.ts +10 -8
- package/components/table/src/services/table-filter/table-filter.model.d.ts +2 -2
- package/components/view/index.d.ts +1 -0
- package/components/view/src/view.component.d.ts +16 -0
- package/components/workflow/src/models/index.d.ts +1 -0
- package/directives/index.d.ts +1 -0
- package/directives/src/sd-href.directive.d.ts +9 -0
- package/fesm2022/sd-angular-core-components-avatar.mjs +88 -0
- package/fesm2022/sd-angular-core-components-avatar.mjs.map +1 -0
- package/fesm2022/sd-angular-core-components-badge.mjs +2 -2
- package/fesm2022/sd-angular-core-components-badge.mjs.map +1 -1
- package/fesm2022/sd-angular-core-components-document-builder.mjs +3187 -552
- package/fesm2022/sd-angular-core-components-document-builder.mjs.map +1 -1
- package/fesm2022/sd-angular-core-components-mini-editor.mjs +326 -0
- package/fesm2022/sd-angular-core-components-mini-editor.mjs.map +1 -0
- package/fesm2022/sd-angular-core-components-table.mjs +513 -87
- package/fesm2022/sd-angular-core-components-table.mjs.map +1 -1
- package/fesm2022/sd-angular-core-components-view.mjs +57 -0
- package/fesm2022/sd-angular-core-components-view.mjs.map +1 -0
- package/fesm2022/sd-angular-core-components-workflow.mjs +33 -43
- package/fesm2022/sd-angular-core-components-workflow.mjs.map +1 -1
- package/fesm2022/sd-angular-core-components.mjs +3 -0
- package/fesm2022/sd-angular-core-components.mjs.map +1 -1
- package/fesm2022/sd-angular-core-directives.mjs +80 -27
- package/fesm2022/sd-angular-core-directives.mjs.map +1 -1
- package/fesm2022/sd-angular-core-forms-autocomplete.mjs +35 -9
- package/fesm2022/sd-angular-core-forms-autocomplete.mjs.map +1 -1
- package/fesm2022/sd-angular-core-forms-date.mjs +24 -4
- package/fesm2022/sd-angular-core-forms-date.mjs.map +1 -1
- package/fesm2022/sd-angular-core-forms-datetime.mjs +27 -9
- package/fesm2022/sd-angular-core-forms-datetime.mjs.map +1 -1
- package/fesm2022/sd-angular-core-forms-input-number.mjs +37 -10
- package/fesm2022/sd-angular-core-forms-input-number.mjs.map +1 -1
- package/fesm2022/sd-angular-core-forms-input.mjs +29 -11
- package/fesm2022/sd-angular-core-forms-input.mjs.map +1 -1
- package/fesm2022/sd-angular-core-forms-radio.mjs +18 -2
- package/fesm2022/sd-angular-core-forms-radio.mjs.map +1 -1
- package/fesm2022/sd-angular-core-forms-select.mjs +27 -9
- package/fesm2022/sd-angular-core-forms-select.mjs.map +1 -1
- package/fesm2022/sd-angular-core-forms-textarea.mjs +21 -2
- package/fesm2022/sd-angular-core-forms-textarea.mjs.map +1 -1
- package/fesm2022/sd-angular-core-modules-auth.mjs +5 -5
- package/fesm2022/sd-angular-core-modules-auth.mjs.map +1 -1
- package/fesm2022/sd-angular-core-modules-keycloak.mjs +126 -0
- package/fesm2022/sd-angular-core-modules-keycloak.mjs.map +1 -0
- package/fesm2022/sd-angular-core-modules-layout.mjs +52 -17
- package/fesm2022/sd-angular-core-modules-layout.mjs.map +1 -1
- package/fesm2022/sd-angular-core-modules.mjs +1 -1
- package/fesm2022/sd-angular-core-pipes.mjs +21 -1
- package/fesm2022/sd-angular-core-pipes.mjs.map +1 -1
- package/fesm2022/sd-angular-core-services-confirm.mjs +2 -2
- package/fesm2022/sd-angular-core-services-confirm.mjs.map +1 -1
- package/fesm2022/sd-angular-core-services-docx.mjs +173 -0
- package/fesm2022/sd-angular-core-services-docx.mjs.map +1 -0
- package/fesm2022/sd-angular-core-services-notify.mjs +2 -2
- package/fesm2022/sd-angular-core-services-notify.mjs.map +1 -1
- package/fesm2022/sd-angular-core-services.mjs +1 -0
- package/fesm2022/sd-angular-core-services.mjs.map +1 -1
- package/fesm2022/sd-angular-core-utilities-extensions.mjs +74 -7
- package/fesm2022/sd-angular-core-utilities-extensions.mjs.map +1 -1
- package/fesm2022/sd-angular-core-utilities-models.mjs +8 -2
- package/fesm2022/sd-angular-core-utilities-models.mjs.map +1 -1
- package/forms/autocomplete/src/autocomplete.component.d.ts +9 -4
- package/forms/date/src/date.component.d.ts +7 -2
- package/forms/datetime/src/datetime.component.d.ts +8 -4
- package/forms/input/src/input.component.d.ts +10 -7
- package/forms/input-number/src/input-number.component.d.ts +10 -6
- package/forms/radio/src/radio.component.d.ts +5 -1
- package/forms/select/src/select.component.d.ts +9 -4
- package/forms/textarea/src/textarea.component.d.ts +3 -1
- package/modules/auth/guards/portal.guard.d.ts +3 -3
- package/modules/index.d.ts +1 -1
- package/modules/keycloak/index.d.ts +4 -0
- package/modules/keycloak/keycloak.configuration.d.ts +11 -0
- package/modules/keycloak/keycloak.interceptor.d.ts +2 -0
- package/modules/keycloak/keycloak.module.d.ts +18 -0
- package/modules/keycloak/keycloak.service.d.ts +14 -0
- package/modules/layout/components/sidebar-v1/components/sidebar/sidebar.component.d.ts +1 -0
- package/modules/layout/components/sidebar-v1/components/user/user.component.d.ts +5 -2
- package/modules/layout/configurations/layout.configuration.d.ts +3 -0
- package/modules/layout/services/storage/storage.service.d.ts +1 -0
- package/package.json +82 -64
- package/pipes/index.d.ts +1 -0
- package/pipes/src/empty.pipe.d.ts +7 -0
- package/sd-angular-core-19.0.0-beta.30.tgz +0 -0
- package/services/confirm/src/lib/confirm.service.d.ts +1 -0
- package/services/docx/index.d.ts +1 -0
- package/services/docx/src/lib/docx.model.d.ts +9 -0
- package/services/docx/src/lib/docx.service.d.ts +13 -0
- package/services/docx/src/public-api.d.ts +2 -0
- package/services/index.d.ts +1 -0
- package/utilities/extensions/index.d.ts +1 -0
- package/utilities/extensions/src/color.extension.d.ts +20 -0
- package/utilities/extensions/src/string.extension.d.ts +1 -0
- package/utilities/models/index.d.ts +1 -0
- package/utilities/models/src/filter.model.d.ts +10 -2
- package/utilities/models/src/nested-key-of.model.d.ts +5 -0
- package/utilities/models/src/pattern.model.d.ts +3 -3
- package/components/document-builder/src/plugins/table-fit.plugin.d.ts +0 -4
- package/fesm2022/sd-angular-core-modules-oidc.mjs +0 -127
- package/fesm2022/sd-angular-core-modules-oidc.mjs.map +0 -1
- package/modules/oidc/dynamic-sts.loader.d.ts +0 -11
- package/modules/oidc/index.d.ts +0 -2
- package/modules/oidc/oidc.configuration.d.ts +0 -11
- package/modules/oidc/oidc.module.d.ts +0 -14
- /package/components/document-builder/src/plugins/{comment.plugin.d.ts → comment/comment.plugin.d.ts} +0 -0
- /package/components/document-builder/src/plugins/{variable.plugin.d.ts → variable/variable.plugin.d.ts} +0 -0
|
@@ -17,15 +17,73 @@
|
|
|
17
17
|
// Import the editor styles.
|
|
18
18
|
// @import '@ckeditor/ckeditor5-editor-classic/dist/index.css';
|
|
19
19
|
@import '@ckeditor/ckeditor5-essentials/dist/index.css';
|
|
20
|
+
@import '@ckeditor/ckeditor5-page-break/dist/index.css';
|
|
20
21
|
@import '@ckeditor/ckeditor5-autoformat/dist/index.css';
|
|
21
22
|
@import '@ckeditor/ckeditor5-basic-styles/dist/index.css';
|
|
22
23
|
// @import '@ckeditor/ckeditor5-block-quote/dist/index.css';
|
|
23
24
|
@import '@ckeditor/ckeditor5-heading/dist/index.css';
|
|
24
|
-
@import '@ckeditor/ckeditor5-image/dist/index.css';
|
|
25
|
+
// @import '@ckeditor/ckeditor5-image/dist/index.css';
|
|
26
|
+
@import '@ckeditor/ckeditor5-image/dist/index-editor.css';
|
|
25
27
|
@import '@ckeditor/ckeditor5-indent/dist/index.css';
|
|
26
28
|
@import '@ckeditor/ckeditor5-link/dist/index.css';
|
|
27
29
|
@import '@ckeditor/ckeditor5-list/dist/index.css';
|
|
28
30
|
// @import '@ckeditor/ckeditor5-media-embed/dist/index.css';
|
|
29
31
|
@import '@ckeditor/ckeditor5-paste-from-office/dist/index.css';
|
|
30
|
-
|
|
32
|
+
|
|
33
|
+
// hung.pham16: không sử dụng default styles của ckeditor vì server không hỗ trợ
|
|
34
|
+
// @import '@ckeditor/ckeditor5-table/dist/index.css';
|
|
35
|
+
@import '@ckeditor/ckeditor5-table/dist/index-editor.css';
|
|
36
|
+
|
|
31
37
|
// @import '@ckeditor/ckeditor5-mention/dist/index.css';
|
|
38
|
+
|
|
39
|
+
// Custom toolbar
|
|
40
|
+
.ck-editor {
|
|
41
|
+
/* --- 1. GIẢM KÍCH THƯỚC ICON VÀ CHỮ --- */
|
|
42
|
+
/* Giảm cỡ chữ trong dropdown (mặc định khoảng 13px) */
|
|
43
|
+
--ck-font-size-base: 11px !important;
|
|
44
|
+
|
|
45
|
+
/* Giảm kích thước Icon (mặc định 20px) */
|
|
46
|
+
--ck-icon-size: 16px !important;
|
|
47
|
+
|
|
48
|
+
/* --- 2. TỐI ƯU KHOẢNG CÁCH (Padding/Margin) --- */
|
|
49
|
+
|
|
50
|
+
/* Giảm khoảng cách giữa các nút */
|
|
51
|
+
--ck-spacing-small: 2px !important;
|
|
52
|
+
--ck-spacing-standard: 6px !important;
|
|
53
|
+
--ck-spacing-large: 8px !important;
|
|
54
|
+
|
|
55
|
+
/* */
|
|
56
|
+
--ck-color-table-focused-cell-background: transparent !important;
|
|
57
|
+
--ck-table-content-default-border-color: transparent !important;
|
|
58
|
+
|
|
59
|
+
//
|
|
60
|
+
--ck-insert-table-dropdown-padding: 10px;
|
|
61
|
+
--ck-insert-table-dropdown-box-height: 16px;
|
|
62
|
+
--ck-insert-table-dropdown-box-width: 16px;
|
|
63
|
+
--ck-insert-table-dropdown-box-margin: 1px;
|
|
64
|
+
|
|
65
|
+
--ck-focus-ring: 1px solid var(--ck-color-base-border);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/* Giảm độ cao của thanh toolbar (cho gọn) */
|
|
69
|
+
.ck-toolbar {
|
|
70
|
+
min-height: 32px !important; /* Mặc định thường là 40px */
|
|
71
|
+
padding: 2px !important;
|
|
72
|
+
|
|
73
|
+
/* Làm màu nền toolbar nhạt hơn cho hiện đại */
|
|
74
|
+
background: #f8f9fa !important;
|
|
75
|
+
border-bottom: 1px solid #e0e0e0 !important;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.ck-toolbar__items {
|
|
79
|
+
/* Chỉnh nút bấm trong toolbar nhỏ lại */
|
|
80
|
+
> .ck-button {
|
|
81
|
+
padding: 2px 4px !important; /* Giảm padding trái phải của nút */
|
|
82
|
+
min-height: 24px !important;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/* Chỉnh lại dropdown (Heading, Font Size) cho khớp */
|
|
86
|
+
> .ck-dropdown {
|
|
87
|
+
min-height: 24px !important;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './src/avatar.component';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { OnInit } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class SdAvatar implements OnInit {
|
|
4
|
+
#private;
|
|
5
|
+
src: string | undefined | null;
|
|
6
|
+
size: number;
|
|
7
|
+
isUrl: boolean;
|
|
8
|
+
initials: string;
|
|
9
|
+
bgColor: string;
|
|
10
|
+
ngOnInit(): void;
|
|
11
|
+
handleError(): void;
|
|
12
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SdAvatar, never>;
|
|
13
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SdAvatar, "sd-avatar", never, { "src": { "alias": "src"; "required": true; }; "size": { "alias": "size"; "required": false; }; }, {}, never, never, true, never>;
|
|
14
|
+
}
|
|
@@ -7,23 +7,28 @@ export declare class SdDocumentBuilder {
|
|
|
7
7
|
option: SdDocumentBuilderOption;
|
|
8
8
|
disabled: boolean;
|
|
9
9
|
set _disabled(val: boolean | '' | undefined | null);
|
|
10
|
+
contentChange: EventEmitter<string>;
|
|
10
11
|
Editor: typeof ClassicEditor;
|
|
11
12
|
config: SdEditorConfig;
|
|
12
|
-
contentChange: EventEmitter<string>;
|
|
13
13
|
ngOnInit(): void;
|
|
14
14
|
ngOnDestroy(): void;
|
|
15
15
|
onReady(editor: ClassicEditor): void;
|
|
16
|
-
scrollToComment: (markerId: string) => void;
|
|
17
16
|
setContent: (html: string) => void;
|
|
18
17
|
getContent: () => string;
|
|
19
18
|
setOrientation: (orientation: "PORTRAIT" | "LANDSCAPE") => void;
|
|
20
19
|
getOrientation: () => "PORTRAIT" | "LANDSCAPE";
|
|
21
|
-
getVariables: () => SdDocumentBuilderVariable[];
|
|
22
|
-
getComments(): SdDocumentBuilderComment[];
|
|
23
20
|
scrollToTop(): void;
|
|
24
21
|
heading: {
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Lấy tất cả headings trong document
|
|
24
|
+
* @returns Danh sách tất cả headings
|
|
25
|
+
*/
|
|
26
|
+
all: () => SdDocumentBuilderHeading[];
|
|
27
|
+
/**
|
|
28
|
+
* Scroll tới vị trí của heading
|
|
29
|
+
* @param id - ID của heading cần scroll tới
|
|
30
|
+
*/
|
|
31
|
+
scroll: (id: string) => void;
|
|
27
32
|
};
|
|
28
33
|
comment: {
|
|
29
34
|
/**
|
|
@@ -37,7 +42,10 @@ export declare class SdDocumentBuilder {
|
|
|
37
42
|
* @param data - Dữ liệu extra data
|
|
38
43
|
* @returns SdDocumentBuilderComment hoặc null nếu không có text được chọn
|
|
39
44
|
*/
|
|
40
|
-
add: <T = any>(range: ModelRange, comment: string,
|
|
45
|
+
add: <T = any>(range: ModelRange, comment: string, args?: {
|
|
46
|
+
markerIdExternal?: string | number;
|
|
47
|
+
data?: T;
|
|
48
|
+
}) => SdDocumentBuilderComment<T> | null;
|
|
41
49
|
/**
|
|
42
50
|
* Cập nhật nội dung comment
|
|
43
51
|
* @param markerId - ID của marker
|
|
@@ -63,6 +71,18 @@ export declare class SdDocumentBuilder {
|
|
|
63
71
|
*/
|
|
64
72
|
scroll: (markerId: string) => void;
|
|
65
73
|
};
|
|
74
|
+
variable: {
|
|
75
|
+
/**
|
|
76
|
+
* Lấy tất cả variabes trong document
|
|
77
|
+
* @returns Danh sách tất cả variables
|
|
78
|
+
*/
|
|
79
|
+
all: <T = any>() => SdDocumentBuilderVariable<T>[];
|
|
80
|
+
/**
|
|
81
|
+
* Scroll tới vị trí của variable
|
|
82
|
+
* @param uuid - uuid của variable FE sẽ tự sinh sau mỗi lần drop vào editor
|
|
83
|
+
*/
|
|
84
|
+
scroll: (uuid: string) => void;
|
|
85
|
+
};
|
|
66
86
|
/**
|
|
67
87
|
* Xuất file Word có Header/Footer
|
|
68
88
|
* @param fileName Tên file
|
|
@@ -76,6 +96,8 @@ export declare class SdDocumentBuilder {
|
|
|
76
96
|
header?: string;
|
|
77
97
|
footer?: string;
|
|
78
98
|
}): void;
|
|
99
|
+
hightSelectRange: (range: ModelRange) => void;
|
|
100
|
+
removeHighlightSeclectRange: () => void;
|
|
79
101
|
static ɵfac: i0.ɵɵFactoryDeclaration<SdDocumentBuilder, never>;
|
|
80
102
|
static ɵcmp: i0.ɵɵComponentDeclaration<SdDocumentBuilder, "sd-document-builder", never, { "option": { "alias": "option"; "required": true; }; "_disabled": { "alias": "disabled"; "required": false; }; }, { "contentChange": "contentChange"; }, never, never, true, never>;
|
|
81
103
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cấu hình màu cho Document Builder
|
|
3
|
+
* Bảng màu tập trung và cấu hình cho việc lựa chọn màu nhất quán
|
|
4
|
+
*/
|
|
5
|
+
import { ColorPickerConfig, FontColorConfig, FontSizeConfig, HeadingConfig } from 'ckeditor5';
|
|
6
|
+
/**
|
|
7
|
+
* Trả về bảng màu chung được sử dụng trong tất cả tính năng của document builder
|
|
8
|
+
* @returns Mảng các tùy chọn màu được định sẵn với giá trị hex và label
|
|
9
|
+
*/
|
|
10
|
+
export declare function getPresetColors(): FontColorConfig['colors'];
|
|
11
|
+
/**
|
|
12
|
+
* Trả về cấu hình bộ chọn màu với định dạng hex
|
|
13
|
+
* @returns Đối tượng cấu hình bộ chọn màu
|
|
14
|
+
*/
|
|
15
|
+
export declare function getColorPickerConfig(): ColorPickerConfig;
|
|
16
|
+
/**
|
|
17
|
+
* Trả về cấu hình kích thước font cho document builder
|
|
18
|
+
* @returns Mảng các tùy chọn kích thước font được định sẵn
|
|
19
|
+
*/
|
|
20
|
+
export declare function getFontSizeOptions(): FontSizeConfig['options'];
|
|
21
|
+
export declare function getHeadingOptions(): HeadingConfig['options'];
|
|
@@ -1,21 +1,27 @@
|
|
|
1
|
-
import { EditorConfig, EventInfo, ModelDocumentSelection, ModelRange } from 'ckeditor5';
|
|
1
|
+
import { EditorConfig, EventInfo, ModelDocumentSelection, ModelRange, ViewDataTransfer } from 'ckeditor5';
|
|
2
2
|
export type SdEditorConfig = EditorConfig & {
|
|
3
3
|
getOption?: () => SdDocumentBuilderOption;
|
|
4
4
|
};
|
|
5
5
|
export interface SdDocumentBuilderOption {
|
|
6
6
|
onDropVariable?: (variable: SdDocumentBuilderVariable, dropIndex: number) => boolean | Promise<boolean | SdDocumentBuilderVariable>;
|
|
7
|
-
onAddComment?: (
|
|
7
|
+
onAddComment?: (selectedComment: SdDocumentBuilderSelectedComment) => void;
|
|
8
8
|
onSelectComment?: (markerId: string) => void;
|
|
9
9
|
onSelection?: (selection: ModelDocumentSelection, $event: EventInfo<string, unknown>) => void;
|
|
10
10
|
onOrientation?: (orientation: 'PORTRAIT' | 'LANDSCAPE') => void;
|
|
11
|
+
onPaste?: (data: SdPasteEventData) => void | Promise<void>;
|
|
11
12
|
orientation?: 'PORTRAIT' | 'LANDSCAPE';
|
|
12
13
|
}
|
|
13
14
|
export interface SdDocumentBuilderVariable<T = any> {
|
|
14
15
|
id: string;
|
|
16
|
+
uuid?: string;
|
|
15
17
|
value: string;
|
|
16
18
|
display: string;
|
|
17
19
|
data?: T;
|
|
18
20
|
}
|
|
21
|
+
export interface SdDocumentBuilderSelectedComment {
|
|
22
|
+
range: ModelRange;
|
|
23
|
+
selectedText: string;
|
|
24
|
+
}
|
|
19
25
|
export interface SdDocumentBuilderComment<T = any> {
|
|
20
26
|
markerId: string;
|
|
21
27
|
selectedText: string;
|
|
@@ -29,3 +35,9 @@ export interface SdDocumentBuilderHeading {
|
|
|
29
35
|
level: number;
|
|
30
36
|
type: string;
|
|
31
37
|
}
|
|
38
|
+
export interface SdPasteEventData {
|
|
39
|
+
html?: string;
|
|
40
|
+
text: string;
|
|
41
|
+
source: 'word' | 'excel' | 'google-docs' | 'web' | 'unknown';
|
|
42
|
+
dataTransfer: ViewDataTransfer;
|
|
43
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Document Builder Utilities
|
|
3
|
+
* Các hàm tiện ích cho document builder
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Chuẩn hóa nội dung bằng cách chuyển đổi tất cả màu HSL và RGB sang hex
|
|
7
|
+
* @param content - Nội dung HTML cần chuẩn hóa
|
|
8
|
+
* @returns Nội dung đã được chuẩn hóa với màu hex
|
|
9
|
+
*/
|
|
10
|
+
export declare function normalize(content: string): string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Plugin } from 'ckeditor5';
|
|
2
|
+
/**
|
|
3
|
+
* Plugin để thêm margin-bottom: 4px cho các block elements
|
|
4
|
+
* (paragraph, heading, list, table) thông qua downcast conversion
|
|
5
|
+
*/
|
|
6
|
+
export declare class BlockSpace extends Plugin {
|
|
7
|
+
static get pluginName(): string;
|
|
8
|
+
init(): void;
|
|
9
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Plugin } from 'ckeditor5';
|
|
2
|
+
export declare class ImageCustomPlugin extends Plugin {
|
|
3
|
+
static get pluginName(): "ImageCustomPlugin";
|
|
4
|
+
init(): void;
|
|
5
|
+
/**
|
|
6
|
+
* Xử lý sự kiện chèn ảnh
|
|
7
|
+
*/
|
|
8
|
+
private handleImageInsert;
|
|
9
|
+
/**
|
|
10
|
+
* Xử lý sự kiện thay đổi attribute ảnh
|
|
11
|
+
*/
|
|
12
|
+
private handleImageAttributeChange;
|
|
13
|
+
/**
|
|
14
|
+
* Xử lý sự kiện thay đổi style ảnh - thêm float inline style cho căn chỉnh
|
|
15
|
+
*/
|
|
16
|
+
private handleImageStyleChange;
|
|
17
|
+
/**
|
|
18
|
+
* Áp dụng custom styles cho element ảnh
|
|
19
|
+
*/
|
|
20
|
+
private applyCustomStyles;
|
|
21
|
+
/**
|
|
22
|
+
* Tìm container ck-widget (element figure)
|
|
23
|
+
* CKEditor wrap ảnh block trong <figure class="ck-widget"><img></figure>
|
|
24
|
+
*/
|
|
25
|
+
private findWidgetElement;
|
|
26
|
+
/**
|
|
27
|
+
* Tìm element img thực tế bên trong widget structure
|
|
28
|
+
* CKEditor wrap ảnh block trong <figure class="ck-widget"><img></figure>
|
|
29
|
+
*/
|
|
30
|
+
private findImgElement;
|
|
31
|
+
}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
import { Plugin } from 'ckeditor5';
|
|
2
|
-
/**
|
|
3
|
-
* Custom base64 upload adapter plugin for CKEditor 5.
|
|
4
|
-
* Converts uploaded images to base64 data URLs instead of uploading to a server.
|
|
5
|
-
*/
|
|
6
2
|
export declare class ImageUploadPlugin extends Plugin {
|
|
7
3
|
static get pluginName(): "ImageUploadPlugin";
|
|
8
4
|
init(): void;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './comment.plugin';
|
|
3
|
-
export * from './variable.plugin';
|
|
4
|
-
export * from './table-
|
|
5
|
-
export * from './image-upload.plugin';
|
|
1
|
+
export * from './heading/heading.plugin';
|
|
2
|
+
export * from './comment/comment.plugin';
|
|
3
|
+
export * from './variable/variable.plugin';
|
|
4
|
+
export * from './table-custom';
|
|
5
|
+
export * from './image-upload/image-upload.plugin';
|
|
6
|
+
export * from './image-custom/image-custom.plugin';
|
|
7
|
+
export * from './page-orientation/page-orientation.plugin';
|
|
8
|
+
export * from './paste-handler';
|
|
9
|
+
export * from './highlight-range/highlight-range.plugin';
|
|
10
|
+
export * from './block-space/block-space.plugin';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Plugin } from 'ckeditor5';
|
|
2
|
-
export declare class
|
|
3
|
-
static readonly pluginName = "
|
|
2
|
+
export declare class PageOrientation extends Plugin {
|
|
3
|
+
static readonly pluginName = "PageOrientation";
|
|
4
4
|
private _currentOrientation;
|
|
5
5
|
private orientationChangeEmitter?;
|
|
6
6
|
private buttonView?;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module paste-from-office/filters/bookmark
|
|
7
|
+
*/
|
|
8
|
+
import { type ViewUpcastWriter, type ViewDocumentFragment } from 'ckeditor5';
|
|
9
|
+
/**
|
|
10
|
+
* Transforms `<a>` elements which are bookmarks by moving their children after the element.
|
|
11
|
+
*
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export declare function transformBookmarks(documentFragment: ViewDocumentFragment, writer: ViewUpcastWriter): void;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module paste-from-office/filters/br
|
|
7
|
+
*/
|
|
8
|
+
import { type ViewUpcastWriter, type ViewDocumentFragment } from 'ckeditor5';
|
|
9
|
+
/**
|
|
10
|
+
* Transforms `<br>` elements that are siblings to some block element into a paragraphs.
|
|
11
|
+
*
|
|
12
|
+
* @param documentFragment The view structure to be transformed.
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
export declare function transformBlockBrsToParagraphs(documentFragment: ViewDocumentFragment, writer: ViewUpcastWriter): void;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module paste-from-office/filters/image
|
|
7
|
+
*/
|
|
8
|
+
import { type ViewDocumentFragment } from 'ckeditor5';
|
|
9
|
+
/**
|
|
10
|
+
* Replaces source attribute of all `<img>` elements representing regular
|
|
11
|
+
* images (not the Word shapes) with inlined base64 image representation extracted from RTF or Blob data.
|
|
12
|
+
*
|
|
13
|
+
* @param documentFragment Document fragment on which transform images.
|
|
14
|
+
* @param rtfData The RTF data from which images representation will be used.
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
export declare function replaceImagesSourceWithBase64(documentFragment: ViewDocumentFragment, rtfData: string): void;
|
|
18
|
+
/**
|
|
19
|
+
* Converts given HEX string to base64 representation.
|
|
20
|
+
*
|
|
21
|
+
* @internal
|
|
22
|
+
* @param hexString The HEX string to be converted.
|
|
23
|
+
* @returns Base64 representation of a given HEX string.
|
|
24
|
+
*/
|
|
25
|
+
export declare function _convertHexToBase64(hexString: string): string;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module paste-from-office/filters/list
|
|
7
|
+
*/
|
|
8
|
+
import { ViewUpcastWriter, type ViewDocumentFragment } from 'ckeditor5';
|
|
9
|
+
/**
|
|
10
|
+
* Transforms Word specific list-like elements to the semantic HTML lists.
|
|
11
|
+
*
|
|
12
|
+
* Lists in Word are represented by block elements with special attributes like:
|
|
13
|
+
*
|
|
14
|
+
* ```xml
|
|
15
|
+
* <p class=MsoListParagraphCxSpFirst style='mso-list:l1 level1 lfo1'>...</p> // Paragraph based list.
|
|
16
|
+
* <h1 style='mso-list:l0 level1 lfo1'>...</h1> // Heading 1 based list.
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @param documentFragment The view structure to be transformed.
|
|
20
|
+
* @param stylesString Styles from which list-like elements styling will be extracted.
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
23
|
+
export declare function transformListItemLikeElementsIntoLists(documentFragment: ViewDocumentFragment, stylesString: string, hasMultiLevelListPlugin: boolean): void;
|
|
24
|
+
/**
|
|
25
|
+
* Removes paragraph wrapping content inside a list item.
|
|
26
|
+
*
|
|
27
|
+
* @internal
|
|
28
|
+
*/
|
|
29
|
+
export declare function unwrapParagraphInListItem(documentFragment: ViewDocumentFragment, writer: ViewUpcastWriter): void;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module paste-from-office/filters/parse
|
|
7
|
+
*/
|
|
8
|
+
import { type StylesProcessor, type ViewDocumentFragment } from 'ckeditor5';
|
|
9
|
+
/**
|
|
10
|
+
* Parses the provided HTML extracting contents of `<body>` and `<style>` tags.
|
|
11
|
+
*
|
|
12
|
+
* @param htmlString HTML string to be parsed.
|
|
13
|
+
*/
|
|
14
|
+
export declare function parsePasteOfficeHtml(htmlString: string, stylesProcessor: StylesProcessor): PasteOfficeHtmlParseResult;
|
|
15
|
+
/**
|
|
16
|
+
* The result of {@link ~parsePasteOfficeHtml}.
|
|
17
|
+
*/
|
|
18
|
+
export interface PasteOfficeHtmlParseResult {
|
|
19
|
+
/**
|
|
20
|
+
* Parsed body content as a traversable structure.
|
|
21
|
+
*/
|
|
22
|
+
body: ViewDocumentFragment;
|
|
23
|
+
/**
|
|
24
|
+
* Entire body content as a string.
|
|
25
|
+
*/
|
|
26
|
+
bodyString: string;
|
|
27
|
+
/**
|
|
28
|
+
* Array of native `CSSStyleSheet` objects, each representing separate `style` tag from the source HTML.
|
|
29
|
+
*/
|
|
30
|
+
styles: Array<CSSStyleSheet>;
|
|
31
|
+
/**
|
|
32
|
+
* All `style` tags contents combined in the order of occurrence into one string.
|
|
33
|
+
*/
|
|
34
|
+
stylesString: string;
|
|
35
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module paste-from-office/filters/removeboldwrapper
|
|
7
|
+
*/
|
|
8
|
+
import type { ViewUpcastWriter, ViewDocumentFragment } from 'ckeditor5';
|
|
9
|
+
/**
|
|
10
|
+
* Removes the `<b>` tag wrapper added by Google Docs to a copied content.
|
|
11
|
+
*
|
|
12
|
+
* @param documentFragment element `data.content` obtained from clipboard
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
export declare function removeBoldWrapper(documentFragment: ViewDocumentFragment, writer: ViewUpcastWriter): void;
|
package/components/document-builder/src/plugins/paste-handler/filters/removegooglesheetstag.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module paste-from-office/filters/removegooglesheetstag
|
|
7
|
+
*/
|
|
8
|
+
import type { ViewUpcastWriter, ViewDocumentFragment } from 'ckeditor5';
|
|
9
|
+
/**
|
|
10
|
+
* Removes the `<google-sheets-html-origin>` tag wrapper added by Google Sheets to a copied content.
|
|
11
|
+
*
|
|
12
|
+
* @param documentFragment element `data.content` obtained from clipboard
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
export declare function removeGoogleSheetsTag(documentFragment: ViewDocumentFragment, writer: ViewUpcastWriter): void;
|
package/components/document-builder/src/plugins/paste-handler/filters/removeinvalidtablewidth.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module paste-from-office/filters/removeinvalidtablewidth
|
|
7
|
+
*/
|
|
8
|
+
import type { ViewUpcastWriter, ViewDocumentFragment } from 'ckeditor5';
|
|
9
|
+
/**
|
|
10
|
+
* Removes the `width:0px` style from table pasted from Google Sheets and `width="0"` attribute from Word tables.
|
|
11
|
+
*
|
|
12
|
+
* @param documentFragment element `data.content` obtained from clipboard
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
export declare function removeInvalidTableWidth(documentFragment: ViewDocumentFragment, writer: ViewUpcastWriter): void;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module paste-from-office/filters/removemsattributes
|
|
7
|
+
*/
|
|
8
|
+
import { type ViewDocumentFragment } from 'ckeditor5';
|
|
9
|
+
/**
|
|
10
|
+
* Cleanup MS attributes like styles, attributes and elements.
|
|
11
|
+
*
|
|
12
|
+
* @param documentFragment element `data.content` obtained from clipboard.
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
export declare function removeMSAttributes(documentFragment: ViewDocumentFragment): void;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module paste-from-office/filters/removestyleblock
|
|
7
|
+
*/
|
|
8
|
+
import type { ViewUpcastWriter, ViewDocumentFragment } from 'ckeditor5';
|
|
9
|
+
/**
|
|
10
|
+
* Removes `<style>` block added by Google Sheets to a copied content.
|
|
11
|
+
*
|
|
12
|
+
* @param documentFragment element `data.content` obtained from clipboard
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
export declare function removeStyleBlock(documentFragment: ViewDocumentFragment, writer: ViewUpcastWriter): void;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module paste-from-office/filters/removexmlns
|
|
7
|
+
*/
|
|
8
|
+
import type { ViewUpcastWriter, ViewDocumentFragment } from 'ckeditor5';
|
|
9
|
+
/**
|
|
10
|
+
* Removes the `xmlns` attribute from table pasted from Google Sheets.
|
|
11
|
+
*
|
|
12
|
+
* @param documentFragment element `data.content` obtained from clipboard
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
export declare function removeXmlns(documentFragment: ViewDocumentFragment, writer: ViewUpcastWriter): void;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module paste-from-office/filters/replacemsfootnotes
|
|
7
|
+
*/
|
|
8
|
+
import type { ViewDocumentFragment, ViewUpcastWriter } from 'ckeditor5';
|
|
9
|
+
/**
|
|
10
|
+
* Replaces MS Word specific footnotes references and definitions with proper elements.
|
|
11
|
+
*
|
|
12
|
+
* Things to know about MS Word footnotes:
|
|
13
|
+
*
|
|
14
|
+
* * Footnote references in Word are marked with `mso-footnote-id` style.
|
|
15
|
+
* * Word does not support nested footnotes, so references within definitions are ignored.
|
|
16
|
+
* * Word appends extra spaces after footnote references within definitions, which are trimmed.
|
|
17
|
+
* * Footnote definitions list is marked with `mso-element: footnote-list` style it contain `mso-element: footnote` elements.
|
|
18
|
+
* * Footnote definition might contain tables, lists and other elements, not only text. They are placed directly within `li` element,
|
|
19
|
+
* without any wrapper (in opposition to text content of the definition, which is placed within `MsoFootnoteText` element).
|
|
20
|
+
*
|
|
21
|
+
* Example pseudo document showing MS Word footnote structure:
|
|
22
|
+
*
|
|
23
|
+
* ```html
|
|
24
|
+
* <p>Text with footnote<a style='mso-footnote-id:ftn1'>[1]</a> reference.</p>
|
|
25
|
+
*
|
|
26
|
+
* <div style='mso-element:footnote-list'>
|
|
27
|
+
* <div style='mso-element:footnote' id=ftn1>
|
|
28
|
+
* <p class=MsoFootnoteText><a style='mso-footnote-id:ftn1'>[1]</a> Footnote content</p>
|
|
29
|
+
* <table class="MsoTableGrid">...</table>
|
|
30
|
+
* </div>
|
|
31
|
+
* </div>
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* Will be transformed into:
|
|
35
|
+
*
|
|
36
|
+
* ```html
|
|
37
|
+
* <p>Text with footnote<sup class="footnote"><a id="ref-footnote-ftn1" href="#footnote-ftn1">1</a></sup> reference.</p>
|
|
38
|
+
*
|
|
39
|
+
* <ol class="footnotes">
|
|
40
|
+
* <li class="footnote-definition" id="footnote-ftn1">
|
|
41
|
+
* <a href="#ref-footnote-ftn1" class="footnote-backlink">^</a>
|
|
42
|
+
* <div class="footnote-content">
|
|
43
|
+
* <p>Footnote content</p>
|
|
44
|
+
* <table>...</table>
|
|
45
|
+
* </div>
|
|
46
|
+
* </li>
|
|
47
|
+
* </ol>
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* @param documentFragment `data.content` obtained from clipboard.
|
|
51
|
+
* @param writer The view writer instance.
|
|
52
|
+
* @internal
|
|
53
|
+
*/
|
|
54
|
+
export declare function replaceMSFootnotes(documentFragment: ViewDocumentFragment, writer: ViewUpcastWriter): void;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module paste-from-office/filters/replacetabswithinprewithspaces
|
|
7
|
+
*/
|
|
8
|
+
import type { ViewDocumentFragment, ViewUpcastWriter } from 'ckeditor5';
|
|
9
|
+
/**
|
|
10
|
+
* Replaces tab characters with spaces in text nodes that are inside elements styled with `white-space: pre-wrap`.
|
|
11
|
+
*
|
|
12
|
+
* This is a workaround for incorrect detection of pre-like formatting in the DOM converter for pasted Google Docs documents.
|
|
13
|
+
* When an element uses `white-space: pre-wrap`, the editor reduces tab characters to a single space, causing
|
|
14
|
+
* inconsistent spacing in pasted content. This function replaces tabs with spaces to ensure visual consistency.
|
|
15
|
+
* This is intended as a temporary solution.
|
|
16
|
+
*
|
|
17
|
+
* See: https://github.com/ckeditor/ckeditor5/issues/18995
|
|
18
|
+
*
|
|
19
|
+
* @param documentFragment The `data.content` element obtained from the clipboard.
|
|
20
|
+
* @param writer The upcast writer used to manipulate the view structure.
|
|
21
|
+
* @param tabWidth The number of spaces to replace each tab with. Defaults to 8.
|
|
22
|
+
* @internal
|
|
23
|
+
*/
|
|
24
|
+
export declare function replaceTabsWithinPreWithSpaces(documentFragment: ViewDocumentFragment, writer: ViewUpcastWriter, tabWidth: number): void;
|