Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@linalgo/annotate-core

Package Overview
Dependencies
Maintainers
2
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@linalgo/annotate-core - npm Package Compare versions

Comparing version 0.0.13 to 0.0.14

2

package.json
{
"name": "@linalgo/annotate-core",
"version": "0.0.13",
"version": "0.0.14",
"description": "A library for html document annotations following W3C standards.",

@@ -5,0 +5,0 @@ "main": "./dist/index.js",

@@ -12,3 +12,3 @@ export * from './annotators';

// const annotator = new Annotator(document, 'b');
// const annotator = new Annotator(document, 'mark');
// function highlight(range: Range) {

@@ -15,0 +15,0 @@ // const annotation = annotator.createAnnotation(range, 'test', 'test', document.URL, 'test');

@@ -8,2 +8,6 @@ import { XPathSelection } from './selection';

this.range = range;
const startContainer = getPathTo(range.startContainer, rootNode, this.ignoreNodeName)
const endContainer = getPathTo(range.endContainer, rootNode, this.ignoreNodeName)
const startOffset = getNormalizedOffset(range.startContainer, range.startOffset, this.ignoreNodeName)
const endOffset = getNormalizedOffset(range.endContainer, range.endOffset, this.ignoreNodeName)
this.selection = {

@@ -28,3 +32,3 @@ startContainer: getPathTo(range.startContainer, rootNode, this.ignoreNodeName),

return this.range;
} catch(e) {
} catch (e) {
throw new Error(`Could not find node with selection ${selection}`);

@@ -66,4 +70,6 @@ }

while (!node.isSameNode(fromNode)) {
if (node.nodeType != Node.TEXT_NODE && nodeName(node) !== ignoreNodeName) {
path = `/${nodeName(node)}[${nodePosition(node)}]${path}`;
if (node.nodeType != Node.TEXT_NODE) {
if (nodeName(node) !== ignoreNodeName) {
path = `/${nodeName(node)}[${nodePosition(node)}]${path}`;
}
}

@@ -89,5 +95,5 @@ node = node.parentNode;

function getNormalizedOffset(node: Node, offset: number, ignoreNodeName: string): number {
let parentNode = node.parentNode;
let parentNode = node;
while (parentNode.nodeType == node.TEXT_NODE || nodeName(parentNode) == ignoreNodeName) {
parentNode = node.parentNode;
parentNode = parentNode.parentNode;
}

@@ -94,0 +100,0 @@ let newOffset = 0;

Sorry, the diff of this file is too big to display

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