Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

prosemirror-suggest

Package Overview
Dependencies
Maintainers
1
Versions
273
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prosemirror-suggest - npm Package Compare versions

Comparing version 1.0.0-next.33 to 1.0.0-next.34

10

CHANGELOG.md
# prosemirror-suggest
## 1.0.0-next.34
> 2020-09-10
### Patch Changes
- Updated dependencies [[`27b358e4`](https://github.com/remirror/remirror/commit/27b358e4cb877a1e8df61c9d5326f366e66f30dc), [`5945dffe`](https://github.com/remirror/remirror/commit/5945dffeadac8ae568be1ab0014e1186e03d5fb0)]:
- @remirror/core-constants@1.0.0-next.34
- @remirror/core-helpers@1.0.0-next.34
## 1.0.0-next.33

@@ -4,0 +14,0 @@

128

dist/prosemirror-suggest.browser.cjs.js

@@ -5,13 +5,18 @@ 'use strict';

function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
var prosemirrorState = require('prosemirror-state');
var _defineProperty = _interopDefault(require('@babel/runtime/helpers/defineProperty'));
var _classPrivateFieldSet = _interopDefault(require('@babel/runtime/helpers/classPrivateFieldSet'));
var _classPrivateFieldGet = _interopDefault(require('@babel/runtime/helpers/classPrivateFieldGet'));
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
var _classPrivateFieldSet = require('@babel/runtime/helpers/classPrivateFieldSet');
var _classPrivateFieldGet = require('@babel/runtime/helpers/classPrivateFieldGet');
var prosemirrorView = require('prosemirror-view');
var coreHelpers = require('@remirror/core-helpers');
var escapeStringRegex = _interopDefault(require('escape-string-regexp'));
var escapeStringRegex = require('escape-string-regexp');
var coreConstants = require('@remirror/core-constants');
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
var _defineProperty__default = /*#__PURE__*/_interopDefault(_defineProperty);
var _classPrivateFieldSet__default = /*#__PURE__*/_interopDefault(_classPrivateFieldSet);
var _classPrivateFieldGet__default = /*#__PURE__*/_interopDefault(_classPrivateFieldGet);
var escapeStringRegex__default = /*#__PURE__*/_interopDefault(escapeStringRegex);
/**

@@ -187,3 +192,3 @@ * This [[`Suggester`]] interface defines all the options required to create a

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }

@@ -758,3 +763,3 @@ /**

function getCharAsRegex(char) {
return coreHelpers.isString(char) ? new RegExp(escapeStringRegex(char)) : char;
return coreHelpers.isString(char) ? new RegExp(escapeStringRegex__default['default'](char)) : char;
}

@@ -823,3 +828,3 @@

function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$1(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$1(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
/**

@@ -861,3 +866,3 @@ * The `prosemirror-suggest` state which manages the list of suggesters.

get decorationSet() {
return _classPrivateFieldGet(this, _ignored);
return _classPrivateFieldGet__default['default'](this, _ignored);
}

@@ -877,3 +882,3 @@ /**

get removed() {
return _classPrivateFieldGet(this, _removed);
return _classPrivateFieldGet__default['default'](this, _removed);
}

@@ -886,3 +891,3 @@ /**

get match() {
return _classPrivateFieldGet(this, _next) ? _classPrivateFieldGet(this, _next) : _classPrivateFieldGet(this, _prev) && _classPrivateFieldGet(this, _handlerMatches).exit ? _classPrivateFieldGet(this, _prev) : undefined;
return _classPrivateFieldGet__default['default'](this, _next) ? _classPrivateFieldGet__default['default'](this, _next) : _classPrivateFieldGet__default['default'](this, _prev) && _classPrivateFieldGet__default['default'](this, _handlerMatches).exit ? _classPrivateFieldGet__default['default'](this, _prev) : undefined;
}

@@ -945,11 +950,11 @@ /**

_defineProperty(this, "setMarkRemoved", () => {
_classPrivateFieldSet(this, _removed, true);
_defineProperty__default['default'](this, "setMarkRemoved", () => {
_classPrivateFieldSet__default['default'](this, _removed, true);
});
_defineProperty(this, "ignoreNextExit", () => {
_classPrivateFieldSet(this, _ignoreNextExit, true);
_defineProperty__default['default'](this, "ignoreNextExit", () => {
_classPrivateFieldSet__default['default'](this, _ignoreNextExit, true);
});
_defineProperty(this, "addIgnored", (_ref) => {
_defineProperty__default['default'](this, "addIgnored", (_ref) => {
var from = _ref.from,

@@ -960,3 +965,3 @@ name = _ref.name,

var suggester = _classPrivateFieldGet(this, _suggesters).find(value => value.name === name);
var suggester = _classPrivateFieldGet__default['default'](this, _suggesters).find(value => value.name === name);

@@ -980,10 +985,10 @@ if (!suggester) {

_classPrivateFieldSet(this, _ignored, _classPrivateFieldGet(this, _ignored).add(this.view.state.doc, [decoration]));
_classPrivateFieldSet__default['default'](this, _ignored, _classPrivateFieldGet__default['default'](this, _ignored).add(this.view.state.doc, [decoration]));
});
_defineProperty(this, "removeIgnored", (_ref2) => {
_defineProperty__default['default'](this, "removeIgnored", (_ref2) => {
var from = _ref2.from,
name = _ref2.name;
var suggester = _classPrivateFieldGet(this, _suggesters).find(value => value.name === name);
var suggester = _classPrivateFieldGet__default['default'](this, _suggesters).find(value => value.name === name);

@@ -996,3 +1001,3 @@ if (!suggester) {

var decoration = _classPrivateFieldGet(this, _ignored).find(from, from + offset)[0];
var decoration = _classPrivateFieldGet__default['default'](this, _ignored).find(from, from + offset)[0];

@@ -1003,8 +1008,8 @@ if (!coreHelpers.bool(decoration) || decoration.spec.name !== name) {

_classPrivateFieldSet(this, _ignored, _classPrivateFieldGet(this, _ignored).remove([decoration]));
_classPrivateFieldSet__default['default'](this, _ignored, _classPrivateFieldGet__default['default'](this, _ignored).remove([decoration]));
});
_defineProperty(this, "clearIgnored", name => {
_defineProperty__default['default'](this, "clearIgnored", name => {
if (!name) {
_classPrivateFieldSet(this, _ignored, prosemirrorView.DecorationSet.empty);
_classPrivateFieldSet__default['default'](this, _ignored, prosemirrorView.DecorationSet.empty);

@@ -1014,3 +1019,3 @@ return;

var decorations = _classPrivateFieldGet(this, _ignored).find();
var decorations = _classPrivateFieldGet__default['default'](this, _ignored).find();

@@ -1022,3 +1027,3 @@ var decorationsToClear = decorations.filter((_ref3) => {

_classPrivateFieldSet(this, _ignored, _classPrivateFieldGet(this, _ignored).remove(decorationsToClear));
_classPrivateFieldSet__default['default'](this, _ignored, _classPrivateFieldGet__default['default'](this, _ignored).remove(decorationsToClear));
});

@@ -1028,5 +1033,5 @@

_classPrivateFieldSet(this, _suggesters, suggesters.map(mapper));
_classPrivateFieldSet__default['default'](this, _suggesters, suggesters.map(mapper));
_classPrivateFieldSet(this, _suggesters, coreHelpers.sort(_classPrivateFieldGet(this, _suggesters), (a, b) => b.priority - a.priority));
_classPrivateFieldSet__default['default'](this, _suggesters, coreHelpers.sort(_classPrivateFieldGet__default['default'](this, _suggesters), (a, b) => b.priority - a.priority));
}

@@ -1072,4 +1077,4 @@ /**

shouldRunExit() {
if (_classPrivateFieldGet(this, _ignoreNextExit)) {
_classPrivateFieldSet(this, _ignoreNextExit, false);
if (_classPrivateFieldGet__default['default'](this, _ignoreNextExit)) {
_classPrivateFieldSet__default['default'](this, _ignoreNextExit, false);

@@ -1100,3 +1105,3 @@ return false;

var _iterator = _createForOfIteratorHelper$1(_classPrivateFieldGet(this, _suggesters)),
var _iterator = _createForOfIteratorHelper$1(_classPrivateFieldGet__default['default'](this, _suggesters)),
_step;

@@ -1123,3 +1128,3 @@

onViewUpdate() {
var _classPrivateFieldGet2 = _classPrivateFieldGet(this, _handlerMatches),
var _classPrivateFieldGet2 = _classPrivateFieldGet__default['default'](this, _handlerMatches),
change = _classPrivateFieldGet2.change,

@@ -1162,3 +1167,3 @@ exit = _classPrivateFieldGet2.exit;

_classPrivateFieldSet(this, _removed, false);
_classPrivateFieldSet__default['default'](this, _removed, false);

@@ -1175,3 +1180,3 @@ return;

_classPrivateFieldSet(this, _removed, false);
_classPrivateFieldSet__default['default'](this, _removed, false);

@@ -1181,3 +1186,3 @@ if (isInvalidSplitReason(exit.exitReason)) {

// the next input.
_classPrivateFieldSet(this, _handlerMatches, coreHelpers.object());
_classPrivateFieldSet__default['default'](this, _handlerMatches, coreHelpers.object());
}

@@ -1194,3 +1199,3 @@ }

// Map over and update the ignored decorations.
var ignored = _classPrivateFieldGet(this, _ignored).map(tr.mapping, tr.doc);
var ignored = _classPrivateFieldGet__default['default'](this, _ignored).map(tr.mapping, tr.doc);

@@ -1215,3 +1220,3 @@ var decorations = ignored.find(); // For suggesters with multiple characters it is possible for a `paste` or

_classPrivateFieldSet(this, _ignored, ignored.remove(invalid));
_classPrivateFieldSet__default['default'](this, _ignored, ignored.remove(invalid));
}

@@ -1238,3 +1243,3 @@ /**

var decorations = _classPrivateFieldGet(this, _ignored).find();
var decorations = _classPrivateFieldGet__default['default'](this, _ignored).find();

@@ -1249,4 +1254,3 @@ return decorations.some((_ref6) => {

var shouldIgnore = spec.specific ? spec.name === name : true;
return shouldIgnore;
return spec.specific ? spec.name === name : true;
});

@@ -1260,7 +1264,7 @@ }

resetState() {
_classPrivateFieldSet(this, _handlerMatches, coreHelpers.object());
_classPrivateFieldSet__default['default'](this, _handlerMatches, coreHelpers.object());
_classPrivateFieldSet(this, _next, undefined);
_classPrivateFieldSet__default['default'](this, _next, undefined);
_classPrivateFieldSet(this, _removed, false);
_classPrivateFieldSet__default['default'](this, _removed, false);
}

@@ -1276,5 +1280,5 @@ /**

var docChanged = _classPrivateFieldGet(this, _docChanged);
var docChanged = _classPrivateFieldGet__default['default'](this, _docChanged);
var suggesters = _classPrivateFieldGet(this, _suggesters);
var suggesters = _classPrivateFieldGet__default['default'](this, _suggesters);

@@ -1289,8 +1293,8 @@ var selectionEmpty = state.selection.empty;

_classPrivateFieldSet(this, _next, match && this.shouldIgnoreMatch(match) ? undefined : match); // Store the matches with reasons
_classPrivateFieldSet__default['default'](this, _next, match && this.shouldIgnoreMatch(match) ? undefined : match); // Store the matches with reasons
_classPrivateFieldSet(this, _handlerMatches, findReason({
next: _classPrivateFieldGet(this, _next),
prev: _classPrivateFieldGet(this, _prev),
_classPrivateFieldSet__default['default'](this, _handlerMatches, findReason({
next: _classPrivateFieldGet__default['default'](this, _next),
prev: _classPrivateFieldGet__default['default'](this, _prev),
state,

@@ -1306,3 +1310,3 @@ $pos

addSuggester(suggester) {
var previous = _classPrivateFieldGet(this, _suggesters).find(item => item.name === suggester.name);
var previous = _classPrivateFieldGet__default['default'](this, _suggesters).find(item => item.name === suggester.name);

@@ -1312,7 +1316,7 @@ var mapper = createSuggesterMapper();

if (previous) {
_classPrivateFieldSet(this, _suggesters, _classPrivateFieldGet(this, _suggesters).map(item => item === previous ? mapper(suggester) : item));
_classPrivateFieldSet__default['default'](this, _suggesters, _classPrivateFieldGet__default['default'](this, _suggesters).map(item => item === previous ? mapper(suggester) : item));
} else {
var suggesters = [..._classPrivateFieldGet(this, _suggesters), mapper(suggester)];
var suggesters = [..._classPrivateFieldGet__default['default'](this, _suggesters), mapper(suggester)];
_classPrivateFieldSet(this, _suggesters, coreHelpers.sort(suggesters, (a, b) => b.priority - a.priority));
_classPrivateFieldSet__default['default'](this, _suggesters, coreHelpers.sort(suggesters, (a, b) => b.priority - a.priority));
}

@@ -1330,3 +1334,3 @@

_classPrivateFieldSet(this, _suggesters, _classPrivateFieldGet(this, _suggesters).filter(item => item.name !== name)); // When removing a suggester make sure to clear the ignored sections.
_classPrivateFieldSet__default['default'](this, _suggesters, _classPrivateFieldGet__default['default'](this, _suggesters).filter(item => item.name !== name)); // When removing a suggester make sure to clear the ignored sections.

@@ -1361,3 +1365,3 @@

var _classPrivateFieldGet3 = _classPrivateFieldGet(this, _handlerMatches),
var _classPrivateFieldGet3 = _classPrivateFieldGet__default['default'](this, _handlerMatches),
exit = _classPrivateFieldGet3.exit;

@@ -1367,7 +1371,7 @@

if (!transactionHasChanged && !_classPrivateFieldGet(this, _removed)) {
if (!transactionHasChanged && !_classPrivateFieldGet__default['default'](this, _removed)) {
return this;
}
_classPrivateFieldSet(this, _docChanged, tr.docChanged);
_classPrivateFieldSet__default['default'](this, _docChanged, tr.docChanged);

@@ -1381,3 +1385,3 @@ this.mapIgnoredDecorations(tr); // If the previous run was an exit, reset the suggester matches.

_classPrivateFieldSet(this, _prev, _classPrivateFieldGet(this, _next)); // Match against the current selection position
_classPrivateFieldSet__default['default'](this, _prev, _classPrivateFieldGet__default['default'](this, _next)); // Match against the current selection position

@@ -1401,3 +1405,3 @@

if (!isValidMatch(match)) {
return _classPrivateFieldGet(this, _ignored);
return _classPrivateFieldGet__default['default'](this, _ignored);
}

@@ -1409,3 +1413,3 @@

if (shouldSkip) {
return _classPrivateFieldGet(this, _ignored);
return _classPrivateFieldGet__default['default'](this, _ignored);
}

@@ -1420,3 +1424,3 @@

to = range.to;
return this.shouldIgnoreMatch(match) ? _classPrivateFieldGet(this, _ignored) : _classPrivateFieldGet(this, _ignored).add(state.doc, [prosemirrorView.Decoration.inline(from, to, {
return this.shouldIgnoreMatch(match) ? _classPrivateFieldGet__default['default'](this, _ignored) : _classPrivateFieldGet__default['default'](this, _ignored).add(state.doc, [prosemirrorView.Decoration.inline(from, to, {
nodeName: suggestTag,

@@ -1423,0 +1427,0 @@ class: name ? "".concat(suggestClassName, " ").concat(suggestClassName, "-").concat(name) : suggestClassName

@@ -1241,4 +1241,3 @@ import { TextSelection, Selection, PluginKey, Plugin } from 'prosemirror-state';

var shouldIgnore = spec.specific ? spec.name === name : true;
return shouldIgnore;
return spec.specific ? spec.name === name : true;
});

@@ -1245,0 +1244,0 @@ }

@@ -5,13 +5,18 @@ 'use strict';

function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
var prosemirrorState = require('prosemirror-state');
var _defineProperty = _interopDefault(require('@babel/runtime/helpers/defineProperty'));
var _classPrivateFieldSet = _interopDefault(require('@babel/runtime/helpers/classPrivateFieldSet'));
var _classPrivateFieldGet = _interopDefault(require('@babel/runtime/helpers/classPrivateFieldGet'));
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
var _classPrivateFieldSet = require('@babel/runtime/helpers/classPrivateFieldSet');
var _classPrivateFieldGet = require('@babel/runtime/helpers/classPrivateFieldGet');
var prosemirrorView = require('prosemirror-view');
var coreHelpers = require('@remirror/core-helpers');
var escapeStringRegex = _interopDefault(require('escape-string-regexp'));
var escapeStringRegex = require('escape-string-regexp');
var coreConstants = require('@remirror/core-constants');
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
var _defineProperty__default = /*#__PURE__*/_interopDefault(_defineProperty);
var _classPrivateFieldSet__default = /*#__PURE__*/_interopDefault(_classPrivateFieldSet);
var _classPrivateFieldGet__default = /*#__PURE__*/_interopDefault(_classPrivateFieldGet);
var escapeStringRegex__default = /*#__PURE__*/_interopDefault(escapeStringRegex);
/**

@@ -187,3 +192,3 @@ * This [[`Suggester`]] interface defines all the options required to create a

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }

@@ -758,3 +763,3 @@ /**

function getCharAsRegex(char) {
return coreHelpers.isString(char) ? new RegExp(escapeStringRegex(char)) : char;
return coreHelpers.isString(char) ? new RegExp(escapeStringRegex__default['default'](char)) : char;
}

@@ -823,3 +828,3 @@

function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$1(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$1(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
/**

@@ -861,3 +866,3 @@ * The `prosemirror-suggest` state which manages the list of suggesters.

get decorationSet() {
return _classPrivateFieldGet(this, _ignored);
return _classPrivateFieldGet__default['default'](this, _ignored);
}

@@ -877,3 +882,3 @@ /**

get removed() {
return _classPrivateFieldGet(this, _removed);
return _classPrivateFieldGet__default['default'](this, _removed);
}

@@ -886,3 +891,3 @@ /**

get match() {
return _classPrivateFieldGet(this, _next) ? _classPrivateFieldGet(this, _next) : _classPrivateFieldGet(this, _prev) && _classPrivateFieldGet(this, _handlerMatches).exit ? _classPrivateFieldGet(this, _prev) : undefined;
return _classPrivateFieldGet__default['default'](this, _next) ? _classPrivateFieldGet__default['default'](this, _next) : _classPrivateFieldGet__default['default'](this, _prev) && _classPrivateFieldGet__default['default'](this, _handlerMatches).exit ? _classPrivateFieldGet__default['default'](this, _prev) : undefined;
}

@@ -945,11 +950,11 @@ /**

_defineProperty(this, "setMarkRemoved", () => {
_classPrivateFieldSet(this, _removed, true);
_defineProperty__default['default'](this, "setMarkRemoved", () => {
_classPrivateFieldSet__default['default'](this, _removed, true);
});
_defineProperty(this, "ignoreNextExit", () => {
_classPrivateFieldSet(this, _ignoreNextExit, true);
_defineProperty__default['default'](this, "ignoreNextExit", () => {
_classPrivateFieldSet__default['default'](this, _ignoreNextExit, true);
});
_defineProperty(this, "addIgnored", (_ref) => {
_defineProperty__default['default'](this, "addIgnored", (_ref) => {
var from = _ref.from,

@@ -960,3 +965,3 @@ name = _ref.name,

var suggester = _classPrivateFieldGet(this, _suggesters).find(value => value.name === name);
var suggester = _classPrivateFieldGet__default['default'](this, _suggesters).find(value => value.name === name);

@@ -980,10 +985,10 @@ if (!suggester) {

_classPrivateFieldSet(this, _ignored, _classPrivateFieldGet(this, _ignored).add(this.view.state.doc, [decoration]));
_classPrivateFieldSet__default['default'](this, _ignored, _classPrivateFieldGet__default['default'](this, _ignored).add(this.view.state.doc, [decoration]));
});
_defineProperty(this, "removeIgnored", (_ref2) => {
_defineProperty__default['default'](this, "removeIgnored", (_ref2) => {
var from = _ref2.from,
name = _ref2.name;
var suggester = _classPrivateFieldGet(this, _suggesters).find(value => value.name === name);
var suggester = _classPrivateFieldGet__default['default'](this, _suggesters).find(value => value.name === name);

@@ -996,3 +1001,3 @@ if (!suggester) {

var decoration = _classPrivateFieldGet(this, _ignored).find(from, from + offset)[0];
var decoration = _classPrivateFieldGet__default['default'](this, _ignored).find(from, from + offset)[0];

@@ -1003,8 +1008,8 @@ if (!coreHelpers.bool(decoration) || decoration.spec.name !== name) {

_classPrivateFieldSet(this, _ignored, _classPrivateFieldGet(this, _ignored).remove([decoration]));
_classPrivateFieldSet__default['default'](this, _ignored, _classPrivateFieldGet__default['default'](this, _ignored).remove([decoration]));
});
_defineProperty(this, "clearIgnored", name => {
_defineProperty__default['default'](this, "clearIgnored", name => {
if (!name) {
_classPrivateFieldSet(this, _ignored, prosemirrorView.DecorationSet.empty);
_classPrivateFieldSet__default['default'](this, _ignored, prosemirrorView.DecorationSet.empty);

@@ -1014,3 +1019,3 @@ return;

var decorations = _classPrivateFieldGet(this, _ignored).find();
var decorations = _classPrivateFieldGet__default['default'](this, _ignored).find();

@@ -1022,3 +1027,3 @@ var decorationsToClear = decorations.filter((_ref3) => {

_classPrivateFieldSet(this, _ignored, _classPrivateFieldGet(this, _ignored).remove(decorationsToClear));
_classPrivateFieldSet__default['default'](this, _ignored, _classPrivateFieldGet__default['default'](this, _ignored).remove(decorationsToClear));
});

@@ -1028,5 +1033,5 @@

_classPrivateFieldSet(this, _suggesters, suggesters.map(mapper));
_classPrivateFieldSet__default['default'](this, _suggesters, suggesters.map(mapper));
_classPrivateFieldSet(this, _suggesters, coreHelpers.sort(_classPrivateFieldGet(this, _suggesters), (a, b) => b.priority - a.priority));
_classPrivateFieldSet__default['default'](this, _suggesters, coreHelpers.sort(_classPrivateFieldGet__default['default'](this, _suggesters), (a, b) => b.priority - a.priority));
}

@@ -1072,4 +1077,4 @@ /**

shouldRunExit() {
if (_classPrivateFieldGet(this, _ignoreNextExit)) {
_classPrivateFieldSet(this, _ignoreNextExit, false);
if (_classPrivateFieldGet__default['default'](this, _ignoreNextExit)) {
_classPrivateFieldSet__default['default'](this, _ignoreNextExit, false);

@@ -1100,3 +1105,3 @@ return false;

var _iterator = _createForOfIteratorHelper$1(_classPrivateFieldGet(this, _suggesters)),
var _iterator = _createForOfIteratorHelper$1(_classPrivateFieldGet__default['default'](this, _suggesters)),
_step;

@@ -1123,3 +1128,3 @@

onViewUpdate() {
var _classPrivateFieldGet2 = _classPrivateFieldGet(this, _handlerMatches),
var _classPrivateFieldGet2 = _classPrivateFieldGet__default['default'](this, _handlerMatches),
change = _classPrivateFieldGet2.change,

@@ -1162,3 +1167,3 @@ exit = _classPrivateFieldGet2.exit;

_classPrivateFieldSet(this, _removed, false);
_classPrivateFieldSet__default['default'](this, _removed, false);

@@ -1175,3 +1180,3 @@ return;

_classPrivateFieldSet(this, _removed, false);
_classPrivateFieldSet__default['default'](this, _removed, false);

@@ -1181,3 +1186,3 @@ if (isInvalidSplitReason(exit.exitReason)) {

// the next input.
_classPrivateFieldSet(this, _handlerMatches, coreHelpers.object());
_classPrivateFieldSet__default['default'](this, _handlerMatches, coreHelpers.object());
}

@@ -1194,3 +1199,3 @@ }

// Map over and update the ignored decorations.
var ignored = _classPrivateFieldGet(this, _ignored).map(tr.mapping, tr.doc);
var ignored = _classPrivateFieldGet__default['default'](this, _ignored).map(tr.mapping, tr.doc);

@@ -1215,3 +1220,3 @@ var decorations = ignored.find(); // For suggesters with multiple characters it is possible for a `paste` or

_classPrivateFieldSet(this, _ignored, ignored.remove(invalid));
_classPrivateFieldSet__default['default'](this, _ignored, ignored.remove(invalid));
}

@@ -1238,3 +1243,3 @@ /**

var decorations = _classPrivateFieldGet(this, _ignored).find();
var decorations = _classPrivateFieldGet__default['default'](this, _ignored).find();

@@ -1249,4 +1254,3 @@ return decorations.some((_ref6) => {

var shouldIgnore = spec.specific ? spec.name === name : true;
return shouldIgnore;
return spec.specific ? spec.name === name : true;
});

@@ -1260,7 +1264,7 @@ }

resetState() {
_classPrivateFieldSet(this, _handlerMatches, coreHelpers.object());
_classPrivateFieldSet__default['default'](this, _handlerMatches, coreHelpers.object());
_classPrivateFieldSet(this, _next, undefined);
_classPrivateFieldSet__default['default'](this, _next, undefined);
_classPrivateFieldSet(this, _removed, false);
_classPrivateFieldSet__default['default'](this, _removed, false);
}

@@ -1276,5 +1280,5 @@ /**

var docChanged = _classPrivateFieldGet(this, _docChanged);
var docChanged = _classPrivateFieldGet__default['default'](this, _docChanged);
var suggesters = _classPrivateFieldGet(this, _suggesters);
var suggesters = _classPrivateFieldGet__default['default'](this, _suggesters);

@@ -1289,8 +1293,8 @@ var selectionEmpty = state.selection.empty;

_classPrivateFieldSet(this, _next, match && this.shouldIgnoreMatch(match) ? undefined : match); // Store the matches with reasons
_classPrivateFieldSet__default['default'](this, _next, match && this.shouldIgnoreMatch(match) ? undefined : match); // Store the matches with reasons
_classPrivateFieldSet(this, _handlerMatches, findReason({
next: _classPrivateFieldGet(this, _next),
prev: _classPrivateFieldGet(this, _prev),
_classPrivateFieldSet__default['default'](this, _handlerMatches, findReason({
next: _classPrivateFieldGet__default['default'](this, _next),
prev: _classPrivateFieldGet__default['default'](this, _prev),
state,

@@ -1306,3 +1310,3 @@ $pos

addSuggester(suggester) {
var previous = _classPrivateFieldGet(this, _suggesters).find(item => item.name === suggester.name);
var previous = _classPrivateFieldGet__default['default'](this, _suggesters).find(item => item.name === suggester.name);

@@ -1312,7 +1316,7 @@ var mapper = createSuggesterMapper();

if (previous) {
_classPrivateFieldSet(this, _suggesters, _classPrivateFieldGet(this, _suggesters).map(item => item === previous ? mapper(suggester) : item));
_classPrivateFieldSet__default['default'](this, _suggesters, _classPrivateFieldGet__default['default'](this, _suggesters).map(item => item === previous ? mapper(suggester) : item));
} else {
var suggesters = [..._classPrivateFieldGet(this, _suggesters), mapper(suggester)];
var suggesters = [..._classPrivateFieldGet__default['default'](this, _suggesters), mapper(suggester)];
_classPrivateFieldSet(this, _suggesters, coreHelpers.sort(suggesters, (a, b) => b.priority - a.priority));
_classPrivateFieldSet__default['default'](this, _suggesters, coreHelpers.sort(suggesters, (a, b) => b.priority - a.priority));
}

@@ -1330,3 +1334,3 @@

_classPrivateFieldSet(this, _suggesters, _classPrivateFieldGet(this, _suggesters).filter(item => item.name !== name)); // When removing a suggester make sure to clear the ignored sections.
_classPrivateFieldSet__default['default'](this, _suggesters, _classPrivateFieldGet__default['default'](this, _suggesters).filter(item => item.name !== name)); // When removing a suggester make sure to clear the ignored sections.

@@ -1361,3 +1365,3 @@

var _classPrivateFieldGet3 = _classPrivateFieldGet(this, _handlerMatches),
var _classPrivateFieldGet3 = _classPrivateFieldGet__default['default'](this, _handlerMatches),
exit = _classPrivateFieldGet3.exit;

@@ -1367,7 +1371,7 @@

if (!transactionHasChanged && !_classPrivateFieldGet(this, _removed)) {
if (!transactionHasChanged && !_classPrivateFieldGet__default['default'](this, _removed)) {
return this;
}
_classPrivateFieldSet(this, _docChanged, tr.docChanged);
_classPrivateFieldSet__default['default'](this, _docChanged, tr.docChanged);

@@ -1381,3 +1385,3 @@ this.mapIgnoredDecorations(tr); // If the previous run was an exit, reset the suggester matches.

_classPrivateFieldSet(this, _prev, _classPrivateFieldGet(this, _next)); // Match against the current selection position
_classPrivateFieldSet__default['default'](this, _prev, _classPrivateFieldGet__default['default'](this, _next)); // Match against the current selection position

@@ -1401,3 +1405,3 @@

if (!isValidMatch(match)) {
return _classPrivateFieldGet(this, _ignored);
return _classPrivateFieldGet__default['default'](this, _ignored);
}

@@ -1409,3 +1413,3 @@

if (shouldSkip) {
return _classPrivateFieldGet(this, _ignored);
return _classPrivateFieldGet__default['default'](this, _ignored);
}

@@ -1420,3 +1424,3 @@

to = range.to;
return this.shouldIgnoreMatch(match) ? _classPrivateFieldGet(this, _ignored) : _classPrivateFieldGet(this, _ignored).add(state.doc, [prosemirrorView.Decoration.inline(from, to, {
return this.shouldIgnoreMatch(match) ? _classPrivateFieldGet__default['default'](this, _ignored) : _classPrivateFieldGet__default['default'](this, _ignored).add(state.doc, [prosemirrorView.Decoration.inline(from, to, {
nodeName: suggestTag,

@@ -1423,0 +1427,0 @@ class: name ? "".concat(suggestClassName, " ").concat(suggestClassName, "-").concat(name) : suggestClassName

"use strict";
function _interopDefault(ex) {
return ex && "object" == typeof ex && "default" in ex ? ex.default : ex;
}
Object.defineProperty(exports, "__esModule", {

@@ -11,4 +7,12 @@ value: !0

var prosemirrorState = require("prosemirror-state"), _defineProperty = _interopDefault(require("@babel/runtime/helpers/defineProperty")), _classPrivateFieldSet = _interopDefault(require("@babel/runtime/helpers/classPrivateFieldSet")), _classPrivateFieldGet = _interopDefault(require("@babel/runtime/helpers/classPrivateFieldGet")), prosemirrorView = require("prosemirror-view"), coreHelpers = require("@remirror/core-helpers"), escapeStringRegex = _interopDefault(require("escape-string-regexp")), coreConstants = require("@remirror/core-constants");
var prosemirrorState = require("prosemirror-state"), _defineProperty = require("@babel/runtime/helpers/defineProperty"), _classPrivateFieldSet = require("@babel/runtime/helpers/classPrivateFieldSet"), _classPrivateFieldGet = require("@babel/runtime/helpers/classPrivateFieldGet"), prosemirrorView = require("prosemirror-view"), coreHelpers = require("@remirror/core-helpers"), escapeStringRegex = require("escape-string-regexp"), coreConstants = require("@remirror/core-constants");
function _interopDefault(e) {
return e && e.__esModule ? e : {
default: e
};
}
var _defineProperty__default = _interopDefault(_defineProperty), _classPrivateFieldSet__default = _interopDefault(_classPrivateFieldSet), _classPrivateFieldGet__default = _interopDefault(_classPrivateFieldGet), escapeStringRegex__default = _interopDefault(escapeStringRegex);
function isChange(compare) {

@@ -166,3 +170,3 @@ return !(!compare.prev || !compare.next || compare.prev.query.full === compare.next.query.full);

i % 2 ? ownKeys(Object(source), !0).forEach((function(key) {
_defineProperty(target, key, source[key]);
_defineProperty__default.default(target, key, source[key]);
})) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach((function(key) {

@@ -427,3 +431,3 @@ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));

function getCharAsRegex(char) {
return coreHelpers.isString(char) ? new RegExp(escapeStringRegex(char)) : char;
return coreHelpers.isString(char) ? new RegExp(escapeStringRegex__default.default(char)) : char;
}

@@ -536,3 +540,3 @@

i % 2 ? ownKeys$1(Object(source), !0).forEach((function(key) {
_defineProperty(target, key, source[key]);
_defineProperty__default.default(target, key, source[key]);
})) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach((function(key) {

@@ -552,9 +556,9 @@ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));

get decorationSet() {
return _classPrivateFieldGet(this, _ignored);
return _classPrivateFieldGet__default.default(this, _ignored);
}
get removed() {
return _classPrivateFieldGet(this, _removed);
return _classPrivateFieldGet__default.default(this, _removed);
}
get match() {
return _classPrivateFieldGet(this, _next) ? _classPrivateFieldGet(this, _next) : _classPrivateFieldGet(this, _prev) && _classPrivateFieldGet(this, _handlerMatches).exit ? _classPrivateFieldGet(this, _prev) : void 0;
return _classPrivateFieldGet__default.default(this, _next) ? _classPrivateFieldGet__default.default(this, _next) : _classPrivateFieldGet__default.default(this, _prev) && _classPrivateFieldGet__default.default(this, _handlerMatches).exit ? _classPrivateFieldGet__default.default(this, _prev) : void 0;
}

@@ -586,8 +590,8 @@ constructor(suggesters) {

value: !1
}), _defineProperty(this, "setMarkRemoved", () => {
_classPrivateFieldSet(this, _removed, !0);
}), _defineProperty(this, "ignoreNextExit", () => {
_classPrivateFieldSet(this, _ignoreNextExit, !0);
}), _defineProperty(this, "addIgnored", _ref => {
var from = _ref.from, name = _ref.name, _ref$specific = _ref.specific, specific = void 0 !== _ref$specific && _ref$specific, suggester = _classPrivateFieldGet(this, _suggesters).find(value => value.name === name);
}), _defineProperty__default.default(this, "setMarkRemoved", () => {
_classPrivateFieldSet__default.default(this, _removed, !0);
}), _defineProperty__default.default(this, "ignoreNextExit", () => {
_classPrivateFieldSet__default.default(this, _ignoreNextExit, !0);
}), _defineProperty__default.default(this, "addIgnored", _ref => {
var from = _ref.from, name = _ref.name, _ref$specific = _ref.specific, specific = void 0 !== _ref$specific && _ref$specific, suggester = _classPrivateFieldGet__default.default(this, _suggesters).find(value => value.name === name);
if (!suggester) throw new Error("No suggester exists for the name provided: ".concat(name));

@@ -603,16 +607,17 @@ var to = from + (coreHelpers.isString(suggester.char) ? suggester.char.length : 1), attributes = suggester.ignoredClassName ? {

});
_classPrivateFieldSet(this, _ignored, _classPrivateFieldGet(this, _ignored).add(this.view.state.doc, [ decoration ]));
}), _defineProperty(this, "removeIgnored", _ref2 => {
var from = _ref2.from, name = _ref2.name, suggester = _classPrivateFieldGet(this, _suggesters).find(value => value.name === name);
_classPrivateFieldSet__default.default(this, _ignored, _classPrivateFieldGet__default.default(this, _ignored).add(this.view.state.doc, [ decoration ]));
}), _defineProperty__default.default(this, "removeIgnored", _ref2 => {
var from = _ref2.from, name = _ref2.name, suggester = _classPrivateFieldGet__default.default(this, _suggesters).find(value => value.name === name);
if (!suggester) throw new Error("No suggester exists for the name provided: ".concat(name));
var offset = coreHelpers.isString(suggester.char) ? suggester.char.length : 1, decoration = _classPrivateFieldGet(this, _ignored).find(from, from + offset)[0];
coreHelpers.bool(decoration) && decoration.spec.name === name && _classPrivateFieldSet(this, _ignored, _classPrivateFieldGet(this, _ignored).remove([ decoration ]));
}), _defineProperty(this, "clearIgnored", name => {
var offset = coreHelpers.isString(suggester.char) ? suggester.char.length : 1, decoration = _classPrivateFieldGet__default.default(this, _ignored).find(from, from + offset)[0];
coreHelpers.bool(decoration) && decoration.spec.name === name && _classPrivateFieldSet__default.default(this, _ignored, _classPrivateFieldGet__default.default(this, _ignored).remove([ decoration ]));
}), _defineProperty__default.default(this, "clearIgnored", name => {
if (name) {
var decorationsToClear = _classPrivateFieldGet(this, _ignored).find().filter(_ref3 => _ref3.spec.name === name);
_classPrivateFieldSet(this, _ignored, _classPrivateFieldGet(this, _ignored).remove(decorationsToClear));
} else _classPrivateFieldSet(this, _ignored, prosemirrorView.DecorationSet.empty);
var decorationsToClear = _classPrivateFieldGet__default.default(this, _ignored).find().filter(_ref3 => _ref3.spec.name === name);
_classPrivateFieldSet__default.default(this, _ignored, _classPrivateFieldGet__default.default(this, _ignored).remove(decorationsToClear));
} else _classPrivateFieldSet__default.default(this, _ignored, prosemirrorView.DecorationSet.empty);
});
var mapper = createSuggesterMapper();
_classPrivateFieldSet(this, _suggesters, suggesters.map(mapper)), _classPrivateFieldSet(this, _suggesters, coreHelpers.sort(_classPrivateFieldGet(this, _suggesters), (a, b) => b.priority - a.priority));
_classPrivateFieldSet__default.default(this, _suggesters, suggesters.map(mapper)),
_classPrivateFieldSet__default.default(this, _suggesters, coreHelpers.sort(_classPrivateFieldGet__default.default(this, _suggesters), (a, b) => b.priority - a.priority));
}

@@ -635,3 +640,3 @@ init(view) {

shouldRunExit() {
return !_classPrivateFieldGet(this, _ignoreNextExit) || (_classPrivateFieldSet(this, _ignoreNextExit, !1),
return !_classPrivateFieldGet__default.default(this, _ignoreNextExit) || (_classPrivateFieldSet__default.default(this, _ignoreNextExit, !1),
!1);

@@ -642,3 +647,3 @@ }

if (isTextSelection(nextSelection)) {
var _step, _iterator = _createForOfIteratorHelper$1(_classPrivateFieldGet(this, _suggesters));
var _step, _iterator = _createForOfIteratorHelper$1(_classPrivateFieldGet__default.default(this, _suggesters));
try {

@@ -657,3 +662,3 @@ for (_iterator.s(); !(_step = _iterator.n()).done; ) {

onViewUpdate() {
var _classPrivateFieldGet2 = _classPrivateFieldGet(this, _handlerMatches), change = _classPrivateFieldGet2.change, exit = _classPrivateFieldGet2.exit, match = this.match;
var _classPrivateFieldGet2 = _classPrivateFieldGet__default.default(this, _handlerMatches), change = _classPrivateFieldGet2.change, exit = _classPrivateFieldGet2.exit, match = this.match;
if (this.updateWithNextSelection(), (change || exit) && isValidMatch(match)) {

@@ -667,18 +672,18 @@ if (change && exit && isJumpReason({

return this.shouldRunExit() && exit.suggester.onChange(exitParameters), change.suggester.onChange(changeParameters),
void _classPrivateFieldSet(this, _removed, !1);
void _classPrivateFieldSet__default.default(this, _removed, !1);
}
change && change.suggester.onChange(this.createParameter(change)), exit && this.shouldRunExit() && (exit.suggester.onChange(this.createParameter(exit)),
_classPrivateFieldSet(this, _removed, !1), isInvalidSplitReason(exit.exitReason) && _classPrivateFieldSet(this, _handlerMatches, coreHelpers.object()));
_classPrivateFieldSet__default.default(this, _removed, !1), isInvalidSplitReason(exit.exitReason) && _classPrivateFieldSet__default.default(this, _handlerMatches, coreHelpers.object()));
}
}
mapIgnoredDecorations(tr) {
var ignored = _classPrivateFieldGet(this, _ignored).map(tr.mapping, tr.doc), invalid = ignored.find().filter(_ref4 => {
var ignored = _classPrivateFieldGet__default.default(this, _ignored).map(tr.mapping, tr.doc), invalid = ignored.find().filter(_ref4 => {
var from = _ref4.from, to = _ref4.to, spec = _ref4.spec;
return to - from !== (coreHelpers.isString(spec.char) ? spec.char.length : 1);
});
_classPrivateFieldSet(this, _ignored, ignored.remove(invalid));
_classPrivateFieldSet__default.default(this, _ignored, ignored.remove(invalid));
}
shouldIgnoreMatch(_ref5) {
var range = _ref5.range, name = _ref5.suggester.name;
return _classPrivateFieldGet(this, _ignored).find().some(_ref6 => {
return _classPrivateFieldGet__default.default(this, _ignored).find().some(_ref6 => {
var spec = _ref6.spec;

@@ -689,7 +694,7 @@ return _ref6.from === range.from && (!spec.specific || spec.name === name);

resetState() {
_classPrivateFieldSet(this, _handlerMatches, coreHelpers.object()), _classPrivateFieldSet(this, _next, void 0),
_classPrivateFieldSet(this, _removed, !1);
_classPrivateFieldSet__default.default(this, _handlerMatches, coreHelpers.object()),
_classPrivateFieldSet__default.default(this, _next, void 0), _classPrivateFieldSet__default.default(this, _removed, !1);
}
updateReasons(parameter) {
var $pos = parameter.$pos, state = parameter.state, docChanged = _classPrivateFieldGet(this, _docChanged), suggesters = _classPrivateFieldGet(this, _suggesters), selectionEmpty = state.selection.empty, match = isTextSelection(state.selection) ? findFromSuggesters({
var $pos = parameter.$pos, state = parameter.state, docChanged = _classPrivateFieldGet__default.default(this, _docChanged), suggesters = _classPrivateFieldGet__default.default(this, _suggesters), selectionEmpty = state.selection.empty, match = isTextSelection(state.selection) ? findFromSuggesters({
suggesters: suggesters,

@@ -700,6 +705,6 @@ $pos: $pos,

}) : void 0;
_classPrivateFieldSet(this, _next, match && this.shouldIgnoreMatch(match) ? void 0 : match),
_classPrivateFieldSet(this, _handlerMatches, findReason({
next: _classPrivateFieldGet(this, _next),
prev: _classPrivateFieldGet(this, _prev),
_classPrivateFieldSet__default.default(this, _next, match && this.shouldIgnoreMatch(match) ? void 0 : match),
_classPrivateFieldSet__default.default(this, _handlerMatches, findReason({
next: _classPrivateFieldGet__default.default(this, _next),
prev: _classPrivateFieldGet__default.default(this, _prev),
state: state,

@@ -710,6 +715,6 @@ $pos: $pos

addSuggester(suggester) {
var previous = _classPrivateFieldGet(this, _suggesters).find(item => item.name === suggester.name), mapper = createSuggesterMapper();
if (previous) _classPrivateFieldSet(this, _suggesters, _classPrivateFieldGet(this, _suggesters).map(item => item === previous ? mapper(suggester) : item)); else {
var suggesters = [ ..._classPrivateFieldGet(this, _suggesters), mapper(suggester) ];
_classPrivateFieldSet(this, _suggesters, coreHelpers.sort(suggesters, (a, b) => b.priority - a.priority));
var previous = _classPrivateFieldGet__default.default(this, _suggesters).find(item => item.name === suggester.name), mapper = createSuggesterMapper();
if (previous) _classPrivateFieldSet__default.default(this, _suggesters, _classPrivateFieldGet__default.default(this, _suggesters).map(item => item === previous ? mapper(suggester) : item)); else {
var suggesters = [ ..._classPrivateFieldGet__default.default(this, _suggesters), mapper(suggester) ];
_classPrivateFieldSet__default.default(this, _suggesters, coreHelpers.sort(suggesters, (a, b) => b.priority - a.priority));
}

@@ -720,3 +725,3 @@ return () => this.removeSuggester(suggester.name);

var name = coreHelpers.isString(suggester) ? suggester : suggester.name;
_classPrivateFieldSet(this, _suggesters, _classPrivateFieldGet(this, _suggesters).filter(item => item.name !== name)),
_classPrivateFieldSet__default.default(this, _suggesters, _classPrivateFieldGet__default.default(this, _suggesters).filter(item => item.name !== name)),
this.clearIgnored(name);

@@ -733,5 +738,5 @@ }

apply(parameter) {
var tr = parameter.tr, state = parameter.state, exit = _classPrivateFieldGet(this, _handlerMatches).exit;
return tr.docChanged || tr.selectionSet || _classPrivateFieldGet(this, _removed) ? (_classPrivateFieldSet(this, _docChanged, tr.docChanged),
this.mapIgnoredDecorations(tr), exit && this.resetState(), _classPrivateFieldSet(this, _prev, _classPrivateFieldGet(this, _next)),
var tr = parameter.tr, state = parameter.state, exit = _classPrivateFieldGet__default.default(this, _handlerMatches).exit;
return tr.docChanged || tr.selectionSet || _classPrivateFieldGet__default.default(this, _removed) ? (_classPrivateFieldSet__default.default(this, _docChanged, tr.docChanged),
this.mapIgnoredDecorations(tr), exit && this.resetState(), _classPrivateFieldSet__default.default(this, _prev, _classPrivateFieldGet__default.default(this, _next)),
this.updateReasons({

@@ -744,7 +749,7 @@ $pos: tr.selection.$from,

var match = this.match;
if (!isValidMatch(match)) return _classPrivateFieldGet(this, _ignored);
if (!isValidMatch(match)) return _classPrivateFieldGet__default.default(this, _ignored);
var disableDecorations = match.suggester.disableDecorations;
if (coreHelpers.isFunction(disableDecorations) ? disableDecorations(state, match) : disableDecorations) return _classPrivateFieldGet(this, _ignored);
if (coreHelpers.isFunction(disableDecorations) ? disableDecorations(state, match) : disableDecorations) return _classPrivateFieldGet__default.default(this, _ignored);
var range = match.range, suggester = match.suggester, name = suggester.name, suggestTag = suggester.suggestTag, suggestClassName = suggester.suggestClassName, from = range.from, to = range.to;
return this.shouldIgnoreMatch(match) ? _classPrivateFieldGet(this, _ignored) : _classPrivateFieldGet(this, _ignored).add(state.doc, [ prosemirrorView.Decoration.inline(from, to, {
return this.shouldIgnoreMatch(match) ? _classPrivateFieldGet__default.default(this, _ignored) : _classPrivateFieldGet__default.default(this, _ignored).add(state.doc, [ prosemirrorView.Decoration.inline(from, to, {
nodeName: suggestTag,

@@ -751,0 +756,0 @@ class: name ? "".concat(suggestClassName, " ").concat(suggestClassName, "-").concat(name) : suggestClassName

@@ -1241,4 +1241,3 @@ import { TextSelection, Selection, PluginKey, Plugin } from 'prosemirror-state';

var shouldIgnore = spec.specific ? spec.name === name : true;
return shouldIgnore;
return spec.specific ? spec.name === name : true;
});

@@ -1245,0 +1244,0 @@ }

{
"name": "prosemirror-suggest",
"version": "1.0.0-next.33",
"version": "1.0.0-next.34",
"description": "Primitives for building your prosemirror suggestion and autocomplete functionality",

@@ -24,4 +24,4 @@ "homepage": "https://github.com/remirror/remirror/tree/HEAD/packages/prosemirror-suggest",

"@babel/runtime": "^7.11.0",
"@remirror/core-constants": "1.0.0-next.33",
"@remirror/core-helpers": "1.0.0-next.33",
"@remirror/core-constants": "1.0.0-next.34",
"@remirror/core-helpers": "1.0.0-next.34",
"escape-string-regexp": "^4.0.0",

@@ -28,0 +28,0 @@ "type-fest": "^0.16.0"

@@ -42,3 +42,3 @@ # prosemirror-suggest

The installation requires the installation of the peer dependencies `prosemirror-view prosemirror-state prosemirror-keymap` to avoid version clashes.
The installation requires the installation of the peer dependencies `prosemirror-view prosemirror-state and prosemirror-model` to avoid version clashes.

@@ -49,2 +49,4 @@ <br />

This documentation will be updated soon.
`prosemirror-suggest` uses configuration objects called `Suggester`<!-- -->'s to define the behaviour of the suggesters you create. By calling the exported `suggest` method with all required `Suggester`<!-- -->'s the functionality is added to the editor in one plugin.

@@ -55,3 +57,3 @@

```ts
import { Suggester, suggest } from 'prosemirror-suggest';
import { suggest, Suggester } from 'prosemirror-suggest';

@@ -156,3 +158,4 @@ const maxResults = 10;

```ts
suggest: (...suggesters: Suggester[]) => Plugin;
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
(...suggesters: Suggester[]) => Plugin;
```

@@ -159,0 +162,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc