forked from Ariestar/obsidian-dragger
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstyles.css
More file actions
254 lines (222 loc) · 7.09 KB
/
styles.css
File metadata and controls
254 lines (222 loc) · 7.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
/* Dragger 插件样式 */
.dnd-hidden {
display: none !important;
}
/* 拖拽手柄 - 完全悬浮定位,不影响文档布局 */
.dnd-drag-handle {
position: absolute;
left: calc(-1 * var(--dnd-handle-size, 24px));
top: 0;
transform: none;
width: var(--dnd-handle-size, 24px);
height: var(--dnd-handle-size, 24px);
display: flex;
align-items: center;
justify-content: center;
cursor: grab;
opacity: 0;
transition: none;
color: var(--dnd-handle-color, var(--interactive-accent));
border-radius: 999px;
z-index: 1;
}
/* Disable hover state when block selection is active - only anchor handle should be visible */
body:not(.dnd-block-selection-active) .dnd-drag-handle:hover {
opacity: 1 !important;
color: var(--dnd-handle-color-hover, var(--dnd-handle-color, var(--text-accent)));
filter: brightness(1.08);
}
.dnd-drag-handle:active {
cursor: grabbing;
}
.dnd-handle-core {
width: var(--dnd-handle-core-size, 16px);
height: var(--dnd-handle-core-size, 16px);
border-radius: 999px;
background: currentColor;
box-shadow:
0 0 0 1px rgba(255, 255, 255, 0.18),
0 0 8px var(--dnd-handle-color, var(--interactive-accent));
}
/* 手柄图标样式:六点抓手 */
[data-dnd-handle-icon="grip-dots"] .dnd-handle-core {
width: auto;
height: auto;
border-radius: 0;
background: none;
box-shadow: none;
font-size: var(--dnd-handle-core-size, 16px);
line-height: 1;
}
[data-dnd-handle-icon="grip-dots"] .dnd-handle-core::before {
content: '⠿';
}
/* 手柄图标样式:三横线 */
[data-dnd-handle-icon="grip-lines"] .dnd-handle-core {
width: auto;
height: auto;
border-radius: 0;
background: none;
box-shadow: none;
font-size: var(--dnd-handle-core-size, 16px);
line-height: 1;
}
[data-dnd-handle-icon="grip-lines"] .dnd-handle-core::before {
content: '☰';
}
/* 手柄图标样式:方块 */
[data-dnd-handle-icon="square"] .dnd-handle-core {
border-radius: 2px;
}
/* 选中高亮:单块拖拽时对应行的背景光晕 */
.cm-line.dnd-selection-highlight-line {
background: color-mix(in srgb, var(--dnd-selection-highlight-color, var(--interactive-accent)) 12%, transparent);
border-radius: 4px;
}
/* 所有块共用同一显示态:由统一事件链添加 is-visible */
.dnd-drag-handle.is-visible {
opacity: 0.5;
}
.markdown-source-view.mod-cm6 .cm-editor.dnd-root-editor {
position: relative;
}
/* 仅主编辑器行参与手柄定位,避免影响嵌套编辑器(如表格单元格) */
.markdown-source-view.mod-cm6 .cm-editor.dnd-root-editor .cm-content.dnd-main-content > .cm-line {
position: relative;
overflow: visible;
}
/* Horizontal rule lines sometimes render a wide overlay that can swallow handle hit-testing. */
.dnd-line-number-hover-hidden,
.dnd-line-number-grab-hidden,
.dnd-drag-source-line-number {
color: transparent !important;
opacity: 0 !important;
text-shadow: none !important;
}
.dnd-drag-handle.dnd-range-selected-handle {
opacity: 1 !important;
cursor: grab;
color: var(--dnd-handle-color-hover, var(--dnd-handle-color, var(--interactive-accent)));
filter: brightness(1.08);
}
.dnd-drag-handle.dnd-range-selected-handle .dnd-handle-core {
box-shadow:
0 0 0 1px rgba(255, 255, 255, 0.2),
0 0 10px color-mix(in srgb, var(--dnd-handle-color, var(--interactive-accent)) 45%, transparent);
}
body.dnd-block-selection-active .dnd-drag-handle.dnd-selection-handle-hidden {
opacity: 0 !important;
pointer-events: none !important;
}
body.dnd-block-selection-active .dnd-drag-handle.dnd-selection-anchor-handle {
opacity: 1 !important;
pointer-events: auto !important;
}
.cm-line.dnd-range-selected-line {
background: color-mix(in srgb, var(--dnd-selection-highlight-color, var(--interactive-accent)) 14%, transparent);
border-radius: 4px;
}
.dnd-range-selection-link {
position: absolute;
width: 3px;
transform: translateX(-50%);
border-radius: 999px;
/* Use a more reliable color fallback chain to avoid "black sidebar" in light themes.
Fallback order: custom var -> text-accent -> interactive-accent -> explicit purple */
background-color: var(--dnd-selection-highlight-color, var(--text-accent, var(--interactive-accent, #7c3aed)));
box-shadow: 0 0 4px color-mix(in srgb, var(--dnd-selection-highlight-color, var(--text-accent, var(--interactive-accent, #7c3aed))) 28%, transparent);
will-change: left, top, height, opacity;
transition:
left 45ms linear,
top 45ms linear,
height 45ms linear,
opacity 36ms linear;
opacity: 0;
pointer-events: none;
cursor: grab;
z-index: 10002;
}
.dnd-range-selection-link.is-active {
opacity: 1;
pointer-events: auto;
}
.dnd-range-selection-link::before {
content: '';
position: absolute;
top: 0;
bottom: 0;
left: -10px;
right: -10px;
background: transparent;
}
/* 常态显示拖拽手柄 */
body.dnd-handles-always .dnd-drag-handle {
opacity: 0.6;
}
body.dnd-handles-always .dnd-drag-handle.is-visible {
opacity: 1;
}
/* 隐藏模式:完全不显示手柄 */
body.dnd-handles-hidden .dnd-drag-handle {
display: none !important;
}
/* 拖拽中的状态 */
body.dnd-dragging {
cursor: grabbing !important;
}
body.dnd-dragging * {
cursor: grabbing !important;
}
body.dnd-dragging .cm-line:hover {
background-color: transparent;
}
/* 移动端手势锁:拖拽期间禁用页面滚动与触摸平移 */
body.dnd-mobile-gesture-lock {
overflow: hidden;
overscroll-behavior: none;
touch-action: none;
-webkit-user-select: none;
user-select: none;
}
.markdown-source-view.mod-cm6 .cm-editor.dnd-mobile-gesture-lock,
.markdown-source-view.mod-cm6 .cm-editor.dnd-mobile-gesture-lock .cm-scroller,
.markdown-source-view.mod-cm6 .cm-editor.dnd-mobile-gesture-lock .cm-content {
touch-action: none !important;
overscroll-behavior: none;
}
/* 拖拽时的ghost预览 */
.dnd-drag-ghost {
position: absolute;
left: -9999px;
padding: 4px 8px;
background-color: var(--background-primary);
border: 1px solid var(--background-modifier-border);
border-radius: 4px;
font-size: 12px;
color: var(--text-normal);
max-width: 300px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
z-index: 1000;
}
/* 放置位置指示器 */
.dnd-drop-indicator {
position: fixed;
height: 3px;
background: var(--dnd-drop-indicator-color, var(--interactive-accent));
pointer-events: none;
z-index: 10000;
border-radius: 2px;
box-shadow: 0 0 6px var(--dnd-drop-indicator-color, var(--interactive-accent));
}
/* 列表块内落点高亮 */
.dnd-drop-highlight {
position: fixed;
pointer-events: none;
z-index: 9999;
border-radius: 6px;
background: color-mix(in srgb, var(--dnd-drop-indicator-color, var(--interactive-accent)) 14%, transparent);
box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--dnd-drop-indicator-color, var(--interactive-accent)) 36%, transparent);
}