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

carta-md

Package Overview
Dependencies
Maintainers
1
Versions
96
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

carta-md - npm Package Compare versions

Comparing version 4.3.6 to 4.3.7

45

dist/internal/speculative.js

@@ -40,3 +40,5 @@ import { diffChars } from 'diff';

const addedCallback = (change) => {
const node = textNodes[currentNodeIdx] ?? createTemporaryNode(container);
const node = textNodes.at(currentNodeIdx) ?? createTemporaryNode(container);
if (!node)
return; // Could not create a temporary node
const text = node.textContent ?? '';

@@ -49,29 +51,18 @@ const pre = text.slice(0, currentNodeCharIdx);

const removedCallback = (change) => {
// Use the Selection object to delete removed text
const startNodeIdx = currentNodeIdx;
const startNodeCharIdx = currentNodeCharIdx;
advance(change.value.length);
const endNodeIdx = currentNodeIdx;
let endNodeCharIdx = currentNodeCharIdx;
const startNode = textNodes[startNodeIdx];
let endNode = textNodes[endNodeIdx];
if (!endNode) {
// Remove everything
endNode = textNodes.at(-1);
endNodeCharIdx = endNode.textContent?.length ?? 0;
let charsToRemove = change.value.length;
while (charsToRemove > 0) {
const node = textNodes.at(currentNodeIdx);
if (!node)
return; // Could not find a node
const text = node.textContent ?? '';
const availableNodeChars = text.length - currentNodeCharIdx;
const stepsTaken = Math.min(availableNodeChars, charsToRemove);
node.textContent =
text.slice(0, currentNodeCharIdx) + text.slice(currentNodeCharIdx + stepsTaken);
charsToRemove -= stepsTaken;
if (stepsTaken == availableNodeChars) {
currentNodeIdx++;
currentNodeCharIdx = 0;
}
}
const range = new Range();
range.setStart(startNode, startNodeCharIdx);
range.setEnd(endNode, endNodeCharIdx);
const selection = window.getSelection();
if (!selection)
return;
const initialRanges = new Array(selection.rangeCount).map((_, i) => selection.getRangeAt(i));
selection.removeAllRanges();
selection.addRange(range);
selection.deleteFromDocument();
initialRanges.forEach(selection.addRange);
// Go back to start
currentNodeIdx = startNodeIdx;
currentNodeCharIdx = startNodeCharIdx;
};

@@ -78,0 +69,0 @@ for (const change of diff) {

2

package.json

@@ -19,3 +19,3 @@ {

},
"version": "4.3.6",
"version": "4.3.7",
"scripts": {

@@ -22,0 +22,0 @@ "dev": "vite dev",

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