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

BUG: Can not add a link: getModel() fails with: TypeError: $ is not a function #5536

Closed
2 tasks done
adiux opened this issue Nov 29, 2023 · 0 comments
Closed
2 tasks done

Comments

@adiux
Copy link

adiux commented Nov 29, 2023

GrapesJS version

  • I confirm to use the latest version of GrapesJS

What browser are you using?

Chrome Version 119

Reproducible demo link

https://jsfiddle.net/bj7afw63/1/

Describe the bug

How to reproduce the bug?

  1. Load the fiddle
  2. Try to add a link with the default RTE (not CKE)
  3. Nothing happens in the UI and a JS error appears in the console: TypeError: $ is not a function

What is the expected behavior?
A link is added in the UI inside the mj-text component.

What is the current behavior?
The link is not added.

What I found out so far
I tracked the error to the GJS method: getModel().

It appears that the mj-text component does not have the el.__cashData.

Just returning the el is also not a solution as this leads to other problems:
TypeError: model_1.once is not a function
But the link is added to the editor.

I assume this is related to mj-text being defined on the outside <tr> instead of the passed in <div>:

<tr data-gjs-type="mj-text" class="gjs-selected">
  <td>
    <div contenteditable="true">
      Hello World
    </div>
  </td>
</tr>

Code of Conduct

  • I agree to follow this project's Code of Conduct
@adiux adiux changed the title BUG: getModel() fails with: TypeError: $ is not a function BUG: Can not add a link: getModel() fails with: TypeError: $ is not a function Nov 29, 2023
@artf artf closed this as completed in 2ce7414 Nov 29, 2023
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