@domternal/core 0.4.0 → 0.5.0

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/README.md CHANGED
@@ -24,7 +24,7 @@ See <u>[Packages & Bundle Size](https://domternal.dev/v1/packages)</u> for a ful
24
24
  - **Tree-shakeable** - import only what you use, your bundler strips the rest
25
25
  - **~38 KB gzipped** (own code), <u>[~108 KB total](https://domternal.dev/v1/packages)</u> with ProseMirror
26
26
  - **TypeScript first** - 100% typed, zero `any`
27
- - **7,500+ tests** - 3,936 unit tests and 3,652 E2E tests across 76 Playwright specs
27
+ - **6,400+ tests** - 2,677 unit tests and 3,767 E2E tests across 78 Playwright specs
28
28
  - **Light and dark theme** - 70+ CSS custom properties for full visual control
29
29
  - **Inline styles export** - `getHTML({ styled: true })` produces inline CSS ready for email clients, CMS, and Google Docs
30
30
  - **SSR helpers** - `generateHTML`, `generateJSON`, `generateText` for server-side rendering
package/dist/index.cjs CHANGED
@@ -3603,6 +3603,11 @@ var Editor = class extends EventEmitter {
3603
3603
  */
3604
3604
  setEditable(editable) {
3605
3605
  this.options.editable = editable;
3606
+ if (editable) {
3607
+ this.view.dom.removeAttribute("aria-readonly");
3608
+ } else {
3609
+ this.view.dom.setAttribute("aria-readonly", "true");
3610
+ }
3606
3611
  this.view.dispatch(this.state.tr);
3607
3612
  return this;
3608
3613
  }
@@ -3734,6 +3739,12 @@ var Editor = class extends EventEmitter {
3734
3739
  state: state$1,
3735
3740
  dispatchTransaction: this.dispatchTransaction.bind(this),
3736
3741
  editable: () => this.options.editable ?? true,
3742
+ attributes: () => ({
3743
+ role: "textbox",
3744
+ "aria-multiline": "true",
3745
+ "aria-label": this.options.ariaLabel ?? "Rich text editor",
3746
+ ...this.options.editable ?? true ? {} : { "aria-readonly": "true" }
3747
+ }),
3737
3748
  ...Object.keys(nodeViews).length > 0 ? { nodeViews } : {},
3738
3749
  // Clipboard transform — apply user-provided transform (e.g. inlineStyles) on copy/cut
3739
3750
  ...this.options.clipboardHTMLTransform ? this.buildClipboardSerializer(this.options.clipboardHTMLTransform, this._extensionManager.schema) : {},
@@ -5416,7 +5427,8 @@ var TaskItem = Node.create({
5416
5427
  "input",
5417
5428
  {
5418
5429
  type: "checkbox",
5419
- checked: node.attrs["checked"] ? "checked" : null
5430
+ checked: node.attrs["checked"] ? "checked" : null,
5431
+ "aria-label": "Task status"
5420
5432
  }
5421
5433
  ]
5422
5434
  ],
@@ -8153,6 +8165,7 @@ function linkPopoverPlugin({ editor, markType, protocols }) {
8153
8165
  input.type = "url";
8154
8166
  input.placeholder = "Enter URL...";
8155
8167
  input.className = "dm-link-popover-input";
8168
+ input.setAttribute("aria-label", "URL");
8156
8169
  const applyBtn = document.createElement("button");
8157
8170
  applyBtn.type = "button";
8158
8171
  applyBtn.className = "dm-link-popover-btn dm-link-popover-apply";
@@ -8671,6 +8684,10 @@ function createFloatingMenuPlugin(options) {
8671
8684
  shouldShow = defaultShouldShow2,
8672
8685
  offset: offset2 = 0
8673
8686
  } = options;
8687
+ if (!element.getAttribute("role")) {
8688
+ element.setAttribute("role", "toolbar");
8689
+ element.setAttribute("aria-label", "Floating menu");
8690
+ }
8674
8691
  let cleanupFloating = null;
8675
8692
  const updatePosition = (view) => {
8676
8693
  const { selection } = view.state;
@@ -8814,6 +8831,7 @@ var StarterKit = Extension.create({
8814
8831
  maybeAdd(TrailingNode, this.options.trailingNode);
8815
8832
  maybeAdd(ListKeymap, this.options.listKeymap);
8816
8833
  maybeAdd(LinkPopover, this.options.linkPopover);
8834
+ maybeAdd(SelectionDecoration, this.options.selectionDecoration);
8817
8835
  return extensions;
8818
8836
  }
8819
8837
  });