@tooark/wysiwyg 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1311,6 +1311,11 @@ class ArkWysiwygEditor extends HTMLElement {
1311
1311
  button.title = label;
1312
1312
  button.setAttribute("aria-label", label);
1313
1313
  button.tabIndex = -1;
1314
+ // No mouse o botão não rouba o foco do editor (padrão de toolbar de editor): a seleção continua visível e o
1315
+ // comando aplica sobre ela sem vai-e-volta de foco. O focus() do Tiptap só devolve o foco no próximo frame, e
1316
+ // um Enter digitado nesse intervalo acionava o botão em vez de chegar ao editor. Teclado entra pelo Tab.
1317
+ button.addEventListener("mousedown", (event) => event.preventDefault());
1318
+ button.addEventListener("click", () => this.setCurrent(button));
1314
1319
  this.controls.push(button);
1315
1320
  return button;
1316
1321
  }