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

Unlink toolbar button is enabled when selection is not inside link element #4777

Closed
oskarwrobel opened this issue Apr 5, 2017 · 14 comments · Fixed by ckeditor/ckeditor5-link#119
Assignees
Labels
package:link type:bug This issue reports a buggy (incorrect) behavior.
Milestone

Comments

@oskarwrobel
Copy link
Contributor

apr-05-2017 18-16-09

@oleq oleq changed the title Unlink toolbar button is enable when selection is not inside link element Unlink toolbar button is enabled when selection is not inside link element Apr 13, 2017
@oleq
Copy link
Member

oleq commented Apr 13, 2017

The super strange thing is that is starts working as soon as the first link is created:
kapture 2017-04-13 at 10 53 30

@oskarwrobel
Copy link
Contributor Author

When selection is placed inside link element for the first time.

@oskarwrobel
Copy link
Contributor Author

Maybe something related to bind() ?

@oleq
Copy link
Member

oleq commented Apr 13, 2017

Hard to tell without debugging. This is really odd.

@oskarwrobel
Copy link
Contributor Author

This is because of missing initial refreshState() call in UnlinkCommand
https://github.com/ckeditor/ckeditor5-link/blob/master/src/unlinkcommand.js#L27

@oleq
Copy link
Member

oleq commented Apr 18, 2017

@oleq
Copy link
Member

oleq commented May 15, 2017

It turned out the issue is in ToggleAttributeCommand. Will be resolved in https://github.com/ckeditor/ckeditor5-core/issues/50.

@Reinmar
Copy link
Member

Reinmar commented May 15, 2017

I've just noticed that the LinkCommand doesn't base on ToggleAttributeCommand :D So no, this won't be fixed by the fix in the core.

@oleq
Copy link
Member

oleq commented May 15, 2017

@Reinmar I guess this one should fix it.

@Reinmar
Copy link
Member

Reinmar commented May 15, 2017

Not entirely. If you start the editor content with an image (link starts disabled) and then move the selection somewhere into a text, the link is not enabled because it's not refreshed.

@oleq
Copy link
Member

oleq commented May 15, 2017

@Reinmar
Copy link
Member

Reinmar commented May 15, 2017

No. LinkCommand doesn't inherit from TAC. Hence, we need the same fix in LC as you proposed in TAC.

@oleq
Copy link
Member

oleq commented May 15, 2017

You're right. Shouldn't it rather become a core feature? I mean, there will be tons of commands experiencing the same issue in the future and it's easy to forget about this case.

@Reinmar
Copy link
Member

Reinmar commented May 15, 2017

I guess we could have a helper (core/command/helpers) called refreshOnChange() which would add such a listener. OTOH, these are 4 LOC and we also have a ticket in the engine opened (https://github.com/ckeditor/ckeditor5-engine/issues/698) which may affect (shorten) this code. So, I'd not do anything now. It's easier to repeat ourselves for now rather than fixing broken abstraction later on. But I definitely agree that before 1.0.0 we'll need to clean this up.

Reinmar referenced this issue in ckeditor/ckeditor5-link May 19, 2017
Fix: `LinkCommand` and `UnlinkCommand` should update their state upon editor load. Closes #93.
@mlewand mlewand transferred this issue from ckeditor/ckeditor5-link Oct 9, 2019
@mlewand mlewand added this to the iteration 11 milestone Oct 9, 2019
@mlewand mlewand added status:confirmed type:bug This issue reports a buggy (incorrect) behavior. package:link labels Oct 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:link type:bug This issue reports a buggy (incorrect) behavior.
Projects
None yet
4 participants