-
-
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
Fake selection #3841
Comments
PS. We've been also discussion where should land the code which:
I'm for placing 1-2 in the engine. |
Will this feature also cover the following related "sub-features":
Basically, I'm talking about bringing the exact same features we have in CKEditor 4's Image2... they make the widget system very easy to use. |
I would make it clear that this issue has nothing to do with fake inline, text selections, similar to those that one would use to show other users selection in collaboration. Btw, this comment made me think that this feature can be useful in collaboration contexts where one wants to show the fake selection of other users with different colors. |
I agree that 2 should be handled by the engine as a part of the fake selection. The user should be able to simply mark the selection as fake and do not care about its behavior. So what engine allows you is to set the view selection in places where you can not set the DOM selection and add special flag On the other hand, the fake selection should not handle visual representation of the selection, should not mark any element in any way, nor add any listeners as long the selection is not there. This is why I think that it should not handle 1 nor hover. But. This is exactly what should be provided by widgets. In CKE 5 widget should be a view/DOM element which provides exactly this: fake selection with proper visual representation, hover and clicks behavior (and it might be a part of the engine too, IMHO).
Selection of other users and the fake selection are separate cases. In the first one, the most important problem in how to handle changes in the view which has not representation in the model, what is not a case in the fake selection. On the other hand, fake selection needs to move the real selection and provide proper behavior for arrows, what is not a case for others users selection. |
Yes, ofc... but for sure there are several rendering features that should be shared here. |
Hover will be handled by CSS of course. Click listeners should pluggable and, as we've just agreed, should be implemented by the engine. They should not, however, be obligatory fake selection's feature.
Widgets are 3rd thing in this picture. There's fake selection support, specific behaviour handlers (like "click to select" or "move sel on arrow key"), and widget view element. Widget view element will handle adding special classes to widgets and perhaps ensuring that default styles for them are injected in the page. Widget elements can also automatically mix in those specific behaviours, like "click to select", but we need to figure out how we can actually do that. Cause currently we don't support view element observers and it seems that if we want to enable injecting behaviours to view elements, we need to have observers. |
I'm wondering if other than listening to (arrow) keys / pointing events there's also a need to create a fake selection on generic selection change event - some IMEs expose "arrow keys" - and it wan't that long ago when we were dealing with all keycodes being Also by implementing custom selection make sure to cover a11y for this feature. You need to keep user informed of what's going on. Without handling it user will get irrelevant information based on native selection. |
Right, you mentioned 3 interesting things.
|
|
Fake selection is a feature which lets us work around browser limitations. Various browsers support only limited types of selections. For example, most browsers do not support multi-range selections (which are needed to represent table cell selections) and Blink and Webkit don't support selections anchored in elements which makes it impossible to have e.g. this:
In CKEditor 4 we worked around this by styling the selected object so it looks like selected and hiding the real selection in a hidden container. Table cells selection works a bit differently and only marks the cells, leaving the native selection somewhere in the table.
Proposal
Most likely, we'll also need to types of fake selections – "on objects" and something to handle tables. Alternatively, the table feature will mark all cells (by adding classes) and cancel rendering 2+ ranges of the selection. But I don't know how this could work while you make selection using DnD (because it shouldn't be re-rendered then).
The text was updated successfully, but these errors were encountered: