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

n is undefined #59

Closed
Xarkam opened this issue Apr 23, 2018 · 2 comments
Closed

n is undefined #59

Xarkam opened this issue Apr 23, 2018 · 2 comments

Comments

@Xarkam
Copy link

Xarkam commented Apr 23, 2018

Hi,

I followed the readme to test the editor.
But with the line flask.run('#my-code-wrapper'); I obtain one error of n is undefined

With the line flask.run('#my-code-wrapper', { language: 'sql', lineNumbers: true }), all run normaly.

My testing code:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.3.1/semantic.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.14.0/themes/prism.min.css" async integrity="sha256-N1K43s+8twRa+tzzoF3V8EgssdDiZ6kd9r8Rfgg8kZU=" crossorigin="anonymous" />
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.14.0/plugins/line-numbers/prism-line-numbers.min.css" async integrity="sha256-SA3HrKLu4tldegZQVdUx8Cwwo2hQFIu7iW6UOo6OdS4=" crossorigin="anonymous" />
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/CodeFlask.js/0.1.1/codeflask.min.css" async integrity="sha256-WrayoNKyvtuOAWLPQkI9vvI/ZG8zfJeOrwHiRlFm2BY=" crossorigin="anonymous" />
    <style>
        .main.container {
            padding-top: 50px;
        }

        #my-code-wrapper {
            width:350px;
            height:250px;
            position:relative; /* Position must be: relative, absolute or fixed */
        }
    </style>
</head>
<body>
    <div class="ui main container">
       <div id="my-code-wrapper" data-language="sql"></div>
    </div>

    <script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.14.0/prism.min.js" async integrity="sha256-jTGzLAqOAcOL+ALD2f2tvFY7fs6dwkOeo88xiuVHaRk=" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.14.0/plugins/line-numbers/prism-line-numbers.min.js" async integrity="sha256-JfF9MVfGdRUxzT4pecjOZq6B+F5EylLQLwcQNg+6+Qk=" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/CodeFlask.js/0.1.1/codeflask.min.js" async integrity="sha256-ERpc+wfArI8UJK0iigJWqNNoZETrxAOF8dMjDSCcOTQ=" crossorigin="anonymous"></script>
    <script>
        var flask = new CodeFlask;
        flask.run('#my-code-wrapper');
        //flask.run('#my-code-wrapper', { language: 'sql', lineNumbers: true })
      </script>
</body>
</html>
@gianjohansen
Copy link

The latest build on cdnjs is from December 2016 (v0.2.0), which is old enough that the code in the readme doesn't function. Running without options was fixed in this PR in January 2017: #27

@kazzkiq Can we get a v0.2.1 tag of the current build to fix this for all the cdnjs users?
@Xarkam If you link to a local copy of the current version it'll work.

@kazzkiq
Copy link
Owner

kazzkiq commented Apr 30, 2018

The #27 stopped working again with current changes. So I had to push another fix for v0.3.+ for it to work properly.

It is now fixed at v0.3.1.

Since cdnjs takes some time to generate production files, you can use unpkg:

https://unpkg.com/codeflask@0.3.1/src/codeflask.js

@kazzkiq kazzkiq closed this as completed Apr 30, 2018
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

3 participants