@remirror/pm
Advanced tools
Comparing version 3.0.0-beta.1 to 3.0.0-beta.2
@@ -0,1 +1,15 @@ | ||
var _excluded = ["state", "dispatch", "view", "tr"]; | ||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } | ||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } | ||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } | ||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } | ||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); } | ||
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } | ||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } | ||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } | ||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } | ||
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } } | ||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } | ||
// src/extra/pm-types.ts | ||
@@ -12,8 +26,11 @@ import { InputRule } from "prosemirror-inputrules"; | ||
function chainableEditorState(tr, state) { | ||
const proto = Object.getPrototypeOf(state); | ||
let selection = tr.selection; | ||
let doc = tr.doc; | ||
let storedMarks = tr.storedMarks; | ||
const properties = object(); | ||
for (const [key, value] of Object.entries(state)) { | ||
var proto = Object.getPrototypeOf(state); | ||
var selection = tr.selection; | ||
var doc = tr.doc; | ||
var storedMarks = tr.storedMarks; | ||
var properties = object(); | ||
for (var _i = 0, _Object$entries = Object.entries(state); _i < _Object$entries.length; _i++) { | ||
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2), | ||
key = _Object$entries$_i[0], | ||
value = _Object$entries$_i[1]; | ||
properties[key] = { | ||
@@ -23,4 +40,3 @@ value | ||
} | ||
return Object.create(proto, { | ||
...properties, | ||
return Object.create(proto, _objectSpread(_objectSpread({}, properties), {}, { | ||
storedMarks: { | ||
@@ -49,15 +65,17 @@ get() { | ||
} | ||
}); | ||
})); | ||
} | ||
function convertCommand(commandFunction) { | ||
return ({ | ||
state, | ||
dispatch, | ||
view, | ||
tr | ||
}) => commandFunction(chainableEditorState(tr, state), dispatch, view); | ||
return _ref => { | ||
var state = _ref.state, | ||
dispatch = _ref.dispatch, | ||
view = _ref.view, | ||
tr = _ref.tr; | ||
return commandFunction(chainableEditorState(tr, state), dispatch, view); | ||
}; | ||
} | ||
function nonChainable(commandFunction) { | ||
return props => { | ||
invariant(props.dispatch === void 0 || props.dispatch === props.view?.dispatch, { | ||
var _props$view; | ||
invariant(props.dispatch === void 0 || props.dispatch === ((_props$view = props.view) === null || _props$view === void 0 ? void 0 : _props$view.dispatch), { | ||
code: ErrorConstant.NON_CHAINABLE_COMMAND | ||
@@ -68,18 +86,20 @@ }); | ||
} | ||
function chainCommands(...commands) { | ||
return ({ | ||
state, | ||
dispatch, | ||
view, | ||
tr, | ||
...rest | ||
}) => { | ||
for (const element of commands) { | ||
if (element({ | ||
function chainCommands() { | ||
for (var _len = arguments.length, commands = new Array(_len), _key = 0; _key < _len; _key++) { | ||
commands[_key] = arguments[_key]; | ||
} | ||
return _ref2 => { | ||
var state = _ref2.state, | ||
dispatch = _ref2.dispatch, | ||
view = _ref2.view, | ||
tr = _ref2.tr, | ||
rest = _objectWithoutProperties(_ref2, _excluded); | ||
for (var _i2 = 0, _commands = commands; _i2 < _commands.length; _i2++) { | ||
var element = _commands[_i2]; | ||
if (element(_objectSpread({ | ||
state, | ||
dispatch, | ||
view, | ||
tr, | ||
...rest | ||
})) { | ||
tr | ||
}, rest))) { | ||
return true; | ||
@@ -86,0 +106,0 @@ } |
{ | ||
"name": "@remirror/pm", | ||
"version": "3.0.0-beta.1", | ||
"version": "3.0.0-beta.2", | ||
"description": "A bundled library containing all the core prosemirror libraries required for using remirror", | ||
@@ -130,4 +130,4 @@ "homepage": "https://github.com/remirror/remirror/tree/HEAD/packages/remirror__pm", | ||
"@babel/runtime": "^7.22.3", | ||
"@remirror/core-constants": "3.0.0-beta.0", | ||
"@remirror/core-helpers": "4.0.0-beta.0", | ||
"@remirror/core-constants": "3.0.0-beta.1", | ||
"@remirror/core-helpers": "4.0.0-beta.1", | ||
"prosemirror-collab": "^1.3.1", | ||
@@ -141,8 +141,8 @@ "prosemirror-commands": "^1.5.2", | ||
"prosemirror-model": "^1.19.3", | ||
"prosemirror-paste-rules": "^3.0.0-beta.1", | ||
"prosemirror-paste-rules": "^3.0.0-beta.2", | ||
"prosemirror-schema-list": "^1.3.0", | ||
"prosemirror-state": "^1.4.3", | ||
"prosemirror-suggest": "3.0.0-beta.1", | ||
"prosemirror-suggest": "3.0.0-beta.2", | ||
"prosemirror-tables": "^1.3.4", | ||
"prosemirror-trailing-node": "^3.0.0-beta.1", | ||
"prosemirror-trailing-node": "^3.0.0-beta.2", | ||
"prosemirror-transform": "^1.8.0", | ||
@@ -149,0 +149,0 @@ "prosemirror-view": "^1.32.3" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
1653600
18641
+ Added@remirror/core-constants@3.0.0-beta.1(transitive)
+ Added@remirror/core-helpers@4.0.0-beta.1(transitive)
+ Added@remirror/types@2.0.0-beta.1(transitive)
+ Addedprosemirror-suggest@3.0.0-beta.2(transitive)
+ Addedprosemirror-view@1.37.0(transitive)
- Removed@remirror/core-constants@3.0.0-beta.0(transitive)
- Removed@remirror/core-helpers@4.0.0-beta.0(transitive)
- Removed@remirror/types@2.0.0-beta.0(transitive)
- Removedprosemirror-suggest@3.0.0-beta.1(transitive)
- Removedprosemirror-view@1.36.0(transitive)