versacall-core-library-react 2.0.50 → 2.0.51
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.
|
@@ -85,18 +85,26 @@ function CoreToolbar(props) {
|
|
|
85
85
|
warning = props.warning,
|
|
86
86
|
intl = props.intl,
|
|
87
87
|
classes = props.classes,
|
|
88
|
-
showSeperator = props.showSeperator
|
|
88
|
+
showSeperator = props.showSeperator,
|
|
89
|
+
disableHotkeys = props.disableHotkeys,
|
|
90
|
+
saveDisabled = props.saveDisabled,
|
|
91
|
+
handleSave = props.handleSave;
|
|
92
|
+
/* const propsRef = useRef(props);
|
|
93
|
+
useLayoutEffect(() => {
|
|
94
|
+
propsRef.current = props;
|
|
95
|
+
}); */
|
|
96
|
+
|
|
89
97
|
var handleKeyDown = (0, _react.useCallback)(function (e) {
|
|
90
98
|
// NOTE: In theory it would be good to have a hotkey for the close button.
|
|
91
|
-
if (!
|
|
99
|
+
if (!disableHotkeys) {
|
|
92
100
|
// Look for CTRL+S or META+S
|
|
93
101
|
if ((window.navigator.platform.match('Mac') ? e.metaKey : e.ctrlKey) && e.keyCode === 83) {
|
|
94
102
|
// CTRL+S or META+S (Mac)
|
|
95
103
|
e.preventDefault();
|
|
96
104
|
|
|
97
|
-
if (!
|
|
105
|
+
if (!saveDisabled) {
|
|
98
106
|
console.log('calling save');
|
|
99
|
-
|
|
107
|
+
handleSave();
|
|
100
108
|
} else {
|
|
101
109
|
console.log('save disabled');
|
|
102
110
|
}
|
|
@@ -117,7 +125,7 @@ function CoreToolbar(props) {
|
|
|
117
125
|
} else {
|
|
118
126
|
console.log('hotkeys disabled');
|
|
119
127
|
}
|
|
120
|
-
}, []);
|
|
128
|
+
}, [disableHotkeys, saveDisabled, handleSave]);
|
|
121
129
|
|
|
122
130
|
_react.default.useEffect(function () {
|
|
123
131
|
document.addEventListener('keydown', handleKeyDown); // cleanup
|
|
@@ -125,7 +133,7 @@ function CoreToolbar(props) {
|
|
|
125
133
|
return function () {
|
|
126
134
|
document.removeEventListener('keydown', handleKeyDown);
|
|
127
135
|
};
|
|
128
|
-
}, [handleKeyDown]);
|
|
136
|
+
}, [handleKeyDown, disableHotkeys, saveDisabled, handleSave]);
|
|
129
137
|
|
|
130
138
|
return /*#__PURE__*/_react.default.createElement(_Toolbar.default, null, props.icon, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
131
139
|
variant: "h6",
|
package/package.json
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
"versacall": {
|
|
3
3
|
"title": "Versacall Core Library React",
|
|
4
4
|
"applicationType": "react-library",
|
|
5
|
-
"build":
|
|
5
|
+
"build": 51
|
|
6
6
|
},
|
|
7
7
|
"name": "versacall-core-library-react",
|
|
8
|
-
"version": "2.0.
|
|
8
|
+
"version": "2.0.51",
|
|
9
9
|
"description": "Versacall Core Library",
|
|
10
10
|
"main": "dist/index.js",
|
|
11
11
|
"module": "dist/index.js",
|