javascript - How to open a file with epiceditor? -
i have following file structure
and in content.php have following js code
var file = "http://2sense.net/blog/posts/my-second-post.md" var opts = { basepath: "http://2sense.net/blog/posts/", container: 'epiceditor', textarea: null, basepath: 'epiceditor', clientsidestorage: true, localstoragename: 'epiceditor', usenativefullscreen: true, parser: marked, file: { name: 'epiceditor', defaultcontent: '', autosave: 100 }, theme: { base: '/themes/base/epiceditor.css', preview: '/themes/preview/preview-dark.css', editor: '/themes/editor/epic-dark.css' }, button: { preview: true, fullscreen: true }, focusonload: false, shortcut: { modifier: 18, fullscreen: 70, preview: 80 }, string: { togglepreview: 'toggle preview mode', toggleedit: 'toggle edit mode', togglefullscreen: 'enter fullscreen' } } window.editor = new epiceditor(opts); editor.load(function () { console.log("editor loaded.") }); $("#openfile").on("click", function() { console.log("openfile"); editor.open(file); editor.enterfullscreen(); })
when try open file "editor.open(file);" not happen anything. , have verified event triggered proprely when press button. have idea how fix this, or have real example... documentation api on epiceditor website not much.
cheers
client side js cannot open desktop files (or, not or cross browser). nice feature use file api, that's not implemented. epiceditor stores "files" in localstorage. when editor.open('foo')
you're doing: json.parse(localstorage['epiceditor'])['foo'].content
. has been asked few times, made ticket make more clear in docs.
https://github.com/oscargodson/epiceditor/issues/276
does help?
p.s. pull request docs make sense welcome :)
Comments
Post a Comment