handsontable 0.0.0-next-0146b3f-20240129 → 0.0.0-next-dc31c83-20240131

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/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-0146b3f-20240129";
137
+ const hotVersion = "0.0.0-next-dc31c83-20240131";
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-0146b3f-20240129";
127
+ const hotVersion = "0.0.0-next-dc31c83-20240131";
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-0146b3f-20240129",
13
+ "version": "0.0.0-next-dc31c83-20240131",
14
14
  "main": "index",
15
15
  "module": "index.mjs",
16
16
  "jsnext:main": "index.mjs",
package/tableView.js CHANGED
@@ -307,15 +307,13 @@ class TableView {
307
307
  const {
308
308
  rootElement,
309
309
  rootDocument,
310
- selection
310
+ selection,
311
+ rootWindow
311
312
  } = this.hot;
312
313
  const documentElement = rootDocument.documentElement;
313
314
  this.eventManager.addEventListener(rootElement, 'mousedown', event => {
314
315
  _classPrivateFieldSet(this, _selectionMouseDown, true);
315
316
  if (!this.isTextSelectionAllowed(event.target)) {
316
- const {
317
- rootWindow
318
- } = this.hot;
319
317
  (0, _element.clearTextSelection)(rootWindow);
320
318
  event.preventDefault();
321
319
  rootWindow.focus(); // make sure that window that contains HOT is active. Important when HOT is in iframe.
@@ -328,7 +326,7 @@ class TableView {
328
326
  if (_classPrivateFieldGet(this, _selectionMouseDown) && !this.isTextSelectionAllowed(event.target)) {
329
327
  // Clear selection only when fragmentSelection is enabled, otherwise clearing selection breaks the IME editor.
330
328
  if (this.settings.fragmentSelection) {
331
- (0, _element.clearTextSelection)(this.hot.rootWindow);
329
+ (0, _element.clearTextSelection)(rootWindow);
332
330
  }
333
331
  event.preventDefault();
334
332
  }
@@ -408,6 +406,13 @@ class TableView {
408
406
  this.hot.destroyEditor(false, false);
409
407
  }
410
408
  });
409
+ let parentWindow = (0, _element.getParentWindow)(rootWindow);
410
+ while (parentWindow !== null) {
411
+ this.eventManager.addEventListener(parentWindow.document.documentElement, 'click', () => {
412
+ this.hot.unlisten();
413
+ });
414
+ parentWindow = (0, _element.getParentWindow)(parentWindow);
415
+ }
411
416
  this.eventManager.addEventListener(_classPrivateFieldGet(this, _table), 'selectstart', event => {
412
417
  if (this.settings.fragmentSelection || (0, _element.isInput)(event.target)) {
413
418
  return;
package/tableView.mjs CHANGED
@@ -12,7 +12,7 @@ function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) {
12
12
  function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
13
13
  function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
14
14
  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; } }
15
- import { addClass, clearTextSelection, empty, fastInnerHTML, fastInnerText, getScrollbarWidth, hasClass, isChildOf, isInput, isOutsideInput, isVisible, setAttribute } from "./helpers/dom/element.mjs";
15
+ import { addClass, clearTextSelection, empty, fastInnerHTML, fastInnerText, getScrollbarWidth, hasClass, isChildOf, isInput, isOutsideInput, isVisible, setAttribute, getParentWindow } from "./helpers/dom/element.mjs";
16
16
  import EventManager from "./eventManager.mjs";
17
17
  import { isImmediatePropagationStopped, isRightClick, isLeftClick } from "./helpers/dom/event.mjs";
18
18
  import Walkontable from "./3rdparty/walkontable/src/index.mjs";
@@ -303,15 +303,13 @@ class TableView {
303
303
  const {
304
304
  rootElement,
305
305
  rootDocument,
306
- selection
306
+ selection,
307
+ rootWindow
307
308
  } = this.hot;
308
309
  const documentElement = rootDocument.documentElement;
309
310
  this.eventManager.addEventListener(rootElement, 'mousedown', event => {
310
311
  _classPrivateFieldSet(this, _selectionMouseDown, true);
311
312
  if (!this.isTextSelectionAllowed(event.target)) {
312
- const {
313
- rootWindow
314
- } = this.hot;
315
313
  clearTextSelection(rootWindow);
316
314
  event.preventDefault();
317
315
  rootWindow.focus(); // make sure that window that contains HOT is active. Important when HOT is in iframe.
@@ -324,7 +322,7 @@ class TableView {
324
322
  if (_classPrivateFieldGet(this, _selectionMouseDown) && !this.isTextSelectionAllowed(event.target)) {
325
323
  // Clear selection only when fragmentSelection is enabled, otherwise clearing selection breaks the IME editor.
326
324
  if (this.settings.fragmentSelection) {
327
- clearTextSelection(this.hot.rootWindow);
325
+ clearTextSelection(rootWindow);
328
326
  }
329
327
  event.preventDefault();
330
328
  }
@@ -404,6 +402,13 @@ class TableView {
404
402
  this.hot.destroyEditor(false, false);
405
403
  }
406
404
  });
405
+ let parentWindow = getParentWindow(rootWindow);
406
+ while (parentWindow !== null) {
407
+ this.eventManager.addEventListener(parentWindow.document.documentElement, 'click', () => {
408
+ this.hot.unlisten();
409
+ });
410
+ parentWindow = getParentWindow(parentWindow);
411
+ }
407
412
  this.eventManager.addEventListener(_classPrivateFieldGet(this, _table), 'selectstart', event => {
408
413
  if (this.settings.fragmentSelection || isInput(event.target)) {
409
414
  return;
@@ -5,7 +5,6 @@ exports._dataToHTML = _dataToHTML;
5
5
  exports.htmlToGridSettings = htmlToGridSettings;
6
6
  exports.instanceToHTML = instanceToHTML;
7
7
  require("core-js/modules/es.array.push.js");
8
- require("core-js/modules/es.string.replace-all.js");
9
8
  var _mixed = require("./../helpers/mixed");
10
9
  const ESCAPED_HTML_CHARS = {
11
10
  '&nbsp;': '\x20',
@@ -141,14 +140,7 @@ function htmlToGridSettings(element) {
141
140
  if (typeof checkElement === 'string') {
142
141
  const escapedAdjacentHTML = checkElement.replace(/<td\b[^>]*?>([\s\S]*?)<\/\s*td>/g, cellFragment => {
143
142
  const openingTag = cellFragment.match(/<td\b[^>]*?>/g)[0];
144
- const paragraphRegexp = /<p.*?>/g;
145
- const cellValue = cellFragment.substring(openingTag.length, cellFragment.lastIndexOf('<')).trim() // Removing whitespaces from the start and the end of HTML fragment
146
- .replaceAll(/\n\s+/g, ' ') // HTML tags may be split using multiple new lines and whitespaces
147
- .replaceAll(paragraphRegexp, '\n') // Only paragraphs should split text using new line characters
148
- .replace('\n', '') // First paragraph shouldn't start with new line characters
149
- .replaceAll(/<\/(.*)>\s+$/mg, '</$1>') // HTML tags may end with whitespace.
150
- .replace(/(<(?!br)([^>]+)>)/gi, '') // Removing HTML tags
151
- .replaceAll(/^&nbsp;$/mg, ''); // Removing single &nbsp; characters separating new lines
143
+ const cellValue = cellFragment.substring(openingTag.length, cellFragment.lastIndexOf('<')).replace(/(<(?!br)([^>]+)>)/gi, '');
152
144
  const closingTag = '</td>';
153
145
  return `${openingTag}${cellValue}${closingTag}`;
154
146
  });
@@ -1,5 +1,4 @@
1
1
  import "core-js/modules/es.array.push.js";
2
- import "core-js/modules/es.string.replace-all.js";
3
2
  import { isEmpty } from "./../helpers/mixed.mjs";
4
3
  const ESCAPED_HTML_CHARS = {
5
4
  '&nbsp;': '\x20',
@@ -135,14 +134,7 @@ export function htmlToGridSettings(element) {
135
134
  if (typeof checkElement === 'string') {
136
135
  const escapedAdjacentHTML = checkElement.replace(/<td\b[^>]*?>([\s\S]*?)<\/\s*td>/g, cellFragment => {
137
136
  const openingTag = cellFragment.match(/<td\b[^>]*?>/g)[0];
138
- const paragraphRegexp = /<p.*?>/g;
139
- const cellValue = cellFragment.substring(openingTag.length, cellFragment.lastIndexOf('<')).trim() // Removing whitespaces from the start and the end of HTML fragment
140
- .replaceAll(/\n\s+/g, ' ') // HTML tags may be split using multiple new lines and whitespaces
141
- .replaceAll(paragraphRegexp, '\n') // Only paragraphs should split text using new line characters
142
- .replace('\n', '') // First paragraph shouldn't start with new line characters
143
- .replaceAll(/<\/(.*)>\s+$/mg, '</$1>') // HTML tags may end with whitespace.
144
- .replace(/(<(?!br)([^>]+)>)/gi, '') // Removing HTML tags
145
- .replaceAll(/^&nbsp;$/mg, ''); // Removing single &nbsp; characters separating new lines
137
+ const cellValue = cellFragment.substring(openingTag.length, cellFragment.lastIndexOf('<')).replace(/(<(?!br)([^>]+)>)/gi, '');
146
138
  const closingTag = '</td>';
147
139
  return `${openingTag}${cellValue}${closingTag}`;
148
140
  });