Used in Hyvor Blogs and Hyvor Post.
import { Editor } from '@hyvor/richtext';
<Editor
bind:editorView
content={content}
onvaluechange={handleValueChange}
rtl={false}
config={{
embedEnabled: false,
// see config.ts for more options
}}
/>- The top-level node representing the entire document.
- A text node containing plain text.
- This is usually the only node that contains marks.
- Group:
inline
- A block-level node representing a paragraph of text.
- Parsed from
<p>HTML tag. - Group:
block - Content:
inline*
- A block-level node representing a heading.
- Attributes:
level: The level of the heading (1-6).id: Optional ID for the heading, useful for anchors.
- Parsed from
<h1>,<h2>,<h3>, etc. HTML tags. - Group:
block - Content:
inline*
- A block-level node representing a blockquote.
- Parsed from
<blockquote>HTML tag. - Group:
block - Content:
block+
- A block-level node representing a callout box.
- Attributes:
emoji: An emoji to display in the callout. Default💡bg: Background color of the callout. Default#f1f1effg: Foreground color of the callout. Default#000000
- Parsed from
<aside>
- A block-level node representing a figure, containing an image or audio node along with an optional caption.
- Parsed from
<figure>HTML tag. - Group:
block - Content:
(image|audio) figcaption config.imageEnabledorconfig.embedEnabledmust betrueto enable this node.
- An element that represents a caption or legend for a figure.
- Parsed from
<figcaption>HTML tag. - Content:
inline* - Same conditions as the
figurenode to enable.
- A block-level node representing an image, living inside a figure.
- Attributes:
src: The source URL of the image.alt: Alternative text for the image.width: Custom width of the image in pixels (nullby default).height: Custom height of the image in pixels (nullby default).
- Parsed from
<img>HTML tag. config.imageEnabledmust betrueto enable this node.
Note: config.imageUploader must be provided to upload images.
- A block-level node representing an audio file.
- Attributes:
src: The source URL of the audio file.
- Parsed from
<audio>HTML tag. config.audioEnabledmust betrueto enable this node.
Note: config.audioUploader must be provided to upload audio files.
- A block-level node representing an embed, living inside a figure.
- Attributes:
url: The URL of the embedded content.
- Parsed from
<x-embed>HTML tag. - Group:
block config.embedEnabledmust betrueto enable this node.
- A block-level node representing a link bookmark preview.
- Attributes:
url: The URL of the bookmark.
- Parsed from
<bookmark>HTML tag. - Group:
block config.bookmarkEnabledmust betrueto enable this node.
- A block-level node representing a table of contents.
- Attributes:
levels: The heading levels to include in the TOC (e.g.,[1, 2, 3]).
- Group:
block config.tocEnabledmust betrueto enable this node.
- A block-level node representing a table.
- Subnodes:
table_row,table_cell,table_header - Parsed from
<table>HTML tag. - Group:
block config.tableEnabledmust betrueto enable this node.
- A block-level node representing a button.
- Attributes:
href: The URL the button links to.
- Parsed from
<div class="button-wrap">HTML tag. - Group:
block - Content:
inline* config.buttonEnabledmust betrueto enable this node.
- A block-level node representing a block of preformatted code.
- Attributes:
language: The programming language of the code block (optional).annotations: An array of annotations for the code block (optional).name: Filename associated with the code block (optional).
- Parsed from
<pre><code>HTML tags. - Group:
block - Content:
text*
- A block-level node representing custom HTML content.
- Attributes:
- Content:
text*
The following marks are supported:
code
link(attributes:href)emstrongstrikesupsub