@fileverse-dev/fortune-react 1.1.4-live-query-1 → 1.1.5-live-query-2
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useCallback, useContext, useRef, useState } from "react";
|
|
1
|
+
import React, { useCallback, useContext, useRef, useState, useEffect } from "react";
|
|
2
2
|
import { MAX_ZOOM_RATIO, MIN_ZOOM_RATIO, getSheetIndex } from "@fileverse-dev/fortune-core";
|
|
3
3
|
import WorkbookContext from "../../context";
|
|
4
4
|
import SVGIcon from "../SVGIcon";
|
|
@@ -59,6 +59,21 @@ var ZoomControl = function ZoomControl() {
|
|
|
59
59
|
noHistory: true
|
|
60
60
|
});
|
|
61
61
|
}, [setContext]);
|
|
62
|
+
useEffect(function () {
|
|
63
|
+
var handleKeyDown = function handleKeyDown(e) {
|
|
64
|
+
if ((e.metaKey || e.ctrlKey) && e.code === "Equal") {
|
|
65
|
+
zoomTo(context.zoomRatio + 0.1);
|
|
66
|
+
e.stopPropagation();
|
|
67
|
+
} else if ((e.metaKey || e.ctrlKey) && e.code === "Minus") {
|
|
68
|
+
zoomTo(context.zoomRatio - 0.1);
|
|
69
|
+
e.stopPropagation();
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
73
|
+
return function () {
|
|
74
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
75
|
+
};
|
|
76
|
+
}, [context.zoomRatio]);
|
|
62
77
|
return /*#__PURE__*/React.createElement("div", {
|
|
63
78
|
className: "fortune-zoom-container"
|
|
64
79
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -68,6 +68,21 @@ var ZoomControl = function ZoomControl() {
|
|
|
68
68
|
noHistory: true
|
|
69
69
|
});
|
|
70
70
|
}, [setContext]);
|
|
71
|
+
(0, _react.useEffect)(function () {
|
|
72
|
+
var handleKeyDown = function handleKeyDown(e) {
|
|
73
|
+
if ((e.metaKey || e.ctrlKey) && e.code === "Equal") {
|
|
74
|
+
zoomTo(context.zoomRatio + 0.1);
|
|
75
|
+
e.stopPropagation();
|
|
76
|
+
} else if ((e.metaKey || e.ctrlKey) && e.code === "Minus") {
|
|
77
|
+
zoomTo(context.zoomRatio - 0.1);
|
|
78
|
+
e.stopPropagation();
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
82
|
+
return function () {
|
|
83
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
84
|
+
};
|
|
85
|
+
}, [context.zoomRatio]);
|
|
71
86
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
72
87
|
className: "fortune-zoom-container"
|
|
73
88
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fileverse-dev/fortune-react",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.5-live-query-2",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"types": "lib/index.d.ts",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"tsc": "tsc"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@fileverse-dev/fortune-core": "1.1.
|
|
19
|
+
"@fileverse-dev/fortune-core": "1.1.5-live-query-2",
|
|
20
20
|
"@fileverse/ui": "^4.1.7-patch-21",
|
|
21
21
|
"@tippyjs/react": "^4.2.6",
|
|
22
22
|
"@types/regenerator-runtime": "^0.13.6",
|