handsontable 0.0.0-next-74a68c1-20230627 → 0.0.0-next-208afb8-20230627
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of handsontable might be problematic. Click here for more details.
- package/CHANGELOG.md +0 -31
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/core.d.ts +1 -0
- package/core.js +31 -2
- package/core.mjs +31 -2
- package/dataMap/metaManager/metaSchema.js +1 -1
- package/dataMap/metaManager/metaSchema.mjs +1 -1
- package/dist/handsontable.css +2 -2
- package/dist/handsontable.full.css +2 -2
- package/dist/handsontable.full.js +3553 -3366
- package/dist/handsontable.full.min.css +2 -2
- package/dist/handsontable.full.min.js +53 -53
- package/dist/handsontable.js +7968 -7781
- package/dist/handsontable.min.css +2 -2
- package/dist/handsontable.min.js +4 -4
- package/editorManager.js +4 -10
- package/editorManager.mjs +4 -10
- package/helpers/mixed.js +2 -2
- package/helpers/mixed.mjs +2 -2
- package/package.json +1 -1
- package/pluginHooks.d.ts +1 -0
- package/pluginHooks.js +11 -4
- package/pluginHooks.mjs +11 -4
- package/plugins/comments/commentEditor.js +1 -0
- package/plugins/comments/commentEditor.mjs +1 -0
- package/plugins/comments/comments.js +289 -231
- package/plugins/comments/comments.mjs +297 -241
- package/plugins/comments/contextMenuItem/addEditComment.js +51 -0
- package/plugins/comments/contextMenuItem/addEditComment.mjs +35 -0
- package/plugins/comments/contextMenuItem/readOnlyComment.js +63 -0
- package/plugins/comments/contextMenuItem/readOnlyComment.mjs +55 -0
- package/plugins/comments/contextMenuItem/removeComment.js +48 -0
- package/plugins/comments/contextMenuItem/removeComment.mjs +32 -0
- package/plugins/contextMenu/contextMenu.js +1 -0
- package/plugins/contextMenu/contextMenu.mjs +1 -0
- package/plugins/copyPaste/copyPaste.js +1 -1
- package/plugins/copyPaste/copyPaste.mjs +1 -1
- package/plugins/filters/filters.js +42 -62
- package/plugins/filters/filters.mjs +41 -61
- package/shortcutContexts/commands/index.js +1 -2
- package/shortcutContexts/commands/index.mjs +1 -2
- package/shortcutContexts/grid.js +0 -5
- package/shortcutContexts/grid.mjs +0 -5
- package/tableView.js +9 -4
- package/tableView.mjs +9 -4
- package/translations/indexMapper.d.ts +2 -0
- package/shortcutContexts/commands/scrollToFocusedCell.js +0 -38
- package/shortcutContexts/commands/scrollToFocusedCell.mjs +0 -33
@@ -1,41 +1,40 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
4
|
-
require("core-js/modules/es.object.set-prototype-of.js");
|
5
|
-
require("core-js/modules/es.object.get-prototype-of.js");
|
6
|
-
require("core-js/modules/es.reflect.construct.js");
|
7
|
-
require("core-js/modules/es.reflect.get.js");
|
8
|
-
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
9
3
|
require("core-js/modules/es.symbol.to-primitive.js");
|
10
4
|
require("core-js/modules/es.date.to-primitive.js");
|
11
5
|
require("core-js/modules/es.symbol.js");
|
12
6
|
require("core-js/modules/es.symbol.description.js");
|
13
7
|
require("core-js/modules/es.number.constructor.js");
|
8
|
+
require("core-js/modules/es.object.set-prototype-of.js");
|
9
|
+
require("core-js/modules/es.object.get-prototype-of.js");
|
10
|
+
require("core-js/modules/es.reflect.construct.js");
|
11
|
+
require("core-js/modules/es.reflect.get.js");
|
12
|
+
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
14
13
|
require("core-js/modules/es.symbol.iterator.js");
|
14
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
15
15
|
exports.__esModule = true;
|
16
|
-
exports.PLUGIN_PRIORITY = exports.PLUGIN_KEY = exports.Comments = void 0;
|
16
|
+
exports.PLUGIN_PRIORITY = exports.PLUGIN_KEY = exports.META_STYLE = exports.META_READONLY = exports.META_COMMENT_VALUE = exports.META_COMMENT = exports.Comments = void 0;
|
17
|
+
require("core-js/modules/es.array.concat.js");
|
17
18
|
require("core-js/modules/es.array.iterator.js");
|
18
19
|
require("core-js/modules/es.object.to-string.js");
|
19
20
|
require("core-js/modules/es.string.iterator.js");
|
20
21
|
require("core-js/modules/es.weak-map.js");
|
21
22
|
require("core-js/modules/web.dom-collections.iterator.js");
|
22
23
|
var _element = require("../../helpers/dom/element");
|
24
|
+
var _event = require("../../helpers/dom/event");
|
23
25
|
var _object = require("../../helpers/object");
|
24
26
|
var _eventManager = _interopRequireDefault(require("../../eventManager"));
|
25
27
|
var _base = require("../base");
|
26
28
|
var _commentEditor = _interopRequireDefault(require("./commentEditor"));
|
27
|
-
var
|
28
|
-
var
|
29
|
-
var
|
30
|
-
|
31
|
-
|
29
|
+
var _displaySwitch2 = _interopRequireDefault(require("./displaySwitch"));
|
30
|
+
var _predefinedItems = require("../contextMenu/predefinedItems");
|
31
|
+
var _addEditComment = _interopRequireDefault(require("./contextMenuItem/addEditComment"));
|
32
|
+
var _removeComment = _interopRequireDefault(require("./contextMenuItem/removeComment"));
|
33
|
+
var _readOnlyComment = _interopRequireDefault(require("./contextMenuItem/readOnlyComment"));
|
32
34
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
33
|
-
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; }
|
34
35
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
35
36
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
36
37
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
37
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
38
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
39
38
|
function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
|
40
39
|
function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
|
41
40
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
@@ -45,15 +44,30 @@ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) ===
|
|
45
44
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
46
45
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
47
46
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
47
|
+
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
48
|
+
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
49
|
+
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; }
|
50
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
51
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
52
|
+
function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
|
53
|
+
function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } }
|
54
|
+
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
|
55
|
+
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
56
|
+
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
48
57
|
var PLUGIN_KEY = 'comments';
|
49
58
|
exports.PLUGIN_KEY = PLUGIN_KEY;
|
50
59
|
var PLUGIN_PRIORITY = 60;
|
51
60
|
exports.PLUGIN_PRIORITY = PLUGIN_PRIORITY;
|
52
|
-
var privatePool = new WeakMap();
|
53
61
|
var META_COMMENT = 'comment';
|
62
|
+
exports.META_COMMENT = META_COMMENT;
|
54
63
|
var META_COMMENT_VALUE = 'value';
|
64
|
+
exports.META_COMMENT_VALUE = META_COMMENT_VALUE;
|
55
65
|
var META_STYLE = 'style';
|
66
|
+
exports.META_STYLE = META_STYLE;
|
56
67
|
var META_READONLY = 'readOnly';
|
68
|
+
exports.META_READONLY = META_READONLY;
|
69
|
+
var SHORTCUTS_GROUP = PLUGIN_KEY;
|
70
|
+
var SHORTCUTS_CONTEXT_NAME = "plugin:".concat(PLUGIN_KEY);
|
57
71
|
|
58
72
|
/* eslint-disable jsdoc/require-description-complete-sentence */
|
59
73
|
/**
|
@@ -145,63 +159,119 @@ var META_READONLY = 'readOnly';
|
|
145
159
|
* ```
|
146
160
|
* :::
|
147
161
|
*/
|
162
|
+
var _editor = /*#__PURE__*/new WeakMap();
|
163
|
+
var _displaySwitch = /*#__PURE__*/new WeakMap();
|
164
|
+
var _preventEditorAutoSwitch = /*#__PURE__*/new WeakMap();
|
165
|
+
var _preventEditorHiding = /*#__PURE__*/new WeakMap();
|
166
|
+
var _tempEditorDimensions = /*#__PURE__*/new WeakMap();
|
167
|
+
var _cellBelowCursor = /*#__PURE__*/new WeakMap();
|
168
|
+
var _commentValueBeforeSave = /*#__PURE__*/new WeakMap();
|
148
169
|
var Comments = /*#__PURE__*/function (_BasePlugin) {
|
149
170
|
_inherits(Comments, _BasePlugin);
|
150
171
|
var _super = _createSuper(Comments);
|
151
|
-
function Comments(
|
172
|
+
function Comments() {
|
152
173
|
var _this;
|
153
174
|
_classCallCheck(this, Comments);
|
154
|
-
|
175
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
176
|
+
args[_key] = arguments[_key];
|
177
|
+
}
|
178
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
179
|
+
/**
|
180
|
+
* Current cell range, an object with `from` property, with `row` and `col` properties (e.q. `{from: {row: 1, col: 6}}`).
|
181
|
+
*
|
182
|
+
* @type {object}
|
183
|
+
*/
|
184
|
+
_defineProperty(_assertThisInitialized(_this), "range", {});
|
185
|
+
/**
|
186
|
+
* Instance of {@link EventManager}.
|
187
|
+
*
|
188
|
+
* @protected
|
189
|
+
* @type {EventManager}
|
190
|
+
*/
|
191
|
+
_defineProperty(_assertThisInitialized(_this), "eventManager", null);
|
155
192
|
/**
|
156
193
|
* Instance of {@link CommentEditor}.
|
157
194
|
*
|
158
195
|
* @private
|
159
196
|
* @type {CommentEditor}
|
160
197
|
*/
|
161
|
-
_this
|
198
|
+
_classPrivateFieldInitSpec(_assertThisInitialized(_this), _editor, {
|
199
|
+
writable: true,
|
200
|
+
value: null
|
201
|
+
});
|
162
202
|
/**
|
163
203
|
* Instance of {@link DisplaySwitch}.
|
164
204
|
*
|
165
205
|
* @private
|
166
206
|
* @type {DisplaySwitch}
|
167
207
|
*/
|
168
|
-
_this
|
208
|
+
_classPrivateFieldInitSpec(_assertThisInitialized(_this), _displaySwitch, {
|
209
|
+
writable: true,
|
210
|
+
value: null
|
211
|
+
});
|
169
212
|
/**
|
170
|
-
*
|
213
|
+
* Prevents showing/hiding editor that reacts on the logic triggered by the "mouseover" events.
|
171
214
|
*
|
172
215
|
* @private
|
173
|
-
* @type {
|
216
|
+
* @type {boolean}
|
174
217
|
*/
|
175
|
-
_this
|
218
|
+
_classPrivateFieldInitSpec(_assertThisInitialized(_this), _preventEditorAutoSwitch, {
|
219
|
+
writable: true,
|
220
|
+
value: false
|
221
|
+
});
|
176
222
|
/**
|
177
|
-
*
|
223
|
+
* Prevents hiding editor when the table viewport is scrolled and that scroll is triggered by the
|
224
|
+
* keyboard shortcut that insert or edits the comment.
|
178
225
|
*
|
226
|
+
* @private
|
227
|
+
* @type {boolean}
|
228
|
+
*/
|
229
|
+
_classPrivateFieldInitSpec(_assertThisInitialized(_this), _preventEditorHiding, {
|
230
|
+
writable: true,
|
231
|
+
value: false
|
232
|
+
});
|
233
|
+
/**
|
234
|
+
* The property for holding editor dimensions for further processing.
|
235
|
+
*
|
236
|
+
* @private
|
179
237
|
* @type {object}
|
180
238
|
*/
|
181
|
-
_this
|
239
|
+
_classPrivateFieldInitSpec(_assertThisInitialized(_this), _tempEditorDimensions, {
|
240
|
+
writable: true,
|
241
|
+
value: {}
|
242
|
+
});
|
182
243
|
/**
|
183
|
-
*
|
244
|
+
* The flag that allows processing mousedown event correctly when comments editor is triggered.
|
184
245
|
*
|
185
246
|
* @private
|
186
247
|
* @type {boolean}
|
187
248
|
*/
|
188
|
-
_this
|
189
|
-
|
190
|
-
|
191
|
-
|
249
|
+
_classPrivateFieldInitSpec(_assertThisInitialized(_this), _cellBelowCursor, {
|
250
|
+
writable: true,
|
251
|
+
value: null
|
252
|
+
});
|
253
|
+
/**
|
254
|
+
* Holds the comment value before it's actually saved to the cell meta.
|
255
|
+
*
|
256
|
+
* @private
|
257
|
+
* @type {string}
|
258
|
+
*/
|
259
|
+
_classPrivateFieldInitSpec(_assertThisInitialized(_this), _commentValueBeforeSave, {
|
260
|
+
writable: true,
|
261
|
+
value: ''
|
192
262
|
});
|
193
263
|
return _this;
|
194
264
|
}
|
195
|
-
|
196
|
-
/**
|
197
|
-
* Checks if the plugin is enabled in the handsontable settings. This method is executed in {@link Hooks#beforeInit}
|
198
|
-
* hook and if it returns `true` then the {@link Comments#enablePlugin} method is called.
|
199
|
-
*
|
200
|
-
* @returns {boolean}
|
201
|
-
*/
|
202
265
|
_createClass(Comments, [{
|
203
266
|
key: "isEnabled",
|
204
|
-
value:
|
267
|
+
value:
|
268
|
+
/**
|
269
|
+
* Checks if the plugin is enabled in the handsontable settings. This method is executed in {@link Hooks#beforeInit}
|
270
|
+
* hook and if it returns `true` then the {@link Comments#enablePlugin} method is called.
|
271
|
+
*
|
272
|
+
* @returns {boolean}
|
273
|
+
*/
|
274
|
+
function isEnabled() {
|
205
275
|
return !!this.hot.getSettings()[PLUGIN_KEY];
|
206
276
|
}
|
207
277
|
|
@@ -215,14 +285,14 @@ var Comments = /*#__PURE__*/function (_BasePlugin) {
|
|
215
285
|
if (this.enabled) {
|
216
286
|
return;
|
217
287
|
}
|
218
|
-
if (!this
|
219
|
-
this
|
288
|
+
if (!_classPrivateFieldGet(this, _editor)) {
|
289
|
+
_classPrivateFieldSet(this, _editor, new _commentEditor.default(this.hot.rootDocument, this.hot.isRtl()));
|
220
290
|
}
|
221
291
|
if (!this.eventManager) {
|
222
292
|
this.eventManager = new _eventManager.default(this);
|
223
293
|
}
|
224
|
-
if (!this
|
225
|
-
this
|
294
|
+
if (!_classPrivateFieldGet(this, _displaySwitch)) {
|
295
|
+
_classPrivateFieldSet(this, _displaySwitch, new _displaySwitch2.default(this.getDisplayDelaySetting()));
|
226
296
|
}
|
227
297
|
this.addHook('afterContextMenuDefaultOptions', function (options) {
|
228
298
|
return _this2.addToContextMenu(options);
|
@@ -230,21 +300,22 @@ var Comments = /*#__PURE__*/function (_BasePlugin) {
|
|
230
300
|
this.addHook('afterRenderer', function (TD, row, col, prop, value, cellProperties) {
|
231
301
|
return _this2.onAfterRenderer(TD, cellProperties);
|
232
302
|
});
|
233
|
-
this.addHook('
|
234
|
-
return _this2.
|
235
|
-
});
|
236
|
-
this.addHook('afterScrollVertically', function () {
|
237
|
-
return _this2.hide();
|
303
|
+
this.addHook('afterScroll', function () {
|
304
|
+
return _this2.onAfterScroll();
|
238
305
|
});
|
239
306
|
this.addHook('afterBeginEditing', function () {
|
240
307
|
return _this2.hide();
|
241
308
|
});
|
242
|
-
this.
|
309
|
+
this.addHook('afterDocumentKeyDown', function (event) {
|
310
|
+
return _this2.onAfterDocumentKeyDown(event);
|
311
|
+
});
|
312
|
+
_classPrivateFieldGet(this, _displaySwitch).addLocalHook('hide', function () {
|
243
313
|
return _this2.hide();
|
244
314
|
});
|
245
|
-
this.
|
315
|
+
_classPrivateFieldGet(this, _displaySwitch).addLocalHook('show', function (row, col) {
|
246
316
|
return _this2.showAtCell(row, col);
|
247
317
|
});
|
318
|
+
this.registerShortcuts();
|
248
319
|
this.registerListeners();
|
249
320
|
_get(_getPrototypeOf(Comments.prototype), "enablePlugin", this).call(this);
|
250
321
|
}
|
@@ -258,10 +329,8 @@ var Comments = /*#__PURE__*/function (_BasePlugin) {
|
|
258
329
|
}, {
|
259
330
|
key: "updatePlugin",
|
260
331
|
value: function updatePlugin() {
|
261
|
-
this.
|
262
|
-
this.enablePlugin();
|
332
|
+
_classPrivateFieldGet(this, _displaySwitch).updateDelay(this.getDisplayDelaySetting());
|
263
333
|
_get(_getPrototypeOf(Comments.prototype), "updatePlugin", this).call(this);
|
264
|
-
this.displaySwitch.updateDelay(this.getDisplayDelaySetting());
|
265
334
|
}
|
266
335
|
|
267
336
|
/**
|
@@ -270,9 +339,82 @@ var Comments = /*#__PURE__*/function (_BasePlugin) {
|
|
270
339
|
}, {
|
271
340
|
key: "disablePlugin",
|
272
341
|
value: function disablePlugin() {
|
342
|
+
this.unregisterShortcuts();
|
273
343
|
_get(_getPrototypeOf(Comments.prototype), "disablePlugin", this).call(this);
|
274
344
|
}
|
275
345
|
|
346
|
+
/**
|
347
|
+
* Register shortcuts responsible for toggling context menu.
|
348
|
+
*
|
349
|
+
* @private
|
350
|
+
*/
|
351
|
+
}, {
|
352
|
+
key: "registerShortcuts",
|
353
|
+
value: function registerShortcuts() {
|
354
|
+
var _this3 = this;
|
355
|
+
var manager = this.hot.getShortcutManager();
|
356
|
+
var gridContext = manager.getContext('grid');
|
357
|
+
var pluginContext = manager.addContext(SHORTCUTS_CONTEXT_NAME);
|
358
|
+
gridContext.addShortcut({
|
359
|
+
keys: [['Control', 'Alt', 'M']],
|
360
|
+
callback: function callback() {
|
361
|
+
var range = _this3.hot.getSelectedRangeLast();
|
362
|
+
_classPrivateFieldSet(_this3, _preventEditorHiding, true);
|
363
|
+
_this3.hot.scrollToFocusedCell(function () {
|
364
|
+
_this3.setRange(range);
|
365
|
+
_this3.show();
|
366
|
+
_this3.focusEditor();
|
367
|
+
manager.setActiveContextName(SHORTCUTS_CONTEXT_NAME);
|
368
|
+
_this3.hot._registerTimeout(function () {
|
369
|
+
_classPrivateFieldSet(_this3, _preventEditorHiding, false);
|
370
|
+
});
|
371
|
+
});
|
372
|
+
},
|
373
|
+
stopPropagation: true,
|
374
|
+
runOnlyIf: function runOnlyIf() {
|
375
|
+
var _this3$hot$getSelecte;
|
376
|
+
return ((_this3$hot$getSelecte = _this3.hot.getSelectedRangeLast()) === null || _this3$hot$getSelecte === void 0 ? void 0 : _this3$hot$getSelecte.highlight.isCell()) && !_classPrivateFieldGet(_this3, _editor).isVisible();
|
377
|
+
},
|
378
|
+
group: SHORTCUTS_GROUP
|
379
|
+
});
|
380
|
+
pluginContext.addShortcut({
|
381
|
+
keys: [['Escape']],
|
382
|
+
callback: function callback() {
|
383
|
+
_classPrivateFieldGet(_this3, _editor).setValue(_classPrivateFieldGet(_this3, _commentValueBeforeSave));
|
384
|
+
_this3.hide();
|
385
|
+
manager.setActiveContextName('grid');
|
386
|
+
},
|
387
|
+
runOnlyIf: function runOnlyIf() {
|
388
|
+
var _this3$hot$getSelecte2;
|
389
|
+
return ((_this3$hot$getSelecte2 = _this3.hot.getSelectedRangeLast()) === null || _this3$hot$getSelecte2 === void 0 ? void 0 : _this3$hot$getSelecte2.highlight.isCell()) && _classPrivateFieldGet(_this3, _editor).isVisible();
|
390
|
+
},
|
391
|
+
group: SHORTCUTS_GROUP
|
392
|
+
});
|
393
|
+
pluginContext.addShortcut({
|
394
|
+
keys: [['Control/Meta', 'Enter']],
|
395
|
+
callback: function callback() {
|
396
|
+
_this3.hide();
|
397
|
+
manager.setActiveContextName('grid');
|
398
|
+
},
|
399
|
+
runOnlyIf: function runOnlyIf() {
|
400
|
+
var _this3$hot$getSelecte3;
|
401
|
+
return ((_this3$hot$getSelecte3 = _this3.hot.getSelectedRangeLast()) === null || _this3$hot$getSelecte3 === void 0 ? void 0 : _this3$hot$getSelecte3.highlight.isCell()) && _classPrivateFieldGet(_this3, _editor).isVisible();
|
402
|
+
},
|
403
|
+
group: SHORTCUTS_GROUP
|
404
|
+
});
|
405
|
+
}
|
406
|
+
|
407
|
+
/**
|
408
|
+
* Unregister shortcuts responsible for toggling context menu.
|
409
|
+
*
|
410
|
+
* @private
|
411
|
+
*/
|
412
|
+
}, {
|
413
|
+
key: "unregisterShortcuts",
|
414
|
+
value: function unregisterShortcuts() {
|
415
|
+
this.hot.getShortcutManager().getContext('grid').removeShortcutsByGroup(SHORTCUTS_GROUP);
|
416
|
+
}
|
417
|
+
|
276
418
|
/**
|
277
419
|
* Registers all necessary DOM listeners.
|
278
420
|
*
|
@@ -281,25 +423,29 @@ var Comments = /*#__PURE__*/function (_BasePlugin) {
|
|
281
423
|
}, {
|
282
424
|
key: "registerListeners",
|
283
425
|
value: function registerListeners() {
|
284
|
-
var
|
426
|
+
var _this4 = this;
|
285
427
|
var rootDocument = this.hot.rootDocument;
|
428
|
+
var editorElement = this.getEditorInputElement();
|
286
429
|
this.eventManager.addEventListener(rootDocument, 'mouseover', function (event) {
|
287
|
-
return
|
430
|
+
return _this4.onMouseOver(event);
|
288
431
|
});
|
289
432
|
this.eventManager.addEventListener(rootDocument, 'mousedown', function (event) {
|
290
|
-
return
|
433
|
+
return _this4.onMouseDown(event);
|
291
434
|
});
|
292
435
|
this.eventManager.addEventListener(rootDocument, 'mouseup', function () {
|
293
|
-
return
|
436
|
+
return _this4.onMouseUp();
|
294
437
|
});
|
295
|
-
this.eventManager.addEventListener(
|
296
|
-
return
|
438
|
+
this.eventManager.addEventListener(editorElement, 'focus', function () {
|
439
|
+
return _this4.onEditorFocus();
|
297
440
|
});
|
298
|
-
this.eventManager.addEventListener(
|
299
|
-
return
|
441
|
+
this.eventManager.addEventListener(editorElement, 'blur', function () {
|
442
|
+
return _this4.onEditorBlur();
|
300
443
|
});
|
301
|
-
this.eventManager.addEventListener(
|
302
|
-
return
|
444
|
+
this.eventManager.addEventListener(editorElement, 'mousedown', function (event) {
|
445
|
+
return _this4.onEditorMouseDown(event);
|
446
|
+
});
|
447
|
+
this.eventManager.addEventListener(editorElement, 'mouseup', function (event) {
|
448
|
+
return _this4.onEditorMouseUp(event);
|
303
449
|
});
|
304
450
|
}
|
305
451
|
|
@@ -347,7 +493,7 @@ var Comments = /*#__PURE__*/function (_BasePlugin) {
|
|
347
493
|
}, {
|
348
494
|
key: "targetIsCommentTextArea",
|
349
495
|
value: function targetIsCommentTextArea(event) {
|
350
|
-
return this.
|
496
|
+
return this.getEditorInputElement() === event.target;
|
351
497
|
}
|
352
498
|
|
353
499
|
/**
|
@@ -361,7 +507,7 @@ var Comments = /*#__PURE__*/function (_BasePlugin) {
|
|
361
507
|
if (!this.range.from) {
|
362
508
|
throw new Error('Before using this method, first set cell range (hot.getPlugin("comment").setRange())');
|
363
509
|
}
|
364
|
-
var editorValue = this.
|
510
|
+
var editorValue = _classPrivateFieldGet(this, _editor).getValue();
|
365
511
|
var comment = '';
|
366
512
|
if (value !== null && value !== void 0) {
|
367
513
|
comment = value;
|
@@ -470,8 +616,9 @@ var Comments = /*#__PURE__*/function (_BasePlugin) {
|
|
470
616
|
return false;
|
471
617
|
}
|
472
618
|
var meta = this.hot.getCellMeta(this.range.from.row, this.range.from.col);
|
473
|
-
this.
|
474
|
-
this.
|
619
|
+
_classPrivateFieldGet(this, _displaySwitch).cancelHiding();
|
620
|
+
_classPrivateFieldGet(this, _editor).setValue(meta[META_COMMENT] ? meta[META_COMMENT][META_COMMENT_VALUE] : null || '');
|
621
|
+
_classPrivateFieldGet(this, _editor).show();
|
475
622
|
this.refreshEditor(true);
|
476
623
|
return true;
|
477
624
|
}
|
@@ -498,7 +645,7 @@ var Comments = /*#__PURE__*/function (_BasePlugin) {
|
|
498
645
|
}, {
|
499
646
|
key: "hide",
|
500
647
|
value: function hide() {
|
501
|
-
this.
|
648
|
+
_classPrivateFieldGet(this, _editor).hide();
|
502
649
|
}
|
503
650
|
|
504
651
|
/**
|
@@ -511,7 +658,7 @@ var Comments = /*#__PURE__*/function (_BasePlugin) {
|
|
511
658
|
value: function refreshEditor() {
|
512
659
|
var _renderableRow, _renderableColumn;
|
513
660
|
var force = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
514
|
-
if (!force && (!this.range.from || !this.
|
661
|
+
if (!force && (!this.range.from || !_classPrivateFieldGet(this, _editor).isVisible())) {
|
515
662
|
return;
|
516
663
|
}
|
517
664
|
var _this$hot = this.hot,
|
@@ -527,7 +674,7 @@ var Comments = /*#__PURE__*/function (_BasePlugin) {
|
|
527
674
|
|
528
675
|
// Reset the editor position to (0, 0) so the opening direction calculation wouldn't be influenced by its
|
529
676
|
// previous position
|
530
|
-
this.
|
677
|
+
_classPrivateFieldGet(this, _editor).setPosition(0, 0);
|
531
678
|
if (renderableRow === null) {
|
532
679
|
renderableRow = rowIndexMapper.getRenderableFromVisualIndex(rowIndexMapper.getNearestNotHiddenIndex(visualRow, -1));
|
533
680
|
}
|
@@ -550,9 +697,9 @@ var Comments = /*#__PURE__*/function (_BasePlugin) {
|
|
550
697
|
}, true);
|
551
698
|
var commentStyle = this.getCommentMeta(visualRow, visualColumn, META_STYLE);
|
552
699
|
if (commentStyle) {
|
553
|
-
this.
|
700
|
+
_classPrivateFieldGet(this, _editor).setSize(commentStyle.width, commentStyle.height);
|
554
701
|
} else {
|
555
|
-
this.
|
702
|
+
_classPrivateFieldGet(this, _editor).resetSize();
|
556
703
|
}
|
557
704
|
var lastColWidth = isBeforeRenderedColumns ? 0 : wtTable.getStretchedColumnWidth(renderableColumn);
|
558
705
|
var lastRowHeight = targetingPreviousRow && !isBeforeRenderedRows ? (0, _element.outerHeight)(TD) : 0;
|
@@ -561,9 +708,9 @@ var Comments = /*#__PURE__*/function (_BasePlugin) {
|
|
561
708
|
top = _TD$getBoundingClient.top,
|
562
709
|
cellWidth = _TD$getBoundingClient.width,
|
563
710
|
cellHeight = _TD$getBoundingClient.height;
|
564
|
-
var
|
565
|
-
editorWidth =
|
566
|
-
editorHeight =
|
711
|
+
var _classPrivateFieldGet2 = _classPrivateFieldGet(this, _editor).getSize(),
|
712
|
+
editorWidth = _classPrivateFieldGet2.width,
|
713
|
+
editorHeight = _classPrivateFieldGet2.height;
|
567
714
|
var _this$hot$rootWindow = this.hot.rootWindow,
|
568
715
|
innerWidth = _this$hot$rootWindow.innerWidth,
|
569
716
|
innerHeight = _this$hot$rootWindow.innerHeight;
|
@@ -583,30 +730,17 @@ var Comments = /*#__PURE__*/function (_BasePlugin) {
|
|
583
730
|
if (top + editorHeight > innerHeight) {
|
584
731
|
y -= editorHeight - cellHeight + 1;
|
585
732
|
}
|
586
|
-
this.
|
587
|
-
this.
|
733
|
+
_classPrivateFieldGet(this, _editor).setPosition(x, y);
|
734
|
+
_classPrivateFieldGet(this, _editor).setReadOnlyState(this.getCommentMeta(visualRow, visualColumn, META_READONLY));
|
588
735
|
}
|
589
736
|
|
590
737
|
/**
|
591
|
-
*
|
592
|
-
*
|
593
|
-
* @private
|
594
|
-
* @returns {boolean}
|
738
|
+
* Focuses the comments editor element.
|
595
739
|
*/
|
596
740
|
}, {
|
597
|
-
key: "
|
598
|
-
value: function
|
599
|
-
|
600
|
-
if (!selected) {
|
601
|
-
return false;
|
602
|
-
}
|
603
|
-
var hasComment = false;
|
604
|
-
var cell = selected.getTopStartCorner(); // IN EXCEL THERE IS COMMENT ONLY FOR TOP LEFT CELL IN SELECTION
|
605
|
-
|
606
|
-
if (this.getCommentMeta(cell.row, cell.col, META_COMMENT_VALUE)) {
|
607
|
-
hasComment = true;
|
608
|
-
}
|
609
|
-
return hasComment;
|
741
|
+
key: "focusEditor",
|
742
|
+
value: function focusEditor() {
|
743
|
+
_classPrivateFieldGet(this, _editor).focus();
|
610
744
|
}
|
611
745
|
|
612
746
|
/**
|
@@ -660,7 +794,7 @@ var Comments = /*#__PURE__*/function (_BasePlugin) {
|
|
660
794
|
if (!this.hot.view || !this.hot.view._wt) {
|
661
795
|
return;
|
662
796
|
}
|
663
|
-
if (!this
|
797
|
+
if (!_classPrivateFieldGet(this, _preventEditorAutoSwitch) && !this.targetIsCommentTextArea(event)) {
|
664
798
|
var eventCell = (0, _element.closest)(event.target, 'TD', 'TBODY');
|
665
799
|
var coordinates = null;
|
666
800
|
if (eventCell) {
|
@@ -681,17 +815,16 @@ var Comments = /*#__PURE__*/function (_BasePlugin) {
|
|
681
815
|
}, {
|
682
816
|
key: "onMouseOver",
|
683
817
|
value: function onMouseOver(event) {
|
684
|
-
var priv = privatePool.get(this);
|
685
818
|
var rootDocument = this.hot.rootDocument;
|
686
|
-
if (this
|
819
|
+
if (_classPrivateFieldGet(this, _preventEditorAutoSwitch) || _classPrivateFieldGet(this, _editor).isFocused() || (0, _element.hasClass)(event.target, 'wtBorder') || _classPrivateFieldGet(this, _cellBelowCursor) === event.target || !_classPrivateFieldGet(this, _editor)) {
|
687
820
|
return;
|
688
821
|
}
|
689
|
-
|
822
|
+
_classPrivateFieldSet(this, _cellBelowCursor, rootDocument.elementFromPoint(event.clientX, event.clientY));
|
690
823
|
if (this.targetIsCellWithComment(event)) {
|
691
824
|
var range = this.hot._createCellRange(this.hot.getCoords(event.target));
|
692
|
-
this.
|
825
|
+
_classPrivateFieldGet(this, _displaySwitch).show(range);
|
693
826
|
} else if ((0, _element.isChildOf)(event.target, rootDocument) && !this.targetIsCommentTextArea(event)) {
|
694
|
-
this.
|
827
|
+
_classPrivateFieldGet(this, _displaySwitch).hide();
|
695
828
|
}
|
696
829
|
}
|
697
830
|
|
@@ -703,7 +836,7 @@ var Comments = /*#__PURE__*/function (_BasePlugin) {
|
|
703
836
|
}, {
|
704
837
|
key: "onMouseUp",
|
705
838
|
value: function onMouseUp() {
|
706
|
-
this
|
839
|
+
_classPrivateFieldSet(this, _preventEditorAutoSwitch, false);
|
707
840
|
}
|
708
841
|
|
709
842
|
/**
|
@@ -722,16 +855,33 @@ var Comments = /*#__PURE__*/function (_BasePlugin) {
|
|
722
855
|
}
|
723
856
|
|
724
857
|
/**
|
725
|
-
*
|
858
|
+
* Hook observer the "blur" event from the comments editor element. The hook clears the
|
859
|
+
* editor content and gives back the keyboard shortcuts control by switching to the "grid" context.
|
726
860
|
*
|
727
861
|
* @private
|
728
862
|
*/
|
729
863
|
}, {
|
730
864
|
key: "onEditorBlur",
|
731
865
|
value: function onEditorBlur() {
|
866
|
+
_classPrivateFieldSet(this, _commentValueBeforeSave, '');
|
867
|
+
this.hot.getShortcutManager().setActiveContextName('grid');
|
732
868
|
this.setComment();
|
733
869
|
}
|
734
870
|
|
871
|
+
/**
|
872
|
+
* Hook observer the "focus" event from the comments editor element. The hook takes the control of
|
873
|
+
* the keyboard shortcuts by switching the context to plugins one.
|
874
|
+
*
|
875
|
+
* @private
|
876
|
+
*/
|
877
|
+
}, {
|
878
|
+
key: "onEditorFocus",
|
879
|
+
value: function onEditorFocus() {
|
880
|
+
_classPrivateFieldSet(this, _commentValueBeforeSave, this.getComment());
|
881
|
+
this.hot.listen();
|
882
|
+
this.hot.getShortcutManager().setActiveContextName(SHORTCUTS_CONTEXT_NAME);
|
883
|
+
}
|
884
|
+
|
735
885
|
/**
|
736
886
|
* `mousedown` hook. Along with `onEditorMouseUp` used to simulate the textarea resizing event.
|
737
887
|
*
|
@@ -741,11 +891,10 @@ var Comments = /*#__PURE__*/function (_BasePlugin) {
|
|
741
891
|
}, {
|
742
892
|
key: "onEditorMouseDown",
|
743
893
|
value: function onEditorMouseDown(event) {
|
744
|
-
|
745
|
-
priv.tempEditorDimensions = {
|
894
|
+
_classPrivateFieldSet(this, _tempEditorDimensions, {
|
746
895
|
width: (0, _element.outerWidth)(event.target),
|
747
896
|
height: (0, _element.outerHeight)(event.target)
|
748
|
-
};
|
897
|
+
});
|
749
898
|
}
|
750
899
|
|
751
900
|
/**
|
@@ -757,10 +906,9 @@ var Comments = /*#__PURE__*/function (_BasePlugin) {
|
|
757
906
|
}, {
|
758
907
|
key: "onEditorMouseUp",
|
759
908
|
value: function onEditorMouseUp(event) {
|
760
|
-
var priv = privatePool.get(this);
|
761
909
|
var currentWidth = (0, _element.outerWidth)(event.target);
|
762
910
|
var currentHeight = (0, _element.outerHeight)(event.target);
|
763
|
-
if (currentWidth !==
|
911
|
+
if (currentWidth !== _classPrivateFieldGet(this, _tempEditorDimensions).width + 1 || currentHeight !== _classPrivateFieldGet(this, _tempEditorDimensions).height + 2) {
|
764
912
|
this.updateCommentMeta(this.range.from.row, this.range.from.col, _defineProperty({}, META_STYLE, {
|
765
913
|
width: currentWidth,
|
766
914
|
height: currentHeight
|
@@ -769,144 +917,42 @@ var Comments = /*#__PURE__*/function (_BasePlugin) {
|
|
769
917
|
}
|
770
918
|
|
771
919
|
/**
|
772
|
-
*
|
773
|
-
*
|
774
|
-
* @private
|
775
|
-
*/
|
776
|
-
}, {
|
777
|
-
key: "onContextMenuAddComment",
|
778
|
-
value: function onContextMenuAddComment() {
|
779
|
-
var coords = this.hot.getSelectedRangeLast();
|
780
|
-
this.preventEditorAutoSwitch = true;
|
781
|
-
this.displaySwitch.cancelHiding();
|
782
|
-
this.setRange({
|
783
|
-
from: coords.highlight
|
784
|
-
});
|
785
|
-
this.show();
|
786
|
-
this.hot.deselectCell();
|
787
|
-
this.editor.focus();
|
788
|
-
}
|
789
|
-
|
790
|
-
/**
|
791
|
-
* Context Menu's "remove comment" callback.
|
920
|
+
* Observes the pressed keys and if there is already opened the comment editor prevents open
|
921
|
+
* the table editor into the fast edit mode.
|
792
922
|
*
|
793
|
-
* @
|
923
|
+
* @param {Event} event The keydown event.
|
794
924
|
*/
|
795
925
|
}, {
|
796
|
-
key: "
|
797
|
-
value: function
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
coords.forAll(function (row, column) {
|
802
|
-
if (row >= 0 && column >= 0) {
|
803
|
-
_this4.removeCommentAtCell(row, column, false);
|
804
|
-
}
|
805
|
-
});
|
806
|
-
this.hot.render();
|
926
|
+
key: "onAfterDocumentKeyDown",
|
927
|
+
value: function onAfterDocumentKeyDown(event) {
|
928
|
+
if (_classPrivateFieldGet(this, _editor).isVisible()) {
|
929
|
+
(0, _event.stopImmediatePropagation)(event);
|
930
|
+
}
|
807
931
|
}
|
808
932
|
|
809
933
|
/**
|
810
|
-
*
|
811
|
-
*
|
812
|
-
* @private
|
934
|
+
* Observes the changes in the scroll position if triggered it hides the comment editor.
|
813
935
|
*/
|
814
936
|
}, {
|
815
|
-
key: "
|
816
|
-
value: function
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
coords.forAll(function (row, column) {
|
821
|
-
if (row >= 0 && column >= 0) {
|
822
|
-
var currentState = !!_this5.getCommentMeta(row, column, META_READONLY);
|
823
|
-
_this5.updateCommentMeta(row, column, _defineProperty({}, META_READONLY, !currentState));
|
824
|
-
}
|
825
|
-
});
|
937
|
+
key: "onAfterScroll",
|
938
|
+
value: function onAfterScroll() {
|
939
|
+
if (!_classPrivateFieldGet(this, _preventEditorHiding)) {
|
940
|
+
this.hide();
|
941
|
+
}
|
826
942
|
}
|
827
943
|
|
828
944
|
/**
|
829
945
|
* Add Comments plugin options to the Context Menu.
|
830
946
|
*
|
831
947
|
* @private
|
832
|
-
* @param {object}
|
948
|
+
* @param {object} options The menu options.
|
833
949
|
*/
|
834
950
|
}, {
|
835
951
|
key: "addToContextMenu",
|
836
|
-
value: function addToContextMenu(
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
if (!range) {
|
841
|
-
return false;
|
842
|
-
}
|
843
|
-
if (range.isSingleHeader() || range.highlight.isHeader()) {
|
844
|
-
return false;
|
845
|
-
}
|
846
|
-
return _this6.hot.rowIndexMapper.getRenderableIndexesLength() > 0 && _this6.hot.columnIndexMapper.getRenderableIndexesLength() > 0;
|
847
|
-
};
|
848
|
-
defaultOptions.items.push({
|
849
|
-
name: '---------'
|
850
|
-
}, {
|
851
|
-
key: 'commentsAddEdit',
|
852
|
-
name: function name() {
|
853
|
-
if (_this6.checkSelectionCommentsConsistency()) {
|
854
|
-
return _this6.hot.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_EDIT_COMMENT);
|
855
|
-
}
|
856
|
-
return _this6.hot.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ADD_COMMENT);
|
857
|
-
},
|
858
|
-
callback: function callback() {
|
859
|
-
return _this6.onContextMenuAddComment();
|
860
|
-
},
|
861
|
-
disabled: function disabled() {
|
862
|
-
if (!isThereAnySelectedCellToProcess()) {
|
863
|
-
return true;
|
864
|
-
}
|
865
|
-
return !(_this6.hot.getSelectedLast() && !_this6.hot.selection.isSelectedByCorner());
|
866
|
-
}
|
867
|
-
}, {
|
868
|
-
key: 'commentsRemove',
|
869
|
-
name: function name() {
|
870
|
-
return this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_REMOVE_COMMENT);
|
871
|
-
},
|
872
|
-
callback: function callback() {
|
873
|
-
return _this6.onContextMenuRemoveComment();
|
874
|
-
},
|
875
|
-
disabled: function disabled() {
|
876
|
-
if (!isThereAnySelectedCellToProcess()) {
|
877
|
-
return true;
|
878
|
-
}
|
879
|
-
return !(_this6.hot.getSelectedLast() && !_this6.hot.selection.isSelectedByCorner());
|
880
|
-
}
|
881
|
-
}, {
|
882
|
-
key: 'commentsReadOnly',
|
883
|
-
name: function name() {
|
884
|
-
var _this7 = this;
|
885
|
-
var label = this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_READ_ONLY_COMMENT);
|
886
|
-
var hasProperty = (0, _utils.checkSelectionConsistency)(this.getSelectedRangeLast(), function (row, col) {
|
887
|
-
var readOnlyProperty = _this7.getCellMeta(row, col)[META_COMMENT];
|
888
|
-
if (readOnlyProperty) {
|
889
|
-
readOnlyProperty = readOnlyProperty[META_READONLY];
|
890
|
-
}
|
891
|
-
if (readOnlyProperty) {
|
892
|
-
return true;
|
893
|
-
}
|
894
|
-
});
|
895
|
-
if (hasProperty) {
|
896
|
-
label = (0, _utils.markLabelAsSelected)(label);
|
897
|
-
}
|
898
|
-
return label;
|
899
|
-
},
|
900
|
-
callback: function callback() {
|
901
|
-
return _this6.onContextMenuMakeReadOnly();
|
902
|
-
},
|
903
|
-
disabled: function disabled() {
|
904
|
-
if (!isThereAnySelectedCellToProcess()) {
|
905
|
-
return true;
|
906
|
-
}
|
907
|
-
return !(_this6.hot.getSelectedLast() && !_this6.hot.selection.isSelectedByCorner()) || !_this6.checkSelectionCommentsConsistency();
|
908
|
-
}
|
909
|
-
});
|
952
|
+
value: function addToContextMenu(options) {
|
953
|
+
options.items.push({
|
954
|
+
name: _predefinedItems.SEPARATOR
|
955
|
+
}, (0, _addEditComment.default)(this), (0, _removeComment.default)(this), (0, _readOnlyComment.default)(this));
|
910
956
|
}
|
911
957
|
|
912
958
|
/**
|
@@ -924,17 +970,29 @@ var Comments = /*#__PURE__*/function (_BasePlugin) {
|
|
924
970
|
}
|
925
971
|
}
|
926
972
|
|
973
|
+
/**
|
974
|
+
* Gets the editors input element.
|
975
|
+
*
|
976
|
+
* @private
|
977
|
+
* @returns {HTMLTextAreaElement}
|
978
|
+
*/
|
979
|
+
}, {
|
980
|
+
key: "getEditorInputElement",
|
981
|
+
value: function getEditorInputElement() {
|
982
|
+
return _classPrivateFieldGet(this, _editor).getInputElement();
|
983
|
+
}
|
984
|
+
|
927
985
|
/**
|
928
986
|
* Destroys the plugin instance.
|
929
987
|
*/
|
930
988
|
}, {
|
931
989
|
key: "destroy",
|
932
990
|
value: function destroy() {
|
933
|
-
if (this
|
934
|
-
this.
|
991
|
+
if (_classPrivateFieldGet(this, _editor)) {
|
992
|
+
_classPrivateFieldGet(this, _editor).destroy();
|
935
993
|
}
|
936
|
-
if (this
|
937
|
-
this.
|
994
|
+
if (_classPrivateFieldGet(this, _displaySwitch)) {
|
995
|
+
_classPrivateFieldGet(this, _displaySwitch).destroy();
|
938
996
|
}
|
939
997
|
_get(_getPrototypeOf(Comments.prototype), "destroy", this).call(this);
|
940
998
|
}
|