kazzkiq / CodeFlask

A micro code-editor for awesome web pages.
https://kazzkiq.github.io/CodeFlask/
MIT License
1.07k stars 121 forks source link

Load code from file #48

Closed nunos7 closed 6 years ago

nunos7 commented 7 years ago

Hi, It's possible to load code from file using jquery and then run codeflask to edit that code? Example here: http://plnkr.co/edit/lwy2Zk11UJ8GVWX1JgKD?p=preview

In the example the html code is rendered as HTML...

NS

kyleknighted commented 6 years ago

You could try out some AJAX. This appears to work.

$(document).ready(function() {
  var flask = new CodeFlask();
  flask.run('#my-code-wrapper', { language: 'html' });

  $.get('code.html', function(data) {
    flask.update(data);
  })
});

Example: http://plnkr.co/edit/tfkVvmZ5wQn9Zy4yIMBP?p=preview