This repository was archived by the owner on Jun 26, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +16
-8
lines changed Expand file tree Collapse file tree 2 files changed +16
-8
lines changed Original file line number Diff line number Diff line change @@ -103,12 +103,15 @@ export default class Model {
103
103
} ) ;
104
104
this . schema . extend ( '$text' , { allowIn : '$clipboardHolder' } ) ;
105
105
106
- // Element needed by `upcastElementToMarker` converter.
107
- // This element temporarily represents marker bound during conversion process and is removed
108
- // at the end of conversion. `UpcastDispatcher` or at least `Conversion` class looks like a better for this
109
- // registration but both know nothing about Schema.
110
- this . schema . register ( '$marker' , {
111
- allowIn : [ '$root' , '$block' ]
106
+ // An element needed by the `upcastElementToMarker` converter.
107
+ // This element temporarily represents a marker boundary during the conversion process and is removed
108
+ // at the end of the conversion. `UpcastDispatcher` or at least `Conversion` class looks like a
109
+ // better place for this registration but both know nothing about `Schema`.
110
+ this . schema . register ( '$marker' ) ;
111
+ this . schema . addChildCheck ( ( context , childDefinition ) => {
112
+ if ( childDefinition . name === '$marker' ) {
113
+ return true ;
114
+ }
112
115
} ) ;
113
116
114
117
injectSelectionPostFixer ( this ) ;
Original file line number Diff line number Diff line change @@ -51,9 +51,14 @@ describe( 'Model', () => {
51
51
} ) ;
52
52
53
53
it ( 'registers $marker to the schema' , ( ) => {
54
+ model . document . createRoot ( '$anywhere' , 'anywhere' ) ;
55
+ schema . register ( 'anything' ) ;
56
+
54
57
expect ( schema . isRegistered ( '$marker' ) ) . to . be . true ;
55
- expect ( schema . checkChild ( [ '$root' ] , '$marker' ) , 1 ) . to . be . true ;
56
- expect ( schema . checkChild ( [ '$block' ] , '$marker' ) , 1 ) . to . be . true ;
58
+ expect ( schema . checkChild ( [ '$root' ] , '$marker' ) ) . to . be . true ;
59
+ expect ( schema . checkChild ( [ '$block' ] , '$marker' ) ) . to . be . true ;
60
+ expect ( schema . checkChild ( [ '$anywhere' ] , '$marker' ) ) . to . be . true ;
61
+ expect ( schema . checkChild ( [ 'anything' ] , '$marker' ) ) . to . be . true ;
57
62
} ) ;
58
63
} ) ;
59
64
You can’t perform that action at this time.
0 commit comments