Spaces:
Sleeping
Sleeping
drakosfire
commited on
Commit
•
b1fa4de
1
Parent(s):
9efcf1c
Pretty sure that all textareas lock during drag events, no more dropping html into textareas or content editable areas
Browse files- scripts.js +21 -8
scripts.js
CHANGED
@@ -353,28 +353,41 @@ document.addEventListener("DOMContentLoaded", function() {
|
|
353 |
}
|
354 |
function lockTextareas() {
|
355 |
const textareas = blockContainer.querySelectorAll('textarea');
|
|
|
356 |
textareas.forEach(textarea => {
|
357 |
textarea.setAttribute('disabled', true);
|
|
|
358 |
});
|
359 |
-
|
360 |
-
descriptionTextareas.
|
361 |
-
|
|
|
|
|
|
|
362 |
});
|
|
|
363 |
console.log('All textareas have been locked.');
|
364 |
}
|
365 |
|
366 |
function unlockTextareas() {
|
367 |
const textareas = blockContainer.querySelectorAll('textarea');
|
|
|
368 |
textareas.forEach(textarea => {
|
369 |
textarea.removeAttribute('disabled');
|
|
|
370 |
});
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
|
|
|
|
375 |
});
|
|
|
|
|
376 |
}
|
377 |
-
|
|
|
378 |
function handleDragStart(e) {
|
379 |
lockTextareas();
|
380 |
const target = e.target.closest('.block-item, .block-content');
|
|
|
353 |
}
|
354 |
function lockTextareas() {
|
355 |
const textareas = blockContainer.querySelectorAll('textarea');
|
356 |
+
|
357 |
textareas.forEach(textarea => {
|
358 |
textarea.setAttribute('disabled', true);
|
359 |
+
console.log(`Textarea with ID "${textarea.id}" is now disabled: ${textarea.disabled}`);
|
360 |
});
|
361 |
+
|
362 |
+
const descriptionTextareas = blockContainer.querySelectorAll('.description-textarea');
|
363 |
+
|
364 |
+
descriptionTextareas.forEach(descriptionTextarea => {
|
365 |
+
descriptionTextarea.removeAttribute('contenteditable');
|
366 |
+
console.log(`Description textarea with ID "${descriptionTextarea.id}" is now enabled: ${!descriptionTextarea.contenteditable}`);
|
367 |
});
|
368 |
+
|
369 |
console.log('All textareas have been locked.');
|
370 |
}
|
371 |
|
372 |
function unlockTextareas() {
|
373 |
const textareas = blockContainer.querySelectorAll('textarea');
|
374 |
+
|
375 |
textareas.forEach(textarea => {
|
376 |
textarea.removeAttribute('disabled');
|
377 |
+
console.log(`Textarea with ID "${textarea.id}" is now enabled: ${!textarea.disabled}`);
|
378 |
});
|
379 |
+
|
380 |
+
const descriptionTextareas = blockContainer.querySelectorAll('.description-textarea');
|
381 |
+
|
382 |
+
descriptionTextareas.forEach(descriptionTextarea => {
|
383 |
+
descriptionTextarea.removeAttribute('contenteditable');
|
384 |
+
console.log(`Description textarea with ID "${descriptionTextarea.id}" is now enabled: ${!descriptionTextarea.contenteditable}`);
|
385 |
});
|
386 |
+
|
387 |
+
console.log('All textareas have been unlocked.');
|
388 |
}
|
389 |
+
|
390 |
+
|
391 |
function handleDragStart(e) {
|
392 |
lockTextareas();
|
393 |
const target = e.target.closest('.block-item, .block-content');
|