@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.
- package/dist/lib/browser/index.mjs +33 -44
- 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/index.d.ts +0 -1
- package/dist/types/src/index.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 +23 -24
- package/src/components/Toolbar/Toolbar.stories.tsx +0 -1
- package/src/components/Toolbar/Toolbar.tsx +38 -32
- package/src/index.ts +0 -1
- 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
|
}
|
|
@@ -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,
|
|
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(
|
|
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(
|
|
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
|
-
})
|
|
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))));
|
|
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,
|