@dxos/react-ui-editor 0.4.8 → 0.4.9-main.2d20855
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/lib/browser/index.mjs +33 -40
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/types/src/components/TextEditor/TextEditor.stories.d.ts +3 -0
- package/dist/types/src/components/TextEditor/TextEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts +3 -0
- package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts.map +1 -1
- package/dist/types/src/extensions/automerge/automerge.stories.d.ts +3 -0
- package/dist/types/src/extensions/automerge/automerge.stories.d.ts.map +1 -1
- package/dist/types/src/hooks/useTextEditor.stories.d.ts +3 -0
- package/dist/types/src/hooks/useTextEditor.stories.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +3 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/package.json +24 -24
- package/src/components/Toolbar/Toolbar.stories.tsx +0 -1
- package/src/components/Toolbar/Toolbar.tsx +38 -32
- package/src/translations.ts +3 -0
|
@@ -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
|
}
|
|
@@ -4485,11 +4488,11 @@ var TextEditor = /* @__PURE__ */ forwardRef(({ id, doc, selection, extensions, c
|
|
|
4485
4488
|
});
|
|
4486
4489
|
|
|
4487
4490
|
// 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";
|
|
4491
|
+
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
4492
|
import { createContext } from "@radix-ui/react-context";
|
|
4490
4493
|
import React2, { useEffect as useEffect3, useRef as useRef2, useState as useState3 } from "react";
|
|
4491
4494
|
import { useDropzone } from "react-dropzone";
|
|
4492
|
-
import { DensityProvider, ElevationProvider,
|
|
4495
|
+
import { DensityProvider, ElevationProvider, Toolbar as NaturalToolbar, Tooltip, useTranslation, DropdownMenu, Button } from "@dxos/react-ui";
|
|
4493
4496
|
import { getSize } from "@dxos/react-ui-theme";
|
|
4494
4497
|
var tooltipProps = {
|
|
4495
4498
|
side: "top",
|
|
@@ -4572,58 +4575,48 @@ var MarkdownHeading = () => {
|
|
|
4572
4575
|
return setTooltipOpen(nextOpen);
|
|
4573
4576
|
}
|
|
4574
4577
|
}
|
|
4575
|
-
}, /* @__PURE__ */ React2.createElement(
|
|
4576
|
-
disabled: value === null,
|
|
4577
|
-
value: value ?? "0",
|
|
4578
|
+
}, /* @__PURE__ */ React2.createElement(DropdownMenu.Root, {
|
|
4578
4579
|
open: selectOpen,
|
|
4579
4580
|
onOpenChange: (nextOpen) => {
|
|
4580
4581
|
if (!nextOpen) {
|
|
4581
4582
|
suppressNextTooltip.current = true;
|
|
4582
4583
|
}
|
|
4583
4584
|
return setSelectOpen(nextOpen);
|
|
4584
|
-
}
|
|
4585
|
-
onValueChange: (value2) => onAction?.({
|
|
4586
|
-
type: "heading",
|
|
4587
|
-
data: parseInt(value2)
|
|
4588
|
-
})
|
|
4585
|
+
}
|
|
4589
4586
|
}, /* @__PURE__ */ React2.createElement(Tooltip.Trigger, {
|
|
4590
4587
|
asChild: true
|
|
4591
4588
|
}, /* @__PURE__ */ React2.createElement(NaturalToolbar.Button, {
|
|
4592
4589
|
asChild: true
|
|
4593
|
-
}, /* @__PURE__ */ React2.createElement(
|
|
4590
|
+
}, /* @__PURE__ */ React2.createElement(DropdownMenu.Trigger, {
|
|
4591
|
+
asChild: true
|
|
4592
|
+
}, /* @__PURE__ */ React2.createElement(Button, {
|
|
4594
4593
|
variant: "ghost",
|
|
4595
|
-
classNames: buttonStyles
|
|
4594
|
+
classNames: buttonStyles,
|
|
4595
|
+
disabled: value === null
|
|
4596
4596
|
}, /* @__PURE__ */ React2.createElement("span", {
|
|
4597
4597
|
className: "sr-only"
|
|
4598
4598
|
}, t("heading label")), /* @__PURE__ */ React2.createElement(HeadingIcon, {
|
|
4599
4599
|
className: iconStyles
|
|
4600
|
-
})
|
|
4601
|
-
|
|
4602
|
-
|
|
4603
|
-
|
|
4604
|
-
|
|
4605
|
-
|
|
4606
|
-
|
|
4607
|
-
|
|
4608
|
-
|
|
4609
|
-
|
|
4610
|
-
|
|
4611
|
-
|
|
4612
|
-
|
|
4613
|
-
|
|
4614
|
-
|
|
4615
|
-
|
|
4616
|
-
|
|
4617
|
-
|
|
4618
|
-
|
|
4619
|
-
|
|
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))));
|
|
4600
|
+
}), /* @__PURE__ */ React2.createElement(CaretDown, null))))), /* @__PURE__ */ React2.createElement(DropdownMenu.Portal, null, /* @__PURE__ */ React2.createElement(DropdownMenu.Content, {
|
|
4601
|
+
classNames: "is-min md:is-min",
|
|
4602
|
+
onCloseAutoFocus: (e) => e.preventDefault()
|
|
4603
|
+
}, /* @__PURE__ */ React2.createElement(DropdownMenu.Viewport, null, Object.keys(HeadingIcons).map((level) => {
|
|
4604
|
+
const Icon = HeadingIcons[level];
|
|
4605
|
+
return /* @__PURE__ */ React2.createElement(DropdownMenu.CheckboxItem, {
|
|
4606
|
+
key: level,
|
|
4607
|
+
checked: value === level,
|
|
4608
|
+
onClick: () => onAction?.({
|
|
4609
|
+
type: "heading",
|
|
4610
|
+
data: level
|
|
4611
|
+
})
|
|
4612
|
+
}, /* @__PURE__ */ React2.createElement("span", {
|
|
4613
|
+
className: "sr-only"
|
|
4614
|
+
}, t("heading level label", {
|
|
4615
|
+
count: parseInt(level)
|
|
4616
|
+
})), /* @__PURE__ */ React2.createElement(Icon, {
|
|
4617
|
+
className: iconStyles
|
|
4618
|
+
}), /* @__PURE__ */ React2.createElement(DropdownMenu.ItemIndicator, null, /* @__PURE__ */ React2.createElement(Check, null)));
|
|
4619
|
+
})), /* @__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
4620
|
};
|
|
4628
4621
|
var markdownStyles = [
|
|
4629
4622
|
{
|