Prechádzať zdrojové kódy

Update CloneController - added/cleared events should not be cancelable

- While no code uses the event.preventDefault on these it's good practice to advise when cancelling will do nothing
LB 5 mesiacov pred
rodič
commit
93384a062e
1 zmenil súbory, kde vykonal 2 pridanie a 2 odobranie
  1. 2 2
      client/src/controllers/CloneController.ts

+ 2 - 2
client/src/controllers/CloneController.ts

@@ -106,7 +106,7 @@ export class CloneController extends Controller<HTMLElement> {
     debounce(() => {
       this.element.classList.remove(...this.hideClasses);
       this.element.classList.add(...this.showClasses);
-      this.dispatch('added');
+      this.dispatch('added', { cancelable: false });
     }, this.showDelayValue || null /* run immediately if zero */)().then(() => {
       // Once complete, check if we should automatically clear the content after a delay
       const autoClearValue = this.autoClearValue || null;
@@ -141,7 +141,7 @@ export class CloneController extends Controller<HTMLElement> {
     debounce(noop, clearDelayValue)().then(() => {
       if (!this?.isClearing) return;
       this.containerTarget.innerHTML = '';
-      this.dispatch('cleared');
+      this.dispatch('cleared', { cancelable: false });
       this.isClearing = false;
     });
   }