handsontable 0.0.0-next-c40f8b4-20240131 → 0.0.0-next-ffffb2f-20240131

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/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-c40f8b4-20240131";
137
+ const hotVersion = "0.0.0-next-ffffb2f-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-c40f8b4-20240131";
127
+ const hotVersion = "0.0.0-next-ffffb2f-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-c40f8b4-20240131",
13
+ "version": "0.0.0-next-ffffb2f-20240131",
14
14
  "main": "index",
15
15
  "module": "index.mjs",
16
16
  "jsnext:main": "index.mjs",
@@ -5,6 +5,7 @@ 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");
8
9
  var _mixed = require("./../helpers/mixed");
9
10
  const ESCAPED_HTML_CHARS = {
10
11
  '&nbsp;': '\x20',
@@ -140,7 +141,14 @@ function htmlToGridSettings(element) {
140
141
  if (typeof checkElement === 'string') {
141
142
  const escapedAdjacentHTML = checkElement.replace(/<td\b[^>]*?>([\s\S]*?)<\/\s*td>/g, cellFragment => {
142
143
  const openingTag = cellFragment.match(/<td\b[^>]*?>/g)[0];
143
- const cellValue = cellFragment.substring(openingTag.length, cellFragment.lastIndexOf('<')).replace(/(<(?!br)([^>]+)>)/gi, '');
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
144
152
  const closingTag = '</td>';
145
153
  return `${openingTag}${cellValue}${closingTag}`;
146
154
  });
@@ -1,4 +1,5 @@
1
1
  import "core-js/modules/es.array.push.js";
2
+ import "core-js/modules/es.string.replace-all.js";
2
3
  import { isEmpty } from "./../helpers/mixed.mjs";
3
4
  const ESCAPED_HTML_CHARS = {
4
5
  '&nbsp;': '\x20',
@@ -134,7 +135,14 @@ export function htmlToGridSettings(element) {
134
135
  if (typeof checkElement === 'string') {
135
136
  const escapedAdjacentHTML = checkElement.replace(/<td\b[^>]*?>([\s\S]*?)<\/\s*td>/g, cellFragment => {
136
137
  const openingTag = cellFragment.match(/<td\b[^>]*?>/g)[0];
137
- const cellValue = cellFragment.substring(openingTag.length, cellFragment.lastIndexOf('<')).replace(/(<(?!br)([^>]+)>)/gi, '');
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
138
146
  const closingTag = '</td>';
139
147
  return `${openingTag}${cellValue}${closingTag}`;
140
148
  });