question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Uncaught (in promise): TypeError: fontFamily.replace is not a function on destroy action

See original GitHub issue

Hello, everybody.

Framework: Angular Use case: textarea with tinymce Angular dicrective. Tynymce package: “tinymce”: “^4.6.3”, Issue: We have lifecycle method in Angular called onDestroy. This method invokes before Angular directive will be destroyed. In this method I call editor.destroy() method and have an Uncaught exception. Stack trace in below:

ERROR Error: Uncaught (in promise): TypeError: fontFamily.replace is not a function TypeError: fontFamily.replace is not a function at normalizeFontFamily (http://localhost:8080/app/app.bundle-92563952a2c38322b634.js:125611:25) at Object.getFontFamily (http://localhost:8080/app/app.bundle-92563952a2c38322b634.js:81726:16) at Editor.<anonymous> (http://localhost:8080/app/app.bundle-92563952a2c38322b634.js:125754:35) at Dispatcher.fire (http://localhost:8080/app/app.bundle-92563952a2c38322b634.js:104998:31) at Editor.fire (http://localhost:8080/app/app.bundle-92563952a2c38322b634.js:105238:41) at Object.nodeChanged (http://localhost:8080/app/app.bundle-92563952a2c38322b634.js:115690:18) at Editor.nodeChanged (http://localhost:8080/app/app.bundle-92563952a2c38322b634.js:119441:36) at Editor.<anonymous> (http://localhost:8080/app/app.bundle-92563952a2c38322b634.js:99843:18) at Dispatcher.fire (http://localhost:8080/app/app.bundle-92563952a2c38322b634.js:104998:31) at Editor.fire (http://localhost:8080/app/app.bundle-92563952a2c38322b634.js:105238:41) at Object.add (http://localhost:8080/app/app.bundle-92563952a2c38322b634.js:99931:18) at Editor.addNonTypingUndoLevel (http://localhost:8080/app/app.bundle-92563952a2c38322b634.js:99731:14) at Dispatcher.fire (http://localhost:8080/app/app.bundle-92563952a2c38322b634.js:104998:31) at Editor.fire (http://localhost:8080/app/app.bundle-92563952a2c38322b634.js:105238:41) at Editor.save (http://localhost:8080/app/app.bundle-92563952a2c38322b634.js:119855:16) at Editor.remove (http://localhost:8080/app/app.bundle-92563952a2c38322b634.js:120302:16) at Editor.destroy (http://localhost:8080/app/app.bundle-92563952a2c38322b634.js:120351:16)

This issue is actual only when my Tinymce textarea have been prepopulated with some text/html/etc. when directive created (i.e. tinymce textarea have editor.setContent() in the init_instance_callback init config)

Expected result: No uncaught exception.

Do anyone have the same problem? It can be Angular integration issue as well.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:5
  • Comments:15 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
morozowcommented, Jun 28, 2017

@Kuresov Yes, it is similar for me. But I mentioned that there is no error if tinymce didn’t have any initial value, only with some initialized value. So, this behavior can be named unstable.

Also I discovered, that in normal (no error) case fontFamily has string value like 'Verdana, Arial, Helvetica, sans-serif' but after destroy it has HTMLElement value of tinymce body element. So, it has different types and not seems like race condition.

1reaction
gpashiscommented, Jun 6, 2019

I am getting an similar issue “Uncaught TypeError: rawToolbar.replace is not a function” from theme.js (Version: 5.0.7). This is only reproducible when we load on mobile environment. Desktop environment works fine.

Uncaught TypeError: rawToolbar.replace is not a function at extract$1 (theme.js:10428) at identify (theme.js:10438) at Object.detect$4 [as detect] (theme.js:10536) at Editor.<anonymous> (theme.js:14296) at EventDispatcher.fire (tinymce.js:25608) at Editor.fire (tinymce.js:25714) at initEditor (tinymce.js:23786) at tinymce.js:23900 at tinymce.js:4479 at tinymce.js:4136

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught TypeError: b.replace is not a function
In the docs it sais that remove expects an optional parameter which is a selector. Since you are calling it with a delay...
Read more >
Fixed - Uncaught TypeError: a.replace is not a function
This does assume that newCount is a string, but this might not necessarily be the case - on initial page load this is...
Read more >
Uncaught TypeError: Cannot read property of null - iDiallo
This error occurs when you read a property or call a method on a null object . That's because the DOM API returns...
Read more >
What went wrong? Troubleshooting JavaScript - MDN Web Docs
An error message to indicate what's gone wrong: "TypeError: guessSubmit.addeventListener is not a function"; A "Learn More" link that links ...
Read more >
Bug listing with status RESOLVED with resolution FIXED as at ...
Bug :2 - "How do I attach an ebuild. ... Bug:331 - "zsh ebuild does not install functions" status:RESOLVED resolution:FIXED severity:normal · Bug:332 ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found