@remirror/core-utils
Advanced tools
Comparing version 1.0.0-next.53 to 1.0.0-next.54
# @remirror/core-utils | ||
## 1.0.0-next.54 | ||
> 2020-11-19 | ||
### Patch Changes | ||
- [`1a0348e7`](https://github.com/remirror/remirror/commit/1a0348e795e1bef83ef31489e0aa3c256da9e434) [#789](https://github.com/remirror/remirror/pull/789) Thanks [@ifiokjr](https://github.com/ifiokjr)! - Fix `removeMark` when called with `dispatch = undefined`. This means that `command.<NAME>.isEnabled()` checks should all be fixed if they are using `removeMark` as mentioned in [#784](https://github.com/remirror/remirror/issues/784). | ||
- Updated dependencies []: | ||
- @remirror/core-constants@1.0.0-next.54 | ||
- @remirror/core-helpers@1.0.0-next.54 | ||
- @remirror/core-types@1.0.0-next.54 | ||
- @remirror/pm@1.0.0-next.54 | ||
## 1.0.0-next.53 | ||
@@ -4,0 +18,0 @@ |
@@ -764,10 +764,13 @@ "use strict"; | ||
return _ref => { | ||
var dispatch = _ref.dispatch, tr = _ref.tr, type = parameter.type, _parameter$attrs = parameter.attrs, attrs = void 0 === _parameter$attrs ? coreHelpers.object() : _parameter$attrs, appendText = parameter.appendText, range = parameter.range, selection = tr.selection, _ref2 = null != range ? range : selection, from = _ref2.from, to = _ref2.to; | ||
return null == dispatch || dispatch(tr.addMark(from, to, type.create(attrs)) && appendText ? tr.insertText(appendText) : tr), | ||
!0; | ||
var dispatch = _ref.dispatch, tr = _ref.tr, type = parameter.type, _parameter$attrs = parameter.attrs, attrs = void 0 === _parameter$attrs ? coreHelpers.object() : _parameter$attrs, appendText = parameter.appendText, range = parameter.range, selection = range ? state.TextSelection.create(tr.doc, range.from, range.to) : tr.selection, $from = selection.$from, from = selection.from, to = selection.to, applicable = 0 === $from.depth && tr.doc.type.allowsMarkType(type); | ||
return tr.doc.nodesBetween(from, to, (node => { | ||
if (applicable) return !1; | ||
node.inlineContent && node.type.allowsMarkType(type) && (applicable = !0); | ||
})), !!applicable && (null == dispatch || dispatch(tr.addMark(from, to, type.create(attrs)) && appendText ? tr.insertText(appendText) : tr), | ||
!0); | ||
}; | ||
} | ||
function lift(_ref3) { | ||
var tr = _ref3.tr, dispatch = _ref3.dispatch, _tr$selection = tr.selection, $from = _tr$selection.$from, $to = _tr$selection.$to, range = $from.blockRange($to), target = range && transform.liftTarget(range); | ||
function lift(_ref2) { | ||
var tr = _ref2.tr, dispatch = _ref2.dispatch, _tr$selection = tr.selection, $from = _tr$selection.$from, $to = _tr$selection.$to, range = $from.blockRange($to), target = range && transform.liftTarget(range); | ||
return !(!coreHelpers.isNumber(target) || !range) && (null == dispatch || dispatch(tr.lift(range, target).scrollIntoView()), | ||
@@ -778,4 +781,4 @@ !0); | ||
function wrapIn(type, attrs) { | ||
return function(_ref4) { | ||
var tr = _ref4.tr, dispatch = _ref4.dispatch, _tr$selection2 = tr.selection, $from = _tr$selection2.$from, $to = _tr$selection2.$to, range = $from.blockRange($to), wrapping = range && transform.findWrapping(range, type, attrs); | ||
return function(_ref3) { | ||
var tr = _ref3.tr, dispatch = _ref3.dispatch, _tr$selection2 = tr.selection, $from = _tr$selection2.$from, $to = _tr$selection2.$to, range = $from.blockRange($to), wrapping = range && transform.findWrapping(range, type, attrs); | ||
return !(!wrapping || !range) && (null == dispatch || dispatch(tr.wrap(range, wrapping).scrollIntoView()), | ||
@@ -795,4 +798,4 @@ !0); | ||
function setBlockType(type, attrs) { | ||
return function(_ref5) { | ||
var tr = _ref5.tr, dispatch = _ref5.dispatch, _tr$selection3 = tr.selection, from = _tr$selection3.from, to = _tr$selection3.to, applicable = !1; | ||
return function(_ref4) { | ||
var tr = _ref4.tr, dispatch = _ref4.dispatch, _tr$selection3 = tr.selection, from = _tr$selection3.from, to = _tr$selection3.to, applicable = !1; | ||
return tr.doc.nodesBetween(from, to, ((node, pos) => { | ||
@@ -841,4 +844,4 @@ if (applicable) return !1; | ||
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 _ref6 => { | ||
var state = _ref6.state, tr = _ref6.tr, dispatch = _ref6.dispatch, schema = state.schema, selection = tr.selection, index = selection.$from.index(), _ref7 = null != range ? range : selection, from = _ref7.from, to = _ref7.to; | ||
return _ref5 => { | ||
var state = _ref5.state, tr = _ref5.tr, dispatch = _ref5.dispatch, schema = state.schema, selection = tr.selection, index = selection.$from.index(), _ref6 = null != range ? range : selection, from = _ref6.from, to = _ref6.to; | ||
if (isNodeType(type)) { | ||
@@ -859,6 +862,6 @@ if (!selection.$from.parent.canReplaceWith(index, index, type)) return !1; | ||
function removeMark(parameter) { | ||
return _ref8 => { | ||
var dispatch = _ref8.dispatch, tr = _ref8.tr, type = parameter.type, _parameter$expand = parameter.expand, expand = void 0 !== _parameter$expand && _parameter$expand, range = parameter.range, selection = tr.selection, _ref9 = null != range ? range : selection, from = _ref9.from, to = _ref9.to; | ||
return _ref7 => { | ||
var dispatch = _ref7.dispatch, tr = _ref7.tr, type = parameter.type, _parameter$expand = parameter.expand, expand = void 0 !== _parameter$expand && _parameter$expand, range = parameter.range, selection = tr.selection, _ref8 = null != range ? range : selection, from = _ref8.from, to = _ref8.to; | ||
if (expand) { | ||
var _getMarkRange, _ref10 = range ? getMarkRange(tr.doc.resolve(range.from), type) || coreHelpers.isNumber(range.to) && getMarkRange(tr.doc.resolve(range.to), type) || { | ||
var _getMarkRange, _ref9 = range ? getMarkRange(tr.doc.resolve(range.from), type) || coreHelpers.isNumber(range.to) && getMarkRange(tr.doc.resolve(range.to), type) || { | ||
from: from, | ||
@@ -870,5 +873,5 @@ to: to | ||
}; | ||
from = _ref10.from, to = _ref10.to; | ||
from = _ref9.from, to = _ref9.to; | ||
} | ||
return tr.removeMark(from, coreHelpers.isNumber(to) ? to : from, type), dispatch && dispatch(tr), | ||
return null == dispatch || dispatch(tr.removeMark(from, coreHelpers.isNumber(to) ? to : from, type)), | ||
!0; | ||
@@ -875,0 +878,0 @@ }; |
@@ -64,3 +64,3 @@ import type { AnchorHeadParameter, AnyConstructor, ApplySchemaAttributes, DOMCompatibleAttributes, EditorSchema, EditorState, FromToParameter, MarkAttributes, MarkTypeParameter, NodeAttributes, PrimitiveSelection, ProsemirrorNode, ProsemirrorNodeParameter, RemirrorContentType, RemirrorJSON, RenderEnvironment, ResolvedPos, SchemaParameter, Selection, Transaction, TrStateParameter } from '@remirror/core-types'; | ||
*/ | ||
export declare function isSelection(value: unknown): value is Selection<EditorSchema>; | ||
export declare function isSelection(value: unknown): value is Selection; | ||
/** | ||
@@ -67,0 +67,0 @@ * Predicate checking whether the value is a ResolvedPosition. |
{ | ||
"name": "@remirror/core-utils", | ||
"version": "1.0.0-next.53", | ||
"version": "1.0.0-next.54", | ||
"description": "Core utilities for dealing with the dom and prosemirror within remirror", | ||
@@ -24,5 +24,5 @@ "homepage": "https://github.com/remirror/remirror/tree/HEAD/packages/@remirror/core-utils", | ||
"@babel/runtime": "^7.12.0", | ||
"@remirror/core-constants": "1.0.0-next.53", | ||
"@remirror/core-helpers": "1.0.0-next.53", | ||
"@remirror/core-types": "1.0.0-next.53", | ||
"@remirror/core-constants": "1.0.0-next.54", | ||
"@remirror/core-helpers": "1.0.0-next.54", | ||
"@remirror/core-types": "1.0.0-next.54", | ||
"@types/min-document": "^2.19.0", | ||
@@ -33,3 +33,3 @@ "min-document": "^2.19.0", | ||
"devDependencies": { | ||
"@remirror/pm": "1.0.0-next.53", | ||
"@remirror/pm": "1.0.0-next.54", | ||
"@types/node": "^14.14.3", | ||
@@ -39,3 +39,3 @@ "domino": "^2.1.6" | ||
"peerDependencies": { | ||
"@remirror/pm": "1.0.0-next.53", | ||
"@remirror/pm": "1.0.0-next.54", | ||
"@types/node": "*" | ||
@@ -42,0 +42,0 @@ }, |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
475991
12834
+ Added@remirror/core-constants@1.0.0-next.54(transitive)
+ Added@remirror/core-helpers@1.0.0-next.54(transitive)
+ Added@remirror/core-types@1.0.0-next.54(transitive)
+ Added@remirror/pm@1.0.0-next.54(transitive)
- Removed@remirror/core-constants@1.0.0-next.53(transitive)
- Removed@remirror/core-helpers@1.0.0-next.53(transitive)
- Removed@remirror/core-types@1.0.0-next.53(transitive)
- Removed@remirror/pm@1.0.0-next.53(transitive)