Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Html workers #3

Closed
gusdaud-zz opened this issue Jun 18, 2016 · 5 comments
Closed

Html workers #3

gusdaud-zz opened this issue Jun 18, 2016 · 5 comments
Assignees

Comments

@gusdaud-zz
Copy link

Hi, is html workers coming to this package ?

I've managed to make they work by copying the missing files from the demo pages to the same folders in my project.

It did great except for inline css and javascript and script tags which didn't work.

@alexdima
Copy link
Member

alexdima commented Jun 20, 2016

@gusdaud I am not sure what you mean. https://microsoft.github.io/monaco-editor/index.html uses the monaco-editor npm modules as it is shipped and has a HTML example:

image

Are you running your sample pages on a real protocol (such as http or https) or are you using the file protocol (the latter does not allow for web workers to be created).

[1] Chrome and Opera give an error "Uncaught SecurityError: Failed to construct 'Worker': Script at 'file:///Path/to/worker.js' cannot be accessed from origin 'null'." when you try to run a worker locally. It needs to be on a proper domain.

https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers#Browser_compatibility

@gusdaud-zz
Copy link
Author

Hey Alex. I'm running on http localhost and on google Chrome.

I've managed to make auto complete and other features provided by the workers to function by manually copying some files to my project such as:

\min\vs\languages\html\common\htmlWorker.js
\min\vs\languages\html\common\htmlWorker.nls.js
\min\vs\base\worker\workerMain.js

That didn't come when I NPM INSTALL Monaco.

(I had to debug the online samples to figure which files were missing)

@pierogitus
Copy link

pierogitus commented Jun 21, 2016

The sample code for running cross origin is wrong. The variable for setting the cross origin worker url should be GlobalEnvironment, not MonacoEnvironment. See this commit microsoft/vscode@70072cb

@alexdima
Copy link
Member

brought back in microsoft/vscode@50fabe9

@alexdima alexdima self-assigned this Jun 24, 2016
@mateuslacorte
Copy link

The sample code for running cross origin is wrong. The variable for setting the cross origin worker url should be GlobalEnvironment, not MonacoEnvironment. See this commit Microsoft/vscode@70072cb

Nice! Fixed here!

@vscodebot vscodebot bot locked and limited conversation to collaborators Oct 29, 2019
CGNonofr pushed a commit to CodinGame/monaco-editor that referenced this issue Nov 10, 2021
CGNonofr pushed a commit to CodinGame/monaco-editor that referenced this issue Nov 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants