versacall-core-library-react 2.0.49 → 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,17 +85,28 @@ 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 (!
|
|
98
|
-
|
|
105
|
+
if (!saveDisabled) {
|
|
106
|
+
console.log('calling save');
|
|
107
|
+
handleSave();
|
|
108
|
+
} else {
|
|
109
|
+
console.log('save disabled');
|
|
99
110
|
}
|
|
100
111
|
/* } else if (e.altKey && e.keyCode === 115) {
|
|
101
112
|
// ALT+F4
|
|
@@ -111,16 +122,18 @@ function CoreToolbar(props) {
|
|
|
111
122
|
} */
|
|
112
123
|
|
|
113
124
|
}
|
|
125
|
+
} else {
|
|
126
|
+
console.log('hotkeys disabled');
|
|
114
127
|
}
|
|
115
|
-
}, []);
|
|
128
|
+
}, [disableHotkeys, saveDisabled, handleSave]);
|
|
116
129
|
|
|
117
130
|
_react.default.useEffect(function () {
|
|
118
|
-
|
|
131
|
+
document.addEventListener('keydown', handleKeyDown); // cleanup
|
|
119
132
|
|
|
120
133
|
return function () {
|
|
121
|
-
|
|
134
|
+
document.removeEventListener('keydown', handleKeyDown);
|
|
122
135
|
};
|
|
123
|
-
}, [handleKeyDown]);
|
|
136
|
+
}, [handleKeyDown, disableHotkeys, saveDisabled, handleSave]);
|
|
124
137
|
|
|
125
138
|
return /*#__PURE__*/_react.default.createElement(_Toolbar.default, null, props.icon, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
126
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",
|