UNPKG

tiptap-extension-resize-image

Version:

A tiptap image resizing extension for React, Vue, Next, and VanillaJS. Additionally, it can align the image position.

27 lines 1.22 kB
/** * Shared `document` click dispatcher. * * Every editable ImageNodeView used to attach its own `click` listener to * `document` so it could detect clicks outside the image and dismiss the * resize UI. With many images on a page this scaled to N listeners and made * every click in the document fan out to N handlers. * * This module keeps a single `document` listener regardless of how many * NodeViews subscribe. Subscribers are dispatched in insertion order; one * subscriber throwing does not stop the rest. */ type ClickListener = (event: MouseEvent) => void; /** * Registers a callback that will be invoked for every `click` event on * `document`. Returns an idempotent `unsubscribe` function that the caller * MUST invoke (typically from a NodeView `destroy` hook) to avoid leaks. */ export declare function subscribeDocumentClick(listener: ClickListener): () => void; /** * Test-only helper. Clears all subscribers and detaches the underlying * `document` listener so that test cases do not leak state into one * another. Production code MUST NOT call this. */ export declare function __resetDocumentClickManagerForTests(): void; export {}; //# sourceMappingURL=document-click-manager.d.ts.map