@ckeditor/ckeditor5-html-support 36.0.0 → 37.0.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/build/html-support.js +1 -1
- package/package.json +42 -36
- package/src/conversionutils.d.ts +42 -0
- package/src/conversionutils.js +57 -77
- package/src/converters.d.ts +56 -0
- package/src/converters.js +104 -156
- package/src/datafilter.d.ts +255 -0
- package/src/datafilter.js +566 -782
- package/src/dataschema.d.ts +174 -0
- package/src/dataschema.js +143 -229
- package/src/fullpage.d.ts +26 -0
- package/src/fullpage.js +65 -86
- package/src/generalhtmlsupport.d.ts +93 -0
- package/src/generalhtmlsupport.js +244 -327
- package/src/generalhtmlsupportconfig.d.ts +76 -0
- package/src/generalhtmlsupportconfig.js +5 -0
- package/src/htmlcomment.d.ts +77 -0
- package/src/htmlcomment.js +175 -239
- package/src/htmlpagedataprocessor.d.ts +22 -0
- package/src/htmlpagedataprocessor.js +53 -76
- package/src/index.d.ts +13 -0
- package/src/index.js +0 -2
- package/src/integrations/codeblock.d.ts +27 -0
- package/src/integrations/codeblock.js +87 -115
- package/src/integrations/customelement.d.ts +30 -0
- package/src/integrations/customelement.js +127 -160
- package/src/integrations/documentlist.d.ts +31 -0
- package/src/integrations/documentlist.js +154 -191
- package/src/integrations/dualcontent.d.ts +49 -0
- package/src/integrations/dualcontent.js +92 -128
- package/src/integrations/heading.d.ts +30 -0
- package/src/integrations/heading.js +41 -54
- package/src/integrations/image.d.ts +30 -0
- package/src/integrations/image.js +154 -212
- package/src/integrations/integrationutils.d.ts +15 -0
- package/src/integrations/integrationutils.js +21 -0
- package/src/integrations/mediaembed.d.ts +30 -0
- package/src/integrations/mediaembed.js +101 -147
- package/src/integrations/script.d.ts +30 -0
- package/src/integrations/script.js +45 -67
- package/src/integrations/style.d.ts +30 -0
- package/src/integrations/style.js +45 -67
- package/src/integrations/table.d.ts +27 -0
- package/src/integrations/table.js +113 -160
- package/src/schemadefinitions.d.ts +13 -0
- package/src/schemadefinitions.js +846 -835
|
@@ -0,0 +1,174 @@
|
|
|
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 html-support/dataschema
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin, type Editor } from 'ckeditor5/src/core';
|
|
9
|
+
import type { AttributeProperties, SchemaItemDefinition } from 'ckeditor5/src/engine';
|
|
10
|
+
/**
|
|
11
|
+
* Holds representation of the extended HTML document type definitions to be used by the
|
|
12
|
+
* editor in HTML support.
|
|
13
|
+
*
|
|
14
|
+
* Data schema is represented by data schema definitions.
|
|
15
|
+
*
|
|
16
|
+
* To add new definition for block element,
|
|
17
|
+
* use {@link module:html-support/dataschema~DataSchema#registerBlockElement} method:
|
|
18
|
+
*
|
|
19
|
+
* ```ts
|
|
20
|
+
* dataSchema.registerBlockElement( {
|
|
21
|
+
* view: 'section',
|
|
22
|
+
* model: 'my-section',
|
|
23
|
+
* modelSchema: {
|
|
24
|
+
* inheritAllFrom: '$block'
|
|
25
|
+
* }
|
|
26
|
+
* } );
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* To add new definition for inline element,
|
|
30
|
+
* use {@link module:html-support/dataschema~DataSchema#registerInlineElement} method:
|
|
31
|
+
*
|
|
32
|
+
* ```
|
|
33
|
+
* dataSchema.registerInlineElement( {
|
|
34
|
+
* view: 'span',
|
|
35
|
+
* model: 'my-span',
|
|
36
|
+
* attributeProperties: {
|
|
37
|
+
* copyOnEnter: true
|
|
38
|
+
* }
|
|
39
|
+
* } );
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export default class DataSchema extends Plugin {
|
|
43
|
+
/**
|
|
44
|
+
* A map of registered data schema definitions.
|
|
45
|
+
*/
|
|
46
|
+
private readonly _definitions;
|
|
47
|
+
constructor(editor: Editor);
|
|
48
|
+
/**
|
|
49
|
+
* @inheritDoc
|
|
50
|
+
*/
|
|
51
|
+
static get pluginName(): 'DataSchema';
|
|
52
|
+
/**
|
|
53
|
+
* @inheritDoc
|
|
54
|
+
*/
|
|
55
|
+
init(): void;
|
|
56
|
+
/**
|
|
57
|
+
* Add new data schema definition describing block element.
|
|
58
|
+
*/
|
|
59
|
+
registerBlockElement(definition: DataSchemaBlockElementDefinition): void;
|
|
60
|
+
/**
|
|
61
|
+
* Add new data schema definition describing inline element.
|
|
62
|
+
*/
|
|
63
|
+
registerInlineElement(definition: DataSchemaInlineElementDefinition): void;
|
|
64
|
+
/**
|
|
65
|
+
* Updates schema definition describing block element with new properties.
|
|
66
|
+
*
|
|
67
|
+
* Creates new scheme if it doesn't exist.
|
|
68
|
+
* Array properties are concatenated with original values.
|
|
69
|
+
*
|
|
70
|
+
* @param definition Definition update.
|
|
71
|
+
*/
|
|
72
|
+
extendBlockElement(definition: DataSchemaBlockElementDefinition): void;
|
|
73
|
+
/**
|
|
74
|
+
* Updates schema definition describing inline element with new properties.
|
|
75
|
+
*
|
|
76
|
+
* Creates new scheme if it doesn't exist.
|
|
77
|
+
* Array properties are concatenated with original values.
|
|
78
|
+
*
|
|
79
|
+
* @param definition Definition update.
|
|
80
|
+
*/
|
|
81
|
+
extendInlineElement(definition: DataSchemaInlineElementDefinition): void;
|
|
82
|
+
/**
|
|
83
|
+
* Returns all definitions matching the given view name.
|
|
84
|
+
*
|
|
85
|
+
* @param includeReferences Indicates if this method should also include definitions of referenced models.
|
|
86
|
+
*/
|
|
87
|
+
getDefinitionsForView(viewName: string | RegExp, includeReferences?: boolean): Set<DataSchemaDefinition>;
|
|
88
|
+
/**
|
|
89
|
+
* Returns definitions matching the given view name.
|
|
90
|
+
*/
|
|
91
|
+
private _getMatchingViewDefinitions;
|
|
92
|
+
/**
|
|
93
|
+
* Resolves all definition references registered for the given data schema definition.
|
|
94
|
+
*
|
|
95
|
+
* @param modelName Data schema model name.
|
|
96
|
+
*/
|
|
97
|
+
private _getReferences;
|
|
98
|
+
/**
|
|
99
|
+
* Updates schema definition with new properties.
|
|
100
|
+
*
|
|
101
|
+
* Creates new scheme if it doesn't exist.
|
|
102
|
+
* Array properties are concatenated with original values.
|
|
103
|
+
*
|
|
104
|
+
* @param definition Definition update.
|
|
105
|
+
*/
|
|
106
|
+
private _extendDefinition;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* A base definition of {@link module:html-support/dataschema~DataSchema data schema}.
|
|
110
|
+
*/
|
|
111
|
+
export interface DataSchemaDefinition {
|
|
112
|
+
/**
|
|
113
|
+
* Name of the model.
|
|
114
|
+
*/
|
|
115
|
+
model: string;
|
|
116
|
+
/**
|
|
117
|
+
* Name of the view element.
|
|
118
|
+
*/
|
|
119
|
+
view?: string;
|
|
120
|
+
/**
|
|
121
|
+
* Indicates that the definition describes object element.
|
|
122
|
+
*/
|
|
123
|
+
isObject?: boolean;
|
|
124
|
+
/**
|
|
125
|
+
* The model schema item definition describing registered model.
|
|
126
|
+
*/
|
|
127
|
+
modelSchema?: SchemaItemDefinition;
|
|
128
|
+
/**
|
|
129
|
+
* Indicates that the definition describes block element.
|
|
130
|
+
* Set by {@link module:html-support/dataschema~DataSchema#registerBlockElement} method.
|
|
131
|
+
*/
|
|
132
|
+
isBlock?: boolean;
|
|
133
|
+
/**
|
|
134
|
+
* Indicates that the definition describes inline element.
|
|
135
|
+
*/
|
|
136
|
+
isInline?: boolean;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* A definition of {@link module:html-support/dataschema~DataSchema data schema} for block elements.
|
|
140
|
+
*/
|
|
141
|
+
export interface DataSchemaBlockElementDefinition extends DataSchemaDefinition {
|
|
142
|
+
/**
|
|
143
|
+
* Should be used when an element can behave both as a sectioning element (e.g. article) and
|
|
144
|
+
* element accepting only inline content (e.g. paragraph).
|
|
145
|
+
* If an element contains only inline content, this option will be used as a model name.
|
|
146
|
+
*/
|
|
147
|
+
paragraphLikeModel?: string;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* A definition of {@link module:html-support/dataschema~DataSchema data schema} for inline elements.
|
|
151
|
+
*/
|
|
152
|
+
export interface DataSchemaInlineElementDefinition extends DataSchemaDefinition {
|
|
153
|
+
/**
|
|
154
|
+
* Additional metadata describing the model attribute.
|
|
155
|
+
*/
|
|
156
|
+
attributeProperties?: AttributeProperties;
|
|
157
|
+
/**
|
|
158
|
+
* Element priority. Decides in what order elements are wrapped by
|
|
159
|
+
* {@link module:engine/view/downcastwriter~DowncastWriter}.
|
|
160
|
+
* Set by {@link module:html-support/dataschema~DataSchema#registerInlineElement} method.
|
|
161
|
+
*/
|
|
162
|
+
priority?: number;
|
|
163
|
+
/**
|
|
164
|
+
* The name of the model attribute that generates the same view element. GHS inline attribute
|
|
165
|
+
* will be removed from the model tree as soon as the coupled attribute is removed. See
|
|
166
|
+
* {@link module:html-support/datafilter~DataFilter#_registerModelPostFixer GHS post-fixer} for more details.
|
|
167
|
+
*/
|
|
168
|
+
coupledAttribute?: string;
|
|
169
|
+
}
|
|
170
|
+
declare module '@ckeditor/ckeditor5-core' {
|
|
171
|
+
interface PluginsMap {
|
|
172
|
+
[DataSchema.pluginName]: DataSchema;
|
|
173
|
+
}
|
|
174
|
+
}
|
package/src/dataschema.js
CHANGED
|
@@ -2,16 +2,13 @@
|
|
|
2
2
|
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
5
|
/**
|
|
7
6
|
* @module html-support/dataschema
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
8
|
import { Plugin } from 'ckeditor5/src/core';
|
|
11
9
|
import { toArray } from 'ckeditor5/src/utils';
|
|
12
10
|
import defaultConfig from './schemadefinitions';
|
|
13
11
|
import { mergeWith } from 'lodash-es';
|
|
14
|
-
|
|
15
12
|
/**
|
|
16
13
|
* Holds representation of the extended HTML document type definitions to be used by the
|
|
17
14
|
* editor in HTML support.
|
|
@@ -21,238 +18,155 @@ import { mergeWith } from 'lodash-es';
|
|
|
21
18
|
* To add new definition for block element,
|
|
22
19
|
* use {@link module:html-support/dataschema~DataSchema#registerBlockElement} method:
|
|
23
20
|
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
21
|
+
* ```ts
|
|
22
|
+
* dataSchema.registerBlockElement( {
|
|
23
|
+
* view: 'section',
|
|
24
|
+
* model: 'my-section',
|
|
25
|
+
* modelSchema: {
|
|
26
|
+
* inheritAllFrom: '$block'
|
|
27
|
+
* }
|
|
28
|
+
* } );
|
|
29
|
+
* ```
|
|
31
30
|
*
|
|
32
31
|
* To add new definition for inline element,
|
|
33
32
|
* use {@link module:html-support/dataschema~DataSchema#registerInlineElement} method:
|
|
34
33
|
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
34
|
+
* ```
|
|
35
|
+
* dataSchema.registerInlineElement( {
|
|
36
|
+
* view: 'span',
|
|
37
|
+
* model: 'my-span',
|
|
38
|
+
* attributeProperties: {
|
|
39
|
+
* copyOnEnter: true
|
|
40
|
+
* }
|
|
41
|
+
* } );
|
|
42
|
+
* ```
|
|
44
43
|
*/
|
|
45
44
|
export default class DataSchema extends Plugin {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
* @returns {Iterable.<module:html-support/dataschema~DataSchemaDefinition>}
|
|
162
|
-
*/
|
|
163
|
-
* _getReferences( modelName ) {
|
|
164
|
-
const { modelSchema } = this._definitions.get( modelName );
|
|
165
|
-
|
|
166
|
-
if ( !modelSchema ) {
|
|
167
|
-
return;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
const inheritProperties = [ 'inheritAllFrom', 'inheritTypesFrom', 'allowWhere', 'allowContentOf', 'allowAttributesOf' ];
|
|
171
|
-
|
|
172
|
-
for ( const property of inheritProperties ) {
|
|
173
|
-
for ( const referenceName of toArray( modelSchema[ property ] || [] ) ) {
|
|
174
|
-
const definition = this._definitions.get( referenceName );
|
|
175
|
-
|
|
176
|
-
if ( referenceName !== modelName && definition ) {
|
|
177
|
-
yield* this._getReferences( definition.model );
|
|
178
|
-
yield definition;
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
/**
|
|
185
|
-
* Updates schema definition with new properties.
|
|
186
|
-
*
|
|
187
|
-
* Creates new scheme if it doesn't exist.
|
|
188
|
-
* Array properties are concatenated with original values.
|
|
189
|
-
*
|
|
190
|
-
* @private
|
|
191
|
-
* @param {module:html-support/dataschema~DataSchemaDefinition} definition Definition update.
|
|
192
|
-
*/
|
|
193
|
-
_extendDefinition( definition ) {
|
|
194
|
-
const currentDefinition = this._definitions.get( definition.model );
|
|
195
|
-
|
|
196
|
-
const mergedDefinition = mergeWith( {}, currentDefinition, definition, ( target, source ) => {
|
|
197
|
-
return Array.isArray( target ) ? target.concat( source ) : undefined;
|
|
198
|
-
} );
|
|
199
|
-
|
|
200
|
-
this._definitions.set( definition.model, mergedDefinition );
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
// Test view name against the given pattern.
|
|
205
|
-
//
|
|
206
|
-
// @private
|
|
207
|
-
// @param {String|RegExp} pattern
|
|
208
|
-
// @param {String} viewName
|
|
209
|
-
// @returns {Boolean}
|
|
210
|
-
function testViewName( pattern, viewName ) {
|
|
211
|
-
if ( typeof pattern === 'string' ) {
|
|
212
|
-
return pattern === viewName;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
if ( pattern instanceof RegExp ) {
|
|
216
|
-
return pattern.test( viewName );
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
return false;
|
|
45
|
+
constructor(editor) {
|
|
46
|
+
super(editor);
|
|
47
|
+
this._definitions = new Map();
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* @inheritDoc
|
|
51
|
+
*/
|
|
52
|
+
static get pluginName() {
|
|
53
|
+
return 'DataSchema';
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* @inheritDoc
|
|
57
|
+
*/
|
|
58
|
+
init() {
|
|
59
|
+
for (const definition of defaultConfig.block) {
|
|
60
|
+
this.registerBlockElement(definition);
|
|
61
|
+
}
|
|
62
|
+
for (const definition of defaultConfig.inline) {
|
|
63
|
+
this.registerInlineElement(definition);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Add new data schema definition describing block element.
|
|
68
|
+
*/
|
|
69
|
+
registerBlockElement(definition) {
|
|
70
|
+
this._definitions.set(definition.model, { ...definition, isBlock: true });
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Add new data schema definition describing inline element.
|
|
74
|
+
*/
|
|
75
|
+
registerInlineElement(definition) {
|
|
76
|
+
this._definitions.set(definition.model, { ...definition, isInline: true });
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Updates schema definition describing block element with new properties.
|
|
80
|
+
*
|
|
81
|
+
* Creates new scheme if it doesn't exist.
|
|
82
|
+
* Array properties are concatenated with original values.
|
|
83
|
+
*
|
|
84
|
+
* @param definition Definition update.
|
|
85
|
+
*/
|
|
86
|
+
extendBlockElement(definition) {
|
|
87
|
+
this._extendDefinition({ ...definition, isBlock: true });
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Updates schema definition describing inline element with new properties.
|
|
91
|
+
*
|
|
92
|
+
* Creates new scheme if it doesn't exist.
|
|
93
|
+
* Array properties are concatenated with original values.
|
|
94
|
+
*
|
|
95
|
+
* @param definition Definition update.
|
|
96
|
+
*/
|
|
97
|
+
extendInlineElement(definition) {
|
|
98
|
+
this._extendDefinition({ ...definition, isInline: true });
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Returns all definitions matching the given view name.
|
|
102
|
+
*
|
|
103
|
+
* @param includeReferences Indicates if this method should also include definitions of referenced models.
|
|
104
|
+
*/
|
|
105
|
+
getDefinitionsForView(viewName, includeReferences = false) {
|
|
106
|
+
const definitions = new Set();
|
|
107
|
+
for (const definition of this._getMatchingViewDefinitions(viewName)) {
|
|
108
|
+
if (includeReferences) {
|
|
109
|
+
for (const reference of this._getReferences(definition.model)) {
|
|
110
|
+
definitions.add(reference);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
definitions.add(definition);
|
|
114
|
+
}
|
|
115
|
+
return definitions;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Returns definitions matching the given view name.
|
|
119
|
+
*/
|
|
120
|
+
_getMatchingViewDefinitions(viewName) {
|
|
121
|
+
return Array.from(this._definitions.values())
|
|
122
|
+
.filter(def => def.view && testViewName(viewName, def.view));
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Resolves all definition references registered for the given data schema definition.
|
|
126
|
+
*
|
|
127
|
+
* @param modelName Data schema model name.
|
|
128
|
+
*/
|
|
129
|
+
*_getReferences(modelName) {
|
|
130
|
+
const { modelSchema } = this._definitions.get(modelName);
|
|
131
|
+
if (!modelSchema) {
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
const inheritProperties = ['inheritAllFrom', 'inheritTypesFrom', 'allowWhere', 'allowContentOf', 'allowAttributesOf'];
|
|
135
|
+
for (const property of inheritProperties) {
|
|
136
|
+
for (const referenceName of toArray(modelSchema[property] || [])) {
|
|
137
|
+
const definition = this._definitions.get(referenceName);
|
|
138
|
+
if (referenceName !== modelName && definition) {
|
|
139
|
+
yield* this._getReferences(definition.model);
|
|
140
|
+
yield definition;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Updates schema definition with new properties.
|
|
147
|
+
*
|
|
148
|
+
* Creates new scheme if it doesn't exist.
|
|
149
|
+
* Array properties are concatenated with original values.
|
|
150
|
+
*
|
|
151
|
+
* @param definition Definition update.
|
|
152
|
+
*/
|
|
153
|
+
_extendDefinition(definition) {
|
|
154
|
+
const currentDefinition = this._definitions.get(definition.model);
|
|
155
|
+
const mergedDefinition = mergeWith({}, currentDefinition, definition, (target, source) => {
|
|
156
|
+
return Array.isArray(target) ? target.concat(source) : undefined;
|
|
157
|
+
});
|
|
158
|
+
this._definitions.set(definition.model, mergedDefinition);
|
|
159
|
+
}
|
|
220
160
|
}
|
|
221
|
-
|
|
222
|
-
/**
|
|
223
|
-
* A base definition of {@link module:html-support/dataschema~DataSchema data schema}.
|
|
224
|
-
*
|
|
225
|
-
* @typedef {Object} module:html-support/dataschema~DataSchemaDefinition
|
|
226
|
-
* @property {String} model Name of the model.
|
|
227
|
-
* @property {String} [view] Name of the view element.
|
|
228
|
-
* @property {Boolean} [isObject] Indicates that the definition describes object element.
|
|
229
|
-
* @property {module:engine/model/schema~SchemaItemDefinition} [modelSchema] The model schema item definition describing registered model.
|
|
230
|
-
*/
|
|
231
|
-
|
|
232
161
|
/**
|
|
233
|
-
*
|
|
234
|
-
*
|
|
235
|
-
* @typedef {Object} module:html-support/dataschema~DataSchemaBlockElementDefinition
|
|
236
|
-
* @property {Boolean} isBlock Indicates that the definition describes block element.
|
|
237
|
-
* Set by {@link module:html-support/dataschema~DataSchema#registerBlockElement} method.
|
|
238
|
-
* @property {String} [paragraphLikeModel] Should be used when an element can behave both as a sectioning element (e.g. article) and
|
|
239
|
-
* element accepting only inline content (e.g. paragraph).
|
|
240
|
-
* If an element contains only inline content, this option will be used as a model
|
|
241
|
-
* name.
|
|
242
|
-
* @extends module:html-support/dataschema~DataSchemaDefinition
|
|
243
|
-
*/
|
|
244
|
-
|
|
245
|
-
/**
|
|
246
|
-
* A definition of {@link module:html-support/dataschema~DataSchema data schema} for inline elements.
|
|
247
|
-
*
|
|
248
|
-
* @typedef {Object} module:html-support/dataschema~DataSchemaInlineElementDefinition
|
|
249
|
-
* @property {module:engine/model/schema~AttributeProperties} [attributeProperties] Additional metadata describing the model attribute.
|
|
250
|
-
* @property {Boolean} isInline Indicates that the definition describes inline element.
|
|
251
|
-
* @property {Number} [priority] Element priority. Decides in what order elements are wrapped by
|
|
252
|
-
* {@link module:engine/view/downcastwriter~DowncastWriter}.
|
|
253
|
-
* Set by {@link module:html-support/dataschema~DataSchema#registerInlineElement} method.
|
|
254
|
-
* @property {String} [coupledAttribute] The name of the model attribute that generates the same view element. GHS inline attribute
|
|
255
|
-
* will be removed from the model tree as soon as the coupled attribute is removed. See
|
|
256
|
-
* {@link module:html-support/datafilter~DataFilter#_registerModelPostFixer GHS post-fixer} for more details.
|
|
257
|
-
* @extends module:html-support/dataschema~DataSchemaDefinition
|
|
162
|
+
* Test view name against the given pattern.
|
|
258
163
|
*/
|
|
164
|
+
function testViewName(pattern, viewName) {
|
|
165
|
+
if (typeof pattern === 'string') {
|
|
166
|
+
return pattern === viewName;
|
|
167
|
+
}
|
|
168
|
+
if (pattern instanceof RegExp) {
|
|
169
|
+
return pattern.test(viewName);
|
|
170
|
+
}
|
|
171
|
+
return false;
|
|
172
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
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 html-support/fullpage
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core';
|
|
9
|
+
/**
|
|
10
|
+
* The full page editing feature. It preserves the whole HTML page in the editor data.
|
|
11
|
+
*/
|
|
12
|
+
export default class FullPage extends Plugin {
|
|
13
|
+
/**
|
|
14
|
+
* @inheritDoc
|
|
15
|
+
*/
|
|
16
|
+
static get pluginName(): 'FullPage';
|
|
17
|
+
/**
|
|
18
|
+
* @inheritDoc
|
|
19
|
+
*/
|
|
20
|
+
init(): void;
|
|
21
|
+
}
|
|
22
|
+
declare module '@ckeditor/ckeditor5-core' {
|
|
23
|
+
interface PluginsMap {
|
|
24
|
+
[FullPage.pluginName]: FullPage;
|
|
25
|
+
}
|
|
26
|
+
}
|