Đi tới nội dung tài liệu
Underverse UI Logo
ComponentForm Input

UEditor

Đã cập nhật

UEditor thuộc nhóm Form Input. Xem demo trực tiếp, cách tích hợp và các lưu ý triển khai.

Bắt đầu nhanh

Import UEditor từ entry công khai. Các ví dụ bên dưới thể hiện những kiểu tương tác và cấu hình được hỗ trợ.

component.tsxtsx
import { UEditor } from '@underverse-ui/underverse';

Ví dụ tương tác

Dùng thử UEditor thật, xem mã ví dụ và tra cứu các prop đã được mô tả.

Đang tải ví dụ tương tác…
Tham chiếu

Tham chiếu API

Tra cứu các thuộc tính, kiểu dữ liệu được chấp nhận, giá trị mặc định và lưu ý về hành vi.

Dữ liệu được sinh từ API TypeScript công khai của thư viện. Kiểu dữ liệu, thuộc tính bắt buộc và giá trị mặc định luôn đồng bộ với mã nguồn.

UEditor

Component
Thuộc tínhMô tảKiểuMặc định
getPortalContainerReturns the per-editor container used by menus and other portalled overlays.() => HTMLElement | null
contentInitial or controlled HTML content for the editor.string""
onChangeCalled with the current HTML after editor updates. Kept for backward compatibility with `onHtmlChange`.(content: string) => void
onHtmlChangeCalled with the current HTML after editor updates. Prefer this when the consumer stores HTML.(html: string) => void
onJsonChangeCalled with the current TipTap JSON document after editor updates.(json: object) => void
outputDebounceMsDebounces HTML/JSON output callbacks by the given number of milliseconds. Defaults to `0` for backward-compatible immediate updates. Values around `100-200` are recommended for large controlled documents.number0
uploadImageUploads images immediately when they are inserted in `imageInsertMode="upload"`.(file: File) => Promise<string> | string
uploadImageForSaveUploads embedded/base64 images during `prepareContentForSave`; use this for save-time normalization.UEditorUploadImageForSave
uploadImageConcurrencyMaximum number of concurrent save-time image/file uploads.number3
imageInsertModeWhether inserted images are kept as base64 in editor state or uploaded immediately."base64" | "upload""base64"
maxImageFileSizeMã nguồn chưa cung cấp mô tả bổ sung.number
allowedImageMimeTypesMã nguồn chưa cung cấp mô tả bổ sung.string[]
fallbackToDataUrlMã nguồn chưa cung cấp mô tả bổ sung.boolean
placeholderMã nguồn chưa cung cấp mô tả bổ sung.string
classNameMã nguồn chưa cung cấp mô tả bổ sung.string
editableMã nguồn chưa cung cấp mô tả bổ sung.booleantrue
autofocusMã nguồn chưa cung cấp mô tả bổ sung.booleanfalse
showToolbarMã nguồn chưa cung cấp mô tả bổ sung.booleantrue
showBubbleMenuMã nguồn chưa cung cấp mô tả bổ sung.booleantrue
showFloatingMenuMã nguồn chưa cung cấp mô tả bổ sung.booleanfalse
showCharacterCountMã nguồn chưa cung cấp mô tả bổ sung.booleantrue
showFooterWhether to show the editor footer. Defaults to `true`.booleantrue
maxCharactersMã nguồn chưa cung cấp mô tả bổ sung.number
minHeightMã nguồn chưa cung cấp mô tả bổ sung.number | string"200px"
maxHeightMã nguồn chưa cung cấp mô tả bổ sung.number | string"auto"
variantMã nguồn chưa cung cấp mô tả bổ sung."default" | "minimal" | "medium" | "medium-full" | "full" | "notion""default"
roundedWhether the editor has rounded corners. Defaults to `true`.booleantrue
fontFamiliesMã nguồn chưa cung cấp mô tả bổ sung.UEditorFontFamilyOption[]
defaultFontFamilyDefault font family for the editor. Defaults to `"Inter"`.UEditorBuiltinFontFamily"Inter"
fontSizesMã nguồn chưa cung cấp mô tả bổ sung.UEditorFontSizeOption[]
lineHeightsMã nguồn chưa cung cấp mô tả bổ sung.UEditorLineHeightOption[]
letterSpacingsMã nguồn chưa cung cấp mô tả bổ sung.UEditorLetterSpacingOption[]
fetchMetadataMã nguồn chưa cung cấp mô tả bổ sung.(url: string) => Promise<{ title?: string; description?: string; image?: string; publisher?: string }>
uploadFileUploads file cards immediately after insertion when available.(file: File) => Promise<string> | string
uploadFileForSaveUploads embedded/base64 file cards during `prepareContentForSave`; falls back to `uploadImageForSave` if omitted.(file: File) => Promise<string | ({ url: string } & Record<string, unknown>)>
extraExtensionsAdditional TipTap extensions appended after the built-in UEditor extensions.Extension[]
showMenuBarMã nguồn chưa cung cấp mô tả bổ sung.booleanfalse
showPreviewButtonWhether to show the preview button at the end of the menu bar. Defaults to `true`.booleantrue
onSaveMã nguồn chưa cung cấp mô tả bổ sung.() => void
onExportMã nguồn chưa cung cấp mô tả bổ sung.() => void
onSourceCodeMã nguồn chưa cung cấp mô tả bổ sung.() => void
onPreviewFires when View > Preview or the eye button is clicked. Return false to prevent the built-in preview dialog.(html: string) => void | false

Hướng dẫn sử dụng

Kết nối UEditor với nhãn hiển thị, thông báo xác thực và trạng thái form rõ ràng. Không dùng placeholder làm nhãn duy nhất.

Trợ năng

Khi dùng UEditor, hãy giữ trạng thái focus dễ nhận biết, cung cấp tên truy cập khi cần và kiểm tra bàn phím cùng trình đọc màn hình trong ngữ cảnh thực tế.