Save editable block content
Write editor-managed content to a custom block property.
Before you start
Add the component
import { createComponent, createIntegration } from '@gitbook/runtime';
const editableContent = createComponent({
componentId: 'editable-content',
render: async (element) => (
<block>
<textinput
state="content"
initialValue={element.props.content}
label="Content"
/>
<button
label="Save content"
onPress={{
action: '@editor.node.updateProps',
props: {
content: element.dynamicState('content')
}
}}
/>
</block>
)
});
export default createIntegration({
components: [editableContent]
});Add the block to your manifest
Test the block
Next steps
Last updated
Was this helpful?