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

@cocreate/selection

Package Overview
Dependencies
Maintainers
1
Versions
168
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cocreate/selection - npm Package Compare versions

Comparing version 1.2.14 to 1.2.15

7

CHANGELOG.md

@@ -0,1 +1,8 @@

## [1.2.15](https://github.com/CoCreate-app/CoCreate-selection/compare/v1.2.14...v1.2.15) (2021-11-24)
### Bug Fixes
* processSelection when at position 0 ([2143e31](https://github.com/CoCreate-app/CoCreate-selection/commit/2143e313e1dcf744980df298790f13442e5715bd))
## [1.2.14](https://github.com/CoCreate-app/CoCreate-selection/compare/v1.2.13...v1.2.14) (2021-11-23)

@@ -2,0 +9,0 @@

2

package.json
{
"name": "@cocreate/selection",
"version": "1.2.14",
"version": "1.2.15",
"description": "A simple selection component in vanilla javascript. Easily configured using HTML5 data-attributes and/or JavaScript API.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -23,3 +23,3 @@ import {cssPath, domParser} from '@cocreate/utils';

let previousSibling = range.startContainer.previousSibling;
if(previousSibling && previousSibling.nodeType == 3) {
if(element.innerHTML && previousSibling && previousSibling.nodeType == 3) {
let length = 0;

@@ -33,2 +33,3 @@ do {

}
if(range.startContainer != range.endContainer) {

@@ -42,3 +43,3 @@ // toDo: replace common ancestor value

let elementStart = start, elementEnd = end;
if (domTextEditor){
if (domTextEditor && domTextEditor.htmlString){
let nodePos = getStringPosition({ string: domTextEditor.htmlString, target: range.startContainer.parentElement, position: 'afterbegin'});

@@ -52,7 +53,16 @@ if (nodePos){

}
let startContainer = range.startContainer;
if (startContainer.nodeType == 3)
startContainer = range.startContainer.parentElement;
let endContainer = range.endContainer;
if (endContainer.nodeType == 3)
endContainer = range.endContainer.parentElement;
let rangeObj = {
startOffset: range.startOffset,
endOffset: range.endOffset,
startContainer: range.startContainer.parentElement,
endContainer: range.endContainer.parentElement,
startContainer,
endContainer,
elementStart,

@@ -92,4 +102,5 @@ elementEnd

let length = prev_start - prevStart;
if(Math.sign(length) === 1 && range.startOffset >= length)
range.startOffset += length;
if(Math.sign(length) === 1)
if (range.startOffset == 0 || range.startOffset >= length)
range.startOffset += length;
}

@@ -103,4 +114,5 @@ if (prevEnd > prev_end){

let length = prev_end - prevEnd;
if(Math.sign(length) === 1 && range.endOffset >= length)
range.endOffset += length;
if(Math.sign(length) === 1)
if (range.endOffset == 0 || range.endOffset >= length)
range.endOffset += length;
}

@@ -107,0 +119,0 @@ }

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