@dxos/react-ui-editor 0.4.8 → 0.4.9-main.1057b49

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.
@@ -17,7 +17,10 @@ var translations_default = [
17
17
  "comment label": "Create comment",
18
18
  "image label": "Insert image",
19
19
  "heading label": "Heading level",
20
- "table label": "Create table"
20
+ "table label": "Create table",
21
+ "heading level label_zero": "Paragraph",
22
+ "heading level label_one": "Heading level {{count}}",
23
+ "heading level label_other": "Heading level {{count}}"
21
24
  }
22
25
  }
23
26
  }
@@ -27,7 +30,6 @@ var translations_default = [
27
30
  import { keymap as keymap11 } from "@codemirror/view";
28
31
  import { tags as tags2 } from "@lezer/highlight";
29
32
  import { TextKind } from "@dxos/protocols/proto/dxos/echo/model/text";
30
- import { Doc, YText, YXmlFragment } from "@dxos/text-model";
31
33
 
32
34
  // packages/ui/react-ui-editor/src/components/TextEditor/TextEditor.tsx
33
35
  import { EditorState as EditorState2 } from "@codemirror/state";
@@ -4485,11 +4487,11 @@ var TextEditor = /* @__PURE__ */ forwardRef(({ id, doc, selection, extensions, c
4485
4487
  });
4486
4488
 
4487
4489
  // packages/ui/react-ui-editor/src/components/Toolbar/Toolbar.tsx
4488
- import { ChatText, Code, CodeBlock, Image, Link, ListBullets, ListChecks, ListNumbers, Paragraph, Quotes, TextStrikethrough, Table as Table2, TextB, TextHOne, TextHTwo, TextHThree, TextHFour, TextHFive, TextHSix, TextItalic } from "@phosphor-icons/react";
4490
+ import { ChatText, Code, CodeBlock, Image, Link, ListBullets, ListChecks, ListNumbers, Paragraph, Quotes, TextStrikethrough, Table as Table2, TextB, TextHOne, TextHTwo, TextHThree, TextHFour, TextHFive, TextHSix, TextItalic, CaretDown, Check } from "@phosphor-icons/react";
4489
4491
  import { createContext } from "@radix-ui/react-context";
4490
4492
  import React2, { useEffect as useEffect3, useRef as useRef2, useState as useState3 } from "react";
4491
4493
  import { useDropzone } from "react-dropzone";
4492
- import { DensityProvider, ElevationProvider, Select, Toolbar as NaturalToolbar, Tooltip, useTranslation } from "@dxos/react-ui";
4494
+ import { DensityProvider, ElevationProvider, Toolbar as NaturalToolbar, Tooltip, useTranslation, DropdownMenu, Button } from "@dxos/react-ui";
4493
4495
  import { getSize } from "@dxos/react-ui-theme";
4494
4496
  var tooltipProps = {
4495
4497
  side: "top",
@@ -4572,58 +4574,48 @@ var MarkdownHeading = () => {
4572
4574
  return setTooltipOpen(nextOpen);
4573
4575
  }
4574
4576
  }
4575
- }, /* @__PURE__ */ React2.createElement(Select.Root, {
4576
- disabled: value === null,
4577
- value: value ?? "0",
4577
+ }, /* @__PURE__ */ React2.createElement(DropdownMenu.Root, {
4578
4578
  open: selectOpen,
4579
4579
  onOpenChange: (nextOpen) => {
4580
4580
  if (!nextOpen) {
4581
4581
  suppressNextTooltip.current = true;
4582
4582
  }
4583
4583
  return setSelectOpen(nextOpen);
4584
- },
4585
- onValueChange: (value2) => onAction?.({
4586
- type: "heading",
4587
- data: parseInt(value2)
4588
- })
4584
+ }
4589
4585
  }, /* @__PURE__ */ React2.createElement(Tooltip.Trigger, {
4590
4586
  asChild: true
4591
4587
  }, /* @__PURE__ */ React2.createElement(NaturalToolbar.Button, {
4592
4588
  asChild: true
4593
- }, /* @__PURE__ */ React2.createElement(Select.TriggerButton, {
4589
+ }, /* @__PURE__ */ React2.createElement(DropdownMenu.Trigger, {
4590
+ asChild: true
4591
+ }, /* @__PURE__ */ React2.createElement(Button, {
4594
4592
  variant: "ghost",
4595
- classNames: buttonStyles
4593
+ classNames: buttonStyles,
4594
+ disabled: value === null
4596
4595
  }, /* @__PURE__ */ React2.createElement("span", {
4597
4596
  className: "sr-only"
4598
4597
  }, t("heading label")), /* @__PURE__ */ React2.createElement(HeadingIcon, {
4599
4598
  className: iconStyles
4600
- })))), /* @__PURE__ */ React2.createElement(Select.Portal, null, /* @__PURE__ */ React2.createElement(Select.Content, null, /* @__PURE__ */ React2.createElement(Select.ScrollUpButton, null), /* @__PURE__ */ React2.createElement(Select.Viewport, null, /* @__PURE__ */ React2.createElement(Select.Option, {
4601
- value: "0"
4602
- }, /* @__PURE__ */ React2.createElement(Paragraph, {
4603
- className: iconStyles
4604
- })), [
4605
- 1,
4606
- 2,
4607
- 3,
4608
- 4,
4609
- 5,
4610
- 6
4611
- ].map((level) => /* @__PURE__ */ React2.createElement(Select.Option, {
4612
- key: level,
4613
- value: String(level)
4614
- }, level === 1 && /* @__PURE__ */ React2.createElement(TextHOne, {
4615
- className: iconStyles
4616
- }), level === 2 && /* @__PURE__ */ React2.createElement(TextHTwo, {
4617
- className: iconStyles
4618
- }), level === 3 && /* @__PURE__ */ React2.createElement(TextHThree, {
4619
- className: iconStyles
4620
- }), level === 4 && /* @__PURE__ */ React2.createElement(TextHFour, {
4621
- className: iconStyles
4622
- }), level === 5 && /* @__PURE__ */ React2.createElement(TextHFive, {
4623
- className: iconStyles
4624
- }), level === 6 && /* @__PURE__ */ React2.createElement(TextHSix, {
4625
- className: iconStyles
4626
- })))), /* @__PURE__ */ React2.createElement(Select.ScrollDownButton, null), /* @__PURE__ */ React2.createElement(Select.Arrow, null)))), /* @__PURE__ */ React2.createElement(Tooltip.Portal, null, /* @__PURE__ */ React2.createElement(Tooltip.Content, tooltipProps, t("heading label"), /* @__PURE__ */ React2.createElement(Tooltip.Arrow, null))));
4599
+ }), /* @__PURE__ */ React2.createElement(CaretDown, null))))), /* @__PURE__ */ React2.createElement(DropdownMenu.Portal, null, /* @__PURE__ */ React2.createElement(DropdownMenu.Content, {
4600
+ classNames: "is-min md:is-min",
4601
+ onCloseAutoFocus: (e) => e.preventDefault()
4602
+ }, /* @__PURE__ */ React2.createElement(DropdownMenu.Viewport, null, Object.keys(HeadingIcons).map((level) => {
4603
+ const Icon = HeadingIcons[level];
4604
+ return /* @__PURE__ */ React2.createElement(DropdownMenu.CheckboxItem, {
4605
+ key: level,
4606
+ checked: value === level,
4607
+ onClick: () => onAction?.({
4608
+ type: "heading",
4609
+ data: level
4610
+ })
4611
+ }, /* @__PURE__ */ React2.createElement("span", {
4612
+ className: "sr-only"
4613
+ }, t("heading level label", {
4614
+ count: parseInt(level)
4615
+ })), /* @__PURE__ */ React2.createElement(Icon, {
4616
+ className: iconStyles
4617
+ }), /* @__PURE__ */ React2.createElement(DropdownMenu.ItemIndicator, null, /* @__PURE__ */ React2.createElement(Check, null)));
4618
+ })), /* @__PURE__ */ React2.createElement(DropdownMenu.Arrow, null)))), /* @__PURE__ */ React2.createElement(Tooltip.Portal, null, /* @__PURE__ */ React2.createElement(Tooltip.Content, tooltipProps, t("heading label"), /* @__PURE__ */ React2.createElement(Tooltip.Arrow, null))));
4627
4619
  };
4628
4620
  var markdownStyles = [
4629
4621
  {
@@ -4925,7 +4917,6 @@ var useTextEditor = (cb = () => ({}), deps = []) => {
4925
4917
  };
4926
4918
  export {
4927
4919
  Cursor,
4928
- Doc,
4929
4920
  EditorModes,
4930
4921
  Inline,
4931
4922
  List,
@@ -4934,8 +4925,6 @@ export {
4934
4925
  TextEditor,
4935
4926
  TextKind,
4936
4927
  Toolbar,
4937
- YText,
4938
- YXmlFragment,
4939
4928
  addBlockquote,
4940
4929
  addCodeblock,
4941
4930
  addLink,