ckeditor5
ckeditor5 copied to clipboard
An error of unlinking block type images
If the Link plugin config parameter addTargetToExternalLinks = true, an error is thrown when the unlink command is executing for block type images (at least for the versions 29.1.0-31.0.0):
ckeditorerror.js:67 Uncaught TypeError: Cannot read properties of undefined (reading '_removeAttribute') at DowncastWriter.removeAttribute (downcastwriter.js:402) at DowncastDispatcher.eval (automaticdecorators.js:142) at DowncastDispatcher.fire (emittermixin.js:208) at DowncastDispatcher._testAndFire (downcastdispatcher.js:571) at DowncastDispatcher.convertAttribute (downcastdispatcher.js:256) at DowncastDispatcher.convertChanges (downcastdispatcher.js:168) at eval (editingcontroller.js:104) at View.change (view.js:508) at Document.EditingController.listenTo.priority (editingcontroller.js:103) at Document.fire (emittermixin.js:208)
Steps for reproducing:
- Compile manual tests from the
link
package - Add the following configuration to the
linkimage.js
manual testlink: { addTargetToExternalLinks: true, }
- Open http://localhost:8125/ckeditor5-link/tests/manual/linkimage.html
- Remove link from an image in the editor.
- Most probably we should not execute a logic from the converter 👇 if the
linkHref
attribute was removed.
https://github.com/ckeditor/ckeditor5/blob/e391ddb70d6f55c2c7465a84fd3e830265b3279d/packages/ckeditor5-link/src/utils/automaticdecorators.js#L109-L152
its trying delete twice the linkinmage and in the second try its crash first is remove by running downcastimagelink the second run is on automaticecorators dispatcher.on( 'attribute:linkHref:imageBlock'...
need add there condition if (!linkinimage) return..
its trying delete twice the linkinmage and in the second try its crash first is remove by running downcastimagelink the second run is on automaticecorators dispatcher.on( 'attribute:linkHref:imageBlock'...
need add there condition if (!linkinimage) return..
That's exactly what's happening, and a fix really seems trivial. I wonder why this still hasn't been fixed? Any comments on that, @Reinmar? Are we missing something here that make a fix more complex?
There has been no activity on this issue for the past year. We've marked it as stale and will close it in 30 days. We understand it may still be relevant, so if you're interested in the solution, leave a comment or reaction under this issue.
We've closed your issue due to inactivity. We understand that the issue may still be relevant. If so, feel free to open a new one (and link this issue to it).