# Tempel dan skema {#clipboard}

Source: [Pertahankan format saat menempel di editor React · Yurich](https://leeyujoo.com/yurich/id/features/clipboard/)

Package: [`yurich`](https://www.npmjs.com/package/yurich)

Package version: `0.1.2`

Pilih format yang dipertahankan saat menempel.

## Coba sendiri {#try-it}

Salin contoh di bawah, lalu tempel ke editor. Teks tebal dan tautan dipertahankan. Teks miring kehilangan formatnya.
<div class="clipboard-sample"><p data-clipboard-sample><strong>Teks tebal</strong> · <em>Teks miring</em> · <a href="https://example.com/">Tautan</a></p></div>

## Tambahkan ke editor {#setup}

Daftarkan ekstensi untuk format yang perlu dipertahankan. HTML yang ditempel mengikuti skema aktif.

```tsx
import { Bold, Code, EditorContent, EditorProvider, Heading, Link, useEditor } from 'yurich';

export function ClipboardEditor() {
  const editor = useEditor({ extensions: [Bold, Code, Heading, Link] });

  return (
    <EditorProvider editor={editor}>
      <EditorContent ariaLabel="Tempel teks berformat di sini" />
    </EditorProvider>
  );
}
```

## Perilaku yang perlu diperhatikan {#behavior}

`Heading`, `Code`, dan `Link` aktif. Salin dari judul bagian ini sampai tautan fitur di bawah, lalu tempel untuk mempertahankan ketiga format tersebut. Teks polos tidak diproses sebagai HTML, dan peletakan melalui seret-lepas dinonaktifkan. Tambahkan `Italic` untuk mempertahankan miring.

[Fitur](https://leeyujoo.com/yurich/id/features/)
