UNPKG

@blocknote/core

Version:

A "Notion-style" block-based extensible text editor built on top of Prosemirror and Tiptap.

44 lines (43 loc) 1.06 kB
import { PluginKey as i, Plugin as l } from "prosemirror-state"; import { DecorationSet as n, Decoration as m } from "prosemirror-view"; import { c as p, a as d } from "./BlockNoteExtension-C2X7LW-V.js"; const r = new i("blocknote-show-selection"), f = p(({ editor: s }) => { const t = d( { enabled: !1 }, { onUpdate() { s.transact((e) => e.setMeta(r, {})); } } ); return { key: "showSelection", store: t, prosemirrorPlugins: [ new l({ key: r, props: { decorations: (e) => { const { doc: a, selection: o } = e; if (!t.state.enabled) return n.empty; const c = m.inline(o.from, o.to, { "data-show-selection": "true" }); return n.create(a, [c]); } } }) ], /** * Show or hide the selection decoration */ showSelection(e) { t.setState({ enabled: e }); } }; }); export { f as S }; //# sourceMappingURL=ShowSelection-Dz-NEase.js.map