Overview
The Sync component syncs the change of the editor with other component.
Properties
lines
get
Returns the latest Lines instance.
This is an alias of Code#Lines
.
i18n
get
Returns the i18n collection.
This is an alias of this.options.i18n
.
Methods
sync()
sync( startRow: number, endRow: number, jumpTo?: number ): void
Syncs changes between the start and end rows to other components.
Consider the following HTML as an example:
<pre> function message() { console.log( 'Hi!' ); } </pre>
Let's attempt to modify the line 2 (the row index is 1
):
const ryuseiCode = new RyuseiCode(); ryuseiCode.apply( 'pre' ); const { Code, Sync } = ryuseiCode.Editor.Components; // Only the Code component knows the change Code.replaceLines( 1, 1, ` console.warn( 'error' );\n` ); // Syncs the change to other components Sync.sync( 1, 1 );
Params
startRow | A start row index. |
---|---|
endRow | An end row index. |
jumpTo | Optional. Jumps to the specified row before starting synchronization. |