Skip to main content

EditorBridge

An Interface of all the commands you can do with the editor on the react native side, can be extended with a BrideExtension. With all of the bridges included in tentapStarterKit the EditorBridge will have:

focus

(pos?: 'start' \| 'end' \| 'all' \| number \| boolean \| null) => void
a function that will focus the editor and open the keyboard
extended by CoreBridge

blur

a function that will blur the editor and close the keyboard
extended by CoreBridge

webviewRef

RefObject\<WebView\>
a ref for the webview that renders the editor
extended by CoreBridge

getEditorState

() => BridgeState
a function that will return the most up to date BridgeState
extended by CoreBridge

getHTML

() => Promise\<string\>
an async function that will return the content of the editor in html format
extended by CoreBridge

getText

() => Promise\<string\>
an async function that will return the content of the editor in text format
extended by CoreBridge

getJSON

() => Promise\<object\>
an async function that will return the content of the editor in json format
extended by CoreBridge

setContent

(content: string) => void
a function that get's html as string and set set's it as the editors content
extended by CoreBridge

setEditable

(editable: boolean) => void
a function that sets the editable state
extended by CoreBridge

setSelection

(from: number, to: number) => void
sets the selection of the editor
extended by CoreBridge

injectCSS

(css: string, tag?: string) => void
creates or updates the stylesheet with the given tag, see Dynamically Updating CSS
default tag: custom-css
extended by CoreBridge

injectJS

(js: string) => void
inject custom javascript into the editor's webview
extended by CoreBridge

updateScrollThresholdAndMargin

(offset: number) => void
a function that gets offset in px and changes scrollThreshold scrollMargin
extended by CoreBridge

toggleBlockquote

() => void
will toggle bold on the editor if possible
extended by BlockquoteBridge

toggleCode

() => void
will toggle code block on the editor if possible
extended by CodeBridge

toggleItalic

() => void
will toggle italic on the editor if possible
extended by ItalicBridge

toggleStrikethrough

() => void
will toggle strikethrough on the editor if possible
extended by StrikeBridge

toggleBulletList

() => void
will toggle bullet list on the editor if possible
extended by BulletListBridge

toggleOrderedList

() => void
will toggle order list on the editor if possible
extended by OrderedListBridge

toggleHeading

(level: number) => void
gets level and toggles heading on the editor if possible
extended by HeadingBridge

lift

() => void
will lift p on the editor if possible
extended by ListItemBridge

sink

() => void
will sink p on the editor if possible
extended by ListItemBridge

undo

() => void
will undo the last history transaction if possible
extended by HistoryBridge

redo

() => void
will redo the last undo transaction if possible
extended by HistoryBridge

setColor

(color: string) => void
sets text color
extended by ColorBridge

unsetColor

() => void
un-sets text color
extended by ColorBridge

setHighlight

(color: string) => void
sets text highlight
extended by HighlightBridge

toggleHighlight

(color: string) => void
toggles text highlight
extended by HighlightBridge

unsetHighlight

(color: string) => void
un-sets text highlight
extended by HighlightBridge

setImage

(src: string) => void
gets image url string and sets image
extended by ImageBridge

(link: string \| null) => void
gets link url as string and sets link, in case of null it will remove the link
extended by LinkBridge

toggleTaskList

() => void
will toggle task list on the editor if possible
extended by TaskListBridge

toggleUnderline

() => void
will toggle underline on the editor if possible
extended by UnderlineBridge

setPlaceholder

(newPlaceholder: string) => void
will change the placeholder on run time
extended by PlaceholderBridge