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

[QUESTION] Is there a way to give background color to editor box #27

Closed
Chanondler opened this issue Apr 24, 2021 · 4 comments
Closed
Labels
question Further information is requested

Comments

@Chanondler
Copy link

I want to add background color to the editor area which is grey color now. Is there any way to do so?
Thanks in advance.
Screenshot 2021-04-24 at 5 58 50 PM

@Chanondler Chanondler added the question Further information is requested label Apr 24, 2021
@tneotia
Copy link
Owner

tneotia commented Apr 24, 2021

Hi, yes you can do this. The easiest way would be to disable darkMode, use the onInit callback, and run JS like so:

HtmlEditor(
   controller: controller,
      htmlEditorOptions: HtmlEditorOptions(
      darkMode: false,
   ),
   callbacks: Callbacks(onInit: () {
      controller.editorController!.evaluateJavascript(source: "document.getElementsByClassName('note-editable')[0].style.backgroundColor='blue';");
   }),
),

You can use any hex code or named color in place of blue (make sure they are in quotes though).

Result:

Please note this only works on mobile. If you use Web let me know and I'll provide a solution for that.

Reference:

summernote/summernote#2390

https://stackoverflow.com/questions/1874560/how-to-use-javascript-to-change-div-backgroundcolor

PS that editor design looks really, really good! 😀

@Chanondler
Copy link
Author

@tneotia Thanks Mate!
One more issue though, editor is not working on ios. Whatever I type does not reflect in the editor. Shall I open a new issue?

Thanks for the compliment for the design. Implementing neumorphic ui in my app. All credits to you for providing customisations.

@tneotia
Copy link
Owner

tneotia commented Apr 26, 2021

If you are using the simulator there is an odd issue where typing with the hardware keyboard does not work in the webview (not just this package, but any webview).

Refer to #7 (comment)

If you have a physical device and it doesn't work, please open a new issue. Thanks!

@mathsilva-dev
Copy link

If you are using the simulator there is an odd issue where typing with the hardware keyboard does not work in the webview (not just this package, but any webview).

Refer to #7 (comment)

If you have a physical device and it doesn't work, please open a new issue. Thanks!

Hello @tneotia
I use this package for web, but i need change the background color the editor, and i see this solution that you presented is only for mobile.
You have a solution for in web usage?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants