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

@remirror/core-utils

Package Overview
Dependencies
Maintainers
1
Versions
287
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@remirror/core-utils - npm Package Compare versions

Comparing version 1.0.0-next.6 to 1.0.0-next.8

14

CHANGELOG.md
# @remirror/core-utils
## 1.0.0-next.8
> 2020-07-21
### Minor Changes
- a93c83bd: - Add `keepSelection` property to the `replaceText` command function.
- Prevent mentions from trapping the cursor when arrowing left and right through the mention.
- Set low priority for `AutoLinkExtension` to prevent `appendTransaction` interfering with
mentions.
- Update extension order in the `SocialPreset`
- `prosemirror-suggest` - New export `isSelectionExitReason` which let's the user know if the exit
was due to a selection change or a character entry.
## 1.0.0-next.6

@@ -4,0 +18,0 @@

83

dist/core-utils.cjs.prod.js

@@ -11,3 +11,3 @@ "use strict";

var coreHelpers = require("@remirror/core-helpers"), commands = require("@remirror/pm/commands"), schemaList = require("@remirror/pm/schema-list"), minDocument = _interopDefault(require("min-document")), coreConstants = require("@remirror/core-constants"), model = require("@remirror/pm/model"), state = require("@remirror/pm/state"), _defineProperty = _interopDefault(require("@babel/runtime/helpers/defineProperty")), _objectWithoutProperties = _interopDefault(require("@babel/runtime/helpers/objectWithoutProperties")), _slicedToArray = _interopDefault(require("@babel/runtime/helpers/slicedToArray")), inputrules = require("@remirror/pm/inputrules"), environment = {
var coreHelpers = require("@remirror/core-helpers"), commands = require("@remirror/pm/commands"), schemaList = require("@remirror/pm/schema-list"), state = require("@remirror/pm/state"), minDocument = _interopDefault(require("min-document")), coreConstants = require("@remirror/core-constants"), model = require("@remirror/pm/model"), _defineProperty = _interopDefault(require("@babel/runtime/helpers/defineProperty")), _objectWithoutProperties = _interopDefault(require("@babel/runtime/helpers/objectWithoutProperties")), _slicedToArray = _interopDefault(require("@babel/runtime/helpers/slicedToArray")), inputrules = require("@remirror/pm/inputrules"), environment = {
get isBrowser() {

@@ -806,2 +806,62 @@ return coreHelpers.bool("undefined" != typeof window && void 0 !== window.document && window.navigator && window.navigator.userAgent);

function _createForOfIteratorHelper$2(o, allowArrayLike) {
var it;
if ("undefined" == typeof Symbol || null == o[Symbol.iterator]) {
if (Array.isArray(o) || (it = _unsupportedIterableToArray$2(o)) || allowArrayLike && o && "number" == typeof o.length) {
it && (o = it);
var i = 0, F = function() {};
return {
s: F,
n: function() {
return i >= o.length ? {
done: !0
} : {
done: !1,
value: o[i++]
};
},
e: function(_e) {
throw _e;
},
f: F
};
}
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
var err, normalCompletion = !0, didErr = !1;
return {
s: function() {
it = o[Symbol.iterator]();
},
n: function() {
var step = it.next();
return normalCompletion = step.done, step;
},
e: function(_e2) {
didErr = !0, err = _e2;
},
f: function() {
try {
normalCompletion || null == it.return || it.return();
} finally {
if (didErr) throw err;
}
}
};
}
function _unsupportedIterableToArray$2(o, minLen) {
if (o) {
if ("string" == typeof o) return _arrayLikeToArray$2(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
return "Object" === n && o.constructor && (n = o.constructor.name), "Map" === n || "Set" === n ? Array.from(o) : "Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? _arrayLikeToArray$2(o, minLen) : void 0;
}
}
function _arrayLikeToArray$2(arr, len) {
(null == len || len > arr.length) && (len = arr.length);
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
return arr2;
}
function updateMark(parameter) {

@@ -863,6 +923,20 @@ return _ref => {

function keepSelectionTransaction(view, tr) {
var _step, from = view.state.selection.from, _iterator = _createForOfIteratorHelper$2(tr.steps);
try {
for (_iterator.s(); !(_step = _iterator.n()).done; ) {
from = _step.value.getMap().map(from);
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
}
tr.setSelection(new state.TextSelection(tr.doc.resolve(from)));
}
function replaceText(parameter) {
var range = parameter.range, type = parameter.type, _parameter$attrs2 = parameter.attrs, attrs = void 0 === _parameter$attrs2 ? {} : _parameter$attrs2, _parameter$appendText = parameter.appendText, appendText = void 0 === _parameter$appendText ? "" : _parameter$appendText, _parameter$content = parameter.content, content = void 0 === _parameter$content ? "" : _parameter$content;
var range = parameter.range, type = parameter.type, _parameter$attrs2 = parameter.attrs, attrs = void 0 === _parameter$attrs2 ? {} : _parameter$attrs2, _parameter$appendText = parameter.appendText, appendText = void 0 === _parameter$appendText ? "" : _parameter$appendText, _parameter$content = parameter.content, content = void 0 === _parameter$content ? "" : _parameter$content, _parameter$keepSelect = parameter.keepSelection, keepSelection = void 0 !== _parameter$keepSelect && _parameter$keepSelect;
return _ref5 => {
var state = _ref5.state, tr = _ref5.tr, dispatch = _ref5.dispatch, schema = state.schema, selection = state.selection, index = selection.$from.index(), _ref6 = null != range ? range : selection, from = _ref6.from, to = _ref6.to;
var state = _ref5.state, tr = _ref5.tr, dispatch = _ref5.dispatch, view = _ref5.view, schema = state.schema, selection = tr.selection, index = selection.$from.index(), _ref6 = null != range ? range : selection, from = _ref6.from, to = _ref6.to;
if (isNodeType(type)) {

@@ -872,3 +946,4 @@ if (!selection.$from.parent.canReplaceWith(index, index, type)) return !1;

} else content || coreHelpers.invariant(!1), tr.replaceWith(from, to, schema.text(content, isMarkType(type) ? [ type.create(attrs) ] : void 0));
if (appendText && tr.insertText(appendText), dispatch) {
if (appendText && tr.insertText(appendText), keepSelection && view && keepSelectionTransaction(view, tr),
dispatch) {
var _document$getSelectio;

@@ -875,0 +950,0 @@ if (isChrome(60)) null === (_document$getSelectio = document.getSelection()) || void 0 === _document$getSelectio || _document$getSelectio.empty();

@@ -71,2 +71,6 @@ import { AttributesParameter, CommandFunction, MarkType, MarkTypeParameter, NodeType, NodeTypeParameter, ProsemirrorAttributes, ProsemirrorCommandFunction, RangeParameter } from '@remirror/core-types';

type?: NodeType | MarkType;
/**
* Whether to keep the original selection after the replacement.
*/
keepSelection?: boolean;
}

@@ -73,0 +77,0 @@ /**

2

package.json
{
"name": "@remirror/core-utils",
"version": "1.0.0-next.6",
"version": "1.0.0-next.8",
"description": "Core utilities for dealing with the dom and prosemirror within remirror",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/remirror/remirror/tree/HEAD/packages/@remirror/core-utils",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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