Editor.Protocol

Protocol module used in Editor.url and custom protocol.

Methods

Editor.Protocol.register (protocol, fn)

Register a protocol so that Editor.url can use it to convert an url to the filesystem path. The fn accept an url Object via url.parse.

Example:

const Path = require('path');

let _url2path = base => {
  return uri => {
    if ( uri.pathname ) {
      return Path.join( base, uri.host, uri.pathname );
    }
    return Path.join( base, uri.host );
  };
};

Editor.Protocol.register('editor-framework', _url2path(Editor.frameworkPath));