-
Notifications
You must be signed in to change notification settings - Fork 40
Fix placeholder over media embed. #1749
base: master
Are you sure you want to change the base?
Conversation
The Can you investigate that? Because it looks like your PR could break some core functionality. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We cannot merge this without the research as pointed out in #1749 (comment).
Thanks bisect & git log master :D I feel so bad for not digging it properly :( - you're right the check should be better then. I'll check on this and I'll update the PR. |
@scofalik & @oleq: The solution for this could done by:
As the markers are hidden in the UI similarly (by CSS) with a placeholder active I think that we might go with CSS solution. But OTOH such solution is not clean enough - it will add the |
I'm for 2b. 2a would add a |
b2203e7
to
6fb56bd
Compare
@@ -153,6 +153,12 @@ export function needsPlaceholder( element ) { | |||
return false; | |||
} | |||
|
|||
// If the element is a Widget, always consider it a non-empty and thus not needing a placeholder. | |||
// https://github.com/ckeditor/ckeditor5/issues/1684 | |||
if ( element.getCustomProperty( 'widget' ) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the second thought, that would be the only place in the codebase other than isWidget()
from ckeditor5-widget
that calls getCustomProperty( 'widget' )
😛
Maybe we could use ckeditor5-widget
as an engine dependency after all. I'm not sure about consequences, though. cc @Reinmar.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah... it might be a cycling dependency then... or widget being an engine feature :P.
At the current state I rather have this check then importing isWidget()
but let's see @Reinmar 2¢.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TBH I have nothing against the current state (element.getCustomProperty( 'widget' )
) and some improvements in i26 as long as we don't change dependencies in i25.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
The only question is whether to isWidget()
or to getCustomProperty( 'widget' )
.
After F2F talk with @Reinmar I'll updat this PR with checks in the schema so the |
@Reinmar I'm working on the rewrite so the This looks like a bigger change because the It is not a big issue in most places but it would require some more work at least in the TL;DR: I don't think we can squish the rewrite in the 25 milestone. My suggestion is that we could use the current state (checking for the widget) in 25 and rewrite it in 26. |
To be honest, I think that the problem is using |
WDYM? I remember you were proposing introducing new element types. Would that (IIRC) |
I am not sure why exactly |
We need custom rendering, without going through our rendering engine. |
Guys, so the |
I think so. |
Yep, I think so too. I wasn't sure initially about the semantics of this type of element and the difference between UI and Raw, but I think https://github.com/ckeditor/ckeditor5-engine/issues/1643#issuecomment-514653753 makes it clear and in that case, it would solve this case. |
What is the status of this PR ? |
I'm going to implement |
Suggested merge commit message (convention)
Other: The placeholder will not be shown for widgets. Closes ckeditor/ckeditor5#1684.
Additional information
@oleq: I've update the PR so the widgets (checked by a custom property) are considered not needing a placeholder.
OLD:
I've been fiddling with the placeholder for some time to check what caused the ckeditor/ckeditor5#1684 and it turned out that the placeholder was enabled for "emptish" elements. The "emptish" element is such that has no children or all of the children are UI Elements.
I'm not sure why this was created this way (maybe some collaboration features? but I doubt it) but this check would give false positive for widget with only
UIElement
children - this is what happens with MediaEmbed.So taking this into consideration I don't see that
UIElement
should dictate that element is empty in regards for showing a placeholder.The other change that we might consider is to tie emptiness check to the model. I didn't go this route as currently the placeholder operates on the view solely.
ps.: The isWidget check was also discarded.