-
-
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
Resolve Link plugin manual decorators quirks #13985
Comments
Hi there, I tried to make a PR, however:
My 2 cents on the dev experience, which ain't smooth compared with other projects:
That said, I hope you can give me some advices for completing the PR :) |
Hey @lamuertepeluda, thanks for the contribution, and the feedback. We will get back to you as soon as possible. |
@vokiel, could you take a look (#13988)?
We use all kinds of setups and many of us use MacBooks with M1/M2. Did you try the steps described in https://ckeditor.com/docs/ckeditor5/latest/framework/contributing/development-environment.html? I've just checked them and they work fine:
It failed because of the missing coverage in the link package. Once you'll get your coverage running you'll most likely know what's missing. As for the feedback regarding the dev env: there's for sure room for improvement. Some smaller comments on unfeasible things:
It's 300.000 SLOC in just this repo itself. We've got a massive test suit. Migration would take years. What we want to enable is writing new tests in TS, though. But there's also a risk of the dev env getting slower due to that. We observed an over 2x increase in dev env compilation times when migrating to TypeScript (which we completed recently after 7 months of work).
Jest runs in Node, not in a browser (unless something has changed there). We rely on the DOM to an extent where moving out of the browser would weaken the test suit. We'd need to look for shifting bits of that to E2E tests or keeping some in the current form and some in Jest... in other words – that'd cause more harm than good for the project's learning curve. As for the other things: definitely, something that we should look into. |
CLA confirmed, status updated. |
Curious also what you mean by:
almost the entire team works on VSCode 🤔 |
ok that's nice to hear 🤗 then maybe sharing the workspace settings of .vscode/extensions.json and .vscode/settings.json could help. I mean, I had several conflicts between linter and formatter while editing the code, which is a bit annoying |
I've used this library https://www.npmjs.com/package/@testing-library/jest-dom in the past. But I really appreciated moving the sources to TS, so having TS also for the tests would be just great. |
Same command, different output (tried also without I have this setup:
I noticed that the yarn.lock file is not in git tracking. This means everyone can potentially get different libraries when installing libraries using |
Could you try to rename the directory in which you are from |
yup! that worked :) thanks! so maybe there is some hardcoded path somewhere. Maybe it's good to add this in the dev/test setup docs |
@pomek, this sounds good, wdyt? |
I believe the issue with paths and non-working the code coverage tool is already fixed. Please, see https://github.com/ckeditor/ckeditor5-dev/releases/tag/v38.2.0. |
Context
I (am planning to) use the CKEditor5 as the editor of a headless CMS. Content editors need to create hyperlinks setting some attributes such as
target
andrel
, whose values are especially important for SEO optimization.To do so, I've configured some manual decorators of the LINK plugin following the plugin guide.
My aim is to allow content editors to (manually) set any of the above, in any possible combination (i.e. I assume they know what they want to do and give them full control over the link).
📝 Provide detailed reproduction steps (if any)
'Open in a new tab'
and'Set SEO No Follow'
✔️ Expected result
Given the html
to which I link
https://ckeditor.com/
and use the first 2 decorators:I want
as the editor downcast and downcast output.
❌ Actual result
Instead I get
as both the editor downcast and downcast output. Which is wrong and results in a broken link. I guess this is the result of the lack of "conflict resolution mechanism" cited in the docs.
Also the model view clearly shows something's off...
In the figure above, extra link attributes are treated as boolean and thus cannot be applied to the html tag. Also their names are reflecting the name of the decorator instead of the name of the attribute.
❓ Possible solution
I have noticed the following things:
link
in order to be downcasted, e.g.linkHref
,linkTarget
,linkRel
but the fact that they are treated as boolean does not work well, resulting in them not being set.linkHref
is actually in the list ofallowedAttributes
. However the full list of standard attributes for the HTML<a>
tag is available here. A comprehensive list of values for the therel
attribute can be obtained from this page and from the Google SEO optimization guide docs.My solution involves:
linkRel
andlinkTarget
(should handle alsolinkPing
,linkDownload
etc) but they're out of my scopeelementToAttribute()
rel -> linkRel, target -> linkTarget, ...attributeToElement()
: linkRel -> rel, linkTarget -> target...linkAttribute
<->attribute
rel
(orclass
) differently from the single-valued ones, such ashref
,target
split()
/join()
.I have created a custom plugin myself which implements the aforementioned solution by copying the Link package code and editing the logic.
While this solution works and shows it is feasible, it still needs a bit more testing, so I didn't publish it yet.
I aim to submit a pull request for the official Link plugin as well, which should make the above clearer, although I might need some time since the project is not really VSCode-friendly (e.g. linters, formatters) and the whole contribution experience is a bit complex.
The following are the screenshots of the results using my version of the link plugin
I'd also like to have some feedbacks about this issue, i.e. if I got something wrong in the plugin configuration.
📃 Other details
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: