1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-26 16:44:22 +02:00

update setters and docs

This commit is contained in:
Ian Storm Taylor
2018-08-03 15:08:20 -07:00
parent f6065e9eb8
commit d2f6e06a66
2 changed files with 56 additions and 0 deletions

View File

@@ -16,7 +16,9 @@ Often times, you don't need to specifically know which point is the "anchor" and
Range({ Range({
anchor: Point, anchor: Point,
focus: Point, focus: Point,
isAtomic: Boolean,
isFocused: Boolean, isFocused: Boolean,
marks: Set,
}) })
``` ```
@@ -32,12 +34,24 @@ The range's anchor point.
The range's focus point. The range's focus point.
### `isAtomic`
`Boolean`
Whether the range is atomic (for decorations only).
### `isFocused` ### `isFocused`
`Boolean` `Boolean`
Whether the range currently has focus. Whether the range currently has focus.
### `marks`
`Set`
A set of marks associated with the range.
### `object` ### `object`
`String` `String`
@@ -210,6 +224,24 @@ Return a new range with a new `end` point.
Return a new range with a new `focus` 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`
`setProperties(properties: Object|Range) => Range` `setProperties(properties: Object|Range) => Range`

View File

@@ -763,6 +763,18 @@ class Range extends Record(DEFAULTS) {
return range 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`. * Set the `isFocused` property to a new `value`.
* *
@@ -775,6 +787,18 @@ class Range extends Record(DEFAULTS) {
return range 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`. * Set the anchor and focus points to new `values`.
* *