@fileverse-dev/fortune-react 1.3.10-input → 1.3.10-input-1

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.
@@ -129,6 +129,8 @@ var InputBox = function InputBox() {
129
129
  var flowdata = getFlowdata(context);
130
130
  var cell = (_a = flowdata === null || flowdata === void 0 ? void 0 : flowdata[row_index]) === null || _a === void 0 ? void 0 : _a[col_index];
131
131
  var value_1 = "";
132
+ var wasOverwrite = refs.globalCache.overwriteCell;
133
+ var overwriteFirstChar = refs.globalCache.overwriteCellFirstChar;
132
134
  if (cell && !refs.globalCache.overwriteCell) {
133
135
  if (isInlineStringCell(cell)) {
134
136
  value_1 = getInlineStringHTML(row_index, col_index, flowdata);
@@ -145,9 +147,15 @@ var InputBox = function InputBox() {
145
147
  }
146
148
  }
147
149
  refs.globalCache.overwriteCell = false;
148
- if (!refs.globalCache.ignoreWriteCell && inputRef.current && value_1) {
150
+ delete refs.globalCache.overwriteCellFirstChar;
151
+ if (wasOverwrite && inputRef.current) {
152
+ inputRef.current.innerText = overwriteFirstChar !== null && overwriteFirstChar !== void 0 ? overwriteFirstChar : "";
153
+ if (overwriteFirstChar) {
154
+ moveToEnd(inputRef.current);
155
+ }
156
+ } else if (!refs.globalCache.ignoreWriteCell && inputRef.current && value_1) {
149
157
  inputRef.current.innerHTML = escapeHTMLTag(escapeScriptTag(value_1));
150
- } else if (!refs.globalCache.ignoreWriteCell && inputRef.current && !value_1) {
158
+ } else if (!refs.globalCache.ignoreWriteCell && inputRef.current && !value_1 && !wasOverwrite) {
151
159
  var valueD = getCellValue(row_index, col_index, flowdata, "f");
152
160
  inputRef.current.innerText = valueD;
153
161
  }
@@ -138,6 +138,8 @@ var InputBox = function InputBox() {
138
138
  var flowdata = (0, _fortuneCore.getFlowdata)(context);
139
139
  var cell = (_a = flowdata === null || flowdata === void 0 ? void 0 : flowdata[row_index]) === null || _a === void 0 ? void 0 : _a[col_index];
140
140
  var value_1 = "";
141
+ var wasOverwrite = refs.globalCache.overwriteCell;
142
+ var overwriteFirstChar = refs.globalCache.overwriteCellFirstChar;
141
143
  if (cell && !refs.globalCache.overwriteCell) {
142
144
  if ((0, _fortuneCore.isInlineStringCell)(cell)) {
143
145
  value_1 = (0, _fortuneCore.getInlineStringHTML)(row_index, col_index, flowdata);
@@ -154,9 +156,15 @@ var InputBox = function InputBox() {
154
156
  }
155
157
  }
156
158
  refs.globalCache.overwriteCell = false;
157
- if (!refs.globalCache.ignoreWriteCell && inputRef.current && value_1) {
159
+ delete refs.globalCache.overwriteCellFirstChar;
160
+ if (wasOverwrite && inputRef.current) {
161
+ inputRef.current.innerText = overwriteFirstChar !== null && overwriteFirstChar !== void 0 ? overwriteFirstChar : "";
162
+ if (overwriteFirstChar) {
163
+ (0, _fortuneCore.moveToEnd)(inputRef.current);
164
+ }
165
+ } else if (!refs.globalCache.ignoreWriteCell && inputRef.current && value_1) {
158
166
  inputRef.current.innerHTML = (0, _fortuneCore.escapeHTMLTag)((0, _fortuneCore.escapeScriptTag)(value_1));
159
- } else if (!refs.globalCache.ignoreWriteCell && inputRef.current && !value_1) {
167
+ } else if (!refs.globalCache.ignoreWriteCell && inputRef.current && !value_1 && !wasOverwrite) {
160
168
  var valueD = (0, _fortuneCore.getCellValue)(row_index, col_index, flowdata, "f");
161
169
  inputRef.current.innerText = valueD;
162
170
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fileverse-dev/fortune-react",
3
- "version": "1.3.10-input",
3
+ "version": "1.3.10-input-1",
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.3.10-input",
19
+ "@fileverse-dev/fortune-core": "1.3.10-input-1",
20
20
  "@fileverse/ui": "5.0.0",
21
21
  "@tippyjs/react": "^4.2.6",
22
22
  "@types/regenerator-runtime": "^0.13.6",