@ckeditor/ckeditor5-engine 47.4.0 → 47.5.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/index.js +15 -4
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/model/schema.d.ts +6 -1
- package/src/model/schema.js +17 -4
package/dist/index.js
CHANGED
|
@@ -24059,11 +24059,14 @@ function getFromAttributeCreator(config) {
|
|
|
24059
24059
|
*
|
|
24060
24060
|
* @param ranges Ranges to be validated.
|
|
24061
24061
|
* @param attribute The name of the attribute to check.
|
|
24062
|
+
* @param options Optional configuration.
|
|
24063
|
+
* @param options.includeEmptyRanges When `true`, empty ranges that allow the attribute are also included
|
|
24064
|
+
* in the returned ranges.
|
|
24062
24065
|
* @returns Ranges in which the attribute is allowed.
|
|
24063
|
-
*/ *getValidRanges(ranges, attribute) {
|
|
24066
|
+
*/ *getValidRanges(ranges, attribute, options = {}) {
|
|
24064
24067
|
ranges = convertToMinimalFlatRanges(ranges);
|
|
24065
24068
|
for (const range of ranges){
|
|
24066
|
-
yield* this._getValidRangesForRange(range, attribute);
|
|
24069
|
+
yield* this._getValidRangesForRange(range, attribute, options);
|
|
24067
24070
|
}
|
|
24068
24071
|
}
|
|
24069
24072
|
/**
|
|
@@ -24331,14 +24334,22 @@ function getFromAttributeCreator(config) {
|
|
|
24331
24334
|
* @param range The range to process.
|
|
24332
24335
|
* @param attribute The name of the attribute to check.
|
|
24333
24336
|
* @returns Ranges in which the attribute is allowed.
|
|
24334
|
-
*/ *_getValidRangesForRange(range, attribute) {
|
|
24337
|
+
*/ *_getValidRangesForRange(range, attribute, options) {
|
|
24335
24338
|
let start = range.start;
|
|
24336
24339
|
let end = range.start;
|
|
24337
24340
|
for (const item of range.getItems({
|
|
24338
24341
|
shallow: true
|
|
24339
24342
|
})){
|
|
24340
24343
|
if (item.is('element')) {
|
|
24341
|
-
|
|
24344
|
+
if (options.includeEmptyRanges && item.isEmpty) {
|
|
24345
|
+
// In empty block check if it accepts text with the given attribute.
|
|
24346
|
+
const context = this.createContext(item);
|
|
24347
|
+
if (this.checkChild(context, '$text') && this.checkAttribute(context.push('$text'), attribute)) {
|
|
24348
|
+
yield ModelRange._createIn(item);
|
|
24349
|
+
}
|
|
24350
|
+
} else {
|
|
24351
|
+
yield* this._getValidRangesForRange(ModelRange._createIn(item), attribute, options);
|
|
24352
|
+
}
|
|
24342
24353
|
}
|
|
24343
24354
|
if (!this.checkAttribute(item, attribute)) {
|
|
24344
24355
|
if (!start.isEqual(end)) {
|