@ckeditor/ckeditor5-paste-from-office-enhanced 41.3.0-alpha.4 → 41.3.1
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/build/paste-from-office-enhanced.js +1 -1
- package/package.json +3 -4
- package/src/index.js +1 -1
- package/src/normalizers/inliner/msofficestylesinliner.js +1 -1
- package/src/normalizers/inliner/utils.js +1 -1
- package/src/normalizers/propagator/msofficeinlinestylepropagator.js +1 -1
- package/src/normalizers/propagator/utils.js +1 -1
- package/src/pastefromofficeenhanced.js +1 -1
- package/src/pastefromofficeenhancedinliner.js +1 -1
- package/src/pastefromofficeenhancedpropagator.js +1 -1
- package/src/utils.js +1 -1
- package/dist/content-index.css +0 -4
- package/dist/editor-index.css +0 -4
- package/dist/index.css +0 -4
- package/dist/types/augmentation.d.ts +0 -14
- package/dist/types/index.d.ts +0 -13
- package/dist/types/normalizers/inliner/msofficestylesinliner.d.ts +0 -46
- package/dist/types/normalizers/inliner/utils.d.ts +0 -132
- package/dist/types/normalizers/propagator/msofficeinlinestylepropagator.d.ts +0 -47
- package/dist/types/normalizers/propagator/utils.d.ts +0 -101
- package/dist/types/pastefromofficeenhanced.d.ts +0 -33
- package/dist/types/pastefromofficeenhancedinliner.d.ts +0 -33
- package/dist/types/pastefromofficeenhancedpropagator.d.ts +0 -40
- package/dist/types/utils.d.ts +0 -15
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
7
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
8
|
-
*/
|
|
9
|
-
import { type NormalizerData, MSWordNormalizer } from '@ckeditor/ckeditor5-paste-from-office';
|
|
10
|
-
/**
|
|
11
|
-
* A normalizer that propagates inline styles from block element into `span` element with style properties
|
|
12
|
-
* and/or creates an `HTML` structure based on early mentioned block element styles.
|
|
13
|
-
*
|
|
14
|
-
* Normalizers are registered by the {@link module:paste-from-office-enhanced/pastefromofficeenhanced~PasteFromOfficeEnhanced}
|
|
15
|
-
* plugin and run on {@link module:clipboard/clipboardpipeline~ClipboardPipeline#event:inputTransformation inputTransformation event}.
|
|
16
|
-
* They detect environment-specific quirks and transform it into a form compatible with other CKEditor features.
|
|
17
|
-
*
|
|
18
|
-
* This particular normalizer turns a pasted content such as:
|
|
19
|
-
*
|
|
20
|
-
* ```html
|
|
21
|
-
* <p style="color:red;font-size:10px;font-weight:bold;">
|
|
22
|
-
* foo
|
|
23
|
-
* </p>
|
|
24
|
-
* ```
|
|
25
|
-
*
|
|
26
|
-
* into:
|
|
27
|
-
*
|
|
28
|
-
* ```html
|
|
29
|
-
* <p>
|
|
30
|
-
* <span style="color:red;font-size:10px">
|
|
31
|
-
* <strong>
|
|
32
|
-
* foo
|
|
33
|
-
* </strong>
|
|
34
|
-
* </span>
|
|
35
|
-
* </p>
|
|
36
|
-
* ```
|
|
37
|
-
*/
|
|
38
|
-
export default class MSOfficeInlineStylePropagator extends MSWordNormalizer {
|
|
39
|
-
/**
|
|
40
|
-
* @inheritDoc
|
|
41
|
-
*/
|
|
42
|
-
execute(data: NormalizerData): void;
|
|
43
|
-
/**
|
|
44
|
-
* @inheritDoc
|
|
45
|
-
*/
|
|
46
|
-
isActive(htmlString: string): boolean;
|
|
47
|
-
}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
7
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* @module paste-from-office-enhanced/normalizers/msofficeinlinestylepropagator/utils
|
|
11
|
-
*/
|
|
12
|
-
import type { UpcastWriter, ViewElement } from 'ckeditor5/src/engine.js';
|
|
13
|
-
/**
|
|
14
|
-
* The list of all `CSS` properties that need to be propagated.
|
|
15
|
-
*
|
|
16
|
-
* @protected
|
|
17
|
-
*/
|
|
18
|
-
export declare const CSS_PROPERTIES_TO_PROPAGATE: readonly ["color", "font-family", "font-size", "text-decoration", "text-decoration-line", "font-weight", "font-style", "vertical-align"];
|
|
19
|
-
/**
|
|
20
|
-
* The list of `CSS` properties that needs to be propagated as an inline `<span>` element.
|
|
21
|
-
*
|
|
22
|
-
* It's a subset of `CSS_PROPERTIES_TO_PROPAGATE`.
|
|
23
|
-
*
|
|
24
|
-
* @protected
|
|
25
|
-
*/
|
|
26
|
-
export declare const CSS_PROPERTIES_TO_BE_SPANS: readonly ["color", "font-family", "font-size"];
|
|
27
|
-
export type CSSPropertyValueAssertion = (value: string) => boolean;
|
|
28
|
-
export type CSSPropertyValueToElementNameMap = readonly [string | CSSPropertyValueAssertion, string];
|
|
29
|
-
/**
|
|
30
|
-
* The map of style to element propagate as a HTML elements
|
|
31
|
-
* (e.g. `text-decoration` with the `underline` value is propagated to `<u>`,
|
|
32
|
-
* or `font-weight` with the `bold` value is propagated to `<strong>`).
|
|
33
|
-
*
|
|
34
|
-
* @protected
|
|
35
|
-
*/
|
|
36
|
-
export declare const CSS_PROPERTIES_TO_BE_HTML_ELEMENTS: {
|
|
37
|
-
[key in Exclude<typeof CSS_PROPERTIES_TO_PROPAGATE[number], typeof CSS_PROPERTIES_TO_BE_SPANS[number]>]: ReadonlyArray<CSSPropertyValueToElementNameMap>;
|
|
38
|
-
};
|
|
39
|
-
/**
|
|
40
|
-
* Checks whether the given property should be propagated at all.
|
|
41
|
-
*
|
|
42
|
-
* @param property
|
|
43
|
-
* @returns
|
|
44
|
-
*/
|
|
45
|
-
export declare function isPropertyToBePropagated(property: string): property is typeof CSS_PROPERTIES_TO_PROPAGATE[number];
|
|
46
|
-
/**
|
|
47
|
-
* Checks whether the given property should be propagated as a span element.
|
|
48
|
-
*
|
|
49
|
-
* @param property
|
|
50
|
-
* @returns
|
|
51
|
-
*/
|
|
52
|
-
export declare function isPropertyToBePropagatedAsSpan(property: string): property is typeof CSS_PROPERTIES_TO_BE_SPANS[number];
|
|
53
|
-
/**
|
|
54
|
-
* Checks whether the given property should be propagated as an HTML element.
|
|
55
|
-
*
|
|
56
|
-
* @param property
|
|
57
|
-
* @returns
|
|
58
|
-
*/
|
|
59
|
-
export declare function isPropertyToBePropagatedAsHTMLElement(property: string): property is keyof typeof CSS_PROPERTIES_TO_BE_HTML_ELEMENTS;
|
|
60
|
-
/**
|
|
61
|
-
* Collects a list of styles to propagate from a block element.
|
|
62
|
-
*
|
|
63
|
-
* @param element The source `ViewElement`.
|
|
64
|
-
* @returns List of valid CSS properties to propagate.
|
|
65
|
-
*/
|
|
66
|
-
export declare function getStylePropertyNamesToPropagate(element: ViewElement): Array<typeof CSS_PROPERTIES_TO_PROPAGATE[number]>;
|
|
67
|
-
/**
|
|
68
|
-
* Executes styles propagation.
|
|
69
|
-
*
|
|
70
|
-
* @param element The source `ViewElement`.
|
|
71
|
-
* @param writer `UpcastWriter` instance.
|
|
72
|
-
* @param propertiesToPropagate List of valid CSS properties to propagate.
|
|
73
|
-
*/
|
|
74
|
-
export declare function propagateStyleProperties(element: ViewElement, writer: UpcastWriter, propertiesToPropagate: Array<string>): void;
|
|
75
|
-
/**
|
|
76
|
-
* Creates an `HTML` structure based on styles propagated from parent block element.
|
|
77
|
-
*
|
|
78
|
-
* @param element The source `ViewElement`.
|
|
79
|
-
* @param writer `UpcastWriter` instance.
|
|
80
|
-
* @param stylesToBeHtmlElements List of styles properties to be propagated as a HTML elements.
|
|
81
|
-
*/
|
|
82
|
-
export declare function propagateStylesAsHTMLElements(element: ViewElement, writer: UpcastWriter, stylesToBeHtmlElements: Partial<typeof CSS_PROPERTIES_TO_BE_HTML_ELEMENTS>): void;
|
|
83
|
-
/**
|
|
84
|
-
* Creates a `span` as a first child of the `element` with styles propagated from parent block element.
|
|
85
|
-
*
|
|
86
|
-
* @param element The source `ViewElement`.
|
|
87
|
-
* @param writer `UpcastWriter` instance.
|
|
88
|
-
* @param spanStyles List of styles properties to propagate.
|
|
89
|
-
*/
|
|
90
|
-
export declare function propagateStylesAsSpan(element: ViewElement, writer: UpcastWriter, spanStyles: Partial<Record<typeof CSS_PROPERTIES_TO_BE_SPANS[number], string>>): void;
|
|
91
|
-
/**
|
|
92
|
-
* Collects and filters element styles into proper objects for further propagation.
|
|
93
|
-
*
|
|
94
|
-
* @param element The source `ViewElement`.
|
|
95
|
-
* @param propertiesToPropagate The array of style properties to propagate.
|
|
96
|
-
* @returns An object with properties to propagate filtered into styles that will be propagated onto `span` and as a HTML elements.
|
|
97
|
-
*/
|
|
98
|
-
export declare function getStylesToPropagate(element: ViewElement, propertiesToPropagate: Array<string>): {
|
|
99
|
-
spanStyles: Partial<Record<typeof CSS_PROPERTIES_TO_BE_SPANS[number], string>>;
|
|
100
|
-
stylesToBeHtmlElements: Partial<typeof CSS_PROPERTIES_TO_BE_HTML_ELEMENTS>;
|
|
101
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
7
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* @module paste-from-office-enhanced/pastefromofficeenhanced
|
|
11
|
-
* @publicApi
|
|
12
|
-
*/
|
|
13
|
-
import { Plugin } from 'ckeditor5/src/core.js';
|
|
14
|
-
import PasteFromOfficeEnhancedInliner from './pastefromofficeenhancedinliner.js';
|
|
15
|
-
import PasteFromOfficeEnhancedPropagator from './pastefromofficeenhancedpropagator.js';
|
|
16
|
-
/**
|
|
17
|
-
* The Paste from Office Enhanced feature.
|
|
18
|
-
*
|
|
19
|
-
* Introduces seamless content pasting from MS Office applications with improved formatting retention for a smoother
|
|
20
|
-
* and more efficient workflow.
|
|
21
|
-
*
|
|
22
|
-
* For a detailed overview, check the {@glink features/pasting/paste-from-office Paste from Office Enhanced feature guide}.
|
|
23
|
-
*/
|
|
24
|
-
export default class PasteFromOfficeEnhanced extends Plugin {
|
|
25
|
-
/**
|
|
26
|
-
* @inheritDoc
|
|
27
|
-
*/
|
|
28
|
-
static get pluginName(): "PasteFromOfficeEnhanced";
|
|
29
|
-
/**
|
|
30
|
-
* @inheritDoc
|
|
31
|
-
*/
|
|
32
|
-
static get requires(): readonly ["PasteFromOffice", typeof PasteFromOfficeEnhancedInliner, typeof PasteFromOfficeEnhancedPropagator];
|
|
33
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
7
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* @module paste-from-office-enhanced/pastefromofficeenhancedinliner
|
|
11
|
-
*/
|
|
12
|
-
import { Plugin } from 'ckeditor5/src/core.js';
|
|
13
|
-
/**
|
|
14
|
-
* The Paste from Office Enhanced inliner plugin that inlines styles passed along the content from MS Office.
|
|
15
|
-
*/
|
|
16
|
-
export default class PasteFromOfficeEnhancedInliner extends Plugin {
|
|
17
|
-
/**
|
|
18
|
-
* @inheritDoc
|
|
19
|
-
*/
|
|
20
|
-
static get pluginName(): "PasteFromOfficeEnhancedInliner";
|
|
21
|
-
/**
|
|
22
|
-
* @inheritDoc
|
|
23
|
-
*/
|
|
24
|
-
static get requires(): readonly ["PasteFromOffice"];
|
|
25
|
-
/**
|
|
26
|
-
* @inheritDoc
|
|
27
|
-
*/
|
|
28
|
-
init(): void;
|
|
29
|
-
/**
|
|
30
|
-
* @inheritDoc
|
|
31
|
-
*/
|
|
32
|
-
afterInit(): void;
|
|
33
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
7
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* @module paste-from-office-enhanced/pastefromofficeenhancedpropagator
|
|
11
|
-
*/
|
|
12
|
-
import { Plugin, type Editor } from 'ckeditor5/src/core.js';
|
|
13
|
-
/**
|
|
14
|
-
* The Paste from Office Enhanced propagator that propagates inline styles from block elements to:
|
|
15
|
-
* * `span` element with `style` properties,
|
|
16
|
-
* * `HTML` structures based block element styles.
|
|
17
|
-
*/
|
|
18
|
-
export default class PasteFromOfficeEnhancedPropagator extends Plugin {
|
|
19
|
-
licenseKey: string;
|
|
20
|
-
/**
|
|
21
|
-
* @inheritDoc
|
|
22
|
-
*/
|
|
23
|
-
static get pluginName(): "PasteFromOfficeEnhancedPropagator";
|
|
24
|
-
/**
|
|
25
|
-
* @inheritDoc
|
|
26
|
-
*/
|
|
27
|
-
static get requires(): readonly ["PasteFromOffice"];
|
|
28
|
-
/**
|
|
29
|
-
* @inheritDoc
|
|
30
|
-
*/
|
|
31
|
-
constructor(editor: Editor);
|
|
32
|
-
/**
|
|
33
|
-
* @inheritDoc
|
|
34
|
-
*/
|
|
35
|
-
init(): void;
|
|
36
|
-
/**
|
|
37
|
-
* @inheritDoc
|
|
38
|
-
*/
|
|
39
|
-
destroy(): void;
|
|
40
|
-
}
|
package/dist/types/utils.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
7
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* Check if content was pasted from MS Excel.
|
|
11
|
-
*
|
|
12
|
-
* @param html
|
|
13
|
-
* @returns True if content is pasted from MS Excel
|
|
14
|
-
*/
|
|
15
|
-
export declare function isMSExcelContent(html: string): boolean;
|