UNPKG

json-joy

Version:

Collection of libraries for building collaborative editing apps.

21 lines (20 loc) 727 B
import { Anchor } from '../rga/constants'; import { PersistedSlice } from './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. */ export class MarkerSlice extends 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 = Anchor.After; return this.txt.range(start, end); } }