feat(messaging-ui): message formatting + native spellcheck in the composer

Composer becomes a <textarea> so the PLATFORM supplies text services: red
spellcheck squiggles, right-click suggestions / add-to-dictionary, and mobile
autocorrect (spellCheck + autoCorrect + autoCapitalize). Nothing shipped for it.
Previously a single-line <input>, which Firefox does not spellcheck by default
(layout.spellcheckDefault=1 checks multi-line only) and which could not hold a
multi-line message at all. Enter sends, Shift+Enter (and IME composition) makes a
newline, and the box grows with content.

WhatsApp-style markup: *bold*, _italic_, ~strike~, `code`, ```fenced blocks```,
plus bare URLs. Cmd/Ctrl+B/I/E and a small toolbar wrap the selection in markers.
Messages stay PLAIN TEXT on the wire, so stored history and older clients are
unaffected — formatting is purely a render concern.

renderRichText() returns a ReactNode tree and never uses dangerouslySetInnerHTML,
so message text cannot inject markup; links are restricted to http/https/mailto
(safeHref) to close the javascript: vector. Code is tokenized first and its
contents stay literal; markers require word boundaries so snake_case_name and
"5 * 3" are not mangled.

Bumped to 0.1.9. SDK suite: 17 files / 95 tests green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-25 16:29:01 +05:30
parent 3d08fa42f8
commit c946f1e061
8 changed files with 430 additions and 9 deletions
+57
View File
@@ -515,6 +515,63 @@ button.miu-attach-dl:hover {
.miu-input:focus {
border-color: var(--miu-accent);
}
/* Chat box: one row by default, grows with content (JS sets height), then scrolls. */
.miu-textarea {
resize: none;
min-height: 38px;
max-height: 160px;
overflow-y: auto;
line-height: 1.45;
font-family: inherit;
}
.miu-format-bar {
display: flex;
gap: 2px;
padding: 0 2px 4px;
}
.miu-format-btn {
min-width: 26px;
height: 24px;
padding: 0 6px;
border: none;
border-radius: 6px;
background: transparent;
color: var(--miu-muted);
font-size: 12px;
font-weight: 700;
cursor: pointer;
}
.miu-format-btn:hover {
background: var(--miu-panel-2);
color: var(--miu-text);
}
/* ── Rendered message formatting ── */
.miu-code {
padding: 1px 5px;
border-radius: 5px;
background: var(--miu-panel-2);
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
font-size: 0.92em;
}
.miu-code-block {
margin: 6px 0 2px;
padding: 8px 10px;
border-radius: 8px;
background: var(--miu-panel-2);
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
font-size: 0.92em;
white-space: pre-wrap;
overflow-x: auto;
}
.miu-link {
color: var(--miu-accent);
text-decoration: underline;
}
.miu-msg.is-mine .miu-bubble .miu-link,
.miu-msg.is-mine .miu-bubble .miu-code {
color: var(--miu-accent-text);
}
.miu-send {
padding: 0 16px;
border-radius: 10px;