Issue #5536Opened November 29, 2023by adiux0 reactions

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

Question

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

Answers (0)

No answers yet.

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.