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

Function ImageCaptionSpace throws TypeError: Cannot read properties of null (reading 'parentElement') #4843

Open
petrovy4 opened this issue Nov 18, 2024 · 0 comments

Comments

@petrovy4
Copy link

Expected behavior.

ImageCaptionSpace handles edge cases correctly and does not throw error

Actual behavior.

Function ImageCaptionSpace assumes that element returned by selection.element() always has at least 2 parents:

...
    function ImageCaptionSpace(sel_el, e) {
      // https://github.com/froala-labs/froala-editor-js-2/issues/4429
      var _ref = sel_el && sel_el.parentElement,
        parentElement = _ref.parentElement;
...

which is not always correct and should be corrected to avoid exceptions. For example this way:

...
        parentElement = _ref?.parentElement;
...
Editor version.

4.2.1

OS.

Any

Browser.

Any

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

No branches or pull requests

1 participant