Skip to content

Commit 29ad5e1

Browse files
jenstroegerpeyerluk
authored andcommitted
feat(selection): Add getTagNames() helper function.
1 parent bf3bf5c commit 29ad5e1

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/selection.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,16 @@ export default class Selection extends Cursor {
259259
return content.getTags(this.host, this.range, filterFunc)
260260
}
261261

262+
// Get the names of all tags that affect the current selection. Optionally
263+
// pass a method to filter the returned elements.
264+
//
265+
// @param {Function filter(node)} [Optional] Method to filter the DOM
266+
// Nodes whose names are returned.
267+
// @return {Array of DOM Node names}
268+
getTagNames (filterFunc) {
269+
return content.getTagNames(this.getTags(filterFunc))
270+
}
271+
262272
// Get all tags of the specified type that affect the current selection.
263273
//
264274
// @method getTagsByName

0 commit comments

Comments
 (0)