1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003 |
- import { Slice, Fragment, Mark, Node } from 'prosemirror-model';
- import { ReplaceStep, ReplaceAroundStep, Transform } from 'prosemirror-transform';
- const classesById = Object.create(null);
- class Selection {
-
- constructor(
- /**
- The resolved anchor of the selection (the side that stays in
- place when the selection is modified).
- */
- $anchor,
- /**
- The resolved head of the selection (the side that moves when
- the selection is modified).
- */
- $head, ranges) {
- this.$anchor = $anchor;
- this.$head = $head;
- this.ranges = ranges || [new SelectionRange($anchor.min($head), $anchor.max($head))];
- }
-
- get anchor() { return this.$anchor.pos; }
-
- get head() { return this.$head.pos; }
-
- get from() { return this.$from.pos; }
-
- get to() { return this.$to.pos; }
-
- get $from() {
- return this.ranges[0].$from;
- }
-
- get $to() {
- return this.ranges[0].$to;
- }
-
- get empty() {
- let ranges = this.ranges;
- for (let i = 0; i < ranges.length; i++)
- if (ranges[i].$from.pos != ranges[i].$to.pos)
- return false;
- return true;
- }
-
- content() {
- return this.$from.doc.slice(this.from, this.to, true);
- }
-
- replace(tr, content = Slice.empty) {
-
-
-
- let lastNode = content.content.lastChild, lastParent = null;
- for (let i = 0; i < content.openEnd; i++) {
- lastParent = lastNode;
- lastNode = lastNode.lastChild;
- }
- let mapFrom = tr.steps.length, ranges = this.ranges;
- for (let i = 0; i < ranges.length; i++) {
- let { $from, $to } = ranges[i], mapping = tr.mapping.slice(mapFrom);
- tr.replaceRange(mapping.map($from.pos), mapping.map($to.pos), i ? Slice.empty : content);
- if (i == 0)
- selectionToInsertionEnd(tr, mapFrom, (lastNode ? lastNode.isInline : lastParent && lastParent.isTextblock) ? -1 : 1);
- }
- }
-
- replaceWith(tr, node) {
- let mapFrom = tr.steps.length, ranges = this.ranges;
- for (let i = 0; i < ranges.length; i++) {
- let { $from, $to } = ranges[i], mapping = tr.mapping.slice(mapFrom);
- let from = mapping.map($from.pos), to = mapping.map($to.pos);
- if (i) {
- tr.deleteRange(from, to);
- }
- else {
- tr.replaceRangeWith(from, to, node);
- selectionToInsertionEnd(tr, mapFrom, node.isInline ? -1 : 1);
- }
- }
- }
-
- static findFrom($pos, dir, textOnly = false) {
- let inner = $pos.parent.inlineContent ? new TextSelection($pos)
- : findSelectionIn($pos.node(0), $pos.parent, $pos.pos, $pos.index(), dir, textOnly);
- if (inner)
- return inner;
- for (let depth = $pos.depth - 1; depth >= 0; depth--) {
- let found = dir < 0
- ? findSelectionIn($pos.node(0), $pos.node(depth), $pos.before(depth + 1), $pos.index(depth), dir, textOnly)
- : findSelectionIn($pos.node(0), $pos.node(depth), $pos.after(depth + 1), $pos.index(depth) + 1, dir, textOnly);
- if (found)
- return found;
- }
- return null;
- }
-
- static near($pos, bias = 1) {
- return this.findFrom($pos, bias) || this.findFrom($pos, -bias) || new AllSelection($pos.node(0));
- }
-
- static atStart(doc) {
- return findSelectionIn(doc, doc, 0, 0, 1) || new AllSelection(doc);
- }
-
- static atEnd(doc) {
- return findSelectionIn(doc, doc, doc.content.size, doc.childCount, -1) || new AllSelection(doc);
- }
-
- static fromJSON(doc, json) {
- if (!json || !json.type)
- throw new RangeError("Invalid input for Selection.fromJSON");
- let cls = classesById[json.type];
- if (!cls)
- throw new RangeError(`No selection type ${json.type} defined`);
- return cls.fromJSON(doc, json);
- }
-
- static jsonID(id, selectionClass) {
- if (id in classesById)
- throw new RangeError("Duplicate use of selection JSON ID " + id);
- classesById[id] = selectionClass;
- selectionClass.prototype.jsonID = id;
- return selectionClass;
- }
-
- getBookmark() {
- return TextSelection.between(this.$anchor, this.$head).getBookmark();
- }
- }
- Selection.prototype.visible = true;
- class SelectionRange {
-
- constructor(
- /**
- The lower bound of the range.
- */
- $from,
- /**
- The upper bound of the range.
- */
- $to) {
- this.$from = $from;
- this.$to = $to;
- }
- }
- let warnedAboutTextSelection = false;
- function checkTextSelection($pos) {
- if (!warnedAboutTextSelection && !$pos.parent.inlineContent) {
- warnedAboutTextSelection = true;
- console["warn"]("TextSelection endpoint not pointing into a node with inline content (" + $pos.parent.type.name + ")");
- }
- }
- class TextSelection extends Selection {
-
- constructor($anchor, $head = $anchor) {
- checkTextSelection($anchor);
- checkTextSelection($head);
- super($anchor, $head);
- }
-
- get $cursor() { return this.$anchor.pos == this.$head.pos ? this.$head : null; }
- map(doc, mapping) {
- let $head = doc.resolve(mapping.map(this.head));
- if (!$head.parent.inlineContent)
- return Selection.near($head);
- let $anchor = doc.resolve(mapping.map(this.anchor));
- return new TextSelection($anchor.parent.inlineContent ? $anchor : $head, $head);
- }
- replace(tr, content = Slice.empty) {
- super.replace(tr, content);
- if (content == Slice.empty) {
- let marks = this.$from.marksAcross(this.$to);
- if (marks)
- tr.ensureMarks(marks);
- }
- }
- eq(other) {
- return other instanceof TextSelection && other.anchor == this.anchor && other.head == this.head;
- }
- getBookmark() {
- return new TextBookmark(this.anchor, this.head);
- }
- toJSON() {
- return { type: "text", anchor: this.anchor, head: this.head };
- }
-
- static fromJSON(doc, json) {
- if (typeof json.anchor != "number" || typeof json.head != "number")
- throw new RangeError("Invalid input for TextSelection.fromJSON");
- return new TextSelection(doc.resolve(json.anchor), doc.resolve(json.head));
- }
-
- static create(doc, anchor, head = anchor) {
- let $anchor = doc.resolve(anchor);
- return new this($anchor, head == anchor ? $anchor : doc.resolve(head));
- }
-
- static between($anchor, $head, bias) {
- let dPos = $anchor.pos - $head.pos;
- if (!bias || dPos)
- bias = dPos >= 0 ? 1 : -1;
- if (!$head.parent.inlineContent) {
- let found = Selection.findFrom($head, bias, true) || Selection.findFrom($head, -bias, true);
- if (found)
- $head = found.$head;
- else
- return Selection.near($head, bias);
- }
- if (!$anchor.parent.inlineContent) {
- if (dPos == 0) {
- $anchor = $head;
- }
- else {
- $anchor = (Selection.findFrom($anchor, -bias, true) || Selection.findFrom($anchor, bias, true)).$anchor;
- if (($anchor.pos < $head.pos) != (dPos < 0))
- $anchor = $head;
- }
- }
- return new TextSelection($anchor, $head);
- }
- }
- Selection.jsonID("text", TextSelection);
- class TextBookmark {
- constructor(anchor, head) {
- this.anchor = anchor;
- this.head = head;
- }
- map(mapping) {
- return new TextBookmark(mapping.map(this.anchor), mapping.map(this.head));
- }
- resolve(doc) {
- return TextSelection.between(doc.resolve(this.anchor), doc.resolve(this.head));
- }
- }
- class NodeSelection extends Selection {
-
- constructor($pos) {
- let node = $pos.nodeAfter;
- let $end = $pos.node(0).resolve($pos.pos + node.nodeSize);
- super($pos, $end);
- this.node = node;
- }
- map(doc, mapping) {
- let { deleted, pos } = mapping.mapResult(this.anchor);
- let $pos = doc.resolve(pos);
- if (deleted)
- return Selection.near($pos);
- return new NodeSelection($pos);
- }
- content() {
- return new Slice(Fragment.from(this.node), 0, 0);
- }
- eq(other) {
- return other instanceof NodeSelection && other.anchor == this.anchor;
- }
- toJSON() {
- return { type: "node", anchor: this.anchor };
- }
- getBookmark() { return new NodeBookmark(this.anchor); }
-
- static fromJSON(doc, json) {
- if (typeof json.anchor != "number")
- throw new RangeError("Invalid input for NodeSelection.fromJSON");
- return new NodeSelection(doc.resolve(json.anchor));
- }
-
- static create(doc, from) {
- return new NodeSelection(doc.resolve(from));
- }
-
- static isSelectable(node) {
- return !node.isText && node.type.spec.selectable !== false;
- }
- }
- NodeSelection.prototype.visible = false;
- Selection.jsonID("node", NodeSelection);
- class NodeBookmark {
- constructor(anchor) {
- this.anchor = anchor;
- }
- map(mapping) {
- let { deleted, pos } = mapping.mapResult(this.anchor);
- return deleted ? new TextBookmark(pos, pos) : new NodeBookmark(pos);
- }
- resolve(doc) {
- let $pos = doc.resolve(this.anchor), node = $pos.nodeAfter;
- if (node && NodeSelection.isSelectable(node))
- return new NodeSelection($pos);
- return Selection.near($pos);
- }
- }
- class AllSelection extends Selection {
-
- constructor(doc) {
- super(doc.resolve(0), doc.resolve(doc.content.size));
- }
- replace(tr, content = Slice.empty) {
- if (content == Slice.empty) {
- tr.delete(0, tr.doc.content.size);
- let sel = Selection.atStart(tr.doc);
- if (!sel.eq(tr.selection))
- tr.setSelection(sel);
- }
- else {
- super.replace(tr, content);
- }
- }
- toJSON() { return { type: "all" }; }
-
- static fromJSON(doc) { return new AllSelection(doc); }
- map(doc) { return new AllSelection(doc); }
- eq(other) { return other instanceof AllSelection; }
- getBookmark() { return AllBookmark; }
- }
- Selection.jsonID("all", AllSelection);
- const AllBookmark = {
- map() { return this; },
- resolve(doc) { return new AllSelection(doc); }
- };
- function findSelectionIn(doc, node, pos, index, dir, text = false) {
- if (node.inlineContent)
- return TextSelection.create(doc, pos);
- for (let i = index - (dir > 0 ? 0 : 1); dir > 0 ? i < node.childCount : i >= 0; i += dir) {
- let child = node.child(i);
- if (!child.isAtom) {
- let inner = findSelectionIn(doc, child, pos + dir, dir < 0 ? child.childCount : 0, dir, text);
- if (inner)
- return inner;
- }
- else if (!text && NodeSelection.isSelectable(child)) {
- return NodeSelection.create(doc, pos - (dir < 0 ? child.nodeSize : 0));
- }
- pos += child.nodeSize * dir;
- }
- return null;
- }
- function selectionToInsertionEnd(tr, startLen, bias) {
- let last = tr.steps.length - 1;
- if (last < startLen)
- return;
- let step = tr.steps[last];
- if (!(step instanceof ReplaceStep || step instanceof ReplaceAroundStep))
- return;
- let map = tr.mapping.maps[last], end;
- map.forEach((_from, _to, _newFrom, newTo) => { if (end == null)
- end = newTo; });
- tr.setSelection(Selection.near(tr.doc.resolve(end), bias));
- }
- const UPDATED_SEL = 1, UPDATED_MARKS = 2, UPDATED_SCROLL = 4;
- class Transaction extends Transform {
-
- constructor(state) {
- super(state.doc);
-
- this.curSelectionFor = 0;
-
-
- this.updated = 0;
-
- this.meta = Object.create(null);
- this.time = Date.now();
- this.curSelection = state.selection;
- this.storedMarks = state.storedMarks;
- }
-
- get selection() {
- if (this.curSelectionFor < this.steps.length) {
- this.curSelection = this.curSelection.map(this.doc, this.mapping.slice(this.curSelectionFor));
- this.curSelectionFor = this.steps.length;
- }
- return this.curSelection;
- }
-
- setSelection(selection) {
- if (selection.$from.doc != this.doc)
- throw new RangeError("Selection passed to setSelection must point at the current document");
- this.curSelection = selection;
- this.curSelectionFor = this.steps.length;
- this.updated = (this.updated | UPDATED_SEL) & ~UPDATED_MARKS;
- this.storedMarks = null;
- return this;
- }
-
- get selectionSet() {
- return (this.updated & UPDATED_SEL) > 0;
- }
-
- setStoredMarks(marks) {
- this.storedMarks = marks;
- this.updated |= UPDATED_MARKS;
- return this;
- }
-
- ensureMarks(marks) {
- if (!Mark.sameSet(this.storedMarks || this.selection.$from.marks(), marks))
- this.setStoredMarks(marks);
- return this;
- }
-
- addStoredMark(mark) {
- return this.ensureMarks(mark.addToSet(this.storedMarks || this.selection.$head.marks()));
- }
-
- removeStoredMark(mark) {
- return this.ensureMarks(mark.removeFromSet(this.storedMarks || this.selection.$head.marks()));
- }
-
- get storedMarksSet() {
- return (this.updated & UPDATED_MARKS) > 0;
- }
-
- addStep(step, doc) {
- super.addStep(step, doc);
- this.updated = this.updated & ~UPDATED_MARKS;
- this.storedMarks = null;
- }
-
- setTime(time) {
- this.time = time;
- return this;
- }
-
- replaceSelection(slice) {
- this.selection.replace(this, slice);
- return this;
- }
-
- replaceSelectionWith(node, inheritMarks = true) {
- let selection = this.selection;
- if (inheritMarks)
- node = node.mark(this.storedMarks || (selection.empty ? selection.$from.marks() : (selection.$from.marksAcross(selection.$to) || Mark.none)));
- selection.replaceWith(this, node);
- return this;
- }
-
- deleteSelection() {
- this.selection.replace(this);
- return this;
- }
-
- insertText(text, from, to) {
- let schema = this.doc.type.schema;
- if (from == null) {
- if (!text)
- return this.deleteSelection();
- return this.replaceSelectionWith(schema.text(text), true);
- }
- else {
- if (to == null)
- to = from;
- to = to == null ? from : to;
- if (!text)
- return this.deleteRange(from, to);
- let marks = this.storedMarks;
- if (!marks) {
- let $from = this.doc.resolve(from);
- marks = to == from ? $from.marks() : $from.marksAcross(this.doc.resolve(to));
- }
- this.replaceRangeWith(from, to, schema.text(text, marks));
- if (!this.selection.empty)
- this.setSelection(Selection.near(this.selection.$to));
- return this;
- }
- }
-
- setMeta(key, value) {
- this.meta[typeof key == "string" ? key : key.key] = value;
- return this;
- }
-
- getMeta(key) {
- return this.meta[typeof key == "string" ? key : key.key];
- }
-
- get isGeneric() {
- for (let _ in this.meta)
- return false;
- return true;
- }
-
- scrollIntoView() {
- this.updated |= UPDATED_SCROLL;
- return this;
- }
-
- get scrolledIntoView() {
- return (this.updated & UPDATED_SCROLL) > 0;
- }
- }
- function bind(f, self) {
- return !self || !f ? f : f.bind(self);
- }
- class FieldDesc {
- constructor(name, desc, self) {
- this.name = name;
- this.init = bind(desc.init, self);
- this.apply = bind(desc.apply, self);
- }
- }
- const baseFields = [
- new FieldDesc("doc", {
- init(config) { return config.doc || config.schema.topNodeType.createAndFill(); },
- apply(tr) { return tr.doc; }
- }),
- new FieldDesc("selection", {
- init(config, instance) { return config.selection || Selection.atStart(instance.doc); },
- apply(tr) { return tr.selection; }
- }),
- new FieldDesc("storedMarks", {
- init(config) { return config.storedMarks || null; },
- apply(tr, _marks, _old, state) { return state.selection.$cursor ? tr.storedMarks : null; }
- }),
- new FieldDesc("scrollToSelection", {
- init() { return 0; },
- apply(tr, prev) { return tr.scrolledIntoView ? prev + 1 : prev; }
- })
- ];
- class Configuration {
- constructor(schema, plugins) {
- this.schema = schema;
- this.plugins = [];
- this.pluginsByKey = Object.create(null);
- this.fields = baseFields.slice();
- if (plugins)
- plugins.forEach(plugin => {
- if (this.pluginsByKey[plugin.key])
- throw new RangeError("Adding different instances of a keyed plugin (" + plugin.key + ")");
- this.plugins.push(plugin);
- this.pluginsByKey[plugin.key] = plugin;
- if (plugin.spec.state)
- this.fields.push(new FieldDesc(plugin.key, plugin.spec.state, plugin));
- });
- }
- }
- class EditorState {
-
- constructor(
- /**
- @internal
- */
- config) {
- this.config = config;
- }
-
- get schema() {
- return this.config.schema;
- }
-
- get plugins() {
- return this.config.plugins;
- }
-
- apply(tr) {
- return this.applyTransaction(tr).state;
- }
-
- filterTransaction(tr, ignore = -1) {
- for (let i = 0; i < this.config.plugins.length; i++)
- if (i != ignore) {
- let plugin = this.config.plugins[i];
- if (plugin.spec.filterTransaction && !plugin.spec.filterTransaction.call(plugin, tr, this))
- return false;
- }
- return true;
- }
-
- applyTransaction(rootTr) {
- if (!this.filterTransaction(rootTr))
- return { state: this, transactions: [] };
- let trs = [rootTr], newState = this.applyInner(rootTr), seen = null;
-
-
-
- for (;;) {
- let haveNew = false;
- for (let i = 0; i < this.config.plugins.length; i++) {
- let plugin = this.config.plugins[i];
- if (plugin.spec.appendTransaction) {
- let n = seen ? seen[i].n : 0, oldState = seen ? seen[i].state : this;
- let tr = n < trs.length &&
- plugin.spec.appendTransaction.call(plugin, n ? trs.slice(n) : trs, oldState, newState);
- if (tr && newState.filterTransaction(tr, i)) {
- tr.setMeta("appendedTransaction", rootTr);
- if (!seen) {
- seen = [];
- for (let j = 0; j < this.config.plugins.length; j++)
- seen.push(j < i ? { state: newState, n: trs.length } : { state: this, n: 0 });
- }
- trs.push(tr);
- newState = newState.applyInner(tr);
- haveNew = true;
- }
- if (seen)
- seen[i] = { state: newState, n: trs.length };
- }
- }
- if (!haveNew)
- return { state: newState, transactions: trs };
- }
- }
-
- applyInner(tr) {
- if (!tr.before.eq(this.doc))
- throw new RangeError("Applying a mismatched transaction");
- let newInstance = new EditorState(this.config), fields = this.config.fields;
- for (let i = 0; i < fields.length; i++) {
- let field = fields[i];
- newInstance[field.name] = field.apply(tr, this[field.name], this, newInstance);
- }
- return newInstance;
- }
-
- get tr() { return new Transaction(this); }
-
- static create(config) {
- let $config = new Configuration(config.doc ? config.doc.type.schema : config.schema, config.plugins);
- let instance = new EditorState($config);
- for (let i = 0; i < $config.fields.length; i++)
- instance[$config.fields[i].name] = $config.fields[i].init(config, instance);
- return instance;
- }
-
- reconfigure(config) {
- let $config = new Configuration(this.schema, config.plugins);
- let fields = $config.fields, instance = new EditorState($config);
- for (let i = 0; i < fields.length; i++) {
- let name = fields[i].name;
- instance[name] = this.hasOwnProperty(name) ? this[name] : fields[i].init(config, instance);
- }
- return instance;
- }
-
- toJSON(pluginFields) {
- let result = { doc: this.doc.toJSON(), selection: this.selection.toJSON() };
- if (this.storedMarks)
- result.storedMarks = this.storedMarks.map(m => m.toJSON());
- if (pluginFields && typeof pluginFields == 'object')
- for (let prop in pluginFields) {
- if (prop == "doc" || prop == "selection")
- throw new RangeError("The JSON fields `doc` and `selection` are reserved");
- let plugin = pluginFields[prop], state = plugin.spec.state;
- if (state && state.toJSON)
- result[prop] = state.toJSON.call(plugin, this[plugin.key]);
- }
- return result;
- }
-
- static fromJSON(config, json, pluginFields) {
- if (!json)
- throw new RangeError("Invalid input for EditorState.fromJSON");
- if (!config.schema)
- throw new RangeError("Required config field 'schema' missing");
- let $config = new Configuration(config.schema, config.plugins);
- let instance = new EditorState($config);
- $config.fields.forEach(field => {
- if (field.name == "doc") {
- instance.doc = Node.fromJSON(config.schema, json.doc);
- }
- else if (field.name == "selection") {
- instance.selection = Selection.fromJSON(instance.doc, json.selection);
- }
- else if (field.name == "storedMarks") {
- if (json.storedMarks)
- instance.storedMarks = json.storedMarks.map(config.schema.markFromJSON);
- }
- else {
- if (pluginFields)
- for (let prop in pluginFields) {
- let plugin = pluginFields[prop], state = plugin.spec.state;
- if (plugin.key == field.name && state && state.fromJSON &&
- Object.prototype.hasOwnProperty.call(json, prop)) {
- instance[field.name] = state.fromJSON.call(plugin, config, json[prop], instance);
- return;
- }
- }
- instance[field.name] = field.init(config, instance);
- }
- });
- return instance;
- }
- }
- function bindProps(obj, self, target) {
- for (let prop in obj) {
- let val = obj[prop];
- if (val instanceof Function)
- val = val.bind(self);
- else if (prop == "handleDOMEvents")
- val = bindProps(val, self, {});
- target[prop] = val;
- }
- return target;
- }
- class Plugin {
-
- constructor(
- /**
- The plugin's [spec object](https://prosemirror.net/docs/ref/#state.PluginSpec).
- */
- spec) {
- this.spec = spec;
-
- this.props = {};
- if (spec.props)
- bindProps(spec.props, this, this.props);
- this.key = spec.key ? spec.key.key : createKey("plugin");
- }
-
- getState(state) { return state[this.key]; }
- }
- const keys = Object.create(null);
- function createKey(name) {
- if (name in keys)
- return name + "$" + ++keys[name];
- keys[name] = 0;
- return name + "$";
- }
- class PluginKey {
-
- constructor(name = "key") { this.key = createKey(name); }
-
- get(state) { return state.config.pluginsByKey[this.key]; }
-
- getState(state) { return state[this.key]; }
- }
- export { AllSelection, EditorState, NodeSelection, Plugin, PluginKey, Selection, SelectionRange, TextSelection, Transaction };
|