@windoc/react 0.2.11 → 0.3.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.mjs CHANGED
@@ -529,24 +529,29 @@ function ListTool() {
529
529
  const { editorRef, isApple, rangeStyle } = useEditor();
530
530
  const optionsRef = useRef10(null);
531
531
  const isActive = !!rangeStyle?.listType;
532
+ const close = () => optionsRef.current?.classList.remove("visible");
532
533
  const handleList = (type, style) => {
533
534
  editorRef.current?.command.executeList(type, style);
535
+ close();
534
536
  };
535
537
  const handlePreset = (type, preset) => {
536
538
  const style = type === "ol" ? "decimal" : "disc";
537
539
  editorRef.current?.command.executeListWithPreset(type, style, preset);
540
+ close();
538
541
  };
539
542
  const handleIndent = (e) => {
540
543
  e.stopPropagation();
541
544
  editorRef.current?.command.executeListIndent();
545
+ close();
542
546
  };
543
547
  const handleOutdent = (e) => {
544
548
  e.stopPropagation();
545
549
  editorRef.current?.command.executeListOutdent();
550
+ close();
546
551
  };
547
552
  return /* @__PURE__ */ jsxs10("div", { className: `menu-item__list ${isActive ? "active" : ""}`, title: `List(${isApple ? "\u2318" : "Ctrl"}+Shift+U)`, children: [
548
553
  /* @__PURE__ */ jsx21(List, { size: 16, onClick: () => optionsRef.current?.classList.toggle("visible"), style: { cursor: "pointer" } }),
549
- /* @__PURE__ */ jsx21("div", { className: "options", ref: optionsRef, children: /* @__PURE__ */ jsxs10("div", { style: { padding: "8px", width: "320px" }, children: [
554
+ /* @__PURE__ */ jsx21("div", { className: "options", ref: optionsRef, style: { width: "320px" }, children: /* @__PURE__ */ jsxs10("div", { style: { padding: "8px" }, children: [
550
555
  /* @__PURE__ */ jsxs10("div", { style: { display: "flex", gap: "4px", marginBottom: "8px" }, children: [
551
556
  /* @__PURE__ */ jsx21(
552
557
  "button",
@@ -640,16 +645,18 @@ function SeparatorTool() {
640
645
  const optionsRef = useRef11(null);
641
646
  const [selectedWidth, setSelectedWidth] = useState5(1);
642
647
  const lineColor = "#344054";
643
- const handleSeparator = (dashArray) => {
648
+ const handleSeparator = (e, dashArray) => {
649
+ e.stopPropagation();
644
650
  editorRef.current?.command.executeSeparator(dashArray, { lineWidth: selectedWidth });
651
+ optionsRef.current?.classList.remove("visible");
645
652
  };
646
- return /* @__PURE__ */ jsxs12("div", { className: "menu-item__separator", title: "Separator", children: [
647
- /* @__PURE__ */ jsx23(Minus, { size: 16, onClick: () => optionsRef.current?.classList.toggle("visible"), style: { cursor: "pointer" } }),
648
- /* @__PURE__ */ jsx23("div", { className: "options", ref: optionsRef, children: /* @__PURE__ */ jsxs12("div", { style: { padding: "8px 10px 10px", width: "200px" }, children: [
653
+ return /* @__PURE__ */ jsx23("div", { className: "menu-item", title: "Separator", children: /* @__PURE__ */ jsxs12("span", { className: "menu-item__separator", onClick: () => optionsRef.current?.classList.toggle("visible"), style: { display: "flex", alignItems: "center", justifyContent: "center", width: "28px", height: "28px", cursor: "pointer", margin: "0 2px", borderRadius: "8px", color: "#475467", transition: "all 0.2s", position: "relative" }, children: [
654
+ /* @__PURE__ */ jsx23(Minus, { size: 16 }),
655
+ /* @__PURE__ */ jsx23("div", { className: "options", ref: optionsRef, style: { width: "220px", height: "auto" }, children: /* @__PURE__ */ jsxs12("div", { style: { padding: "8px 10px 10px" }, children: [
649
656
  /* @__PURE__ */ jsx23("ul", { style: { margin: 0, padding: 0, listStyle: "none" }, children: DASH_STYLES.map(({ label, dashArray }) => /* @__PURE__ */ jsxs12(
650
657
  "li",
651
658
  {
652
- onClick: () => handleSeparator(dashArray),
659
+ onClick: (e) => handleSeparator(e, dashArray),
653
660
  style: { display: "flex", alignItems: "center", gap: "10px", padding: "5px 6px", cursor: "pointer", borderRadius: "4px" },
654
661
  children: [
655
662
  /* @__PURE__ */ jsx23("svg", { style: { flex: 1, minWidth: 0, overflow: "hidden" }, height: "8", children: /* @__PURE__ */ jsx23(
@@ -695,7 +702,7 @@ function SeparatorTool() {
695
702
  )) })
696
703
  ] })
697
704
  ] }) })
698
- ] });
705
+ ] }) });
699
706
  }
700
707
 
701
708
  // src/toolbar/WatermarkTool.tsx