File tree Expand file tree Collapse file tree 2 files changed +29
-29
lines changed Expand file tree Collapse file tree 2 files changed +29
-29
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,35 @@ export default class Cursor {
3737 this . isCursor = true
3838 }
3939
40+ // Get all tags that affect the current selection. Optionally pass a
41+ // method to filter the returned elements.
42+ //
43+ // @param {Function filter(node) } [Optional] Method to filter the returned
44+ // DOM Nodes.
45+ // @return {Array of DOM Nodes }
46+ getTags ( filterFunc ) {
47+ return content . getTags ( this . host , this . range , filterFunc )
48+ }
49+
50+ // Get the names of all tags that affect the current selection. Optionally
51+ // pass a method to filter the returned elements.
52+ //
53+ // @param {Function filter(node) } [Optional] Method to filter the DOM
54+ // Nodes whose names are returned.
55+ // @return {Array<String> of tag names }
56+ getTagNames ( filterFunc ) {
57+ return content . getTagNames ( this . getTags ( filterFunc ) )
58+ }
59+
60+ // Get all tags of the specified type that affect the current selection.
61+ //
62+ // @method getTagsByName
63+ // @param {String } tagName. E.g. 'a' to get all links.
64+ // @return {Array of DOM Nodes }
65+ getTagsByName ( tagName ) {
66+ return content . getTagsByName ( this . host , this . range , tagName )
67+ }
68+
4069 isAtEnd ( ) {
4170 return parser . isEndOfHost (
4271 this . host ,
Original file line number Diff line number Diff line change @@ -249,35 +249,6 @@ export default class Selection extends Cursor {
249249 this . setSelection ( )
250250 }
251251
252- // Get all tags that affect the current selection. Optionally pass a
253- // method to filter the returned elements.
254- //
255- // @param {Function filter(node) } [Optional] Method to filter the returned
256- // DOM Nodes.
257- // @return {Array of DOM Nodes }
258- getTags ( filterFunc ) {
259- return content . getTags ( this . host , this . range , filterFunc )
260- }
261-
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<String> of tag names }
268- getTagNames ( filterFunc ) {
269- return content . getTagNames ( this . getTags ( filterFunc ) )
270- }
271-
272- // Get all tags of the specified type that affect the current selection.
273- //
274- // @method getTagsByName
275- // @param {String } tagName. E.g. 'a' to get all links.
276- // @return {Array of DOM Nodes }
277- getTagsByName ( tagName ) {
278- return content . getTagsByName ( this . host , this . range , tagName )
279- }
280-
281252 // Check if the selection is the same as the elements contents.
282253 //
283254 // @method isExactSelection
You can’t perform that action at this time.
0 commit comments