docs/plans/2026-04-06-slate-v2-multiline-plain-text-paste-fast-path.md
Supporting plan. For current queue and roadmap truth, see master-roadmap.md.
Replace the current multiline plain-text clipboard fallback path so it no longer
routes through generic insert_fragment machinery.
The intent is not to invent a new clipboard abstraction.
The intent is to give slate-v2 a real multiline plain-text insertion seam
that matches the engine direction in
Part I. Engine North Star.
The best long-term choice is:
slate-v2slate-dom-v2slate-v2insert_text semantics narrowDo not keep disguising multiline plain text as a block fragment.
slate-dom-v2 reads clipboard dataslate-v2 owns multiline plain-text insertion semanticsasText clipboard branch in
clipboard.tsinsert_text with multiline/range-replacement meaning
before that broader API is actually earned.insert_fragmentinsert_text For Multiline Plain Textinsert_text is point-scoped and narrowThe strongest argument against this plan:
That means the dedicated intent could be the right model and still fail to move the benchmark enough.
The plan must therefore require explicit benchmark proof, not just API purity.
Land the new seam as internal-first.
That means:
slate-v2slate-dom-v2slate-v2.slate-dom-v2 plain-text clipboard fallback through the new path.slate-browser changesinsert_fragment.slate-v2 clipboard contract tests stay green.pasteMs at the frozen 1000-block, 5-iteration
lane without making readyMs, typeMs, or selectAllMs regress beyond
noise.
Concrete bar:
pasteMs mean improves by at least 15% versus the current v2 baseline,
or by at least 10msreadyMs, typeMs, and selectAllMs do not regress by more than 10%
eachinsert_fragment.yarn bench:phase6:huge-document:localinsert_fragmentProof required for:
Direct work allowed for:
Use legacy Slate, ProseMirror, and Lexical only as shape references:
asText clipboard path is saneDo not copy:
slate-v2 clipboard contract only if the new intent becomes
visible at the contract layeryarn bench:phase6:huge-document:localIf the dedicated intent still fails to move the paste benchmark materially, the next seam is not “more intent modeling”.
It is snapshot publication / index rebuild after large multiline inserts.
That should be treated as a new decision, not silently folded into this one.
Do not keep iterating on the new intent just because it is architecturally clean. If semantics stay green and routing is proven but the benchmark bar is still missed, stop and reframe the seam.