json-joy
Version:
Collection of libraries for building collaborative editing apps.
25 lines (24 loc) • 900 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.MarkerSlice = void 0;
const constants_1 = require("../rga/constants");
const PersistedSlice_1 = require("./PersistedSlice");
/**
* Represents a block split in the text, i.e. it is a *marker* that shows
* where a block was split. Markers also insert one "\n" new line character.
* Both marker ends are attached to the "before" anchor fo the "\n" new line
* character, i.e. it is *collapsed* to the "before" anchor.
*/
class MarkerSlice extends PersistedSlice_1.PersistedSlice {
/**
* Returns the {@link Range} which exactly contains the block boundary of this
* marker.
*/
boundary() {
const start = this.start;
const end = start.clone();
end.anchor = constants_1.Anchor.After;
return this.txt.range(start, end);
}
}
exports.MarkerSlice = MarkerSlice;
;