B4J Library CodeMirror wrapper and example

After the proof of concept test, here is a wrapper for the CodeMirror javascript libarary which runs quite happily in a Webview.

Current functionality:
  • Highlighting Mode for B4x (and 100+ other languages)
  • Minimal wrapper implementation in library, see the attached CodeEditor for an example of a fuller implementation
  • implemented the available visual themes

In addition, the CodeEditor (also a b4xlib) is an example implementation. The only thing not implemented is file loading and saving as the would really depend on the structure of your project.

Dependencies:

CodeMirrorWrapper:

CodeEditor
  • CodeMirrorWrapper

CMMinimal Implementaion - Project
  • CodeMirrorWrapper

Downloads: (Dropbox)

Both the CodeMirror b4xlib and the CodeMirror project are too large to attach to the forum as they contain the CodeMirror javascript library.
You can download them from my dropbox here:

Version 1.5

  • Separated from the CodeEditor module for easier minimal implementation.
  • Added ReadOnly option
  • Added Themes
    • Requires an allowedthemes List to be passed so they can be validataed against the defined themes.
    • You can pass a subset of the defined themes so only your preferred themes are available.

Update 1.51

  • Small process changes to enable minimal implementation
    • Please download library / Project from the dropbox link
    • added minimal implementation example.

1608562768624.png

The CodeEditor.b4xlib and Project and XML files for both libraries are attached.

I hope you find them useful. Let me know how you get on with them.
 

Attachments

  • CodeEditor.b4xlib
    4.7 KB · Views: 92
  • Codeeditor.zip
    7.1 KB · Views: 114
  • CodeEditor.xml
    4.5 KB · Views: 88
  • CodeMirrorWrapper.xml
    27.7 KB · Views: 113
  • CMMinimal.zip
    2.1 KB · Views: 96
Last edited:

stevel05

Expert
Licensed User
Update 1.51

  • Small process changes to enable minimal implementation
    • Please download updated library / Project from the dropbox link
    • added minimal implementation example.
 
Last edited:
Top