A new Event will be added to the RealTimeString class.
export class StringSpliceEvent implements IValueChangedEvent {
public static readonly NAME = "splice";
public readonly element: ObservableString;
public readonly user: DomainUser;
public readonly sessionId: string;
public readonly local: boolean;
public readonly index: number;
public readonly deleteCount: number;
public readonly insertValue: string;
}
The current insert and remove events will ultimately be updated to use the underlying splice mechanism, and those two previous methods will simply be convenience methods.
However, the current StringInsertEvent and StringRemove events will sill be kept. The following rules will be used to determine which event is emitted:
If the splice has a deleteCount == 0 and non-empty insertValue emit a StringInsertEvent
If the splice has a deleteCount > 0 and no insertValue emit a StringRemoveEvent
If the splice has a deleteCount > 0 and non-empty insertValue emit a StringSpliceEvent
Tasks
[x] Updated the protocol to remove the String Insert and String Remove operations in favor of the String Splice
[x] Updated the server code to switch to using only the StringSplice operations
[x] Updated the server transformation functions to handle splices instead of removes and inserts
[x] Updated the server unit tests
[x] Updated the ot-tf spec on server
[x] Create schema version 3.0 that removes insert and remove operations and creates a splice operation
[x] Create deltas between schema version 2.0 and 3.0
[x] Test schema migration
[x] Update client to apply splice operations instead of insert and remove
[x] Refactor current string insert and remove methods to use splice under the hood
[x] Update transformation functions.
[x] Update transformation functions unit tests
[x] Updated the ot-tf spec on client
[x] Update event emission on RealTimeString
[x] Update documentation
Is there a workaround in the absence of this feature?
At present time the user must do a batch operation consisting of a remove and an insert.
Versions
Description The RealTimeString class will be augmented with a
splice
method that will allow for easy, atomic, replacements of segments of a string.A few examples illustrating the feature:
A new Event will be added to the
RealTimeString
class.The current insert and remove events will ultimately be updated to use the underlying splice mechanism, and those two previous methods will simply be convenience methods.
However, the current StringInsertEvent and StringRemove events will sill be kept. The following rules will be used to determine which event is emitted:
StringInsertEvent
StringRemoveEvent
StringSpliceEvent
Tasks
Is there a workaround in the absence of this feature? At present time the user must do a batch operation consisting of a remove and an insert.