InMemoryClipboard
An in-memory clipboard installed by Lib.useInMemoryClipboard.
It replaces the clipboard of one window until InMemoryClipboard.restore runs. [Symbol.dispose] does the same. It is set only where the renderer has Symbol.dispose (Chromium 134 and later, so Electron 35 and later), and a bundler that lowers using puts its helper outside the serialized callback, so prefer try/finally inside an evalInObsidian callback.
Import:
import type { InMemoryClipboard } from 'obsidian-integration-testing';Signature:
export interface InMemoryClipboard extends DisposableExtends: Disposable
Properties
| Property | Type | Description |
|---|---|---|
| html | string | The HTML the clipboard holds now: the seed, or the last HTML written. Writing plain text alone clears it, as a real clipboard does. |
| isElectronClipboardReplaced | boolean | Whether Electron's clipboard module was replaced too. It is false where the window has no require (mobile), or where the module's methods could not be overwritten. |
| restore | (this: void) => void | Puts the window's own clipboard back. Calling it again does nothing. |
| text | string | The text the clipboard holds now: the seed, or the last text written. |
| writtenTexts | readonly string[] | Every text written while the clipboard was installed, oldest first. A write through navigator.clipboard.write counts when its item carries text/plain. |
Links to this page: