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

Error on remove image link / ready event is fired more than once #17252

Closed
felipeissa opened this issue Oct 10, 2024 · 3 comments · Fixed by #17281
Closed

Error on remove image link / ready event is fired more than once #17252

felipeissa opened this issue Oct 10, 2024 · 3 comments · Fixed by #17281
Assignees
Labels
package:image package:link pending:feedback This issue is blocked by necessary feedback. type:bug This issue reports a buggy (incorrect) behavior.

Comments

@felipeissa
Copy link

felipeissa commented Oct 10, 2024

When removing a link from image, the following error is being displayed on console:

polyfills.js:1 Uncaught CKEditorError: Cannot read properties of undefined (reading '_removeAttribute')
Read more: https://ckeditor.com/docs/ckeditor5/latest/support/error-codes.html#error-Cannot read properties of undefined (reading '_removeAttribute')
    at Aa.removeAttribute (main.js:1:711864)
    at cE.<anonymous> (main.js:1:1298952)
    at cE.fire (main.js:1:536129)
    at cE._testAndFire (main.js:1:795292)
    at cE._convertAttribute (main.js:1:793831)
    at cE.convertChanges (main.js:1:791864)
    at main.js:1:819706
    at qS.change (main.js:1:762482)
    at listenTo.priority (main.js:1:819671)
    at v0.fire (main.js:1:536129)

Reproduction steps:

  1. Add image to ck editor
  2. Click on image and add a link to it (any link will do, eg: 'https://google.com'
  3. Click to 'unlink'

The error above will be displayed into console. Also, everytime you try to remove the link the event 'ready' is fired again (on angular app).

Issue can be seen on the feature reach editor: https://ckeditor.com/ckeditor-5/demo/feature-rich/ (just can't validate it it calls 'ready' more than once also.

✔️ Expected result

Link should be removed and no error should be displayed on console. Ready event should be fired only once, not every link removal.

❌ Actual result

Error is displayed on console, ready event is fired for every link removal.

📃 Other details

  • Browser: Google Chrome 129.0.6668.90
  • OS: Windows 11
  • First affected CKEditor version: / Installed CKEditor plugins:

"@ckeditor/ckeditor5-editor-classic": "~43.2.0"
"@ckeditor/ckeditor5-image": "~43.2.0"
"@ckeditor/ckeditor5-link": "~43.2.0"

Editor config:

{
link: {
addTargetToExternalLinks: true
}
};

@felipeissa felipeissa added the type:bug This issue reports a buggy (incorrect) behavior. label Oct 10, 2024
@Witoso
Copy link
Member

Witoso commented Oct 14, 2024

I cannot reproduce the error on our demo page, could you share a recording? I'm not sure if I understand ready event. Could you elaborate how you listen to it?

@Witoso Witoso added package:image package:link pending:feedback This issue is blocked by necessary feedback. labels Oct 14, 2024
@felipeissa
Copy link
Author

Hi @Witoso ,

I've uploaded a recording of it on youtube (should be visible): https://www.youtube.com/watch?v=9yhc1Zg-KYM

On angular, I use it following way:

<ckeditor #myEditor *ngIf="config" [editor]="Editor" [config]="config" [(ngModel)]="editorDataModel" (ready)="onReady($event)"> </ckeditor>

I believe its this event from the api:

https://ckeditor.com/docs/ckeditor5/latest/api/module_core_editor_editor-Editor.html#event-ready

I can create a sample project on github, if necessary

@Witoso
Copy link
Member

Witoso commented Oct 14, 2024

Thank you, I confirmed it throws on the demo, I could replicate it in the docs. We will investigate.

@Mati365 Mati365 self-assigned this Oct 17, 2024
Mati365 added a commit that referenced this issue Oct 17, 2024
Fix (link): No longer crash editor after removing link from image when `LinkConfig#addTargetToExternalLinks: true` is set. Closes #17252
@CKEditorBot CKEditorBot added this to the iteration 79 milestone Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:image package:link pending:feedback This issue is blocked by necessary feedback. type:bug This issue reports a buggy (incorrect) behavior.
Projects
None yet
4 participants