File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -161,9 +161,14 @@ export function unwrapInternalNodes (sibling, keepUiElements) {
161161
162162// Get all tags that start or end inside the range
163163export function getTags ( host , range , filterFunc ) {
164- const tags = getInnerTags ( range , filterFunc )
164+ const innerTags = getInnerTags ( range , filterFunc )
165+ const ancestorTags = getAncestorTags ( host , range , filterFunc )
166+ return innerTags . concat ( ancestorTags )
167+ }
165168
166- // get all tags that surround the range
169+ // Get all ancestor tags that start or end inside the range
170+ export function getAncestorTags ( host , range , filterFunc ) {
171+ let tags = [ ]
167172 let node = range . commonAncestorContainer
168173 while ( node !== host ) {
169174 if ( ! filterFunc || filterFunc ( node ) ) tags . push ( node )
Original file line number Diff line number Diff line change @@ -65,6 +65,16 @@ export default class Cursor {
6565 return content . getTagsByName ( this . host , this . range , tagName )
6666 }
6767
68+ // Get all tags that are completely withing the current selection.
69+ getInnerTags ( filterFunc ) {
70+ return content . getInnerTags ( this . range , filterFunc )
71+ }
72+
73+ // Get all tags that surround the current selection.
74+ getAncestorTags ( filterFunc ) {
75+ return content . getAncestorTags ( this . host , this . range , filterFunc )
76+ }
77+
6878 isAtEnd ( ) {
6979 return parser . isEndOfHost (
7080 this . host ,
You can’t perform that action at this time.
0 commit comments