@windoc/react 0.2.2 → 0.2.4
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.js +14 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -14
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/styles/editor.css +24 -0
package/dist/index.js
CHANGED
|
@@ -217,10 +217,10 @@ function useDropdown() {
|
|
|
217
217
|
// src/utils/DropdownPortal.tsx
|
|
218
218
|
var import_react_dom = require("react-dom");
|
|
219
219
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
220
|
-
function DropdownPortal({ isOpen, style, className, children }) {
|
|
220
|
+
function DropdownPortal({ isOpen, style, className, wrapperClassName, children }) {
|
|
221
221
|
if (!isOpen) return null;
|
|
222
222
|
return (0, import_react_dom.createPortal)(
|
|
223
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className:
|
|
223
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: `menu-item menu-item-portal${wrapperClassName ? ` ${wrapperClassName}` : ""}`, style, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className, children }) }),
|
|
224
224
|
document.body
|
|
225
225
|
);
|
|
226
226
|
}
|
|
@@ -243,7 +243,7 @@ function ColumnTool() {
|
|
|
243
243
|
};
|
|
244
244
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "menu-item__column", ref: triggerRef, onClick: toggle, children: [
|
|
245
245
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "select", title: "Column Layout", children: currentColumns === 1 ? "1 Column" : `${currentColumns} Columns` }),
|
|
246
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DropdownPortal, { isOpen, style: portalStyle, className: "options visible", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { onClick: (e) => e.stopPropagation(), children: [
|
|
246
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DropdownPortal, { isOpen, style: portalStyle, className: "options visible", wrapperClassName: "menu-item__column", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { onClick: (e) => e.stopPropagation(), children: [
|
|
247
247
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("ul", { children: [
|
|
248
248
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("li", { onClick: () => handleColumn(1), children: "1 Column" }),
|
|
249
249
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("li", { onClick: () => handleColumn(2), children: "2 Columns" })
|
|
@@ -339,7 +339,7 @@ function TitleTool() {
|
|
|
339
339
|
};
|
|
340
340
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "menu-item__title", ref: triggerRef, onClick: toggle, children: [
|
|
341
341
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "select", title: "Toggle Heading", children: activeLabel }),
|
|
342
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DropdownPortal, { isOpen, style: portalStyle, className: "options visible", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("ul", { children: LEVELS.map(({ level, label }) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
342
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DropdownPortal, { isOpen, style: portalStyle, className: "options visible", wrapperClassName: "menu-item__title", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("ul", { children: LEVELS.map(({ level, label }) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
343
343
|
"li",
|
|
344
344
|
{
|
|
345
345
|
className: activeLevel === level ? "active" : "",
|
|
@@ -368,7 +368,7 @@ function FontTool() {
|
|
|
368
368
|
};
|
|
369
369
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "menu-item__font", ref: triggerRef, onClick: toggle, children: [
|
|
370
370
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "select", title: "Font", children: activeLabel }),
|
|
371
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DropdownPortal, { isOpen, style: portalStyle, className: "options visible", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("ul", { children: FONTS.map(({ family, label }) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
371
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DropdownPortal, { isOpen, style: portalStyle, className: "options visible", wrapperClassName: "menu-item__font", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("ul", { children: FONTS.map(({ family, label }) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
372
372
|
"li",
|
|
373
373
|
{
|
|
374
374
|
"data-family": family,
|
|
@@ -394,7 +394,7 @@ function FontSizeTool() {
|
|
|
394
394
|
};
|
|
395
395
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "menu-item__size", ref: triggerRef, onClick: toggle, children: [
|
|
396
396
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "select", title: "Font Size", children: activeSize }),
|
|
397
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DropdownPortal, { isOpen, style: portalStyle, className: "options visible", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("ul", { children: SIZES.map((size) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
397
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DropdownPortal, { isOpen, style: portalStyle, className: "options visible", wrapperClassName: "menu-item__size", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("ul", { children: SIZES.map((size) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
398
398
|
"li",
|
|
399
399
|
{
|
|
400
400
|
className: activeSize === size ? "active" : "",
|
|
@@ -419,7 +419,7 @@ function LineHeightTool() {
|
|
|
419
419
|
};
|
|
420
420
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "menu-item__line-height", ref: triggerRef, onClick: toggle, children: [
|
|
421
421
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "select", title: "Line Height", children: activeLabel }),
|
|
422
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(DropdownPortal, { isOpen, style: portalStyle, className: "options visible", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("ul", { children: LINE_HEIGHTS.map((h) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
422
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(DropdownPortal, { isOpen, style: portalStyle, className: "options visible", wrapperClassName: "menu-item__line-height", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("ul", { children: LINE_HEIGHTS.map((h) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
423
423
|
"li",
|
|
424
424
|
{
|
|
425
425
|
className: String(activeMargin) === h || activeLabel === h ? "active" : "",
|
|
@@ -458,7 +458,7 @@ function ColorTool() {
|
|
|
458
458
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react4.Baseline, { size: 16 }),
|
|
459
459
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: { backgroundColor: activeColor } }),
|
|
460
460
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("input", { id: "color", type: "color", readOnly: true, tabIndex: -1 }),
|
|
461
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(DropdownPortal, { isOpen: visible, style: portalStyle, className: "color-palette-dropdown", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { onClick: (e) => e.stopPropagation(), children: [
|
|
461
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(DropdownPortal, { isOpen: visible, style: portalStyle, className: "color-palette-dropdown", wrapperClassName: "menu-item__color", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { onClick: (e) => e.stopPropagation(), children: [
|
|
462
462
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("button", { className: "color-palette-reset", onClick: handleReset, children: [
|
|
463
463
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react4.RotateCcw, { size: 12 }),
|
|
464
464
|
"Reset"
|
|
@@ -504,7 +504,7 @@ function HighlightTool() {
|
|
|
504
504
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react5.Highlighter, { size: 16 }),
|
|
505
505
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { style: { backgroundColor: activeColor || "#ffff00" } }),
|
|
506
506
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("input", { id: "highlight", type: "color", readOnly: true, tabIndex: -1 }),
|
|
507
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DropdownPortal, { isOpen: visible, style: portalStyle, className: "color-palette-dropdown", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { onClick: (e) => e.stopPropagation(), children: [
|
|
507
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DropdownPortal, { isOpen: visible, style: portalStyle, className: "color-palette-dropdown", wrapperClassName: "menu-item__highlight", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { onClick: (e) => e.stopPropagation(), children: [
|
|
508
508
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("button", { className: "color-palette-reset", onClick: handleReset, children: [
|
|
509
509
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react5.RotateCcw, { size: 12 }),
|
|
510
510
|
"None"
|
|
@@ -552,7 +552,7 @@ function UnderlineTool() {
|
|
|
552
552
|
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: `menu-item__underline ${isActive ? "active" : ""}`, ref: triggerRef, title: `Underline(${isApple ? "\u2318" : "Ctrl"}+U)`, children: [
|
|
553
553
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react8.Underline, { size: 16, onClick: () => editorRef.current?.command.executeUnderline(), style: { cursor: "pointer" } }),
|
|
554
554
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "select", onClick: toggle }),
|
|
555
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(DropdownPortal, { isOpen, style: portalStyle, className: "options visible", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("ul", { children: STYLES.map((style) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("li", { "data-decoration-style": style, onClick: () => {
|
|
555
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(DropdownPortal, { isOpen, style: portalStyle, className: "options visible", wrapperClassName: "menu-item__underline", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("ul", { children: STYLES.map((style) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("li", { "data-decoration-style": style, onClick: () => {
|
|
556
556
|
editorRef.current?.command.executeUnderline({ style });
|
|
557
557
|
}, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("i", {}) }, style)) }) })
|
|
558
558
|
] });
|
|
@@ -657,7 +657,7 @@ function ListTool() {
|
|
|
657
657
|
};
|
|
658
658
|
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { ref: triggerRef, className: `menu-item__list ${isActive ? "active" : ""}`, title: `List(${isApple ? "\u2318" : "Ctrl"}+Shift+U)`, children: [
|
|
659
659
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react14.List, { size: 16, onClick: toggle, style: { cursor: "pointer" } }),
|
|
660
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropdownPortal, { isOpen, style: portalStyle, className: "options visible", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { style: { padding: "8px", width: "320px" }, children: [
|
|
660
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropdownPortal, { isOpen, style: portalStyle, className: "options visible", wrapperClassName: "menu-item__list", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { style: { padding: "8px", width: "320px" }, children: [
|
|
661
661
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { style: { display: "flex", gap: "4px", marginBottom: "8px" }, children: [
|
|
662
662
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
663
663
|
"button",
|
|
@@ -756,7 +756,7 @@ function SeparatorTool() {
|
|
|
756
756
|
};
|
|
757
757
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "menu-item__separator", ref: triggerRef, title: "Separator", children: [
|
|
758
758
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react16.Minus, { size: 16, onClick: toggle, style: { cursor: "pointer" } }),
|
|
759
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DropdownPortal, { isOpen, style: portalStyle, className: "options visible", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { style: { padding: "8px 10px 10px", width: "200px" }, children: [
|
|
759
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DropdownPortal, { isOpen, style: portalStyle, className: "options visible", wrapperClassName: "menu-item__separator", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { style: { padding: "8px 10px 10px", width: "200px" }, children: [
|
|
760
760
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("ul", { style: { margin: 0, padding: 0, listStyle: "none" }, children: DASH_STYLES.map(({ label, dashArray }) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
761
761
|
"li",
|
|
762
762
|
{
|
|
@@ -825,7 +825,7 @@ function InsertElementTool() {
|
|
|
825
825
|
};
|
|
826
826
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "menu-item__insert-element", ref: triggerRef, onClick: toggle, children: [
|
|
827
827
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("i", { title: "Insert Element" }),
|
|
828
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropdownPortal, { isOpen, style: portalStyle, className: "options visible", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("ul", { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("li", { onClick: handleHeader, children: "Add Header" }) }) })
|
|
828
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropdownPortal, { isOpen, style: portalStyle, className: "options visible", wrapperClassName: "menu-item__insert-element", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("ul", { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("li", { onClick: handleHeader, children: "Add Header" }) }) })
|
|
829
829
|
] });
|
|
830
830
|
}
|
|
831
831
|
|
|
@@ -848,7 +848,7 @@ function PageBreakTool() {
|
|
|
848
848
|
onClick: toggle,
|
|
849
849
|
children: [
|
|
850
850
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("i", { title: "Break" }),
|
|
851
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DropdownPortal, { isOpen, style: portalStyle, className: "options visible", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("ul", { children: [
|
|
851
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DropdownPortal, { isOpen, style: portalStyle, className: "options visible", wrapperClassName: "menu-item__page-break", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("ul", { children: [
|
|
852
852
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("li", { onClick: handlePageBreak, children: "Page Break" }),
|
|
853
853
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("li", { onClick: handleColumnBreak, children: "Column Break" })
|
|
854
854
|
] }) })
|