Skip to content

Commit ad7a1c8

Browse files
committed
feat: auto selection color
1 parent ee3c1f1 commit ad7a1c8

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

packages/force-copy/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "force-copy",
3-
"version": "1.0.10",
3+
"version": "1.0.12",
44
"author": "Czy",
55
"license": "MIT",
66
"sideEffects": false,
File renamed without changes.
Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,29 @@
11
export const STYLE_ID = "__FORCE_COPY_STYLE__";
22

3-
export const AUTO_USER_SELECT =
4-
"*{user-select: auto !important;-webkit-user-select: auto !important;} ";
5-
6-
export const ALLOW_PAINT = "@media print{body{display:block !important;}} ";
7-
83
export const COPY_BUTTON_STYLE =
94
".__copy-button {width: 60px; height: 30px; background: #4C98F7;color: #fff;position: absolute;" +
105
"z-index: -1000;opacity: 0;display: flex;justify-content: center;align-items: center;border-radius: 3px;" +
116
"font-size: 13px;cursor: pointer;transition: opacity 0.3s;} ";
127

8+
// https://developer.mozilla.org/zh-CN/docs/Web/CSS/user-select
9+
export const AUTO_USER_SELECT =
10+
"*, html body * :not(input):not(textarea)" +
11+
"{user-select: auto !important;-webkit-user-select: auto !important;} ";
12+
13+
// https://developer.mozilla.org/zh-CN/docs/Web/CSS/@media
14+
export const ALLOW_PAINT = "@media print{body{display:block !important;}} ";
15+
16+
// https://developer.mozilla.org/en-US/docs/Web/CSS/unset
17+
// https://developer.mozilla.org/zh-CN/docs/Web/CSS/::selection
18+
// https://stackoverflow.com/questions/33448213/how-to-reset-background-color-of-selection
1319
export const AUTO_SELECTION =
1420
":not(input):not(textarea)::selection {" +
21+
" color: inherit !important;" +
1522
" background-color: #BEDAFF !important;" +
1623
" background-color: highlight !important;" +
1724
"} " +
1825
":not(input):not(textarea)::-moz-selection {" +
26+
" color: inherit !important;" +
1927
" background-color: #BEDAFF !important;" +
2028
" background-color: highlight !important;" +
2129
"} ";

0 commit comments

Comments
 (0)