2018-11-23 17:11:50 +01:00
|
|
|
import {OutputData} from '../data-formats/output-data';
|
2019-07-01 13:10:30 +02:00
|
|
|
import {BlockToolData, ToolConfig} from "../tools";
|
2018-11-23 17:11:50 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Describes methods to manipulate with Editor`s blocks
|
|
|
|
*/
|
|
|
|
export interface Blocks {
|
|
|
|
/**
|
|
|
|
* Remove all blocks from Editor zone
|
|
|
|
*/
|
|
|
|
clear(): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Render passed data
|
|
|
|
* @param {OutputData} data
|
|
|
|
* @return {Promise<void>}
|
|
|
|
*/
|
|
|
|
render(data: OutputData): Promise<void>;
|
|
|
|
|
2019-03-18 21:59:40 +01:00
|
|
|
/**
|
|
|
|
* Render passed HTML string
|
|
|
|
* @param {string} data
|
|
|
|
* @return {Promise<void>}
|
|
|
|
*/
|
|
|
|
renderFromHTML(data: string): Promise<void>;
|
|
|
|
|
2018-11-23 17:11:50 +01:00
|
|
|
/**
|
|
|
|
* Removes current Block
|
|
|
|
*/
|
|
|
|
delete(): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Swaps two Blocks
|
|
|
|
* @param {number} fromIndex - block to swap
|
|
|
|
* @param {number} toIndex - block to swap with
|
|
|
|
*/
|
|
|
|
swap(fromIndex: number, toIndex: number): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns Block holder by Block index
|
|
|
|
* @param {number} index
|
|
|
|
* @returns {HTMLElement}
|
|
|
|
*/
|
|
|
|
getBlockByIndex(index: number): HTMLElement;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns current Block index
|
|
|
|
* @returns {number}
|
|
|
|
*/
|
|
|
|
getCurrentBlockIndex(): number;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Mark Block as stretched
|
|
|
|
* @param {number} index - Block to mark
|
|
|
|
* @param {boolean} status - stretch status
|
|
|
|
*/
|
|
|
|
stretchBlock(index: number, status?: boolean): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns Blocks count
|
|
|
|
* @return {number}
|
|
|
|
*/
|
|
|
|
getBlocksCount(): number;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Insert new Initial Block after current Block
|
2019-07-01 13:10:30 +02:00
|
|
|
*
|
|
|
|
* @deprecated
|
2018-11-23 17:11:50 +01:00
|
|
|
*/
|
|
|
|
insertNewBlock(): void;
|
2019-07-01 13:10:30 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Insert new Block
|
|
|
|
*
|
|
|
|
* @param {string} type — Tool name
|
|
|
|
* @param {BlockToolData} data — Tool data to insert
|
|
|
|
* @param {ToolConfig} config — Tool config
|
|
|
|
* @param {number?} index — index where to insert new Block
|
|
|
|
* @param {boolean?} needToFocus - flag to focus inserted Block
|
|
|
|
*/
|
|
|
|
insert(
|
|
|
|
type?: string,
|
|
|
|
data?: BlockToolData,
|
|
|
|
config?: ToolConfig,
|
|
|
|
index?: number,
|
|
|
|
needToFocus?: boolean,
|
|
|
|
): void;
|
|
|
|
|
2018-11-23 17:11:50 +01:00
|
|
|
}
|