@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.js CHANGED
@@ -1309,6 +1309,11 @@ class ArkWysiwygEditor extends HTMLElement {
1309
1309
  button.title = label;
1310
1310
  button.setAttribute("aria-label", label);
1311
1311
  button.tabIndex = -1;
1312
+ // 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
1313
+ // comando aplica sobre ela sem vai-e-volta de foco. O focus() do Tiptap só devolve o foco no próximo frame, e
1314
+ // um Enter digitado nesse intervalo acionava o botão em vez de chegar ao editor. Teclado entra pelo Tab.
1315
+ button.addEventListener("mousedown", (event) => event.preventDefault());
1316
+ button.addEventListener("click", () => this.setCurrent(button));
1312
1317
  this.controls.push(button);
1313
1318
  return button;
1314
1319
  }