Unable to open local Blob URLs.
I'm trying to create a browser extension to edit currently viewing web page as markdown. To do that, I've written code to convert HTML to Markdown, save it as a local blob, and open stackedit.io from the blob url. However, it fails with an error 500 (Internal Server Error.) Is there any plan to support 'open from blob url' ?
The URL parameter is meant to ask a web service to download a file. If you pass the file content there, it's not necessary to ask this web service. So I guess you should use another url parameter like content= and create a StackEdit extension to parse this parameter and create the file using fileMgr module. Tell me if you need help on that.
Can Extensions depend on fileMgr? A reference error occurs if I inject fileMgr into an extension:
Uncaught TypeError: Cannot read property 'addListener' of undefined (fileMgr.js:164)
If you copy/paste that in Settings>Extensions>UserCustom, you will have an extension that creates a file every time you open StackEdit:
userCustom.onReady = function() {
var fileDesc = fileMgr.createFile('Title', 'Content');
fileMgr.selectFile(fileDesc);
};
If you are creating your own extension, you can have a look at userCustom.js and see how the fileMgr module is injected. Basically, you have to use onFileMgrCreated event instead of requirejs injection because extensions are created before the fileMgr module.
See this part of the developer guide for a list of available events.
Thanks for you support. I've created an extension to parse url parameters. But if I include a URL into the parameters, an error occurs in LESS (before extensions are loaded.)
For instance, if I open the following URL in my dev environment:
'http://localhost/?debug&content=blob:chrome-extension%123//abc/def'
An error occurs at lessc.js:537:
Uncaught Error: Unrecognised input
I think there's a bug in less.js, however, I don't understand why the CSS preprocessor has to parse the document url.