improve types
This commit is contained in:
parent
8139aeb073
commit
51f0f5718a
15 changed files with 196 additions and 186 deletions
|
@ -15,16 +15,17 @@ limitations under the License.
|
|||
*/
|
||||
|
||||
import EditorModel from "./model";
|
||||
import DocumentPosition from "./position";
|
||||
|
||||
export default class DocumentOffset {
|
||||
constructor(public offset: number, public readonly atNodeEnd: boolean) {
|
||||
}
|
||||
|
||||
asPosition(model: EditorModel) {
|
||||
public asPosition(model: EditorModel): DocumentPosition {
|
||||
return model.positionForOffset(this.offset, this.atNodeEnd);
|
||||
}
|
||||
|
||||
add(delta: number, atNodeEnd = false) {
|
||||
public add(delta: number, atNodeEnd = false): DocumentOffset {
|
||||
return new DocumentOffset(this.offset + delta, atNodeEnd);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue