@mocanvas/mocanvas · interface
interface EditableTextHandleEverything a label component needs, from either hook.
Properties · 10
handleBlur: () => voidStop editing when focus leaves the label.
handleDoubleClick: (e: {Start editing on a double click.
handleFocus: () => voidSelect the whole label when it takes focus, so typing replaces it.
handleInputPointerDown: (e: PointerEvent) => voidSwallow pointer-down inside the input so the canvas does not start a drag.
handleKeyDown: (e: KeyboardEvent) => voidEscape commits, Enter commits a single-line label.
handlePaste: (e: ClipboardEvent | ClipboardEvent$1<HTMLTextAreaElement>) => voidLet a paste inside the label reach the label rather than the canvas.
isEditing: booleanWhether this shape is the one being edited.
isEmpty: boolean | undefinedWhether the label has no text; undefined before it is known.
isReadyForEditing: booleanWhether the editing surface may mount.
One frame behind isEditing: a contenteditable that mounts in the
same commit as the state change steals focus before the canvas has
finished handling the click that caused it.
rInput: RefObject<HTMLDivElement | null>Ref for the element the text is edited in.
mocanvas is built by Symbio. Free for non-commercial, non-profit and development use; commercial use needs an agreement. Not affiliated with or endorsed by tldraw.