shadow: false · scoped: false — light DOM. ProseMirror controla el DOM editable de forma imperativa.
Props Prop Atributo Tipo Default Descripción accountFontsaccount-fontsstring | undefined | { label: string; value: string; }[]—Account/imported fonts shown in a separate "Imported fonts" section.
JS property: `Array<{ label: string; value: string }>`.
HTML attribute: JSON string of the same array. autofocusautofocusbooleanfalsecustomExtensions— object[] | undefined—Extra Tiptap extensions appended to the preset (JS property only).
Registered at editor creation — required for new schema nodes (images,
tables, embeds, …) that `getEditorInstance()` cannot add afterwards. disableddisabledbooleanfalsefeaturesfeaturesobject | string | undefined—Feature overrides (JSON string for HTML attr, or object via JS property). fontFamiliesfont-familiesstring | undefined | { label: string; value: string; }[]—Font families available in the bubble menu font selector.
JS property: `Array<{ label: string; value: string }>`.
HTML attribute: JSON string of the same array.
If not provided, a default list of system fonts is used. fontLoader— (() => Promise<{ label: string; value: string; url?: string | undefined; }[]>) | undefined—Async callback that loads account/imported fonts.
Called once when the font dropdown opens for the first time.
Must return `Array<{ label: string; value: string; url?: string }>`.
If `url` is provided, the font is registered via FontFace API.
JS property only — cannot be set via HTML attribute. fontsLoadingfonts-loadingboolean | undefined—Whether account fonts are currently loading. helperTexthelper-textstring | undefined—imageUpload— ((file: File) => Promise<string>) | undefined—Host image upload handler (JS property): `(file) => Promise<url>`. labellabelstring | undefined—localelocalestring'en'BCP-47 locale for UI strings (e.g. 'en', 'es-CO', 'pt-BR'). Default English. maxLengthmax-lengthnumber | undefined—placeholderplaceholderstring''presetpreset"comment" | "document" | "email" | "task"'task'Preset controlling allowed nodes/marks, toolbar and sanitization. readonlyreadonlybooleanfalserequiredrequiredbooleanfalsesecondaryLabelsecondary-labelstring | undefined—showCharacterCountshow-character-countbooleanfalsestatusstatus"default" | "error" | "info" | "success" | "warning"'default'toolbartoolbar"auto" | "basic" | "compact" | "full" | "none"'auto'Toolbar layout. `auto` uses the preset default. valuevaluenull | stringnullProseMirror document as a JSON string. `null`/empty = empty editor.
Eventos Evento Detail Bubbles Cancelable Descripción coBlurvoid✓ ✓ coChangeRichTextOutput✓ ✓ Emitted on blur (committed value). coClearvoid✓ ✓ coFocusvoid✓ ✓ coFontPopupHidevoid✓ ✓ Emitted when the font dropdown closes. coFontPopupShowvoid✓ ✓ Emitted when the font dropdown opens — host should load account fonts. coInputRichTextOutput✓ ✓ Emitted on every keystroke. coReadyvoid✓ ✓ Emitted once the editor is mounted and ready.
Slots Este componente no expone slots.
CSS Parts Part Descripción ::part(content)Editable ProseMirror surface ::part(helper)Helper text row ::part(label)Field label ::part(toolbar)Formatting toolbar ::part(wrapper)Outer container
CSS Custom Properties Este componente no expone CSS custom properties.
Estas propiedades solo pueden asignarse vía JavaScript (no como atributos HTML):
Prop Tipo Descripción customExtensionsExtension[]Extensiones Tiptap adicionales (schema nuevo) imageUpload(file: File) => Promise<string>Handler de subida de imágenes a CDN fontLoader() => Promise<FontEntry[]>Callback async para cargar fuentes de cuenta
Método Retorno Descripción getJSON()Promise<object | null>Documento ProseMirror JSON, o null si vacío getHtml()Promise<string>HTML sanitizado getText()Promise<string>Texto plano clear()Promise<void>Limpia el contenido y emite coClear focusEditor()Promise<void>Foca el editor programáticamente setContent(content)Promise<void>Establece contenido (HTML string u objeto JSON) getEditorInstance()Promise<Editor | null>Instancia Tiptap — escape hatch para control avanzado
Evento Payload Cuándo coInput{ json, html, text }Cada cambio (keystroke) coChange{ json, html, text }Al perder foco (valor confirmado) coFocusvoidAl ganar foco coBlurvoidAl perder foco coClearvoidDespués de clear() coReadyvoidEditor montado y listo coFontPopupShowvoidSe abrió el selector de fuentes coFontPopupHidevoidSe cerró el selector de fuentes
shadow: true
Props Prop Atributo Tipo Default Descripción compactcompactbooleanfalseReduced padding. emptyTextempty-textstring | undefined—Text shown when there is no content. formatformat"html" | "json"'html'Input format. `html` is the lightweight path. presetpreset"comment" | "document" | "email" | "task"'document'Sanitization profile to apply. valuevaluenull | stringnullHTML string (default) or ProseMirror JSON string.
Eventos Este componente no emite eventos personalizados.
Slots Este componente no expone slots.
CSS Parts Part Descripción ::part(content)::part(empty)
CSS Custom Properties Este componente no expone CSS custom properties.
shadow: true — normalmente renderizado internamente por el editor.
Props Prop Atributo Tipo Default Descripción disableddisabledbooleanfalseeditor— Editor | undefined—Editor instance (set as a property by the host editor). imageUpload— ((file: File) => Promise<any>) | undefined—Image upload handler (JS property): `(file) => Promise<url | {src, fileId}>`. localelocalestring'en'BCP-47 locale for UI strings (e.g. 'en', 'es-CO', 'pt-BR'). Default English. variantvariant"basic" | "compact" | "full" | "none"'basic'Toolbar layout variant.
Eventos Evento Detail Bubbles Cancelable Descripción coAction{ action: string; payload?: unknown; }✓ ✓ Emitted whenever a toolbar action runs (observability for hosts). coPopoverChange{ open: boolean; }✓ ✓ Emitted when a toolbar popover/dropdown opens or closes (host hides the
selection bubble while one is open to avoid spatial overlap).
Slots Este componente no expone slots.
CSS Parts Part Descripción ::part(button)A toolbar button ::part(toolbar)The toolbar container
CSS Custom Properties Este componente no expone CSS custom properties.
Evento Payload Descripción coAction{ action: string; payload?: unknown }Se ejecutó una acción de toolbar coPopoverChange{ open: boolean }Un popover/dropdown se abrió o cerró
import { createEditor } from '@prolibu-suite/cobalt-rich-text' ;
const editor = createEditor ({
element: document. getElementById ( 'editor' ),
placeholder: 'Escribe aquí…' ,
features: { variables: true },
imageUpload : async ( file ) => uploadToCDN (file),
onUpdate : ({ editor }) => { /* ... */ },
onFocus : () => { /* ... */ },
onBlur : () => { /* ... */ },
} from '@prolibu-suite/cobalt-rich-text' ;
const exts = getExtensions ( 'email' , {
placeholder: 'Escribe tu email…' ,
features: { variables: true , mentions: true },
defaultToolbarForPreset ( 'task' ); // 'basic'
maxLengthForPreset ( 'comment' ); // 2000
PRESETS ; // ['comment', 'task', 'email', 'document']
import { jsonToHtml, htmlToJson, jsonToText } from '@prolibu-suite/cobalt-rich-text' ;
const html = jsonToHtml (prosemirrorDoc, 'task' ); // HTML sanitizado
const json = htmlToJson (htmlString, 'task' ); // sanitiza antes de parsear
const text = jsonToText (prosemirrorDoc); // texto plano
import { sanitize, SANITIZE_CONFIGS } from '@prolibu-suite/cobalt-rich-text' ;
const clean = sanitize (dirtyHtml, 'email' );
RichTextPreset, // 'comment' | 'task' | 'email' | 'document'
ToolbarVariant, // 'none' | 'compact' | 'basic' | 'full'
RichTextOutput, // { json: object; html: string; text: string }
RichTextFeatures, // { mentions?, variables?, image?, characterCount?, link? }
} from '@prolibu-suite/cobalt-rich-text' ;