-
-
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
[GHS] Editor crashes after inserting nested inline element with a class #10657
Comments
Anyone working on this fix? |
Hi, we have some mission-critical content that can't be dropped in order to get through this bug. Is a PR welcome to fix this? |
This comment has been minimized.
This comment has been minimized.
@shahzebgit easiest fix should be just to do this at the source:
Any suggestion for a better fix? Looking to hear from the project maintainers too. @Mgsy |
@shabab477 yeah even i'm using something similar solution for now, but i think better solution would be to preserve the class even if it doesn't finds
this here helps us to avoid the error for mean time. I made little change for this, this helps it to let the classes get applied even if it doesn't have anything to merge with. if (!Array.isArray(target[key])) {
result[key] = source[key];
} |
Yeah, this looks better, right now I am building from source and deploying in our app but would be great to have it in the upstream. |
Made a bit more changes hope this solves the issue here. Here export function mergeViewElementAttributes( target, source ) {
const result = cloneDeep( target );
for ( const key in source ) {
//If target is empty, just copy the source.
if (target[key] === undefined)) {
result[key] = source[key];
}
// Merge classes.
else if ( Array.isArray( source[ key ] ) ) {
result[ key ] = Array.from( new Set( [ ...target[ key ], ...source[ key ] ] ) );
}
// Merge attributes or styles.
else {
result[ key ] = { ...target[ key ], ...source[ key ] };
}
}
return result;
} |
We'll be working soon on a bug that throws the same error (#11450) so hopefully this issue will be resolved too. |
📝 Provide detailed reproduction steps (if any)
✔️ Expected result
The content inserts properly.
❌ Actual result
The editor crashes.
📃 Other details
The issue occurs only if the parent element is the same element as the nested one and the nested one contains a class.
Error
If you'd like to see this fixed sooner, add a 👍 reaction to this post.
The text was updated successfully, but these errors were encountered: