UNPKG

470 kBSource Map (JSON)View Raw
1{"version":3,"file":"slate.js","sources":["../src/models/data.js","../src/constants/model-types.js","../src/utils/memoize.js","../src/models/mark.js","../src/models/range.js","../src/models/character.js","../src/models/leaf.js","../src/utils/generate-key.js","../src/models/text.js","../src/utils/is-index-in-range.js","../src/models/node.js","../src/models/inline.js","../src/models/document.js","../src/models/block.js","../src/changes/at-current-range.js","../src/utils/string.js","../src/changes/at-range.js","../src/changes/by-key.js","../src/constants/operation-attributes.js","../src/models/history.js","../src/constants/core-schema-rules.js","../src/models/stack.js","../src/models/schema.js","../src/models/value.js","../src/models/operation.js","../src/operations/invert.js","../src/changes/on-history.js","../src/changes/on-selection.js","../src/changes/on-value.js","../src/changes/with-schema.js","../src/changes/index.js","../src/operations/apply.js","../src/models/change.js","../src/operations/index.js","../src/index.js"],"sourcesContent":["import isPlainObject from 'is-plain-object'\nimport { Map } from 'immutable'\n\n/**\n * Data.\n *\n * This isn't an immutable record, it's just a thin wrapper around `Map` so that\n * we can allow for more convenient creation.\n *\n * @type {Object}\n */\n\nclass Data {\n /**\n * Create a new `Data` with `attrs`.\n *\n * @param {Object|Data|Map} attrs\n * @return {Data} data\n */\n\n static create(attrs = {}) {\n if (Map.isMap(attrs)) {\n return attrs\n }\n\n if (isPlainObject(attrs)) {\n return Data.fromJSON(attrs)\n }\n\n throw new Error(\n `\\`Data.create\\` only accepts objects or maps, but you passed it: ${attrs}`\n )\n }\n\n /**\n * Create a `Data` from a JSON `object`.\n *\n * @param {Object} object\n * @return {Data}\n */\n\n static fromJSON(object) {\n return new Map(object)\n }\n\n /**\n * Alias `fromJS`.\n */\n\n static fromJS = Data.fromJSON\n}\n\n/**\n * Export.\n *\n * @type {Object}\n */\n\nexport default Data\n","/**\n * Slate-specific model types.\n *\n * @type {Object}\n */\n\nconst MODEL_TYPES = {\n BLOCK: '@@__SLATE_BLOCK__@@',\n CHANGE: '@@__SLATE_CHANGE__@@',\n CHARACTER: '@@__SLATE_CHARACTER__@@',\n DOCUMENT: '@@__SLATE_DOCUMENT__@@',\n HISTORY: '@@__SLATE_HISTORY__@@',\n INLINE: '@@__SLATE_INLINE__@@',\n LEAF: '@@__SLATE_LEAF__@@',\n MARK: '@@__SLATE_MARK__@@',\n OPERATION: '@@__SLATE_OPERATION__@@',\n RANGE: '@@__SLATE_RANGE__@@',\n SCHEMA: '@@__SLATE_SCHEMA__@@',\n STACK: '@@__SLATE_STACK__@@',\n TEXT: '@@__SLATE_TEXT__@@',\n VALUE: '@@__SLATE_VALUE__@@',\n}\n\n/**\n * Export.\n *\n * @type {Object}\n */\n\nexport default MODEL_TYPES\n","/**\n * GLOBAL: True if memoization should is enabled.\n *\n * @type {Boolean}\n */\n\nlet ENABLED = true\n\n/**\n * GLOBAL: Changing this cache key will clear all previous cached results.\n *\n * @type {Number}\n */\n\nlet CACHE_KEY = 0\n\n/**\n * The leaf node of a cache tree. Used to support variable argument length. A\n * unique object, so that native Maps will key it by reference.\n *\n * @type {Object}\n */\n\nconst LEAF = {}\n\n/**\n * A value to represent a memoized undefined value. Allows efficient value\n * retrieval using Map.get only.\n *\n * @type {Object}\n */\n\nconst UNDEFINED = {}\n\n/**\n * Default value for unset keys in native Maps\n *\n * @type {Undefined}\n */\n\nconst UNSET = undefined\n\n/**\n * Memoize all of the `properties` on a `object`.\n *\n * @param {Object} object\n * @param {Array} properties\n * @return {Record}\n */\n\nfunction memoize(object, properties) {\n for (const property of properties) {\n const original = object[property]\n\n if (!original) {\n throw new Error(`Object does not have a property named \"${property}\".`)\n }\n\n object[property] = function(...args) {\n // If memoization is disabled, call into the original method.\n if (!ENABLED) return original.apply(this, args)\n\n // If the cache key is different, previous caches must be cleared.\n if (CACHE_KEY !== this.__cache_key) {\n this.__cache_key = CACHE_KEY\n this.__cache = new Map() // eslint-disable-line no-undef,no-restricted-globals\n this.__cache_no_args = {}\n }\n\n if (!this.__cache) {\n this.__cache = new Map() // eslint-disable-line no-undef,no-restricted-globals\n }\n if (!this.__cache_no_args) {\n this.__cache_no_args = {}\n }\n\n const takesArguments = args.length !== 0\n\n let cachedValue\n let keys\n\n if (takesArguments) {\n keys = [property, ...args]\n cachedValue = getIn(this.__cache, keys)\n } else {\n cachedValue = this.__cache_no_args[property]\n }\n\n // If we've got a result already, return it.\n if (cachedValue !== UNSET) {\n return cachedValue === UNDEFINED ? undefined : cachedValue\n }\n\n // Otherwise calculate what it should be once and cache it.\n const value = original.apply(this, args)\n const v = value === undefined ? UNDEFINED : value\n\n if (takesArguments) {\n this.__cache = setIn(this.__cache, keys, v)\n } else {\n this.__cache_no_args[property] = v\n }\n\n return value\n }\n }\n}\n\n/**\n * Get a value at a key path in a tree of Map.\n *\n * If not set, returns UNSET.\n * If the set value is undefined, returns UNDEFINED.\n *\n * @param {Map} map\n * @param {Array} keys\n * @return {Any|UNSET|UNDEFINED}\n */\n\nfunction getIn(map, keys) {\n for (const key of keys) {\n map = map.get(key)\n if (map === UNSET) return UNSET\n }\n\n return map.get(LEAF)\n}\n\n/**\n * Set a value at a key path in a tree of Map, creating Maps on the go.\n *\n * @param {Map} map\n * @param {Array} keys\n * @param {Any} value\n * @return {Map}\n */\n\nfunction setIn(map, keys, value) {\n let parent = map\n let child\n\n for (const key of keys) {\n child = parent.get(key)\n\n // If the path was not created yet...\n if (child === UNSET) {\n child = new Map() // eslint-disable-line no-undef,no-restricted-globals\n parent.set(key, child)\n }\n\n parent = child\n }\n\n // The whole path has been created, so set the value to the bottom most map.\n child.set(LEAF, value)\n return map\n}\n\n/**\n * In DEV mode, clears the previously memoized values, globally.\n *\n * @return {Void}\n */\n\nfunction resetMemoization() {\n CACHE_KEY++\n\n if (CACHE_KEY >= Number.MAX_SAFE_INTEGER) {\n CACHE_KEY = 0\n }\n}\n\n/**\n * In DEV mode, enable or disable the use of memoize values, globally.\n *\n * @param {Boolean} enabled\n * @return {Void}\n */\n\nfunction useMemoization(enabled) {\n ENABLED = enabled\n}\n\n/**\n * Export.\n *\n * @type {Object}\n */\n\nexport default memoize\nexport { resetMemoization, useMemoization }\n","import isPlainObject from 'is-plain-object'\nimport logger from 'slate-dev-logger'\nimport { Map, Record, Set } from 'immutable'\n\nimport MODEL_TYPES from '../constants/model-types'\nimport Data from './data'\nimport memoize from '../utils/memoize'\n\n/**\n * Default properties.\n *\n * @type {Object}\n */\n\nconst DEFAULTS = {\n data: new Map(),\n type: undefined,\n}\n\n/**\n * Mark.\n *\n * @type {Mark}\n */\n\nclass Mark extends Record(DEFAULTS) {\n /**\n * Create a new `Mark` with `attrs`.\n *\n * @param {Object|Mark} attrs\n * @return {Mark}\n */\n\n static create(attrs = {}) {\n if (Mark.isMark(attrs)) {\n return attrs\n }\n\n if (typeof attrs == 'string') {\n attrs = { type: attrs }\n }\n\n if (isPlainObject(attrs)) {\n return Mark.fromJSON(attrs)\n }\n\n throw new Error(\n `\\`Mark.create\\` only accepts objects, strings or marks, but you passed it: ${attrs}`\n )\n }\n\n /**\n * Create a set of marks.\n *\n * @param {Array<Object|Mark>} elements\n * @return {Set<Mark>}\n */\n\n static createSet(elements) {\n if (Set.isSet(elements) || Array.isArray(elements)) {\n const marks = new Set(elements.map(Mark.create))\n return marks\n }\n\n if (elements == null) {\n return new Set()\n }\n\n throw new Error(\n `\\`Mark.createSet\\` only accepts sets, arrays or null, but you passed it: ${elements}`\n )\n }\n\n /**\n * Create a dictionary of settable mark properties from `attrs`.\n *\n * @param {Object|String|Mark} attrs\n * @return {Object}\n */\n\n static createProperties(attrs = {}) {\n if (Mark.isMark(attrs)) {\n return {\n data: attrs.data,\n type: attrs.type,\n }\n }\n\n if (typeof attrs == 'string') {\n return { type: attrs }\n }\n\n if (isPlainObject(attrs)) {\n const props = {}\n if ('type' in attrs) props.type = attrs.type\n if ('data' in attrs) props.data = Data.create(attrs.data)\n return props\n }\n\n throw new Error(\n `\\`Mark.createProperties\\` only accepts objects, strings or marks, but you passed it: ${attrs}`\n )\n }\n\n /**\n * Create a `Mark` from a JSON `object`.\n *\n * @param {Object} object\n * @return {Mark}\n */\n\n static fromJSON(object) {\n const { data = {}, type } = object\n\n if (typeof type != 'string') {\n throw new Error('`Mark.fromJS` requires a `type` string.')\n }\n\n const mark = new Mark({\n type,\n data: new Map(data),\n })\n\n return mark\n }\n\n /**\n * Alias `fromJS`.\n */\n\n static fromJS = Mark.fromJSON\n\n /**\n * Check if `any` is a `Mark`.\n *\n * @param {Any} any\n * @return {Boolean}\n */\n\n static isMark(any) {\n return !!(any && any[MODEL_TYPES.MARK])\n }\n\n /**\n * Check if `any` is a set of marks.\n *\n * @param {Any} any\n * @return {Boolean}\n */\n\n static isMarkSet(any) {\n return Set.isSet(any) && any.every(item => Mark.isMark(item))\n }\n\n /**\n * Object.\n */\n\n get object() {\n return 'mark'\n }\n\n get kind() {\n logger.deprecate(\n 'slate@0.32.0',\n 'The `kind` property of Slate objects has been renamed to `object`.'\n )\n return this.object\n }\n\n /**\n * Get the component for the node from a `schema`.\n *\n * @param {Schema} schema\n * @return {Component|Void}\n */\n\n getComponent(schema) {\n return schema.__getComponent(this)\n }\n\n /**\n * Return a JSON representation of the mark.\n *\n * @return {Object}\n */\n\n toJSON() {\n const object = {\n object: this.object,\n type: this.type,\n data: this.data.toJSON(),\n }\n\n return object\n }\n\n /**\n * Alias `toJS`.\n */\n\n toJS() {\n return this.toJSON()\n }\n}\n\n/**\n * Attach a pseudo-symbol for type checking.\n */\n\nMark.prototype[MODEL_TYPES.MARK] = true\n\n/**\n * Memoize read methods.\n */\n\nmemoize(Mark.prototype, ['getComponent'])\n\n/**\n * Export.\n *\n * @type {Mark}\n */\n\nexport default Mark\n","import isPlainObject from 'is-plain-object'\nimport logger from 'slate-dev-logger'\nimport { List, Record, Set } from 'immutable'\n\nimport MODEL_TYPES from '../constants/model-types'\nimport Mark from './mark'\n\n/**\n * Default properties.\n *\n * @type {Object}\n */\n\nconst DEFAULTS = {\n anchorKey: null,\n anchorOffset: 0,\n focusKey: null,\n focusOffset: 0,\n isBackward: null,\n isFocused: false,\n marks: null,\n atomic: false,\n}\n\n/**\n * Range.\n *\n * @type {Range}\n */\n\nclass Range extends Record(DEFAULTS) {\n /**\n * Create a new `Range` with `attrs`.\n *\n * @param {Object|Range} attrs\n * @return {Range}\n */\n\n static create(attrs = {}) {\n if (Range.isRange(attrs)) {\n return attrs\n }\n\n if (isPlainObject(attrs)) {\n return Range.fromJSON(attrs)\n }\n\n throw new Error(\n `\\`Range.create\\` only accepts objects or ranges, but you passed it: ${attrs}`\n )\n }\n\n /**\n * Create a list of `Ranges` from `elements`.\n *\n * @param {Array<Range|Object>|List<Range|Object>} elements\n * @return {List<Range>}\n */\n\n static createList(elements = []) {\n if (List.isList(elements) || Array.isArray(elements)) {\n const list = new List(elements.map(Range.create))\n return list\n }\n\n throw new Error(\n `\\`Range.createList\\` only accepts arrays or lists, but you passed it: ${elements}`\n )\n }\n\n /**\n * Create a dictionary of settable range properties from `attrs`.\n *\n * @param {Object|String|Range} attrs\n * @return {Object}\n */\n\n static createProperties(attrs = {}) {\n if (Range.isRange(attrs)) {\n return {\n anchorKey: attrs.anchorKey,\n anchorOffset: attrs.anchorOffset,\n focusKey: attrs.focusKey,\n focusOffset: attrs.focusOffset,\n isBackward: attrs.isBackward,\n isFocused: attrs.isFocused,\n marks: attrs.marks,\n atomic: attrs.atomic,\n }\n }\n\n if (isPlainObject(attrs)) {\n const props = {}\n if ('anchorKey' in attrs) props.anchorKey = attrs.anchorKey\n if ('anchorOffset' in attrs) props.anchorOffset = attrs.anchorOffset\n if ('anchorPath' in attrs) props.anchorPath = attrs.anchorPath\n if ('focusKey' in attrs) props.focusKey = attrs.focusKey\n if ('focusOffset' in attrs) props.focusOffset = attrs.focusOffset\n if ('focusPath' in attrs) props.focusPath = attrs.focusPath\n if ('isBackward' in attrs) props.isBackward = attrs.isBackward\n if ('isFocused' in attrs) props.isFocused = attrs.isFocused\n if ('marks' in attrs)\n props.marks = attrs.marks == null ? null : Mark.createSet(attrs.marks)\n if ('atomic' in attrs) props.atomic = attrs.atomic\n return props\n }\n\n throw new Error(\n `\\`Range.createProperties\\` only accepts objects or ranges, but you passed it: ${attrs}`\n )\n }\n\n /**\n * Create a `Range` from a JSON `object`.\n *\n * @param {Object} object\n * @return {Range}\n */\n\n static fromJSON(object) {\n const {\n anchorKey = null,\n anchorOffset = 0,\n focusKey = null,\n focusOffset = 0,\n isBackward = null,\n isFocused = false,\n marks = null,\n atomic = false,\n } = object\n\n const range = new Range({\n anchorKey,\n anchorOffset,\n focusKey,\n focusOffset,\n isBackward,\n isFocused,\n marks: marks == null ? null : new Set(marks.map(Mark.fromJSON)),\n atomic,\n })\n\n return range\n }\n\n /**\n * Alias `fromJS`.\n */\n\n static fromJS = Range.fromJSON\n\n /**\n * Check if an `obj` is a `Range`.\n *\n * @param {Any} obj\n * @return {Boolean}\n */\n\n static isRange(obj) {\n return !!(obj && obj[MODEL_TYPES.RANGE])\n }\n\n /**\n * Object.\n *\n * @return {String}\n */\n\n get object() {\n return 'range'\n }\n\n get kind() {\n logger.deprecate(\n 'slate@0.32.0',\n 'The `kind` property of Slate objects has been renamed to `object`.'\n )\n return this.object\n }\n\n /**\n * Check whether the range is blurred.\n *\n * @return {Boolean}\n */\n\n get isBlurred() {\n return !this.isFocused\n }\n\n /**\n * Check whether the range is collapsed.\n *\n * @return {Boolean}\n */\n\n get isCollapsed() {\n return (\n this.anchorKey == this.focusKey && this.anchorOffset == this.focusOffset\n )\n }\n\n /**\n * Check whether the range is expanded.\n *\n * @return {Boolean}\n */\n\n get isExpanded() {\n return !this.isCollapsed\n }\n\n /**\n * Check whether the range is forward.\n *\n * @return {Boolean}\n */\n\n get isForward() {\n return this.isBackward == null ? null : !this.isBackward\n }\n\n /**\n * Check whether the range's keys are set.\n *\n * @return {Boolean}\n */\n\n get isSet() {\n return this.anchorKey != null && this.focusKey != null\n }\n\n /**\n * Check whether the range's keys are not set.\n *\n * @return {Boolean}\n */\n\n get isUnset() {\n return !this.isSet\n }\n\n /**\n * Get the start key.\n *\n * @return {String}\n */\n\n get startKey() {\n return this.isBackward ? this.focusKey : this.anchorKey\n }\n\n /**\n * Get the start offset.\n *\n * @return {String}\n */\n\n get startOffset() {\n return this.isBackward ? this.focusOffset : this.anchorOffset\n }\n\n /**\n * Get the end key.\n *\n * @return {String}\n */\n\n get endKey() {\n return this.isBackward ? this.anchorKey : this.focusKey\n }\n\n /**\n * Get the end offset.\n *\n * @return {String}\n */\n\n get endOffset() {\n return this.isBackward ? this.anchorOffset : this.focusOffset\n }\n\n /**\n * Check whether anchor point of the range is at the start of a `node`.\n *\n * @param {Node} node\n * @return {Boolean}\n */\n\n hasAnchorAtStartOf(node) {\n // PERF: Do a check for a `0` offset first since it's quickest.\n if (this.anchorOffset != 0) return false\n const first = getFirst(node)\n return this.anchorKey == first.key\n }\n\n /**\n * Check whether anchor point of the range is at the end of a `node`.\n *\n * @param {Node} node\n * @return {Boolean}\n */\n\n hasAnchorAtEndOf(node) {\n const last = getLast(node)\n return this.anchorKey == last.key && this.anchorOffset == last.text.length\n }\n\n /**\n * Check whether the anchor edge of a range is in a `node` and at an\n * offset between `start` and `end`.\n *\n * @param {Node} node\n * @param {Number} start\n * @param {Number} end\n * @return {Boolean}\n */\n\n hasAnchorBetween(node, start, end) {\n return (\n this.anchorOffset <= end &&\n start <= this.anchorOffset &&\n this.hasAnchorIn(node)\n )\n }\n\n /**\n * Check whether the anchor edge of a range is in a `node`.\n *\n * @param {Node} node\n * @return {Boolean}\n */\n\n hasAnchorIn(node) {\n return node.object == 'text'\n ? node.key == this.anchorKey\n : this.anchorKey != null && node.hasDescendant(this.anchorKey)\n }\n\n /**\n * Check whether focus point of the range is at the end of a `node`.\n *\n * @param {Node} node\n * @return {Boolean}\n */\n\n hasFocusAtEndOf(node) {\n const last = getLast(node)\n return this.focusKey == last.key && this.focusOffset == last.text.length\n }\n\n /**\n * Check whether focus point of the range is at the start of a `node`.\n *\n * @param {Node} node\n * @return {Boolean}\n */\n\n hasFocusAtStartOf(node) {\n if (this.focusOffset != 0) return false\n const first = getFirst(node)\n return this.focusKey == first.key\n }\n\n /**\n * Check whether the focus edge of a range is in a `node` and at an\n * offset between `start` and `end`.\n *\n * @param {Node} node\n * @param {Number} start\n * @param {Number} end\n * @return {Boolean}\n */\n\n hasFocusBetween(node, start, end) {\n return (\n start <= this.focusOffset &&\n this.focusOffset <= end &&\n this.hasFocusIn(node)\n )\n }\n\n /**\n * Check whether the focus edge of a range is in a `node`.\n *\n * @param {Node} node\n * @return {Boolean}\n */\n\n hasFocusIn(node) {\n return node.object == 'text'\n ? node.key == this.focusKey\n : this.focusKey != null && node.hasDescendant(this.focusKey)\n }\n\n /**\n * Check whether the range is at the start of a `node`.\n *\n * @param {Node} node\n * @return {Boolean}\n */\n\n isAtStartOf(node) {\n return this.isCollapsed && this.hasAnchorAtStartOf(node)\n }\n\n /**\n * Check whether the range is at the end of a `node`.\n *\n * @param {Node} node\n * @return {Boolean}\n */\n\n isAtEndOf(node) {\n return this.isCollapsed && this.hasAnchorAtEndOf(node)\n }\n\n /**\n * Focus the range.\n *\n * @return {Range}\n */\n\n focus() {\n return this.merge({\n isFocused: true,\n })\n }\n\n /**\n * Blur the range.\n *\n * @return {Range}\n */\n\n blur() {\n return this.merge({\n isFocused: false,\n })\n }\n\n /**\n * Unset the range.\n *\n * @return {Range}\n */\n\n deselect() {\n return this.merge({\n anchorKey: null,\n anchorOffset: 0,\n focusKey: null,\n focusOffset: 0,\n isFocused: false,\n isBackward: false,\n })\n }\n\n /**\n * Flip the range.\n *\n * @return {Range}\n */\n\n flip() {\n return this.merge({\n anchorKey: this.focusKey,\n anchorOffset: this.focusOffset,\n focusKey: this.anchorKey,\n focusOffset: this.anchorOffset,\n isBackward: this.isBackward == null ? null : !this.isBackward,\n })\n }\n\n /**\n * Move the anchor offset `n` characters.\n *\n * @param {Number} n (optional)\n * @return {Range}\n */\n\n moveAnchor(n = 1) {\n const { anchorKey, focusKey, focusOffset, isBackward } = this\n const anchorOffset = this.anchorOffset + n\n return this.merge({\n anchorOffset,\n isBackward:\n anchorKey == focusKey ? anchorOffset > focusOffset : isBackward,\n })\n }\n\n /**\n * Move the anchor offset `n` characters.\n *\n * @param {Number} n (optional)\n * @return {Range}\n */\n\n moveFocus(n = 1) {\n const { anchorKey, anchorOffset, focusKey, isBackward } = this\n const focusOffset = this.focusOffset + n\n return this.merge({\n focusOffset,\n isBackward:\n focusKey == anchorKey ? anchorOffset > focusOffset : isBackward,\n })\n }\n\n /**\n * Move the range's anchor point to a `key` and `offset`.\n *\n * @param {String} key\n * @param {Number} offset\n * @return {Range}\n */\n\n moveAnchorTo(key, offset) {\n const { anchorKey, focusKey, focusOffset, isBackward } = this\n return this.merge({\n anchorKey: key,\n anchorOffset: offset,\n isBackward:\n key == focusKey\n ? offset > focusOffset\n : key == anchorKey ? isBackward : null,\n })\n }\n\n /**\n * Move the range's focus point to a `key` and `offset`.\n *\n * @param {String} key\n * @param {Number} offset\n * @return {Range}\n */\n\n moveFocusTo(key, offset) {\n const { focusKey, anchorKey, anchorOffset, isBackward } = this\n return this.merge({\n focusKey: key,\n focusOffset: offset,\n isBackward:\n key == anchorKey\n ? anchorOffset > offset\n : key == focusKey ? isBackward : null,\n })\n }\n\n /**\n * Move the range to `anchorOffset`.\n *\n * @param {Number} anchorOffset\n * @return {Range}\n */\n\n moveAnchorOffsetTo(anchorOffset) {\n return this.merge({\n anchorOffset,\n isBackward:\n this.anchorKey == this.focusKey\n ? anchorOffset > this.focusOffset\n : this.isBackward,\n })\n }\n\n /**\n * Move the range to `focusOffset`.\n *\n * @param {Number} focusOffset\n * @return {Range}\n */\n\n moveFocusOffsetTo(focusOffset) {\n return this.merge({\n focusOffset,\n isBackward:\n this.anchorKey == this.focusKey\n ? this.anchorOffset > focusOffset\n : this.isBackward,\n })\n }\n\n /**\n * Move the range to `anchorOffset` and `focusOffset`.\n *\n * @param {Number} anchorOffset\n * @param {Number} focusOffset (optional)\n * @return {Range}\n */\n\n moveOffsetsTo(anchorOffset, focusOffset = anchorOffset) {\n return this.moveAnchorOffsetTo(anchorOffset).moveFocusOffsetTo(focusOffset)\n }\n\n /**\n * Move the focus point to the anchor point.\n *\n * @return {Range}\n */\n\n moveToAnchor() {\n return this.moveFocusTo(this.anchorKey, this.anchorOffset)\n }\n\n /**\n * Move the anchor point to the focus point.\n *\n * @return {Range}\n */\n\n moveToFocus() {\n return this.moveAnchorTo(this.focusKey, this.focusOffset)\n }\n\n /**\n * Move the range's anchor point to the start of a `node`.\n *\n * @param {Node} node\n * @return {Range}\n */\n\n moveAnchorToStartOf(node) {\n node = getFirst(node)\n return this.moveAnchorTo(node.key, 0)\n }\n\n /**\n * Move the range's anchor point to the end of a `node`.\n *\n * @param {Node} node\n * @return {Range}\n */\n\n moveAnchorToEndOf(node) {\n node = getLast(node)\n return this.moveAnchorTo(node.key, node.text.length)\n }\n\n /**\n * Move the range's focus point to the start of a `node`.\n *\n * @param {Node} node\n * @return {Range}\n */\n\n moveFocusToStartOf(node) {\n node = getFirst(node)\n return this.moveFocusTo(node.key, 0)\n }\n\n /**\n * Move the range's focus point to the end of a `node`.\n *\n * @param {Node} node\n * @return {Range}\n */\n\n moveFocusToEndOf(node) {\n node = getLast(node)\n return this.moveFocusTo(node.key, node.text.length)\n }\n\n /**\n * Move to the entire range of `start` and `end` nodes.\n *\n * @param {Node} start\n * @param {Node} end (optional)\n * @return {Range}\n */\n\n moveToRangeOf(start, end = start) {\n const range = this.isBackward ? this.flip() : this\n return range.moveAnchorToStartOf(start).moveFocusToEndOf(end)\n }\n\n /**\n * Normalize the range, relative to a `node`, ensuring that the anchor\n * and focus nodes of the range always refer to leaf text nodes.\n *\n * @param {Node} node\n * @return {Range}\n */\n\n normalize(node) {\n const range = this\n let { anchorKey, anchorOffset, focusKey, focusOffset, isBackward } = range\n\n const anchorOffsetType = typeof anchorOffset\n const focusOffsetType = typeof focusOffset\n if (anchorOffsetType != 'number' || focusOffsetType != 'number') {\n logger.warn(\n `The range offsets should be numbers, but they were of type \"${anchorOffsetType}\" and \"${focusOffsetType}\".`\n )\n }\n\n // If the range is unset, make sure it is properly zeroed out.\n if (anchorKey == null || focusKey == null) {\n return range.merge({\n anchorKey: null,\n anchorOffset: 0,\n focusKey: null,\n focusOffset: 0,\n isBackward: false,\n })\n }\n\n // Get the anchor and focus nodes.\n let anchorNode = node.getDescendant(anchorKey)\n let focusNode = node.getDescendant(focusKey)\n\n // If the range is malformed, warn and zero it out.\n if (!anchorNode || !focusNode) {\n logger.warn(\n 'The range was invalid and was reset. The range in question was:',\n range\n )\n const first = node.getFirstText()\n return range.merge({\n anchorKey: first ? first.key : null,\n anchorOffset: 0,\n focusKey: first ? first.key : null,\n focusOffset: 0,\n isBackward: false,\n })\n }\n\n // If the anchor node isn't a text node, match it to one.\n if (anchorNode.object != 'text') {\n logger.warn(\n 'The range anchor was set to a Node that is not a Text node. This should not happen and can degrade performance. The node in question was:',\n anchorNode\n )\n const anchorText = anchorNode.getTextAtOffset(anchorOffset)\n const offset = anchorNode.getOffset(anchorText.key)\n anchorOffset = anchorOffset - offset\n anchorNode = anchorText\n }\n\n // If the focus node isn't a text node, match it to one.\n if (focusNode.object != 'text') {\n logger.warn(\n 'The range focus was set to a Node that is not a Text node. This should not happen and can degrade performance. The node in question was:',\n focusNode\n )\n const focusText = focusNode.getTextAtOffset(focusOffset)\n const offset = focusNode.getOffset(focusText.key)\n focusOffset = focusOffset - offset\n focusNode = focusText\n }\n\n // If `isBackward` is not set, derive it.\n if (isBackward == null) {\n if (anchorNode.key === focusNode.key) {\n isBackward = anchorOffset > focusOffset\n } else {\n isBackward = !node.areDescendantsSorted(anchorNode.key, focusNode.key)\n }\n }\n\n // Merge in any updated properties.\n return range.merge({\n anchorKey: anchorNode.key,\n anchorOffset,\n focusKey: focusNode.key,\n focusOffset,\n isBackward,\n })\n }\n\n /**\n * Return a JSON representation of the range.\n *\n * @return {Object}\n */\n\n toJSON() {\n const object = {\n object: this.object,\n anchorKey: this.anchorKey,\n anchorOffset: this.anchorOffset,\n focusKey: this.focusKey,\n focusOffset: this.focusOffset,\n isBackward: this.isBackward,\n isFocused: this.isFocused,\n marks:\n this.marks == null ? null : this.marks.toArray().map(m => m.toJSON()),\n atomic: this.atomic,\n }\n\n return object\n }\n\n /**\n * Alias `toJS`.\n */\n\n toJS() {\n return this.toJSON()\n }\n}\n\n/**\n * Attach a pseudo-symbol for type checking.\n */\n\nRange.prototype[MODEL_TYPES.RANGE] = true\n\n/**\n * Mix in some \"move\" convenience methods.\n */\n\nconst MOVE_METHODS = [\n ['move', ''],\n ['move', 'To'],\n ['move', 'ToStartOf'],\n ['move', 'ToEndOf'],\n]\n\nMOVE_METHODS.forEach(([p, s]) => {\n Range.prototype[`${p}${s}`] = function(...args) {\n return this[`${p}Anchor${s}`](...args)[`${p}Focus${s}`](...args)\n }\n})\n\n/**\n * Mix in the \"start\", \"end\" and \"edge\" convenience methods.\n */\n\nconst EDGE_METHODS = [\n ['has', 'AtStartOf', true],\n ['has', 'AtEndOf', true],\n ['has', 'Between', true],\n ['has', 'In', true],\n ['collapseTo', ''],\n ['move', ''],\n ['moveTo', ''],\n ['move', 'To'],\n ['move', 'OffsetTo'],\n]\n\nEDGE_METHODS.forEach(([p, s, hasEdge]) => {\n const anchor = `${p}Anchor${s}`\n const focus = `${p}Focus${s}`\n\n Range.prototype[`${p}Start${s}`] = function(...args) {\n return this.isBackward ? this[focus](...args) : this[anchor](...args)\n }\n\n Range.prototype[`${p}End${s}`] = function(...args) {\n return this.isBackward ? this[anchor](...args) : this[focus](...args)\n }\n\n if (hasEdge) {\n Range.prototype[`${p}Edge${s}`] = function(...args) {\n return this[anchor](...args) || this[focus](...args)\n }\n }\n})\n\n/**\n * Mix in some aliases for convenience / parallelism with the browser APIs.\n */\n\nconst ALIAS_METHODS = [\n ['collapseTo', 'moveTo'],\n ['collapseToAnchor', 'moveToAnchor'],\n ['collapseToFocus', 'moveToFocus'],\n ['collapseToStart', 'moveToStart'],\n ['collapseToEnd', 'moveToEnd'],\n ['collapseToStartOf', 'moveToStartOf'],\n ['collapseToEndOf', 'moveToEndOf'],\n ['extend', 'moveFocus'],\n ['extendTo', 'moveFocusTo'],\n ['extendToStartOf', 'moveFocusToStartOf'],\n ['extendToEndOf', 'moveFocusToEndOf'],\n]\n\nALIAS_METHODS.forEach(([alias, method]) => {\n Range.prototype[alias] = function(...args) {\n return this[method](...args)\n }\n})\n\n/**\n * Get the first text of a `node`.\n *\n * @param {Node} node\n * @return {Text}\n */\n\nfunction getFirst(node) {\n return node.object == 'text' ? node : node.getFirstText()\n}\n\n/**\n * Get the last text of a `node`.\n *\n * @param {Node} node\n * @return {Text}\n */\n\nfunction getLast(node) {\n return node.object == 'text' ? node : node.getLastText()\n}\n\n/**\n * Export.\n *\n * @type {Range}\n */\n\nexport default Range\n","import isPlainObject from 'is-plain-object'\nimport logger from 'slate-dev-logger'\nimport { List, Record, Set } from 'immutable'\n\nimport MODEL_TYPES from '../constants/model-types'\n\n/**\n * Default properties.\n *\n * @type {Object}\n */\n\nconst DEFAULTS = {\n marks: new Set(),\n text: '',\n}\n\n/**\n * Character.\n *\n * @type {Character}\n */\n\nclass Character extends Record(DEFAULTS) {\n /**\n * Create a `Character` with `attrs`.\n *\n * @param {Object|String|Character} attrs\n * @return {Character}\n */\n\n static create(attrs = {}) {\n if (Character.isCharacter(attrs)) {\n return attrs\n }\n\n if (typeof attrs == 'string') {\n attrs = { text: attrs }\n }\n\n if (isPlainObject(attrs)) {\n return Character.fromJSON(attrs)\n }\n\n throw new Error(\n `\\`Character.create\\` only accepts objects, strings or characters, but you passed it: ${attrs}`\n )\n }\n\n /**\n * Create a list of `Characters` from `elements`.\n *\n * @param {String|Array<Object|Character|String>|List<Object|Character|String>} elements\n * @return {List<Character>}\n */\n\n static createList(elements = []) {\n if (typeof elements == 'string') {\n elements = elements.split('')\n }\n\n if (List.isList(elements) || Array.isArray(elements)) {\n const list = new List(elements.map(Character.create))\n return list\n }\n\n throw new Error(\n `\\`Block.createList\\` only accepts strings, arrays or lists, but you passed it: ${elements}`\n )\n }\n\n /**\n * Create a `Character` from a JSON `object`.\n *\n * @param {Object} object\n * @return {Character}\n */\n\n static fromJSON(object) {\n const { text, marks = [] } = object\n\n if (typeof text != 'string') {\n throw new Error('`Character.fromJSON` requires a block `text` string.')\n }\n\n const character = new Character({\n text,\n marks: new Set(marks),\n })\n\n return character\n }\n\n /**\n * Alias `fromJS`.\n */\n\n static fromJS = Character.fromJSON\n\n /**\n * Check if `any` is a `Character`.\n *\n * @param {Any} any\n * @return {Boolean}\n */\n\n static isCharacter(any) {\n return !!(any && any[MODEL_TYPES.CHARACTER])\n }\n\n /**\n * Check if `any` is a character list.\n *\n * @param {Any} any\n * @return {Boolean}\n */\n\n static isCharacterList(any) {\n return List.isList(any) && any.every(item => Character.isCharacter(item))\n }\n\n /**\n * Object.\n *\n * @return {String}\n */\n\n get object() {\n return 'character'\n }\n\n get kind() {\n logger.deprecate(\n 'slate@0.32.0',\n 'The `kind` property of Slate objects has been renamed to `object`.'\n )\n return this.object\n }\n\n /**\n * Return a JSON representation of the character.\n *\n * @return {Object}\n */\n\n toJSON() {\n const object = {\n object: this.object,\n text: this.text,\n marks: this.marks.toArray().map(m => m.toJSON()),\n }\n\n return object\n }\n\n /**\n * Alias `toJS`.\n */\n\n toJS() {\n return this.toJSON()\n }\n}\n\n/**\n * Attach a pseudo-symbol for type checking.\n */\n\nCharacter.prototype[MODEL_TYPES.CHARACTER] = true\n\n/**\n * Export.\n *\n * @type {Character}\n */\n\nexport default Character\n","import isPlainObject from 'is-plain-object'\nimport logger from 'slate-dev-logger'\nimport { List, Record, Set } from 'immutable'\n\nimport MODEL_TYPES from '../constants/model-types'\nimport Character from './character'\nimport Mark from './mark'\n\n/**\n * Default properties.\n *\n * @type {Object}\n */\n\nconst DEFAULTS = {\n marks: new Set(),\n text: '',\n}\n\n/**\n * Leaf.\n *\n * @type {Leaf}\n */\n\nclass Leaf extends Record(DEFAULTS) {\n /**\n * Create a new `Leaf` with `attrs`.\n *\n * @param {Object|Leaf} attrs\n * @return {Leaf}\n */\n\n static create(attrs = {}) {\n if (Leaf.isLeaf(attrs)) {\n return attrs\n }\n\n if (typeof attrs == 'string') {\n attrs = { text: attrs }\n }\n\n if (isPlainObject(attrs)) {\n return Leaf.fromJSON(attrs)\n }\n\n throw new Error(\n `\\`Leaf.create\\` only accepts objects, strings or leaves, but you passed it: ${attrs}`\n )\n }\n\n /**\n * Create a `Leaf` list from `attrs`.\n *\n * @param {Array<Leaf|Object>|List<Leaf|Object>} attrs\n * @return {List<Leaf>}\n */\n\n static createList(attrs = []) {\n if (List.isList(attrs) || Array.isArray(attrs)) {\n const list = new List(attrs.map(Leaf.create))\n return list\n }\n\n throw new Error(\n `\\`Leaf.createList\\` only accepts arrays or lists, but you passed it: ${attrs}`\n )\n }\n\n /**\n * Create a `Leaf` from a JSON `object`.\n *\n * @param {Object} object\n * @return {Leaf}\n */\n\n static fromJSON(object) {\n const { text = '', marks = [] } = object\n\n const leaf = new Leaf({\n text,\n marks: new Set(marks.map(Mark.fromJSON)),\n })\n\n return leaf\n }\n\n /**\n * Alias `fromJS`.\n */\n\n static fromJS = Leaf.fromJSON\n\n /**\n * Check if `any` is a `Leaf`.\n *\n * @param {Any} any\n * @return {Boolean}\n */\n\n static isLeaf(any) {\n return !!(any && any[MODEL_TYPES.LEAF])\n }\n\n /**\n * Check if `any` is a list of leaves.\n *\n * @param {Any} any\n * @return {Boolean}\n */\n\n static isLeafList(any) {\n return List.isList(any) && any.every(item => Leaf.isLeaf(item))\n }\n\n /**\n * Object.\n *\n * @return {String}\n */\n\n get object() {\n return 'leaf'\n }\n\n get kind() {\n logger.deprecate(\n 'slate@0.32.0',\n 'The `kind` property of Slate objects has been renamed to `object`.'\n )\n return this.object\n }\n\n /**\n * Return leaf as a list of characters\n *\n * @return {List<Character>}\n */\n\n getCharacters() {\n const { marks } = this\n const characters = Character.createList(\n this.text.split('').map(char => {\n return Character.create({\n text: char,\n marks,\n })\n })\n )\n\n return characters\n }\n\n /**\n * Return a JSON representation of the leaf.\n *\n * @return {Object}\n */\n\n toJSON() {\n const object = {\n object: this.object,\n text: this.text,\n marks: this.marks.toArray().map(m => m.toJSON()),\n }\n\n return object\n }\n\n /**\n * Alias `toJS`.\n */\n\n toJS() {\n return this.toJSON()\n }\n}\n\n/**\n * Attach a pseudo-symbol for type checking.\n */\n\nLeaf.prototype[MODEL_TYPES.LEAF] = true\n\n/**\n * Export.\n *\n * @type {Leaf}\n */\n\nexport default Leaf\n","/**\n * An auto-incrementing index for generating keys.\n *\n * @type {Number}\n */\n\nlet n\n\n/**\n * The global key generating function.\n *\n * @type {Function}\n */\n\nlet generate\n\n/**\n * Generate a key.\n *\n * @return {String}\n */\n\nfunction generateKey() {\n return generate()\n}\n\n/**\n * Set a different unique ID generating `function`.\n *\n * @param {Function} func\n */\n\nfunction setKeyGenerator(func) {\n generate = func\n}\n\n/**\n * Reset the key generating function to its initial state.\n */\n\nfunction resetKeyGenerator() {\n n = 0\n generate = () => `${n++}`\n}\n\n/**\n * Set the initial state.\n */\n\nresetKeyGenerator()\n\n/**\n * Export.\n *\n * @type {Object}\n */\n\nexport default generateKey\nexport { setKeyGenerator, resetKeyGenerator }\n","import isPlainObject from 'is-plain-object'\nimport logger from 'slate-dev-logger'\nimport { List, OrderedSet, Record, Set, is } from 'immutable'\n\nimport Character from './character'\nimport Mark from './mark'\nimport Leaf from './leaf'\nimport MODEL_TYPES from '../constants/model-types'\nimport generateKey from '../utils/generate-key'\nimport memoize from '../utils/memoize'\n\n/**\n * Default properties.\n *\n * @type {Object}\n */\n\nconst DEFAULTS = {\n characters: new List(),\n key: undefined,\n}\n\n/**\n * Text.\n *\n * @type {Text}\n */\n\nclass Text extends Record(DEFAULTS) {\n /**\n * Create a new `Text` with `attrs`.\n *\n * @param {Object|Array|List|String|Text} attrs\n * @return {Text}\n */\n\n static create(attrs = '') {\n if (Text.isText(attrs)) {\n return attrs\n }\n\n if (typeof attrs == 'string') {\n attrs = { leaves: [{ text: attrs }] }\n }\n\n if (isPlainObject(attrs)) {\n if (attrs.text) {\n const { text, marks, key } = attrs\n attrs = { key, leaves: [{ text, marks }] }\n }\n\n return Text.fromJSON(attrs)\n }\n\n throw new Error(\n `\\`Text.create\\` only accepts objects, arrays, strings or texts, but you passed it: ${attrs}`\n )\n }\n\n /**\n * Create a list of `Texts` from `elements`.\n *\n * @param {Array<Text|Object>|List<Text|Object>} elements\n * @return {List<Text>}\n */\n\n static createList(elements = []) {\n if (List.isList(elements) || Array.isArray(elements)) {\n const list = new List(elements.map(Text.create))\n return list\n }\n\n throw new Error(\n `\\`Text.createList\\` only accepts arrays or lists, but you passed it: ${elements}`\n )\n }\n\n /**\n * Create a `Text` from a JSON `object`.\n *\n * @param {Object|Text} object\n * @return {Text}\n */\n\n static fromJSON(object) {\n if (Text.isText(object)) {\n return object\n }\n\n const { leaves = [], key = generateKey() } = object\n\n const characters = leaves\n .map(Leaf.fromJSON)\n .reduce((l, r) => l.concat(r.getCharacters()), new List())\n\n const node = new Text({\n characters,\n key,\n })\n\n return node\n }\n\n /**\n * Alias `fromJS`.\n */\n\n static fromJS = Text.fromJSON\n\n /**\n * Check if `any` is a `Text`.\n *\n * @param {Any} any\n * @return {Boolean}\n */\n\n static isText(any) {\n return !!(any && any[MODEL_TYPES.TEXT])\n }\n\n /**\n * Check if `any` is a list of texts.\n *\n * @param {Any} any\n * @return {Boolean}\n */\n\n static isTextList(any) {\n return List.isList(any) && any.every(item => Text.isText(item))\n }\n\n /**\n * Object.\n *\n * @return {String}\n */\n\n get object() {\n return 'text'\n }\n\n get kind() {\n logger.deprecate(\n 'slate@0.32.0',\n 'The `kind` property of Slate objects has been renamed to `object`.'\n )\n return this.object\n }\n\n /**\n * Is the node empty?\n *\n * @return {Boolean}\n */\n\n get isEmpty() {\n return this.text == ''\n }\n\n /**\n * Get the concatenated text of the node.\n *\n * @return {String}\n */\n\n get text() {\n return this.characters.reduce((string, char) => string + char.text, '')\n }\n\n /**\n * Add a `mark` at `index` and `length`.\n *\n * @param {Number} index\n * @param {Number} length\n * @param {Mark} mark\n * @return {Text}\n */\n\n addMark(index, length, mark) {\n const marks = new Set([mark])\n return this.addMarks(index, length, marks)\n }\n\n /**\n * Add a `set` of marks at `index` and `length`.\n *\n * @param {Number} index\n * @param {Number} length\n * @param {Set<Mark>} set\n * @return {Text}\n */\n\n addMarks(index, length, set) {\n const characters = this.characters.map((char, i) => {\n if (i < index) return char\n if (i >= index + length) return char\n let { marks } = char\n marks = marks.union(set)\n char = char.set('marks', marks)\n return char\n })\n\n return this.set('characters', characters)\n }\n\n /**\n * Derive a set of decorated characters with `decorations`.\n *\n * @param {List<Decoration>} decorations\n * @return {List<Character>}\n */\n\n getDecoratedCharacters(decorations) {\n let node = this\n const { key, characters } = node\n\n // PERF: Exit early if there are no characters to be decorated.\n if (characters.size == 0) return characters\n\n decorations.forEach(range => {\n const { startKey, endKey, startOffset, endOffset, marks } = range\n const hasStart = startKey == key\n const hasEnd = endKey == key\n const index = hasStart ? startOffset : 0\n const length = hasEnd ? endOffset - index : characters.size\n node = node.addMarks(index, length, marks)\n })\n\n return node.characters\n }\n\n /**\n * Get the decorations for the node from a `schema`.\n *\n * @param {Schema} schema\n * @return {Array}\n */\n\n getDecorations(schema) {\n return schema.__getDecorations(this)\n }\n\n /**\n * Derive the leaves for a list of `characters`.\n *\n * @param {Array|Void} decorations (optional)\n * @return {List<Leaf>}\n */\n\n getLeaves(decorations = []) {\n const characters = this.getDecoratedCharacters(decorations)\n let leaves = []\n\n // PERF: cache previous values for faster lookup.\n let prevChar\n let prevLeaf\n\n // If there are no characters, return one empty range.\n if (characters.size == 0) {\n leaves.push({})\n } else {\n // Otherwise, loop the characters and build the leaves...\n characters.forEach((char, i) => {\n const { marks, text } = char\n\n // The first one can always just be created.\n if (i == 0) {\n prevChar = char\n prevLeaf = { text, marks }\n leaves.push(prevLeaf)\n return\n }\n\n // Otherwise, compare the current and previous marks.\n const prevMarks = prevChar.marks\n const isSame = is(marks, prevMarks)\n\n // If the marks are the same, add the text to the previous range.\n if (isSame) {\n prevChar = char\n prevLeaf.text += text\n return\n }\n\n // Otherwise, create a new range.\n prevChar = char\n prevLeaf = { text, marks }\n leaves.push(prevLeaf)\n }, [])\n }\n\n // PERF: convert the leaves to immutable objects after iterating.\n leaves = new List(leaves.map(object => new Leaf(object)))\n\n // Return the leaves.\n return leaves\n }\n\n /**\n * Get all of the marks on the text.\n *\n * @return {OrderedSet<Mark>}\n */\n\n getMarks() {\n const array = this.getMarksAsArray()\n return new OrderedSet(array)\n }\n\n /**\n * Get all of the marks on the text as an array\n *\n * @return {Array}\n */\n\n getMarksAsArray() {\n return this.characters.reduce((array, char) => {\n return array.concat(char.marks.toArray())\n }, [])\n }\n\n /**\n * Get the marks on the text at `index`.\n *\n * @param {Number} index\n * @return {Set<Mark>}\n */\n\n getMarksAtIndex(index) {\n if (index == 0) return Mark.createSet()\n const { characters } = this\n const char = characters.get(index - 1)\n if (!char) return Mark.createSet()\n return char.marks\n }\n\n /**\n * Get a node by `key`, to parallel other nodes.\n *\n * @param {String} key\n * @return {Node|Null}\n */\n\n getNode(key) {\n return this.key == key ? this : null\n }\n\n /**\n * Check if the node has a node by `key`, to parallel other nodes.\n *\n * @param {String} key\n * @return {Boolean}\n */\n\n hasNode(key) {\n return !!this.getNode(key)\n }\n\n /**\n * Insert `text` at `index`.\n *\n * @param {Numbder} index\n * @param {String} text\n * @param {String} marks (optional)\n * @return {Text}\n */\n\n insertText(index, text, marks) {\n let { characters } = this\n const chars = Character.createList(\n text.split('').map(char => ({ text: char, marks }))\n )\n\n characters = characters\n .slice(0, index)\n .concat(chars)\n .concat(characters.slice(index))\n\n return this.set('characters', characters)\n }\n\n /**\n * Regenerate the node's key.\n *\n * @return {Text}\n */\n\n regenerateKey() {\n const key = generateKey()\n return this.set('key', key)\n }\n\n /**\n * Remove a `mark` at `index` and `length`.\n *\n * @param {Number} index\n * @param {Number} length\n * @param {Mark} mark\n * @return {Text}\n */\n\n removeMark(index, length, mark) {\n const characters = this.characters.map((char, i) => {\n if (i < index) return char\n if (i >= index + length) return char\n let { marks } = char\n marks = marks.remove(mark)\n char = char.set('marks', marks)\n return char\n })\n\n return this.set('characters', characters)\n }\n\n /**\n * Remove text from the text node at `index` for `length`.\n *\n * @param {Number} index\n * @param {Number} length\n * @return {Text}\n */\n\n removeText(index, length) {\n let { characters } = this\n const start = index\n const end = index + length\n characters = characters.filterNot((char, i) => start <= i && i < end)\n return this.set('characters', characters)\n }\n\n /**\n * Return a JSON representation of the text.\n *\n * @param {Object} options\n * @return {Object}\n */\n\n toJSON(options = {}) {\n const object = {\n object: this.object,\n leaves: this.getLeaves()\n .toArray()\n .map(r => r.toJSON()),\n }\n\n if (options.preserveKeys) {\n object.key = this.key\n }\n\n return object\n }\n\n /**\n * Alias `toJS`.\n */\n\n toJS(options) {\n return this.toJSON(options)\n }\n\n /**\n * Update a `mark` at `index` and `length` with `properties`.\n *\n * @param {Number} index\n * @param {Number} length\n * @param {Mark} mark\n * @param {Object} properties\n * @return {Text}\n */\n\n updateMark(index, length, mark, properties) {\n const newMark = mark.merge(properties)\n\n const characters = this.characters.map((char, i) => {\n if (i < index) return char\n if (i >= index + length) return char\n let { marks } = char\n if (!marks.has(mark)) return char\n marks = marks.remove(mark)\n marks = marks.add(newMark)\n char = char.set('marks', marks)\n return char\n })\n\n return this.set('characters', characters)\n }\n\n /**\n * Validate the text node against a `schema`.\n *\n * @param {Schema} schema\n * @return {Object|Void}\n */\n\n validate(schema) {\n return schema.validateNode(this)\n }\n\n /**\n * Get the first invalid descendant\n * PREF: Do not cache this method; because it can cause cycle reference\n *\n * @param {Schema} schema\n * @returns {Text|Null}\n */\n\n getFirstInvalidDescendant(schema) {\n return this.validate(schema) ? this : null\n }\n}\n\n/**\n * Attach a pseudo-symbol for type checking.\n */\n\nText.prototype[MODEL_TYPES.TEXT] = true\n\n/**\n * Memoize read methods.\n */\n\nmemoize(Text.prototype, ['getMarks', 'getMarksAsArray'], {\n takesArguments: false,\n})\n\nmemoize(Text.prototype, [\n 'getDecoratedCharacters',\n 'getDecorations',\n 'getLeaves',\n 'getMarksAtIndex',\n 'validate',\n])\n\n/**\n * Export.\n *\n * @type {Text}\n */\n\nexport default Text\n","/**\n * Check if an `index` of a `text` node is in a `range`.\n *\n * @param {Number} index\n * @param {Text} text\n * @param {Range} range\n * @return {Boolean}\n */\n\nfunction isIndexInRange(index, text, range) {\n const { startKey, startOffset, endKey, endOffset } = range\n\n if (text.key == startKey && text.key == endKey) {\n return startOffset <= index && index < endOffset\n } else if (text.key == startKey) {\n return startOffset <= index\n } else if (text.key == endKey) {\n return index < endOffset\n } else {\n return true\n }\n}\n\n/**\n * Export.\n *\n * @type {Function}\n */\n\nexport default isIndexInRange\n","import direction from 'direction'\nimport isPlainObject from 'is-plain-object'\nimport logger from 'slate-dev-logger'\nimport { List, OrderedSet, Set } from 'immutable'\n\nimport Block from './block'\nimport Data from './data'\nimport Document from './document'\nimport Inline from './inline'\nimport Range from './range'\nimport Text from './text'\nimport generateKey from '../utils/generate-key'\nimport isIndexInRange from '../utils/is-index-in-range'\nimport memoize from '../utils/memoize'\n\n/**\n * Node.\n *\n * And interface that `Document`, `Block` and `Inline` all implement, to make\n * working with the recursive node tree easier.\n *\n * @type {Node}\n */\n\nclass Node {\n /**\n * Create a new `Node` with `attrs`.\n *\n * @param {Object|Node} attrs\n * @return {Node}\n */\n\n static create(attrs = {}) {\n if (Node.isNode(attrs)) {\n return attrs\n }\n\n if (isPlainObject(attrs)) {\n let { object } = attrs\n\n if (!object && attrs.kind) {\n logger.deprecate(\n 'slate@0.32.0',\n 'The `kind` property of Slate objects has been renamed to `object`.'\n )\n object = attrs.kind\n }\n\n switch (object) {\n case 'block':\n return Block.create(attrs)\n case 'document':\n return Document.create(attrs)\n case 'inline':\n return Inline.create(attrs)\n case 'text':\n return Text.create(attrs)\n default: {\n throw new Error('`Node.create` requires a `object` string.')\n }\n }\n }\n\n throw new Error(\n `\\`Node.create\\` only accepts objects or nodes but you passed it: ${attrs}`\n )\n }\n\n /**\n * Create a list of `Nodes` from an array.\n *\n * @param {Array<Object|Node>} elements\n * @return {List<Node>}\n */\n\n static createList(elements = []) {\n if (List.isList(elements) || Array.isArray(elements)) {\n const list = new List(elements.map(Node.create))\n return list\n }\n\n throw new Error(\n `\\`Node.createList\\` only accepts lists or arrays, but you passed it: ${elements}`\n )\n }\n\n /**\n * Create a dictionary of settable node properties from `attrs`.\n *\n * @param {Object|String|Node} attrs\n * @return {Object}\n */\n\n static createProperties(attrs = {}) {\n if (Block.isBlock(attrs) || Inline.isInline(attrs)) {\n return {\n data: attrs.data,\n isVoid: attrs.isVoid,\n type: attrs.type,\n }\n }\n\n if (typeof attrs == 'string') {\n return { type: attrs }\n }\n\n if (isPlainObject(attrs)) {\n const props = {}\n if ('type' in attrs) props.type = attrs.type\n if ('data' in attrs) props.data = Data.create(attrs.data)\n if ('isVoid' in attrs) props.isVoid = attrs.isVoid\n return props\n }\n\n throw new Error(\n `\\`Node.createProperties\\` only accepts objects, strings, blocks or inlines, but you passed it: ${attrs}`\n )\n }\n\n /**\n * Create a `Node` from a JSON `value`.\n *\n * @param {Object} value\n * @return {Node}\n */\n\n static fromJSON(value) {\n let { object } = value\n\n if (!object && value.kind) {\n logger.deprecate(\n 'slate@0.32.0',\n 'The `kind` property of Slate objects has been renamed to `object`.'\n )\n object = value.kind\n }\n\n switch (object) {\n case 'block':\n return Block.fromJSON(value)\n case 'document':\n return Document.fromJSON(value)\n case 'inline':\n return Inline.fromJSON(value)\n case 'text':\n return Text.fromJSON(value)\n default: {\n throw new Error(\n `\\`Node.fromJSON\\` requires an \\`object\\` of either 'block', 'document', 'inline' or 'text', but you passed: ${value}`\n )\n }\n }\n }\n\n /**\n * Alias `fromJS`.\n */\n\n static fromJS = Node.fromJSON\n\n /**\n * Check if `any` is a `Node`.\n *\n * @param {Any} any\n * @return {Boolean}\n */\n\n static isNode(any) {\n return (\n Block.isBlock(any) ||\n Document.isDocument(any) ||\n Inline.isInline(any) ||\n Text.isText(any)\n )\n }\n\n /**\n * Check if `any` is a list of nodes.\n *\n * @param {Any} any\n * @return {Boolean}\n */\n\n static isNodeList(any) {\n return List.isList(any) && any.every(item => Node.isNode(item))\n }\n\n /**\n * True if the node has both descendants in that order, false otherwise. The\n * order is depth-first, post-order.\n *\n * @param {String} first\n * @param {String} second\n * @return {Boolean}\n */\n\n areDescendantsSorted(first, second) {\n first = assertKey(first)\n second = assertKey(second)\n\n const keys = this.getKeysAsArray()\n const firstIndex = keys.indexOf(first)\n const secondIndex = keys.indexOf(second)\n if (firstIndex == -1 || secondIndex == -1) return null\n\n return firstIndex < secondIndex\n }\n\n /**\n * Assert that a node has a child by `key` and return it.\n *\n * @param {String} key\n * @return {Node}\n */\n\n assertChild(key) {\n const child = this.getChild(key)\n\n if (!child) {\n key = assertKey(key)\n throw new Error(`Could not find a child node with key \"${key}\".`)\n }\n\n return child\n }\n\n /**\n * Assert that a node has a descendant by `key` and return it.\n *\n * @param {String} key\n * @return {Node}\n */\n\n assertDescendant(key) {\n const descendant = this.getDescendant(key)\n\n if (!descendant) {\n key = assertKey(key)\n throw new Error(`Could not find a descendant node with key \"${key}\".`)\n }\n\n return descendant\n }\n\n /**\n * Assert that a node's tree has a node by `key` and return it.\n *\n * @param {String} key\n * @return {Node}\n */\n\n assertNode(key) {\n const node = this.getNode(key)\n\n if (!node) {\n key = assertKey(key)\n throw new Error(`Could not find a node with key \"${key}\".`)\n }\n\n return node\n }\n\n /**\n * Assert that a node exists at `path` and return it.\n *\n * @param {Array} path\n * @return {Node}\n */\n\n assertPath(path) {\n const descendant = this.getDescendantAtPath(path)\n\n if (!descendant) {\n throw new Error(`Could not find a descendant at path \"${path}\".`)\n }\n\n return descendant\n }\n\n /**\n * Recursively filter all descendant nodes with `iterator`.\n *\n * @param {Function} iterator\n * @return {List<Node>}\n */\n\n filterDescendants(iterator) {\n const matches = []\n\n this.forEachDescendant((node, i, nodes) => {\n if (iterator(node, i, nodes)) matches.push(node)\n })\n\n return List(matches)\n }\n\n /**\n * Recursively find all descendant nodes by `iterator`.\n *\n * @param {Function} iterator\n * @return {Node|Null}\n */\n\n findDescendant(iterator) {\n let found = null\n\n this.forEachDescendant((node, i, nodes) => {\n if (iterator(node, i, nodes)) {\n found = node\n return false\n }\n })\n\n return found\n }\n\n /**\n * Recursively iterate over all descendant nodes with `iterator`. If the\n * iterator returns false it will break the loop.\n *\n * @param {Function} iterator\n */\n\n forEachDescendant(iterator) {\n let ret\n\n this.nodes.forEach((child, i, nodes) => {\n if (iterator(child, i, nodes) === false) {\n ret = false\n return false\n }\n\n if (child.object != 'text') {\n ret = child.forEachDescendant(iterator)\n return ret\n }\n })\n\n return ret\n }\n\n /**\n * Get the path of ancestors of a descendant node by `key`.\n *\n * @param {String|Node} key\n * @return {List<Node>|Null}\n */\n\n getAncestors(key) {\n key = assertKey(key)\n\n if (key == this.key) return List()\n if (this.hasChild(key)) return List([this])\n\n let ancestors\n this.nodes.find(node => {\n if (node.object == 'text') return false\n ancestors = node.getAncestors(key)\n return ancestors\n })\n\n if (ancestors) {\n return ancestors.unshift(this)\n } else {\n return null\n }\n }\n\n /**\n * Get the leaf block descendants of the node.\n *\n * @return {List<Node>}\n */\n\n getBlocks() {\n const array = this.getBlocksAsArray()\n return new List(array)\n }\n\n /**\n * Get the leaf block descendants of the node.\n *\n * @return {List<Node>}\n */\n\n getBlocksAsArray() {\n return this.nodes.reduce((array, child) => {\n if (child.object != 'block') return array\n if (!child.isLeafBlock()) return array.concat(child.getBlocksAsArray())\n array.push(child)\n return array\n }, [])\n }\n\n /**\n * Get the leaf block descendants in a `range`.\n *\n * @param {Range} range\n * @return {List<Node>}\n */\n\n getBlocksAtRange(range) {\n const array = this.getBlocksAtRangeAsArray(range)\n // Eliminate duplicates by converting to an `OrderedSet` first.\n return new List(new OrderedSet(array))\n }\n\n /**\n * Get the leaf block descendants in a `range` as an array\n *\n * @param {Range} range\n * @return {Array}\n */\n\n getBlocksAtRangeAsArray(range) {\n range = range.normalize(this)\n if (range.isUnset) return []\n\n const { startKey, endKey } = range\n const startBlock = this.getClosestBlock(startKey)\n\n // PERF: the most common case is when the range is in a single block node,\n // where we can avoid a lot of iterating of the tree.\n if (startKey == endKey) return [startBlock]\n\n const endBlock = this.getClosestBlock(endKey)\n const blocks = this.getBlocksAsArray()\n const start = blocks.indexOf(startBlock)\n const end = blocks.indexOf(endBlock)\n return blocks.slice(start, end + 1)\n }\n\n /**\n * Get all of the leaf blocks that match a `type`.\n *\n * @param {String} type\n * @return {List<Node>}\n */\n\n getBlocksByType(type) {\n const array = this.getBlocksByTypeAsArray(type)\n return new List(array)\n }\n\n /**\n * Get all of the leaf blocks that match a `type` as an array\n *\n * @param {String} type\n * @return {Array}\n */\n\n getBlocksByTypeAsArray(type) {\n return this.nodes.reduce((array, node) => {\n if (node.object != 'block') {\n return array\n } else if (node.isLeafBlock() && node.type == type) {\n array.push(node)\n return array\n } else {\n return array.concat(node.getBlocksByTypeAsArray(type))\n }\n }, [])\n }\n\n /**\n * Get all of the characters for every text node.\n *\n * @return {List<Character>}\n */\n\n getCharacters() {\n const array = this.getCharactersAsArray()\n return new List(array)\n }\n\n /**\n * Get all of the characters for every text node as an array\n *\n * @return {Array}\n */\n\n getCharactersAsArray() {\n return this.nodes.reduce((arr, node) => {\n return node.object == 'text'\n ? arr.concat(node.characters.toArray())\n : arr.concat(node.getCharactersAsArray())\n }, [])\n }\n\n /**\n * Get a list of the characters in a `range`.\n *\n * @param {Range} range\n * @return {List<Character>}\n */\n\n getCharactersAtRange(range) {\n const array = this.getCharactersAtRangeAsArray(range)\n return new List(array)\n }\n\n /**\n * Get a list of the characters in a `range` as an array.\n *\n * @param {Range} range\n * @return {Array}\n */\n\n getCharactersAtRangeAsArray(range) {\n range = range.normalize(this)\n if (range.isUnset) return []\n\n return this.getTextsAtRange(range).reduce((arr, text) => {\n const chars = text.characters\n .filter((char, i) => isIndexInRange(i, text, range))\n .toArray()\n\n return arr.concat(chars)\n }, [])\n }\n\n /**\n * Get a child node by `key`.\n *\n * @param {String} key\n * @return {Node|Null}\n */\n\n getChild(key) {\n key = assertKey(key)\n return this.nodes.find(node => node.key == key)\n }\n\n /**\n * Get closest parent of node by `key` that matches `iterator`.\n *\n * @param {String} key\n * @param {Function} iterator\n * @return {Node|Null}\n */\n\n getClosest(key, iterator) {\n key = assertKey(key)\n const ancestors = this.getAncestors(key)\n if (!ancestors) {\n throw new Error(`Could not find a descendant node with key \"${key}\".`)\n }\n\n // Exclude this node itself.\n return ancestors.rest().findLast(iterator)\n }\n\n /**\n * Get the closest block parent of a `node`.\n *\n * @param {String} key\n * @return {Node|Null}\n */\n\n getClosestBlock(key) {\n return this.getClosest(key, parent => parent.object == 'block')\n }\n\n /**\n * Get the closest inline parent of a `node`.\n *\n * @param {String} key\n * @return {Node|Null}\n */\n\n getClosestInline(key) {\n return this.getClosest(key, parent => parent.object == 'inline')\n }\n\n /**\n * Get the closest void parent of a `node`.\n *\n * @param {String} key\n * @return {Node|Null}\n */\n\n getClosestVoid(key) {\n return this.getClosest(key, parent => parent.isVoid)\n }\n\n /**\n * Get the common ancestor of nodes `one` and `two` by keys.\n *\n * @param {String} one\n * @param {String} two\n * @return {Node}\n */\n\n getCommonAncestor(one, two) {\n one = assertKey(one)\n two = assertKey(two)\n\n if (one == this.key) return this\n if (two == this.key) return this\n\n this.assertDescendant(one)\n this.assertDescendant(two)\n let ancestors = new List()\n let oneParent = this.getParent(one)\n let twoParent = this.getParent(two)\n\n while (oneParent) {\n ancestors = ancestors.push(oneParent)\n oneParent = this.getParent(oneParent.key)\n }\n\n while (twoParent) {\n if (ancestors.includes(twoParent)) return twoParent\n twoParent = this.getParent(twoParent.key)\n }\n }\n\n /**\n * Get the decorations for the node from a `stack`.\n *\n * @param {Stack} stack\n * @return {List}\n */\n\n getDecorations(stack) {\n const decorations = stack.find('decorateNode', this)\n const list = Range.createList(decorations || [])\n return list\n }\n\n /**\n * Get the depth of a child node by `key`, with optional `startAt`.\n *\n * @param {String} key\n * @param {Number} startAt (optional)\n * @return {Number} depth\n */\n\n getDepth(key, startAt = 1) {\n this.assertDescendant(key)\n if (this.hasChild(key)) return startAt\n return this.getFurthestAncestor(key).getDepth(key, startAt + 1)\n }\n\n /**\n * Get a descendant node by `key`.\n *\n * @param {String} key\n * @return {Node|Null}\n */\n\n getDescendant(key) {\n key = assertKey(key)\n let descendantFound = null\n\n const found = this.nodes.find(node => {\n if (node.key === key) {\n return node\n } else if (node.object !== 'text') {\n descendantFound = node.getDescendant(key)\n return descendantFound\n } else {\n return false\n }\n })\n\n return descendantFound || found\n }\n\n /**\n * Get a descendant by `path`.\n *\n * @param {Array} path\n * @return {Node|Null}\n */\n\n getDescendantAtPath(path) {\n let descendant = this\n\n for (const index of path) {\n if (!descendant) return\n if (!descendant.nodes) return\n descendant = descendant.nodes.get(index)\n }\n\n return descendant\n }\n\n /**\n * Get the first child text node.\n *\n * @return {Node|Null}\n */\n\n getFirstText() {\n let descendantFound = null\n\n const found = this.nodes.find(node => {\n if (node.object == 'text') return true\n descendantFound = node.getFirstText()\n return descendantFound\n })\n\n return descendantFound || found\n }\n\n /**\n * Get a fragment of the node at a `range`.\n *\n * @param {Range} range\n * @return {Document}\n */\n\n getFragmentAtRange(range) {\n range = range.normalize(this)\n if (range.isUnset) return Document.create()\n\n let node = this\n\n // Make sure the children exist.\n const { startKey, startOffset, endKey, endOffset } = range\n const startText = node.assertDescendant(startKey)\n const endText = node.assertDescendant(endKey)\n\n // Split at the start and end.\n let child = startText\n let previous\n let parent\n\n while ((parent = node.getParent(child.key))) {\n const index = parent.nodes.indexOf(child)\n const position =\n child.object == 'text' ? startOffset : child.nodes.indexOf(previous)\n\n parent = parent.splitNode(index, position)\n node = node.updateNode(parent)\n previous = parent.nodes.get(index + 1)\n child = parent\n }\n\n child = startKey == endKey ? node.getNextText(startKey) : endText\n\n while ((parent = node.getParent(child.key))) {\n const index = parent.nodes.indexOf(child)\n const position =\n child.object == 'text'\n ? startKey == endKey ? endOffset - startOffset : endOffset\n : child.nodes.indexOf(previous)\n\n parent = parent.splitNode(index, position)\n node = node.updateNode(parent)\n previous = parent.nodes.get(index + 1)\n child = parent\n }\n\n // Get the start and end nodes.\n const startNode = node.getNextSibling(\n node.getFurthestAncestor(startKey).key\n )\n const endNode =\n startKey == endKey\n ? node.getNextSibling(\n node.getNextSibling(node.getFurthestAncestor(endKey).key).key\n )\n : node.getNextSibling(node.getFurthestAncestor(endKey).key)\n\n // Get children range of nodes from start to end nodes\n const startIndex = node.nodes.indexOf(startNode)\n const endIndex = node.nodes.indexOf(endNode)\n const nodes = node.nodes.slice(startIndex, endIndex)\n\n // Return a new document fragment.\n return Document.create({ nodes })\n }\n\n /**\n * Get the furthest parent of a node by `key` that matches an `iterator`.\n *\n * @param {String} key\n * @param {Function} iterator\n * @return {Node|Null}\n */\n\n getFurthest(key, iterator) {\n const ancestors = this.getAncestors(key)\n if (!ancestors) {\n key = assertKey(key)\n throw new Error(`Could not find a descendant node with key \"${key}\".`)\n }\n\n // Exclude this node itself\n return ancestors.rest().find(iterator)\n }\n\n /**\n * Get the furthest block parent of a node by `key`.\n *\n * @param {String} key\n * @return {Node|Null}\n */\n\n getFurthestBlock(key) {\n return this.getFurthest(key, node => node.object == 'block')\n }\n\n /**\n * Get the furthest inline parent of a node by `key`.\n *\n * @param {String} key\n * @return {Node|Null}\n */\n\n getFurthestInline(key) {\n return this.getFurthest(key, node => node.object == 'inline')\n }\n\n /**\n * Get the furthest ancestor of a node by `key`.\n *\n * @param {String} key\n * @return {Node|Null}\n */\n\n getFurthestAncestor(key) {\n key = assertKey(key)\n return this.nodes.find(node => {\n if (node.key == key) return true\n if (node.object == 'text') return false\n return node.hasDescendant(key)\n })\n }\n\n /**\n * Get the furthest ancestor of a node by `key` that has only one child.\n *\n * @param {String} key\n * @return {Node|Null}\n */\n\n getFurthestOnlyChildAncestor(key) {\n const ancestors = this.getAncestors(key)\n\n if (!ancestors) {\n key = assertKey(key)\n throw new Error(`Could not find a descendant node with key \"${key}\".`)\n }\n\n const result = ancestors\n // Skip this node...\n .shift()\n // Take parents until there are more than one child...\n .reverse()\n .takeUntil(p => p.nodes.size > 1)\n // And pick the highest.\n .last()\n if (!result) return null\n return result\n }\n\n /**\n * Get the closest inline nodes for each text node in the node.\n *\n * @return {List<Node>}\n */\n\n getInlines() {\n const array = this.getInlinesAsArray()\n return new List(array)\n }\n\n /**\n * Get the closest inline nodes for each text node in the node, as an array.\n *\n * @return {List<Node>}\n */\n\n getInlinesAsArray() {\n let array = []\n\n this.nodes.forEach(child => {\n if (child.object == 'text') return\n if (child.isLeafInline()) {\n array.push(child)\n } else {\n array = array.concat(child.getInlinesAsArray())\n }\n })\n\n return array\n }\n\n /**\n * Get the closest inline nodes for each text node in a `range`.\n *\n * @param {Range} range\n * @return {List<Node>}\n */\n\n getInlinesAtRange(range) {\n const array = this.getInlinesAtRangeAsArray(range)\n // Remove duplicates by converting it to an `OrderedSet` first.\n return new List(new OrderedSet(array))\n }\n\n /**\n * Get the closest inline nodes for each text node in a `range` as an array.\n *\n * @param {Range} range\n * @return {Array}\n */\n\n getInlinesAtRangeAsArray(range) {\n range = range.normalize(this)\n if (range.isUnset) return []\n\n return this.getTextsAtRangeAsArray(range)\n .map(text => this.getClosestInline(text.key))\n .filter(exists => exists)\n }\n\n /**\n * Get all of the leaf inline nodes that match a `type`.\n *\n * @param {String} type\n * @return {List<Node>}\n */\n\n getInlinesByType(type) {\n const array = this.getInlinesByTypeAsArray(type)\n return new List(array)\n }\n\n /**\n * Get all of the leaf inline nodes that match a `type` as an array.\n *\n * @param {String} type\n * @return {Array}\n */\n\n getInlinesByTypeAsArray(type) {\n return this.nodes.reduce((inlines, node) => {\n if (node.object == 'text') {\n return inlines\n } else if (node.isLeafInline() && node.type == type) {\n inlines.push(node)\n return inlines\n } else {\n return inlines.concat(node.getInlinesByTypeAsArray(type))\n }\n }, [])\n }\n\n /**\n * Return a set of all keys in the node as an array.\n *\n * @return {Array<String>}\n */\n\n getKeysAsArray() {\n const keys = []\n\n this.forEachDescendant(desc => {\n keys.push(desc.key)\n })\n\n return keys\n }\n\n /**\n * Return a set of all keys in the node.\n *\n * @return {Set<String>}\n */\n\n getKeys() {\n const keys = this.getKeysAsArray()\n return new Set(keys)\n }\n\n /**\n * Get the last child text node.\n *\n * @return {Node|Null}\n */\n\n getLastText() {\n let descendantFound = null\n\n const found = this.nodes.findLast(node => {\n if (node.object == 'text') return true\n descendantFound = node.getLastText()\n return descendantFound\n })\n\n return descendantFound || found\n }\n\n /**\n * Get all of the marks for all of the characters of every text node.\n *\n * @return {Set<Mark>}\n */\n\n getMarks() {\n const array = this.getMarksAsArray()\n return new Set(array)\n }\n\n /**\n * Get all of the marks for all of the characters of every text node.\n *\n * @return {OrderedSet<Mark>}\n */\n\n getOrderedMarks() {\n const array = this.getMarksAsArray()\n return new OrderedSet(array)\n }\n\n /**\n * Get all of the marks as an array.\n *\n * @return {Array}\n */\n\n getMarksAsArray() {\n return this.nodes.reduce((marks, node) => {\n return marks.concat(node.getMarksAsArray())\n }, [])\n }\n\n /**\n * Get a set of the marks in a `range`.\n *\n * @param {Range} range\n * @return {Set<Mark>}\n */\n\n getMarksAtRange(range) {\n const array = this.getMarksAtRangeAsArray(range)\n return new Set(array)\n }\n\n /**\n * Get a set of the marks in a `range`.\n *\n * @param {Range} range\n * @return {Set<Mark>}\n */\n\n getInsertMarksAtRange(range) {\n const array = this.getInsertMarksAtRangeAsArray(range)\n return new Set(array)\n }\n\n /**\n * Get a set of the marks in a `range`.\n *\n * @param {Range} range\n * @return {OrderedSet<Mark>}\n */\n\n getOrderedMarksAtRange(range) {\n const array = this.getMarksAtRangeAsArray(range)\n return new OrderedSet(array)\n }\n\n /**\n * Get a set of the active marks in a `range`.\n *\n * @param {Range} range\n * @return {Set<Mark>}\n */\n\n getActiveMarksAtRange(range) {\n const array = this.getActiveMarksAtRangeAsArray(range)\n return new Set(array)\n }\n\n /**\n * Get a set of the marks in a `range`, by unioning.\n *\n * @param {Range} range\n * @return {Array}\n */\n\n getMarksAtRangeAsArray(range) {\n range = range.normalize(this)\n if (range.isUnset) return []\n if (range.isCollapsed) return this.getMarksAtCollapsedRangeAsArray(range)\n\n return this.getCharactersAtRange(range).reduce((memo, char) => {\n if (char) {\n char.marks.toArray().forEach(c => memo.push(c))\n }\n return memo\n }, [])\n }\n\n /**\n * Get a set of the marks in a `range` for insertion behavior.\n *\n * @param {Range} range\n * @return {Array}\n */\n\n getInsertMarksAtRangeAsArray(range) {\n range = range.normalize(this)\n if (range.isUnset) return []\n if (range.isCollapsed) return this.getMarksAtCollapsedRangeAsArray(range)\n\n const text = this.getDescendant(range.startKey)\n const char = text.characters.get(range.startOffset)\n if (!char) return []\n\n return char.marks.toArray()\n }\n\n /**\n * Get a set of marks in a `range`, by treating it as collapsed.\n *\n * @param {Range} range\n * @return {Array}\n */\n\n getMarksAtCollapsedRangeAsArray(range) {\n if (range.isUnset) return []\n\n const { startKey, startOffset } = range\n\n if (startOffset == 0) {\n const previous = this.getPreviousText(startKey)\n if (!previous || previous.text.length == 0) return []\n if (\n this.getClosestBlock(startKey) !== this.getClosestBlock(previous.key)\n ) {\n return []\n }\n const char = previous.characters.get(previous.text.length - 1)\n if (!char) return []\n\n return char.marks.toArray()\n }\n\n const text = this.getDescendant(startKey)\n const char = text.characters.get(startOffset - 1)\n if (!char) return []\n\n return char.marks.toArray()\n }\n\n /**\n * Get a set of marks in a `range`, by intersecting.\n *\n * @param {Range} range\n * @return {Array}\n */\n\n getActiveMarksAtRangeAsArray(range) {\n range = range.normalize(this)\n if (range.isUnset) return []\n if (range.isCollapsed) return this.getMarksAtCollapsedRangeAsArray(range)\n\n // Otherwise, get a set of the marks for each character in the range.\n const chars = this.getCharactersAtRange(range)\n const first = chars.first()\n if (!first) return []\n\n let memo = first.marks\n\n chars.slice(1).forEach(char => {\n const marks = char ? char.marks : []\n memo = memo.intersect(marks)\n return memo.size != 0\n })\n\n return memo.toArray()\n }\n\n /**\n * Get all of the marks that match a `type`.\n *\n * @param {String} type\n * @return {Set<Mark>}\n */\n\n getMarksByType(type) {\n const array = this.getMarksByTypeAsArray(type)\n return new Set(array)\n }\n\n /**\n * Get all of the marks that match a `type`.\n *\n * @param {String} type\n * @return {OrderedSet<Mark>}\n */\n\n getOrderedMarksByType(type) {\n const array = this.getMarksByTypeAsArray(type)\n return new OrderedSet(array)\n }\n\n /**\n * Get all of the marks that match a `type` as an array.\n *\n * @param {String} type\n * @return {Array}\n */\n\n getMarksByTypeAsArray(type) {\n return this.nodes.reduce((array, node) => {\n return node.object == 'text'\n ? array.concat(node.getMarksAsArray().filter(m => m.type == type))\n : array.concat(node.getMarksByTypeAsArray(type))\n }, [])\n }\n\n /**\n * Get the block node before a descendant text node by `key`.\n *\n * @param {String} key\n * @return {Node|Null}\n */\n\n getNextBlock(key) {\n const child = this.assertDescendant(key)\n let last\n\n if (child.object == 'block') {\n last = child.getLastText()\n } else {\n const block = this.getClosestBlock(key)\n last = block.getLastText()\n }\n\n const next = this.getNextText(last.key)\n if (!next) return null\n\n return this.getClosestBlock(next.key)\n }\n\n /**\n * Get the node after a descendant by `key`.\n *\n * @param {String} key\n * @return {Node|Null}\n */\n\n getNextSibling(key) {\n key = assertKey(key)\n\n const parent = this.getParent(key)\n const after = parent.nodes.skipUntil(child => child.key == key)\n\n if (after.size == 0) {\n throw new Error(`Could not find a child node with key \"${key}\".`)\n }\n return after.get(1)\n }\n\n /**\n * Get the text node after a descendant text node by `key`.\n *\n * @param {String} key\n * @return {Node|Null}\n */\n\n getNextText(key) {\n key = assertKey(key)\n return this.getTexts()\n .skipUntil(text => text.key == key)\n .get(1)\n }\n\n /**\n * Get a node in the tree by `key`.\n *\n * @param {String} key\n * @return {Node|Null}\n */\n\n getNode(key) {\n key = assertKey(key)\n return this.key == key ? this : this.getDescendant(key)\n }\n\n /**\n * Get a node in the tree by `path`.\n *\n * @param {Array} path\n * @return {Node|Null}\n */\n\n getNodeAtPath(path) {\n return path.length ? this.getDescendantAtPath(path) : this\n }\n\n /**\n * Get the offset for a descendant text node by `key`.\n *\n * @param {String} key\n * @return {Number}\n */\n\n getOffset(key) {\n this.assertDescendant(key)\n\n // Calculate the offset of the nodes before the highest child.\n const child = this.getFurthestAncestor(key)\n const offset = this.nodes\n .takeUntil(n => n == child)\n .reduce((memo, n) => memo + n.text.length, 0)\n\n // Recurse if need be.\n return this.hasChild(key) ? offset : offset + child.getOffset(key)\n }\n\n /**\n * Get the offset from a `range`.\n *\n * @param {Range} range\n * @return {Number}\n */\n\n getOffsetAtRange(range) {\n range = range.normalize(this)\n\n if (range.isUnset) {\n throw new Error('The range cannot be unset to calculcate its offset.')\n }\n\n if (range.isExpanded) {\n throw new Error('The range must be collapsed to calculcate its offset.')\n }\n\n const { startKey, startOffset } = range\n return this.getOffset(startKey) + startOffset\n }\n\n /**\n * Get the parent of a child node by `key`.\n *\n * @param {String} key\n * @return {Node|Null}\n */\n\n getParent(key) {\n if (this.hasChild(key)) return this\n\n let node = null\n\n this.nodes.find(child => {\n if (child.object == 'text') {\n return false\n } else {\n node = child.getParent(key)\n return node\n }\n })\n\n return node\n }\n\n /**\n * Get the path of a descendant node by `key`.\n *\n * @param {String|Node} key\n * @return {Array}\n */\n\n getPath(key) {\n let child = this.assertNode(key)\n const ancestors = this.getAncestors(key)\n const path = []\n\n ancestors.reverse().forEach(ancestor => {\n const index = ancestor.nodes.indexOf(child)\n path.unshift(index)\n child = ancestor\n })\n\n return path\n }\n\n /**\n * Refind the path of node if path is changed.\n *\n * @param {Array} path\n * @param {String} key\n * @return {Array}\n */\n\n refindPath(path, key) {\n const node = this.getDescendantAtPath(path)\n if (node && node.key === key) {\n return path\n }\n\n return this.getPath(key)\n }\n\n /**\n *\n * Refind the node with the same node.key after change.\n *\n * @param {Array} path\n * @param {String} key\n * @return {Node|Void}\n */\n\n refindNode(path, key) {\n const node = this.getDescendantAtPath(path)\n if (node && node.key === key) {\n return node\n }\n\n return this.getDescendant(key)\n }\n\n /**\n * Get the placeholder for the node from a `schema`.\n *\n * @param {Schema} schema\n * @return {Component|Void}\n */\n\n getPlaceholder(schema) {\n return schema.__getPlaceholder(this)\n }\n\n /**\n * Get the block node before a descendant text node by `key`.\n *\n * @param {String} key\n * @return {Node|Null}\n */\n\n getPreviousBlock(key) {\n const child = this.assertDescendant(key)\n let first\n\n if (child.object == 'block') {\n first = child.getFirstText()\n } else {\n const block = this.getClosestBlock(key)\n first = block.getFirstText()\n }\n\n const previous = this.getPreviousText(first.key)\n if (!previous) return null\n\n return this.getClosestBlock(previous.key)\n }\n\n /**\n * Get the node before a descendant node by `key`.\n *\n * @param {String} key\n * @return {Node|Null}\n */\n\n getPreviousSibling(key) {\n key = assertKey(key)\n const parent = this.getParent(key)\n const before = parent.nodes.takeUntil(child => child.key == key)\n\n if (before.size == parent.nodes.size) {\n throw new Error(`Could not find a child node with key \"${key}\".`)\n }\n\n return before.last()\n }\n\n /**\n * Get the text node before a descendant text node by `key`.\n *\n * @param {String} key\n * @return {Node|Null}\n */\n\n getPreviousText(key) {\n key = assertKey(key)\n return this.getTexts()\n .takeUntil(text => text.key == key)\n .last()\n }\n\n /**\n * Get the indexes of the selection for a `range`, given an extra flag for\n * whether the node `isSelected`, to determine whether not finding matches\n * means everything is selected or nothing is.\n *\n * @param {Range} range\n * @param {Boolean} isSelected\n * @return {Object|Null}\n */\n\n getSelectionIndexes(range, isSelected = false) {\n const { startKey, endKey } = range\n\n // PERF: if we're not selected, or the range is blurred, we can exit early.\n if (!isSelected || range.isBlurred) {\n return null\n }\n\n // if we've been given an invalid selection we can exit early.\n if (range.isUnset) {\n return null\n }\n\n // PERF: if the start and end keys are the same, just check for the child\n // that contains that single key.\n if (startKey == endKey) {\n const child = this.getFurthestAncestor(startKey)\n const index = child ? this.nodes.indexOf(child) : null\n return { start: index, end: index + 1 }\n }\n\n // Otherwise, check all of the children...\n let start = null\n let end = null\n\n this.nodes.forEach((child, i) => {\n if (child.object == 'text') {\n if (start == null && child.key == startKey) start = i\n if (end == null && child.key == endKey) end = i + 1\n } else {\n if (start == null && child.hasDescendant(startKey)) start = i\n if (end == null && child.hasDescendant(endKey)) end = i + 1\n }\n\n // PERF: exit early if both start and end have been found.\n return start == null || end == null\n })\n\n if (isSelected && start == null) start = 0\n if (isSelected && end == null) end = this.nodes.size\n return start == null ? null : { start, end }\n }\n\n /**\n * Get the concatenated text string of all child nodes.\n *\n * @return {String}\n */\n\n getText() {\n return this.nodes.reduce((string, node) => {\n return string + node.text\n }, '')\n }\n\n /**\n * Get the descendent text node at an `offset`.\n *\n * @param {String} offset\n * @return {Node|Null}\n */\n\n getTextAtOffset(offset) {\n // PERF: Add a few shortcuts for the obvious cases.\n if (offset == 0) return this.getFirstText()\n if (offset == this.text.length) return this.getLastText()\n if (offset < 0 || offset > this.text.length) return null\n\n let length = 0\n\n return this.getTexts().find((node, i, nodes) => {\n length += node.text.length\n return length > offset\n })\n }\n\n /**\n * Get the direction of the node's text.\n *\n * @return {String}\n */\n\n getTextDirection() {\n const dir = direction(this.text)\n return dir == 'neutral' ? undefined : dir\n }\n\n /**\n * Recursively get all of the child text nodes in order of appearance.\n *\n * @return {List<Node>}\n */\n\n getTexts() {\n const array = this.getTextsAsArray()\n return new List(array)\n }\n\n /**\n * Recursively get all the leaf text nodes in order of appearance, as array.\n *\n * @return {List<Node>}\n */\n\n getTextsAsArray() {\n let array = []\n\n this.nodes.forEach(node => {\n if (node.object == 'text') {\n array.push(node)\n } else {\n array = array.concat(node.getTextsAsArray())\n }\n })\n\n return array\n }\n\n /**\n * Get all of the text nodes in a `range`.\n *\n * @param {Range} range\n * @return {List<Node>}\n */\n\n getTextsAtRange(range) {\n const array = this.getTextsAtRangeAsArray(range)\n return new List(array)\n }\n\n /**\n * Get all of the text nodes in a `range` as an array.\n *\n * @param {Range} range\n * @return {Array}\n */\n\n getTextsAtRangeAsArray(range) {\n range = range.normalize(this)\n if (range.isUnset) return []\n\n const { startKey, endKey } = range\n const startText = this.getDescendant(startKey)\n\n // PERF: the most common case is when the range is in a single text node,\n // where we can avoid a lot of iterating of the tree.\n if (startKey == endKey) return [startText]\n\n const endText = this.getDescendant(endKey)\n const texts = this.getTextsAsArray()\n const start = texts.indexOf(startText)\n const end = texts.indexOf(endText)\n return texts.slice(start, end + 1)\n }\n\n /**\n * Check if a child node exists by `key`.\n *\n * @param {String} key\n * @return {Boolean}\n */\n\n hasChild(key) {\n return !!this.getChild(key)\n }\n\n /**\n * Recursively check if a child node exists by `key`.\n *\n * @param {String} key\n * @return {Boolean}\n */\n\n hasDescendant(key) {\n return !!this.getDescendant(key)\n }\n\n /**\n * Recursively check if a node exists by `key`.\n *\n * @param {String} key\n * @return {Boolean}\n */\n\n hasNode(key) {\n return !!this.getNode(key)\n }\n\n /**\n * Check if a node has a void parent by `key`.\n *\n * @param {String} key\n * @return {Boolean}\n */\n\n hasVoidParent(key) {\n return !!this.getClosestVoid(key)\n }\n\n /**\n * Insert a `node` at `index`.\n *\n * @param {Number} index\n * @param {Node} node\n * @return {Node}\n */\n\n insertNode(index, node) {\n const keys = this.getKeysAsArray()\n\n if (keys.includes(node.key)) {\n node = node.regenerateKey()\n }\n\n if (node.object != 'text') {\n node = node.mapDescendants(desc => {\n return keys.includes(desc.key) ? desc.regenerateKey() : desc\n })\n }\n\n const nodes = this.nodes.insert(index, node)\n return this.set('nodes', nodes)\n }\n\n /**\n * Check whether the node is in a `range`.\n *\n * @param {Range} range\n * @return {Boolean}\n */\n\n isInRange(range) {\n range = range.normalize(this)\n\n const node = this\n const { startKey, endKey, isCollapsed } = range\n\n // PERF: solve the most common cast where the start or end key are inside\n // the node, for collapsed selections.\n if (\n node.key == startKey ||\n node.key == endKey ||\n node.hasDescendant(startKey) ||\n node.hasDescendant(endKey)\n ) {\n return true\n }\n\n // PERF: if the selection is collapsed and the previous check didn't return\n // true, then it must be false.\n if (isCollapsed) {\n return false\n }\n\n // Otherwise, look through all of the leaf text nodes in the range, to see\n // if any of them are inside the node.\n const texts = node.getTextsAtRange(range)\n let memo = false\n\n texts.forEach(text => {\n if (node.hasDescendant(text.key)) memo = true\n return memo\n })\n\n return memo\n }\n\n /**\n * Check whether the node is a leaf block.\n *\n * @return {Boolean}\n */\n\n isLeafBlock() {\n return this.object == 'block' && this.nodes.every(n => n.object != 'block')\n }\n\n /**\n * Check whether the node is a leaf inline.\n *\n * @return {Boolean}\n */\n\n isLeafInline() {\n return (\n this.object == 'inline' && this.nodes.every(n => n.object != 'inline')\n )\n }\n\n /**\n * Merge a children node `first` with another children node `second`.\n * `first` and `second` will be concatenated in that order.\n * `first` and `second` must be two Nodes or two Text.\n *\n * @param {Node} first\n * @param {Node} second\n * @return {Node}\n */\n\n mergeNode(withIndex, index) {\n let node = this\n let one = node.nodes.get(withIndex)\n const two = node.nodes.get(index)\n\n if (one.object != two.object) {\n throw new Error(\n `Tried to merge two nodes of different objects: \"${one.object}\" and \"${\n two.object\n }\".`\n )\n }\n\n // If the nodes are text nodes, concatenate their characters together.\n if (one.object == 'text') {\n const characters = one.characters.concat(two.characters)\n one = one.set('characters', characters)\n } else {\n // Otherwise, concatenate their child nodes together.\n const nodes = one.nodes.concat(two.nodes)\n one = one.set('nodes', nodes)\n }\n\n node = node.removeNode(index)\n node = node.removeNode(withIndex)\n node = node.insertNode(withIndex, one)\n return node\n }\n\n /**\n * Map all child nodes, updating them in their parents. This method is\n * optimized to not return a new node if no changes are made.\n *\n * @param {Function} iterator\n * @return {Node}\n */\n\n mapChildren(iterator) {\n let { nodes } = this\n\n nodes.forEach((node, i) => {\n const ret = iterator(node, i, this.nodes)\n if (ret != node) nodes = nodes.set(ret.key, ret)\n })\n\n return this.set('nodes', nodes)\n }\n\n /**\n * Map all descendant nodes, updating them in their parents. This method is\n * optimized to not return a new node if no changes are made.\n *\n * @param {Function} iterator\n * @return {Node}\n */\n\n mapDescendants(iterator) {\n let { nodes } = this\n\n nodes.forEach((node, i) => {\n let ret = node\n if (ret.object != 'text') ret = ret.mapDescendants(iterator)\n ret = iterator(ret, i, this.nodes)\n if (ret == node) return\n\n const index = nodes.indexOf(node)\n nodes = nodes.set(index, ret)\n })\n\n return this.set('nodes', nodes)\n }\n\n /**\n * Regenerate the node's key.\n *\n * @return {Node}\n */\n\n regenerateKey() {\n const key = generateKey()\n return this.set('key', key)\n }\n\n /**\n * Remove a `node` from the children node map.\n *\n * @param {String} key\n * @return {Node}\n */\n\n removeDescendant(key) {\n key = assertKey(key)\n\n let node = this\n let parent = node.getParent(key)\n if (!parent)\n throw new Error(`Could not find a descendant node with key \"${key}\".`)\n\n const index = parent.nodes.findIndex(n => n.key === key)\n const nodes = parent.nodes.splice(index, 1)\n\n parent = parent.set('nodes', nodes)\n node = node.updateNode(parent)\n return node\n }\n\n /**\n * Remove a node at `index`.\n *\n * @param {Number} index\n * @return {Node}\n */\n\n removeNode(index) {\n const nodes = this.nodes.splice(index, 1)\n return this.set('nodes', nodes)\n }\n\n /**\n * Split a child node by `index` at `position`.\n *\n * @param {Number} index\n * @param {Number} position\n * @return {Node}\n */\n\n splitNode(index, position) {\n let node = this\n const child = node.nodes.get(index)\n let one\n let two\n\n // If the child is a text node, the `position` refers to the text offset at\n // which to split it.\n if (child.object == 'text') {\n const befores = child.characters.take(position)\n const afters = child.characters.skip(position)\n one = child.set('characters', befores)\n two = child.set('characters', afters).regenerateKey()\n } else {\n // Otherwise, if the child is not a text node, the `position` refers to the\n // index at which to split its children.\n const befores = child.nodes.take(position)\n const afters = child.nodes.skip(position)\n one = child.set('nodes', befores)\n two = child.set('nodes', afters).regenerateKey()\n }\n\n // Remove the old node and insert the newly split children.\n node = node.removeNode(index)\n node = node.insertNode(index, two)\n node = node.insertNode(index, one)\n return node\n }\n\n /**\n * Set a new value for a child node by `key`.\n *\n * @param {Node} node\n * @return {Node}\n */\n\n updateNode(node) {\n if (node.key == this.key) {\n return node\n }\n\n let child = this.assertDescendant(node.key)\n const ancestors = this.getAncestors(node.key)\n\n ancestors.reverse().forEach(parent => {\n let { nodes } = parent\n const index = nodes.indexOf(child)\n child = parent\n nodes = nodes.set(index, node)\n parent = parent.set('nodes', nodes)\n node = parent\n })\n\n return node\n }\n\n /**\n * Validate the node against a `schema`.\n *\n * @param {Schema} schema\n * @return {Function|Null}\n */\n\n validate(schema) {\n return schema.validateNode(this)\n }\n\n /**\n * Get the first invalid descendant\n *\n * @param {Schema} schema\n * @return {Node|Text|Null}\n */\n\n getFirstInvalidDescendant(schema) {\n let result = null\n this.nodes.find(n => {\n result = n.validate(schema) ? n : n.getFirstInvalidDescendant(schema)\n return result\n })\n return result\n }\n}\n\n/**\n * Assert a key `arg`.\n *\n * @param {String} arg\n * @return {String}\n */\n\nfunction assertKey(arg) {\n if (typeof arg == 'string') return arg\n throw new Error(\n `Invalid \\`key\\` argument! It must be a key string, but you passed: ${arg}`\n )\n}\n\n/**\n * Memoize read methods.\n */\n\nmemoize(Node.prototype, [\n 'areDescendantsSorted',\n 'getActiveMarksAtRangeAsArray',\n 'getAncestors',\n 'getBlocksAsArray',\n 'getBlocksAtRangeAsArray',\n 'getBlocksByTypeAsArray',\n 'getCharactersAtRangeAsArray',\n 'getCharactersAsArray',\n 'getChild',\n 'getClosestBlock',\n 'getClosestInline',\n 'getClosestVoid',\n 'getCommonAncestor',\n 'getDecorations',\n 'getDepth',\n 'getDescendant',\n 'getDescendantAtPath',\n 'getFirstText',\n 'getFragmentAtRange',\n 'getFurthestBlock',\n 'getFurthestInline',\n 'getFurthestAncestor',\n 'getFurthestOnlyChildAncestor',\n 'getInlinesAsArray',\n 'getInlinesAtRangeAsArray',\n 'getInlinesByTypeAsArray',\n 'getMarksAsArray',\n 'getMarksAtRangeAsArray',\n 'getInsertMarksAtRangeAsArray',\n 'getKeysAsArray',\n 'getLastText',\n 'getMarksByTypeAsArray',\n 'getNextBlock',\n 'getNextSibling',\n 'getNextText',\n 'getNode',\n 'getNodeAtPath',\n 'getOffset',\n 'getOffsetAtRange',\n 'getParent',\n 'getPath',\n 'getPlaceholder',\n 'getPreviousBlock',\n 'getPreviousSibling',\n 'getPreviousText',\n 'getText',\n 'getTextAtOffset',\n 'getTextDirection',\n 'getTextsAsArray',\n 'getTextsAtRangeAsArray',\n 'isLeafBlock',\n 'isLeafInline',\n 'validate',\n 'getFirstInvalidDescendant',\n])\n\n/**\n * Export.\n *\n * @type {Object}\n */\n\nexport default Node\n","/**\n * Prevent circular dependencies.\n */\n\nimport './document'\n\n/**\n * Dependencies.\n */\n\nimport isPlainObject from 'is-plain-object'\nimport logger from 'slate-dev-logger'\nimport { List, Map, Record } from 'immutable'\n\nimport Node from './node'\nimport MODEL_TYPES from '../constants/model-types'\nimport generateKey from '../utils/generate-key'\n\n/**\n * Default properties.\n *\n * @type {Object}\n */\n\nconst DEFAULTS = {\n data: new Map(),\n isVoid: false,\n key: undefined,\n nodes: new List(),\n type: undefined,\n}\n\n/**\n * Inline.\n *\n * @type {Inline}\n */\n\nclass Inline extends Record(DEFAULTS) {\n /**\n * Create a new `Inline` with `attrs`.\n *\n * @param {Object|String|Inline} attrs\n * @return {Inline}\n */\n\n static create(attrs = {}) {\n if (Inline.isInline(attrs)) {\n return attrs\n }\n\n if (typeof attrs == 'string') {\n attrs = { type: attrs }\n }\n\n if (isPlainObject(attrs)) {\n return Inline.fromJSON(attrs)\n }\n\n throw new Error(\n `\\`Inline.create\\` only accepts objects, strings or inlines, but you passed it: ${attrs}`\n )\n }\n\n /**\n * Create a list of `Inlines` from an array.\n *\n * @param {Array<Inline|Object>|List<Inline|Object>} elements\n * @return {List<Inline>}\n */\n\n static createList(elements = []) {\n if (List.isList(elements) || Array.isArray(elements)) {\n const list = new List(elements.map(Inline.create))\n return list\n }\n\n throw new Error(\n `\\`Inline.createList\\` only accepts arrays or lists, but you passed it: ${elements}`\n )\n }\n\n /**\n * Create a `Inline` from a JSON `object`.\n *\n * @param {Object|Inline} object\n * @return {Inline}\n */\n\n static fromJSON(object) {\n if (Inline.isInline(object)) {\n return object\n }\n\n const {\n data = {},\n isVoid = false,\n key = generateKey(),\n nodes = [],\n type,\n } = object\n\n if (typeof type != 'string') {\n throw new Error('`Inline.fromJS` requires a `type` string.')\n }\n\n const inline = new Inline({\n key,\n type,\n isVoid: !!isVoid,\n data: new Map(data),\n nodes: new List(nodes.map(Node.fromJSON)),\n })\n\n return inline\n }\n\n /**\n * Alias `fromJS`.\n */\n\n static fromJS = Inline.fromJSON\n\n /**\n * Check if `any` is a `Inline`.\n *\n * @param {Any} any\n * @return {Boolean}\n */\n\n static isInline(any) {\n return !!(any && any[MODEL_TYPES.INLINE])\n }\n\n /**\n * Check if `any` is a list of inlines.\n *\n * @param {Any} any\n * @return {Boolean}\n */\n\n static isInlineList(any) {\n return List.isList(any) && any.every(item => Inline.isInline(item))\n }\n\n /**\n * Object.\n *\n * @return {String}\n */\n\n get object() {\n return 'inline'\n }\n\n get kind() {\n logger.deprecate(\n 'slate@0.32.0',\n 'The `kind` property of Slate objects has been renamed to `object`.'\n )\n return this.object\n }\n\n /**\n * Check if the inline is empty.\n * Returns true if inline is not void and all it's children nodes are empty.\n * Void node is never empty, regardless of it's content.\n *\n * @return {Boolean}\n */\n\n get isEmpty() {\n return !this.isVoid && !this.nodes.some(child => !child.isEmpty)\n }\n\n /**\n * Get the concatenated text of all the inline's children.\n *\n * @return {String}\n */\n\n get text() {\n return this.getText()\n }\n\n /**\n * Return a JSON representation of the inline.\n *\n * @param {Object} options\n * @return {Object}\n */\n\n toJSON(options = {}) {\n const object = {\n object: this.object,\n type: this.type,\n isVoid: this.isVoid,\n data: this.data.toJSON(),\n nodes: this.nodes.toArray().map(n => n.toJSON(options)),\n }\n\n if (options.preserveKeys) {\n object.key = this.key\n }\n\n return object\n }\n\n /**\n * Alias `toJS`.\n */\n\n toJS(options) {\n return this.toJSON(options)\n }\n}\n\n/**\n * Attach a pseudo-symbol for type checking.\n */\n\nInline.prototype[MODEL_TYPES.INLINE] = true\n\n/**\n * Mix in `Node` methods.\n */\n\nObject.getOwnPropertyNames(Node.prototype).forEach(method => {\n if (method == 'constructor') return\n Inline.prototype[method] = Node.prototype[method]\n})\n\n/**\n * Export.\n *\n * @type {Inline}\n */\n\nexport default Inline\n","/**\n * Prevent circular dependencies.\n */\n\nimport './block'\nimport './inline'\n\n/**\n * Dependencies.\n */\n\nimport isPlainObject from 'is-plain-object'\nimport logger from 'slate-dev-logger'\nimport { List, Map, Record } from 'immutable'\n\nimport Node from './node'\nimport MODEL_TYPES from '../constants/model-types'\nimport generateKey from '../utils/generate-key'\n\n/**\n * Default properties.\n *\n * @type {Object}\n */\n\nconst DEFAULTS = {\n data: new Map(),\n key: undefined,\n nodes: new List(),\n}\n\n/**\n * Document.\n *\n * @type {Document}\n */\n\nclass Document extends Record(DEFAULTS) {\n /**\n * Create a new `Document` with `attrs`.\n *\n * @param {Object|Array|List|Text} attrs\n * @return {Document}\n */\n\n static create(attrs = {}) {\n if (Document.isDocument(attrs)) {\n return attrs\n }\n\n if (List.isList(attrs) || Array.isArray(attrs)) {\n attrs = { nodes: attrs }\n }\n\n if (isPlainObject(attrs)) {\n return Document.fromJSON(attrs)\n }\n\n throw new Error(\n `\\`Document.create\\` only accepts objects, arrays, lists or documents, but you passed it: ${attrs}`\n )\n }\n\n /**\n * Create a `Document` from a JSON `object`.\n *\n * @param {Object|Document} object\n * @return {Document}\n */\n\n static fromJSON(object) {\n if (Document.isDocument(object)) {\n return object\n }\n\n const { data = {}, key = generateKey(), nodes = [] } = object\n\n const document = new Document({\n key,\n data: new Map(data),\n nodes: new List(nodes.map(Node.fromJSON)),\n })\n\n return document\n }\n\n /**\n * Alias `fromJS`.\n */\n\n static fromJS = Document.fromJSON\n\n /**\n * Check if `any` is a `Document`.\n *\n * @param {Any} any\n * @return {Boolean}\n */\n\n static isDocument(any) {\n return !!(any && any[MODEL_TYPES.DOCUMENT])\n }\n\n /**\n * Object.\n *\n * @return {String}\n */\n\n get object() {\n return 'document'\n }\n\n get kind() {\n logger.deprecate(\n 'slate@0.32.0',\n 'The `kind` property of Slate objects has been renamed to `object`.'\n )\n return this.object\n }\n\n /**\n * Check if the document is empty.\n * Returns true if all it's children nodes are empty.\n *\n * @return {Boolean}\n */\n\n get isEmpty() {\n return !this.nodes.some(child => !child.isEmpty)\n }\n\n /**\n * Get the concatenated text of all the document's children.\n *\n * @return {String}\n */\n\n get text() {\n return this.getText()\n }\n\n /**\n * Return a JSON representation of the document.\n *\n * @param {Object} options\n * @return {Object}\n */\n\n toJSON(options = {}) {\n const object = {\n object: this.object,\n data: this.data.toJSON(),\n nodes: this.nodes.toArray().map(n => n.toJSON(options)),\n }\n\n if (options.preserveKeys) {\n object.key = this.key\n }\n\n return object\n }\n\n /**\n * Alias `toJS`.\n */\n\n toJS(options) {\n return this.toJSON(options)\n }\n}\n\n/**\n * Attach a pseudo-symbol for type checking.\n */\n\nDocument.prototype[MODEL_TYPES.DOCUMENT] = true\n\n/**\n * Mix in `Node` methods.\n */\n\nObject.getOwnPropertyNames(Node.prototype).forEach(method => {\n if (method == 'constructor') return\n Document.prototype[method] = Node.prototype[method]\n})\n\n/**\n * Export.\n *\n * @type {Document}\n */\n\nexport default Document\n","/**\n * Prevent circular dependencies.\n */\n\nimport './document'\n\n/**\n * Dependencies.\n */\n\nimport isPlainObject from 'is-plain-object'\nimport logger from 'slate-dev-logger'\nimport { List, Map, Record } from 'immutable'\n\nimport MODEL_TYPES from '../constants/model-types'\nimport Node from './node'\nimport generateKey from '../utils/generate-key'\n\n/**\n * Default properties.\n *\n * @type {Object}\n */\n\nconst DEFAULTS = {\n data: new Map(),\n isVoid: false,\n key: undefined,\n nodes: new List(),\n type: undefined,\n}\n\n/**\n * Block.\n *\n * @type {Block}\n */\n\nclass Block extends Record(DEFAULTS) {\n /**\n * Create a new `Block` from `attrs`.\n *\n * @param {Object|String|Block} attrs\n * @return {Block}\n */\n\n static create(attrs = {}) {\n if (Block.isBlock(attrs)) {\n return attrs\n }\n\n if (typeof attrs == 'string') {\n attrs = { type: attrs }\n }\n\n if (isPlainObject(attrs)) {\n return Block.fromJSON(attrs)\n }\n\n throw new Error(\n `\\`Block.create\\` only accepts objects, strings or blocks, but you passed it: ${attrs}`\n )\n }\n\n /**\n * Create a list of `Blocks` from `attrs`.\n *\n * @param {Array<Block|Object>|List<Block|Object>} attrs\n * @return {List<Block>}\n */\n\n static createList(attrs = []) {\n if (List.isList(attrs) || Array.isArray(attrs)) {\n const list = new List(attrs.map(Block.create))\n return list\n }\n\n throw new Error(\n `\\`Block.createList\\` only accepts arrays or lists, but you passed it: ${attrs}`\n )\n }\n\n /**\n * Create a `Block` from a JSON `object`.\n *\n * @param {Object|Block} object\n * @return {Block}\n */\n\n static fromJSON(object) {\n if (Block.isBlock(object)) {\n return object\n }\n\n const {\n data = {},\n isVoid = false,\n key = generateKey(),\n nodes = [],\n type,\n } = object\n\n if (typeof type != 'string') {\n throw new Error('`Block.fromJSON` requires a `type` string.')\n }\n\n const block = new Block({\n key,\n type,\n isVoid: !!isVoid,\n data: new Map(data),\n nodes: new List(nodes.map(Node.fromJSON)),\n })\n\n return block\n }\n\n /**\n * Alias `fromJS`.\n */\n\n static fromJS = Block.fromJSON\n\n /**\n * Check if `any` is a `Block`.\n *\n * @param {Any} any\n * @return {Boolean}\n */\n\n static isBlock(any) {\n return !!(any && any[MODEL_TYPES.BLOCK])\n }\n\n /**\n * Check if `any` is a block list.\n *\n * @param {Any} any\n * @return {Boolean}\n */\n\n static isBlockList(any) {\n return List.isList(any) && any.every(item => Block.isBlock(item))\n }\n\n /**\n * Object.\n *\n * @return {String}\n */\n\n get object() {\n return 'block'\n }\n\n get kind() {\n logger.deprecate(\n 'slate@0.32.0',\n 'The `kind` property of Slate objects has been renamed to `object`.'\n )\n return this.object\n }\n\n /**\n * Check if the block is empty.\n * Returns true if block is not void and all it's children nodes are empty.\n * Void node is never empty, regardless of it's content.\n *\n * @return {Boolean}\n */\n\n get isEmpty() {\n return !this.isVoid && !this.nodes.some(child => !child.isEmpty)\n }\n\n /**\n * Get the concatenated text of all the block's children.\n *\n * @return {String}\n */\n\n get text() {\n return this.getText()\n }\n\n /**\n * Return a JSON representation of the block.\n *\n * @param {Object} options\n * @return {Object}\n */\n\n toJSON(options = {}) {\n const object = {\n object: this.object,\n type: this.type,\n isVoid: this.isVoid,\n data: this.data.toJSON(),\n nodes: this.nodes.toArray().map(n => n.toJSON(options)),\n }\n\n if (options.preserveKeys) {\n object.key = this.key\n }\n\n return object\n }\n\n /**\n * Alias `toJS`.\n */\n\n toJS(options) {\n return this.toJSON(options)\n }\n}\n\n/**\n * Attach a pseudo-symbol for type checking.\n */\n\nBlock.prototype[MODEL_TYPES.BLOCK] = true\n\n/**\n * Mix in `Node` methods.\n */\n\nObject.getOwnPropertyNames(Node.prototype).forEach(method => {\n if (method == 'constructor') return\n Block.prototype[method] = Node.prototype[method]\n})\n\n/**\n * Export.\n *\n * @type {Block}\n */\n\nexport default Block\n","import logger from 'slate-dev-logger'\nimport Block from '../models/block'\nimport Inline from '../models/inline'\nimport Mark from '../models/mark'\n\n/**\n * Changes.\n *\n * @type {Object}\n */\n\nconst Changes = {}\n\n/**\n * Mix in the changes that pass through to their at-range equivalents because\n * they don't have any effect on the selection.\n */\n\nconst PROXY_TRANSFORMS = [\n 'deleteBackward',\n 'deleteCharBackward',\n 'deleteLineBackward',\n 'deleteWordBackward',\n 'deleteForward',\n 'deleteCharForward',\n 'deleteWordForward',\n 'deleteLineForward',\n 'setBlocks',\n 'setInlines',\n 'splitInline',\n 'unwrapBlock',\n 'unwrapInline',\n 'wrapBlock',\n 'wrapInline',\n]\n\nPROXY_TRANSFORMS.forEach(method => {\n Changes[method] = (change, ...args) => {\n const { value } = change\n const { selection } = value\n const methodAtRange = `${method}AtRange`\n change[methodAtRange](selection, ...args)\n }\n})\n\nChanges.setBlock = (...args) => {\n logger.deprecate(\n 'slate@0.33.0',\n 'The `setBlock` method of Slate changes has been renamed to `setBlocks`.'\n )\n Changes.setBlocks(...args)\n}\n\nChanges.setInline = (...args) => {\n logger.deprecate(\n 'slate@0.33.0',\n 'The `setInline` method of Slate changes has been renamed to `setInlines`.'\n )\n Changes.setInlines(...args)\n}\n\n/**\n * Add a `mark` to the characters in the current selection.\n *\n * @param {Change} change\n * @param {Mark} mark\n */\n\nChanges.addMark = (change, mark) => {\n mark = Mark.create(mark)\n const { value } = change\n const { document, selection } = value\n\n if (selection.isExpanded) {\n change.addMarkAtRange(selection, mark)\n } else if (selection.marks) {\n const marks = selection.marks.add(mark)\n const sel = selection.set('marks', marks)\n change.select(sel)\n } else {\n const marks = document.getActiveMarksAtRange(selection).add(mark)\n const sel = selection.set('marks', marks)\n change.select(sel)\n }\n}\n\n/**\n * Add a list of `marks` to the characters in the current selection.\n *\n * @param {Change} change\n * @param {Mark} mark\n */\n\nChanges.addMarks = (change, marks) => {\n marks.forEach(mark => change.addMark(mark))\n}\n\n/**\n * Delete at the current selection.\n *\n * @param {Change} change\n */\n\nChanges.delete = change => {\n const { value } = change\n const { selection } = value\n change.deleteAtRange(selection)\n\n // Ensure that the selection is collapsed to the start, because in certain\n // cases when deleting across inline nodes, when splitting the inline node the\n // end point of the selection will end up after the split point.\n change.collapseToStart()\n}\n\n/**\n * Insert a `block` at the current selection.\n *\n * @param {Change} change\n * @param {String|Object|Block} block\n */\n\nChanges.insertBlock = (change, block) => {\n block = Block.create(block)\n const { value } = change\n const { selection } = value\n change.insertBlockAtRange(selection, block)\n\n // If the node was successfully inserted, update the selection.\n const node = change.value.document.getNode(block.key)\n if (node) change.collapseToEndOf(node)\n}\n\n/**\n * Insert a `fragment` at the current selection.\n *\n * @param {Change} change\n * @param {Document} fragment\n */\n\nChanges.insertFragment = (change, fragment) => {\n if (!fragment.nodes.size) return\n\n let { value } = change\n let { document, selection } = value\n const { startText, endText, startInline } = value\n const lastText = fragment.getLastText()\n const lastInline = fragment.getClosestInline(lastText.key)\n const keys = document.getTexts().map(text => text.key)\n const isAppending =\n !startInline ||\n selection.hasEdgeAtStartOf(startText) ||\n selection.hasEdgeAtEndOf(endText)\n\n change.insertFragmentAtRange(selection, fragment)\n value = change.value\n document = value.document\n\n const newTexts = document.getTexts().filter(n => !keys.includes(n.key))\n const newText = isAppending ? newTexts.last() : newTexts.takeLast(2).first()\n\n if (newText && lastInline) {\n change.select(selection.collapseToEndOf(newText))\n } else if (newText) {\n change.select(\n selection.collapseToStartOf(newText).move(lastText.text.length)\n )\n } else {\n change.select(selection.collapseToStart().move(lastText.text.length))\n }\n}\n\n/**\n * Insert an `inline` at the current selection.\n *\n * @param {Change} change\n * @param {String|Object|Inline} inline\n */\n\nChanges.insertInline = (change, inline) => {\n inline = Inline.create(inline)\n const { value } = change\n const { selection } = value\n change.insertInlineAtRange(selection, inline)\n\n // If the node was successfully inserted, update the selection.\n const node = change.value.document.getNode(inline.key)\n if (node) change.collapseToEndOf(node)\n}\n\n/**\n * Insert a string of `text` with optional `marks` at the current selection.\n *\n * @param {Change} change\n * @param {String} text\n * @param {Set<Mark>} marks (optional)\n */\n\nChanges.insertText = (change, text, marks) => {\n const { value } = change\n const { document, selection } = value\n marks = marks || selection.marks || document.getInsertMarksAtRange(selection)\n change.insertTextAtRange(selection, text, marks)\n\n // If the text was successfully inserted, and the selection had marks on it,\n // unset the selection's marks.\n if (selection.marks && document != change.value.document) {\n change.select({ marks: null })\n }\n}\n\n/**\n * Split the block node at the current selection, to optional `depth`.\n *\n * @param {Change} change\n * @param {Number} depth (optional)\n */\n\nChanges.splitBlock = (change, depth = 1) => {\n const { value } = change\n const { selection } = value\n change.splitBlockAtRange(selection, depth).collapseToEnd()\n}\n\n/**\n * Remove a `mark` from the characters in the current selection.\n *\n * @param {Change} change\n * @param {Mark} mark\n */\n\nChanges.removeMark = (change, mark) => {\n mark = Mark.create(mark)\n const { value } = change\n const { document, selection } = value\n\n if (selection.isExpanded) {\n change.removeMarkAtRange(selection, mark)\n } else if (selection.marks) {\n const marks = selection.marks.remove(mark)\n const sel = selection.set('marks', marks)\n change.select(sel)\n } else {\n const marks = document.getActiveMarksAtRange(selection).remove(mark)\n const sel = selection.set('marks', marks)\n change.select(sel)\n }\n}\n\n/**\n * Add or remove a `mark` from the characters in the current selection,\n * depending on whether it's already there.\n *\n * @param {Change} change\n * @param {Mark} mark\n */\n\nChanges.toggleMark = (change, mark) => {\n mark = Mark.create(mark)\n const { value } = change\n const exists = value.activeMarks.has(mark)\n\n if (exists) {\n change.removeMark(mark)\n } else {\n change.addMark(mark)\n }\n}\n\n/**\n * Wrap the current selection with prefix/suffix.\n *\n * @param {Change} change\n * @param {String} prefix\n * @param {String} suffix\n */\n\nChanges.wrapText = (change, prefix, suffix = prefix) => {\n const { value } = change\n const { selection } = value\n change.wrapTextAtRange(selection, prefix, suffix)\n\n // If the selection was collapsed, it will have moved the start offset too.\n if (selection.isCollapsed) {\n change.moveStart(0 - prefix.length)\n }\n\n // Adding the suffix will have pushed the end of the selection further on, so\n // we need to move it back to account for this.\n change.moveEnd(0 - suffix.length)\n\n // There's a chance that the selection points moved \"through\" each other,\n // resulting in a now-incorrect selection direction.\n if (selection.isForward != change.value.selection.isForward) {\n change.flip()\n }\n}\n\n/**\n * Export.\n *\n * @type {Object}\n */\n\nexport default Changes\n","import { reverse } from 'esrever'\n\n/**\n * Surrogate pair start and end points.\n *\n * @type {Number}\n */\n\nconst SURROGATE_START = 0xd800\nconst SURROGATE_END = 0xdfff\n\n/**\n * A regex to match space characters.\n *\n * @type {RegExp}\n */\n\nconst SPACE = /\\s/\n\n/**\n * A regex to match chameleon characters, that count as word characters as long\n * as they are inside of a word.\n *\n * @type {RegExp}\n */\n\nconst CHAMELEON = /['\\u2018\\u2019]/\n\n/**\n * A regex that matches punctuation.\n *\n * @type {RegExp}\n */\n\nconst PUNCTUATION = /[\\u0021-\\u0023\\u0025-\\u002A\\u002C-\\u002F\\u003A\\u003B\\u003F\\u0040\\u005B-\\u005D\\u005F\\u007B\\u007D\\u00A1\\u00A7\\u00AB\\u00B6\\u00B7\\u00BB\\u00BF\\u037E\\u0387\\u055A-\\u055F\\u0589\\u058A\\u05BE\\u05C0\\u05C3\\u05C6\\u05F3\\u05F4\\u0609\\u060A\\u060C\\u060D\\u061B\\u061E\\u061F\\u066A-\\u066D\\u06D4\\u0700-\\u070D\\u07F7-\\u07F9\\u0830-\\u083E\\u085E\\u0964\\u0965\\u0970\\u0AF0\\u0DF4\\u0E4F\\u0E5A\\u0E5B\\u0F04-\\u0F12\\u0F14\\u0F3A-\\u0F3D\\u0F85\\u0FD0-\\u0FD4\\u0FD9\\u0FDA\\u104A-\\u104F\\u10FB\\u1360-\\u1368\\u1400\\u166D\\u166E\\u169B\\u169C\\u16EB-\\u16ED\\u1735\\u1736\\u17D4-\\u17D6\\u17D8-\\u17DA\\u1800-\\u180A\\u1944\\u1945\\u1A1E\\u1A1F\\u1AA0-\\u1AA6\\u1AA8-\\u1AAD\\u1B5A-\\u1B60\\u1BFC-\\u1BFF\\u1C3B-\\u1C3F\\u1C7E\\u1C7F\\u1CC0-\\u1CC7\\u1CD3\\u2010-\\u2027\\u2030-\\u2043\\u2045-\\u2051\\u2053-\\u205E\\u207D\\u207E\\u208D\\u208E\\u2329\\u232A\\u2768-\\u2775\\u27C5\\u27C6\\u27E6-\\u27EF\\u2983-\\u2998\\u29D8-\\u29DB\\u29FC\\u29FD\\u2CF9-\\u2CFC\\u2CFE\\u2CFF\\u2D70\\u2E00-\\u2E2E\\u2E30-\\u2E3B\\u3001-\\u3003\\u3008-\\u3011\\u3014-\\u301F\\u3030\\u303D\\u30A0\\u30FB\\uA4FE\\uA4FF\\uA60D-\\uA60F\\uA673\\uA67E\\uA6F2-\\uA6F7\\uA874-\\uA877\\uA8CE\\uA8CF\\uA8F8-\\uA8FA\\uA92E\\uA92F\\uA95F\\uA9C1-\\uA9CD\\uA9DE\\uA9DF\\uAA5C-\\uAA5F\\uAADE\\uAADF\\uAAF0\\uAAF1\\uABEB\\uFD3E\\uFD3F\\uFE10-\\uFE19\\uFE30-\\uFE52\\uFE54-\\uFE61\\uFE63\\uFE68\\uFE6A\\uFE6B\\uFF01-\\uFF03\\uFF05-\\uFF0A\\uFF0C-\\uFF0F\\uFF1A\\uFF1B\\uFF1F\\uFF20\\uFF3B-\\uFF3D\\uFF3F\\uFF5B\\uFF5D\\uFF5F-\\uFF65]/\n\n/**\n * Is a character `code` in a surrogate character.\n *\n * @param {Number} code\n * @return {Boolean}\n */\n\nfunction isSurrogate(code) {\n return SURROGATE_START <= code && code <= SURROGATE_END\n}\n\n/**\n * Is a character a word character? Needs the `remaining` characters too.\n *\n * @param {String} char\n * @param {String|Void} remaining\n * @return {Boolean}\n */\n\nfunction isWord(char, remaining) {\n if (SPACE.test(char)) return false\n\n // If it's a chameleon character, recurse to see if the next one is or not.\n if (CHAMELEON.test(char)) {\n let next = remaining.charAt(0)\n const length = getCharLength(next)\n next = remaining.slice(0, length)\n const rest = remaining.slice(length)\n if (isWord(next, rest)) return true\n }\n\n if (PUNCTUATION.test(char)) return false\n return true\n}\n\n/**\n * Get the length of a `character`.\n *\n * @param {String} char\n * @return {Number}\n */\n\nfunction getCharLength(char) {\n return isSurrogate(char.charCodeAt(0)) ? 2 : 1\n}\n\n/**\n * Get the offset to the end of the first character in `text`.\n *\n * @param {String} text\n * @return {Number}\n */\n\nfunction getCharOffset(text) {\n const char = text.charAt(0)\n return getCharLength(char)\n}\n\n/**\n * Get the offset to the end of the character before an `offset` in `text`.\n *\n * @param {String} text\n * @param {Number} offset\n * @return {Number}\n */\n\nfunction getCharOffsetBackward(text, offset) {\n text = text.slice(0, offset)\n text = reverse(text)\n return getCharOffset(text)\n}\n\n/**\n * Get the offset to the end of the character after an `offset` in `text`.\n *\n * @param {String} text\n * @param {Number} offset\n * @return {Number}\n */\n\nfunction getCharOffsetForward(text, offset) {\n text = text.slice(offset)\n return getCharOffset(text)\n}\n\n/**\n * Get the offset to the end of the first word in `text`.\n *\n * @param {String} text\n * @return {Number}\n */\n\nfunction getWordOffset(text) {\n let length = 0\n let i = 0\n let started = false\n let char\n\n while ((char = text.charAt(i))) {\n const l = getCharLength(char)\n char = text.slice(i, i + l)\n const rest = text.slice(i + l)\n\n if (isWord(char, rest)) {\n started = true\n length += l\n } else if (!started) {\n length += l\n } else {\n break\n }\n\n i += l\n }\n\n return length\n}\n\n/**\n * Get the offset to the end of the word before an `offset` in `text`.\n *\n * @param {String} text\n * @param {Number} offset\n * @return {Number}\n */\n\nfunction getWordOffsetBackward(text, offset) {\n text = text.slice(0, offset)\n text = reverse(text)\n const o = getWordOffset(text)\n return o\n}\n\n/**\n * Get the offset to the end of the word after an `offset` in `text`.\n *\n * @param {String} text\n * @param {Number} offset\n * @return {Number}\n */\n\nfunction getWordOffsetForward(text, offset) {\n text = text.slice(offset)\n const o = getWordOffset(text)\n return o\n}\n\n/**\n * Export.\n *\n * @type {Object}\n */\n\nexport default {\n getCharOffsetForward,\n getCharOffsetBackward,\n getWordOffsetBackward,\n getWordOffsetForward,\n}\n","import { List } from 'immutable'\nimport logger from 'slate-dev-logger'\n\nimport Block from '../models/block'\nimport Inline from '../models/inline'\nimport Mark from '../models/mark'\nimport Node from '../models/node'\nimport String from '../utils/string'\n\n/**\n * Changes.\n *\n * @type {Object}\n */\n\nconst Changes = {}\n\n/**\n * Add a new `mark` to the characters at `range`.\n *\n * @param {Change} change\n * @param {Range} range\n * @param {Mixed} mark\n * @param {Object} options\n * @property {Boolean} normalize\n */\n\nChanges.addMarkAtRange = (change, range, mark, options = {}) => {\n if (range.isCollapsed) return\n\n const normalize = change.getFlag('normalize', options)\n const { value } = change\n const { document } = value\n const { startKey, startOffset, endKey, endOffset } = range\n const texts = document.getTextsAtRange(range)\n\n texts.forEach(node => {\n const { key } = node\n let index = 0\n let length = node.text.length\n\n if (key == startKey) index = startOffset\n if (key == endKey) length = endOffset\n if (key == startKey && key == endKey) length = endOffset - startOffset\n\n change.addMarkByKey(key, index, length, mark, { normalize })\n })\n}\n\n/**\n * Add a list of `marks` to the characters at `range`.\n *\n * @param {Change} change\n * @param {Range} range\n * @param {Array<Mixed>} mark\n * @param {Object} options\n * @property {Boolean} normalize\n */\n\nChanges.addMarksAtRange = (change, range, marks, options = {}) => {\n marks.forEach(mark => change.addMarkAtRange(range, mark, options))\n}\n\n/**\n * Delete everything in a `range`.\n *\n * @param {Change} change\n * @param {Range} range\n * @param {Object} options\n * @property {Boolean} normalize\n */\n\nChanges.deleteAtRange = (change, range, options = {}) => {\n if (range.isCollapsed) return\n\n // Snapshot the selection, which creates an extra undo save point, so that\n // when you undo a delete, the expanded selection will be retained.\n change.snapshotSelection()\n\n const normalize = change.getFlag('normalize', options)\n const { value } = change\n let { startKey, startOffset, endKey, endOffset } = range\n let { document } = value\n let isStartVoid = document.hasVoidParent(startKey)\n let isEndVoid = document.hasVoidParent(endKey)\n let startBlock = document.getClosestBlock(startKey)\n let endBlock = document.getClosestBlock(endKey)\n\n // Check if we have a \"hanging\" selection case where the even though the\n // selection extends into the start of the end node, we actually want to\n // ignore that for UX reasons.\n const isHanging =\n startOffset == 0 &&\n endOffset == 0 &&\n isStartVoid == false &&\n startKey == startBlock.getFirstText().key &&\n endKey == endBlock.getFirstText().key\n\n // If it's a hanging selection, nudge it back to end in the previous text.\n if (isHanging && isEndVoid) {\n const prevText = document.getPreviousText(endKey)\n endKey = prevText.key\n endOffset = prevText.text.length\n isEndVoid = document.hasVoidParent(endKey)\n }\n\n // If the start node is inside a void node, remove the void node and update\n // the starting point to be right after it, continuously until the start point\n // is not a void, or until the entire range is handled.\n while (isStartVoid) {\n const startVoid = document.getClosestVoid(startKey)\n const nextText = document.getNextText(startKey)\n change.removeNodeByKey(startVoid.key, { normalize: false })\n\n // If the start and end keys are the same, we're done.\n if (startKey == endKey) return\n\n // If there is no next text node, we're done.\n if (!nextText) return\n\n // Continue...\n document = change.value.document\n startKey = nextText.key\n startOffset = 0\n isStartVoid = document.hasVoidParent(startKey)\n }\n\n // If the end node is inside a void node, do the same thing but backwards. But\n // we don't need any aborting checks because if we've gotten this far there\n // must be a non-void node that will exit the loop.\n while (isEndVoid) {\n const endVoid = document.getClosestVoid(endKey)\n const prevText = document.getPreviousText(endKey)\n change.removeNodeByKey(endVoid.key, { normalize: false })\n\n // Continue...\n document = change.value.document\n endKey = prevText.key\n endOffset = prevText.text.length\n isEndVoid = document.hasVoidParent(endKey)\n }\n\n // If the start and end key are the same, and it was a hanging selection, we\n // can just remove the entire block.\n if (startKey == endKey && isHanging) {\n change.removeNodeByKey(startBlock.key, { normalize })\n return\n } else if (startKey == endKey) {\n // Otherwise, if it wasn't hanging, we're inside a single text node, so we can\n // simply remove the text in the range.\n const index = startOffset\n const length = endOffset - startOffset\n change.removeTextByKey(startKey, index, length, { normalize })\n return\n } else {\n // Otherwise, we need to recursively remove text and nodes inside the start\n // block after the start offset and inside the end block before the end\n // offset. Then remove any blocks that are in between the start and end\n // blocks. Then finally merge the start and end nodes.\n startBlock = document.getClosestBlock(startKey)\n endBlock = document.getClosestBlock(endKey)\n const startText = document.getNode(startKey)\n const endText = document.getNode(endKey)\n const startLength = startText.text.length - startOffset\n const endLength = endOffset\n\n const ancestor = document.getCommonAncestor(startKey, endKey)\n const startChild = ancestor.getFurthestAncestor(startKey)\n const endChild = ancestor.getFurthestAncestor(endKey)\n\n const startParent = document.getParent(startBlock.key)\n const startParentIndex = startParent.nodes.indexOf(startBlock)\n const endParentIndex = startParent.nodes.indexOf(endBlock)\n\n let child\n\n // Iterate through all of the nodes in the tree after the start text node\n // but inside the end child, and remove them.\n child = startText\n\n while (child.key != startChild.key) {\n const parent = document.getParent(child.key)\n const index = parent.nodes.indexOf(child)\n const afters = parent.nodes.slice(index + 1)\n\n afters.reverse().forEach(node => {\n change.removeNodeByKey(node.key, { normalize: false })\n })\n\n child = parent\n }\n\n // Remove all of the middle children.\n const startChildIndex = ancestor.nodes.indexOf(startChild)\n const endChildIndex = ancestor.nodes.indexOf(endChild)\n const middles = ancestor.nodes.slice(startChildIndex + 1, endChildIndex)\n\n middles.reverse().forEach(node => {\n change.removeNodeByKey(node.key, { normalize: false })\n })\n\n // Remove the nodes before the end text node in the tree.\n child = endText\n\n while (child.key != endChild.key) {\n const parent = document.getParent(child.key)\n const index = parent.nodes.indexOf(child)\n const befores = parent.nodes.slice(0, index)\n\n befores.reverse().forEach(node => {\n change.removeNodeByKey(node.key, { normalize: false })\n })\n\n child = parent\n }\n\n // Remove any overlapping text content from the leaf text nodes.\n if (startLength != 0) {\n change.removeTextByKey(startKey, startOffset, startLength, {\n normalize: false,\n })\n }\n\n if (endLength != 0) {\n change.removeTextByKey(endKey, 0, endOffset, { normalize: false })\n }\n\n // If the start and end blocks aren't the same, move and merge the end block\n // into the start block.\n if (startBlock.key != endBlock.key) {\n document = change.value.document\n const lonely = document.getFurthestOnlyChildAncestor(endBlock.key)\n\n // Move the end block to be right after the start block.\n if (endParentIndex != startParentIndex + 1) {\n change.moveNodeByKey(\n endBlock.key,\n startParent.key,\n startParentIndex + 1,\n { normalize: false }\n )\n }\n\n // If the selection is hanging, just remove the start block, otherwise\n // merge the end block into it.\n if (isHanging) {\n change.removeNodeByKey(startBlock.key, { normalize: false })\n } else {\n change.mergeNodeByKey(endBlock.key, { normalize: false })\n }\n\n // If nested empty blocks are left over above the end block, remove them.\n if (lonely) {\n change.removeNodeByKey(lonely.key, { normalize: false })\n }\n }\n\n // If we should normalize, do it now after everything.\n if (normalize) {\n change.normalizeNodeByKey(ancestor.key)\n }\n }\n}\n\n/**\n * Delete backward until the character boundary at a `range`.\n *\n * @param {Change} change\n * @param {Range} range\n * @param {Object} options\n * @property {Boolean} normalize\n */\n\nChanges.deleteCharBackwardAtRange = (change, range, options) => {\n const { value } = change\n const { document } = value\n const { startKey, startOffset } = range\n const startBlock = document.getClosestBlock(startKey)\n const offset = startBlock.getOffset(startKey)\n const o = offset + startOffset\n const { text } = startBlock\n const n = String.getCharOffsetBackward(text, o)\n change.deleteBackwardAtRange(range, n, options)\n}\n\n/**\n * Delete backward until the line boundary at a `range`.\n *\n * @param {Change} change\n * @param {Range} range\n * @param {Object} options\n * @property {Boolean} normalize\n */\n\nChanges.deleteLineBackwardAtRange = (change, range, options) => {\n const { value } = change\n const { document } = value\n const { startKey, startOffset } = range\n const startBlock = document.getClosestBlock(startKey)\n const offset = startBlock.getOffset(startKey)\n const o = offset + startOffset\n change.deleteBackwardAtRange(range, o, options)\n}\n\n/**\n * Delete backward until the word boundary at a `range`.\n *\n * @param {Change} change\n * @param {Range} range\n * @param {Object} options\n * @property {Boolean} normalize\n */\n\nChanges.deleteWordBackwardAtRange = (change, range, options) => {\n const { value } = change\n const { document } = value\n const { startKey, startOffset } = range\n const startBlock = document.getClosestBlock(startKey)\n const offset = startBlock.getOffset(startKey)\n const o = offset + startOffset\n const { text } = startBlock\n const n = String.getWordOffsetBackward(text, o)\n change.deleteBackwardAtRange(range, n, options)\n}\n\n/**\n * Delete backward `n` characters at a `range`.\n *\n * @param {Change} change\n * @param {Range} range\n * @param {Number} n (optional)\n * @param {Object} options\n * @property {Boolean} normalize\n */\n\nChanges.deleteBackwardAtRange = (change, range, n = 1, options = {}) => {\n const normalize = change.getFlag('normalize', options)\n const { value } = change\n const { document } = value\n const { startKey, focusOffset } = range\n\n // If the range is expanded, perform a regular delete instead.\n if (range.isExpanded) {\n change.deleteAtRange(range, { normalize })\n return\n }\n\n const voidParent = document.getClosestVoid(startKey)\n\n // If there is a void parent, delete it.\n if (voidParent) {\n change.removeNodeByKey(voidParent.key, { normalize })\n return\n }\n\n const block = document.getClosestBlock(startKey)\n\n // If the closest is not void, but empty, remove it\n if (block && block.isEmpty && document.nodes.size !== 1) {\n change.removeNodeByKey(block.key, { normalize })\n return\n }\n\n // If the range is at the start of the document, abort.\n if (range.isAtStartOf(document)) {\n return\n }\n\n // If the range is at the start of the text node, we need to figure out what\n // is behind it to know how to delete...\n const text = document.getDescendant(startKey)\n if (range.isAtStartOf(text)) {\n const prev = document.getPreviousText(text.key)\n const prevBlock = document.getClosestBlock(prev.key)\n const prevVoid = document.getClosestVoid(prev.key)\n\n // If the previous text node has a void parent, remove it.\n if (prevVoid) {\n change.removeNodeByKey(prevVoid.key, { normalize })\n return\n }\n\n // If we're deleting by one character and the previous text node is not\n // inside the current block, we need to merge the two blocks together.\n if (n == 1 && prevBlock != block) {\n range = range.merge({\n anchorKey: prev.key,\n anchorOffset: prev.text.length,\n })\n\n change.deleteAtRange(range, { normalize })\n return\n }\n }\n\n // If the focus offset is farther than the number of characters to delete,\n // just remove the characters backwards inside the current node.\n if (n < focusOffset) {\n range = range.merge({\n focusOffset: focusOffset - n,\n isBackward: true,\n })\n\n change.deleteAtRange(range, { normalize })\n return\n }\n\n // Otherwise, we need to see how many nodes backwards to go.\n let node = text\n let offset = 0\n let traversed = focusOffset\n\n while (n > traversed) {\n node = document.getPreviousText(node.key)\n const next = traversed + node.text.length\n if (n <= next) {\n offset = next - n\n break\n } else {\n traversed = next\n }\n }\n\n range = range.merge({\n focusKey: node.key,\n focusOffset: offset,\n isBackward: true,\n })\n\n change.deleteAtRange(range, { normalize })\n}\n\n/**\n * Delete forward until the character boundary at a `range`.\n *\n * @param {Change} change\n * @param {Range} range\n * @param {Object} options\n * @property {Boolean} normalize\n */\n\nChanges.deleteCharForwardAtRange = (change, range, options) => {\n const { value } = change\n const { document } = value\n const { startKey, startOffset } = range\n const startBlock = document.getClosestBlock(startKey)\n const offset = startBlock.getOffset(startKey)\n const o = offset + startOffset\n const { text } = startBlock\n const n = String.getCharOffsetForward(text, o)\n change.deleteForwardAtRange(range, n, options)\n}\n\n/**\n * Delete forward until the line boundary at a `range`.\n *\n * @param {Change} change\n * @param {Range} range\n * @param {Object} options\n * @property {Boolean} normalize\n */\n\nChanges.deleteLineForwardAtRange = (change, range, options) => {\n const { value } = change\n const { document } = value\n const { startKey, startOffset } = range\n const startBlock = document.getClosestBlock(startKey)\n const offset = startBlock.getOffset(startKey)\n const o = offset + startOffset\n change.deleteForwardAtRange(range, o, options)\n}\n\n/**\n * Delete forward until the word boundary at a `range`.\n *\n * @param {Change} change\n * @param {Range} range\n * @param {Object} options\n * @property {Boolean} normalize\n */\n\nChanges.deleteWordForwardAtRange = (change, range, options) => {\n const { value } = change\n const { document } = value\n const { startKey, startOffset } = range\n const startBlock = document.getClosestBlock(startKey)\n const offset = startBlock.getOffset(startKey)\n const o = offset + startOffset\n const { text } = startBlock\n const n = String.getWordOffsetForward(text, o)\n change.deleteForwardAtRange(range, n, options)\n}\n\n/**\n * Delete forward `n` characters at a `range`.\n *\n * @param {Change} change\n * @param {Range} range\n * @param {Number} n (optional)\n * @param {Object} options\n * @property {Boolean} normalize\n */\n\nChanges.deleteForwardAtRange = (change, range, n = 1, options = {}) => {\n const normalize = change.getFlag('normalize', options)\n const { value } = change\n const { document } = value\n const { startKey, focusOffset } = range\n\n // If the range is expanded, perform a regular delete instead.\n if (range.isExpanded) {\n change.deleteAtRange(range, { normalize })\n return\n }\n\n const voidParent = document.getClosestVoid(startKey)\n\n // If the node has a void parent, delete it.\n if (voidParent) {\n change.removeNodeByKey(voidParent.key, { normalize })\n return\n }\n\n const block = document.getClosestBlock(startKey)\n\n // If the closest is not void, but empty, remove it\n if (block && block.isEmpty && document.nodes.size !== 1) {\n const nextBlock = document.getNextBlock(block.key)\n change.removeNodeByKey(block.key, { normalize })\n if (nextBlock && nextBlock.key) {\n change.moveToStartOf(nextBlock)\n }\n return\n }\n\n // If the range is at the start of the document, abort.\n if (range.isAtEndOf(document)) {\n return\n }\n\n // If the range is at the start of the text node, we need to figure out what\n // is behind it to know how to delete...\n const text = document.getDescendant(startKey)\n if (range.isAtEndOf(text)) {\n const next = document.getNextText(text.key)\n const nextBlock = document.getClosestBlock(next.key)\n const nextVoid = document.getClosestVoid(next.key)\n\n // If the next text node has a void parent, remove it.\n if (nextVoid) {\n change.removeNodeByKey(nextVoid.key, { normalize })\n return\n }\n\n // If we're deleting by one character and the previous text node is not\n // inside the current block, we need to merge the two blocks together.\n if (n == 1 && nextBlock != block) {\n range = range.merge({\n focusKey: next.key,\n focusOffset: 0,\n })\n\n change.deleteAtRange(range, { normalize })\n return\n }\n }\n\n // If the remaining characters to the end of the node is greater than or equal\n // to the number of characters to delete, just remove the characters forwards\n // inside the current node.\n if (n <= text.text.length - focusOffset) {\n range = range.merge({\n focusOffset: focusOffset + n,\n })\n\n change.deleteAtRange(range, { normalize })\n return\n }\n\n // Otherwise, we need to see how many nodes forwards to go.\n let node = text\n let offset = focusOffset\n let traversed = text.text.length - focusOffset\n\n while (n > traversed) {\n node = document.getNextText(node.key)\n const next = traversed + node.text.length\n if (n <= next) {\n offset = n - traversed\n break\n } else {\n traversed = next\n }\n }\n\n // If the focus node is inside a void, go up until right before it.\n if (document.hasVoidParent(node.key)) {\n const parent = document.getClosestVoid(node.key)\n node = document.getPreviousText(parent.key)\n offset = node.text.length\n }\n\n range = range.merge({\n focusKey: node.key,\n focusOffset: offset,\n })\n\n change.deleteAtRange(range, { normalize })\n}\n\n/**\n * Insert a `block` node at `range`.\n *\n * @param {Change} change\n * @param {Range} range\n * @param {Block|String|Object} block\n * @param {Object} options\n * @property {Boolean} normalize\n */\n\nChanges.insertBlockAtRange = (change, range, block, options = {}) => {\n block = Block.create(block)\n const normalize = change.getFlag('normalize', options)\n\n if (range.isExpanded) {\n change.deleteAtRange(range)\n range = range.collapseToStart()\n }\n\n const { value } = change\n const { document } = value\n const { startKey, startOffset } = range\n const startBlock = document.getClosestBlock(startKey)\n const parent = document.getParent(startBlock.key)\n const index = parent.nodes.indexOf(startBlock)\n\n if (startBlock.isVoid) {\n const extra = range.isAtEndOf(startBlock) ? 1 : 0\n change.insertNodeByKey(parent.key, index + extra, block, { normalize })\n } else if (startBlock.isEmpty) {\n change.insertNodeByKey(parent.key, index + 1, block, { normalize })\n } else if (range.isAtStartOf(startBlock)) {\n change.insertNodeByKey(parent.key, index, block, { normalize })\n } else if (range.isAtEndOf(startBlock)) {\n change.insertNodeByKey(parent.key, index + 1, block, { normalize })\n } else {\n change.splitDescendantsByKey(startBlock.key, startKey, startOffset, {\n normalize: false,\n })\n change.insertNodeByKey(parent.key, index + 1, block, { normalize })\n }\n\n if (normalize) {\n change.normalizeNodeByKey(parent.key)\n }\n}\n\n/**\n * Insert a `fragment` at a `range`.\n *\n * @param {Change} change\n * @param {Range} range\n * @param {Document} fragment\n * @param {Object} options\n * @property {Boolean} normalize\n */\n\nChanges.insertFragmentAtRange = (change, range, fragment, options = {}) => {\n const normalize = change.getFlag('normalize', options)\n\n // If the range is expanded, delete it first.\n if (range.isExpanded) {\n change.deleteAtRange(range, { normalize: false })\n range = range.collapseToStart()\n }\n\n // If the fragment is empty, there's nothing to do after deleting.\n if (!fragment.nodes.size) return\n\n // Regenerate the keys for all of the fragments nodes, so that they're\n // guaranteed not to collide with the existing keys in the document. Otherwise\n // they will be rengerated automatically and we won't have an easy way to\n // reference them.\n fragment = fragment.mapDescendants(child => child.regenerateKey())\n\n // Calculate a few things...\n const { startKey, startOffset } = range\n const { value } = change\n let { document } = value\n let startText = document.getDescendant(startKey)\n let startBlock = document.getClosestBlock(startText.key)\n let startChild = startBlock.getFurthestAncestor(startText.key)\n const isAtStart = range.isAtStartOf(startBlock)\n const parent = document.getParent(startBlock.key)\n const index = parent.nodes.indexOf(startBlock)\n const blocks = fragment.getBlocks()\n const firstBlock = blocks.first()\n const lastBlock = blocks.last()\n\n // If the fragment only contains a void block, use `insertBlock` instead.\n if (firstBlock == lastBlock && firstBlock.isVoid) {\n change.insertBlockAtRange(range, firstBlock, options)\n return\n }\n\n // If the first and last block aren't the same, we need to insert all of the\n // nodes after the fragment's first block at the index.\n if (firstBlock != lastBlock) {\n const lonelyParent = fragment.getFurthest(\n firstBlock.key,\n p => p.nodes.size == 1\n )\n const lonelyChild = lonelyParent || firstBlock\n const startIndex = parent.nodes.indexOf(startBlock)\n fragment = fragment.removeDescendant(lonelyChild.key)\n\n fragment.nodes.forEach((node, i) => {\n const newIndex = startIndex + i + 1\n change.insertNodeByKey(parent.key, newIndex, node, { normalize: false })\n })\n }\n\n // Check if we need to split the node.\n if (startOffset != 0) {\n change.splitDescendantsByKey(startChild.key, startKey, startOffset, {\n normalize: false,\n })\n }\n\n // Update our variables with the new value.\n document = change.value.document\n startText = document.getDescendant(startKey)\n startBlock = document.getClosestBlock(startKey)\n startChild = startBlock.getFurthestAncestor(startText.key)\n\n // If the first and last block aren't the same, we need to move any of the\n // starting block's children after the split into the last block of the\n // fragment, which has already been inserted.\n if (firstBlock != lastBlock) {\n const nextChild = isAtStart\n ? startChild\n : startBlock.getNextSibling(startChild.key)\n const nextNodes = nextChild\n ? startBlock.nodes.skipUntil(n => n.key == nextChild.key)\n : List()\n const lastIndex = lastBlock.nodes.size\n\n nextNodes.forEach((node, i) => {\n const newIndex = lastIndex + i\n change.moveNodeByKey(node.key, lastBlock.key, newIndex, {\n normalize: false,\n })\n })\n }\n\n // If the starting block is empty, we replace it entirely with the first block\n // of the fragment, since this leads to a more expected behavior for the user.\n if (startBlock.isEmpty) {\n change.removeNodeByKey(startBlock.key, { normalize: false })\n change.insertNodeByKey(parent.key, index, firstBlock, { normalize: false })\n } else {\n // Otherwise, we maintain the starting block, and insert all of the first\n // block's inline nodes into it at the split point.\n const inlineChild = startBlock.getFurthestAncestor(startText.key)\n const inlineIndex = startBlock.nodes.indexOf(inlineChild)\n\n firstBlock.nodes.forEach((inline, i) => {\n const o = startOffset == 0 ? 0 : 1\n const newIndex = inlineIndex + i + o\n change.insertNodeByKey(startBlock.key, newIndex, inline, {\n normalize: false,\n })\n })\n }\n\n // Normalize if requested.\n if (normalize) {\n change.normalizeNodeByKey(parent.key)\n }\n}\n\n/**\n * Insert an `inline` node at `range`.\n *\n * @param {Change} change\n * @param {Range} range\n * @param {Inline|String|Object} inline\n * @param {Object} options\n * @property {Boolean} normalize\n */\n\nChanges.insertInlineAtRange = (change, range, inline, options = {}) => {\n const normalize = change.getFlag('normalize', options)\n inline = Inline.create(inline)\n\n if (range.isExpanded) {\n change.deleteAtRange(range, { normalize: false })\n range = range.collapseToStart()\n }\n\n const { value } = change\n const { document } = value\n const { startKey, startOffset } = range\n const parent = document.getParent(startKey)\n const startText = document.assertDescendant(startKey)\n const index = parent.nodes.indexOf(startText)\n\n if (parent.isVoid) return\n\n change.splitNodeByKey(startKey, startOffset, { normalize: false })\n change.insertNodeByKey(parent.key, index + 1, inline, { normalize: false })\n\n if (normalize) {\n change.normalizeNodeByKey(parent.key)\n }\n}\n\n/**\n * Insert `text` at a `range`, with optional `marks`.\n *\n * @param {Change} change\n * @param {Range} range\n * @param {String} text\n * @param {Set<Mark>} marks (optional)\n * @param {Object} options\n * @property {Boolean} normalize\n */\n\nChanges.insertTextAtRange = (change, range, text, marks, options = {}) => {\n let { normalize } = options\n const { value } = change\n const { document } = value\n const { startKey, startOffset } = range\n let key = startKey\n let offset = startOffset\n const parent = document.getParent(startKey)\n\n if (parent.isVoid) return\n\n if (range.isExpanded) {\n change.deleteAtRange(range, { normalize: false })\n\n // Update range start after delete\n if (change.value.startKey !== key) {\n key = change.value.startKey\n offset = change.value.startOffset\n }\n }\n\n // PERF: Unless specified, don't normalize if only inserting text.\n if (normalize !== undefined) {\n normalize = range.isExpanded\n }\n change.insertTextByKey(key, offset, text, marks, { normalize: false })\n\n if (normalize) {\n // normalize in the narrowest existing block that originally contains startKey and endKey\n const commonAncestor = document.getCommonAncestor(startKey, range.endKey)\n const ancestors = document\n .getAncestors(commonAncestor.key)\n .push(commonAncestor)\n const normalizeAncestor = ancestors.findLast(n =>\n change.value.document.getDescendant(n.key)\n )\n change.normalizeNodeByKey(normalizeAncestor.key)\n }\n}\n\n/**\n * Remove an existing `mark` to the characters at `range`.\n *\n * @param {Change} change\n * @param {Range} range\n * @param {Mark|String} mark (optional)\n * @param {Object} options\n * @property {Boolean} normalize\n */\n\nChanges.removeMarkAtRange = (change, range, mark, options = {}) => {\n if (range.isCollapsed) return\n\n const normalize = change.getFlag('normalize', options)\n const { value } = change\n const { document } = value\n const texts = document.getTextsAtRange(range)\n const { startKey, startOffset, endKey, endOffset } = range\n\n texts.forEach(node => {\n const { key } = node\n let index = 0\n let length = node.text.length\n\n if (key == startKey) index = startOffset\n if (key == endKey) length = endOffset\n if (key == startKey && key == endKey) length = endOffset - startOffset\n\n change.removeMarkByKey(key, index, length, mark, { normalize })\n })\n}\n\n/**\n * Set the `properties` of block nodes in a `range`.\n *\n * @param {Change} change\n * @param {Range} range\n * @param {Object|String} properties\n * @param {Object} options\n * @property {Boolean} normalize\n */\n\nChanges.setBlocksAtRange = (change, range, properties, options = {}) => {\n const normalize = change.getFlag('normalize', options)\n const { value } = change\n const { document } = value\n const blocks = document.getBlocksAtRange(range)\n\n const { startKey, startOffset, endKey, endOffset, isCollapsed } = range\n const isStartVoid = document.hasVoidParent(startKey)\n const startBlock = document.getClosestBlock(startKey)\n const endBlock = document.getClosestBlock(endKey)\n\n // Check if we have a \"hanging\" selection case where the even though the\n // selection extends into the start of the end node, we actually want to\n // ignore that for UX reasons.\n const isHanging =\n isCollapsed == false &&\n startOffset == 0 &&\n endOffset == 0 &&\n isStartVoid == false &&\n startKey == startBlock.getFirstText().key &&\n endKey == endBlock.getFirstText().key\n\n // If it's a hanging selection, ignore the last block.\n const sets = isHanging ? blocks.slice(0, -1) : blocks\n\n sets.forEach(block => {\n change.setNodeByKey(block.key, properties, { normalize })\n })\n}\n\nChanges.setBlockAtRange = (...args) => {\n logger.deprecate(\n 'slate@0.33.0',\n 'The `setBlockAtRange` method of Slate changes has been renamed to `setBlocksAtRange`.'\n )\n Changes.setBlocksAtRange(...args)\n}\n\n/**\n * Set the `properties` of inline nodes in a `range`.\n *\n * @param {Change} change\n * @param {Range} range\n * @param {Object|String} properties\n * @param {Object} options\n * @property {Boolean} normalize\n */\n\nChanges.setInlinesAtRange = (change, range, properties, options = {}) => {\n const normalize = change.getFlag('normalize', options)\n const { value } = change\n const { document } = value\n const inlines = document.getInlinesAtRange(range)\n\n inlines.forEach(inline => {\n change.setNodeByKey(inline.key, properties, { normalize })\n })\n}\n\nChanges.setInlineAtRange = (...args) => {\n logger.deprecate(\n 'slate@0.33.0',\n 'The `setInlineAtRange` method of Slate changes has been renamed to `setInlinesAtRange`.'\n )\n Changes.setInlinesAtRange(...args)\n}\n\n/**\n * Split the block nodes at a `range`, to optional `height`.\n *\n * @param {Change} change\n * @param {Range} range\n * @param {Number} height (optional)\n * @param {Object} options\n * @property {Boolean} normalize\n */\n\nChanges.splitBlockAtRange = (change, range, height = 1, options = {}) => {\n const normalize = change.getFlag('normalize', options)\n\n if (range.isExpanded) {\n change.deleteAtRange(range, { normalize })\n range = range.collapseToStart()\n }\n\n const { startKey, startOffset } = range\n const { value } = change\n const { document } = value\n let node = document.assertDescendant(startKey)\n let parent = document.getClosestBlock(node.key)\n let h = 0\n\n while (parent && parent.object == 'block' && h < height) {\n node = parent\n parent = document.getClosestBlock(parent.key)\n h++\n }\n\n change.splitDescendantsByKey(node.key, startKey, startOffset, { normalize })\n}\n\n/**\n * Split the inline nodes at a `range`, to optional `height`.\n *\n * @param {Change} change\n * @param {Range} range\n * @param {Number} height (optional)\n * @param {Object} options\n * @property {Boolean} normalize\n */\n\nChanges.splitInlineAtRange = (\n change,\n range,\n height = Infinity,\n options = {}\n) => {\n const normalize = change.getFlag('normalize', options)\n\n if (range.isExpanded) {\n change.deleteAtRange(range, { normalize })\n range = range.collapseToStart()\n }\n\n const { startKey, startOffset } = range\n const { value } = change\n const { document } = value\n let node = document.assertDescendant(startKey)\n let parent = document.getClosestInline(node.key)\n let h = 0\n\n while (parent && parent.object == 'inline' && h < height) {\n node = parent\n parent = document.getClosestInline(parent.key)\n h++\n }\n\n change.splitDescendantsByKey(node.key, startKey, startOffset, { normalize })\n}\n\n/**\n * Add or remove a `mark` from the characters at `range`, depending on whether\n * it's already there.\n *\n * @param {Change} change\n * @param {Range} range\n * @param {Mixed} mark\n * @param {Object} options\n * @property {Boolean} normalize\n */\n\nChanges.toggleMarkAtRange = (change, range, mark, options = {}) => {\n if (range.isCollapsed) return\n\n mark = Mark.create(mark)\n\n const normalize = change.getFlag('normalize', options)\n const { value } = change\n const { document } = value\n const marks = document.getActiveMarksAtRange(range)\n const exists = marks.some(m => m.equals(mark))\n\n if (exists) {\n change.removeMarkAtRange(range, mark, { normalize })\n } else {\n change.addMarkAtRange(range, mark, { normalize })\n }\n}\n\n/**\n * Unwrap all of the block nodes in a `range` from a block with `properties`.\n *\n * @param {Change} change\n * @param {Range} range\n * @param {String|Object} properties\n * @param {Object} options\n * @property {Boolean} normalize\n */\n\nChanges.unwrapBlockAtRange = (change, range, properties, options = {}) => {\n properties = Node.createProperties(properties)\n\n const normalize = change.getFlag('normalize', options)\n const { value } = change\n let { document } = value\n const blocks = document.getBlocksAtRange(range)\n const wrappers = blocks\n .map(block => {\n return document.getClosest(block.key, parent => {\n if (parent.object != 'block') return false\n if (properties.type != null && parent.type != properties.type)\n return false\n if (properties.isVoid != null && parent.isVoid != properties.isVoid)\n return false\n if (properties.data != null && !parent.data.isSuperset(properties.data))\n return false\n return true\n })\n })\n .filter(exists => exists)\n .toOrderedSet()\n .toList()\n\n wrappers.forEach(block => {\n const first = block.nodes.first()\n const last = block.nodes.last()\n const parent = document.getParent(block.key)\n const index = parent.nodes.indexOf(block)\n\n const children = block.nodes.filter(child => {\n return blocks.some(b => child == b || child.hasDescendant(b.key))\n })\n\n const firstMatch = children.first()\n const lastMatch = children.last()\n\n if (first == firstMatch && last == lastMatch) {\n block.nodes.forEach((child, i) => {\n change.moveNodeByKey(child.key, parent.key, index + i, {\n normalize: false,\n })\n })\n\n change.removeNodeByKey(block.key, { normalize: false })\n } else if (last == lastMatch) {\n block.nodes.skipUntil(n => n == firstMatch).forEach((child, i) => {\n change.moveNodeByKey(child.key, parent.key, index + 1 + i, {\n normalize: false,\n })\n })\n } else if (first == firstMatch) {\n block.nodes\n .takeUntil(n => n == lastMatch)\n .push(lastMatch)\n .forEach((child, i) => {\n change.moveNodeByKey(child.key, parent.key, index + i, {\n normalize: false,\n })\n })\n } else {\n const firstText = firstMatch.getFirstText()\n change.splitDescendantsByKey(block.key, firstText.key, 0, {\n normalize: false,\n })\n document = change.value.document\n\n children.forEach((child, i) => {\n if (i == 0) {\n const extra = child\n child = document.getNextBlock(child.key)\n change.removeNodeByKey(extra.key, { normalize: false })\n }\n\n change.moveNodeByKey(child.key, parent.key, index + 1 + i, {\n normalize: false,\n })\n })\n }\n })\n\n // TODO: optmize to only normalize the right block\n if (normalize) {\n change.normalizeDocument()\n }\n}\n\n/**\n * Unwrap the inline nodes in a `range` from an inline with `properties`.\n *\n * @param {Change} change\n * @param {Range} range\n * @param {String|Object} properties\n * @param {Object} options\n * @property {Boolean} normalize\n */\n\nChanges.unwrapInlineAtRange = (change, range, properties, options = {}) => {\n properties = Node.createProperties(properties)\n\n const normalize = change.getFlag('normalize', options)\n const { value } = change\n const { document } = value\n const texts = document.getTextsAtRange(range)\n const inlines = texts\n .map(text => {\n return document.getClosest(text.key, parent => {\n if (parent.object != 'inline') return false\n if (properties.type != null && parent.type != properties.type)\n return false\n if (properties.isVoid != null && parent.isVoid != properties.isVoid)\n return false\n if (properties.data != null && !parent.data.isSuperset(properties.data))\n return false\n return true\n })\n })\n .filter(exists => exists)\n .toOrderedSet()\n .toList()\n\n inlines.forEach(inline => {\n const parent = change.value.document.getParent(inline.key)\n const index = parent.nodes.indexOf(inline)\n\n inline.nodes.forEach((child, i) => {\n change.moveNodeByKey(child.key, parent.key, index + i, {\n normalize: false,\n })\n })\n })\n\n // TODO: optmize to only normalize the right block\n if (normalize) {\n change.normalizeDocument()\n }\n}\n\n/**\n * Wrap all of the blocks in a `range` in a new `block`.\n *\n * @param {Change} change\n * @param {Range} range\n * @param {Block|Object|String} block\n * @param {Object} options\n * @property {Boolean} normalize\n */\n\nChanges.wrapBlockAtRange = (change, range, block, options = {}) => {\n block = Block.create(block)\n block = block.set('nodes', block.nodes.clear())\n\n const normalize = change.getFlag('normalize', options)\n const { value } = change\n const { document } = value\n\n const blocks = document.getBlocksAtRange(range)\n const firstblock = blocks.first()\n const lastblock = blocks.last()\n let parent, siblings, index\n\n // If there is only one block in the selection then we know the parent and\n // siblings.\n if (blocks.length === 1) {\n parent = document.getParent(firstblock.key)\n siblings = blocks\n } else {\n // Determine closest shared parent to all blocks in selection.\n parent = document.getClosest(firstblock.key, p1 => {\n return !!document.getClosest(lastblock.key, p2 => p1 == p2)\n })\n }\n\n // If no shared parent could be found then the parent is the document.\n if (parent == null) parent = document\n\n // Create a list of direct children siblings of parent that fall in the\n // selection.\n if (siblings == null) {\n const indexes = parent.nodes.reduce((ind, node, i) => {\n if (node == firstblock || node.hasDescendant(firstblock.key)) ind[0] = i\n if (node == lastblock || node.hasDescendant(lastblock.key)) ind[1] = i\n return ind\n }, [])\n\n index = indexes[0]\n siblings = parent.nodes.slice(indexes[0], indexes[1] + 1)\n }\n\n // Get the index to place the new wrapped node at.\n if (index == null) {\n index = parent.nodes.indexOf(siblings.first())\n }\n\n // Inject the new block node into the parent.\n change.insertNodeByKey(parent.key, index, block, { normalize: false })\n\n // Move the sibling nodes into the new block node.\n siblings.forEach((node, i) => {\n change.moveNodeByKey(node.key, block.key, i, { normalize: false })\n })\n\n if (normalize) {\n change.normalizeNodeByKey(parent.key)\n }\n}\n\n/**\n * Wrap the text and inlines in a `range` in a new `inline`.\n *\n * @param {Change} change\n * @param {Range} range\n * @param {Inline|Object|String} inline\n * @param {Object} options\n * @property {Boolean} normalize\n */\n\nChanges.wrapInlineAtRange = (change, range, inline, options = {}) => {\n const { value } = change\n let { document } = value\n const normalize = change.getFlag('normalize', options)\n const { startKey, startOffset, endKey, endOffset } = range\n\n if (range.isCollapsed) {\n // Wrapping an inline void\n const inlineParent = document.getClosestInline(startKey)\n if (!inlineParent.isVoid) {\n return\n }\n\n return change.wrapInlineByKey(inlineParent.key, inline, options)\n }\n\n inline = Inline.create(inline)\n inline = inline.set('nodes', inline.nodes.clear())\n\n const blocks = document.getBlocksAtRange(range)\n let startBlock = document.getClosestBlock(startKey)\n let endBlock = document.getClosestBlock(endKey)\n let startChild = startBlock.getFurthestAncestor(startKey)\n let endChild = endBlock.getFurthestAncestor(endKey)\n\n change.splitDescendantsByKey(endChild.key, endKey, endOffset, {\n normalize: false,\n })\n change.splitDescendantsByKey(startChild.key, startKey, startOffset, {\n normalize: false,\n })\n\n document = change.value.document\n startBlock = document.getDescendant(startBlock.key)\n endBlock = document.getDescendant(endBlock.key)\n startChild = startBlock.getFurthestAncestor(startKey)\n endChild = endBlock.getFurthestAncestor(endKey)\n const startIndex = startBlock.nodes.indexOf(startChild)\n const endIndex = endBlock.nodes.indexOf(endChild)\n\n if (startBlock == endBlock) {\n document = change.value.document\n startBlock = document.getClosestBlock(startKey)\n startChild = startBlock.getFurthestAncestor(startKey)\n\n const startInner = document.getNextSibling(startChild.key)\n const startInnerIndex = startBlock.nodes.indexOf(startInner)\n const endInner =\n startKey == endKey ? startInner : startBlock.getFurthestAncestor(endKey)\n const inlines = startBlock.nodes\n .skipUntil(n => n == startInner)\n .takeUntil(n => n == endInner)\n .push(endInner)\n\n const node = inline.regenerateKey()\n\n change.insertNodeByKey(startBlock.key, startInnerIndex, node, {\n normalize: false,\n })\n\n inlines.forEach((child, i) => {\n change.moveNodeByKey(child.key, node.key, i, { normalize: false })\n })\n\n if (normalize) {\n change.normalizeNodeByKey(startBlock.key)\n }\n } else {\n const startInlines = startBlock.nodes.slice(startIndex + 1)\n const endInlines = endBlock.nodes.slice(0, endIndex + 1)\n const startNode = inline.regenerateKey()\n const endNode = inline.regenerateKey()\n\n change.insertNodeByKey(startBlock.key, startIndex + 1, startNode, {\n normalize: false,\n })\n change.insertNodeByKey(endBlock.key, endIndex, endNode, {\n normalize: false,\n })\n\n startInlines.forEach((child, i) => {\n change.moveNodeByKey(child.key, startNode.key, i, { normalize: false })\n })\n\n endInlines.forEach((child, i) => {\n change.moveNodeByKey(child.key, endNode.key, i, { normalize: false })\n })\n\n if (normalize) {\n change.normalizeNodeByKey(startBlock.key).normalizeNodeByKey(endBlock.key)\n }\n\n blocks.slice(1, -1).forEach(block => {\n const node = inline.regenerateKey()\n change.insertNodeByKey(block.key, 0, node, { normalize: false })\n\n block.nodes.forEach((child, i) => {\n change.moveNodeByKey(child.key, node.key, i, { normalize: false })\n })\n\n if (normalize) {\n change.normalizeNodeByKey(block.key)\n }\n })\n }\n}\n\n/**\n * Wrap the text in a `range` in a prefix/suffix.\n *\n * @param {Change} change\n * @param {Range} range\n * @param {String} prefix\n * @param {String} suffix (optional)\n * @param {Object} options\n * @property {Boolean} normalize\n */\n\nChanges.wrapTextAtRange = (\n change,\n range,\n prefix,\n suffix = prefix,\n options = {}\n) => {\n const normalize = change.getFlag('normalize', options)\n const { startKey, endKey } = range\n const start = range.collapseToStart()\n let end = range.collapseToEnd()\n\n if (startKey == endKey) {\n end = end.move(prefix.length)\n }\n\n change.insertTextAtRange(start, prefix, [], { normalize })\n change.insertTextAtRange(end, suffix, [], { normalize })\n}\n\n/**\n * Export.\n *\n * @type {Object}\n */\n\nexport default Changes\n","import Block from '../models/block'\nimport Inline from '../models/inline'\nimport Mark from '../models/mark'\nimport Node from '../models/node'\n\n/**\n * Changes.\n *\n * @type {Object}\n */\n\nconst Changes = {}\n\n/**\n * Add mark to text at `offset` and `length` in node by `key`.\n *\n * @param {Change} change\n * @param {String} key\n * @param {Number} offset\n * @param {Number} length\n * @param {Mixed} mark\n * @param {Object} options\n * @property {Boolean} normalize\n */\n\nChanges.addMarkByKey = (change, key, offset, length, mark, options = {}) => {\n mark = Mark.create(mark)\n const normalize = change.getFlag('normalize', options)\n const { value } = change\n const { document } = value\n const path = document.getPath(key)\n const node = document.getNode(key)\n const leaves = node.getLeaves()\n\n const operations = []\n const bx = offset\n const by = offset + length\n let o = 0\n\n leaves.forEach(leaf => {\n const ax = o\n const ay = ax + leaf.text.length\n\n o += leaf.text.length\n\n // If the leaf doesn't overlap with the operation, continue on.\n if (ay < bx || by < ax) return\n\n // If the leaf already has the mark, continue on.\n if (leaf.marks.has(mark)) return\n\n // Otherwise, determine which offset and characters overlap.\n const start = Math.max(ax, bx)\n const end = Math.min(ay, by)\n\n operations.push({\n type: 'add_mark',\n value,\n path,\n offset: start,\n length: end - start,\n mark,\n })\n })\n\n change.applyOperations(operations)\n\n if (normalize) {\n const parent = document.getParent(key)\n change.normalizeNodeByKey(parent.key)\n }\n}\n\n/**\n * Insert a `fragment` at `index` in a node by `key`.\n *\n * @param {Change} change\n * @param {String} key\n * @param {Number} index\n * @param {Fragment} fragment\n * @param {Object} options\n * @property {Boolean} normalize\n */\n\nChanges.insertFragmentByKey = (change, key, index, fragment, options = {}) => {\n const normalize = change.getFlag('normalize', options)\n\n fragment.nodes.forEach((node, i) => {\n change.insertNodeByKey(key, index + i, node)\n })\n\n if (normalize) {\n change.normalizeNodeByKey(key)\n }\n}\n\n/**\n * Insert a `node` at `index` in a node by `key`.\n *\n * @param {Change} change\n * @param {String} key\n * @param {Number} index\n * @param {Node} node\n * @param {Object} options\n * @property {Boolean} normalize\n */\n\nChanges.insertNodeByKey = (change, key, index, node, options = {}) => {\n const normalize = change.getFlag('normalize', options)\n const { value } = change\n const { document } = value\n const path = document.getPath(key)\n\n change.applyOperation({\n type: 'insert_node',\n value,\n path: [...path, index],\n node,\n })\n\n if (normalize) {\n change.normalizeNodeByKey(key)\n }\n}\n\n/**\n * Insert `text` at `offset` in node by `key`.\n *\n * @param {Change} change\n * @param {String} key\n * @param {Number} offset\n * @param {String} text\n * @param {Set<Mark>} marks (optional)\n * @param {Object} options\n * @property {Boolean} normalize\n */\n\nChanges.insertTextByKey = (change, key, offset, text, marks, options = {}) => {\n const normalize = change.getFlag('normalize', options)\n\n const { value } = change\n const { document } = value\n const path = document.getPath(key)\n const node = document.getNode(key)\n marks = marks || node.getMarksAtIndex(offset)\n\n change.applyOperation({\n type: 'insert_text',\n value,\n path,\n offset,\n text,\n marks,\n })\n\n if (normalize) {\n const parent = document.getParent(key)\n change.normalizeNodeByKey(parent.key)\n }\n}\n\n/**\n * Merge a node by `key` with the previous node.\n *\n * @param {Change} change\n * @param {String} key\n * @param {Object} options\n * @property {Boolean} normalize\n */\n\nChanges.mergeNodeByKey = (change, key, options = {}) => {\n const normalize = change.getFlag('normalize', options)\n const { value } = change\n const { document } = value\n const path = document.getPath(key)\n const original = document.getDescendant(key)\n const previous = document.getPreviousSibling(key)\n\n if (!previous) {\n throw new Error(`Unable to merge node with key \"${key}\", no previous key.`)\n }\n\n const position =\n previous.object == 'text' ? previous.text.length : previous.nodes.size\n\n change.applyOperation({\n type: 'merge_node',\n value,\n path,\n position,\n // for undos to succeed we only need the type and data because\n // these are the only properties that get changed in the merge operation\n properties: {\n type: original.type,\n data: original.data,\n },\n target: null,\n })\n\n if (normalize) {\n const parent = document.getParent(key)\n change.normalizeNodeByKey(parent.key)\n }\n}\n\n/**\n * Move a node by `key` to a new parent by `newKey` and `index`.\n * `newKey` is the key of the container (it can be the document itself)\n *\n * @param {Change} change\n * @param {String} key\n * @param {String} newKey\n * @param {Number} index\n * @param {Object} options\n * @property {Boolean} normalize\n */\n\nChanges.moveNodeByKey = (change, key, newKey, newIndex, options = {}) => {\n const normalize = change.getFlag('normalize', options)\n const { value } = change\n const { document } = value\n const path = document.getPath(key)\n const newPath = document.getPath(newKey)\n\n change.applyOperation({\n type: 'move_node',\n value,\n path,\n newPath: [...newPath, newIndex],\n })\n\n if (normalize) {\n const parent = document.getCommonAncestor(key, newKey)\n change.normalizeNodeByKey(parent.key)\n }\n}\n\n/**\n * Remove mark from text at `offset` and `length` in node by `key`.\n *\n * @param {Change} change\n * @param {String} key\n * @param {Number} offset\n * @param {Number} length\n * @param {Mark} mark\n * @param {Object} options\n * @property {Boolean} normalize\n */\n\nChanges.removeMarkByKey = (change, key, offset, length, mark, options = {}) => {\n mark = Mark.create(mark)\n const normalize = change.getFlag('normalize', options)\n const { value } = change\n const { document } = value\n const path = document.getPath(key)\n const node = document.getNode(key)\n const leaves = node.getLeaves()\n\n const operations = []\n const bx = offset\n const by = offset + length\n let o = 0\n\n leaves.forEach(leaf => {\n const ax = o\n const ay = ax + leaf.text.length\n\n o += leaf.text.length\n\n // If the leaf doesn't overlap with the operation, continue on.\n if (ay < bx || by < ax) return\n\n // If the leaf already has the mark, continue on.\n if (!leaf.marks.has(mark)) return\n\n // Otherwise, determine which offset and characters overlap.\n const start = Math.max(ax, bx)\n const end = Math.min(ay, by)\n\n operations.push({\n type: 'remove_mark',\n value,\n path,\n offset: start,\n length: end - start,\n mark,\n })\n })\n\n change.applyOperations(operations)\n\n if (normalize) {\n const parent = document.getParent(key)\n change.normalizeNodeByKey(parent.key)\n }\n}\n\n/**\n * Remove all `marks` from node by `key`.\n *\n * @param {Change} change\n * @param {String} key\n * @param {Object} options\n * @property {Boolean} normalize\n */\n\nChanges.removeAllMarksByKey = (change, key, options = {}) => {\n const { state } = change\n const { document } = state\n const node = document.getNode(key)\n const texts = node.object === 'text' ? [node] : node.getTextsAsArray()\n\n texts.forEach(text => {\n text.getMarksAsArray().forEach(mark => {\n change.removeMarkByKey(text.key, 0, text.text.length, mark, options)\n })\n })\n}\n\n/**\n * Remove a node by `key`.\n *\n * @param {Change} change\n * @param {String} key\n * @param {Object} options\n * @property {Boolean} normalize\n */\n\nChanges.removeNodeByKey = (change, key, options = {}) => {\n const normalize = change.getFlag('normalize', options)\n const { value } = change\n const { document } = value\n const path = document.getPath(key)\n const node = document.getNode(key)\n\n change.applyOperation({\n type: 'remove_node',\n value,\n path,\n node,\n })\n\n if (normalize) {\n const parent = document.getParent(key)\n change.normalizeNodeByKey(parent.key)\n }\n}\n\n/**\n * Remove text at `offset` and `length` in node by `key`.\n *\n * @param {Change} change\n * @param {String} key\n * @param {Number} offset\n * @param {Number} length\n * @param {Object} options\n * @property {Boolean} normalize\n */\n\nChanges.removeTextByKey = (change, key, offset, length, options = {}) => {\n const normalize = change.getFlag('normalize', options)\n const { value } = change\n const { document } = value\n const path = document.getPath(key)\n const node = document.getNode(key)\n const leaves = node.getLeaves()\n const { text } = node\n\n const removals = []\n const bx = offset\n const by = offset + length\n let o = 0\n\n leaves.forEach(leaf => {\n const ax = o\n const ay = ax + leaf.text.length\n\n o += leaf.text.length\n\n // If the leaf doesn't overlap with the removal, continue on.\n if (ay < bx || by < ax) return\n\n // Otherwise, determine which offset and characters overlap.\n const start = Math.max(ax, bx)\n const end = Math.min(ay, by)\n const string = text.slice(start, end)\n\n removals.push({\n type: 'remove_text',\n value,\n path,\n offset: start,\n text: string,\n marks: leaf.marks,\n })\n })\n\n // Apply in reverse order, so subsequent removals don't impact previous ones.\n change.applyOperations(removals.reverse())\n\n if (normalize) {\n const block = document.getClosestBlock(key)\n change.normalizeNodeByKey(block.key)\n }\n}\n\n/**\n`* Replace a `node` with another `node`\n *\n * @param {Change} change\n * @param {String} key\n * @param {Object|Node} node\n * @param {Object} options\n * @property {Boolean} normalize\n */\n\nChanges.replaceNodeByKey = (change, key, newNode, options = {}) => {\n newNode = Node.create(newNode)\n const normalize = change.getFlag('normalize', options)\n const { value } = change\n const { document } = value\n const node = document.getNode(key)\n const parent = document.getParent(key)\n const index = parent.nodes.indexOf(node)\n change.removeNodeByKey(key, { normalize: false })\n change.insertNodeByKey(parent.key, index, newNode, options)\n if (normalize) {\n change.normalizeNodeByKey(parent.key)\n }\n}\n\n/**\n * Set `properties` on mark on text at `offset` and `length` in node by `key`.\n *\n * @param {Change} change\n * @param {String} key\n * @param {Number} offset\n * @param {Number} length\n * @param {Mark} mark\n * @param {Object} options\n * @property {Boolean} normalize\n */\n\nChanges.setMarkByKey = (\n change,\n key,\n offset,\n length,\n mark,\n properties,\n options = {}\n) => {\n mark = Mark.create(mark)\n properties = Mark.createProperties(properties)\n const normalize = change.getFlag('normalize', options)\n const { value } = change\n const { document } = value\n const path = document.getPath(key)\n\n change.applyOperation({\n type: 'set_mark',\n value,\n path,\n offset,\n length,\n mark,\n properties,\n })\n\n if (normalize) {\n const parent = document.getParent(key)\n change.normalizeNodeByKey(parent.key)\n }\n}\n\n/**\n * Set `properties` on a node by `key`.\n *\n * @param {Change} change\n * @param {String} key\n * @param {Object|String} properties\n * @param {Object} options\n * @property {Boolean} normalize\n */\n\nChanges.setNodeByKey = (change, key, properties, options = {}) => {\n properties = Node.createProperties(properties)\n const normalize = change.getFlag('normalize', options)\n const { value } = change\n const { document } = value\n const path = document.getPath(key)\n const node = document.getNode(key)\n\n change.applyOperation({\n type: 'set_node',\n value,\n path,\n node,\n properties,\n })\n\n if (normalize) {\n change.normalizeNodeByKey(node.key)\n }\n}\n\n/**\n * Split a node by `key` at `position`.\n *\n * @param {Change} change\n * @param {String} key\n * @param {Number} position\n * @param {Object} options\n * @property {Boolean} normalize\n */\n\nChanges.splitNodeByKey = (change, key, position, options = {}) => {\n const { normalize = true, target = null } = options\n const { value } = change\n const { document } = value\n const path = document.getPath(key)\n const node = document.getDescendantAtPath(path)\n\n change.applyOperation({\n type: 'split_node',\n value,\n path,\n position,\n properties: {\n type: node.type,\n data: node.data,\n },\n target,\n })\n\n if (normalize) {\n const parent = document.getParent(key)\n change.normalizeNodeByKey(parent.key)\n }\n}\n\n/**\n * Split a node deeply down the tree by `key`, `textKey` and `textOffset`.\n *\n * @param {Change} change\n * @param {String} key\n * @param {Number} position\n * @param {Object} options\n * @property {Boolean} normalize\n */\n\nChanges.splitDescendantsByKey = (\n change,\n key,\n textKey,\n textOffset,\n options = {}\n) => {\n if (key == textKey) {\n change.splitNodeByKey(textKey, textOffset, options)\n return\n }\n\n const normalize = change.getFlag('normalize', options)\n const { value } = change\n const { document } = value\n\n const text = document.getNode(textKey)\n const ancestors = document.getAncestors(textKey)\n const nodes = ancestors\n .skipUntil(a => a.key == key)\n .reverse()\n .unshift(text)\n let previous\n let index\n\n nodes.forEach(node => {\n const prevIndex = index == null ? null : index\n index = previous ? node.nodes.indexOf(previous) + 1 : textOffset\n previous = node\n change.splitNodeByKey(node.key, index, {\n normalize: false,\n target: prevIndex,\n })\n })\n\n if (normalize) {\n const parent = document.getParent(key)\n change.normalizeNodeByKey(parent.key)\n }\n}\n\n/**\n * Unwrap content from an inline parent with `properties`.\n *\n * @param {Change} change\n * @param {String} key\n * @param {Object|String} properties\n * @param {Object} options\n * @property {Boolean} normalize\n */\n\nChanges.unwrapInlineByKey = (change, key, properties, options) => {\n const { value } = change\n const { document, selection } = value\n const node = document.assertDescendant(key)\n const first = node.getFirstText()\n const last = node.getLastText()\n const range = selection.moveToRangeOf(first, last)\n change.unwrapInlineAtRange(range, properties, options)\n}\n\n/**\n * Unwrap content from a block parent with `properties`.\n *\n * @param {Change} change\n * @param {String} key\n * @param {Object|String} properties\n * @param {Object} options\n * @property {Boolean} normalize\n */\n\nChanges.unwrapBlockByKey = (change, key, properties, options) => {\n const { value } = change\n const { document, selection } = value\n const node = document.assertDescendant(key)\n const first = node.getFirstText()\n const last = node.getLastText()\n const range = selection.moveToRangeOf(first, last)\n change.unwrapBlockAtRange(range, properties, options)\n}\n\n/**\n * Unwrap a single node from its parent.\n *\n * If the node is surrounded with siblings, its parent will be\n * split. If the node is the only child, the parent is removed, and\n * simply replaced by the node itself. Cannot unwrap a root node.\n *\n * @param {Change} change\n * @param {String} key\n * @param {Object} options\n * @property {Boolean} normalize\n */\n\nChanges.unwrapNodeByKey = (change, key, options = {}) => {\n const normalize = change.getFlag('normalize', options)\n const { value } = change\n const { document } = value\n const parent = document.getParent(key)\n const node = parent.getChild(key)\n\n const index = parent.nodes.indexOf(node)\n const isFirst = index === 0\n const isLast = index === parent.nodes.size - 1\n\n const parentParent = document.getParent(parent.key)\n const parentIndex = parentParent.nodes.indexOf(parent)\n\n if (parent.nodes.size === 1) {\n change.moveNodeByKey(key, parentParent.key, parentIndex, {\n normalize: false,\n })\n change.removeNodeByKey(parent.key, options)\n } else if (isFirst) {\n // Just move the node before its parent.\n change.moveNodeByKey(key, parentParent.key, parentIndex, options)\n } else if (isLast) {\n // Just move the node after its parent.\n change.moveNodeByKey(key, parentParent.key, parentIndex + 1, options)\n } else {\n // Split the parent.\n change.splitNodeByKey(parent.key, index, { normalize: false })\n\n // Extract the node in between the splitted parent.\n change.moveNodeByKey(key, parentParent.key, parentIndex + 1, {\n normalize: false,\n })\n\n if (normalize) {\n change.normalizeNodeByKey(parentParent.key)\n }\n }\n}\n\n/**\n * Wrap a node in a block with `properties`.\n *\n * @param {Change} change\n * @param {String} key The node to wrap\n * @param {Block|Object|String} block The wrapping block (its children are discarded)\n * @param {Object} options\n * @property {Boolean} normalize\n */\n\nChanges.wrapBlockByKey = (change, key, block, options) => {\n block = Block.create(block)\n block = block.set('nodes', block.nodes.clear())\n\n const { document } = change.value\n const node = document.assertDescendant(key)\n const parent = document.getParent(node.key)\n const index = parent.nodes.indexOf(node)\n\n change.insertNodeByKey(parent.key, index, block, { normalize: false })\n change.moveNodeByKey(node.key, block.key, 0, options)\n}\n\n/**\n * Wrap a node in an inline with `properties`.\n *\n * @param {Change} change\n * @param {String} key The node to wrap\n * @param {Block|Object|String} inline The wrapping inline (its children are discarded)\n * @param {Object} options\n * @property {Boolean} normalize\n */\n\nChanges.wrapInlineByKey = (change, key, inline, options) => {\n inline = Inline.create(inline)\n inline = inline.set('nodes', inline.nodes.clear())\n\n const { document } = change.value\n const node = document.assertDescendant(key)\n const parent = document.getParent(node.key)\n const index = parent.nodes.indexOf(node)\n\n change.insertNodeByKey(parent.key, index, inline, { normalize: false })\n change.moveNodeByKey(node.key, inline.key, 0, options)\n}\n\n/**\n * Wrap a node by `key` with `parent`.\n *\n * @param {Change} change\n * @param {String} key\n * @param {Node|Object} parent\n * @param {Object} options\n */\n\nChanges.wrapNodeByKey = (change, key, parent) => {\n parent = Node.create(parent)\n parent = parent.set('nodes', parent.nodes.clear())\n\n if (parent.object == 'block') {\n change.wrapBlockByKey(key, parent)\n return\n }\n\n if (parent.object == 'inline') {\n change.wrapInlineByKey(key, parent)\n return\n }\n}\n\n/**\n * Export.\n *\n * @type {Object}\n */\n\nexport default Changes\n","/**\n * Slate operation attributes.\n *\n * @type {Array}\n */\n\nconst OPERATION_ATTRIBUTES = {\n add_mark: ['value', 'path', 'offset', 'length', 'mark'],\n insert_node: ['value', 'path', 'node'],\n insert_text: ['value', 'path', 'offset', 'text', 'marks'],\n merge_node: ['value', 'path', 'position', 'properties', 'target'],\n move_node: ['value', 'path', 'newPath'],\n remove_mark: ['value', 'path', 'offset', 'length', 'mark'],\n remove_node: ['value', 'path', 'node'],\n remove_text: ['value', 'path', 'offset', 'text', 'marks'],\n set_mark: ['value', 'path', 'offset', 'length', 'mark', 'properties'],\n set_node: ['value', 'path', 'node', 'properties'],\n set_selection: ['value', 'selection', 'properties'],\n set_value: ['value', 'properties'],\n split_node: ['value', 'path', 'position', 'properties', 'target'],\n}\n\n/**\n * Export.\n *\n * @type {Object}\n */\n\nexport default OPERATION_ATTRIBUTES\n","import Debug from 'debug'\nimport isEqual from 'lodash/isEqual'\nimport isPlainObject from 'is-plain-object'\nimport logger from 'slate-dev-logger'\nimport { List, Record, Stack } from 'immutable'\n\nimport MODEL_TYPES from '../constants/model-types'\n\n/**\n * Debug.\n *\n * @type {Function}\n */\n\nconst debug = Debug('slate:history')\n\n/**\n * Default properties.\n *\n * @type {Object}\n */\n\nconst DEFAULTS = {\n redos: new Stack(),\n undos: new Stack(),\n}\n\n/**\n * History.\n *\n * @type {History}\n */\n\nclass History extends Record(DEFAULTS) {\n /**\n * Create a new `History` with `attrs`.\n *\n * @param {Object|History} attrs\n * @return {History}\n */\n\n static create(attrs = {}) {\n if (History.isHistory(attrs)) {\n return attrs\n }\n\n if (isPlainObject(attrs)) {\n return History.fromJSON(attrs)\n }\n\n throw new Error(\n `\\`History.create\\` only accepts objects or histories, but you passed it: ${attrs}`\n )\n }\n\n /**\n * Create a `History` from a JSON `object`.\n *\n * @param {Object} object\n * @return {History}\n */\n\n static fromJSON(object) {\n const { redos = [], undos = [] } = object\n\n const history = new History({\n redos: new Stack(redos),\n undos: new Stack(undos),\n })\n\n return history\n }\n\n /**\n * Alias `fromJS`.\n */\n\n static fromJS = History.fromJSON\n\n /**\n * Check if `any` is a `History`.\n *\n * @param {Any} any\n * @return {Boolean}\n */\n\n static isHistory(any) {\n return !!(any && any[MODEL_TYPES.HISTORY])\n }\n\n /**\n * Object.\n *\n * @return {String}\n */\n\n get object() {\n return 'history'\n }\n\n get kind() {\n logger.deprecate(\n 'slate@0.32.0',\n 'The `kind` property of Slate objects has been renamed to `object`.'\n )\n return this.object\n }\n\n /**\n * Save an `operation` into the history.\n *\n * @param {Object} operation\n * @param {Object} options\n * @return {History}\n */\n\n save(operation, options = {}) {\n let history = this\n let { undos, redos } = history\n let { merge, skip } = options\n const prevBatch = undos.peek()\n const prevOperation = prevBatch && prevBatch.last()\n\n if (skip == null) {\n skip = shouldSkip(operation, prevOperation)\n }\n\n if (skip) {\n return history\n }\n\n if (merge == null) {\n merge = shouldMerge(operation, prevOperation)\n }\n\n debug('save', { operation, merge })\n\n // If the `merge` flag is true, add the operation to the previous batch.\n if (merge && prevBatch) {\n const batch = prevBatch.push(operation)\n undos = undos.pop()\n undos = undos.push(batch)\n } else {\n // Otherwise, create a new batch with the operation.\n const batch = new List([operation])\n undos = undos.push(batch)\n }\n\n // Constrain the history to 100 entries for memory's sake.\n if (undos.size > 100) {\n undos = undos.take(100)\n }\n\n // Clear the redos and update the history.\n redos = redos.clear()\n history = history.set('undos', undos).set('redos', redos)\n return history\n }\n\n /**\n * Return a JSON representation of the history.\n *\n * @return {Object}\n */\n\n toJSON() {\n const object = {\n object: this.object,\n redos: this.redos.toJSON(),\n undos: this.undos.toJSON(),\n }\n\n return object\n }\n\n /**\n * Alias `toJS`.\n */\n\n toJS() {\n return this.toJSON()\n }\n}\n\n/**\n * Attach a pseudo-symbol for type checking.\n */\n\nHistory.prototype[MODEL_TYPES.HISTORY] = true\n\n/**\n * Check whether to merge a new operation `o` into the previous operation `p`.\n *\n * @param {Object} o\n * @param {Object} p\n * @return {Boolean}\n */\n\nfunction shouldMerge(o, p) {\n if (!p) return false\n\n const merge =\n (o.type == 'set_selection' && p.type == 'set_selection') ||\n (o.type == 'insert_text' &&\n p.type == 'insert_text' &&\n o.offset == p.offset + p.text.length &&\n isEqual(o.path, p.path)) ||\n (o.type == 'remove_text' &&\n p.type == 'remove_text' &&\n o.offset + o.text.length == p.offset &&\n isEqual(o.path, p.path))\n\n return merge\n}\n\n/**\n * Check whether to skip a new operation `o`, given previous operation `p`.\n *\n * @param {Object} o\n * @param {Object} p\n * @return {Boolean}\n */\n\nfunction shouldSkip(o, p) {\n if (!p) return false\n\n const skip = o.type == 'set_selection' && p.type == 'set_selection'\n\n return skip\n}\n\n/**\n * Export.\n *\n * @type {History}\n */\n\nexport default History\n","import { List } from 'immutable'\n\nimport Text from '../models/text'\n\n/**\n * Define the core schema rules, order-sensitive.\n *\n * @type {Array}\n */\n\nconst CORE_SCHEMA_RULES = [\n /**\n * Only allow block nodes in documents.\n *\n * @type {Object}\n */\n\n {\n validateNode(node) {\n if (node.object != 'document') return\n const invalids = node.nodes.filter(n => n.object != 'block')\n if (!invalids.size) return\n\n return change => {\n invalids.forEach(child => {\n change.removeNodeByKey(child.key, { normalize: false })\n })\n }\n },\n },\n\n /**\n * Only allow block nodes or inline and text nodes in blocks.\n *\n * @type {Object}\n */\n\n {\n validateNode(node) {\n if (node.object != 'block') return\n const first = node.nodes.first()\n if (!first) return\n const objects = first.object == 'block' ? ['block'] : ['inline', 'text']\n const invalids = node.nodes.filter(n => !objects.includes(n.object))\n if (!invalids.size) return\n\n return change => {\n invalids.forEach(child => {\n change.removeNodeByKey(child.key, { normalize: false })\n })\n }\n },\n },\n\n /**\n * Only allow inline and text nodes in inlines.\n *\n * @type {Object}\n */\n\n {\n validateNode(node) {\n if (node.object != 'inline') return\n const invalids = node.nodes.filter(\n n => n.object != 'inline' && n.object != 'text'\n )\n if (!invalids.size) return\n\n return change => {\n invalids.forEach(child => {\n change.removeNodeByKey(child.key, { normalize: false })\n })\n }\n },\n },\n\n /**\n * Ensure that block and inline nodes have at least one text child.\n *\n * @type {Object}\n */\n\n {\n validateNode(node) {\n if (node.object != 'block' && node.object != 'inline') return\n if (node.nodes.size > 0) return\n\n return change => {\n const text = Text.create()\n change.insertNodeByKey(node.key, 0, text, { normalize: false })\n }\n },\n },\n\n /**\n * Ensure that inline non-void nodes are never empty.\n *\n * This rule is applied to all blocks and inlines, because when they contain an empty\n * inline, we need to remove the empty inline from that parent node. If `validate`\n * was to be memoized, it should be against the parent node, not the empty inline itself.\n *\n * @type {Object}\n */\n\n {\n validateNode(node) {\n if (node.object != 'inline' && node.object != 'block') return\n\n const invalids = node.nodes.filter(\n child => child.object === 'inline' && child.isEmpty\n )\n\n if (!invalids.size) return\n\n return change => {\n // If all of the block's nodes are invalid, insert an empty text node so\n // that the selection will be preserved when they are all removed.\n if (node.nodes.size == invalids.size) {\n const text = Text.create()\n change.insertNodeByKey(node.key, 1, text, { normalize: false })\n }\n\n invalids.forEach(child => {\n change.removeNodeByKey(child.key, { normalize: false })\n })\n }\n },\n },\n\n /**\n * Ensure that inline void nodes are surrounded by text nodes, by adding extra\n * blank text nodes if necessary.\n *\n * @type {Object}\n */\n\n {\n validateNode(node) {\n if (node.object != 'block' && node.object != 'inline') return\n\n const invalids = node.nodes.reduce((list, child, index) => {\n if (child.object !== 'inline') return list\n\n const prev = index > 0 ? node.nodes.get(index - 1) : null\n const next = node.nodes.get(index + 1)\n\n // We don't test if \"prev\" is inline, since it has already been\n // processed in the loop\n const insertBefore = !prev\n const insertAfter = !next || next.object == 'inline'\n\n if (insertAfter || insertBefore) {\n list = list.push({ insertAfter, insertBefore, index })\n }\n\n return list\n }, new List())\n\n if (!invalids.size) return\n\n return change => {\n // Shift for every text node inserted previously.\n let shift = 0\n\n invalids.forEach(({ index, insertAfter, insertBefore }) => {\n if (insertBefore) {\n change.insertNodeByKey(node.key, shift + index, Text.create(), {\n normalize: false,\n })\n shift++\n }\n\n if (insertAfter) {\n change.insertNodeByKey(node.key, shift + index + 1, Text.create(), {\n normalize: false,\n })\n shift++\n }\n })\n }\n },\n },\n\n /**\n * Merge adjacent text nodes.\n *\n * @type {Object}\n */\n\n {\n validateNode(node) {\n if (node.object != 'block' && node.object != 'inline') return\n\n const invalids = node.nodes\n .map((child, i) => {\n const next = node.nodes.get(i + 1)\n if (child.object != 'text') return\n if (!next || next.object != 'text') return\n return next\n })\n .filter(Boolean)\n\n if (!invalids.size) return\n\n return change => {\n // Reverse the list to handle consecutive merges, since the earlier nodes\n // will always exist after each merge.\n invalids.reverse().forEach(n => {\n change.mergeNodeByKey(n.key, { normalize: false })\n })\n }\n },\n },\n\n /**\n * Prevent extra empty text nodes, except when adjacent to inline void nodes.\n *\n * @type {Object}\n */\n\n {\n validateNode(node) {\n if (node.object != 'block' && node.object != 'inline') return\n const { nodes } = node\n if (nodes.size <= 1) return\n\n const invalids = nodes.filter((desc, i) => {\n if (desc.object != 'text') return\n if (desc.text.length > 0) return\n\n const prev = i > 0 ? nodes.get(i - 1) : null\n const next = nodes.get(i + 1)\n\n // If it's the first node, and the next is a void, preserve it.\n if (!prev && next.object == 'inline') return\n\n // It it's the last node, and the previous is an inline, preserve it.\n if (!next && prev.object == 'inline') return\n\n // If it's surrounded by inlines, preserve it.\n if (next && prev && next.object == 'inline' && prev.object == 'inline')\n return\n\n // Otherwise, remove it.\n return true\n })\n\n if (!invalids.size) return\n\n return change => {\n invalids.forEach(text => {\n change.removeNodeByKey(text.key, { normalize: false })\n })\n }\n },\n },\n]\n\n/**\n * Export.\n *\n * @type {Array}\n */\n\nexport default CORE_SCHEMA_RULES\n","import logger from 'slate-dev-logger'\nimport { Record } from 'immutable'\n\nimport MODEL_TYPES from '../constants/model-types'\nimport memoize from '../utils/memoize'\n\n/**\n * Default properties.\n *\n * @type {Object}\n */\n\nconst DEFAULTS = {\n plugins: [],\n}\n\n/**\n * Stack.\n *\n * @type {Stack}\n */\n\nclass Stack extends Record(DEFAULTS) {\n /**\n * Constructor.\n *\n * @param {Object} attrs\n */\n\n static create(attrs = {}) {\n const { plugins = [] } = attrs\n const stack = new Stack({ plugins })\n return stack\n }\n\n /**\n * Check if `any` is a `Stack`.\n *\n * @param {Any} any\n * @return {Boolean}\n */\n\n static isStack(any) {\n return !!(any && any[MODEL_TYPES.STACK])\n }\n\n /**\n * Object.\n *\n * @return {String}\n */\n\n get object() {\n return 'stack'\n }\n\n get kind() {\n logger.deprecate(\n 'slate@0.32.0',\n 'The `kind` property of Slate objects has been renamed to `object`.'\n )\n return this.object\n }\n\n /**\n * Get all plugins with `property`.\n *\n * @param {String} property\n * @return {Array}\n */\n\n getPluginsWith(property) {\n return this.plugins.filter(plugin => plugin[property] != null)\n }\n\n /**\n * Iterate the plugins with `property`, returning the first non-null value.\n *\n * @param {String} property\n * @param {Any} ...args\n */\n\n find(property, ...args) {\n const plugins = this.getPluginsWith(property)\n\n for (const plugin of plugins) {\n const ret = plugin[property](...args)\n if (ret != null) return ret\n }\n }\n\n /**\n * Iterate the plugins with `property`, returning all the non-null values.\n *\n * @param {String} property\n * @param {Any} ...args\n * @return {Array}\n */\n\n map(property, ...args) {\n const plugins = this.getPluginsWith(property)\n const array = []\n\n for (const plugin of plugins) {\n const ret = plugin[property](...args)\n if (ret != null) array.push(ret)\n }\n\n return array\n }\n\n /**\n * Iterate the plugins with `property`, breaking on any a non-null values.\n *\n * @param {String} property\n * @param {Any} ...args\n */\n\n run(property, ...args) {\n const plugins = this.getPluginsWith(property)\n\n for (const plugin of plugins) {\n const ret = plugin[property](...args)\n if (ret != null) return\n }\n }\n\n /**\n * Iterate the plugins with `property`, reducing to a set of React children.\n *\n * @param {String} property\n * @param {Object} props\n * @param {Any} ...args\n */\n\n render(property, props, ...args) {\n const plugins = this.getPluginsWith(property)\n .slice()\n .reverse()\n let { children = null } = props\n\n for (const plugin of plugins) {\n const ret = plugin[property](props, ...args)\n if (ret == null) continue\n props.children = children = ret\n }\n\n return children\n }\n}\n\n/**\n * Attach a pseudo-symbol for type checking.\n */\n\nStack.prototype[MODEL_TYPES.STACK] = true\n\n/**\n * Memoize read methods.\n */\n\nmemoize(Stack.prototype, ['getPluginsWith'])\n\n/**\n * Export.\n *\n * @type {Stack}\n */\n\nexport default Stack\n","import Debug from 'debug'\nimport isPlainObject from 'is-plain-object'\nimport logger from 'slate-dev-logger'\nimport mergeWith from 'lodash/mergeWith'\nimport { Record } from 'immutable'\n\nimport {\n CHILD_OBJECT_INVALID,\n CHILD_REQUIRED,\n CHILD_TYPE_INVALID,\n CHILD_UNKNOWN,\n FIRST_CHILD_OBJECT_INVALID,\n FIRST_CHILD_TYPE_INVALID,\n LAST_CHILD_OBJECT_INVALID,\n LAST_CHILD_TYPE_INVALID,\n NODE_DATA_INVALID,\n NODE_IS_VOID_INVALID,\n NODE_MARK_INVALID,\n NODE_TEXT_INVALID,\n PARENT_OBJECT_INVALID,\n PARENT_TYPE_INVALID,\n} from 'slate-schema-violations'\n\nimport CORE_SCHEMA_RULES from '../constants/core-schema-rules'\nimport MODEL_TYPES from '../constants/model-types'\nimport Stack from './stack'\nimport memoize from '../utils/memoize'\n\n/**\n * Debug.\n *\n * @type {Function}\n */\n\nconst debug = Debug('slate:schema')\n\n/**\n * Default properties.\n *\n * @type {Object}\n */\n\nconst DEFAULTS = {\n stack: Stack.create(),\n document: {},\n blocks: {},\n inlines: {},\n}\n\n/**\n * Schema.\n *\n * @type {Schema}\n */\n\nclass Schema extends Record(DEFAULTS) {\n /**\n * Create a new `Schema` with `attrs`.\n *\n * @param {Object|Schema} attrs\n * @return {Schema}\n */\n\n static create(attrs = {}) {\n if (Schema.isSchema(attrs)) {\n return attrs\n }\n\n if (isPlainObject(attrs)) {\n return Schema.fromJSON(attrs)\n }\n\n throw new Error(\n `\\`Schema.create\\` only accepts objects or schemas, but you passed it: ${attrs}`\n )\n }\n\n /**\n * Create a `Schema` from a JSON `object`.\n *\n * @param {Object} object\n * @return {Schema}\n */\n\n static fromJSON(object) {\n if (Schema.isSchema(object)) {\n return object\n }\n\n let { plugins } = object\n\n if (object.rules) {\n throw new Error(\n 'Schemas in Slate have changed! They are no longer accept a `rules` property.'\n )\n }\n\n if (object.nodes) {\n throw new Error(\n 'Schemas in Slate have changed! They are no longer accept a `nodes` property.'\n )\n }\n\n if (!plugins) {\n plugins = [{ schema: object }]\n }\n\n const schema = resolveSchema(plugins)\n const stack = Stack.create({ plugins: [...CORE_SCHEMA_RULES, ...plugins] })\n const ret = new Schema({ ...schema, stack })\n return ret\n }\n\n /**\n * Alias `fromJS`.\n */\n\n static fromJS = Schema.fromJSON\n\n /**\n * Check if `any` is a `Schema`.\n *\n * @param {Any} any\n * @return {Boolean}\n */\n\n static isSchema(any) {\n return !!(any && any[MODEL_TYPES.SCHEMA])\n }\n\n /**\n * Object.\n *\n * @return {String}\n */\n\n get object() {\n return 'schema'\n }\n\n get kind() {\n logger.deprecate(\n 'slate@0.32.0',\n 'The `kind` property of Slate objects has been renamed to `object`.'\n )\n return this.object\n }\n\n /**\n * Get the rule for an `object`.\n *\n * @param {Mixed} object\n * @return {Object}\n */\n\n getRule(object) {\n switch (object.object) {\n case 'document':\n return this.document\n case 'block':\n return this.blocks[object.type]\n case 'inline':\n return this.inlines[object.type]\n }\n }\n\n /**\n * Get a dictionary of the parent rule validations by child type.\n *\n * @return {Object|Null}\n */\n\n getParentRules() {\n const { blocks, inlines } = this\n const parents = {}\n\n for (const key in blocks) {\n const rule = blocks[key]\n if (rule.parent == null) continue\n parents[key] = rule\n }\n\n for (const key in inlines) {\n const rule = inlines[key]\n if (rule.parent == null) continue\n parents[key] = rule\n }\n\n return Object.keys(parents).length == 0 ? null : parents\n }\n\n /**\n * Fail validation by returning a normalizing change function.\n *\n * @param {String} violation\n * @param {Object} context\n * @return {Function}\n */\n\n fail(violation, context) {\n return change => {\n debug(`normalizing`, { violation, context })\n const { rule } = context\n const { size } = change.operations\n if (rule.normalize) rule.normalize(change, violation, context)\n if (change.operations.size > size) return\n this.normalize(change, violation, context)\n }\n }\n\n /**\n * Normalize an invalid value with `violation` and `context`.\n *\n * @param {Change} change\n * @param {String} violation\n * @param {Mixed} context\n */\n\n normalize(change, violation, context) {\n switch (violation) {\n case CHILD_OBJECT_INVALID:\n case CHILD_TYPE_INVALID:\n case CHILD_UNKNOWN:\n case FIRST_CHILD_OBJECT_INVALID:\n case FIRST_CHILD_TYPE_INVALID:\n case LAST_CHILD_OBJECT_INVALID:\n case LAST_CHILD_TYPE_INVALID: {\n const { child, node } = context\n return child.object == 'text' &&\n node.object == 'block' &&\n node.nodes.size == 1\n ? change.removeNodeByKey(node.key)\n : change.removeNodeByKey(child.key)\n }\n\n case CHILD_REQUIRED:\n case NODE_TEXT_INVALID:\n case PARENT_OBJECT_INVALID:\n case PARENT_TYPE_INVALID: {\n const { node } = context\n return node.object == 'document'\n ? node.nodes.forEach(child => change.removeNodeByKey(child.key))\n : change.removeNodeByKey(node.key)\n }\n\n case NODE_DATA_INVALID: {\n const { node, key } = context\n return node.data.get(key) === undefined && node.object != 'document'\n ? change.removeNodeByKey(node.key)\n : change.setNodeByKey(node.key, { data: node.data.delete(key) })\n }\n\n case NODE_IS_VOID_INVALID: {\n const { node } = context\n return change.setNodeByKey(node.key, { isVoid: !node.isVoid })\n }\n\n case NODE_MARK_INVALID: {\n const { node, mark } = context\n return node\n .getTexts()\n .forEach(t => change.removeMarkByKey(t.key, 0, t.text.length, mark))\n }\n }\n }\n\n /**\n * Validate a `node` with the schema, returning a function that will fix the\n * invalid node, or void if the node is valid.\n *\n * @param {Node} node\n * @return {Function|Void}\n */\n\n validateNode(node) {\n const ret = this.stack.find('validateNode', node)\n if (ret) return ret\n\n if (node.object == 'text') return\n\n const rule = this.getRule(node) || {}\n const parents = this.getParentRules()\n const ctx = { node, rule }\n\n if (rule.isVoid != null) {\n if (node.isVoid != rule.isVoid) {\n return this.fail(NODE_IS_VOID_INVALID, ctx)\n }\n }\n\n if (rule.data != null) {\n for (const key in rule.data) {\n const fn = rule.data[key]\n const value = node.data.get(key)\n\n if (!fn(value)) {\n return this.fail(NODE_DATA_INVALID, { ...ctx, key, value })\n }\n }\n }\n\n if (rule.marks != null) {\n const marks = node.getMarks().toArray()\n\n for (const mark of marks) {\n if (!rule.marks.some(def => def.type === mark.type)) {\n return this.fail(NODE_MARK_INVALID, { ...ctx, mark })\n }\n }\n }\n\n if (rule.text != null) {\n const { text } = node\n\n if (!rule.text.test(text)) {\n return this.fail(NODE_TEXT_INVALID, { ...ctx, text })\n }\n }\n\n if (rule.first != null) {\n const { objects, types } = rule.first\n const child = node.nodes.first()\n\n if (child && objects && !objects.includes(child.object)) {\n return this.fail(FIRST_CHILD_OBJECT_INVALID, { ...ctx, child })\n }\n\n if (child && types && !types.includes(child.type)) {\n return this.fail(FIRST_CHILD_TYPE_INVALID, { ...ctx, child })\n }\n }\n\n if (rule.last != null) {\n const { objects, types } = rule.last\n const child = node.nodes.last()\n\n if (child && objects && !objects.includes(child.object)) {\n return this.fail(LAST_CHILD_OBJECT_INVALID, { ...ctx, child })\n }\n\n if (child && types && !types.includes(child.type)) {\n return this.fail(LAST_CHILD_TYPE_INVALID, { ...ctx, child })\n }\n }\n\n if (rule.nodes != null || parents != null) {\n const children = node.nodes.toArray()\n const defs = rule.nodes != null ? rule.nodes.slice() : []\n\n let offset\n let min\n let index\n let def\n let max\n let child\n\n function nextDef() {\n offset = offset == null ? null : 0\n def = defs.shift()\n min = def && (def.min == null ? 0 : def.min)\n max = def && (def.max == null ? Infinity : def.max)\n return !!def\n }\n\n function nextChild() {\n index = index == null ? 0 : index + 1\n offset = offset == null ? 0 : offset + 1\n child = children[index]\n if (max != null && offset == max) nextDef()\n return !!child\n }\n function rewind() {\n offset -= 1\n index -= 1\n }\n\n if (rule.nodes != null) {\n nextDef()\n }\n\n while (nextChild()) {\n if (\n parents != null &&\n child.object != 'text' &&\n child.type in parents\n ) {\n const r = parents[child.type]\n\n if (\n r.parent.objects != null &&\n !r.parent.objects.includes(node.object)\n ) {\n return this.fail(PARENT_OBJECT_INVALID, {\n node: child,\n parent: node,\n rule: r,\n })\n }\n\n if (r.parent.types != null && !r.parent.types.includes(node.type)) {\n return this.fail(PARENT_TYPE_INVALID, {\n node: child,\n parent: node,\n rule: r,\n })\n }\n }\n\n if (rule.nodes != null) {\n if (!def) {\n return this.fail(CHILD_UNKNOWN, { ...ctx, child, index })\n }\n\n if (def.objects != null && !def.objects.includes(child.object)) {\n if (offset >= min && nextDef()) {\n rewind()\n continue\n }\n return this.fail(CHILD_OBJECT_INVALID, { ...ctx, child, index })\n }\n\n if (def.types != null && !def.types.includes(child.type)) {\n if (offset >= min && nextDef()) {\n rewind()\n continue\n }\n return this.fail(CHILD_TYPE_INVALID, { ...ctx, child, index })\n }\n }\n }\n\n if (rule.nodes != null) {\n while (min != null) {\n if (offset < min) {\n return this.fail(CHILD_REQUIRED, { ...ctx, index })\n }\n\n nextDef()\n }\n }\n }\n }\n\n /**\n * Return a JSON representation of the schema.\n *\n * @return {Object}\n */\n\n toJSON() {\n const object = {\n object: this.object,\n document: this.document,\n blocks: this.blocks,\n inlines: this.inlines,\n }\n\n return object\n }\n\n /**\n * Alias `toJS`.\n */\n\n toJS() {\n return this.toJSON()\n }\n}\n\n/**\n * Resolve a set of schema rules from an array of `plugins`.\n *\n * @param {Array} plugins\n * @return {Object}\n */\n\nfunction resolveSchema(plugins = []) {\n const schema = {\n document: {},\n blocks: {},\n inlines: {},\n }\n\n plugins\n .slice()\n .reverse()\n .forEach(plugin => {\n if (!plugin.schema) return\n\n if (plugin.schema.rules) {\n throw new Error(\n 'Schemas in Slate have changed! They are no longer accept a `rules` property.'\n )\n }\n\n if (plugin.schema.nodes) {\n throw new Error(\n 'Schemas in Slate have changed! They are no longer accept a `nodes` property.'\n )\n }\n\n const { document = {}, blocks = {}, inlines = {} } = plugin.schema\n const d = resolveDocumentRule(document)\n const bs = {}\n const is = {}\n\n for (const key in blocks) {\n bs[key] = resolveNodeRule('block', key, blocks[key])\n }\n\n for (const key in inlines) {\n is[key] = resolveNodeRule('inline', key, inlines[key])\n }\n\n mergeWith(schema.document, d, customizer)\n mergeWith(schema.blocks, bs, customizer)\n mergeWith(schema.inlines, is, customizer)\n })\n\n return schema\n}\n\n/**\n * Resolve a document rule `obj`.\n *\n * @param {Object} obj\n * @return {Object}\n */\n\nfunction resolveDocumentRule(obj) {\n return {\n data: {},\n nodes: null,\n ...obj,\n }\n}\n\n/**\n * Resolve a node rule with `type` from `obj`.\n *\n * @param {String} object\n * @param {String} type\n * @param {Object} obj\n * @return {Object}\n */\n\nfunction resolveNodeRule(object, type, obj) {\n return {\n data: {},\n isVoid: null,\n nodes: null,\n first: null,\n last: null,\n parent: null,\n text: null,\n ...obj,\n }\n}\n\n/**\n * A Lodash customizer for merging schema definitions. Special cases `objects`\n * and `types` arrays to be unioned, and ignores new `null` values.\n *\n * @param {Mixed} target\n * @param {Mixed} source\n * @return {Array|Void}\n */\n\nfunction customizer(target, source, key) {\n if (key == 'objects' || key == 'types') {\n return target == null ? source : target.concat(source)\n } else {\n return source == null ? target : source\n }\n}\n\n/**\n * Attach a pseudo-symbol for type checking.\n */\n\nSchema.prototype[MODEL_TYPES.SCHEMA] = true\n\n/**\n * Memoize read methods.\n */\n\nmemoize(Schema.prototype, ['getParentRules'])\n\n/**\n * Export.\n *\n * @type {Schema}\n */\n\nexport default Schema\n","import isPlainObject from 'is-plain-object'\nimport logger from 'slate-dev-logger'\nimport { Record, Set, List, Map } from 'immutable'\n\nimport MODEL_TYPES from '../constants/model-types'\nimport Change from './change'\nimport Data from './data'\nimport Document from './document'\nimport History from './history'\nimport Range from './range'\nimport Schema from './schema'\n\n/**\n * Default properties.\n *\n * @type {Object}\n */\n\nconst DEFAULTS = {\n data: new Map(),\n decorations: null,\n document: Document.create(),\n history: History.create(),\n schema: Schema.create(),\n selection: Range.create(),\n}\n\n/**\n * Value.\n *\n * @type {Value}\n */\n\nclass Value extends Record(DEFAULTS) {\n /**\n * Create a new `Value` with `attrs`.\n *\n * @param {Object|Value} attrs\n * @param {Object} options\n * @return {Value}\n */\n\n static create(attrs = {}, options = {}) {\n if (Value.isValue(attrs)) {\n return attrs\n }\n\n if (isPlainObject(attrs)) {\n return Value.fromJSON(attrs)\n }\n\n throw new Error(\n `\\`Value.create\\` only accepts objects or values, but you passed it: ${attrs}`\n )\n }\n\n /**\n * Create a dictionary of settable value properties from `attrs`.\n *\n * @param {Object|Value} attrs\n * @return {Object}\n */\n\n static createProperties(attrs = {}) {\n if (Value.isValue(attrs)) {\n return {\n data: attrs.data,\n decorations: attrs.decorations,\n schema: attrs.schema,\n }\n }\n\n if (isPlainObject(attrs)) {\n const props = {}\n if ('data' in attrs) props.data = Data.create(attrs.data)\n if ('decorations' in attrs)\n props.decorations = Range.createList(attrs.decorations)\n if ('schema' in attrs) props.schema = Schema.create(attrs.schema)\n return props\n }\n\n throw new Error(\n `\\`Value.createProperties\\` only accepts objects or values, but you passed it: ${attrs}`\n )\n }\n\n /**\n * Create a `Value` from a JSON `object`.\n *\n * @param {Object} object\n * @param {Object} options\n * @property {Boolean} normalize\n * @property {Array} plugins\n * @return {Value}\n */\n\n static fromJSON(object, options = {}) {\n let { document = {}, selection = {}, schema = {} } = object\n\n let data = new Map()\n\n document = Document.fromJSON(document)\n selection = Range.fromJSON(selection)\n schema = Schema.fromJSON(schema)\n\n // Allow plugins to set a default value for `data`.\n if (options.plugins) {\n for (const plugin of options.plugins) {\n if (plugin.data) data = data.merge(plugin.data)\n }\n }\n\n // Then merge in the `data` provided.\n if ('data' in object) {\n data = data.merge(object.data)\n }\n\n if (selection.isUnset) {\n const text = document.getFirstText()\n if (text) selection = selection.collapseToStartOf(text)\n }\n\n let value = new Value({\n data,\n document,\n selection,\n schema,\n })\n\n if (options.normalize !== false) {\n value = value.change({ save: false }).normalize().value\n }\n\n return value\n }\n\n /**\n * Alias `fromJS`.\n */\n\n static fromJS = Value.fromJSON\n\n /**\n * Check if a `value` is a `Value`.\n *\n * @param {Any} value\n * @return {Boolean}\n */\n\n static isValue(value) {\n return !!(value && value[MODEL_TYPES.VALUE])\n }\n\n /**\n * Object.\n *\n * @return {String}\n */\n\n get object() {\n return 'value'\n }\n\n get kind() {\n logger.deprecate(\n 'slate@0.32.0',\n 'The `kind` property of Slate objects has been renamed to `object`.'\n )\n return this.object\n }\n\n /**\n * Are there undoable events?\n *\n * @return {Boolean}\n */\n\n get hasUndos() {\n return this.history.undos.size > 0\n }\n\n /**\n * Are there redoable events?\n *\n * @return {Boolean}\n */\n\n get hasRedos() {\n return this.history.redos.size > 0\n }\n\n /**\n * Is the current selection blurred?\n *\n * @return {Boolean}\n */\n\n get isBlurred() {\n return this.selection.isBlurred\n }\n\n /**\n * Is the current selection focused?\n *\n * @return {Boolean}\n */\n\n get isFocused() {\n return this.selection.isFocused\n }\n\n /**\n * Is the current selection collapsed?\n *\n * @return {Boolean}\n */\n\n get isCollapsed() {\n return this.selection.isCollapsed\n }\n\n /**\n * Is the current selection expanded?\n *\n * @return {Boolean}\n */\n\n get isExpanded() {\n return this.selection.isExpanded\n }\n\n /**\n * Is the current selection backward?\n *\n * @return {Boolean} isBackward\n */\n\n get isBackward() {\n return this.selection.isBackward\n }\n\n /**\n * Is the current selection forward?\n *\n * @return {Boolean}\n */\n\n get isForward() {\n return this.selection.isForward\n }\n\n /**\n * Get the current start key.\n *\n * @return {String}\n */\n\n get startKey() {\n return this.selection.startKey\n }\n\n /**\n * Get the current end key.\n *\n * @return {String}\n */\n\n get endKey() {\n return this.selection.endKey\n }\n\n /**\n * Get the current start offset.\n *\n * @return {String}\n */\n\n get startOffset() {\n return this.selection.startOffset\n }\n\n /**\n * Get the current end offset.\n *\n * @return {String}\n */\n\n get endOffset() {\n return this.selection.endOffset\n }\n\n /**\n * Get the current anchor key.\n *\n * @return {String}\n */\n\n get anchorKey() {\n return this.selection.anchorKey\n }\n\n /**\n * Get the current focus key.\n *\n * @return {String}\n */\n\n get focusKey() {\n return this.selection.focusKey\n }\n\n /**\n * Get the current anchor offset.\n *\n * @return {String}\n */\n\n get anchorOffset() {\n return this.selection.anchorOffset\n }\n\n /**\n * Get the current focus offset.\n *\n * @return {String}\n */\n\n get focusOffset() {\n return this.selection.focusOffset\n }\n\n /**\n * Get the current start text node's closest block parent.\n *\n * @return {Block}\n */\n\n get startBlock() {\n return this.startKey && this.document.getClosestBlock(this.startKey)\n }\n\n /**\n * Get the current end text node's closest block parent.\n *\n * @return {Block}\n */\n\n get endBlock() {\n return this.endKey && this.document.getClosestBlock(this.endKey)\n }\n\n /**\n * Get the current anchor text node's closest block parent.\n *\n * @return {Block}\n */\n\n get anchorBlock() {\n return this.anchorKey && this.document.getClosestBlock(this.anchorKey)\n }\n\n /**\n * Get the current focus text node's closest block parent.\n *\n * @return {Block}\n */\n\n get focusBlock() {\n return this.focusKey && this.document.getClosestBlock(this.focusKey)\n }\n\n /**\n * Get the current start text node's closest inline parent.\n *\n * @return {Inline}\n */\n\n get startInline() {\n return this.startKey && this.document.getClosestInline(this.startKey)\n }\n\n /**\n * Get the current end text node's closest inline parent.\n *\n * @return {Inline}\n */\n\n get endInline() {\n return this.endKey && this.document.getClosestInline(this.endKey)\n }\n\n /**\n * Get the current anchor text node's closest inline parent.\n *\n * @return {Inline}\n */\n\n get anchorInline() {\n return this.anchorKey && this.document.getClosestInline(this.anchorKey)\n }\n\n /**\n * Get the current focus text node's closest inline parent.\n *\n * @return {Inline}\n */\n\n get focusInline() {\n return this.focusKey && this.document.getClosestInline(this.focusKey)\n }\n\n /**\n * Get the current start text node.\n *\n * @return {Text}\n */\n\n get startText() {\n return this.startKey && this.document.getDescendant(this.startKey)\n }\n\n /**\n * Get the current end node.\n *\n * @return {Text}\n */\n\n get endText() {\n return this.endKey && this.document.getDescendant(this.endKey)\n }\n\n /**\n * Get the current anchor node.\n *\n * @return {Text}\n */\n\n get anchorText() {\n return this.anchorKey && this.document.getDescendant(this.anchorKey)\n }\n\n /**\n * Get the current focus node.\n *\n * @return {Text}\n */\n\n get focusText() {\n return this.focusKey && this.document.getDescendant(this.focusKey)\n }\n\n /**\n * Get the next block node.\n *\n * @return {Block}\n */\n\n get nextBlock() {\n return this.endKey && this.document.getNextBlock(this.endKey)\n }\n\n /**\n * Get the previous block node.\n *\n * @return {Block}\n */\n\n get previousBlock() {\n return this.startKey && this.document.getPreviousBlock(this.startKey)\n }\n\n /**\n * Get the next inline node.\n *\n * @return {Inline}\n */\n\n get nextInline() {\n return this.endKey && this.document.getNextInline(this.endKey)\n }\n\n /**\n * Get the previous inline node.\n *\n * @return {Inline}\n */\n\n get previousInline() {\n return this.startKey && this.document.getPreviousInline(this.startKey)\n }\n\n /**\n * Get the next text node.\n *\n * @return {Text}\n */\n\n get nextText() {\n return this.endKey && this.document.getNextText(this.endKey)\n }\n\n /**\n * Get the previous text node.\n *\n * @return {Text}\n */\n\n get previousText() {\n return this.startKey && this.document.getPreviousText(this.startKey)\n }\n\n /**\n * Get the characters in the current selection.\n *\n * @return {List<Character>}\n */\n\n get characters() {\n return this.selection.isUnset\n ? new List()\n : this.document.getCharactersAtRange(this.selection)\n }\n\n /**\n * Get the marks of the current selection.\n *\n * @return {Set<Mark>}\n */\n\n get marks() {\n return this.selection.isUnset\n ? new Set()\n : this.selection.marks || this.document.getMarksAtRange(this.selection)\n }\n\n /**\n * Get the active marks of the current selection.\n *\n * @return {Set<Mark>}\n */\n\n get activeMarks() {\n return this.selection.isUnset\n ? new Set()\n : this.selection.marks ||\n this.document.getActiveMarksAtRange(this.selection)\n }\n\n /**\n * Get the block nodes in the current selection.\n *\n * @return {List<Block>}\n */\n\n get blocks() {\n return this.selection.isUnset\n ? new List()\n : this.document.getBlocksAtRange(this.selection)\n }\n\n /**\n * Get the fragment of the current selection.\n *\n * @return {Document}\n */\n\n get fragment() {\n return this.selection.isUnset\n ? Document.create()\n : this.document.getFragmentAtRange(this.selection)\n }\n\n /**\n * Get the inline nodes in the current selection.\n *\n * @return {List<Inline>}\n */\n\n get inlines() {\n return this.selection.isUnset\n ? new List()\n : this.document.getInlinesAtRange(this.selection)\n }\n\n /**\n * Get the text nodes in the current selection.\n *\n * @return {List<Text>}\n */\n\n get texts() {\n return this.selection.isUnset\n ? new List()\n : this.document.getTextsAtRange(this.selection)\n }\n\n /**\n * Check whether the selection is empty.\n *\n * @return {Boolean}\n */\n\n get isEmpty() {\n if (this.isCollapsed) return true\n if (this.endOffset != 0 && this.startOffset != 0) return false\n return this.fragment.isEmpty\n }\n\n /**\n * Check whether the selection is collapsed in a void node.\n *\n * @return {Boolean}\n */\n\n get isInVoid() {\n if (this.isExpanded) return false\n return this.document.hasVoidParent(this.startKey)\n }\n\n /**\n * Create a new `Change` with the current value as a starting point.\n *\n * @param {Object} attrs\n * @return {Change}\n */\n\n change(attrs = {}) {\n return new Change({ ...attrs, value: this })\n }\n\n /**\n * Return a JSON representation of the value.\n *\n * @param {Object} options\n * @return {Object}\n */\n\n toJSON(options = {}) {\n const object = {\n object: this.object,\n document: this.document.toJSON(options),\n }\n\n if (options.preserveData) {\n object.data = this.data.toJSON()\n }\n\n if (options.preserveDecorations) {\n object.decorations = this.decorations\n ? this.decorations.toArray().map(d => d.toJSON())\n : null\n }\n\n if (options.preserveHistory) {\n object.history = this.history.toJSON()\n }\n\n if (options.preserveSelection) {\n object.selection = this.selection.toJSON()\n }\n\n if (options.preserveSchema) {\n object.schema = this.schema.toJSON()\n }\n\n if (options.preserveSelection && !options.preserveKeys) {\n const { document, selection } = this\n object.selection.anchorPath = selection.isSet\n ? document.getPath(selection.anchorKey)\n : null\n object.selection.focusPath = selection.isSet\n ? document.getPath(selection.focusKey)\n : null\n delete object.selection.anchorKey\n delete object.selection.focusKey\n }\n\n if (\n options.preserveDecorations &&\n object.decorations &&\n !options.preserveKeys\n ) {\n const { document } = this\n object.decorations = object.decorations.map(decoration => {\n const withPath = {\n ...decoration,\n anchorPath: document.getPath(decoration.anchorKey),\n focusPath: document.getPath(decoration.focusKey),\n }\n delete withPath.anchorKey\n delete withPath.focusKey\n return withPath\n })\n }\n\n return object\n }\n\n /**\n * Alias `toJS`.\n */\n\n toJS(options) {\n return this.toJSON(options)\n }\n}\n\n/**\n * Attach a pseudo-symbol for type checking.\n */\n\nValue.prototype[MODEL_TYPES.VALUE] = true\n\n/**\n * Export.\n */\n\nexport default Value\n","import isPlainObject from 'is-plain-object'\nimport logger from 'slate-dev-logger'\nimport { List, Record } from 'immutable'\n\nimport MODEL_TYPES from '../constants/model-types'\nimport OPERATION_ATTRIBUTES from '../constants/operation-attributes'\nimport Mark from './mark'\nimport Node from './node'\nimport Range from './range'\nimport Value from './value'\n\n/**\n * Default properties.\n *\n * @type {Object}\n */\n\nconst DEFAULTS = {\n length: undefined,\n mark: undefined,\n marks: undefined,\n newPath: undefined,\n node: undefined,\n offset: undefined,\n path: undefined,\n position: undefined,\n properties: undefined,\n selection: undefined,\n target: undefined,\n text: undefined,\n type: undefined,\n value: undefined,\n}\n\n/**\n * Operation.\n *\n * @type {Operation}\n */\n\nclass Operation extends Record(DEFAULTS) {\n /**\n * Create a new `Operation` with `attrs`.\n *\n * @param {Object|Array|List|String|Operation} attrs\n * @return {Operation}\n */\n\n static create(attrs = {}) {\n if (Operation.isOperation(attrs)) {\n return attrs\n }\n\n if (isPlainObject(attrs)) {\n return Operation.fromJSON(attrs)\n }\n\n throw new Error(\n `\\`Operation.create\\` only accepts objects or operations, but you passed it: ${attrs}`\n )\n }\n\n /**\n * Create a list of `Operations` from `elements`.\n *\n * @param {Array<Operation|Object>|List<Operation|Object>} elements\n * @return {List<Operation>}\n */\n\n static createList(elements = []) {\n if (List.isList(elements) || Array.isArray(elements)) {\n const list = new List(elements.map(Operation.create))\n return list\n }\n\n throw new Error(\n `\\`Operation.createList\\` only accepts arrays or lists, but you passed it: ${elements}`\n )\n }\n\n /**\n * Create a `Operation` from a JSON `object`.\n *\n * @param {Object|Operation} object\n * @return {Operation}\n */\n\n static fromJSON(object) {\n if (Operation.isOperation(object)) {\n return object\n }\n\n const { type, value } = object\n const ATTRIBUTES = OPERATION_ATTRIBUTES[type]\n const attrs = { type }\n\n if (!ATTRIBUTES) {\n throw new Error(\n `\\`Operation.fromJSON\\` was passed an unrecognized operation type: \"${type}\"`\n )\n }\n\n for (const key of ATTRIBUTES) {\n let v = object[key]\n\n if (v === undefined) {\n // Skip keys for objects that should not be serialized, and are only used\n // for providing the local-only invert behavior for the history stack.\n if (key == 'document') continue\n if (key == 'selection') continue\n if (key == 'value') continue\n if (key == 'node' && type != 'insert_node') continue\n\n throw new Error(\n `\\`Operation.fromJSON\\` was passed a \"${type}\" operation without the required \"${key}\" attribute.`\n )\n }\n\n if (key == 'mark') {\n v = Mark.create(v)\n }\n\n if (key == 'marks' && v != null) {\n v = Mark.createSet(v)\n }\n\n if (key == 'node') {\n v = Node.create(v)\n }\n\n if (key == 'selection') {\n v = Range.create(v)\n }\n\n if (key == 'value') {\n v = Value.create(v)\n }\n\n if (key == 'properties' && type == 'merge_node') {\n v = Node.createProperties(v)\n }\n\n if (key == 'properties' && type == 'set_mark') {\n v = Mark.createProperties(v)\n }\n\n if (key == 'properties' && type == 'set_node') {\n v = Node.createProperties(v)\n }\n\n if (key == 'properties' && type == 'set_selection') {\n const { anchorKey, focusKey, ...rest } = v\n v = Range.createProperties(rest)\n\n if (anchorKey !== undefined) {\n v.anchorPath =\n anchorKey === null ? null : value.document.getPath(anchorKey)\n }\n\n if (focusKey !== undefined) {\n v.focusPath =\n focusKey === null ? null : value.document.getPath(focusKey)\n }\n }\n\n if (key == 'properties' && type == 'set_value') {\n v = Value.createProperties(v)\n }\n\n if (key == 'properties' && type == 'split_node') {\n v = Node.createProperties(v)\n }\n\n attrs[key] = v\n }\n\n const node = new Operation(attrs)\n return node\n }\n\n /**\n * Alias `fromJS`.\n */\n\n static fromJS = Operation.fromJSON\n\n /**\n * Check if `any` is a `Operation`.\n *\n * @param {Any} any\n * @return {Boolean}\n */\n\n static isOperation(any) {\n return !!(any && any[MODEL_TYPES.OPERATION])\n }\n\n /**\n * Check if `any` is a list of operations.\n *\n * @param {Any} any\n * @return {Boolean}\n */\n\n static isOperationList(any) {\n return List.isList(any) && any.every(item => Operation.isOperation(item))\n }\n\n /**\n * Object.\n *\n * @return {String}\n */\n\n get object() {\n return 'operation'\n }\n\n get kind() {\n logger.deprecate(\n 'slate@0.32.0',\n 'The `kind` property of Slate objects has been renamed to `object`.'\n )\n return this.object\n }\n\n /**\n * Return a JSON representation of the operation.\n *\n * @param {Object} options\n * @return {Object}\n */\n\n toJSON(options = {}) {\n const { object, type } = this\n const json = { object, type }\n const ATTRIBUTES = OPERATION_ATTRIBUTES[type]\n\n for (const key of ATTRIBUTES) {\n let value = this[key]\n\n // Skip keys for objects that should not be serialized, and are only used\n // for providing the local-only invert behavior for the history stack.\n if (key == 'document') continue\n if (key == 'selection') continue\n if (key == 'value') continue\n if (key == 'node' && type != 'insert_node') continue\n\n if (key == 'mark' || key == 'marks' || key == 'node') {\n value = value.toJSON()\n }\n\n if (key == 'properties' && type == 'merge_node') {\n const v = {}\n if ('data' in value) v.data = value.data.toJS()\n if ('type' in value) v.type = value.type\n value = v\n }\n\n if (key == 'properties' && type == 'set_mark') {\n const v = {}\n if ('data' in value) v.data = value.data.toJS()\n if ('type' in value) v.type = value.type\n value = v\n }\n\n if (key == 'properties' && type == 'set_node') {\n const v = {}\n if ('data' in value) v.data = value.data.toJS()\n if ('isVoid' in value) v.isVoid = value.isVoid\n if ('type' in value) v.type = value.type\n value = v\n }\n\n if (key == 'properties' && type == 'set_selection') {\n const v = {}\n if ('anchorOffset' in value) v.anchorOffset = value.anchorOffset\n if ('anchorPath' in value) v.anchorPath = value.anchorPath\n if ('focusOffset' in value) v.focusOffset = value.focusOffset\n if ('focusPath' in value) v.focusPath = value.focusPath\n if ('isBackward' in value) v.isBackward = value.isBackward\n if ('isFocused' in value) v.isFocused = value.isFocused\n if ('marks' in value)\n v.marks = value.marks == null ? null : value.marks.toJSON()\n value = v\n }\n\n if (key == 'properties' && type == 'set_value') {\n const v = {}\n if ('data' in value) v.data = value.data.toJS()\n if ('decorations' in value) v.decorations = value.decorations.toJS()\n if ('schema' in value) v.schema = value.schema.toJS()\n value = v\n }\n\n if (key == 'properties' && type == 'split_node') {\n const v = {}\n if ('data' in value) v.data = value.data.toJS()\n if ('type' in value) v.type = value.type\n value = v\n }\n\n json[key] = value\n }\n\n return json\n }\n\n /**\n * Alias `toJS`.\n */\n\n toJS(options) {\n return this.toJSON(options)\n }\n}\n\n/**\n * Attach a pseudo-symbol for type checking.\n */\n\nOperation.prototype[MODEL_TYPES.OPERATION] = true\n\n/**\n * Export.\n *\n * @type {Operation}\n */\n\nexport default Operation\n","import Debug from 'debug'\nimport pick from 'lodash/pick'\n\nimport Operation from '../models/operation'\n\n/**\n * Debug.\n *\n * @type {Function}\n */\n\nconst debug = Debug('slate:operation:invert')\n\n/**\n * Invert an `op`.\n *\n * @param {Object} op\n * @return {Object}\n */\n\nfunction invertOperation(op) {\n op = Operation.create(op)\n const { type } = op\n debug(type, op)\n\n /**\n * Insert node.\n */\n\n if (type == 'insert_node') {\n const inverse = op.set('type', 'remove_node')\n return inverse\n }\n\n /**\n * Remove node.\n */\n\n if (type == 'remove_node') {\n const inverse = op.set('type', 'insert_node')\n return inverse\n }\n\n /**\n * Move node.\n */\n\n if (type == 'move_node') {\n const { newPath, path } = op\n let inversePath = newPath\n let inverseNewPath = path\n\n const pathLast = path.length - 1\n const newPathLast = newPath.length - 1\n\n // If the node's old position was a left sibling of an ancestor of\n // its new position, we need to adjust part of the path by -1.\n if (\n path.length < inversePath.length &&\n path.slice(0, pathLast).every((e, i) => e == inversePath[i]) &&\n path[pathLast] < inversePath[pathLast]\n ) {\n inversePath = inversePath\n .slice(0, pathLast)\n .concat([inversePath[pathLast] - 1])\n .concat(inversePath.slice(pathLast + 1, inversePath.length))\n }\n\n // If the node's new position is an ancestor of the old position,\n // or a left sibling of an ancestor of its old position, we need\n // to adjust part of the path by 1.\n if (\n newPath.length < inverseNewPath.length &&\n newPath.slice(0, newPathLast).every((e, i) => e == inverseNewPath[i]) &&\n newPath[newPathLast] <= inverseNewPath[newPathLast]\n ) {\n inverseNewPath = inverseNewPath\n .slice(0, newPathLast)\n .concat([inverseNewPath[newPathLast] + 1])\n .concat(inverseNewPath.slice(newPathLast + 1, inverseNewPath.length))\n }\n\n const inverse = op.set('path', inversePath).set('newPath', inverseNewPath)\n return inverse\n }\n\n /**\n * Merge node.\n */\n\n if (type == 'merge_node') {\n const { path } = op\n const { length } = path\n const last = length - 1\n const inversePath = path.slice(0, last).concat([path[last] - 1])\n const inverse = op.set('type', 'split_node').set('path', inversePath)\n return inverse\n }\n\n /**\n * Split node.\n */\n\n if (type == 'split_node') {\n const { path } = op\n const { length } = path\n const last = length - 1\n const inversePath = path.slice(0, last).concat([path[last] + 1])\n const inverse = op.set('type', 'merge_node').set('path', inversePath)\n return inverse\n }\n\n /**\n * Set node.\n */\n\n if (type == 'set_node') {\n const { properties, node } = op\n const inverseNode = node.merge(properties)\n const inverseProperties = pick(node, Object.keys(properties))\n const inverse = op\n .set('node', inverseNode)\n .set('properties', inverseProperties)\n return inverse\n }\n\n /**\n * Insert text.\n */\n\n if (type == 'insert_text') {\n const inverse = op.set('type', 'remove_text')\n return inverse\n }\n\n /**\n * Remove text.\n */\n\n if (type == 'remove_text') {\n const inverse = op.set('type', 'insert_text')\n return inverse\n }\n\n /**\n * Add mark.\n */\n\n if (type == 'add_mark') {\n const inverse = op.set('type', 'remove_mark')\n return inverse\n }\n\n /**\n * Remove mark.\n */\n\n if (type == 'remove_mark') {\n const inverse = op.set('type', 'add_mark')\n return inverse\n }\n\n /**\n * Set mark.\n */\n\n if (type == 'set_mark') {\n const { properties, mark } = op\n const inverseMark = mark.merge(properties)\n const inverseProperties = pick(mark, Object.keys(properties))\n const inverse = op\n .set('mark', inverseMark)\n .set('properties', inverseProperties)\n return inverse\n }\n\n /**\n * Set selection.\n */\n\n if (type == 'set_selection') {\n const { properties, selection, value } = op\n const { anchorPath, focusPath, ...props } = properties\n const { document } = value\n\n if (anchorPath !== undefined) {\n props.anchorKey =\n anchorPath === null ? null : document.assertPath(anchorPath).key\n }\n\n if (focusPath !== undefined) {\n props.focusKey =\n focusPath === null ? null : document.assertPath(focusPath).key\n }\n\n const inverseSelection = selection.merge(props)\n const inverseProps = pick(selection, Object.keys(props))\n\n if (anchorPath !== undefined) {\n inverseProps.anchorPath =\n inverseProps.anchorKey === null\n ? null\n : document.getPath(inverseProps.anchorKey)\n delete inverseProps.anchorKey\n }\n\n if (focusPath !== undefined) {\n inverseProps.focusPath =\n inverseProps.focusKey === null\n ? null\n : document.getPath(inverseProps.focusKey)\n delete inverseProps.focusKey\n }\n\n const inverse = op\n .set('selection', inverseSelection)\n .set('properties', inverseProps)\n return inverse\n }\n\n /**\n * Set value.\n */\n\n if (type == 'set_value') {\n const { properties, value } = op\n const inverseValue = value.merge(properties)\n const inverseProperties = pick(value, Object.keys(properties))\n const inverse = op\n .set('value', inverseValue)\n .set('properties', inverseProperties)\n return inverse\n }\n}\n\n/**\n * Export.\n *\n * @type {Function}\n */\n\nexport default invertOperation\n","import invert from '../operations/invert'\nimport omit from 'lodash/omit'\n\n/**\n * Changes.\n *\n * @type {Object}\n */\n\nconst Changes = {}\n\n/**\n * Redo to the next value in the history.\n *\n * @param {Change} change\n */\n\nChanges.redo = change => {\n let { value } = change\n let { history } = value\n if (!history) return\n\n let { undos, redos } = history\n const next = redos.peek()\n if (!next) return\n\n // Shift the next value into the undo stack.\n redos = redos.pop()\n undos = undos.push(next)\n\n // Replay the next operations.\n next.forEach(op => {\n const { type, properties } = op\n\n // When the operation mutates the selection, omit its `isFocused` value to\n // prevent the editor focus from changing during redoing.\n if (type == 'set_selection') {\n op = op.set('properties', omit(properties, 'isFocused'))\n }\n\n change.applyOperation(op, { save: false })\n })\n\n // Update the history.\n value = change.value\n history = history.set('undos', undos).set('redos', redos)\n value = value.set('history', history)\n change.value = value\n}\n\n/**\n * Undo the previous operations in the history.\n *\n * @param {Change} change\n */\n\nChanges.undo = change => {\n let { value } = change\n let { history } = value\n if (!history) return\n\n let { undos, redos } = history\n const previous = undos.peek()\n if (!previous) return\n\n // Shift the previous operations into the redo stack.\n undos = undos.pop()\n redos = redos.push(previous)\n\n // Replay the inverse of the previous operations.\n previous\n .slice()\n .reverse()\n .map(invert)\n .forEach(inverse => {\n const { type, properties } = inverse\n\n // When the operation mutates the selection, omit its `isFocused` value to\n // prevent the editor focus from changing during undoing.\n if (type == 'set_selection') {\n inverse = inverse.set('properties', omit(properties, 'isFocused'))\n }\n\n change.applyOperation(inverse, { save: false })\n })\n\n // Update the history.\n value = change.value\n history = history.set('undos', undos).set('redos', redos)\n value = value.set('history', history)\n change.value = value\n}\n\n/**\n * Export.\n *\n * @type {Object}\n */\n\nexport default Changes\n","import isEmpty from 'is-empty'\nimport pick from 'lodash/pick'\n\nimport Range from '../models/range'\n\n/**\n * Changes.\n *\n * @type {Object}\n */\n\nconst Changes = {}\n\n/**\n * Set `properties` on the selection.\n *\n * @param {Change} change\n * @param {Object} properties\n */\n\nChanges.select = (change, properties, options = {}) => {\n properties = Range.createProperties(properties)\n\n const { snapshot = false } = options\n const { value } = change\n const { document, selection } = value\n const props = {}\n const sel = selection.toJSON()\n const next = selection.merge(properties).normalize(document)\n properties = pick(next, Object.keys(properties))\n\n // Remove any properties that are already equal to the current selection. And\n // create a dictionary of the previous values for all of the properties that\n // are being changed, for the inverse operation.\n for (const k in properties) {\n if (snapshot == false && properties[k] == sel[k]) continue\n props[k] = properties[k]\n }\n\n // If the selection moves, clear any marks, unless the new selection\n // properties change the marks in some way.\n const moved = ['anchorKey', 'anchorOffset', 'focusKey', 'focusOffset'].some(\n p => props.hasOwnProperty(p)\n )\n\n if (sel.marks && properties.marks == sel.marks && moved) {\n props.marks = null\n }\n\n // If there are no new properties to set, abort.\n if (isEmpty(props)) {\n return\n }\n\n // Apply the operation.\n change.applyOperation(\n {\n type: 'set_selection',\n value,\n properties: props,\n selection: sel,\n },\n snapshot ? { skip: false, merge: false } : {}\n )\n}\n\n/**\n * Select the whole document.\n *\n * @param {Change} change\n */\n\nChanges.selectAll = change => {\n const { value } = change\n const { document, selection } = value\n const next = selection.moveToRangeOf(document)\n change.select(next)\n}\n\n/**\n * Snapshot the current selection.\n *\n * @param {Change} change\n */\n\nChanges.snapshotSelection = change => {\n const { value } = change\n const { selection } = value\n change.select(selection, { snapshot: true })\n}\n\n/**\n * Move the anchor point backward, accounting for being at the start of a block.\n *\n * @param {Change} change\n */\n\nChanges.moveAnchorCharBackward = change => {\n const { value } = change\n const { document, selection, anchorText, anchorBlock } = value\n const { anchorOffset } = selection\n const previousText = document.getPreviousText(anchorText.key)\n const isInVoid = document.hasVoidParent(anchorText.key)\n const isPreviousInVoid =\n previousText && document.hasVoidParent(previousText.key)\n\n if (!isInVoid && anchorOffset > 0) {\n change.moveAnchor(-1)\n return\n }\n\n if (!previousText) {\n return\n }\n\n change.moveAnchorToEndOf(previousText)\n\n if (!isInVoid && !isPreviousInVoid && anchorBlock.hasNode(previousText.key)) {\n change.moveAnchor(-1)\n }\n}\n\n/**\n * Move the anchor point forward, accounting for being at the end of a block.\n *\n * @param {Change} change\n */\n\nChanges.moveAnchorCharForward = change => {\n const { value } = change\n const { document, selection, anchorText, anchorBlock } = value\n const { anchorOffset } = selection\n const nextText = document.getNextText(anchorText.key)\n const isInVoid = document.hasVoidParent(anchorText.key)\n const isNextInVoid = nextText && document.hasVoidParent(nextText.key)\n\n if (!isInVoid && anchorOffset < anchorText.text.length) {\n change.moveAnchor(1)\n return\n }\n\n if (!nextText) {\n return\n }\n\n change.moveAnchorToStartOf(nextText)\n\n if (!isInVoid && !isNextInVoid && anchorBlock.hasNode(nextText.key)) {\n change.moveAnchor(1)\n }\n}\n\n/**\n * Move the focus point backward, accounting for being at the start of a block.\n *\n * @param {Change} change\n */\n\nChanges.moveFocusCharBackward = change => {\n const { value } = change\n const { document, selection, focusText, focusBlock } = value\n const { focusOffset } = selection\n const previousText = document.getPreviousText(focusText.key)\n const isInVoid = document.hasVoidParent(focusText.key)\n const isPreviousInVoid =\n previousText && document.hasVoidParent(previousText.key)\n\n if (!isInVoid && focusOffset > 0) {\n change.moveFocus(-1)\n return\n }\n\n if (!previousText) {\n return\n }\n\n change.moveFocusToEndOf(previousText)\n\n if (!isInVoid && !isPreviousInVoid && focusBlock.hasNode(previousText.key)) {\n change.moveFocus(-1)\n }\n}\n\n/**\n * Move the focus point forward, accounting for being at the end of a block.\n *\n * @param {Change} change\n */\n\nChanges.moveFocusCharForward = change => {\n const { value } = change\n const { document, selection, focusText, focusBlock } = value\n const { focusOffset } = selection\n const nextText = document.getNextText(focusText.key)\n const isInVoid = document.hasVoidParent(focusText.key)\n const isNextInVoid = nextText && document.hasVoidParent(nextText.key)\n\n if (!isInVoid && focusOffset < focusText.text.length) {\n change.moveFocus(1)\n return\n }\n\n if (!nextText) {\n return\n }\n\n change.moveFocusToStartOf(nextText)\n\n if (!isInVoid && !isNextInVoid && focusBlock.hasNode(nextText.key)) {\n change.moveFocus(1)\n }\n}\n\n/**\n * Mix in move methods.\n */\n\nconst MOVE_DIRECTIONS = ['Forward', 'Backward']\n\nMOVE_DIRECTIONS.forEach(direction => {\n const anchor = `moveAnchorChar${direction}`\n const focus = `moveFocusChar${direction}`\n\n Changes[`moveChar${direction}`] = change => {\n change[anchor]()[focus]()\n }\n\n Changes[`moveStartChar${direction}`] = change => {\n if (change.value.isBackward) {\n change[focus]()\n } else {\n change[anchor]()\n }\n }\n\n Changes[`moveEndChar${direction}`] = change => {\n if (change.value.isBackward) {\n change[anchor]()\n } else {\n change[focus]()\n }\n }\n\n Changes[`extendChar${direction}`] = change => {\n change[`moveFocusChar${direction}`]()\n }\n\n Changes[`collapseChar${direction}`] = change => {\n const collapse =\n direction == 'Forward' ? 'collapseToEnd' : 'collapseToStart'\n change[collapse]()[`moveChar${direction}`]()\n }\n})\n\n/**\n * Mix in alias methods.\n */\n\nconst ALIAS_METHODS = [\n ['collapseLineBackward', 'collapseToStartOfBlock'],\n ['collapseLineForward', 'collapseToEndOfBlock'],\n ['extendLineBackward', 'extendToStartOfBlock'],\n ['extendLineForward', 'extendToEndOfBlock'],\n]\n\nALIAS_METHODS.forEach(([alias, method]) => {\n Changes[alias] = function(change, ...args) {\n change[method](change, ...args)\n }\n})\n\n/**\n * Mix in selection changes that are just a proxy for the selection method.\n */\n\nconst PROXY_TRANSFORMS = [\n 'blur',\n 'collapseTo',\n 'collapseToAnchor',\n 'collapseToEnd',\n 'collapseToEndOf',\n 'collapseToFocus',\n 'collapseToStart',\n 'collapseToStartOf',\n 'extend',\n 'extendTo',\n 'extendToEndOf',\n 'extendToStartOf',\n 'flip',\n 'focus',\n 'move',\n 'moveAnchor',\n 'moveAnchorOffsetTo',\n 'moveAnchorTo',\n 'moveAnchorToEndOf',\n 'moveAnchorToStartOf',\n 'moveEnd',\n 'moveEndOffsetTo',\n 'moveEndTo',\n 'moveFocus',\n 'moveFocusOffsetTo',\n 'moveFocusTo',\n 'moveFocusToEndOf',\n 'moveFocusToStartOf',\n 'moveOffsetsTo',\n 'moveStart',\n 'moveStartOffsetTo',\n 'moveStartTo',\n 'moveTo',\n 'moveToEnd',\n 'moveToEndOf',\n 'moveToRangeOf',\n 'moveToStart',\n 'moveToStartOf',\n 'deselect',\n]\n\nPROXY_TRANSFORMS.forEach(method => {\n Changes[method] = (change, ...args) => {\n const normalize = method != 'deselect'\n const { value } = change\n const { document, selection } = value\n let next = selection[method](...args)\n if (normalize) next = next.normalize(document)\n change.select(next)\n }\n})\n\n/**\n * Mix in node-related changes.\n */\n\nconst PREFIXES = [\n 'moveTo',\n 'moveAnchorTo',\n 'moveFocusTo',\n 'moveStartTo',\n 'moveEndTo',\n 'collapseTo',\n 'extendTo',\n]\n\nconst DIRECTIONS = ['Next', 'Previous']\n\nconst OBJECTS = ['Block', 'Inline', 'Text']\n\nPREFIXES.forEach(prefix => {\n const edges = ['Start', 'End']\n\n if (prefix == 'moveTo') {\n edges.push('Range')\n }\n\n edges.forEach(edge => {\n const method = `${prefix}${edge}Of`\n\n OBJECTS.forEach(object => {\n const getNode = object == 'Text' ? 'getNode' : `getClosest${object}`\n\n Changes[`${method}${object}`] = change => {\n const { value } = change\n const { document, selection } = value\n const node = document[getNode](selection.startKey)\n if (!node) return\n change[method](node)\n }\n\n DIRECTIONS.forEach(direction => {\n const getDirectionNode = `get${direction}${object}`\n const directionKey = direction == 'Next' ? 'startKey' : 'endKey'\n\n Changes[`${method}${direction}${object}`] = change => {\n const { value } = change\n const { document, selection } = value\n const node = document[getNode](selection[directionKey])\n if (!node) return\n const target = document[getDirectionNode](node.key)\n if (!target) return\n change[method](target)\n }\n })\n })\n })\n})\n\n/**\n * Export.\n *\n * @type {Object}\n */\n\nexport default Changes\n","import Value from '../models/value'\n\n/**\n * Changes.\n *\n * @type {Object}\n */\n\nconst Changes = {}\n\n/**\n * Set `properties` on the value.\n *\n * @param {Change} change\n * @param {Object|Value} properties\n * @param {Object} options\n */\n\nChanges.setValue = (change, properties, options = {}) => {\n properties = Value.createProperties(properties)\n const { value } = change\n\n change.applyOperation(\n {\n type: 'set_value',\n properties,\n value,\n },\n options\n )\n}\n\n/**\n * Export.\n *\n * @type {Object}\n */\n\nexport default Changes\n","/**\n * Changes.\n *\n * @type {Object}\n */\n\nconst Changes = {}\n\n/**\n * Normalize the value with its schema.\n *\n * @param {Change} change\n */\n\nChanges.normalize = change => {\n change.normalizeDocument()\n}\n\n/**\n * Normalize the document with the value's schema.\n *\n * @param {Change} change\n */\n\nChanges.normalizeDocument = change => {\n const { value } = change\n const { document } = value\n change.normalizeNodeByKey(document.key)\n}\n\n/**\n * Normalize a `node` and its children with the value's schema.\n *\n * @param {Change} change\n * @param {Node|String} key\n */\n\nChanges.normalizeNodeByKey = (change, key) => {\n const { value } = change\n let { document, schema } = value\n const node = document.assertNode(key)\n\n normalizeNodeAndChildren(change, node, schema)\n\n document = change.value.document\n const ancestors = document.getAncestors(key)\n if (!ancestors) return\n\n ancestors.forEach(ancestor => {\n normalizeNode(change, ancestor, schema)\n })\n}\n\n/**\n * Normalize a `node` and its children with a `schema`.\n *\n * @param {Change} change\n * @param {Node} node\n * @param {Schema} schema\n */\n\nfunction normalizeNodeAndChildren(change, node, schema) {\n if (node.object == 'text') {\n normalizeNode(change, node, schema)\n return\n }\n\n let child = node.getFirstInvalidDescendant(schema)\n let path = change.value.document.getPath(node.key)\n while (node && child) {\n normalizeNodeAndChildren(change, child, schema)\n node = change.value.document.refindNode(path, node.key)\n if (!node) {\n path = []\n child = null\n } else {\n path = change.value.document.refindPath(path, node.key)\n child = node.getFirstInvalidDescendant(schema)\n }\n }\n\n // Normalize the node itself if it still exists.\n if (node) {\n normalizeNode(change, node, schema)\n }\n}\n\n/**\n * Normalize a `node` with a `schema`, but not its children.\n *\n * @param {Change} change\n * @param {Node} node\n * @param {Schema} schema\n */\n\nfunction normalizeNode(change, node, schema) {\n const max = schema.stack.plugins.length + 1\n let iterations = 0\n\n function iterate(c, n) {\n const normalize = n.validate(schema)\n if (!normalize) return\n\n // Run the `normalize` function to fix the node.\n let path = c.value.document.getPath(n.key)\n normalize(c)\n\n // Re-find the node reference, in case it was updated. If the node no longer\n // exists, we're done for this branch.\n n = c.value.document.refindNode(path, n.key)\n if (!n) return\n\n path = c.value.document.refindPath(path, n.key)\n\n // Increment the iterations counter, and check to make sure that we haven't\n // exceeded the max. Without this check, it's easy for the `validate` or\n // `normalize` function of a schema rule to be written incorrectly and for\n // an infinite invalid loop to occur.\n iterations++\n\n if (iterations > max) {\n throw new Error(\n 'A schema rule could not be validated after sufficient iterations. This is usually due to a `rule.validate` or `rule.normalize` function of a schema being incorrectly written, causing an infinite loop.'\n )\n }\n\n // Otherwise, iterate again.\n iterate(c, n)\n }\n\n iterate(change, node)\n}\n\n/**\n * Export.\n *\n * @type {Object}\n */\n\nexport default Changes\n","import AtCurrentRange from './at-current-range'\nimport AtRange from './at-range'\nimport ByKey from './by-key'\nimport OnHistory from './on-history'\nimport OnSelection from './on-selection'\nimport OnValue from './on-value'\nimport WithSchema from './with-schema'\n\n/**\n * Export.\n *\n * @type {Object}\n */\n\nexport default {\n ...AtCurrentRange,\n ...AtRange,\n ...ByKey,\n ...OnHistory,\n ...OnSelection,\n ...OnValue,\n ...WithSchema,\n}\n","import Debug from 'debug'\n\nimport Operation from '../models/operation'\n\n/**\n * Debug.\n *\n * @type {Function}\n */\n\nconst debug = Debug('slate:operation:apply')\n\n/**\n * Apply adjustments to affected ranges (selections, decorations);\n * accepts (value, checking function -> bool, applying function -> range)\n * returns value with affected ranges fixed\n *\n * @param {Value} value\n * @param {Function} checkAffected\n * @param {Function} adjustRange\n * @return {Value}\n */\n\nfunction applyRangeAdjustments(value, checkAffected, adjustRange) {\n // gather all ranges from selection, decorations\n const ranges = (value.selection ? [value.selection] : []).concat(\n value.decorations ? value.decorations.toArray() : []\n )\n if (ranges.length === 0) return\n\n for (const range of ranges) {\n if (!checkAffected(range)) continue\n const adjusted = adjustRange(range)\n\n // apply at source of this range, comparing by identity\n if (value.selection === range) {\n value = value.set('selection', adjusted)\n }\n if (value.decorations !== null) {\n // not using List.includes() since it isn't true identity check\n value.decorations.forEach((decoration, i) => {\n if (decoration === range) {\n value =\n adjusted.anchorKey === null\n ? // handle 'deselected' range\n value.set('decorations', value.decorations.delete(i))\n : value.set('decorations', value.decorations.set(i, adjusted))\n }\n })\n }\n }\n\n return value\n}\n\n/**\n * clear any atomic ranges (in decorations) if they contain the point (key, offset, offset-end?)\n * specified\n *\n * @param {Value} value\n * @param {String} key\n * @param {Number} offset\n * @param {Number?} offsetEnd\n * @return {Value}\n */\n\nfunction clearAtomicRangesIfContains(value, key, offset, offsetEnd = null) {\n return applyRangeAdjustments(\n value,\n range => {\n if (!range.atomic) return false\n const { startKey, startOffset, endKey, endOffset } = range\n return (\n (startKey == key &&\n startOffset < offset &&\n (endKey != key || endOffset > offset)) ||\n (offsetEnd &&\n startKey == key &&\n startOffset < offsetEnd &&\n (endKey != key || endOffset > offsetEnd))\n )\n },\n range => range.deselect()\n )\n}\n\n/**\n * Applying functions.\n *\n * @type {Object}\n */\n\nconst APPLIERS = {\n /**\n * Add mark to text at `offset` and `length` in node by `path`.\n *\n * @param {Value} value\n * @param {Operation} operation\n * @return {Value}\n */\n\n add_mark(value, operation) {\n const { path, offset, length, mark } = operation\n let { document } = value\n let node = document.assertPath(path)\n node = node.addMark(offset, length, mark)\n document = document.updateNode(node)\n value = value.set('document', document)\n return value\n },\n\n /**\n * Insert a `node` at `index` in a node by `path`.\n *\n * @param {Value} value\n * @param {Operation} operation\n * @return {Value}\n */\n\n insert_node(value, operation) {\n const { path, node } = operation\n const index = path[path.length - 1]\n const rest = path.slice(0, -1)\n let { document } = value\n let parent = document.assertPath(rest)\n parent = parent.insertNode(index, node)\n document = document.updateNode(parent)\n value = value.set('document', document)\n return value\n },\n\n /**\n * Insert `text` at `offset` in node by `path`.\n *\n * @param {Value} value\n * @param {Operation} operation\n * @return {Value}\n */\n\n insert_text(value, operation) {\n const { path, offset, text, marks } = operation\n let { document } = value\n let node = document.assertPath(path)\n\n // Update the document\n node = node.insertText(offset, text, marks)\n document = document.updateNode(node)\n\n value = value.set('document', document)\n\n // if insert happens within atomic ranges, clear\n value = clearAtomicRangesIfContains(value, node.key, offset)\n\n // Update the selection, decorations\n value = applyRangeAdjustments(\n value,\n ({ anchorKey, anchorOffset, isBackward, atomic }) =>\n anchorKey == node.key &&\n (anchorOffset > offset ||\n (anchorOffset == offset && (!atomic || !isBackward))),\n range => range.moveAnchor(text.length)\n )\n\n value = applyRangeAdjustments(\n value,\n ({ focusKey, focusOffset, isBackward, atomic }) =>\n focusKey == node.key &&\n (focusOffset > offset ||\n (focusOffset == offset && (!atomic || isBackward))),\n range => range.moveFocus(text.length)\n )\n\n return value\n },\n\n /**\n * Merge a node at `path` with the previous node.\n *\n * @param {Value} value\n * @param {Operation} operation\n * @return {Value}\n */\n\n merge_node(value, operation) {\n const { path } = operation\n const withPath = path\n .slice(0, path.length - 1)\n .concat([path[path.length - 1] - 1])\n let { document } = value\n const one = document.assertPath(withPath)\n const two = document.assertPath(path)\n let parent = document.getParent(one.key)\n const oneIndex = parent.nodes.indexOf(one)\n const twoIndex = parent.nodes.indexOf(two)\n\n // Perform the merge in the document.\n parent = parent.mergeNode(oneIndex, twoIndex)\n document = document.updateNode(parent)\n value = value.set('document', document)\n\n if (one.object == 'text') {\n value = applyRangeAdjustments(\n value,\n // If the nodes are text nodes and the range is inside the second node:\n ({ anchorKey, focusKey }) =>\n anchorKey == two.key || focusKey == two.key,\n // update it to refer to the first node instead:\n range => {\n if (range.anchorKey == two.key)\n range = range.moveAnchorTo(\n one.key,\n one.text.length + range.anchorOffset\n )\n if (range.focusKey == two.key)\n range = range.moveFocusTo(\n one.key,\n one.text.length + range.focusOffset\n )\n return range.normalize(document)\n }\n )\n }\n\n return value\n },\n\n /**\n * Move a node by `path` to `newPath`.\n *\n * @param {Value} value\n * @param {Operation} operation\n * @return {Value}\n */\n\n move_node(value, operation) {\n const { path, newPath } = operation\n const newIndex = newPath[newPath.length - 1]\n const newParentPath = newPath.slice(0, -1)\n const oldParentPath = path.slice(0, -1)\n const oldIndex = path[path.length - 1]\n let { document } = value\n const node = document.assertPath(path)\n\n // Remove the node from its current parent.\n let parent = document.getParent(node.key)\n parent = parent.removeNode(oldIndex)\n document = document.updateNode(parent)\n\n // Find the new target...\n let target\n\n // If the old path and the rest of the new path are the same, then the new\n // target is the old parent.\n if (\n oldParentPath.every((x, i) => x === newParentPath[i]) &&\n oldParentPath.length === newParentPath.length\n ) {\n target = parent\n } else if (\n oldParentPath.every((x, i) => x === newParentPath[i]) &&\n oldIndex < newParentPath[oldParentPath.length]\n ) {\n // Otherwise, if the old path removal resulted in the new path being no longer\n // correct, we need to decrement the new path at the old path's last index.\n newParentPath[oldParentPath.length]--\n target = document.assertPath(newParentPath)\n } else {\n // Otherwise, we can just grab the target normally...\n target = document.assertPath(newParentPath)\n }\n\n // Insert the new node to its new parent.\n target = target.insertNode(newIndex, node)\n document = document.updateNode(target)\n value = value.set('document', document)\n return value\n },\n\n /**\n * Remove mark from text at `offset` and `length` in node by `path`.\n *\n * @param {Value} value\n * @param {Operation} operation\n * @return {Value}\n */\n\n remove_mark(value, operation) {\n const { path, offset, length, mark } = operation\n let { document } = value\n let node = document.assertPath(path)\n node = node.removeMark(offset, length, mark)\n document = document.updateNode(node)\n value = value.set('document', document)\n return value\n },\n\n /**\n * Remove a node by `path`.\n *\n * @param {Value} value\n * @param {Operation} operation\n * @return {Value}\n */\n\n remove_node(value, operation) {\n const { path } = operation\n let { document, selection } = value\n const node = document.assertPath(path)\n\n if (selection.isSet || value.decorations !== null) {\n const first = node.object == 'text' ? node : node.getFirstText() || node\n const last = node.object == 'text' ? node : node.getLastText() || node\n const prev = document.getPreviousText(first.key)\n const next = document.getNextText(last.key)\n\n value = applyRangeAdjustments(\n value,\n // If the start or end point was in this node\n ({ startKey, endKey }) =>\n node.hasNode(startKey) || node.hasNode(endKey),\n // update it to be just before/after\n range => {\n const { startKey, endKey } = range\n\n if (node.hasNode(startKey)) {\n range = prev\n ? range.moveStartTo(prev.key, prev.text.length)\n : next ? range.moveStartTo(next.key, 0) : range.deselect()\n }\n if (node.hasNode(endKey)) {\n range = prev\n ? range.moveEndTo(prev.key, prev.text.length)\n : next ? range.moveEndTo(next.key, 0) : range.deselect()\n }\n // If the range wasn't deselected, normalize it.\n if (range.isSet) return range.normalize(document)\n return range\n }\n )\n }\n\n // Remove the node from the document.\n let parent = document.getParent(node.key)\n const index = parent.nodes.indexOf(node)\n parent = parent.removeNode(index)\n document = document.updateNode(parent)\n\n // Update the document and range.\n value = value.set('document', document)\n return value\n },\n\n /**\n * Remove `text` at `offset` in node by `path`.\n *\n * @param {Value} value\n * @param {Operation} operation\n * @return {Value}\n */\n\n remove_text(value, operation) {\n const { path, offset, text } = operation\n const { length } = text\n const rangeOffset = offset + length\n let { document } = value\n\n let node = document.assertPath(path)\n\n // if insert happens within atomic ranges, clear\n value = clearAtomicRangesIfContains(\n value,\n node.key,\n offset,\n offset + length\n )\n\n value = applyRangeAdjustments(\n value,\n // if anchor of range is here\n ({ anchorKey }) => anchorKey == node.key,\n // adjust if it is in or past the removal range\n range =>\n range.anchorOffset >= rangeOffset\n ? range.moveAnchor(-length)\n : range.anchorOffset > offset\n ? range.moveAnchorTo(range.anchorKey, offset)\n : range\n )\n\n value = applyRangeAdjustments(\n value,\n // if focus of range is here\n ({ focusKey }) => focusKey == node.key,\n // adjust if it is in or past the removal range\n range =>\n range.focusOffset >= rangeOffset\n ? range.moveFocus(-length)\n : range.focusOffset > offset\n ? range.moveFocusTo(range.focusKey, offset)\n : range\n )\n\n node = node.removeText(offset, length)\n document = document.updateNode(node)\n value = value.set('document', document)\n return value\n },\n\n /**\n * Set `properties` on mark on text at `offset` and `length` in node by `path`.\n *\n * @param {Value} value\n * @param {Operation} operation\n * @return {Value}\n */\n\n set_mark(value, operation) {\n const { path, offset, length, mark, properties } = operation\n let { document } = value\n let node = document.assertPath(path)\n node = node.updateMark(offset, length, mark, properties)\n document = document.updateNode(node)\n value = value.set('document', document)\n return value\n },\n\n /**\n * Set `properties` on a node by `path`.\n *\n * @param {Value} value\n * @param {Operation} operation\n * @return {Value}\n */\n\n set_node(value, operation) {\n const { path, properties } = operation\n let { document } = value\n let node = document.assertPath(path)\n node = node.merge(properties)\n document = document.updateNode(node)\n value = value.set('document', document)\n return value\n },\n\n /**\n * Set `properties` on the selection.\n *\n * @param {Value} value\n * @param {Operation} operation\n * @return {Value}\n */\n\n set_selection(value, operation) {\n const { properties } = operation\n const { anchorPath, focusPath, ...props } = properties\n let { document, selection } = value\n\n if (anchorPath !== undefined) {\n props.anchorKey =\n anchorPath === null ? null : document.assertPath(anchorPath).key\n }\n\n if (focusPath !== undefined) {\n props.focusKey =\n focusPath === null ? null : document.assertPath(focusPath).key\n }\n\n selection = selection.merge(props)\n selection = selection.normalize(document)\n value = value.set('selection', selection)\n return value\n },\n\n /**\n * Set `properties` on `value`.\n *\n * @param {Value} value\n * @param {Operation} operation\n * @return {Value}\n */\n\n set_value(value, operation) {\n const { properties } = operation\n value = value.merge(properties)\n return value\n },\n\n /**\n * Split a node by `path` at `offset`.\n *\n * @param {Value} value\n * @param {Operation} operation\n * @return {Value}\n */\n\n split_node(value, operation) {\n const { path, position, properties } = operation\n let { document } = value\n\n // Calculate a few things...\n const node = document.assertPath(path)\n let parent = document.getParent(node.key)\n const index = parent.nodes.indexOf(node)\n\n // Split the node by its parent.\n parent = parent.splitNode(index, position)\n if (properties) {\n const splitNode = parent.nodes.get(index + 1)\n if (splitNode.object !== 'text') {\n parent = parent.updateNode(splitNode.merge(properties))\n }\n }\n document = document.updateNode(parent)\n const next = document.getNextText(node.key)\n\n value = applyRangeAdjustments(\n value,\n // check if range is affected\n ({ startKey, startOffset, endKey, endOffset }) =>\n (node.key == startKey && position <= startOffset) ||\n (node.key == endKey && position <= endOffset),\n // update its start / end as needed\n range => {\n const { startKey, startOffset, endKey, endOffset } = range\n let normalize = false\n\n if (node.key == startKey && position <= startOffset) {\n range = range.moveStartTo(next.key, startOffset - position)\n normalize = true\n }\n\n if (node.key == endKey && position <= endOffset) {\n range = range.moveEndTo(next.key, endOffset - position)\n normalize = true\n }\n\n // Normalize the selection if we changed it\n if (normalize) return range.normalize(document)\n return range\n }\n )\n\n // Return the updated value.\n value = value.set('document', document)\n return value\n },\n}\n\n/**\n * Apply an `operation` to a `value`.\n *\n * @param {Value} value\n * @param {Object|Operation} operation\n * @return {Value} value\n */\n\nfunction applyOperation(value, operation) {\n operation = Operation.create(operation)\n const { type } = operation\n const apply = APPLIERS[type]\n\n if (!apply) {\n throw new Error(`Unknown operation type: \"${type}\".`)\n }\n\n debug(type, operation)\n value = apply(value, operation)\n return value\n}\n\n/**\n * Export.\n *\n * @type {Function}\n */\n\nexport default applyOperation\n","import Debug from 'debug'\nimport isPlainObject from 'is-plain-object'\nimport logger from 'slate-dev-logger'\nimport pick from 'lodash/pick'\nimport { List } from 'immutable'\n\nimport MODEL_TYPES from '../constants/model-types'\nimport Changes from '../changes'\nimport Operation from './operation'\nimport apply from '../operations/apply'\n\n/**\n * Debug.\n *\n * @type {Function}\n */\n\nconst debug = Debug('slate:change')\n\n/**\n * Change.\n *\n * @type {Change}\n */\n\nclass Change {\n /**\n * Check if `any` is a `Change`.\n *\n * @param {Any} any\n * @return {Boolean}\n */\n\n static isChange(any) {\n return !!(any && any[MODEL_TYPES.CHANGE])\n }\n\n /**\n * Create a new `Change` with `attrs`.\n *\n * @param {Object} attrs\n * @property {Value} value\n */\n\n constructor(attrs) {\n const { value } = attrs\n this.value = value\n this.operations = new List()\n this.flags = {\n normalize: true,\n ...pick(attrs, ['merge', 'save', 'normalize']),\n }\n }\n\n /**\n * Object.\n *\n * @return {String}\n */\n\n get object() {\n return 'change'\n }\n\n get kind() {\n logger.deprecate(\n 'slate@0.32.0',\n 'The `kind` property of Slate objects has been renamed to `object`.'\n )\n return this.object\n }\n\n /**\n * Apply an `operation` to the current value, saving the operation to the\n * history if needed.\n *\n * @param {Operation|Object} operation\n * @param {Object} options\n * @return {Change}\n */\n\n applyOperation(operation, options = {}) {\n const { operations, flags } = this\n let { value } = this\n let { history } = value\n\n // Add in the current `value` in case the operation was serialized.\n if (isPlainObject(operation)) {\n operation = { ...operation, value }\n }\n\n operation = Operation.create(operation)\n\n // Default options to the change-level flags, this allows for setting\n // specific options for all of the operations of a given change.\n options = { ...flags, ...options }\n\n // Derive the default option values.\n const {\n merge = operations.size == 0 ? null : true,\n save = true,\n skip = null,\n } = options\n\n // Apply the operation to the value.\n debug('apply', { operation, save, merge })\n value = apply(value, operation)\n\n // If needed, save the operation to the history.\n if (history && save) {\n history = history.save(operation, { merge, skip })\n value = value.set('history', history)\n }\n\n // Update the mutable change object.\n this.value = value\n this.operations = operations.push(operation)\n return this\n }\n\n /**\n * Apply a series of `operations` to the current value.\n *\n * @param {Array|List} operations\n * @param {Object} options\n * @return {Change}\n */\n\n applyOperations(operations, options) {\n operations.forEach(op => this.applyOperation(op, options))\n return this\n }\n\n /**\n * Call a change `fn` with arguments.\n *\n * @param {Function} fn\n * @param {Mixed} ...args\n * @return {Change}\n */\n\n call(fn, ...args) {\n fn(this, ...args)\n return this\n }\n\n /**\n * Applies a series of change mutations and defers normalization until the end.\n *\n * @param {Function} customChange - function that accepts a change object and executes change operations\n * @return {Change}\n */\n\n withoutNormalization(customChange) {\n const original = this.flags.normalize\n this.setOperationFlag('normalize', false)\n try {\n customChange(this)\n // if the change function worked then run normalization\n this.normalizeDocument()\n } finally {\n // restore the flag to whatever it was\n this.setOperationFlag('normalize', original)\n }\n return this\n }\n\n /**\n * Set an operation flag by `key` to `value`.\n *\n * @param {String} key\n * @param {Any} value\n * @return {Change}\n */\n\n setOperationFlag(key, value) {\n this.flags[key] = value\n return this\n }\n\n /**\n * Get the `value` of the specified flag by its `key`. Optionally accepts an `options`\n * object with override flags.\n *\n * @param {String} key\n * @param {Object} options\n * @return {Change}\n */\n\n getFlag(key, options = {}) {\n return options[key] !== undefined ? options[key] : this.flags[key]\n }\n\n /**\n * Unset an operation flag by `key`.\n *\n * @param {String} key\n * @return {Change}\n */\n\n unsetOperationFlag(key) {\n delete this.flags[key]\n return this\n }\n}\n\n/**\n * Attach a pseudo-symbol for type checking.\n */\n\nChange.prototype[MODEL_TYPES.CHANGE] = true\n\n/**\n * Add a change method for each of the changes.\n */\n\nObject.keys(Changes).forEach(type => {\n Change.prototype[type] = function(...args) {\n debug(type, { args })\n this.call(Changes[type], ...args)\n return this\n }\n})\n\n/**\n * Export.\n *\n * @type {Change}\n */\n\nexport default Change\n","import apply from './apply'\nimport invert from './invert'\n\n/**\n * Export.\n *\n * @type {Object}\n */\n\nexport default {\n apply,\n invert,\n}\n","import Block from './models/block'\nimport Change from './models/change'\nimport Changes from './changes'\nimport Character from './models/character'\nimport Data from './models/data'\nimport Document from './models/document'\nimport History from './models/history'\nimport Inline from './models/inline'\nimport Leaf from './models/leaf'\nimport Mark from './models/mark'\nimport Node from './models/node'\nimport Operation from './models/operation'\nimport Operations from './operations'\nimport Range from './models/range'\nimport Schema from './models/schema'\nimport Stack from './models/stack'\nimport Text from './models/text'\nimport Value from './models/value'\nimport { resetKeyGenerator, setKeyGenerator } from './utils/generate-key'\nimport { resetMemoization, useMemoization } from './utils/memoize'\n\n/**\n * Export.\n *\n * @type {Object}\n */\n\nexport {\n Block,\n Change,\n Changes,\n Character,\n Data,\n Document,\n History,\n Inline,\n Leaf,\n Mark,\n Node,\n Operation,\n Operations,\n Range,\n Schema,\n Stack,\n Text,\n Value,\n resetKeyGenerator,\n setKeyGenerator,\n resetMemoization,\n useMemoization,\n}\n\nexport default {\n Block,\n Changes,\n Character,\n Data,\n Document,\n History,\n Inline,\n Leaf,\n Mark,\n Node,\n Operation,\n Operations,\n Range,\n Schema,\n Stack,\n Text,\n Value,\n resetKeyGenerator,\n setKeyGenerator,\n resetMemoization,\n useMemoization,\n}\n"],"names":["Data","attrs","Map","isMap","isPlainObject","fromJSON","Error","object","fromJS","MODEL_TYPES","ENABLED","CACHE_KEY","LEAF","UNDEFINED","UNSET","undefined","memoize","properties","property","original","args","apply","__cache_key","__cache","__cache_no_args","takesArguments","length","cachedValue","keys","getIn","value","v","setIn","map","key","get","parent","child","set","resetMemoization","Number","MAX_SAFE_INTEGER","useMemoization","enabled","DEFAULTS","Mark","schema","__getComponent","type","data","toJSON","deprecate","isMark","elements","Set","isSet","Array","isArray","marks","create","props","mark","any","MARK","every","item","Record","prototype","Range","node","anchorOffset","first","getFirst","anchorKey","last","getLast","text","start","end","hasAnchorIn","hasDescendant","focusKey","focusOffset","hasFocusIn","isCollapsed","hasAnchorAtStartOf","hasAnchorAtEndOf","merge","isBackward","n","offset","moveAnchorOffsetTo","moveFocusOffsetTo","moveFocusTo","moveAnchorTo","range","flip","moveAnchorToStartOf","moveFocusToEndOf","anchorOffsetType","focusOffsetType","warn","anchorNode","getDescendant","focusNode","getFirstText","anchorText","getTextAtOffset","getOffset","focusText","areDescendantsSorted","isFocused","toArray","m","atomic","isRange","List","isList","list","anchorPath","focusPath","createSet","obj","RANGE","MOVE_METHODS","forEach","p","s","EDGE_METHODS","hasEdge","anchor","focus","ALIAS_METHODS","alias","method","getLastText","Character","isCharacter","split","character","CHARACTER","Leaf","characters","createList","char","isLeaf","leaf","generate","generateKey","setKeyGenerator","func","resetKeyGenerator","Text","index","addMarks","i","union","decorations","size","startKey","endKey","startOffset","endOffset","hasStart","hasEnd","__getDecorations","getDecoratedCharacters","leaves","prevChar","prevLeaf","push","prevMarks","isSame","is","array","getMarksAsArray","OrderedSet","reduce","concat","getNode","chars","slice","remove","filterNot","options","getLeaves","r","preserveKeys","newMark","has","add","validateNode","validate","string","isText","l","getCharacters","TEXT","isIndexInRange","Node","second","assertKey","getKeysAsArray","firstIndex","indexOf","secondIndex","getChild","descendant","path","getDescendantAtPath","iterator","matches","forEachDescendant","nodes","found","ret","hasChild","ancestors","find","getAncestors","unshift","getBlocksAsArray","isLeafBlock","getBlocksAtRangeAsArray","normalize","isUnset","startBlock","getClosestBlock","endBlock","blocks","getBlocksByTypeAsArray","getCharactersAsArray","arr","getCharactersAtRangeAsArray","getTextsAtRange","filter","rest","findLast","getClosest","isVoid","one","two","assertDescendant","oneParent","getParent","twoParent","includes","stack","startAt","getFurthestAncestor","getDepth","descendantFound","Document","startText","endText","previous","position","splitNode","updateNode","getNextText","startNode","getNextSibling","endNode","startIndex","endIndex","getFurthest","result","shift","reverse","takeUntil","getInlinesAsArray","isLeafInline","getInlinesAtRangeAsArray","getTextsAtRangeAsArray","getClosestInline","exists","getInlinesByTypeAsArray","inlines","desc","getMarksAtRangeAsArray","getInsertMarksAtRangeAsArray","getActiveMarksAtRangeAsArray","getMarksAtCollapsedRangeAsArray","getCharactersAtRange","memo","c","getPreviousText","intersect","getMarksByTypeAsArray","block","next","after","skipUntil","getTexts","isExpanded","assertNode","ancestor","getPath","__getPlaceholder","before","isSelected","isBlurred","dir","direction","getTextsAsArray","texts","getClosestVoid","regenerateKey","mapDescendants","insert","withIndex","removeNode","insertNode","findIndex","splice","befores","take","afters","skip","getFirstInvalidDescendant","isNode","kind","Block","Inline","isBlock","isInline","isDocument","arg","some","isEmpty","getText","inline","INLINE","Object","getOwnPropertyNames","document","DOCUMENT","BLOCK","Changes","PROXY_TRANSFORMS","change","selection","methodAtRange","setBlock","setBlocks","setInline","setInlines","addMark","addMarkAtRange","sel","select","getActiveMarksAtRange","delete","deleteAtRange","collapseToStart","insertBlock","insertBlockAtRange","collapseToEndOf","insertFragment","fragment","startInline","lastText","lastInline","isAppending","hasEdgeAtStartOf","hasEdgeAtEndOf","insertFragmentAtRange","newTexts","newText","takeLast","collapseToStartOf","move","insertInline","insertInlineAtRange","insertText","getInsertMarksAtRange","insertTextAtRange","splitBlock","depth","splitBlockAtRange","collapseToEnd","removeMark","removeMarkAtRange","toggleMark","activeMarks","wrapText","prefix","suffix","wrapTextAtRange","moveStart","moveEnd","isForward","SURROGATE_START","SURROGATE_END","SPACE","CHAMELEON","PUNCTUATION","isSurrogate","code","isWord","remaining","test","charAt","getCharLength","charCodeAt","getCharOffset","getCharOffsetBackward","getCharOffsetForward","getWordOffset","started","getWordOffsetBackward","o","getWordOffsetForward","getFlag","addMarkByKey","addMarksAtRange","snapshotSelection","isStartVoid","hasVoidParent","isEndVoid","isHanging","prevText","startVoid","nextText","removeNodeByKey","endVoid","removeTextByKey","startLength","endLength","getCommonAncestor","startChild","endChild","startParent","startParentIndex","endParentIndex","startChildIndex","endChildIndex","middles","lonely","getFurthestOnlyChildAncestor","moveNodeByKey","mergeNodeByKey","normalizeNodeByKey","deleteCharBackwardAtRange","String","deleteBackwardAtRange","deleteLineBackwardAtRange","deleteWordBackwardAtRange","voidParent","isAtStartOf","prev","prevBlock","prevVoid","traversed","deleteCharForwardAtRange","deleteForwardAtRange","deleteLineForwardAtRange","deleteWordForwardAtRange","nextBlock","getNextBlock","moveToStartOf","isAtEndOf","nextVoid","extra","insertNodeByKey","splitDescendantsByKey","isAtStart","getBlocks","firstBlock","lastBlock","lonelyParent","lonelyChild","removeDescendant","newIndex","nextChild","nextNodes","lastIndex","inlineChild","inlineIndex","splitNodeByKey","insertTextByKey","commonAncestor","normalizeAncestor","removeMarkByKey","setBlocksAtRange","getBlocksAtRange","sets","setNodeByKey","setBlockAtRange","setInlinesAtRange","getInlinesAtRange","setInlineAtRange","height","h","splitInlineAtRange","Infinity","toggleMarkAtRange","equals","unwrapBlockAtRange","createProperties","wrappers","isSuperset","toOrderedSet","toList","children","b","firstMatch","lastMatch","firstText","normalizeDocument","unwrapInlineAtRange","wrapBlockAtRange","clear","firstblock","lastblock","siblings","p1","p2","indexes","ind","wrapInlineAtRange","inlineParent","wrapInlineByKey","startInner","startInnerIndex","endInner","startInlines","endInlines","operations","bx","by","ax","ay","Math","max","min","applyOperations","insertFragmentByKey","applyOperation","getMarksAtIndex","getPreviousSibling","newKey","newPath","removeAllMarksByKey","state","removals","replaceNodeByKey","newNode","setMarkByKey","target","textKey","textOffset","a","prevIndex","unwrapInlineByKey","moveToRangeOf","unwrapBlockByKey","unwrapNodeByKey","isFirst","isLast","parentParent","parentIndex","wrapBlockByKey","wrapNodeByKey","OPERATION_ATTRIBUTES","debug","Debug","Stack","History","operation","history","undos","redos","prevBatch","peek","prevOperation","shouldSkip","shouldMerge","batch","pop","isHistory","HISTORY","isEqual","CORE_SCHEMA_RULES","invalids","objects","insertBefore","insertAfter","Boolean","plugins","plugin","getPluginsWith","STACK","Schema","parents","rule","violation","context","CHILD_OBJECT_INVALID","CHILD_TYPE_INVALID","CHILD_UNKNOWN","FIRST_CHILD_OBJECT_INVALID","FIRST_CHILD_TYPE_INVALID","LAST_CHILD_OBJECT_INVALID","LAST_CHILD_TYPE_INVALID","CHILD_REQUIRED","NODE_TEXT_INVALID","PARENT_OBJECT_INVALID","PARENT_TYPE_INVALID","NODE_DATA_INVALID","NODE_IS_VOID_INVALID","NODE_MARK_INVALID","t","getRule","getParentRules","ctx","fail","fn","getMarks","def","types","nextDef","defs","rewind","isSchema","rules","resolveSchema","SCHEMA","d","resolveDocumentRule","bs","resolveNodeRule","customizer","source","Value","Change","preserveData","preserveDecorations","preserveHistory","preserveSelection","preserveSchema","withPath","decoration","getPreviousBlock","getNextInline","getPreviousInline","getMarksAtRange","getFragmentAtRange","isValue","save","VALUE","Operation","json","ATTRIBUTES","toJS","isOperation","OPERATION","invertOperation","op","inverse","inversePath","inverseNewPath","pathLast","newPathLast","e","inverseNode","inverseProperties","pick","inverseMark","assertPath","inverseSelection","inverseProps","inverseValue","redo","omit","undo","invert","snapshot","k","moved","hasOwnProperty","selectAll","moveAnchorCharBackward","anchorBlock","previousText","isInVoid","isPreviousInVoid","moveAnchor","moveAnchorToEndOf","hasNode","moveAnchorCharForward","isNextInVoid","moveFocusCharBackward","focusBlock","moveFocus","moveFocusCharForward","moveFocusToStartOf","MOVE_DIRECTIONS","collapse","PREFIXES","DIRECTIONS","OBJECTS","edges","edge","getDirectionNode","directionKey","setValue","normalizeNodeAndChildren","refindNode","refindPath","normalizeNode","iterations","iterate","AtCurrentRange","AtRange","ByKey","OnHistory","OnSelection","OnValue","WithSchema","applyRangeAdjustments","checkAffected","adjustRange","ranges","adjusted","clearAtomicRangesIfContains","offsetEnd","deselect","APPLIERS","oneIndex","twoIndex","mergeNode","newParentPath","oldParentPath","oldIndex","x","moveStartTo","moveEndTo","rangeOffset","removeText","updateMark","CHANGE","flags","customChange","setOperationFlag","call"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;;;;;;;;IASMA;;;;;;;;;;;;;;;6BAQsB;UAAZC,KAAY,uEAAJ,EAAI;;UACpBC,cAAIC,KAAJ,CAAUF,KAAV,CAAJ,EAAsB;eACbA,KAAP;;;UAGEG,cAAcH,KAAd,CAAJ,EAA0B;eACjBD,KAAKK,QAAL,CAAcJ,KAAd,CAAP;;;YAGI,IAAIK,KAAJ,qEACgEL,KADhE,CAAN;;;;;;;;;;;;6BAYcM,QAAQ;aACf,IAAIL,aAAJ,CAAQK,MAAR,CAAP;;;;;;;;;;;;;;;;;AA9BEP,KAqCGQ,SAASR,KAAKK;;ACjDvB;;;;;;AAMA,IAAMI,cAAc;SACX,qBADW;UAEV,sBAFU;aAGP,yBAHO;YAIR,wBAJQ;WAKT,uBALS;UAMV,sBANU;QAOZ,oBAPY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