Ensure path of content loaded in the editor is consistent

pull/262/head
yann300 4 years ago committed by GitHub
parent f59019cbe1
commit c7fb18be69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      src/app/editor/editor.js

@ -324,6 +324,13 @@ class Editor extends Plugin {
* @param {string} content Content of the document or update.
*/
open (path, content) {
/*
we have the following cases:
- URL prepended with "localhost"
- URL prepended with "browser"
- URL not prepended with the file explorer. We assume (as it is in the whole app, that this is a "browser" URL
*/
if (!path.startsWith('localhost') && !path.startsWith('browser')) path = `browser/${path}`
if (!this.sessions[path]) {
const session = this._createSession(content, this._getMode(path))
this.sessions[path] = session

Loading…
Cancel
Save