diff --git a/docs/reference/slate/range.md b/docs/reference/slate/range.md index 942f91059..02cfcd9a2 100644 --- a/docs/reference/slate/range.md +++ b/docs/reference/slate/range.md @@ -16,7 +16,9 @@ Often times, you don't need to specifically know which point is the "anchor" and Range({ anchor: Point, focus: Point, + isAtomic: Boolean, isFocused: Boolean, + marks: Set, }) ``` @@ -32,12 +34,24 @@ The range's anchor point. The range's focus point. +### `isAtomic` + +`Boolean` + +Whether the range is atomic (for decorations only). + ### `isFocused` `Boolean` Whether the range currently has focus. +### `marks` + +`Set` + +A set of marks associated with the range. + ### `object` `String` @@ -210,6 +224,24 @@ Return a new range with a new `end` point. Return a new range with a new `focus` point. +### `setIsAtomic` + +`setIsAtomic(isAtomic: Boolean) => Range` + +Return a new range with a new `isAtomic` value. + +### `setIsFocused` + +`setIsFocused(isFocused: Boolean) => Range` + +Return a new range with a new `isFocused` value. + +### `setMarks` + +`setMarks(marks: Set|Null) => Range` + +Return a new range with a new set of `marks`. + ### `setProperties` `setProperties(properties: Object|Range) => Range` diff --git a/packages/slate/src/models/range.js b/packages/slate/src/models/range.js index 495f2269d..963a68855 100644 --- a/packages/slate/src/models/range.js +++ b/packages/slate/src/models/range.js @@ -763,6 +763,18 @@ class Range extends Record(DEFAULTS) { return range } + /** + * Set the `isAtomic` property to a new `value`. + * + * @param {Boolean} value + * @return {Range} + */ + + setIsAtomic(value) { + const range = this.set('isAtomic', value) + return range + } + /** * Set the `isFocused` property to a new `value`. * @@ -775,6 +787,18 @@ class Range extends Record(DEFAULTS) { return range } + /** + * Set the `marks` property to a new set of `marks`. + * + * @param {Set} marks + * @return {Range} + */ + + setMarks(marks) { + const range = this.set('marks', marks) + return range + } + /** * Set the anchor and focus points to new `values`. *