mirror of
https://github.com/codex-team/editor.js
synced 2024-06-03 14:32:33 +02:00
75dbc91f53
* Api shorthands closes #612 * Remove docs about events * Update embed submodule * Update example
66 lines
1.6 KiB
TypeScript
66 lines
1.6 KiB
TypeScript
/**
|
|
* Describes Editor`s caret API
|
|
*/
|
|
export interface Caret {
|
|
|
|
/**
|
|
* Sets caret to the first Block
|
|
*
|
|
* @param {string} position - position where to set caret
|
|
* @param {number} offset - caret offset
|
|
*
|
|
* @return {boolean}
|
|
*/
|
|
setToFirstBlock(position?: 'end'|'start'|'default', offset?: number): boolean;
|
|
|
|
/**
|
|
* Sets caret to the last Block
|
|
*
|
|
* @param {string} position - position where to set caret
|
|
* @param {number} offset - caret offset
|
|
*
|
|
* @return {boolean}
|
|
*/
|
|
setToLastBlock(position?: 'end'|'start'|'default', offset?: number): boolean;
|
|
|
|
/**
|
|
* Sets caret to the previous Block
|
|
*
|
|
* @param {string} position - position where to set caret
|
|
* @param {number} offset - caret offset
|
|
*
|
|
* @return {boolean}
|
|
*/
|
|
setToPreviousBlock(position?: 'end'|'start'|'default', offset?: number): boolean;
|
|
|
|
/**
|
|
* Sets caret to the next Block
|
|
*
|
|
* @param {string} position - position where to set caret
|
|
* @param {number} offset - caret offset
|
|
*
|
|
* @return {boolean}
|
|
*/
|
|
setToNextBlock(position?: 'end'|'start'|'default', offset?: number): boolean;
|
|
|
|
/**
|
|
* Sets caret to the Block by passed index
|
|
*
|
|
* @param {number} index - index of Block where to set caret
|
|
* @param {string} position - position where to set caret
|
|
* @param {number} offset - caret offset
|
|
*
|
|
* @return {boolean}
|
|
*/
|
|
setToBlock(index: number, position?: 'end'|'start'|'default', offset?: number): boolean;
|
|
|
|
/**
|
|
* Sets caret to the Editor
|
|
*
|
|
* @param {boolean} atEnd - if true, set Caret to the end of the Editor
|
|
*
|
|
* @return {boolean}
|
|
*/
|
|
focus(atEnd?: boolean): boolean;
|
|
}
|