Package com.codename1.ui.editor
The pure Codename One text editing engine that backs
com.codename1.ui.RichTextArea and com.codename1.ui.CodeEditor.
Overview
This package renders and edits text entirely with the Codename One graphics pipeline - it owns the document model, caret, selection, undo stack, layout and painting, and binds directly to the platform text input source (soft keyboard, autocorrect and IME composition) rather than embedding a native web view. Because the engine draws every glyph itself it behaves consistently across platforms and supports mixed left-to-right and right-to-left text via the Unicode Bidirectional Algorithm.
Key types
-
EditorDocument- the mutable character buffer with a line index that caret, selection, undo and the platform input source all operate on. -
EditorView- the basecom.codename1.ui.Componentthat measures, paints, scrolls and hit-tests the document and implements the text input client contract;CodeViewandRichViewextend it for the code and rich text feature layers. -
BidiUtil- the Unicode Bidirectional Algorithm used to resolve embedding levels and reorder mixed-direction runs for measurement and paint. -
HtmlImporter- parses the HTML fragment accepted byRichTextAreainto the styled block/run model the engine renders. -
SyntaxHighlighter,SyntaxToken, andSyntaxHighlightResult- the public extension contract for incremental third-party code highlighting.
These classes are the implementation of the two public editor components;
applications normally interact with RichTextArea and CodeEditor, while
syntax-highlighting extensions implement the public contract in this package.
-
ClassDescriptionThe pure code editor backend.The pure code editor surface.The plain text backing store shared by the pure Codename One editors.The bridge a pure editor view uses to reach the owning editor component and, through it, the platform text input source.The pure Codename One text editing surface.Parses an HTML string into the pure rich text editor model (plain text plus per character
TextStyleand per paragraphRichBlocks.BlockAttr).The imported content.Serializes the pure rich text editor model (text +InlineStyles+RichBlocks) back into an HTML string forRichTextArea#getHtml.The per character inline style model for the pure rich text editor.A predicate over a style, used by#allInRange.A transform applied to a character's style, used to toggle bold, set a color, etc.Describes the lexical rules of a programming language for the pure code editor's tokenizer: its keyword set, comment styles, string delimiters and number syntax.The pure Codename One editor backend.The per paragraph block attribute model for the pure rich text editor.A single paragraph's block attributes.The pure rich text editor backend.Parses supported rich-text interchange formats into the shared editor model.Serializes the native rich-text model directly to its requested interchange format.The pure rich text editor surface.A pluggable incremental syntax highlighter forCodeEditor.Result of highlighting one source line, including the opaque state passed to the following line.One highlighted source span.An immutable inline text style (bold / italic / underline / strike, foreground color, highlight color and relative font size) used by the pure rich text editor.The color palette for the pure code editor, mirroring the light (GitHub style) and dark (VS Code style) themes used by the previousBrowserComponentbackend so switching backends is visually consistent.A small, allocation light, stateful lexer for the pure code editor.A compact undo / redo stack for the pure editors.