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

i/4858: Automatically add a link protocol when not provided in the link form. #7370

Merged
merged 16 commits into from
Jun 10, 2020

Conversation

panr
Copy link
Contributor

@panr panr commented Jun 3, 2020

Suggested merge commit message (convention)

Feature (link): Introduced the config.link.defaultProtocol option for automatically adding it to the links when it's not provided by the user in the link form. Closes #4858.

MINOR BREAKING CHANGES (link): This PR introduces config.link.defaultProtocol API.

@panr
Copy link
Contributor Author

panr commented Jun 3, 2020

@jodator As we've spoken, I went with the UI level of change... but when I was writing tests I thought that maybe we should add this feature for the model level as well?
Now LinkCommand.execute('ckeditor.com') won't add any protocol (as before), so maybe we should be more consistent here 🤔

@panr
Copy link
Contributor Author

panr commented Jun 3, 2020

I still have to update feature docs, but the code can be reviewed.

@jodator
Copy link
Contributor

jodator commented Jun 4, 2020

The code generally looks OK so I'll wait for the tests. One thing to change which slipped us:

2. Should be a opt-in feature.

As for the command auto-fix. I'm not 100% sure whether it is a good or bad idea. Could you check in what scenarios the link command is used? My thinking is that if someone (dev) use the command to insert link then we shouldn't alter it but if the link command is executed by user action we should alter it. But I can't think of other options than UI.

The second scenario is handling link in pasted content. But that seems to be out-of scope for this issue.

@panr
Copy link
Contributor Author

panr commented Jun 4, 2020

As for the command auto-fix. I'm not 100% sure whether it is a good or bad idea.

Me neither...

Could you check in what scenarios the link command is used? My thinking is that if someone (dev) use the command to insert link then we shouldn't alter it but if the link command is executed by user action we should alter it. But I can't think of other options than UI.

What I've seen that we're using the command only on submitting the value (but here the command already gets auto-fixed value from the form input) and in the unit tests... I haven't spotted anything else...

And maybe you're right saying that from the developer's perspective such autofixer isn't a good idea, because it can be unpredictable... So maybe we should stick with the user's perspective only.

@jodator
Copy link
Contributor

jodator commented Jun 4, 2020

So maybe we should stick with the user's perspective only.

Sounds good - let's keep that on UI part only then.

Copy link
Contributor

@jodator jodator left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code loooks good 👍 the things to address

  1. RegExp objects should be created once and then re-used.
  2. The configuration is static so the code should not anticipate that (Dynamic toolbar configuration options #7383)

@jodator jodator self-requested a review June 10, 2020 08:30
Copy link
Contributor

@jodator jodator left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌 LGTM

@jodator jodator merged commit 76c762e into master Jun 10, 2020
@jodator jodator deleted the i/4858 branch June 10, 2020 13:26
@jodator
Copy link
Contributor

jodator commented Jun 10, 2020

@Reinmar Quick question about changelog and annotating breaking changes.

I've removed the MINOR BREAKING CHANGE as this is not a breaking change - it is a MINOR change in terms of SemVem - so not a breaking change. Is it true that every API change should be annotated as breaking? This seems counter-intuitive to me - thus I've removed that from the proposed merge message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Automatically add a protocol to a link
2 participants