New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@openstax/highlighter

Package Overview
Dependencies
Maintainers
5
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@openstax/highlighter - npm Package Compare versions

Comparing version 1.12.0 to 1.12.1

dist/injectHighlightWrappers.spec.d.ts

12

dist/injectHighlightWrappers.js

@@ -29,2 +29,4 @@ "use strict";

const ALLOWED_ELEMENTS = BLOCK_ELEMENTS.concat(TEXT_ELEMENTS).join(',');
const isEmptyTextNode = (node) => node.nodeType === NODE_TYPE.TEXT_NODE && node.textContent && !node.textContent.trim().length;
const isImgOrMediaSpan = (node) => node.nodeName === 'IMG' || (node.nodeName === 'SPAN' && node.dataset.type === 'media');
function injectHighlightWrappers(highlight, options = {}) {

@@ -197,3 +199,7 @@ const wrapper = createWrapper(Object.assign({ id: highlight.id, timestamp: Date.now() }, options));

}
endContainer = endContainer.previousSibling;
// use previous sibling for end container unless end container is an img/media span preceded by an empty text node
// otherwise highlights ending on an img in firefox may not display correctly due to empty text nodes around img element
if (endContainer.previousSibling && !(isImgOrMediaSpan(endContainer) && isEmptyTextNode(endContainer.previousSibling))) {
endContainer = endContainer.previousSibling;
}
}

@@ -221,4 +227,6 @@ else if (endContainer.nodeType === NODE_TYPE.TEXT_NODE) {

startContainer = startContainer.childNodes.item(range.startOffset);
// use next sibling for start container unless start container is an img/media span followed by an empty text node
// otherwise highlights starting on an img in firefox may not display correctly due to empty text nodes around img element
}
else if (startContainer.nextSibling) {
else if (startContainer.nextSibling && !(isImgOrMediaSpan(startContainer) && isEmptyTextNode(startContainer.nextSibling))) {
startContainer = startContainer.nextSibling;

@@ -225,0 +233,0 @@ }

2

package.json
{
"name": "@openstax/highlighter",
"version": "1.12.0",
"version": "1.12.1",
"main": "dist/index.js",

@@ -5,0 +5,0 @@ "license": "MIT",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc