← Zurück zu Entwickler interner Systeme
Entdecke, wie der Skill hilft
Sichere Zwischenablage
Überführt eingefügte Inhalte in unterstützte Editorstrukturen unter Ausschluss aktiven HTMLs und mit eigenen Blockkennungen.
clipboard-content-sanitization
Teammitglieder mit diesem Skill
Wann ist der Skill hilfreich?
Nutze dies, wenn dein Texteditor Webinhalte oder kopierte interne Blöcke übernimmt.
Wobei hilft er dir?
- Erlaubt nur unterstützte Strukturen, sichere Attribute und freigegebene URL-Schemata.
- Vereinheitlicht fremde Formatierung und erhält Absätze, Listen und Tabellen.
- Erzeugt neue Blockkennungen und unterstützt Klartext ohne Ausführung aktiven HTMLs.
Das könntest du fragen
Füge Word-Inhalt und einen unsicheren Link ein; erhalte die Struktur und weise aktiven Inhalt zurück. Die eingefügte Tabelle behält ihre Zellen; Skripte und unsichere URL-Schemata verschwinden. Speichern und Wiederöffnen müssen die bereinigte Dokumentstruktur erhalten.
Ausführliche Dokumentation
Hier findest du die ursprüngliche Anleitung, Beispiele und Prüfschritte des Skills in ihrer Originalsprache.
Weniger anzeigen
Clipboard & Content Sanitization
Use this skill when implementing copy, cut, paste, or external content ingestion in visual and block editors.
Security First: Strict Allowlist Sanitization
- Never Insert Unsanitized HTML or Active Content:
- External clipboard data (
text/html,text/uri-list) is untrusted user input. - Parse pasted HTML in an inert context (
DOMParseror a strict sanitizer such as DOMPurify) and map it through an explicit schema allowlist before constructing editor nodes:- Strip all active/executable elements:
<script>,<iframe>,<object>,<embed>,<svg onload>,<form>,<style>,<meta>,<link>. - Strip all inline event handlers and dangerous attributes:
onerror,onload,onclick,styleexpressions that break editor layout (position: fixed/absolute, negative margins, z-index hijacking). - Validate URLs: Only allow safe URL schemes (
https:,http:,mailto:,tel:, or approved relative paths) on links and media; rejectjavascript:,vbscript:, and untrusteddata:text/htmlURIs.
- Strip all active/executable elements:
- External clipboard data (
Multi-Format Paste Resolution Pipeline
Inspect clipboardData in priority order and transform into valid schema transactions:
- Internal Editor Slice (
application/x-editor-sliceor custom data attribute):- Preserve full block fidelity when copying and pasting within the editor.
- Always regenerate block/node IDs on paste and remap internal links within the pasted slice so pasting never creates duplicate IDs in the document.
- External Rich HTML (
text/htmlfrom web pages, Word, Google Docs, Notion):- Normalize foreign wrapper noise (
<meta>,MsoNormal,<b style="font-weight:normal">, inline font families) into semantic editor blocks and marks (headings, lists, tables, bold, italic, links).
- Normalize foreign wrapper noise (
- Plain Text (
text/plain):- Support plain-text paste (
Cmd/Ctrl + Shift + V) and fallback whentext/htmlis absent. - Convert paragraph breaks into blocks or preserve line breaks inside code blocks, and optionally parse safe URLs or Markdown patterns when appropriate.
- Support plain-text paste (
- Pasted / Dropped Files & Images (
clipboardData.files):- Route pasted images/files through the project's validated upload pipeline (showing an upload placeholder/progress state and replacing with the permanent asset reference on completion, rather than persisting multi-megabyte base64
data:URLs directly inside the document JSON).
- Route pasted images/files through the project's validated upload pipeline (showing an upload placeholder/progress state and replacing with the permanent asset reference on completion, rather than persisting multi-megabyte base64
Checklist
- Is all pasted HTML parsed inertly and filtered through a strict schema allowlist (blocking
<script>,javascript:URLs, event handlers, and layout-breaking inline styles)? - Does copying and pasting blocks within the editor mint fresh unique IDs for all pasted nodes?
- Does plain-text paste (
Cmd/Ctrl+Shift+V) work cleanly across single-line and multi-paragraph selections? - Are pasted images/files uploaded through the storage pipeline instead of bloating the document with raw base64 strings?
Enthaltene Dateien 1
SKILL.md
