-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EPUB/Snapshot: Prevent text selection when annotating in Safari
Disable text selection completely when annotating/resizing, and reenable it temporarily every time caretPositionFromPoint() is called.
- Loading branch information
1 parent
9ca45a5
commit 3262119
Showing
4 changed files
with
116 additions
and
95 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
.annotation-container { | ||
z-index: 9999; | ||
pointer-events: none; | ||
position: absolute; | ||
left: 0; | ||
right: 0; | ||
top: 0; | ||
bottom: 0; | ||
background: transparent; | ||
overflow: visible; | ||
} | ||
|
||
.annotation-container.blended { | ||
mix-blend-mode: multiply; | ||
} | ||
|
||
.annotation-div { | ||
cursor: default; | ||
width: 100%; | ||
height: 100%; | ||
pointer-events: auto; | ||
} | ||
|
||
.inherit-pointer-events { | ||
pointer-events: auto; | ||
} | ||
|
||
.disable-pointer-events { | ||
pointer-events: none !important; | ||
|
||
.inherit-pointer-events { | ||
pointer-events: none !important; | ||
} | ||
|
||
.needs-pointer-events { | ||
display: none !important; | ||
} | ||
} | ||
|
||
.resizer { | ||
cursor: col-resize; | ||
touch-action: none; | ||
} | ||
|
||
@media (any-pointer: coarse) { | ||
.resizer { | ||
stroke: transparent; | ||
stroke-width: 20px; | ||
margin: -10px; | ||
} | ||
} | ||
|
||
@mixin -dark-rules() { | ||
.annotation-container.blended { | ||
mix-blend-mode: screen; | ||
} | ||
} | ||
|
||
@media (prefers-color-scheme: dark) { | ||
#annotation-render-root:not(.disable-dark-mode) { | ||
@include -dark-rules(); | ||
} | ||
} | ||
|
||
#annotation-render-root[data-color-scheme=dark]:not(.disable-dark-mode) { | ||
@include -dark-rules(); | ||
} | ||
|
||
@media print { | ||
:host { | ||
display: none !important; | ||
} | ||
} |
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,73 +1,13 @@ | ||
.annotation-container { | ||
z-index: 9999; | ||
pointer-events: none; | ||
position: absolute; | ||
left: 0; | ||
right: 0; | ||
top: 0; | ||
bottom: 0; | ||
background: transparent; | ||
overflow: visible; | ||
} | ||
|
||
.annotation-container.blended { | ||
mix-blend-mode: multiply; | ||
} | ||
|
||
.annotation-div { | ||
cursor: default; | ||
width: 100%; | ||
height: 100%; | ||
pointer-events: auto; | ||
} | ||
|
||
.inherit-pointer-events { | ||
pointer-events: auto; | ||
} | ||
|
||
.disable-pointer-events { | ||
pointer-events: none !important; | ||
|
||
.inherit-pointer-events { | ||
pointer-events: none !important; | ||
} | ||
|
||
.needs-pointer-events { | ||
display: none !important; | ||
} | ||
} | ||
|
||
.resizer { | ||
cursor: col-resize; | ||
touch-action: none; | ||
} | ||
|
||
@media (any-pointer: coarse) { | ||
.resizer { | ||
stroke: transparent; | ||
stroke-width: 20px; | ||
margin: -10px; | ||
} | ||
} | ||
|
||
@mixin -dark-rules() { | ||
.annotation-container.blended { | ||
mix-blend-mode: screen; | ||
} | ||
} | ||
|
||
@media (prefers-color-scheme: dark) { | ||
#annotation-render-root:not(.disable-dark-mode) { | ||
@include -dark-rules(); | ||
body.resizing-annotation, body.creating-touch-annotation { | ||
&, & * { | ||
user-select: none !important; | ||
-webkit-user-select: none !important; | ||
} | ||
} | ||
|
||
#annotation-render-root[data-color-scheme=dark]:not(.disable-dark-mode) { | ||
@include -dark-rules(); | ||
} | ||
|
||
@media print { | ||
:host { | ||
display: none !important; | ||
body.force-enable-selection-everywhere { | ||
&, & * { | ||
user-select: auto !important; | ||
-webkit-user-select: auto !important; | ||
} | ||
} |