@ckeditor/ckeditor5-source-editing 40.0.0 → 40.2.0
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE.md +2 -2
- package/package.json +3 -3
- package/src/augmentation.d.ts +10 -10
- package/src/augmentation.js +5 -5
- package/src/index.d.ts +9 -9
- package/src/index.js +9 -9
- package/src/sourceediting.d.ts +102 -102
- package/src/sourceediting.js +299 -299
- package/src/utils/formathtml.d.ts +19 -19
- package/src/utils/formathtml.js +128 -128
- package/build/source-editing.js.map +0 -1
package/LICENSE.md
CHANGED
@@ -2,7 +2,7 @@ Software License Agreement
|
|
2
2
|
==========================
|
3
3
|
|
4
4
|
**CKEditor 5 source editing feature** – https://github.com/ckeditor/ckeditor5-source-editing <br>
|
5
|
-
Copyright (c) 2003
|
5
|
+
Copyright (c) 2003–2023, [CKSource Holding sp. z o.o.](https://cksource.com) All rights reserved.
|
6
6
|
|
7
7
|
Licensed under the terms of [GNU General Public License Version 2 or later](http://www.gnu.org/licenses/gpl.html).
|
8
8
|
|
@@ -14,4 +14,4 @@ Where not otherwise indicated, all CKEditor content is authored by CKSource engi
|
|
14
14
|
Trademarks
|
15
15
|
----------
|
16
16
|
|
17
|
-
**CKEditor** is a trademark of [CKSource Holding sp. z o.o.](https://cksource.com) All other brand and product names are trademarks, registered trademarks or service marks of their respective holders.
|
17
|
+
**CKEditor** is a trademark of [CKSource Holding sp. z o.o.](https://cksource.com) All other brand and product names are trademarks, registered trademarks, or service marks of their respective holders.
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ckeditor/ckeditor5-source-editing",
|
3
|
-
"version": "40.
|
3
|
+
"version": "40.2.0",
|
4
4
|
"description": "Source editing feature for CKEditor 5.",
|
5
5
|
"keywords": [
|
6
6
|
"ckeditor",
|
@@ -12,8 +12,8 @@
|
|
12
12
|
],
|
13
13
|
"main": "src/index.js",
|
14
14
|
"dependencies": {
|
15
|
-
"@ckeditor/ckeditor5-theme-lark": "40.
|
16
|
-
"ckeditor5": "40.
|
15
|
+
"@ckeditor/ckeditor5-theme-lark": "40.2.0",
|
16
|
+
"ckeditor5": "40.2.0"
|
17
17
|
},
|
18
18
|
"author": "CKSource (http://cksource.com/)",
|
19
19
|
"license": "GPL-2.0-or-later",
|
package/src/augmentation.d.ts
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
/**
|
2
|
-
* @license Copyright (c) 2003-2023, 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
|
-
import type { SourceEditing } from './index';
|
6
|
-
declare module '@ckeditor/ckeditor5-core' {
|
7
|
-
interface PluginsMap {
|
8
|
-
[SourceEditing.pluginName]: SourceEditing;
|
9
|
-
}
|
10
|
-
}
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2023, 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
|
+
import type { SourceEditing } from './index';
|
6
|
+
declare module '@ckeditor/ckeditor5-core' {
|
7
|
+
interface PluginsMap {
|
8
|
+
[SourceEditing.pluginName]: SourceEditing;
|
9
|
+
}
|
10
|
+
}
|
package/src/augmentation.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
/**
|
2
|
-
* @license Copyright (c) 2003-2023, 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
|
-
export {};
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2023, 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
|
+
export {};
|
package/src/index.d.ts
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
/**
|
2
|
-
* @license Copyright (c) 2003-2023, 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
|
-
* @module source-editing
|
7
|
-
*/
|
8
|
-
export { default as SourceEditing } from './sourceediting';
|
9
|
-
import './augmentation';
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2023, 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
|
+
* @module source-editing
|
7
|
+
*/
|
8
|
+
export { default as SourceEditing } from './sourceediting';
|
9
|
+
import './augmentation';
|
package/src/index.js
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
/**
|
2
|
-
* @license Copyright (c) 2003-2023, 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
|
-
* @module source-editing
|
7
|
-
*/
|
8
|
-
export { default as SourceEditing } from './sourceediting';
|
9
|
-
import './augmentation';
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2023, 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
|
+
* @module source-editing
|
7
|
+
*/
|
8
|
+
export { default as SourceEditing } from './sourceediting';
|
9
|
+
import './augmentation';
|
package/src/sourceediting.d.ts
CHANGED
@@ -1,102 +1,102 @@
|
|
1
|
-
/**
|
2
|
-
* @license Copyright (c) 2003-2023, 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
|
-
* @module source-editing/sourceediting
|
7
|
-
*/
|
8
|
-
import { type Editor, Plugin, PendingActions } from 'ckeditor5/src/core';
|
9
|
-
import '../theme/sourceediting.css';
|
10
|
-
/**
|
11
|
-
* The source editing feature.
|
12
|
-
*
|
13
|
-
* It provides the possibility to view and edit the source of the document.
|
14
|
-
*
|
15
|
-
* For a detailed overview, check the {@glink features/source-editing source editing feature documentation} and the
|
16
|
-
* {@glink api/source-editing package page}.
|
17
|
-
*/
|
18
|
-
export default class SourceEditing extends Plugin {
|
19
|
-
/**
|
20
|
-
* @inheritDoc
|
21
|
-
*/
|
22
|
-
static get pluginName(): "SourceEditing";
|
23
|
-
/**
|
24
|
-
* @inheritDoc
|
25
|
-
*/
|
26
|
-
static get requires(): readonly [typeof PendingActions];
|
27
|
-
/**
|
28
|
-
* Flag indicating whether the document source mode is active.
|
29
|
-
*
|
30
|
-
* @observable
|
31
|
-
*/
|
32
|
-
isSourceEditingMode: boolean;
|
33
|
-
/**
|
34
|
-
* The element replacer instance used to replace the editing roots with the wrapper elements containing the document source.
|
35
|
-
*/
|
36
|
-
private _elementReplacer;
|
37
|
-
/**
|
38
|
-
* Maps all root names to wrapper elements containing the document source.
|
39
|
-
*/
|
40
|
-
private _replacedRoots;
|
41
|
-
/**
|
42
|
-
* Maps all root names to their document data.
|
43
|
-
*/
|
44
|
-
private _dataFromRoots;
|
45
|
-
/**
|
46
|
-
* @inheritDoc
|
47
|
-
*/
|
48
|
-
constructor(editor: Editor);
|
49
|
-
/**
|
50
|
-
* @inheritDoc
|
51
|
-
*/
|
52
|
-
init(): void;
|
53
|
-
/**
|
54
|
-
* @inheritDoc
|
55
|
-
*/
|
56
|
-
afterInit(): void;
|
57
|
-
/**
|
58
|
-
* Updates the source data in all hidden editing roots.
|
59
|
-
*/
|
60
|
-
updateEditorData(): void;
|
61
|
-
/**
|
62
|
-
* Creates source editing wrappers that replace each editing root. Each wrapper contains the document source from the corresponding
|
63
|
-
* root.
|
64
|
-
*
|
65
|
-
* The wrapper element contains a textarea and it solves the problem, that the textarea element cannot auto expand its height based on
|
66
|
-
* the content it contains. The solution is to make the textarea more like a plain div element, which expands in height as much as it
|
67
|
-
* needs to, in order to display the whole document source without scrolling. The wrapper element is a parent for the textarea and for
|
68
|
-
* the pseudo-element `::after`, that replicates the look, content, and position of the textarea. The pseudo-element replica is hidden,
|
69
|
-
* but it is styled to be an identical visual copy of the textarea with the same content. Then, the wrapper is a grid container and both
|
70
|
-
* of its children (the textarea and the `::after` pseudo-element) are positioned within a CSS grid to occupy the same grid cell. The
|
71
|
-
* content in the pseudo-element `::after` is set in CSS and it stretches the grid to the appropriate size based on the textarea value.
|
72
|
-
* Since both children occupy the same grid cell, both have always the same height.
|
73
|
-
*/
|
74
|
-
private _showSourceEditing;
|
75
|
-
/**
|
76
|
-
* Restores all hidden editing roots and sets the source data in them.
|
77
|
-
*/
|
78
|
-
private _hideSourceEditing;
|
79
|
-
/**
|
80
|
-
* Focuses the textarea containing document source from the first editing root.
|
81
|
-
*/
|
82
|
-
private _focusSourceEditing;
|
83
|
-
/**
|
84
|
-
* Disables all commands.
|
85
|
-
*/
|
86
|
-
private _disableCommands;
|
87
|
-
/**
|
88
|
-
* Clears forced disable for all commands, that was previously set through {@link #_disableCommands}.
|
89
|
-
*/
|
90
|
-
private _enableCommands;
|
91
|
-
/**
|
92
|
-
* Adds or removes the `readonly` attribute from the textarea from all roots, if document source mode is active.
|
93
|
-
*
|
94
|
-
* @param isReadOnly Indicates whether all textarea elements should be read-only.
|
95
|
-
*/
|
96
|
-
private _handleReadOnlyMode;
|
97
|
-
/**
|
98
|
-
* Checks, if the plugin is allowed to handle the source editing mode by itself. Currently, the source editing mode is supported only
|
99
|
-
* for the {@link module:editor-classic/classiceditor~ClassicEditor classic editor}.
|
100
|
-
*/
|
101
|
-
private _isAllowedToHandleSourceEditingMode;
|
102
|
-
}
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2023, 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
|
+
* @module source-editing/sourceediting
|
7
|
+
*/
|
8
|
+
import { type Editor, Plugin, PendingActions } from 'ckeditor5/src/core';
|
9
|
+
import '../theme/sourceediting.css';
|
10
|
+
/**
|
11
|
+
* The source editing feature.
|
12
|
+
*
|
13
|
+
* It provides the possibility to view and edit the source of the document.
|
14
|
+
*
|
15
|
+
* For a detailed overview, check the {@glink features/source-editing source editing feature documentation} and the
|
16
|
+
* {@glink api/source-editing package page}.
|
17
|
+
*/
|
18
|
+
export default class SourceEditing extends Plugin {
|
19
|
+
/**
|
20
|
+
* @inheritDoc
|
21
|
+
*/
|
22
|
+
static get pluginName(): "SourceEditing";
|
23
|
+
/**
|
24
|
+
* @inheritDoc
|
25
|
+
*/
|
26
|
+
static get requires(): readonly [typeof PendingActions];
|
27
|
+
/**
|
28
|
+
* Flag indicating whether the document source mode is active.
|
29
|
+
*
|
30
|
+
* @observable
|
31
|
+
*/
|
32
|
+
isSourceEditingMode: boolean;
|
33
|
+
/**
|
34
|
+
* The element replacer instance used to replace the editing roots with the wrapper elements containing the document source.
|
35
|
+
*/
|
36
|
+
private _elementReplacer;
|
37
|
+
/**
|
38
|
+
* Maps all root names to wrapper elements containing the document source.
|
39
|
+
*/
|
40
|
+
private _replacedRoots;
|
41
|
+
/**
|
42
|
+
* Maps all root names to their document data.
|
43
|
+
*/
|
44
|
+
private _dataFromRoots;
|
45
|
+
/**
|
46
|
+
* @inheritDoc
|
47
|
+
*/
|
48
|
+
constructor(editor: Editor);
|
49
|
+
/**
|
50
|
+
* @inheritDoc
|
51
|
+
*/
|
52
|
+
init(): void;
|
53
|
+
/**
|
54
|
+
* @inheritDoc
|
55
|
+
*/
|
56
|
+
afterInit(): void;
|
57
|
+
/**
|
58
|
+
* Updates the source data in all hidden editing roots.
|
59
|
+
*/
|
60
|
+
updateEditorData(): void;
|
61
|
+
/**
|
62
|
+
* Creates source editing wrappers that replace each editing root. Each wrapper contains the document source from the corresponding
|
63
|
+
* root.
|
64
|
+
*
|
65
|
+
* The wrapper element contains a textarea and it solves the problem, that the textarea element cannot auto expand its height based on
|
66
|
+
* the content it contains. The solution is to make the textarea more like a plain div element, which expands in height as much as it
|
67
|
+
* needs to, in order to display the whole document source without scrolling. The wrapper element is a parent for the textarea and for
|
68
|
+
* the pseudo-element `::after`, that replicates the look, content, and position of the textarea. The pseudo-element replica is hidden,
|
69
|
+
* but it is styled to be an identical visual copy of the textarea with the same content. Then, the wrapper is a grid container and both
|
70
|
+
* of its children (the textarea and the `::after` pseudo-element) are positioned within a CSS grid to occupy the same grid cell. The
|
71
|
+
* content in the pseudo-element `::after` is set in CSS and it stretches the grid to the appropriate size based on the textarea value.
|
72
|
+
* Since both children occupy the same grid cell, both have always the same height.
|
73
|
+
*/
|
74
|
+
private _showSourceEditing;
|
75
|
+
/**
|
76
|
+
* Restores all hidden editing roots and sets the source data in them.
|
77
|
+
*/
|
78
|
+
private _hideSourceEditing;
|
79
|
+
/**
|
80
|
+
* Focuses the textarea containing document source from the first editing root.
|
81
|
+
*/
|
82
|
+
private _focusSourceEditing;
|
83
|
+
/**
|
84
|
+
* Disables all commands.
|
85
|
+
*/
|
86
|
+
private _disableCommands;
|
87
|
+
/**
|
88
|
+
* Clears forced disable for all commands, that was previously set through {@link #_disableCommands}.
|
89
|
+
*/
|
90
|
+
private _enableCommands;
|
91
|
+
/**
|
92
|
+
* Adds or removes the `readonly` attribute from the textarea from all roots, if document source mode is active.
|
93
|
+
*
|
94
|
+
* @param isReadOnly Indicates whether all textarea elements should be read-only.
|
95
|
+
*/
|
96
|
+
private _handleReadOnlyMode;
|
97
|
+
/**
|
98
|
+
* Checks, if the plugin is allowed to handle the source editing mode by itself. Currently, the source editing mode is supported only
|
99
|
+
* for the {@link module:editor-classic/classiceditor~ClassicEditor classic editor}.
|
100
|
+
*/
|
101
|
+
private _isAllowedToHandleSourceEditingMode;
|
102
|
+
}
|