CodinGame / monaco-vscode-api

VSCode public API plugged on the monaco editor
MIT License
214 stars 29 forks source link

Body classes looks incorrect #333

Closed BusinessDuck closed 5 months ago

BusinessDuck commented 5 months ago

Hi! Eextra body classes with css styles for that classes causes an global layout changes, like background-color.

See here: https://github.com/CodinGame/monaco-vscode-api/blob/9f6556db2bfbfd3f9bebdca03eeee60a30d92e44/src/service-override/layout.ts#L464

Also web class may be applied twice, looks a bit strange.

I guess that's from vscode workbench... https://github.com/microsoft/vscode/blob/f40051b610e7a8333ab90e30c7bf581fd0ac758c/src/vs/workbench/browser/workbench.ts#L323

The main problem is that Monaco needs to be embeddable in on-page containers, and the current implementation of workbencn only has an on-page editor like vcode.dev

BusinessDuck commented 5 months ago

As possible solution i see the container defined by user something here. When service is initialized

keybindingService({ workbenchContainer: document.querySelector('body') });

like here https://github.com/CodinGame/monaco-vscode-api/blob/9f6556db2bfbfd3f9bebdca03eeee60a30d92e44/src/service-override/layout.ts#L93C27-L93C40

BusinessDuck commented 5 months ago

One alternative quick solution to the problem is to remove styles that affect global characteristics (mean any styles which working directly with .monaco-workbench rule in css) inside of monaco-editor-treemended package

toastyboost commented 5 months ago

Same problem

CGNonofr commented 5 months ago

What property is an issue except background-color and forced-color-adjust?

As possible solution i see the container defined by user something here. When service is initialized

keybindingService({ workbenchContainer: document.querySelector('body') });

like here https://github.com/CodinGame/monaco-vscode-api/blob/9f6556db2bfbfd3f9bebdca03eeee60a30d92e44/src/service-override/layout.ts#L93C27-L93C40

This is deprecated though, you can provide it as the second parameter when initializing the services instead

BusinessDuck commented 5 months ago

What property is an issue except background-color and forced-color-adjust?

Only these

CGNonofr commented 5 months ago

I don't think it's a big issue since it's easily overridable but here's a PR that removes the VSCode global style

github-actions[bot] commented 5 months ago

:tada: This issue has been resolved in version 2.0.2 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: