@windoc/react 0.3.16 → 0.3.18
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.d.mts +10 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +35 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +35 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -99,6 +99,10 @@ type EditorInstance = {
|
|
|
99
99
|
footer: {
|
|
100
100
|
disabled: boolean;
|
|
101
101
|
};
|
|
102
|
+
scale: number;
|
|
103
|
+
paperDirection: string;
|
|
104
|
+
width: number;
|
|
105
|
+
height: number;
|
|
102
106
|
[key: string]: unknown;
|
|
103
107
|
};
|
|
104
108
|
executeUpdateOptions: (options: object) => void;
|
|
@@ -312,6 +316,9 @@ interface FooterContextValue {
|
|
|
312
316
|
rowNo: number;
|
|
313
317
|
colNo: number;
|
|
314
318
|
pageScale: number;
|
|
319
|
+
paperDirection: string;
|
|
320
|
+
paperWidth: number;
|
|
321
|
+
paperHeight: number;
|
|
315
322
|
setPageNoList: (v: string) => void;
|
|
316
323
|
setPageNo: (v: number) => void;
|
|
317
324
|
setPageSize: (v: number) => void;
|
|
@@ -319,6 +326,9 @@ interface FooterContextValue {
|
|
|
319
326
|
setRowNo: (v: number) => void;
|
|
320
327
|
setColNo: (v: number) => void;
|
|
321
328
|
setPageScale: (v: number) => void;
|
|
329
|
+
setPaperDirection: (v: string) => void;
|
|
330
|
+
setPaperWidth: (v: number) => void;
|
|
331
|
+
setPaperHeight: (v: number) => void;
|
|
322
332
|
handleToggleCatalogAction?: () => void;
|
|
323
333
|
}
|
|
324
334
|
declare function FooterProvider({ handleToggleCatalogAction, children }: {
|
package/dist/index.d.ts
CHANGED
|
@@ -99,6 +99,10 @@ type EditorInstance = {
|
|
|
99
99
|
footer: {
|
|
100
100
|
disabled: boolean;
|
|
101
101
|
};
|
|
102
|
+
scale: number;
|
|
103
|
+
paperDirection: string;
|
|
104
|
+
width: number;
|
|
105
|
+
height: number;
|
|
102
106
|
[key: string]: unknown;
|
|
103
107
|
};
|
|
104
108
|
executeUpdateOptions: (options: object) => void;
|
|
@@ -312,6 +316,9 @@ interface FooterContextValue {
|
|
|
312
316
|
rowNo: number;
|
|
313
317
|
colNo: number;
|
|
314
318
|
pageScale: number;
|
|
319
|
+
paperDirection: string;
|
|
320
|
+
paperWidth: number;
|
|
321
|
+
paperHeight: number;
|
|
315
322
|
setPageNoList: (v: string) => void;
|
|
316
323
|
setPageNo: (v: number) => void;
|
|
317
324
|
setPageSize: (v: number) => void;
|
|
@@ -319,6 +326,9 @@ interface FooterContextValue {
|
|
|
319
326
|
setRowNo: (v: number) => void;
|
|
320
327
|
setColNo: (v: number) => void;
|
|
321
328
|
setPageScale: (v: number) => void;
|
|
329
|
+
setPaperDirection: (v: string) => void;
|
|
330
|
+
setPaperWidth: (v: number) => void;
|
|
331
|
+
setPaperHeight: (v: number) => void;
|
|
322
332
|
handleToggleCatalogAction?: () => void;
|
|
323
333
|
}
|
|
324
334
|
declare function FooterProvider({ handleToggleCatalogAction, children }: {
|
package/dist/index.js
CHANGED
|
@@ -118,6 +118,9 @@ function FooterProvider({
|
|
|
118
118
|
const [rowNo, setRowNo] = (0, import_react2.useState)(0);
|
|
119
119
|
const [colNo, setColNo] = (0, import_react2.useState)(0);
|
|
120
120
|
const [pageScale, setPageScale] = (0, import_react2.useState)(100);
|
|
121
|
+
const [paperDirection, setPaperDirection] = (0, import_react2.useState)("vertical");
|
|
122
|
+
const [paperWidth, setPaperWidth] = (0, import_react2.useState)(794);
|
|
123
|
+
const [paperHeight, setPaperHeight] = (0, import_react2.useState)(1123);
|
|
121
124
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
122
125
|
FooterContext.Provider,
|
|
123
126
|
{
|
|
@@ -129,6 +132,9 @@ function FooterProvider({
|
|
|
129
132
|
rowNo,
|
|
130
133
|
colNo,
|
|
131
134
|
pageScale,
|
|
135
|
+
paperDirection,
|
|
136
|
+
paperWidth,
|
|
137
|
+
paperHeight,
|
|
132
138
|
setPageNoList,
|
|
133
139
|
setPageNo,
|
|
134
140
|
setPageSize,
|
|
@@ -136,6 +142,9 @@ function FooterProvider({
|
|
|
136
142
|
setRowNo,
|
|
137
143
|
setColNo,
|
|
138
144
|
setPageScale,
|
|
145
|
+
setPaperDirection,
|
|
146
|
+
setPaperWidth,
|
|
147
|
+
setPaperHeight,
|
|
139
148
|
handleToggleCatalogAction
|
|
140
149
|
},
|
|
141
150
|
children
|
|
@@ -1859,25 +1868,28 @@ function PageScaleAddTool() {
|
|
|
1859
1868
|
var import_react21 = require("react");
|
|
1860
1869
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
1861
1870
|
var SIZES2 = [
|
|
1862
|
-
{ label: "A4", width: 794, height: 1123
|
|
1871
|
+
{ label: "A4", width: 794, height: 1123 },
|
|
1863
1872
|
{ label: "A2", width: 1593, height: 2251 },
|
|
1864
1873
|
{ label: "A3", width: 1125, height: 1593 },
|
|
1865
1874
|
{ label: "A5", width: 565, height: 796 }
|
|
1866
1875
|
];
|
|
1867
1876
|
function PaperSizeTool() {
|
|
1868
1877
|
const { editorRef } = useEditor();
|
|
1878
|
+
const { paperWidth, paperHeight, setPaperWidth, setPaperHeight } = useFooter();
|
|
1869
1879
|
const [visible, setVisible] = (0, import_react21.useState)(false);
|
|
1870
1880
|
const handlePaperSize = (width, height) => {
|
|
1871
1881
|
editorRef.current?.command.executePaperSize(width, height);
|
|
1882
|
+
setPaperWidth(width);
|
|
1883
|
+
setPaperHeight(height);
|
|
1872
1884
|
setVisible(false);
|
|
1873
1885
|
};
|
|
1874
1886
|
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "paper-size", onClick: () => setVisible(!visible), children: [
|
|
1875
1887
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("i", { title: "Paper Type" }),
|
|
1876
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: `options ${visible ? "visible" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("ul", { children: SIZES2.map(({ label, width, height
|
|
1888
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: `options ${visible ? "visible" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("ul", { children: SIZES2.map(({ label, width, height }) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
1877
1889
|
"li",
|
|
1878
1890
|
{
|
|
1879
1891
|
onClick: () => handlePaperSize(width, height),
|
|
1880
|
-
className:
|
|
1892
|
+
className: paperWidth === width && paperHeight === height ? "active" : "",
|
|
1881
1893
|
children: label
|
|
1882
1894
|
},
|
|
1883
1895
|
label
|
|
@@ -1890,9 +1902,11 @@ var import_react22 = require("react");
|
|
|
1890
1902
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
1891
1903
|
function PaperDirectionTool() {
|
|
1892
1904
|
const { editorRef } = useEditor();
|
|
1905
|
+
const { paperDirection, setPaperDirection } = useFooter();
|
|
1893
1906
|
const [visible, setVisible] = (0, import_react22.useState)(false);
|
|
1894
1907
|
const handlePaperDirection = (direction) => {
|
|
1895
1908
|
editorRef.current?.command.executePaperDirection(direction);
|
|
1909
|
+
setPaperDirection(direction);
|
|
1896
1910
|
setVisible(false);
|
|
1897
1911
|
};
|
|
1898
1912
|
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "paper-direction", onClick: () => setVisible(!visible), children: [
|
|
@@ -1902,11 +1916,18 @@ function PaperDirectionTool() {
|
|
|
1902
1916
|
"li",
|
|
1903
1917
|
{
|
|
1904
1918
|
onClick: () => handlePaperDirection("vertical"),
|
|
1905
|
-
className: "active",
|
|
1919
|
+
className: paperDirection === "vertical" ? "active" : "",
|
|
1906
1920
|
children: "Portrait"
|
|
1907
1921
|
}
|
|
1908
1922
|
),
|
|
1909
|
-
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
1923
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
1924
|
+
"li",
|
|
1925
|
+
{
|
|
1926
|
+
onClick: () => handlePaperDirection("horizontal"),
|
|
1927
|
+
className: paperDirection === "horizontal" ? "active" : "",
|
|
1928
|
+
children: "Landscape"
|
|
1929
|
+
}
|
|
1930
|
+
)
|
|
1910
1931
|
] }) })
|
|
1911
1932
|
] });
|
|
1912
1933
|
}
|
|
@@ -2469,7 +2490,10 @@ function EditorInner({
|
|
|
2469
2490
|
setWordCount,
|
|
2470
2491
|
setRowNo,
|
|
2471
2492
|
setColNo,
|
|
2472
|
-
setPageScale
|
|
2493
|
+
setPageScale,
|
|
2494
|
+
setPaperDirection,
|
|
2495
|
+
setPaperWidth,
|
|
2496
|
+
setPaperHeight
|
|
2473
2497
|
} = useFooter();
|
|
2474
2498
|
(0, import_react24.useEffect)(() => {
|
|
2475
2499
|
let instance = null;
|
|
@@ -2494,6 +2518,11 @@ function EditorInner({
|
|
|
2494
2518
|
{ maskMargin: [24, 0, 24, 0], ...userOptions }
|
|
2495
2519
|
);
|
|
2496
2520
|
editorRef.current = instance;
|
|
2521
|
+
const opts = instance.command.getOptions();
|
|
2522
|
+
setPageScale(Math.round(opts.scale * 100));
|
|
2523
|
+
setPaperDirection(opts.paperDirection);
|
|
2524
|
+
setPaperWidth(opts.width);
|
|
2525
|
+
setPaperHeight(opts.height);
|
|
2497
2526
|
instance.listener.rangeStyleChange = (payload) => {
|
|
2498
2527
|
setRangeStyle(payload);
|
|
2499
2528
|
onRangeStyleChange?.(payload);
|