@sd-angular/core 19.0.0-beta.26 → 19.0.0-beta.27
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 +1 -0
- package/components/document-builder/src/document-builder.model.d.ts +8 -1
- 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 +1 -0
- package/components/document-builder/src/plugins/index.d.ts +4 -1
- package/components/document-builder/src/plugins/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-fit/table-fit.plugin.d.ts → table-custom/index.d.ts} +6 -1
- package/fesm2022/sd-angular-core-components-document-builder.mjs +2097 -174
- package/fesm2022/sd-angular-core-components-document-builder.mjs.map +1 -1
- package/fesm2022/sd-angular-core-components-table.mjs +3 -3
- package/fesm2022/sd-angular-core-components-table.mjs.map +1 -1
- package/fesm2022/sd-angular-core-directives.mjs +29 -25
- package/fesm2022/sd-angular-core-directives.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.mjs +1 -0
- package/fesm2022/sd-angular-core-services.mjs.map +1 -1
- package/package.json +44 -36
- package/sd-angular-core-19.0.0-beta.27.tgz +0 -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/sd-angular-core-19.0.0-beta.26.tgz +0 -0
|
@@ -17,6 +17,7 @@
|
|
|
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';
|
|
@@ -1,4 +1,4 @@
|
|
|
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
|
};
|
|
@@ -8,6 +8,7 @@ export interface SdDocumentBuilderOption {
|
|
|
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> {
|
|
@@ -34,3 +35,9 @@ export interface SdDocumentBuilderHeading {
|
|
|
34
35
|
level: number;
|
|
35
36
|
type: string;
|
|
36
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,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
|
+
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
export * from './heading/heading.plugin';
|
|
2
2
|
export * from './comment/comment.plugin';
|
|
3
3
|
export * from './variable/variable.plugin';
|
|
4
|
-
export * from './table-
|
|
4
|
+
export * from './table-custom';
|
|
5
5
|
export * from './image-upload/image-upload.plugin';
|
|
6
6
|
export * from './image-custom/image-custom.plugin';
|
|
7
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';
|
package/components/document-builder/src/plugins/page-orientation/page-orientation.plugin.d.ts
CHANGED
|
@@ -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;
|
|
@@ -0,0 +1,27 @@
|
|
|
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/space
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Replaces last space preceding elements closing tag with ` `. Such operation prevents spaces from being removed
|
|
10
|
+
* during further DOM/View processing (see especially {@link module:engine/view/domconverter~ViewDomConverter#_processDomInlineNodes}).
|
|
11
|
+
* This method also takes into account Word specific `<o:p></o:p>` empty tags.
|
|
12
|
+
* Additionally multiline sequences of spaces and new lines between tags are removed (see #39 and #40).
|
|
13
|
+
*
|
|
14
|
+
* @param htmlString HTML string in which spacing should be normalized.
|
|
15
|
+
* @returns Input HTML with spaces normalized.
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
18
|
+
export declare function normalizeSpacing(htmlString: string): string;
|
|
19
|
+
/**
|
|
20
|
+
* Normalizes spacing in special Word `spacerun spans` (`<span style='mso-spacerun:yes'>\s+</span>`) by replacing
|
|
21
|
+
* all spaces with ` ` pairs. This prevents spaces from being removed during further DOM/View processing
|
|
22
|
+
* (see especially {@link module:engine/view/domconverter~ViewDomConverter#_processDomInlineNodes}).
|
|
23
|
+
*
|
|
24
|
+
* @param htmlDocument Native `Document` object in which spacing should be normalized.
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
27
|
+
export declare function normalizeSpacerunSpans(htmlDocument: Document): void;
|
|
@@ -0,0 +1,16 @@
|
|
|
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/table
|
|
7
|
+
*/
|
|
8
|
+
import { type ViewUpcastWriter, type ViewDocumentFragment } from 'ckeditor5';
|
|
9
|
+
/**
|
|
10
|
+
* Applies border none for table and cells without a border specified.
|
|
11
|
+
* Normalizes style length units to px.
|
|
12
|
+
* Handles left block table alignment.
|
|
13
|
+
*
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
export declare function transformTables(documentFragment: ViewDocumentFragment, writer: ViewUpcastWriter, hasTablePropertiesPlugin?: boolean, hasExtendedTableBlockAlignment?: boolean): 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/utils
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Normalizes CSS length value to 'px'.
|
|
10
|
+
*
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export declare function convertCssLengthToPx(value: string): string;
|
|
14
|
+
/**
|
|
15
|
+
* Returns true for value with 'px' unit.
|
|
16
|
+
*
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
export declare function isPx(value?: string): value is string;
|
|
20
|
+
/**
|
|
21
|
+
* Returns a rounded 'px' value.
|
|
22
|
+
*
|
|
23
|
+
* @internal
|
|
24
|
+
*/
|
|
25
|
+
export declare function toPx(value: number): string;
|
|
@@ -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/pastefromoffice
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin, ClipboardPipeline } from 'ckeditor5';
|
|
9
|
+
/**
|
|
10
|
+
* The Paste from Office plugin.
|
|
11
|
+
*
|
|
12
|
+
* This plugin handles content pasted from Office apps and transforms it (if necessary)
|
|
13
|
+
* to a valid structure which can then be understood by the editor features.
|
|
14
|
+
*
|
|
15
|
+
* Transformation is made by a set of predefined {@link module:paste-from-office/normalizer~PasteFromOfficeNormalizer normalizers}.
|
|
16
|
+
* This plugin includes following normalizers:
|
|
17
|
+
* * {@link module:paste-from-office/normalizers/mswordnormalizer~PasteFromOfficeMSWordNormalizer Microsoft Word normalizer}
|
|
18
|
+
* * {@link module:paste-from-office/normalizers/googledocsnormalizer~GoogleDocsNormalizer Google Docs normalizer}
|
|
19
|
+
*
|
|
20
|
+
* For more information about this feature check the {@glink api/paste-from-office package page}.
|
|
21
|
+
*/
|
|
22
|
+
export declare class PasteHandler extends Plugin {
|
|
23
|
+
/**
|
|
24
|
+
* @inheritDoc
|
|
25
|
+
*/
|
|
26
|
+
static get pluginName(): "PasteHandler";
|
|
27
|
+
/**
|
|
28
|
+
* @inheritDoc
|
|
29
|
+
*/
|
|
30
|
+
static get requires(): readonly [typeof ClipboardPipeline];
|
|
31
|
+
/**
|
|
32
|
+
* @inheritDoc
|
|
33
|
+
*/
|
|
34
|
+
init(): void;
|
|
35
|
+
}
|
package/components/document-builder/src/plugins/paste-handler/normalizers/googledocsnormalizer.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
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/normalizers/googledocsnormalizer
|
|
7
|
+
*/
|
|
8
|
+
import { type ViewDocument } from 'ckeditor5';
|
|
9
|
+
import type { PasteFromOfficeNormalizer, PasteFromOfficeNormalizerData } from '../types';
|
|
10
|
+
/**
|
|
11
|
+
* Normalizer for the content pasted from Google Docs.
|
|
12
|
+
*
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
export declare class GoogleDocsNormalizer implements PasteFromOfficeNormalizer {
|
|
16
|
+
readonly document: ViewDocument;
|
|
17
|
+
/**
|
|
18
|
+
* Creates a new `GoogleDocsNormalizer` instance.
|
|
19
|
+
*
|
|
20
|
+
* @param document View document.
|
|
21
|
+
*/
|
|
22
|
+
constructor(document: ViewDocument);
|
|
23
|
+
/**
|
|
24
|
+
* @inheritDoc
|
|
25
|
+
*/
|
|
26
|
+
isActive(htmlString: string): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* @inheritDoc
|
|
29
|
+
*/
|
|
30
|
+
execute(data: PasteFromOfficeNormalizerData): void;
|
|
31
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
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/normalizers/googlesheetsnormalizer
|
|
7
|
+
*/
|
|
8
|
+
import { type ViewDocument } from 'ckeditor5';
|
|
9
|
+
import type { PasteFromOfficeNormalizer, PasteFromOfficeNormalizerData } from '../types';
|
|
10
|
+
/**
|
|
11
|
+
* Normalizer for the content pasted from Google Sheets.
|
|
12
|
+
*
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
export declare class GoogleSheetsNormalizer implements PasteFromOfficeNormalizer {
|
|
16
|
+
readonly document: ViewDocument;
|
|
17
|
+
/**
|
|
18
|
+
* Creates a new `GoogleSheetsNormalizer` instance.
|
|
19
|
+
*
|
|
20
|
+
* @param document View document.
|
|
21
|
+
*/
|
|
22
|
+
constructor(document: ViewDocument);
|
|
23
|
+
/**
|
|
24
|
+
* @inheritDoc
|
|
25
|
+
*/
|
|
26
|
+
isActive(htmlString: string): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* @inheritDoc
|
|
29
|
+
*/
|
|
30
|
+
execute(data: PasteFromOfficeNormalizerData): void;
|
|
31
|
+
}
|
package/components/document-builder/src/plugins/paste-handler/normalizers/mswordnormalizer.d.ts
ADDED
|
@@ -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
|
+
import { type ViewDocument } from 'ckeditor5';
|
|
6
|
+
import type { PasteFromOfficeNormalizer, PasteFromOfficeNormalizerData } from '../types';
|
|
7
|
+
/**
|
|
8
|
+
* Normalizer for the content pasted from Microsoft Word.
|
|
9
|
+
*/
|
|
10
|
+
export declare class PasteFromOfficeMSWordNormalizer implements PasteFromOfficeNormalizer {
|
|
11
|
+
readonly document: ViewDocument;
|
|
12
|
+
readonly hasMultiLevelListPlugin: boolean;
|
|
13
|
+
readonly hasTablePropertiesPlugin: boolean;
|
|
14
|
+
readonly hasExtendedTableBlockAlignment: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Creates a new `PasteFromOfficeMSWordNormalizer` instance.
|
|
17
|
+
*
|
|
18
|
+
* @param document View document.
|
|
19
|
+
*/
|
|
20
|
+
constructor(document: ViewDocument, hasMultiLevelListPlugin?: boolean, hasTablePropertiesPlugin?: boolean, hasExtendedTableBlockAlignment?: boolean);
|
|
21
|
+
/**
|
|
22
|
+
* @inheritDoc
|
|
23
|
+
*/
|
|
24
|
+
isActive(htmlString: string): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* @inheritDoc
|
|
27
|
+
*/
|
|
28
|
+
execute(data: PasteFromOfficeNormalizerData): void;
|
|
29
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
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/normalizer
|
|
7
|
+
*/
|
|
8
|
+
import type { ClipboardInputTransformationData } from 'ckeditor5';
|
|
9
|
+
import type { PasteOfficeHtmlParseResult } from './filters/parse';
|
|
10
|
+
/**
|
|
11
|
+
* Interface defining a content transformation pasted from an external editor.
|
|
12
|
+
*
|
|
13
|
+
* Normalizers are registered by the {@link module:paste-from-office/pastefromoffice~PasteFromOffice} plugin and run on
|
|
14
|
+
* {@link module:clipboard/clipboardpipeline~ClipboardPipeline#event:inputTransformation inputTransformation event}.
|
|
15
|
+
* They detect environment-specific quirks and transform it into a form compatible with other CKEditor features.
|
|
16
|
+
*/
|
|
17
|
+
export interface PasteFromOfficeNormalizer {
|
|
18
|
+
/**
|
|
19
|
+
* Must return `true` if the `htmlString` contains content which this normalizer can transform.
|
|
20
|
+
*/
|
|
21
|
+
isActive(htmlString: string): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Executes the normalization of a given data.
|
|
24
|
+
*/
|
|
25
|
+
execute(data: PasteFromOfficeNormalizerData): void;
|
|
26
|
+
}
|
|
27
|
+
export interface PasteFromOfficeNormalizerData extends ClipboardInputTransformationData {
|
|
28
|
+
_isTransformedWithPasteFromOffice?: boolean;
|
|
29
|
+
_parsedData: PasteOfficeHtmlParseResult;
|
|
30
|
+
}
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import { Plugin } from 'ckeditor5';
|
|
2
|
-
export declare class
|
|
2
|
+
export declare class TableCustom extends Plugin {
|
|
3
3
|
init(): void;
|
|
4
|
+
/**
|
|
5
|
+
* Parse border style from CSS shorthand (e.g., "1px solid red" or "none")
|
|
6
|
+
*/
|
|
7
|
+
private _parseBorderStyleFromShorthand;
|
|
4
8
|
/**
|
|
5
9
|
* Apply default table width
|
|
6
10
|
*/
|
|
7
11
|
private _applyTableDefaults;
|
|
8
12
|
/**
|
|
9
13
|
* Apply default borders to all cells in a table
|
|
14
|
+
* Nếu cell đã có border rồi thì bỏ qua
|
|
10
15
|
*/
|
|
11
16
|
private _applyCellBorders;
|
|
12
17
|
/**
|