-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Should tableCell be defined as object in schema? #6432
Comments
For example, this is what I have to do if I want to be sure that the range will be created in something that is "visible" in the editor. A real piece of content, if you will. _hasContent( range ) {
for ( const item of range.getItems() ) {
if ( _itemIsContent( item ) ) {
return true;
}
}
return false;
}
_itemIsContent( item ) {
return item.is( 'textProxy' ) || this.editor.model.schema.isObject( item ) && !item.is( 'tableCell' );
} Similar would happen if I wanted to trim the range just to the actual content. |
IMO, the current definition is close to being correct. Let me go through it:
So, if the problems boil down to two things:
Then we need to differentiate cells from other selectable objects. In other words – cell is selectable like other objects, but it's not an object. Hence, we need a new property in the schema and use that property in the aforementioned algorithms and selection postfixer. |
👍 You are right. Plus, table cell cannot be divided by enter key. |
That's ensured by |
Let's wait for more ideas in #7631. If we won't have ground breaking proposals there regarding |
Feature (engine): Introduced `SchemaItemDefinition#isSelectable` and `SchemaItemDefinition#isContent` properties. Closes #6432. Other (table): The `tableCell` model element brought by the `TableEditing` plugin is no longer an object (`SchemaItemDefinition#isObject`) in the `Schema` but a selectable (`SchemaItemDefinition#isSelectable`) (see #6432). Internal (ui): Aligned the `BalloonToolbar` plugin behavior to the new `SchemaItemDefinition#isSelectable` property (see #6432). Docs (engine): Extended the "Schema" deep dive guide with the new properties and methods (see #6432, #7631). Tests (image): Aligned tests to the fact that the `tableCell` model element is no longer an object but a selectable in the schema (see #6432). Tests (horizontal-line): Aligned tests to the fact that the `tableCell` model element is no longer an object but a selectable in the schema (see #6432). MINOR BREAKING CHANGE (table): The `tableCell` model element brought by the `TableEditing` plugin is no longer an object (`SchemaItemDefinition#isObject`) in the `Schema` but a selectable (`SchemaItemDefinition#isSelectable`). Please update your integration code accordingly (see #6432).
📝 Provide a description
I am not sure if
tableCell
element should be "an object" (isObject: true
in schema). Looking at description: https://ckeditor.com/docs/ckeditor5/latest/api/module\_engine\_model\_schema-SchemaItemDefinition.html an object is:So I am not sure if it applies. I'd add to that, that for me, "an object" is something that carries an information on it's own. For example a video, or image. It can be empty, with no other content/data and it still is meaningful.
Current situation messes up some algorithms.
First,
getNearestSelectionRange()
selects a cell, while I think that even in this situation:The selection range should be
Not
(even with table selection turned on).
Second,
Model#hasContent()
will returntrue
when an empty cell is selected (like in the example above).I think it should be a
isLimit
+isBlock
.The text was updated successfully, but these errors were encountered: