HtmlEditorController class

Controller for web

Mixed in types
Available Extensions

Constructors

HtmlEditorController({bool processNewLineAsBr = false, bool processOutputHtml = true, HtmlEditorOptions? editorOptions, HtmlToolbarOptions? toolbarOptions, HtmlStylingOptions? stylingOptions, Callbacks? callbacks, BuildContext? context})

Properties

autoAdjustHeight bool
The editor will automatically adjust its height once the page is loaded to ensure there is no vertical scrolling or empty space. It will only perform the adjustment when the editor is the loaded page.
no setter
callbacks Callbacks
Sets & activates Summernote's callbacks. See the functions available in Callbacks for more details.
getter/setter pair
characterCount int
Gets the current character count
getter/setter pair
content String
Gets the current content of the editor.
no setter
contentHeight double
height occupied by the content section of the editor
getter/setter pair
contentIsEmpty bool
Checks if the editor is empty
no setter
contentIsNotEmpty bool
Checks if the editor is not empty
no setter
context BuildContext?
This context is used only if you need to provide a context other than the one the Editor will get by default.
getter/setter pair
editorController ↔ WebViewController
Allows the WebViewController for the Html editor to be accessed outside of the package itself for endless control and customization.
getter/setter pairinherited
editorOptions HtmlEditorOptions
Defines options for the html editor
getter/setter pair
enableDictation bool
If enabled - shows microphone icon and allows to use dictation within the editor
getter/setter pair
fault Exception?
Fault thrown by the editor. Null if there is no fault.
getter/setter pair
filePath String
finalinherited
focusNode FocusNode?
getter/setter pair
hasFault bool
is there a fault? If there is, the editor will show an error message instead of the editor itself. The "Ok" button will reset the fault.
no setter
hasFocus bool
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
Whether any listeners are currently registered.
no setterinherited
initialized bool
whether the interface is initialized successfully
no setter
isDisabled bool
read only mode
getter/setter pair
isReadOnly bool
Puts editor in read-only mode, hiding its toollbar
getter/setter pair
isRecording bool
is dictation running?
getter/setter pair
processNewLineAsBr bool
Determines whether text processing should happen on input HTML, e.g. whether a new line should be converted to a
.
final
processOutputHtml bool
Determines whether empty paragraph should be disregarded as a value, e.g. whether <p><br></p> is returned as "". Editor uses that HTML as the initial HTML for an opening paragraph (when no text has been entered in the editor).
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sttAvailable bool
is dictation available
no setter
sttBuffer String
Dictation result buffer
getter/setter pair
stylingOptions HtmlStylingOptions
Defines CSS styles for various components and whe
getter/setter pair
toolbar ToolbarWidgetState?
Toolbar widget state to call various methods. For internal use only.
getter/setter pair
toolbarHeight double?
toolbar widget height
no setter
toolbarKey GlobalKey<State<StatefulWidget>>
getter/setter pair
toolbarOptions HtmlToolbarOptions
Defines options for the editor toolbar
getter/setter pair
totalHeight ValueNotifier<double>
total height of the editor = content height + toolbar height
getter/setter pair
verticalPadding double
no setter
viewId String
getter/setter pairinherited

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
clear() Future<void>
Clears the editor of any text.
clearFocus() → void
Clears the focus from the webview
deinitialize() → void
Sometimes, when using MVVM/MVC design patterns, you may want to keep your controller in the root provider or notifier. In this case, when UI component gets destroyed you will want your controlller to be aware of that. This deinitialize method does just that.
disable() Future<void>
disables the Html editor
dispose() → void
inherited
enable() Future<void>
enables the Html editor
evaluateJavascript({required Map<String, Object?> data}) Future<void>
Helper function to run javascript and check current environment
inherited
execCommand(String command, {String? argument}) Future<void>
A function to quickly call a document.execCommand function in a readable format
getInitialContent() Future<String>
This method compiles HTML document based on various controller settings
getSelectedText() Future<String>
Gets the selected text from the editor and returns it as a String.
getText() Future<String>
Gets the text from the editor and returns it as a String.
init(BuildContext initBC, double initHeight, HtmlEditorController c) Future<void>
inherited
initEditor(BuildContext initBC) Future<void>
Initialization of native UI component the init method is pulled from platform-specific mixin and is different for each platform
insertHtml(String html) Future<void>
Insert HTML at the position of the cursor in the editor Note: This method should not be used for plaintext strings
Insert a link at the position of the cursor in the editor
insertText(String text) Future<void>
Insert text at the end of the current HTML content in the editor Note: This method should only be used for plaintext strings
moveCursorToEnd() Future<String>
Move the cursor to the end of the editor
moveCursorToStart() Future<String>
Move the cursor to the start of the editor
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
recalculateContentHeight() Future<void>
Recalculates the height of the editor to remove any vertical scrolling. This method will not do anything if autoAdjustHeight is turned off.
recalculateTotalHeight() → void
redo() → void
Redoes the last action
reloadContent() Future<void>
On native platform html injection is restricted, so we need to reload the page with new content in it. After the page is loaded, we need to prevent onInit callback and call onChaged instead.
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
resetFault() → void
resets the fault and hides the error message if there is one
scrollToCursor() → void
Scrolls the editor to the position of the cursor
setFault(Exception e) → void
setFocus() → void
Sets the focus to the editor.
setInitialText(String text) → void
Sets the initial text of the editor. This is useful when you want to initialize the editor with some text.
setIsRecording(bool value) → void
setSttBuffer(String value) → void
setText(String text) Future<void>
Sets the text of the editor.
toggleCodeView() → void
toggles the codeview in the Html editor
toString() String
A string representation of this object.
inherited
undo() → void
Undoes the last action
updateToolbar() Future<void>
view(HtmlEditorController controller) Widget
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited