removing wrapper

This commit is contained in:
Taly 2018-07-10 11:45:07 +03:00
commit a95e236ee1
No known key found for this signature in database
GPG key ID: F8569511A387BDFB
6 changed files with 63 additions and 31 deletions

View file

@ -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;
}
/**

View file

@ -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);
}
}

View file

@ -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();