Skip to content
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

GHS: Preserving empty inline elements. #14406

Merged
merged 23 commits into from
Jul 13, 2023
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
372c275
PoC of preserving empty inline elements.
niegowski Jun 16, 2023
6d3f8da
Handling empty inline elements as inline widgets.
niegowski Jun 23, 2023
8e29049
Merge branch 'master' into ck/9888-preserving-inline-empty-elements
niegowski Jun 28, 2023
8f9f0f7
Refactoring of DOM to View whitespace handling.
niegowski Jun 30, 2023
2e7a0bf
Merge branch 'master' into ck/9888-preserving-inline-empty-elements
niegowski Jul 3, 2023
a9b738f
Inline object elements matching while converting from DOM to view.
niegowski Jul 3, 2023
de80e96
Should not output NBSP next to an inline object element.
niegowski Jul 4, 2023
2c48070
Do not trim whitespaces if only partial DOM to view conversion is tri…
niegowski Jul 4, 2023
95c1c70
Should not trim spaces if comparing changes in editable (not while pa…
niegowski Jul 4, 2023
d8d86c2
Data and editing pipelines should handle inline object elements the s…
niegowski Jul 4, 2023
e49a468
GHS should accept configuration for allowed empty inline elements.
niegowski Jul 5, 2023
843f925
Code cleanup.
niegowski Jul 6, 2023
01b9218
Private methods moved below the public ones.
niegowski Jul 6, 2023
a33ac18
Fixed trimming whitespaces in nested lists.
niegowski Jul 7, 2023
2e47428
Fixed handling empty inline element with two-step caret movement.
niegowski Jul 10, 2023
e4eb2df
Adding tests.
niegowski Jul 10, 2023
bc19482
Adding tests for registerInlineObjectMatcher.
niegowski Jul 10, 2023
b5c47fb
Adding code docs. Fixing tests.
niegowski Jul 11, 2023
16b7c15
Adding tests.
niegowski Jul 11, 2023
6a103e5
Review fixes.
niegowski Jul 12, 2023
9bb653b
Empty inline element requires any attributes to get converted.
niegowski Jul 12, 2023
9fcf109
Added dedicated manual test.
niegowski Jul 12, 2023
b910260
Merge branch 'master' into ck/9888-preserving-inline-empty-elements
niegowski Jul 12, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions packages/ckeditor5-engine/src/model/documentselection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1135,8 +1135,10 @@ class LiveSelection extends Selection {

// ...look for a first character node in that range and take attributes from it.
for ( const value of range ) {
// If the item is an object, we don't want to get attributes from its children.
// If the item is an object, we don't want to get attributes from its children...
if ( value.item.is( 'element' ) && schema.isObject( value.item ) ) {
// ...but collect attributes from inline object.
attrs = getTextAttributes( value.item, schema );
break;
}

Expand Down Expand Up @@ -1237,7 +1239,10 @@ function getTextAttributes( node: Item | null, schema: Schema ): Iterable<[strin

// Collect all attributes that can be applied to the text node.
for ( const [ key, value ] of node.getAttributes() ) {
if ( schema.checkAttribute( '$text', key ) ) {
if (
schema.checkAttribute( '$text', key ) &&
schema.getAttributeProperties( key ).copyFromObject !== false
niegowski marked this conversation as resolved.
Show resolved Hide resolved
) {
attributes.push( [ key, value ] );
}
}
Expand Down
Loading