浏览代码

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 月之前
父节点
当前提交
93384a062e
共有 1 个文件被更改,包括 2 次插入2 次删除
  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;
     });
   }