Skip to content

Commit f6118f4

Browse files
committed
Update codedrop.js
1 parent fea42e6 commit f6118f4

File tree

1 file changed

+34
-4
lines changed

1 file changed

+34
-4
lines changed

codedrop.js

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,13 +208,24 @@ function processFile(file) {
208208

209209
}
210210

211+
211212
body.addEventListener('drop', (ev) => {
212213

213214
// prevent default behavior (prevent file from being opened)
214215
ev.preventDefault();
215216

216217
// remove drop indication
217-
cd.classList.remove('focus');
218+
219+
if (!liveView.classList.contains('file-open')) {
220+
221+
cd.classList.remove('focus');
222+
223+
} else {
224+
225+
liveView.classList.remove('focus');
226+
227+
}
228+
218229

219230
if (ev.dataTransfer.items) {
220231

@@ -248,19 +259,38 @@ body.addEventListener('dragover', (ev) => {
248259

249260
// prevent default behavior (prevent file from being opened)
250261
ev.preventDefault();
251-
262+
252263
// show drop indication
253-
cd.classList.add('focus');
264+
265+
if (!liveView.classList.contains('file-open')) {
266+
267+
cd.classList.add('focus');
268+
269+
} else {
270+
271+
liveView.classList.add('focus');
272+
273+
}
254274

255275
})
256276

257277
body.addEventListener('dragleave', (ev) => {
258278

259279
// remove drop indication
260-
cd.classList.remove('focus');
280+
281+
if (!liveView.classList.contains('file-open')) {
282+
283+
cd.classList.remove('focus');
284+
285+
} else {
286+
287+
liveView.classList.remove('focus');
288+
289+
}
261290

262291
})
263292

293+
264294
if ('launchQueue' in window) {
265295

266296
window.launchQueue.setConsumer(async (launchParams) => {

0 commit comments

Comments
 (0)