mirror of
https://github.com/codex-team/editor.js
synced 2026-03-16 15:45:47 +01:00
removing wrapper
This commit is contained in:
parent
97f04e6152
commit
a95e236ee1
6 changed files with 63 additions and 31 deletions
|
|
@ -83,10 +83,17 @@ export interface ISelectionAPI {
|
|||
/**
|
||||
* Looks ahead to find passed tag from current selection
|
||||
*
|
||||
* @param tagName
|
||||
* @param className
|
||||
* @param {String} tagName
|
||||
* @param {String} className
|
||||
*/
|
||||
findParentTag: (tagName: string, className: string) => Node;
|
||||
|
||||
/**
|
||||
* Expands selection range to the passed parent node
|
||||
*
|
||||
* @param {HTMLElement} node
|
||||
*/
|
||||
expandToTag: (node: HTMLElement) => void;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -23,12 +23,17 @@ export default class SelectionAPI extends Module implements ISelectionAPI {
|
|||
*/
|
||||
get methods(): ISelectionAPI {
|
||||
return {
|
||||
findParentTag: (tagName, className) => this.findParentTag(tagName, className),
|
||||
findParentTag: (tagName: string, className: string) => this.findParentTag(tagName, className),
|
||||
expandToTag: (node: HTMLElement) => this.expandToTag(node),
|
||||
};
|
||||
}
|
||||
|
||||
public findParentTag(tagName, className) {
|
||||
public findParentTag(tagName: string, className: string): Node {
|
||||
return new Selection().findParentTag(tagName, className);
|
||||
}
|
||||
|
||||
public expandToTag(node: HTMLElement): void {
|
||||
new Selection().expandToTag(node);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -242,7 +242,8 @@ export default class Selection {
|
|||
|
||||
/**
|
||||
* Expands selection range to the passed parent node
|
||||
* @param {Element} node
|
||||
*
|
||||
* @param {HTMLElement} node
|
||||
*/
|
||||
expandToTag(node) {
|
||||
let selection = window.getSelection();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue