Skip to main content
Version: v1

ISharedString Interface

Fluid object interface describing access methods on a SharedString

Signature​

export interface ISharedString extends SharedSegmentSequence<SharedStringSegment>

Extends: SharedSegmentSequence<SharedStringSegment

Methods​

MethodReturn TypeDescription
insertMarker(pos, refType, props)IMergeTreeInsertMsgInserts a marker at the position.
insertText(pos, text, props)voidInserts the text at the position.
posFromRelativePos(relativePos)numberGiven a position specified relative to a marker id, lookup the marker and convert the position to a character position.

Method Details​

insertMarker​

Inserts a marker at the position.

Signature​

insertMarker(pos: number, refType: ReferenceType, props?: PropertySet): IMergeTreeInsertMsg;

Parameters​

ParameterModifiersTypeDescription
posnumberThe position to insert the marker at
refTypeReferenceTypeThe reference type of the marker
propsoptionalPropertySetThe properties of the marker

Returns​

Return type: IMergeTreeInsertMsg

insertText​

Inserts the text at the position.

Signature​

insertText(pos: number, text: string, props?: PropertySet): void;

Parameters​

ParameterModifiersTypeDescription
posnumberThe position to insert the text at
textstringThe text to insert
propsoptionalPropertySetThe properties of the text

posFromRelativePos​

Given a position specified relative to a marker id, lookup the marker and convert the position to a character position.

Signature​

posFromRelativePos(relativePos: IRelativePosition): number;

Parameters​

ParameterTypeDescription
relativePosIRelativePositionId of marker (may be indirect) and whether position is before or after marker.

Returns​

Return type: number