@ckeditor/ckeditor5-paste-from-office 48.2.0 → 48.3.0-alpha.0
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/augmentation.d.ts +8 -8
- package/dist/filters/bookmark.d.ts +10 -10
- package/dist/filters/br.d.ts +11 -11
- package/dist/filters/image.d.ts +19 -19
- package/dist/filters/list.d.ts +25 -25
- package/dist/filters/parse.d.ts +28 -28
- package/dist/filters/removeboldwrapper.d.ts +11 -11
- package/dist/filters/removegooglesheetstag.d.ts +11 -11
- package/dist/filters/removeinvalidtablewidth.d.ts +11 -11
- package/dist/filters/removemsattributes.d.ts +11 -11
- package/dist/filters/removestyleblock.d.ts +11 -11
- package/dist/filters/removexmlns.d.ts +11 -11
- package/dist/filters/replacemsfootnotes.d.ts +53 -50
- package/dist/filters/replacetabswithinprewithspaces.d.ts +20 -20
- package/dist/filters/space.d.ts +23 -23
- package/dist/filters/table.d.ts +12 -12
- package/dist/filters/utils.d.ts +17 -17
- package/dist/index-content.css +1 -0
- package/dist/index-editor.css +1 -0
- package/dist/index.css +0 -2
- package/dist/index.d.ts +25 -25
- package/dist/index.js +1372 -1663
- package/dist/index.js.map +1 -1
- package/dist/normalizer.d.ts +20 -20
- package/dist/normalizers/googledocsnormalizer.d.ts +27 -27
- package/dist/normalizers/googlesheetsnormalizer.d.ts +27 -27
- package/dist/normalizers/mswordnormalizer.d.ts +28 -28
- package/dist/pastefromoffice.d.ts +54 -54
- package/package.json +5 -5
- package/dist/index.css.map +0 -1
package/dist/augmentation.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import type { PasteFromOffice } from
|
|
6
|
-
declare module
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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 { PasteFromOffice } from "./index.js";
|
|
6
|
+
declare module "@ckeditor/ckeditor5-core" {
|
|
7
|
+
interface PluginsMap {
|
|
8
|
+
[PasteFromOffice.pluginName]: PasteFromOffice;
|
|
9
|
+
}
|
|
10
10
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import type { ViewUpcastWriter, ViewDocumentFragment } from
|
|
6
|
+
* @module paste-from-office/filters/bookmark
|
|
7
|
+
*/
|
|
8
|
+
import type { ViewUpcastWriter, ViewDocumentFragment } from "@ckeditor/ckeditor5-engine";
|
|
9
9
|
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
* Transforms `<a>` elements which are bookmarks by moving their children after the element.
|
|
11
|
+
*
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
14
|
export declare function transformBookmarks(documentFragment: ViewDocumentFragment, writer: ViewUpcastWriter): void;
|
package/dist/filters/br.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import { type ViewUpcastWriter, type ViewDocumentFragment } from
|
|
6
|
+
* @module paste-from-office/filters/br
|
|
7
|
+
*/
|
|
8
|
+
import { type ViewUpcastWriter, type ViewDocumentFragment } from "@ckeditor/ckeditor5-engine";
|
|
9
9
|
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
15
|
export declare function transformBlockBrsToParagraphs(documentFragment: ViewDocumentFragment, writer: ViewUpcastWriter): void;
|
package/dist/filters/image.d.ts
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import { type ViewDocumentFragment } from
|
|
6
|
+
* @module paste-from-office/filters/image
|
|
7
|
+
*/
|
|
8
|
+
import { type ViewDocumentFragment } from "@ckeditor/ckeditor5-engine";
|
|
9
9
|
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
17
|
export declare function replaceImagesSourceWithBase64(documentFragment: ViewDocumentFragment, rtfData: string): void;
|
|
18
18
|
/**
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
25
|
export declare function _convertHexToBase64(hexString: string): string;
|
package/dist/filters/list.d.ts
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import { ViewUpcastWriter, type ViewDocumentFragment } from
|
|
6
|
+
* @module paste-from-office/filters/list
|
|
7
|
+
*/
|
|
8
|
+
import { ViewUpcastWriter, type ViewDocumentFragment } from "@ckeditor/ckeditor5-engine";
|
|
9
9
|
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
+
* @param hasMultiLevelListPlugin Whether the editor has the multi-level list plugin enabled.
|
|
22
|
+
* @param enableSkipLevelLists Whether to enable skip-level lists.
|
|
23
|
+
* @internal
|
|
24
|
+
*/
|
|
25
25
|
export declare function transformListItemLikeElementsIntoLists(documentFragment: ViewDocumentFragment, stylesString: string, hasMultiLevelListPlugin: boolean, enableSkipLevelLists?: boolean): void;
|
|
26
26
|
/**
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
* Removes paragraph wrapping content inside a list item.
|
|
28
|
+
*
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
31
31
|
export declare function unwrapParagraphInListItem(documentFragment: ViewDocumentFragment, writer: ViewUpcastWriter): void;
|
package/dist/filters/parse.d.ts
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import { type StylesProcessor, type ViewDocumentFragment } from
|
|
6
|
+
* @module paste-from-office/filters/parse
|
|
7
|
+
*/
|
|
8
|
+
import { type StylesProcessor, type ViewDocumentFragment } from "@ckeditor/ckeditor5-engine";
|
|
9
9
|
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
* Parses the provided HTML extracting contents of `<body>` and `<style>` tags.
|
|
11
|
+
*
|
|
12
|
+
* @param htmlString HTML string to be parsed.
|
|
13
|
+
*/
|
|
14
14
|
export declare function parsePasteOfficeHtml(htmlString: string, stylesProcessor: StylesProcessor): PasteOfficeHtmlParseResult;
|
|
15
15
|
/**
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
* The result of {@link ~parsePasteOfficeHtml}.
|
|
17
|
+
*/
|
|
18
18
|
export interface PasteOfficeHtmlParseResult {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
35
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import type { ViewUpcastWriter, ViewDocumentFragment } from
|
|
6
|
+
* @module paste-from-office/filters/removeboldwrapper
|
|
7
|
+
*/
|
|
8
|
+
import type { ViewUpcastWriter, ViewDocumentFragment } from "@ckeditor/ckeditor5-engine";
|
|
9
9
|
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
15
|
export declare function removeBoldWrapper(documentFragment: ViewDocumentFragment, writer: ViewUpcastWriter): void;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import type { ViewUpcastWriter, ViewDocumentFragment } from
|
|
6
|
+
* @module paste-from-office/filters/removegooglesheetstag
|
|
7
|
+
*/
|
|
8
|
+
import type { ViewUpcastWriter, ViewDocumentFragment } from "@ckeditor/ckeditor5-engine";
|
|
9
9
|
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
15
|
export declare function removeGoogleSheetsTag(documentFragment: ViewDocumentFragment, writer: ViewUpcastWriter): void;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import type { ViewUpcastWriter, ViewDocumentFragment } from
|
|
6
|
+
* @module paste-from-office/filters/removeinvalidtablewidth
|
|
7
|
+
*/
|
|
8
|
+
import type { ViewUpcastWriter, ViewDocumentFragment } from "@ckeditor/ckeditor5-engine";
|
|
9
9
|
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
15
|
export declare function removeInvalidTableWidth(documentFragment: ViewDocumentFragment, writer: ViewUpcastWriter): void;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import { type ViewDocumentFragment } from
|
|
6
|
+
* @module paste-from-office/filters/removemsattributes
|
|
7
|
+
*/
|
|
8
|
+
import { type ViewDocumentFragment } from "@ckeditor/ckeditor5-engine";
|
|
9
9
|
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
* Cleanup MS attributes like styles, attributes and elements.
|
|
11
|
+
*
|
|
12
|
+
* @param documentFragment element `data.content` obtained from clipboard.
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
15
|
export declare function removeMSAttributes(documentFragment: ViewDocumentFragment): void;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import type { ViewUpcastWriter, ViewDocumentFragment } from
|
|
6
|
+
* @module paste-from-office/filters/removestyleblock
|
|
7
|
+
*/
|
|
8
|
+
import type { ViewUpcastWriter, ViewDocumentFragment } from "@ckeditor/ckeditor5-engine";
|
|
9
9
|
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
15
|
export declare function removeStyleBlock(documentFragment: ViewDocumentFragment, writer: ViewUpcastWriter): void;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import type { ViewUpcastWriter, ViewDocumentFragment } from
|
|
6
|
+
* @module paste-from-office/filters/removexmlns
|
|
7
|
+
*/
|
|
8
|
+
import type { ViewUpcastWriter, ViewDocumentFragment } from "@ckeditor/ckeditor5-engine";
|
|
9
9
|
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
15
|
export declare function removeXmlns(documentFragment: ViewDocumentFragment, writer: ViewUpcastWriter): void;
|
|
@@ -1,54 +1,57 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import type { ViewDocumentFragment, ViewUpcastWriter } from
|
|
6
|
+
* @module paste-from-office/filters/replacemsfootnotes
|
|
7
|
+
*/
|
|
8
|
+
import type { ViewDocumentFragment, ViewUpcastWriter } from "@ckeditor/ckeditor5-engine";
|
|
9
9
|
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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
|
+
* <div class="footnotes">
|
|
40
|
+
* <hr class="footnotes-divider">
|
|
41
|
+
* <ol class="footnotes-list">
|
|
42
|
+
* <li class="footnote-definition" id="footnote-ftn1">
|
|
43
|
+
* <a href="#ref-footnote-ftn1" class="footnote-backlink">^</a>
|
|
44
|
+
* <div class="footnote-content">
|
|
45
|
+
* <p>Footnote content</p>
|
|
46
|
+
* <table>...</table>
|
|
47
|
+
* </div>
|
|
48
|
+
* </li>
|
|
49
|
+
* </ol>
|
|
50
|
+
* </div>
|
|
51
|
+
* ```
|
|
52
|
+
*
|
|
53
|
+
* @param documentFragment `data.content` obtained from clipboard.
|
|
54
|
+
* @param writer The view writer instance.
|
|
55
|
+
* @internal
|
|
56
|
+
*/
|
|
54
57
|
export declare function replaceMSFootnotes(documentFragment: ViewDocumentFragment, writer: ViewUpcastWriter): void;
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import type { ViewDocumentFragment, ViewUpcastWriter } from
|
|
6
|
+
* @module paste-from-office/filters/replacetabswithinprewithspaces
|
|
7
|
+
*/
|
|
8
|
+
import type { ViewDocumentFragment, ViewUpcastWriter } from "@ckeditor/ckeditor5-engine";
|
|
9
9
|
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
24
|
export declare function replaceTabsWithinPreWithSpaces(documentFragment: ViewDocumentFragment, writer: ViewUpcastWriter, tabWidth: number): void;
|
package/dist/filters/space.d.ts
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
* @module paste-from-office/filters/space
|
|
7
|
+
*/
|
|
8
8
|
/**
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
|
13
|
+
* https://github.com/ckeditor/ckeditor5-paste-from-office/issues/39
|
|
14
|
+
* and https://github.com/ckeditor/ckeditor5-paste-from-office/issues/40).
|
|
15
|
+
*
|
|
16
|
+
* @param htmlString HTML string in which spacing should be normalized.
|
|
17
|
+
* @returns Input HTML with spaces normalized.
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
20
|
export declare function normalizeSpacing(htmlString: string): string;
|
|
21
21
|
/**
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
* Normalizes spacing in special Word `spacerun spans` (`<span style='mso-spacerun:yes'>\s+</span>`) by replacing
|
|
23
|
+
* all spaces with ` ` pairs. This prevents spaces from being removed during further DOM/View processing
|
|
24
|
+
* (see especially {@link module:engine/view/domconverter~ViewDomConverter#_processDomInlineNodes}).
|
|
25
|
+
*
|
|
26
|
+
* @param htmlDocument Native `Document` object in which spacing should be normalized.
|
|
27
|
+
* @internal
|
|
28
|
+
*/
|
|
29
29
|
export declare function normalizeSpacerunSpans(htmlDocument: Document): void;
|