Code Monkey home page Code Monkey logo

jotted's People

Contributors

armoucar avatar danistefanovic avatar eedrah avatar fiatjaf avatar ghinda avatar lukasdrgon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jotted's Issues

Fail-proof reload.

Hi,

I don't know why but, intermittently, Jotted is not able to load the Result tab. It happens few times and to emulate this error, I have to keep reloading my browser until I get it. I was trying to make my own solution, something like check the iframe content and if things I want are not there, force jotted to reload. Thing is the content is cached and because of cache I'm not able to:

jotted.change({ target: textAreaIWantToReload })

Oh, I use CodeMirrorPlugin.

Thanks :)

Ability to hide Results Panel

If there is an option to hide results panel that will be great. This will come in handy in scenarios if someone is just writing javascript and wants to show output in console.

how to run this?

could anyone tell me how to run this after installing as per doc?

do i need run by like this node xxxx.js ? on which port it will run. ?

Select each element separately

I'm trying to select each element (HTML, CSS, JS) separately before saving it to a file or database, so if I write the following into the HTML:

<h2>Hello World!</h2>

I want just that, nothing else. Same for CSS and JS.

Is there a way to grab these via js by element id or something similar? or a way to define it first?

If I write:
var jotted = document.getElementById("jotted_content").innerHTML
it grabs the whole thing with all the iframes and whatnot.

Thanks, great tool btw.

Force run with play plugin

@ghinda,
at the moment, I'm writing an angular wrapper directive for jotted and it's working very well.
(Wrapper not on github yet.)

So my problem is that I'm loading async. data from a gist and then I'd like to re-run the code after loading to have the updated result but active play plugin isn't running the code after load. Is there a way to do this with the play plugin?

I've had a look at the source code and couldn't see anything like this. That's why I've added it to a fork of your repo. Please have a look here. (In the fork I've also changed mocha test env. a bit because Sauselab wasn't working for me.)

Is there any side effect of my added code? I'm passing a new property updatedData = { ... play: {forceRun: true}} to jotted.trigger('change', updatedData). The added test is passing and no other test is failing.

One issue I've noticed is that I can't trigger the change at every content / type and only at the last content. That's why I have something like this in my AngularJs code where I'm preparing the data for jotted:

config.files.push({
    type: curMappedLang, // mapping where needed
    content: file.content,
    play: {
        // force run on last load item, otherwise css was not loaded properly
        forceRun: (fileNames.length - 1 === i)
    }
});

Later in my angular code I'm triggering the change like this:

for (let i=0; i < config.files.length; i++) {
    jotted.trigger('change', angular.copy(config.files[i]));
}

It's OK to have that in my code and it's working but re-usability isn't good. It would be better if there would be a way to replace every jotted data at once (no looping to trigger changes for html, js, css pane) and trigger the play plugin to run the new data. Or is this already possible?

Set active pane

Hello, Jotted is awesome, it's simple but powerful! It will be great if I can change pane using a click event.

CSS

<style>
    .jotted-nav {
        display: none;
    }
</style>

JS

<script>
    var editor = new Jotted(document.querySelector('#editor'), {
        files: [{
            type: 'html',
            url: 'index.html'
        }]
    })

    $( ".somthing" ).on( "click", function() {
        editor.setActivePane("html");
    });
</script>

Thank you.

Load dependency libs for showcase.

How about loading libs that may be used in showcases? I tried to find this feature inside the code but I couldn't. Is that something that jotted already does or should it be developed?

An example would be jQuery, but I mean a feature to load any js lib.

Thanks, the project is great.

JSX/Babel does not work in html pane.

{
    files: [{
      type: 'html',
      content: '<html>\n' +
                '   <head>\n' +
                '       <script src="https://fb.me/react-0.14.6.js"></script>\n' +
                '       <script src="https://fb.me/react-dom-0.14.6.js"></script>\n' +
                '       <script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.23/browser.js"></script>\n' +
                '   </head>\n' +
                '   <body>\n' +
                '       <div id="content"/>\n' +
                '   </body>\n' +
                '   <script language="javascript" type="text/babel">\n' +
                '         ReactDOM.render(\n' +
                '           <span>Hello, world!</span>,\n' +
                '           document.getElementById("content")\n' +
                '         );        \n' +
                '   </script>\n' +
                '</html>\n'
    }]
}

returns:
Uncaught SyntaxError: Unexpected token <
Same works if you copy-paste it to html file and open it in browser.

Debugging using Developer Tools.

Hello @ghinda,

is it a jotted restriction being able to debug (using devtools) javascript files? By javascript files, I mean the one we pass to jotted as a parameter.

Thanks!

Including the codemirror plugin in gulp-angular

I am trying to use the Jotted javascript library in conjunction with a gulp-angular project. The library itself works fine, but I'm trying to include the library's Codemirror plugin and am running into issues. When I try to add the library and run gulp serve, I get this error:

Error in parsing: "js/codemirror.js", Line 4: Unexpected reserved word

The line causing the issue looks like so:

import * as util from '../util.js'

Prevent iframe top navigation

Rendering a form in the "result" iframe will navigate to a new page when submitted.

I noticed a comment about using iframe sandbox attribute when IE9 is no longer supported. Is this an option?

I'm switching over from codepen that doesn't have this issue. I think it's because they use generous sandbox, but without allow-top-navigation.

There may be an IE9 solution using onbeforeunload too.

Great work on this project - Extremely high quality!

Happy to do a PR for this once a solution is decided

TypeScript

I would love to see TypeScript support added as a plugin.

Show console panel at the bottom

If there is an option to show console panel at the bottom(horizontally below) instead of side by side as panel that will be great. This way the user wont have to change tabs to be able to see console output if they are not using the bin theme. Let me know if you think it makes sense.

Scripts in html pane does not affect on js pane.

Thanks for your project, it really great in terms of interability and api. I am building react component on top of it and it was a joy to hacking around it.

Currently I have weird and unexpected behavior when I run this:

{
    files: [{
      type: 'html',
      content: '<html>\n' +
                '   <head>\n' +
                '       <script src="https://fb.me/react-0.14.6.js"></script>\n' +
                '       <script src="https://fb.me/react-dom-0.14.6.js"></script>\n' +
                '   </head>\n' +
                '   <body>\n' +
                '       <div id="content"/>\n' +
                '   </body>\n' +
                '</html>\n'
    }, {
        type: 'js',
        content: 'ReactDOM.render(\n' +
                '           <span>Hello, world!</span>,\n' +
                '           document.getElementById("content")\n' +
                '         );'
    }],
    plugins: [{
      name: 'babel',
      options: {
        presets: ['react']
      }
    }]
}

with result ReactDOM is not defined

There is another one to show problem closely:

{
    files: [{
      type: 'html',
      content: '<html>\n' +
                '   <head>\n' +
                '       <script src="https://fb.me/react-0.14.6.js"></script>\n' +
                '   </head>\n' +
                '</html>\n'
    }, {
      type: 'js',
      content: 'console.log(<div/>);'
    }],
    plugins: [{
      name: 'babel',
      options: {
        presets: ['react']
      }
    }]
}

with result React is not defined

Apparently js is running in isolated context, but not in html iframe. I was thinking to make PR for this, but not quite get code yet. Would be great if you help me here a bit.
Cheers.

Sass plugin

if someone need i've created sass and postCss plugins for jotted, sass is little bit useless as it havy and slow, but post css looks good, if I have some time i will fork jotted and add these plugins with PR

Side by side preview?

I'm not seeing if it's possible, but is there a way to allow the "result" preview to be rendered to the side of the HTML/CSS/JS instead of a separate tab? Thanks.

Play Button to trigger execution

Currently jotted is in autorun mode. Can we have a way to turn off auto-run and a trigger to execute on some user action. Also if we could clear console on subsequent executions that will be awesome.

Height of pane / iframe

EDIT!

Finally found a way with css
So this can be closed as solved. Thank you and sorry for the inconvinience.
/*
Hello

'I have difficulties changing the height of the result pane. Or the whole pane. I tried with by adding a div with new class around the iframe and then css it to dynamic according to content. Didnt work. Or changing .jotted-pane-result did work nor any static height. So I'm lost here.
I think it is just too narrow to see the actual result. Now 150px only. Can you please help?

Add content between head tags

Hi,

Is it possible to add content between <head> and </head> tags? Actually, I want and insert CSS or JS links there. Hope there has a way.

Thanks.

Order of Pane

Is there Any way to show change order of panes ? i want result pane to show at last not at first

content line disappears

jotted is loaded fine for the first time. but suddenly the content line goes up and down when try to edit the content. it has happened after getting back from some other part of the my module. pls find the below image

1st image shows complete code with no issues
ace1
2nd images show . some line has disappear when try to edit the code
ace2

what is problem actually? where should i change it.?

i try to change "ace_content" class height dynamically from height: 490px; to height: auto; but it doesn't accept it

Thank you

Console errors are not shown

I have noticed that console errors dont shown at times.

for(let i = 0; i < 10; i++) { /* … */ }
for(let i = 0; i < 10; i++) { /* … */ }
console.log(i) // ERROR: no global i declared

Error shows on browser console but not on jotted console.

Can we get the errors on jotted console?

a full blown solution

hi, how could be possible to make a full stack solution like a small jsfiddle up and running using jotted?
Is this just the frontend?

Play + Console - autoClear Issue

I have noticed this issue with Play plugin and console-autoClear set to True. When nothing has changed and I click Run it clears the console (prev result) and doesn't print the log lines. It looks that execution doesn't happen when nothing has changed. I recommend that we force Execute on run click. Thoughts? Let me know if you want me to provide jsbin for repro.

Persist / Store changes (serialize editor)

It would be nice to have some sort of function that allows to easily serialize an object of the editor's content into a single object which might be stored and restored in future.

Using the pen plugin without the codemirror plugin makes the result panel disappear on focus

Thanks a lot for this amazing tool!

I'm experiencing a strange issue with the pen plugin. You can try it yourself on the demo page of the plugin. It works fine in the example provided, but if you remove the plugin codemirror from the array list (i.e. to only have textareas, not a code editor), then clicking on any of the code textareas causes the result panel (on top) to disappear, and all the code panels shift up.

Issue happens consistently on Chrome, Firefox and IE, and also outside of the demo environment. The pen plugin doesn't seem to have any dependency on the codemirror plugin, I've had a look but was not able to fix it myself. It doesn't happen with the bin plugin.

defer document structure to html?

Suggestion: how difficult would it be to handle each pane (javascript, html,css and preview) in it's own div? I ask because it would be much easier to style the page if we had more than one element where everything is dumped to, as opposed to a set of divs that we can arrange in tabs, or in a quad or side by side or implement different layouts or whatever via css.

as it is, each instance of Jotted(document.querySelector('#id') is independant from each other (surprisingly)

Gitter maybe?

You have a great project, maybe we could chat a bit about it, what do you think about creating gitter room?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.