yansenlei / VJsoneditor

:large_blue_diamond: vue use jsoneditor
https://yansenlei.github.io/VJsoneditor/
Apache License 2.0
182 stars 45 forks source link

Can the theme be changed? #31

Closed ghost closed 3 years ago

ghost commented 3 years ago

I'm not entirely sure, but since this is using ace underneath can I still change the theme? If so how?

ghost commented 3 years ago

I think I just figured it out, will test tomorrow. Looks like setting the option

{String} theme

Set the Ace editor theme, uses included 'ace/theme/jsoneditor' by default. Please note that only the default theme is included with JSONEditor, so if you specify another one you need to make sure it is loaded.
ghost commented 3 years ago

So after hours of messing with this and many tries at different ways I cannot get this to work. I found a pretty neat guide that seems a few using vue used.

npm install brace so that I can import different ACE themes, for example import "brace/theme/tomorrow_night_bright"; I tried to set this new theme using JSONEditor options before initialization. It works. options.theme = "ace/theme/tomorrow_night_bright"; this.jsoneditor = new JSONEditor(this.container, options);

However I get nothing. No errors in the console and the text simply does not load up. Am I doing something wrong? Or is this just a fruitless exercise.

yansenlei commented 3 years ago

I tried. Everything was fine.

https://codesandbox.io/s/vjsoneditor-theme-21yjz37j2y?file=/src/App.vue:600-640

import "brace";
import "brace/theme/tomorrow_night_bright";

options.theme = "ace/theme/tomorrow_night_bright"
ghost commented 3 years ago

I tried. Everything was fine.

https://codesandbox.io/s/vjsoneditor-theme-21yjz37j2y?file=/src/App.vue:600-640

import "brace";
import "brace/theme/tomorrow_night_bright";

options.theme = "ace/theme/tomorrow_night_bright"

Well sad day. Clearly does work. When I set it The editor displays as I mentioned before. But there is nothing in the editor. Just the header and footer. It must be something with my setup tho so I'll keep messing with it. Thanks for confirming tho.

yansenlei commented 3 years ago

Happy to help.

ghost commented 3 years ago

Closing this as this is clearly something wrong with my setup.