handsontable 0.0.0-next-0bd37c1-20240513 → 0.0.0-next-c2f1254-20240515
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.
Potentially problematic release.
This version of handsontable might be problematic. Click here for more details.
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/core.js +76 -179
- package/core.mjs +76 -179
- package/dist/handsontable.css +2 -2
- package/dist/handsontable.full.css +2 -2
- package/dist/handsontable.full.js +1969 -1977
- package/dist/handsontable.full.min.css +2 -2
- package/dist/handsontable.full.min.js +6 -6
- package/dist/handsontable.js +2441 -2449
- package/dist/handsontable.min.css +2 -2
- package/dist/handsontable.min.js +9 -9
- package/editorManager.js +0 -67
- package/editorManager.mjs +0 -67
- package/editors/baseEditor/baseEditor.js +1 -36
- package/editors/baseEditor/baseEditor.mjs +2 -37
- package/editors/dateEditor/dateEditor.js +4 -1
- package/editors/dateEditor/dateEditor.mjs +4 -1
- package/editors/handsontableEditor/handsontableEditor.js +2 -2
- package/editors/handsontableEditor/handsontableEditor.mjs +2 -2
- package/editors/selectEditor/selectEditor.js +1 -9
- package/editors/selectEditor/selectEditor.mjs +1 -9
- package/editors/textEditor/textEditor.js +2 -11
- package/editors/textEditor/textEditor.mjs +2 -11
- package/helpers/mixed.js +1 -1
- package/helpers/mixed.mjs +1 -1
- package/package.json +1 -1
- package/plugins/autofill/autofill.js +1 -1
- package/plugins/autofill/autofill.mjs +1 -1
- package/selection/selection.js +156 -4
- package/selection/selection.mjs +156 -4
- package/shortcutContexts/commands/editor/closeAndSave.js +2 -3
- package/shortcutContexts/commands/editor/closeAndSave.mjs +2 -3
- package/shortcutContexts/commands/editor/closeAndSaveByArrowKeys.js +27 -0
- package/shortcutContexts/commands/editor/closeAndSaveByArrowKeys.mjs +24 -0
- package/shortcutContexts/commands/editor/closeAndSaveByEnter.js +11 -0
- package/shortcutContexts/commands/editor/closeAndSaveByEnter.mjs +8 -0
- package/shortcutContexts/commands/editor/index.js +3 -1
- package/shortcutContexts/commands/editor/index.mjs +3 -1
- package/shortcutContexts/editor.js +9 -1
- package/shortcutContexts/editor.mjs +9 -1
- package/shortcutContexts/index.js +1 -1
- package/shortcutContexts/index.mjs +1 -1
package/editorManager.js
CHANGED
@@ -6,7 +6,6 @@ var _unicode = require("./helpers/unicode");
|
|
6
6
|
var _event = require("./helpers/dom/event");
|
7
7
|
var _registry = require("./editors/registry");
|
8
8
|
var _eventManager = _interopRequireDefault(require("./eventManager"));
|
9
|
-
var _mixed = require("./helpers/mixed");
|
10
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
11
10
|
function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
|
12
11
|
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
@@ -14,7 +13,6 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
14
13
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
15
14
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
16
15
|
function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
|
17
|
-
const SHORTCUTS_GROUP_NAVIGATION = exports.SHORTCUTS_GROUP_NAVIGATION = 'editorManager.navigation';
|
18
16
|
var _EditorManager_brand = /*#__PURE__*/new WeakSet();
|
19
17
|
class EditorManager {
|
20
18
|
/**
|
@@ -64,13 +62,6 @@ class EditorManager {
|
|
64
62
|
* @type {boolean}
|
65
63
|
*/
|
66
64
|
_defineProperty(this, "destroyed", false);
|
67
|
-
/**
|
68
|
-
* Determines if EditorManager is locked.
|
69
|
-
*
|
70
|
-
* @private
|
71
|
-
* @type {boolean}
|
72
|
-
*/
|
73
|
-
_defineProperty(this, "lock", false);
|
74
65
|
/**
|
75
66
|
* A reference to an instance of the activeEditor.
|
76
67
|
*
|
@@ -99,34 +90,6 @@ class EditorManager {
|
|
99
90
|
this.hot.view._wt.update('onCellDblClick', (event, coords, elem) => _assertClassBrand(_EditorManager_brand, this, _onCellDblClick).call(this, event, coords, elem));
|
100
91
|
}
|
101
92
|
|
102
|
-
/**
|
103
|
-
* Lock the editor from being prepared and closed. Locking the editor prevents its closing and
|
104
|
-
* reinitialized after selecting the new cell. This feature is necessary for a mobile editor.
|
105
|
-
*/
|
106
|
-
lockEditor() {
|
107
|
-
this.lock = true;
|
108
|
-
}
|
109
|
-
|
110
|
-
/**
|
111
|
-
* Unlock the editor from being prepared and closed. This method restores the original behavior of
|
112
|
-
* the editors where for every new selection its instances are closed.
|
113
|
-
*/
|
114
|
-
unlockEditor() {
|
115
|
-
this.lock = false;
|
116
|
-
}
|
117
|
-
|
118
|
-
/**
|
119
|
-
* Destroy current editor, if exists.
|
120
|
-
*
|
121
|
-
* @param {boolean} revertOriginal If `false` and the cell using allowInvalid option,
|
122
|
-
* then an editor won't be closed until validation is passed.
|
123
|
-
*/
|
124
|
-
destroyEditor(revertOriginal) {
|
125
|
-
if (!this.lock) {
|
126
|
-
this.closeEditor(revertOriginal);
|
127
|
-
}
|
128
|
-
}
|
129
|
-
|
130
93
|
/**
|
131
94
|
* Get active editor.
|
132
95
|
*
|
@@ -141,9 +104,6 @@ class EditorManager {
|
|
141
104
|
*/
|
142
105
|
prepareEditor() {
|
143
106
|
var _this$hot$getSelected;
|
144
|
-
if (this.lock) {
|
145
|
-
return;
|
146
|
-
}
|
147
107
|
if (this.activeEditor && this.activeEditor.isWaiting()) {
|
148
108
|
this.closeEditor(false, false, dataSaved => {
|
149
109
|
if (dataSaved) {
|
@@ -350,33 +310,6 @@ function _onAfterDocumentKeyDown(event) {
|
|
350
310
|
const isCtrlPressed = (event.ctrlKey || event.metaKey) && !event.altKey;
|
351
311
|
if (!this.activeEditor || this.activeEditor && !this.activeEditor.isWaiting()) {
|
352
312
|
if (!(0, _unicode.isFunctionKey)(keyCode) && !(0, _unicode.isCtrlMetaKey)(keyCode) && !isCtrlPressed && !this.isEditorOpened()) {
|
353
|
-
const shortcutManager = this.hot.getShortcutManager();
|
354
|
-
const editorContext = shortcutManager.getContext('editor');
|
355
|
-
const runOnlySelectedConfig = {
|
356
|
-
runOnlyIf: () => (0, _mixed.isDefined)(this.hot.getSelected()),
|
357
|
-
group: SHORTCUTS_GROUP_NAVIGATION
|
358
|
-
};
|
359
|
-
editorContext.addShortcuts([{
|
360
|
-
keys: [['ArrowUp']],
|
361
|
-
callback: () => {
|
362
|
-
this.hot.selection.transformStart(-1, 0);
|
363
|
-
}
|
364
|
-
}, {
|
365
|
-
keys: [['ArrowDown']],
|
366
|
-
callback: () => {
|
367
|
-
this.hot.selection.transformStart(1, 0);
|
368
|
-
}
|
369
|
-
}, {
|
370
|
-
keys: [['ArrowLeft']],
|
371
|
-
callback: () => {
|
372
|
-
this.hot.selection.transformStart(0, -1 * this.hot.getDirectionFactor());
|
373
|
-
}
|
374
|
-
}, {
|
375
|
-
keys: [['ArrowRight']],
|
376
|
-
callback: () => {
|
377
|
-
this.hot.selection.transformStart(0, this.hot.getDirectionFactor());
|
378
|
-
}
|
379
|
-
}], runOnlySelectedConfig);
|
380
313
|
this.openEditor('', event);
|
381
314
|
}
|
382
315
|
}
|
package/editorManager.mjs
CHANGED
@@ -9,8 +9,6 @@ import { isFunctionKey, isCtrlMetaKey } from "./helpers/unicode.mjs";
|
|
9
9
|
import { isImmediatePropagationStopped } from "./helpers/dom/event.mjs";
|
10
10
|
import { getEditorInstance } from "./editors/registry.mjs";
|
11
11
|
import EventManager from "./eventManager.mjs";
|
12
|
-
import { isDefined } from "./helpers/mixed.mjs";
|
13
|
-
export const SHORTCUTS_GROUP_NAVIGATION = 'editorManager.navigation';
|
14
12
|
var _EditorManager_brand = /*#__PURE__*/new WeakSet();
|
15
13
|
class EditorManager {
|
16
14
|
/**
|
@@ -60,13 +58,6 @@ class EditorManager {
|
|
60
58
|
* @type {boolean}
|
61
59
|
*/
|
62
60
|
_defineProperty(this, "destroyed", false);
|
63
|
-
/**
|
64
|
-
* Determines if EditorManager is locked.
|
65
|
-
*
|
66
|
-
* @private
|
67
|
-
* @type {boolean}
|
68
|
-
*/
|
69
|
-
_defineProperty(this, "lock", false);
|
70
61
|
/**
|
71
62
|
* A reference to an instance of the activeEditor.
|
72
63
|
*
|
@@ -95,34 +86,6 @@ class EditorManager {
|
|
95
86
|
this.hot.view._wt.update('onCellDblClick', (event, coords, elem) => _assertClassBrand(_EditorManager_brand, this, _onCellDblClick).call(this, event, coords, elem));
|
96
87
|
}
|
97
88
|
|
98
|
-
/**
|
99
|
-
* Lock the editor from being prepared and closed. Locking the editor prevents its closing and
|
100
|
-
* reinitialized after selecting the new cell. This feature is necessary for a mobile editor.
|
101
|
-
*/
|
102
|
-
lockEditor() {
|
103
|
-
this.lock = true;
|
104
|
-
}
|
105
|
-
|
106
|
-
/**
|
107
|
-
* Unlock the editor from being prepared and closed. This method restores the original behavior of
|
108
|
-
* the editors where for every new selection its instances are closed.
|
109
|
-
*/
|
110
|
-
unlockEditor() {
|
111
|
-
this.lock = false;
|
112
|
-
}
|
113
|
-
|
114
|
-
/**
|
115
|
-
* Destroy current editor, if exists.
|
116
|
-
*
|
117
|
-
* @param {boolean} revertOriginal If `false` and the cell using allowInvalid option,
|
118
|
-
* then an editor won't be closed until validation is passed.
|
119
|
-
*/
|
120
|
-
destroyEditor(revertOriginal) {
|
121
|
-
if (!this.lock) {
|
122
|
-
this.closeEditor(revertOriginal);
|
123
|
-
}
|
124
|
-
}
|
125
|
-
|
126
89
|
/**
|
127
90
|
* Get active editor.
|
128
91
|
*
|
@@ -137,9 +100,6 @@ class EditorManager {
|
|
137
100
|
*/
|
138
101
|
prepareEditor() {
|
139
102
|
var _this$hot$getSelected;
|
140
|
-
if (this.lock) {
|
141
|
-
return;
|
142
|
-
}
|
143
103
|
if (this.activeEditor && this.activeEditor.isWaiting()) {
|
144
104
|
this.closeEditor(false, false, dataSaved => {
|
145
105
|
if (dataSaved) {
|
@@ -346,33 +306,6 @@ function _onAfterDocumentKeyDown(event) {
|
|
346
306
|
const isCtrlPressed = (event.ctrlKey || event.metaKey) && !event.altKey;
|
347
307
|
if (!this.activeEditor || this.activeEditor && !this.activeEditor.isWaiting()) {
|
348
308
|
if (!isFunctionKey(keyCode) && !isCtrlMetaKey(keyCode) && !isCtrlPressed && !this.isEditorOpened()) {
|
349
|
-
const shortcutManager = this.hot.getShortcutManager();
|
350
|
-
const editorContext = shortcutManager.getContext('editor');
|
351
|
-
const runOnlySelectedConfig = {
|
352
|
-
runOnlyIf: () => isDefined(this.hot.getSelected()),
|
353
|
-
group: SHORTCUTS_GROUP_NAVIGATION
|
354
|
-
};
|
355
|
-
editorContext.addShortcuts([{
|
356
|
-
keys: [['ArrowUp']],
|
357
|
-
callback: () => {
|
358
|
-
this.hot.selection.transformStart(-1, 0);
|
359
|
-
}
|
360
|
-
}, {
|
361
|
-
keys: [['ArrowDown']],
|
362
|
-
callback: () => {
|
363
|
-
this.hot.selection.transformStart(1, 0);
|
364
|
-
}
|
365
|
-
}, {
|
366
|
-
keys: [['ArrowLeft']],
|
367
|
-
callback: () => {
|
368
|
-
this.hot.selection.transformStart(0, -1 * this.hot.getDirectionFactor());
|
369
|
-
}
|
370
|
-
}, {
|
371
|
-
keys: [['ArrowRight']],
|
372
|
-
callback: () => {
|
373
|
-
this.hot.selection.transformStart(0, this.hot.getDirectionFactor());
|
374
|
-
}
|
375
|
-
}], runOnlySelectedConfig);
|
376
309
|
this.openEditor('', event);
|
377
310
|
}
|
378
311
|
}
|
@@ -4,7 +4,6 @@ exports.__esModule = true;
|
|
4
4
|
require("core-js/modules/es.error.cause.js");
|
5
5
|
var _mixed = require("../../helpers/mixed");
|
6
6
|
var _object = require("../../helpers/object");
|
7
|
-
var _editorManager = require("../../editorManager");
|
8
7
|
var _hooksRefRegisterer = _interopRequireDefault(require("../../mixins/hooksRefRegisterer"));
|
9
8
|
var _element = require("../../helpers/dom/element");
|
10
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
@@ -20,7 +19,6 @@ const EDITOR_STATE = exports.EDITOR_STATE = Object.freeze({
|
|
20
19
|
// waiting for async validation
|
21
20
|
FINISHED: 'STATE_FINISHED'
|
22
21
|
});
|
23
|
-
const SHORTCUTS_GROUP_EDITOR = exports.SHORTCUTS_GROUP_EDITOR = 'baseEditor';
|
24
22
|
|
25
23
|
/**
|
26
24
|
* @class BaseEditor
|
@@ -172,7 +170,7 @@ class BaseEditor {
|
|
172
170
|
this.prop = prop;
|
173
171
|
this.originalValue = value;
|
174
172
|
this.cellProperties = cellProperties;
|
175
|
-
this.state = EDITOR_STATE.VIRGIN;
|
173
|
+
this.state = this.isOpened() ? this.state : EDITOR_STATE.VIRGIN;
|
176
174
|
}
|
177
175
|
|
178
176
|
/**
|
@@ -210,35 +208,6 @@ class BaseEditor {
|
|
210
208
|
if (Array.isArray(modifiedCellCoords)) {
|
211
209
|
[visualRowFrom, visualColumnFrom] = modifiedCellCoords;
|
212
210
|
}
|
213
|
-
const shortcutManager = this.hot.getShortcutManager();
|
214
|
-
const editorContext = shortcutManager.getContext('editor');
|
215
|
-
const contextConfig = {
|
216
|
-
runOnlyIf: () => (0, _mixed.isDefined)(this.hot.getSelected()),
|
217
|
-
group: SHORTCUTS_GROUP_EDITOR
|
218
|
-
};
|
219
|
-
if (this.isInFullEditMode()) {
|
220
|
-
editorContext.addShortcuts([{
|
221
|
-
keys: [['ArrowUp']],
|
222
|
-
callback: () => {
|
223
|
-
this.hot.selection.transformStart(-1, 0);
|
224
|
-
}
|
225
|
-
}, {
|
226
|
-
keys: [['ArrowDown']],
|
227
|
-
callback: () => {
|
228
|
-
this.hot.selection.transformStart(1, 0);
|
229
|
-
}
|
230
|
-
}, {
|
231
|
-
keys: [['ArrowLeft']],
|
232
|
-
callback: () => {
|
233
|
-
this.hot.selection.transformStart(0, -1 * this.hot.getDirectionFactor());
|
234
|
-
}
|
235
|
-
}, {
|
236
|
-
keys: [['ArrowRight']],
|
237
|
-
callback: () => {
|
238
|
-
this.hot.selection.transformStart(0, this.hot.getDirectionFactor());
|
239
|
-
}
|
240
|
-
}], contextConfig);
|
241
|
-
}
|
242
211
|
|
243
212
|
// Saving values using the modified coordinates.
|
244
213
|
this.hot.populateFromArray(visualRowFrom, visualColumnFrom, value, visualRowTo, visualColumnTo, 'edit');
|
@@ -299,10 +268,6 @@ class BaseEditor {
|
|
299
268
|
if (this.isWaiting()) {
|
300
269
|
return;
|
301
270
|
}
|
302
|
-
const shortcutManager = this.hot.getShortcutManager();
|
303
|
-
const editorContext = shortcutManager.getContext('editor');
|
304
|
-
editorContext.removeShortcutsByGroup(SHORTCUTS_GROUP_EDITOR);
|
305
|
-
editorContext.removeShortcutsByGroup(_editorManager.SHORTCUTS_GROUP_NAVIGATION);
|
306
271
|
if (this.state === EDITOR_STATE.VIRGIN) {
|
307
272
|
this.hot._registerTimeout(() => {
|
308
273
|
this._fireCallbacks(true);
|
@@ -2,9 +2,8 @@ import "core-js/modules/es.error.cause.js";
|
|
2
2
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
3
3
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
4
4
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
5
|
-
import {
|
5
|
+
import { stringify } from "../../helpers/mixed.mjs";
|
6
6
|
import { mixin } from "../../helpers/object.mjs";
|
7
|
-
import { SHORTCUTS_GROUP_NAVIGATION } from "../../editorManager.mjs";
|
8
7
|
import hooksRefRegisterer from "../../mixins/hooksRefRegisterer.mjs";
|
9
8
|
import { getScrollbarWidth, offset, hasVerticalScrollbar, hasHorizontalScrollbar, outerWidth, outerHeight, getComputedStyle } from "../../helpers/dom/element.mjs";
|
10
9
|
export const EDITOR_TYPE = 'base';
|
@@ -16,7 +15,6 @@ export const EDITOR_STATE = Object.freeze({
|
|
16
15
|
// waiting for async validation
|
17
16
|
FINISHED: 'STATE_FINISHED'
|
18
17
|
});
|
19
|
-
export const SHORTCUTS_GROUP_EDITOR = 'baseEditor';
|
20
18
|
|
21
19
|
/**
|
22
20
|
* @class BaseEditor
|
@@ -168,7 +166,7 @@ export class BaseEditor {
|
|
168
166
|
this.prop = prop;
|
169
167
|
this.originalValue = value;
|
170
168
|
this.cellProperties = cellProperties;
|
171
|
-
this.state = EDITOR_STATE.VIRGIN;
|
169
|
+
this.state = this.isOpened() ? this.state : EDITOR_STATE.VIRGIN;
|
172
170
|
}
|
173
171
|
|
174
172
|
/**
|
@@ -206,35 +204,6 @@ export class BaseEditor {
|
|
206
204
|
if (Array.isArray(modifiedCellCoords)) {
|
207
205
|
[visualRowFrom, visualColumnFrom] = modifiedCellCoords;
|
208
206
|
}
|
209
|
-
const shortcutManager = this.hot.getShortcutManager();
|
210
|
-
const editorContext = shortcutManager.getContext('editor');
|
211
|
-
const contextConfig = {
|
212
|
-
runOnlyIf: () => isDefined(this.hot.getSelected()),
|
213
|
-
group: SHORTCUTS_GROUP_EDITOR
|
214
|
-
};
|
215
|
-
if (this.isInFullEditMode()) {
|
216
|
-
editorContext.addShortcuts([{
|
217
|
-
keys: [['ArrowUp']],
|
218
|
-
callback: () => {
|
219
|
-
this.hot.selection.transformStart(-1, 0);
|
220
|
-
}
|
221
|
-
}, {
|
222
|
-
keys: [['ArrowDown']],
|
223
|
-
callback: () => {
|
224
|
-
this.hot.selection.transformStart(1, 0);
|
225
|
-
}
|
226
|
-
}, {
|
227
|
-
keys: [['ArrowLeft']],
|
228
|
-
callback: () => {
|
229
|
-
this.hot.selection.transformStart(0, -1 * this.hot.getDirectionFactor());
|
230
|
-
}
|
231
|
-
}, {
|
232
|
-
keys: [['ArrowRight']],
|
233
|
-
callback: () => {
|
234
|
-
this.hot.selection.transformStart(0, this.hot.getDirectionFactor());
|
235
|
-
}
|
236
|
-
}], contextConfig);
|
237
|
-
}
|
238
207
|
|
239
208
|
// Saving values using the modified coordinates.
|
240
209
|
this.hot.populateFromArray(visualRowFrom, visualColumnFrom, value, visualRowTo, visualColumnTo, 'edit');
|
@@ -295,10 +264,6 @@ export class BaseEditor {
|
|
295
264
|
if (this.isWaiting()) {
|
296
265
|
return;
|
297
266
|
}
|
298
|
-
const shortcutManager = this.hot.getShortcutManager();
|
299
|
-
const editorContext = shortcutManager.getContext('editor');
|
300
|
-
editorContext.removeShortcutsByGroup(SHORTCUTS_GROUP_EDITOR);
|
301
|
-
editorContext.removeShortcutsByGroup(SHORTCUTS_GROUP_NAVIGATION);
|
302
267
|
if (this.state === EDITOR_STATE.VIRGIN) {
|
303
268
|
this.hot._registerTimeout(() => {
|
304
269
|
this._fireCallbacks(true);
|
@@ -155,7 +155,10 @@ class DateEditor extends _textEditor.TextEditor {
|
|
155
155
|
this.$datePicker.destroy();
|
156
156
|
}
|
157
157
|
this.hot._registerTimeout(() => {
|
158
|
-
this.hot.
|
158
|
+
const editorManager = this.hot._getEditorManager();
|
159
|
+
editorManager.closeEditor();
|
160
|
+
this.hot.view.render();
|
161
|
+
editorManager.prepareEditor();
|
159
162
|
});
|
160
163
|
const shortcutManager = this.hot.getShortcutManager();
|
161
164
|
const editorContext = shortcutManager.getContext('editor');
|
@@ -151,7 +151,10 @@ export class DateEditor extends TextEditor {
|
|
151
151
|
this.$datePicker.destroy();
|
152
152
|
}
|
153
153
|
this.hot._registerTimeout(() => {
|
154
|
-
this.hot.
|
154
|
+
const editorManager = this.hot._getEditorManager();
|
155
|
+
editorManager.closeEditor();
|
156
|
+
this.hot.view.render();
|
157
|
+
editorManager.prepareEditor();
|
155
158
|
});
|
156
159
|
const shortcutManager = this.hot.getShortcutManager();
|
157
160
|
const editorContext = shortcutManager.getContext('editor');
|
@@ -5,7 +5,7 @@ var _textEditor = require("../textEditor");
|
|
5
5
|
var _element = require("../../helpers/dom/element");
|
6
6
|
var _event = require("../../helpers/dom/event");
|
7
7
|
var _object = require("../../helpers/object");
|
8
|
-
var
|
8
|
+
var _shortcutContexts = require("../../shortcutContexts");
|
9
9
|
const SHORTCUTS_GROUP = 'handsontableEditor';
|
10
10
|
const EDITOR_TYPE = exports.EDITOR_TYPE = 'handsontable';
|
11
11
|
|
@@ -171,7 +171,7 @@ class HandsontableEditor extends _textEditor.TextEditor {
|
|
171
171
|
super.registerShortcuts();
|
172
172
|
const contextConfig = {
|
173
173
|
group: SHORTCUTS_GROUP,
|
174
|
-
relativeToGroup:
|
174
|
+
relativeToGroup: _shortcutContexts.EDITOR_EDIT_GROUP,
|
175
175
|
position: 'before'
|
176
176
|
};
|
177
177
|
const action = (rowToSelect, event) => {
|
@@ -2,7 +2,7 @@ import { TextEditor } from "../textEditor/index.mjs";
|
|
2
2
|
import { setCaretPosition } from "../../helpers/dom/element.mjs";
|
3
3
|
import { stopImmediatePropagation } from "../../helpers/dom/event.mjs";
|
4
4
|
import { extend } from "../../helpers/object.mjs";
|
5
|
-
import {
|
5
|
+
import { EDITOR_EDIT_GROUP } from "../../shortcutContexts/index.mjs";
|
6
6
|
const SHORTCUTS_GROUP = 'handsontableEditor';
|
7
7
|
export const EDITOR_TYPE = 'handsontable';
|
8
8
|
|
@@ -168,7 +168,7 @@ export class HandsontableEditor extends TextEditor {
|
|
168
168
|
super.registerShortcuts();
|
169
169
|
const contextConfig = {
|
170
170
|
group: SHORTCUTS_GROUP,
|
171
|
-
relativeToGroup:
|
171
|
+
relativeToGroup: EDITOR_EDIT_GROUP,
|
172
172
|
position: 'before'
|
173
173
|
};
|
174
174
|
const action = (rowToSelect, event) => {
|
@@ -189,18 +189,10 @@ class SelectEditor extends _baseEditor.BaseEditor {
|
|
189
189
|
registerShortcuts() {
|
190
190
|
const shortcutManager = this.hot.getShortcutManager();
|
191
191
|
const editorContext = shortcutManager.getContext('editor');
|
192
|
-
const gridContext = shortcutManager.getContext('grid');
|
193
192
|
const contextConfig = {
|
194
193
|
group: SHORTCUTS_GROUP
|
195
194
|
};
|
196
|
-
|
197
|
-
// The `TAB`-related shortcuts should work both in full and fast edit modes.
|
198
|
-
editorContext.addShortcuts([{
|
199
|
-
keys: [['Tab'], ['Shift', 'Tab']],
|
200
|
-
forwardToContext: gridContext,
|
201
|
-
callback: () => {}
|
202
|
-
}], contextConfig);
|
203
|
-
if (this.isInFullEditMode() === true) {
|
195
|
+
if (this.isInFullEditMode()) {
|
204
196
|
// The arrow-related shortcuts should work only in full edit mode.
|
205
197
|
editorContext.addShortcuts([{
|
206
198
|
keys: [['ArrowUp']],
|
@@ -186,18 +186,10 @@ export class SelectEditor extends BaseEditor {
|
|
186
186
|
registerShortcuts() {
|
187
187
|
const shortcutManager = this.hot.getShortcutManager();
|
188
188
|
const editorContext = shortcutManager.getContext('editor');
|
189
|
-
const gridContext = shortcutManager.getContext('grid');
|
190
189
|
const contextConfig = {
|
191
190
|
group: SHORTCUTS_GROUP
|
192
191
|
};
|
193
|
-
|
194
|
-
// The `TAB`-related shortcuts should work both in full and fast edit modes.
|
195
|
-
editorContext.addShortcuts([{
|
196
|
-
keys: [['Tab'], ['Shift', 'Tab']],
|
197
|
-
forwardToContext: gridContext,
|
198
|
-
callback: () => {}
|
199
|
-
}], contextConfig);
|
200
|
-
if (this.isInFullEditMode() === true) {
|
192
|
+
if (this.isInFullEditMode()) {
|
201
193
|
// The arrow-related shortcuts should work only in full edit mode.
|
202
194
|
editorContext.addShortcuts([{
|
203
195
|
keys: [['ArrowUp']],
|
@@ -9,8 +9,6 @@ var _element = require("../../helpers/dom/element");
|
|
9
9
|
var _number = require("../../helpers/number");
|
10
10
|
var _autoResize = require("../../utils/autoResize");
|
11
11
|
var _mixed = require("../../helpers/mixed");
|
12
|
-
var _editorManager = require("../../editorManager");
|
13
|
-
var _baseEditor2 = require("../baseEditor/baseEditor");
|
14
12
|
var _caretPositioner = require("./caretPositioner");
|
15
13
|
var _a11y = require("../../helpers/a11y");
|
16
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
@@ -150,12 +148,12 @@ class TextEditor extends _baseEditor.BaseEditor {
|
|
150
148
|
const {
|
151
149
|
allowInvalid
|
152
150
|
} = cellProperties;
|
153
|
-
if (allowInvalid) {
|
151
|
+
if (allowInvalid && !this.isOpened()) {
|
154
152
|
// Remove an empty space from textarea (added by copyPaste plugin to make copy/paste
|
155
153
|
// functionality work with IME)
|
156
154
|
this.TEXTAREA.value = '';
|
157
155
|
}
|
158
|
-
if (previousState !== _baseEditor.EDITOR_STATE.FINISHED) {
|
156
|
+
if (previousState !== _baseEditor.EDITOR_STATE.FINISHED && !this.isOpened()) {
|
159
157
|
this.hideEditableElement();
|
160
158
|
}
|
161
159
|
}
|
@@ -381,7 +379,6 @@ class TextEditor extends _baseEditor.BaseEditor {
|
|
381
379
|
registerShortcuts() {
|
382
380
|
const shortcutManager = this.hot.getShortcutManager();
|
383
381
|
const editorContext = shortcutManager.getContext('editor');
|
384
|
-
const gridContext = shortcutManager.getContext('grid');
|
385
382
|
const contextConfig = {
|
386
383
|
runOnlyIf: () => (0, _mixed.isDefined)(this.hot.getSelected()),
|
387
384
|
group: SHORTCUTS_GROUP
|
@@ -390,10 +387,6 @@ class TextEditor extends _baseEditor.BaseEditor {
|
|
390
387
|
this.hot.rootDocument.execCommand('insertText', false, '\n');
|
391
388
|
};
|
392
389
|
editorContext.addShortcuts([{
|
393
|
-
keys: [['Tab'], ['Shift', 'Tab'], ['PageUp'], ['PageDown']],
|
394
|
-
forwardToContext: gridContext,
|
395
|
-
callback: () => {}
|
396
|
-
}, {
|
397
390
|
keys: [['Control', 'Enter']],
|
398
391
|
callback: () => {
|
399
392
|
insertNewLine();
|
@@ -439,9 +432,7 @@ class TextEditor extends _baseEditor.BaseEditor {
|
|
439
432
|
unregisterShortcuts() {
|
440
433
|
const shortcutManager = this.hot.getShortcutManager();
|
441
434
|
const editorContext = shortcutManager.getContext('editor');
|
442
|
-
editorContext.removeShortcutsByGroup(_editorManager.SHORTCUTS_GROUP_NAVIGATION);
|
443
435
|
editorContext.removeShortcutsByGroup(SHORTCUTS_GROUP);
|
444
|
-
editorContext.removeShortcutsByGroup(_baseEditor2.SHORTCUTS_GROUP_EDITOR);
|
445
436
|
}
|
446
437
|
}
|
447
438
|
exports.TextEditor = TextEditor;
|
@@ -9,8 +9,6 @@ import { addClass, getComputedStyle, isThisHotChild, setCaretPosition, hasClass,
|
|
9
9
|
import { rangeEach } from "../../helpers/number.mjs";
|
10
10
|
import { createInputElementResizer } from "../../utils/autoResize.mjs";
|
11
11
|
import { isDefined } from "../../helpers/mixed.mjs";
|
12
|
-
import { SHORTCUTS_GROUP_NAVIGATION } from "../../editorManager.mjs";
|
13
|
-
import { SHORTCUTS_GROUP_EDITOR } from "../baseEditor/baseEditor.mjs";
|
14
12
|
import { updateCaretPosition } from "./caretPositioner.mjs";
|
15
13
|
import { A11Y_HIDDEN, A11Y_TABINDEX } from "../../helpers/a11y.mjs";
|
16
14
|
const EDITOR_VISIBLE_CLASS_NAME = 'ht_editor_visible';
|
@@ -146,12 +144,12 @@ export class TextEditor extends BaseEditor {
|
|
146
144
|
const {
|
147
145
|
allowInvalid
|
148
146
|
} = cellProperties;
|
149
|
-
if (allowInvalid) {
|
147
|
+
if (allowInvalid && !this.isOpened()) {
|
150
148
|
// Remove an empty space from textarea (added by copyPaste plugin to make copy/paste
|
151
149
|
// functionality work with IME)
|
152
150
|
this.TEXTAREA.value = '';
|
153
151
|
}
|
154
|
-
if (previousState !== EDITOR_STATE.FINISHED) {
|
152
|
+
if (previousState !== EDITOR_STATE.FINISHED && !this.isOpened()) {
|
155
153
|
this.hideEditableElement();
|
156
154
|
}
|
157
155
|
}
|
@@ -377,7 +375,6 @@ export class TextEditor extends BaseEditor {
|
|
377
375
|
registerShortcuts() {
|
378
376
|
const shortcutManager = this.hot.getShortcutManager();
|
379
377
|
const editorContext = shortcutManager.getContext('editor');
|
380
|
-
const gridContext = shortcutManager.getContext('grid');
|
381
378
|
const contextConfig = {
|
382
379
|
runOnlyIf: () => isDefined(this.hot.getSelected()),
|
383
380
|
group: SHORTCUTS_GROUP
|
@@ -386,10 +383,6 @@ export class TextEditor extends BaseEditor {
|
|
386
383
|
this.hot.rootDocument.execCommand('insertText', false, '\n');
|
387
384
|
};
|
388
385
|
editorContext.addShortcuts([{
|
389
|
-
keys: [['Tab'], ['Shift', 'Tab'], ['PageUp'], ['PageDown']],
|
390
|
-
forwardToContext: gridContext,
|
391
|
-
callback: () => {}
|
392
|
-
}, {
|
393
386
|
keys: [['Control', 'Enter']],
|
394
387
|
callback: () => {
|
395
388
|
insertNewLine();
|
@@ -435,8 +428,6 @@ export class TextEditor extends BaseEditor {
|
|
435
428
|
unregisterShortcuts() {
|
436
429
|
const shortcutManager = this.hot.getShortcutManager();
|
437
430
|
const editorContext = shortcutManager.getContext('editor');
|
438
|
-
editorContext.removeShortcutsByGroup(SHORTCUTS_GROUP_NAVIGATION);
|
439
431
|
editorContext.removeShortcutsByGroup(SHORTCUTS_GROUP);
|
440
|
-
editorContext.removeShortcutsByGroup(SHORTCUTS_GROUP_EDITOR);
|
441
432
|
}
|
442
433
|
}
|
package/helpers/mixed.js
CHANGED
@@ -134,7 +134,7 @@ const domMessages = {
|
|
134
134
|
function _injectProductInfo(key, element) {
|
135
135
|
const hasValidType = !isEmpty(key);
|
136
136
|
const isNonCommercial = typeof key === 'string' && key.toLowerCase() === 'non-commercial-and-evaluation';
|
137
|
-
const hotVersion = "0.0.0-next-
|
137
|
+
const hotVersion = "0.0.0-next-c2f1254-20240515";
|
138
138
|
let keyValidityDate;
|
139
139
|
let consoleMessageState = 'invalid';
|
140
140
|
let domMessageState = 'invalid';
|
package/helpers/mixed.mjs
CHANGED
@@ -124,7 +124,7 @@ const domMessages = {
|
|
124
124
|
export function _injectProductInfo(key, element) {
|
125
125
|
const hasValidType = !isEmpty(key);
|
126
126
|
const isNonCommercial = typeof key === 'string' && key.toLowerCase() === 'non-commercial-and-evaluation';
|
127
|
-
const hotVersion = "0.0.0-next-
|
127
|
+
const hotVersion = "0.0.0-next-c2f1254-20240515";
|
128
128
|
let keyValidityDate;
|
129
129
|
let consoleMessageState = 'invalid';
|
130
130
|
let domMessageState = 'invalid';
|
package/package.json
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
"url": "https://github.com/handsontable/handsontable/issues"
|
11
11
|
},
|
12
12
|
"author": "Handsoncode <hello@handsontable.com>",
|
13
|
-
"version": "0.0.0-next-
|
13
|
+
"version": "0.0.0-next-c2f1254-20240515",
|
14
14
|
"main": "index",
|
15
15
|
"module": "index.mjs",
|
16
16
|
"jsnext:main": "index.mjs",
|