@perlego-oss/text-highlighter
Advanced tools
Comparing version 2.1.0-alpha.4 to 2.1.0-alpha.5
@@ -331,5 +331,5 @@ "use strict"; | ||
var _findNodesAndOffsets = (0, _highlights.findNodesAndOffsets)(hl, parentNode, self.options.excludeNodes, self.options.excludeWhiteSpaceAndReturns), | ||
highlightNodes = _findNodesAndOffsets.nodesAndOffsets; | ||
nodesAndOffsets = _findNodesAndOffsets.nodesAndOffsets; | ||
highlightNodes.forEach(function (_ref) { | ||
nodesAndOffsets.forEach(function (_ref) { | ||
var node = _ref.node, | ||
@@ -336,0 +336,0 @@ offsetWithinNode = _ref.offset, |
@@ -161,3 +161,4 @@ "use strict"; | ||
* Deals with normalising text for when carriage returns and white space | ||
* that directly follows should be ignored. | ||
* that directly follows or when white space and white space that directly | ||
* follows should be ignored. | ||
* | ||
@@ -169,3 +170,3 @@ * @param {string} text | ||
function normaliseText(text) { | ||
return text.replace(/((\r\n|\n\r|\n|\r)\s*)/g, ""); | ||
return text.replace(/(((\r\n|\n\r|\n|\r)\s*)|(^\s+))/g, ""); | ||
} | ||
@@ -172,0 +173,0 @@ /** |
{ | ||
"name": "@perlego-oss/text-highlighter", | ||
"version": "2.1.0-alpha.4", | ||
"version": "2.1.0-alpha.5", | ||
"description": "TextHighlighter allows you to highlight text on web pages.", | ||
@@ -5,0 +5,0 @@ "dependencies": {}, |
@@ -311,3 +311,3 @@ import { | ||
const parentNode = self.el; | ||
const { nodesAndOffsets: highlightNodes } = findNodesAndOffsets( | ||
const { nodesAndOffsets } = findNodesAndOffsets( | ||
hl, | ||
@@ -319,3 +319,3 @@ parentNode, | ||
highlightNodes.forEach(({ node, offset: offsetWithinNode, length: lengthInNode }) => { | ||
nodesAndOffsets.forEach(({ node, offset: offsetWithinNode, length: lengthInNode }) => { | ||
const { priorities, namespaceDataAttribute } = self.options; | ||
@@ -322,0 +322,0 @@ const higherPriorityHighlights = findHigherPriorityHighlights( |
@@ -134,3 +134,4 @@ /** | ||
* Deals with normalising text for when carriage returns and white space | ||
* that directly follows should be ignored. | ||
* that directly follows or when white space and white space that directly | ||
* follows should be ignored. | ||
* | ||
@@ -140,3 +141,3 @@ * @param {string} text | ||
function normaliseText(text) { | ||
return text.replace(/((\r\n|\n\r|\n|\r)\s*)/g, ""); | ||
return text.replace(/(((\r\n|\n\r|\n|\r)\s*)|(^\s+))/g, ""); | ||
} | ||
@@ -143,0 +144,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
5511847
161508