Skip to main content

Components

RichText

a components that wraps the webview that renders the editor

props:

nametypedefaultdescription
editorEditorBridgeThe bridge instance that created with useEditorBridge
exclusivelyUseCustomOnMessagebooleantrueWhen true, if you pass an onMessage prop (webview) this will override tentap's own onMessage property. You probably want to disable this, it's here for compatibility.

you can also override any of the regular WebView props although this is not recommended

Toolbar

A react component of a basic Toolbar that include these features:

  • Add link context Alt text

  • Change headling context Alt text

  • A lot of pre made toolbar items:

    • link
    • quote
    • code
    • bold
    • italic
    • checkList
    • underline
    • strikethrough
    • h1
    • h2
    • h3
    • h4
    • h5
    • h6
    • orderedList
    • bulletList
    • sync
    • lift
    • undo
    • redo

props:

nametypedefaultdescription
editorEditorBridgeThe bridge instance that created with useEditorBridge
hiddenbooleana prop to control if toolbar shown
itemsToolbarItem[]DEFAULT_TOOLBAR_ITEMSarray of ToolbarItem's that will be shown on the toolbar

See how we add a custom toolbar item in the color keyboard example

ToolbarItem

The item rendered by the toolbar component

export interface ToolbarItem {
onPress: ({ editor, editorState }: ArgsToolbarCB) => () => void;
active: ({ editor, editorState }: ArgsToolbarCB) => boolean;
disabled: ({ editor, editorState }: ArgsToolbarCB) => boolean;
image: ({ editor, editorState }: ArgsToolbarCB) => any;
}

type ArgsToolbarCB = {
editor: EditorBridge;
editorState: BridgeState;
};