Package-level declarations

Types

Link copied to clipboard
data class InlineAttachmentRange(val offset: Int, val attachment: InlineTextAttachment)
Link copied to clipboard
class InlineTextAttachment(val id: String, val mimeType: String, val uri: String? = null, val contentDescription: String? = null, val widthPx: Int? = null, val heightPx: Int? = null, metadata: Map<String, String> = emptyMap())

内联非文本内容的元数据。 Metadata for non-text inline content.

Link copied to clipboard
fun interface InputTransformation

在平台提出的用户编辑写入 TextFieldState 前进行校验或改写。 Validates or rewrites a platform-proposed user edit before it reaches TextFieldState.

Link copied to clipboard
data class ParagraphStyle(val alignment: ParagraphTextAlignment? = null, val lineHeightPx: Float? = null, val firstLineIndentPx: Float = 0.0f, val restLineIndentPx: Float = 0.0f, val bullet: TextBullet? = null)

段落级富文本样式。 Paragraph-level rich text style.

Link copied to clipboard
data class ParagraphStyleRange(val range: TextRange, val style: ParagraphStyle)
Link copied to clipboard

段落文本对齐方式。 Paragraph text alignment.

Link copied to clipboard
class ReceiveContentConfiguration(mimeTypes: Set<String> = DefaultMimeTypes, val transformation: ReceiveContentTransformation? = null)

文本字段 receive-content 的 MIME 白名单和可选转换器。 MIME allowlist and optional transformer for text-field receive-content.

Link copied to clipboard

文本字段接收外部内容的来源。 Source from which a text field received external content.

Link copied to clipboard
Link copied to clipboard
data class ReceivedContent(val document: TextDocument, val source: ReceiveContentSource, val mimeTypes: Set<String>, val platformItemCount: Int)

平台 receive-content payload 归一化后的框架模型。 Framework model normalized from a platform receive-content payload.

Link copied to clipboard
data class TextBullet(val radiusPx: Float = 3.0f, val gapWidthPx: Float = 8.0f, val color: Int? = null)

段落项目符号配置。 Paragraph bullet configuration.

Link copied to clipboard
class TextDocument(val text: String, spanStyles: List<TextSpanRange> = emptyList(), paragraphStyles: List<ParagraphStyleRange> = emptyList(), inlineAttachments: List<InlineAttachmentRange> = emptyList())

不可变富文本文档,包含纯文本、span、段落样式和内联附件。 Immutable rich-text document containing plain text, spans, paragraph styles, and inline attachments.

Link copied to clipboard

增量构建 TextDocument 的 builder。 Builder for incrementally creating TextDocument.

Link copied to clipboard

TextDocument 的 saveable 编解码器。 Saveable encoder/decoder for TextDocument.

Link copied to clipboard

暴露给程序化编辑和输入转换的可变编辑缓冲区。 Mutable editing buffer presented to programmatic edits and input transformations.

Link copied to clipboard
class TextFieldState(initialValue: TextFieldValue = TextFieldValue(""), val historyLimit: Int = DEFAULT_HISTORY_LIMIT)

可编辑文本、selection、IME composition 和 undo history 的稳定可观察 owner。 Stable, observable owner of editable text, selection, IME composition, and undo history.

Link copied to clipboard
data class TextFieldValue(val document: TextDocument, val selection: TextRange = TextRange(document.text.length), val composition: TextRange? = null)

完整可编辑状态的不可变快照。 An immutable snapshot of the complete editable state.

Link copied to clipboard

文本字体样式。 Text font style.

Link copied to clipboard
data class TextRange(val start: Int, val end: Int = start)

平台文本编辑器使用的有方向 UTF-16 范围。 A directional UTF-16 range used by platform text editors.

Link copied to clipboard
data class TextSpanRange(val range: TextRange, val style: TextSpanStyle)
Link copied to clipboard
data class TextSpanStyle(val color: Int? = null, val backgroundColor: Int? = null, val fontWeight: Int? = null, val fontStyle: TextFontStyle? = null, val relativeSize: Float? = null, val underline: Boolean = false, val lineThrough: Boolean = false, val verticalAlignment: TextVerticalAlignment = TextVerticalAlignment.Normal, val link: String? = null)

字符级富文本样式。 Character-level rich text style.

Link copied to clipboard

span 相对于文字基线的垂直对齐。 Span vertical alignment relative to the text baseline.

Properties

Link copied to clipboard
const val INLINE_ATTACHMENT_CHARACTER: Char = '\uFFFC'

富文本 inline attachment 在纯文本中的占位字符。 Placeholder character used by rich-text inline attachments inside plain text.

Functions

Link copied to clipboard

使用 DSL 构建富文本文档。 Builds a rich-text document with a DSL block.