Problem/Motivation

In Chrome (but not Firefox), inserting an image via IMCE into a previously inserted Template (from the Templates submodule) triggers a contextualballoon-remove-view-not-exist error. Subsequent image insertions then fail with collection-remove-404.

Steps to reproduce

Environment: Drupal 10.5.x | CKEditor v45.2.2 (v44.0.0 worked fine)
Browser: Chrome
Chrome -> Wysiwyg -> Responsive Columns (Success) -> Image 1 (Successfully placed image with an Error) -> Image 2 (Crash)

Technical Details: The error occurs because drupalImage.js and the Template plugin both attempt to manage the ContextualBalloon stack simultaneously. When the IMCE modal shifts focus, the balloon is auto-closed by the core. When balloon.remove(view) is subsequently called by the plugin, it crashes because the view is already gone.

Proposed resolution

Wrap balloon removal calls in a hasView() check:
if (this._balloon.hasView(this.templateView)) { this._balloon.remove(this.templateView); }

Comments

gladys_loa created an issue. See original summary.

gladys_loa’s picture

I will be opening the bug with CKEditor, it seems to be happening outside of templates. Feel free to delete or close this bug.

mdusza’s picture

Status: Active » Closed (won't fix)

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.