forked from recogito/text-annotator-js
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into recogito#130-spatial-tree-events-emission
- Loading branch information
Showing
9 changed files
with
46 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 0 additions & 11 deletions
11
packages/text-annotator/src/utils/getAnnotatableFragment.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,18 @@ | ||
export * from './cancelSingleClickEvents'; | ||
export * from './cloneEvents'; | ||
export * from './device'; | ||
export * from './programmaticallyFocusable'; | ||
export * from './debounce'; | ||
export * from './getAnnotatableFragment'; | ||
export * from './getQuoteContext'; | ||
export * from './isWhitespaceOrEmpty'; | ||
export * from './isNotAnnotatable'; | ||
export * from './isRevived'; | ||
export * from './isWhitespaceOrEmpty'; | ||
export * from './mergeClientRects'; | ||
export * from './rangeToSelector'; | ||
export * from './reviveAnnotation'; | ||
export * from './reviveSelector'; | ||
export * from './reviveTarget'; | ||
export * from './splitAnnotatableRanges'; | ||
export * from './trimRangeToContainer'; | ||
export * from './cloneEvents'; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
export const NOT_ANNOTATABLE_CLASS = 'not-annotatable'; | ||
|
||
export const NOT_ANNOTATABLE_SELECTOR = `.${NOT_ANNOTATABLE_CLASS}`; | ||
|
||
export const isNotAnnotatable = (node: Node): boolean => { | ||
const closestNotAnnotatable = node instanceof HTMLElement | ||
? node.closest(NOT_ANNOTATABLE_SELECTOR) | ||
: node.parentElement?.closest(NOT_ANNOTATABLE_SELECTOR); | ||
return Boolean(closestNotAnnotatable); | ||
} | ||
|
||
export const isRangeAnnotatable = (range: Range): boolean => { | ||
const ancestor = range.commonAncestorContainer; | ||
return !isNotAnnotatable(ancestor); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 1 addition & 10 deletions
11
packages/text-annotator/src/utils/splitAnnotatableRanges.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters