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

Problem when using CDN file #40

Open
arvindpdmn opened this issue Aug 22, 2018 · 1 comment
Open

Problem when using CDN file #40

arvindpdmn opened this issue Aug 22, 2018 · 1 comment

Comments

@arvindpdmn
Copy link

This is what I have in <head>:

<script src="https://cdn.jsdelivr.net/npm/[email protected]/src/js/spell-checker.min.js"  type="text/javascript"></script>
<script src="https://codemirror.net/addon/mode/overlay.js"  type="text/javascript"></script>

This fails with error ReferenceError: require is not defined due to an attempt to require typo-js. What I understand is that require will work within Node.js runtime but not in browser. What's the solution?

@arvindpdmn
Copy link
Author

I removed the require and export from . My code is now:

<link rel="stylesheet" href="https://cdn.jsdelivr.net/codemirror.spell-checker/latest/spell-checker.min.css">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/typo.min.js"></script>
<script src={localpath}/js/spell-checker.min.js"></script>
<script src="https://codemirror.net/addon/mode/overlay.js"></script>

No errors this time but spell check is not happening. In CodeMirror, textarea content is actually within <div class="CodeMirror-code" role="presentation>". Nothing happens when spell checker is invoked this way:

    CodeMirrorSpellChecker({
        codeMirrorInstance: CodeMirror,
    });
    CodeMirror.fromTextArea(jQuery(".CodeMirror-code")[0], {
        mode: "spell-checker"
    });    

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant