slate-history
Advanced tools
Comparing version 0.58.4 to 0.59.0
@@ -5,7 +5,9 @@ 'use strict'; | ||
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
var isPlainObject = _interopDefault(require('is-plain-object')); | ||
var isPlainObject = require('is-plain-object'); | ||
var slate = require('slate'); | ||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } | ||
var isPlainObject__default = /*#__PURE__*/_interopDefaultLegacy(isPlainObject); | ||
var History = { | ||
@@ -16,3 +18,3 @@ /** | ||
isHistory: function isHistory(value) { | ||
return isPlainObject(value) && Array.isArray(value.redos) && Array.isArray(value.undos) && (value.redos.length === 0 || slate.Operation.isOperationList(value.redos[0])) && (value.undos.length === 0 || slate.Operation.isOperationList(value.undos[0])); | ||
return isPlainObject__default['default'](value) && Array.isArray(value.redos) && Array.isArray(value.undos) && (value.redos.length === 0 || slate.Operation.isOperationList(value.redos[0])) && (value.undos.length === 0 || slate.Operation.isOperationList(value.undos[0])); | ||
} | ||
@@ -19,0 +21,0 @@ }; |
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('slate')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'slate'], factory) : | ||
(global = global || self, factory(global.SlateHistory = {}, global.Slate)); | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.SlateHistory = {}, global.Slate)); | ||
}(this, (function (exports, slate) { 'use strict'; | ||
@@ -6,0 +6,0 @@ |
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("slate")):"function"==typeof define&&define.amd?define(["exports","slate"],e):e((t=t||self).SlateHistory={},t.Slate)}(this,(function(t,e){"use strict"; | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("slate")):"function"==typeof define&&define.amd?define(["exports","slate"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).SlateHistory={},t.Slate)}(this,(function(t,e){"use strict"; | ||
/*! | ||
@@ -14,2 +14,2 @@ * isobject <https://github.com/jonschlinkert/isobject> | ||
*/ | ||
function n(t){return!0==(null!=(e=t)&&"object"==typeof e&&!1===Array.isArray(e))&&"[object Object]"===Object.prototype.toString.call(t);var e}var r={isHistory:function(t){return!1!==n(r=t)&&"function"==typeof(o=r.constructor)&&!1!==n(i=o.prototype)&&!1!==i.hasOwnProperty("isPrototypeOf")&&Array.isArray(t.redos)&&Array.isArray(t.undos)&&(0===t.redos.length||e.Operation.isOperationList(t.redos[0]))&&(0===t.undos.length||e.Operation.isOperationList(t.undos[0]));var r,o,i}},o=new WeakMap,i=new WeakMap,s=new WeakMap,u={isHistoryEditor:function(t){return e.Editor.isEditor(t)&&r.isHistory(t.history)},isMerging:function(t){return s.get(t)},isSaving:function(t){return i.get(t)},redo:function(t){t.redo()},undo:function(t){t.undo()},withoutMerging:function(t,e){var n=u.isMerging(t);s.set(t,!1),e(),s.set(t,n)},withoutSaving:function(t,e){var n=u.isSaving(t);i.set(t,!1),e(),i.set(t,n)}},a=function(t,n){return"set_selection"===t.type||(!(!n||"insert_text"!==t.type||"insert_text"!==n.type||t.offset!==n.offset+n.text.length||!e.Path.equals(t.path,n.path))||!(!n||"remove_text"!==t.type||"remove_text"!==n.type||t.offset+t.text.length!==n.offset||!e.Path.equals(t.path,n.path)))},l=function(t,e){return"set_selection"!==t.type||null!=t.newProperties},f=function(t,e){return!(!e||"set_selection"!==t.type||"set_selection"!==e.type)},p=function(t){return"set_selection"!==t.type};t.HISTORY=o,t.History=r,t.HistoryEditor=u,t.MERGING=s,t.SAVING=i,t.withHistory=function(t){var n=t,r=n.apply;return n.history={undos:[],redos:[]},n.redo=function(){var t=n.history,r=t.redos;if(r.length>0){var o=r[r.length-1];u.withoutSaving(n,(function(){e.Editor.withoutNormalizing(n,(function(){var t=!0,e=!1,r=void 0;try{for(var i,s=o[Symbol.iterator]();!(t=(i=s.next()).done);t=!0){var u=i.value;n.apply(u)}}catch(t){e=!0,r=t}finally{try{t||null==s.return||s.return()}finally{if(e)throw r}}}))})),t.redos.pop(),t.undos.push(o)}},n.undo=function(){var t=n.history,r=t.undos;if(r.length>0){var o=r[r.length-1];u.withoutSaving(n,(function(){e.Editor.withoutNormalizing(n,(function(){var t=o.map(e.Operation.inverse).reverse(),r=!0,i=!1,s=void 0;try{for(var u,a=t[Symbol.iterator]();!(r=(u=a.next()).done);r=!0){var l=u.value;l===t[t.length-1]&&"set_selection"===l.type&&null==l.newProperties||n.apply(l)}}catch(t){i=!0,s=t}finally{try{r||null==a.return||a.return()}finally{if(i)throw s}}}))})),t.redos.push(o),t.undos.pop()}},n.apply=function(t){var e=n.operations,o=n.history,i=o.undos,s=i[i.length-1],y=s&&s[s.length-1],c=f(t,y),h=u.isSaving(n),d=u.isMerging(n);if(null==h&&(h=l(t)),h){if(null==d&&(d=null!=s&&(0!==e.length||(a(t,y)||c))),s&&d)c&&s.pop(),s.push(t);else{var v=[t];i.push(v)}for(;i.length>100;)i.shift();p(t)&&(o.redos=[])}r(t)},n},Object.defineProperty(t,"__esModule",{value:!0})})); | ||
function n(t){return!0==(null!=(e=t)&&"object"==typeof e&&!1===Array.isArray(e))&&"[object Object]"===Object.prototype.toString.call(t);var e}var r={isHistory:function(t){return!1!==n(r=t)&&"function"==typeof(o=r.constructor)&&!1!==n(i=o.prototype)&&!1!==i.hasOwnProperty("isPrototypeOf")&&Array.isArray(t.redos)&&Array.isArray(t.undos)&&(0===t.redos.length||e.Operation.isOperationList(t.redos[0]))&&(0===t.undos.length||e.Operation.isOperationList(t.undos[0]));var r,o,i}},o=new WeakMap,i=new WeakMap,s=new WeakMap,u={isHistoryEditor:function(t){return e.Editor.isEditor(t)&&r.isHistory(t.history)},isMerging:function(t){return s.get(t)},isSaving:function(t){return i.get(t)},redo:function(t){t.redo()},undo:function(t){t.undo()},withoutMerging:function(t,e){var n=u.isMerging(t);s.set(t,!1),e(),s.set(t,n)},withoutSaving:function(t,e){var n=u.isSaving(t);i.set(t,!1),e(),i.set(t,n)}},a=function(t,n){return"set_selection"===t.type||(!(!n||"insert_text"!==t.type||"insert_text"!==n.type||t.offset!==n.offset+n.text.length||!e.Path.equals(t.path,n.path))||!(!n||"remove_text"!==t.type||"remove_text"!==n.type||t.offset+t.text.length!==n.offset||!e.Path.equals(t.path,n.path)))},l=function(t,e){return"set_selection"!==t.type||null!=t.newProperties},f=function(t,e){return!(!e||"set_selection"!==t.type||"set_selection"!==e.type)},p=function(t){return"set_selection"!==t.type};t.HISTORY=o,t.History=r,t.HistoryEditor=u,t.MERGING=s,t.SAVING=i,t.withHistory=function(t){var n=t,r=n.apply;return n.history={undos:[],redos:[]},n.redo=function(){var t=n.history,r=t.redos;if(r.length>0){var o=r[r.length-1];u.withoutSaving(n,(function(){e.Editor.withoutNormalizing(n,(function(){var t=!0,e=!1,r=void 0;try{for(var i,s=o[Symbol.iterator]();!(t=(i=s.next()).done);t=!0){var u=i.value;n.apply(u)}}catch(t){e=!0,r=t}finally{try{t||null==s.return||s.return()}finally{if(e)throw r}}}))})),t.redos.pop(),t.undos.push(o)}},n.undo=function(){var t=n.history,r=t.undos;if(r.length>0){var o=r[r.length-1];u.withoutSaving(n,(function(){e.Editor.withoutNormalizing(n,(function(){var t=o.map(e.Operation.inverse).reverse(),r=!0,i=!1,s=void 0;try{for(var u,a=t[Symbol.iterator]();!(r=(u=a.next()).done);r=!0){var l=u.value;l===t[t.length-1]&&"set_selection"===l.type&&null==l.newProperties||n.apply(l)}}catch(t){i=!0,s=t}finally{try{r||null==a.return||a.return()}finally{if(i)throw s}}}))})),t.redos.push(o),t.undos.pop()}},n.apply=function(t){var e=n.operations,o=n.history,i=o.undos,s=i[i.length-1],y=s&&s[s.length-1],c=f(t,y),h=u.isSaving(n),d=u.isMerging(n);if(null==h&&(h=l(t)),h){if(null==d&&(d=null!=s&&(0!==e.length||(a(t,y)||c))),s&&d)c&&s.pop(),s.push(t);else{var g=[t];i.push(g)}for(;i.length>100;)i.shift();p(t)&&(o.redos=[])}r(t)},n},Object.defineProperty(t,"__esModule",{value:!0})})); |
{ | ||
"name": "slate-history", | ||
"description": "An operation-based history implementation for Slate editors.", | ||
"version": "0.58.4", | ||
"version": "0.59.0", | ||
"license": "MIT", | ||
@@ -21,4 +21,4 @@ "repository": "git://github.com/ianstormtaylor/slate.git", | ||
"devDependencies": { | ||
"slate": "^0.58.4", | ||
"slate-hyperscript": "^0.58.4" | ||
"slate": "^0.59.0", | ||
"slate-hyperscript": "^0.59.0" | ||
}, | ||
@@ -41,3 +41,3 @@ "peerDependencies": { | ||
], | ||
"gitHead": "958189bc4ae4502dc7fe22219c77fea9820124f5" | ||
"gitHead": "60b56651b2e1e6f58bcf29a1a876612720a4fe2c" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
58848
850