versacall-core-library-react 2.0.50 → 2.0.52

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,20 +85,27 @@ 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 (!props.disableHotkeys) {
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 (!props.saveDisabled) {
98
- console.log('calling save');
99
- props.handleSave();
100
- } else {
101
- console.log('save disabled');
105
+ if (!saveDisabled) {
106
+ // console.log('calling save');
107
+ handleSave();
108
+ } else {// console.log('save disabled');
102
109
  }
103
110
  /* } else if (e.altKey && e.keyCode === 115) {
104
111
  // ALT+F4
@@ -114,10 +121,9 @@ function CoreToolbar(props) {
114
121
  } */
115
122
 
116
123
  }
117
- } else {
118
- console.log('hotkeys disabled');
124
+ } else {// console.log('hotkeys disabled');
119
125
  }
120
- }, []);
126
+ }, [disableHotkeys, saveDisabled, handleSave]);
121
127
 
122
128
  _react.default.useEffect(function () {
123
129
  document.addEventListener('keydown', handleKeyDown); // cleanup
@@ -125,7 +131,7 @@ function CoreToolbar(props) {
125
131
  return function () {
126
132
  document.removeEventListener('keydown', handleKeyDown);
127
133
  };
128
- }, [handleKeyDown]);
134
+ }, [handleKeyDown, disableHotkeys, saveDisabled, handleSave]);
129
135
 
130
136
  return /*#__PURE__*/_react.default.createElement(_Toolbar.default, null, props.icon, /*#__PURE__*/_react.default.createElement(_Typography.default, {
131
137
  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": 50
5
+ "build": 52
6
6
  },
7
7
  "name": "versacall-core-library-react",
8
- "version": "2.0.50",
8
+ "version": "2.0.52",
9
9
  "description": "Versacall Core Library",
10
10
  "main": "dist/index.js",
11
11
  "module": "dist/index.js",