2.4 KiB
2.4 KiB
InlineModel
Edit related operations of in-line nodes
Type: InlineModelInterface
Use
new Engine(...).inline
Constructor
new (editor: EditorInterface): InlineModelInterface
Method
init
initialization
/**
* Initialization
*/
init(): void;
closest
Get the nearest Inline node, the return node cannot be found
/**
* Get the nearest Inline node, the return node cannot be found
*/
closest(node: NodeInterface): NodeInterface;
closestNotInline
Get the first non-inline node up
/**
* Get the first non-inline node up
*/
closestNotInline(node: NodeInterface): NodeInterface;
wrap
Add an inline package to the current cursor node
/**
* Add an inline package to the current cursor node
* @param inline inline tag
* @param range cursor, get the current cursor by default
*/
wrap(inline: NodeInterface | Node | string, range?: RangeInterface): void;
unwrap
Remove inline package
/**
* Remove inline package
* @param range cursor, the current editor cursor is the default, or the inline node that needs to be removed
*/
unwrap(range?: RangeInterface | NodeInterface): void;
insert
Insert inline tag
/**
* Insert inline tag
* @param inline inline tag
* @param range cursor
*/
insert(inline: NodeInterface | Node | string, range?: RangeInterface): void;
split
Split inline tags
/**
* Split inline tags
* @param range cursor, get the current cursor by default
*/
split(range?: RangeInterface): void;
findInlines
Get all inline tags within the cursor
/**
* Get all inline tags within the cursor
* @param range cursor
*/
findInlines(range: RangeInterface): Array<NodeInterface>;
repairCursor
Fix inline node cursor placeholder
/**
* Fix cursor placeholder for inline node
* @param node inlne node
*/
repairCursor(node: NodeInterface | Node): void;
repairRange
Fix the cursor selection position, acde -> acde
/**
* Fix the cursor selection position, ​<a>​<anchor />acde<focus />​</a>​ -><anchor />​<a >​acde​</a>​<focus />
* Otherwise, in ot, the ​ changes on both sides of the inline node may not be applied correctly
*/
repairRange(range?: RangeInterface): RangeInterface;