@yorab/react-paint 0.7.1 → 0.7.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.
@@ -185,6 +185,7 @@ const Canvas = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
185
185
  shape: selectedShape,
186
186
  defaultValue: selectionMode.defaultValue,
187
187
  updateValue: updateSelectedShapeText,
188
+ saveShapes: saveShapes,
188
189
  selectionPadding: selectionPadding
189
190
  })));
190
191
  });
@@ -73,9 +73,11 @@ const EditTextBox = _ref7 => {
73
73
  shape,
74
74
  defaultValue,
75
75
  updateValue,
76
+ saveShapes,
76
77
  selectionPadding
77
78
  } = _ref7;
78
79
  const ref = (0, _react.useRef)(null);
80
+ const saveShapesRef = (0, _react.useRef)(saveShapes);
79
81
 
80
82
  const updateContentEditable = e => {
81
83
  updateValue((0, _string.convertDivContentToStringArray)(e.target.innerHTML));
@@ -100,6 +102,12 @@ const EditTextBox = _ref7 => {
100
102
  currentNode.removeEventListener('paste', handlePaste);
101
103
  };
102
104
  }, [defaultValue]);
105
+ (0, _react.useEffect)(() => {
106
+ const saveText = saveShapesRef.current;
107
+ return () => {
108
+ saveText();
109
+ };
110
+ }, []);
103
111
  const position = (0, _react.useMemo)(() => {
104
112
  const {
105
113
  borders,
@@ -107,7 +115,7 @@ const EditTextBox = _ref7 => {
107
115
  } = (0, _shapes.getShapeInfos)(shape, selectionPadding);
108
116
  return (0, _trigo.rotatePoint)({
109
117
  point: [borders.x, borders.y],
110
- rotation: shape.rotation,
118
+ rotation: -shape.rotation,
111
119
  origin: center
112
120
  });
113
121
  }, [shape, selectionPadding]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yorab/react-paint",
3
- "version": "0.7.1",
3
+ "version": "0.7.2",
4
4
  "keywords": [],
5
5
  "author": "Yohann Rabatel",
6
6
  "license": "MIT",