KnowZero / tinymce4-languagetool

Attempt to port Language Tool Spelling and Grammar Check to TinyMCE 4 [ALPHA/EXPIREMENTAL]
Apache License 2.0
22 stars 11 forks source link

Webpack #1

Closed pderiy closed 7 years ago

pderiy commented 7 years ago

Hi, would it work with webpack? Because I'm trying to import it via "require()" and it has errors

KnowZero commented 7 years ago

I am not exactly familiar with webpack so hard to say. What errors are you getting?

Are you trying to load tinymce4 plugin or the languagetool library? Did you include jquery which it depends on?

pderiy commented 7 years ago
jquery.js:4768 Uncaught TypeError: Cannot read property 'createDocumentFragment' of undefined
    at buildFragment (jquery.js:4768)
    at domManip (jquery.js:5735)
    at jQuery.fn.init.append (jquery.js:5924)
    at jQuery.fn.init.<anonymous> (jquery.js:6018)
    at access (jquery.js:4010)
    at jQuery.fn.init.html (jquery.js:5985)
    at lt_textHTML (languagetool.min.js:893)
    at lt_queue (languagetool.min.js:437)
    at Editor.LanguageTool.sgevent.nodechange (languagetool.min.js:193)
    at Object.getEvent (languagetool.min.js:388)
pderiy commented 7 years ago

Steps to reproduce:

  1. copy my git repo: https://github.com/pderiy/languagetool
  2. npm -g install yarn webpack
  3. cd languagetool (go to downloaded repo)
  4. yarn
  5. yarn serve (run local server on localhost:3000)
  6. yarn watch (build ts files from src folder)
  7. open localhost:3000

Full stack trace:

Uncaught TypeError: Cannot read property 'createDocumentFragment' of undefined
    at buildFragment (jquery.js:4768)
    at domManip (jquery.js:5735)
    at jQuery.fn.init.append (jquery.js:5924)
    at jQuery.fn.init.<anonymous> (jquery.js:6018)
    at access (jquery.js:4010)
    at jQuery.fn.init.html (jquery.js:5985)
    at lt_textHTML (languagetool.min.js:892)
    at lt_queue (languagetool.min.js:436)
    at Editor.LanguageTool.sgevent.nodechange (languagetool.min.js:192)
    at Object.getEvent (languagetool.min.js:387)
buildFragment @ jquery.js:4768
domManip @ jquery.js:5735
append @ jquery.js:5924
(anonymous) @ jquery.js:6018
access @ jquery.js:4010
html @ jquery.js:5985
lt_textHTML @ languagetool.min.js:892
lt_queue @ languagetool.min.js:436
LanguageTool.sgevent.nodechange @ languagetool.min.js:192
getEvent @ languagetool.min.js:387
(anonymous) @ plugin.js:219
fire @ tinymce.js:31460
fire @ tinymce.js:31700
nodeChanged @ tinymce.js:42185
nodeChanged @ tinymce.js:46130
initEditor @ tinymce.js:44884
(anonymous) @ tinymce.js:45033
(anonymous) @ tinymce.js:7691
(anonymous) @ tinymce.js:7160
setTimeout (async)
(anonymous) @ tinymce.js:7159
(anonymous) @ tinymce.js:7271
(anonymous) @ tinymce.js:7160
setTimeout (async)
(anonymous) @ tinymce.js:7159
(anonymous) @ tinymce.js:103
passed @ tinymce.js:7528
(anonymous) @ tinymce.js:7576
wait @ tinymce.js:7556
waitForWebKitLinkLoaded @ tinymce.js:7569

This error in lt_textHTML method:

 var thtml = ($(mynode).html()||'');

JQUERY VERSION 3.2.1

pderiy commented 7 years ago

@KnowZero The problem is when I use newest jquery

Could you update your code to the latest jquery?

Now: Jquery v1.12.4 [WORKS] Jquery v3.2.1 [NOT]

KnowZero commented 7 years ago

I applied a patch and tested Jquery v3.2.1 (normally, not through webpack). See if it works now.

pderiy commented 7 years ago

@KnowZero Sure, it wasn't webpack issue.

It works great now!

Could you push your lib to npmjs.com?

KnowZero commented 7 years ago

Great.

As for publishing it to npmjs, I kind of wanted to first get past alpha. Then do a proper release with minified and all that.