Editor.Protocol
Protocol module used in Editor.url
and custom protocol.
Methods
Editor.Protocol.register (protocol, fn)
protocol
string - Protocol namefn
function
Register a protocol so thatEditor.url
can use it to convert an url to the filesystem path.Thefn
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));