@cocreate/selection 1.5.5 → 1.5.7
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +14 -0
- package/package.json +4 -4
- package/src/index.js +6 -6
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
## [1.5.7](https://github.com/CoCreate-app/CoCreate-selection/compare/v1.5.6...v1.5.7) (2023-04-13)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* replaced substr with substring ([e51f5e6](https://github.com/CoCreate-app/CoCreate-selection/commit/e51f5e631dc6b5d7b0da3de10cc4371227d008b0))
|
7
|
+
|
8
|
+
## [1.5.6](https://github.com/CoCreate-app/CoCreate-selection/compare/v1.5.5...v1.5.6) (2023-04-11)
|
9
|
+
|
10
|
+
|
11
|
+
### Bug Fixes
|
12
|
+
|
13
|
+
* bump dependencies ([31b86de](https://github.com/CoCreate-app/CoCreate-selection/commit/31b86deb08a9306f69721c0dcb64f2571ef8a272))
|
14
|
+
|
1
15
|
## [1.5.5](https://github.com/CoCreate-app/CoCreate-selection/compare/v1.5.4...v1.5.5) (2023-04-11)
|
2
16
|
|
3
17
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@cocreate/selection",
|
3
|
-
"version": "1.5.
|
3
|
+
"version": "1.5.7",
|
4
4
|
"description": "A simple selection component in vanilla javascript. Easily configured using HTML5 data-attributes and/or JavaScript API.",
|
5
5
|
"keywords": [
|
6
6
|
"selection",
|
@@ -60,8 +60,8 @@
|
|
60
60
|
"webpack-log": "^3.0.1"
|
61
61
|
},
|
62
62
|
"dependencies": {
|
63
|
-
"@cocreate/docs": "^1.6.
|
64
|
-
"@cocreate/hosting": "^1.8.
|
65
|
-
"@cocreate/utils": "^1.19.
|
63
|
+
"@cocreate/docs": "^1.6.5",
|
64
|
+
"@cocreate/hosting": "^1.8.5",
|
65
|
+
"@cocreate/utils": "^1.19.5"
|
66
66
|
}
|
67
67
|
}
|
package/src/index.js
CHANGED
@@ -170,8 +170,8 @@ export function hasSelection(el) {
|
|
170
170
|
|
171
171
|
export function getElementPosition(str, start, end) {
|
172
172
|
let response = {};
|
173
|
-
let startString = str.
|
174
|
-
let endString = str.
|
173
|
+
let startString = str.substring(0, start);
|
174
|
+
let endString = str.substring(start);
|
175
175
|
let angleStart = startString.lastIndexOf("<");
|
176
176
|
let angleEnd = startString.lastIndexOf(">");
|
177
177
|
let endStringAngleEnd = endString.indexOf(">");
|
@@ -205,9 +205,9 @@ export function getElementPosition(str, start, end) {
|
|
205
205
|
let node = str.slice(angleStart, startString.length + endStringAngleEnd + 1);
|
206
206
|
if (node.startsWith("</")) {
|
207
207
|
startNode = node.slice(0, 1) + node.slice(2);
|
208
|
-
startNode = startNode.
|
208
|
+
startNode = startNode.substring(0, startNode.length - 1);
|
209
209
|
nodeStart = startString.lastIndexOf(startNode);
|
210
|
-
let endString1 = str.
|
210
|
+
let endString1 = str.substring(nodeStart);
|
211
211
|
let end = endString1.indexOf(">");
|
212
212
|
nodeEnd = nodeStart + end + 1;
|
213
213
|
type = 'isEndTag';
|
@@ -323,7 +323,7 @@ export function getStringPosition({string, target, position, attribute, property
|
|
323
323
|
}
|
324
324
|
else {
|
325
325
|
start = getElFromString(dom, string, element, 'beforebegin');
|
326
|
-
let elString = string.
|
326
|
+
let elString = string.substring(start);
|
327
327
|
let attrValue = element.getAttribute(attribute);
|
328
328
|
let attrStart = elString.indexOf(` ${attribute}=`);
|
329
329
|
start = start + attrStart;
|
@@ -339,7 +339,7 @@ export function getStringPosition({string, target, position, attribute, property
|
|
339
339
|
if (prop && val){
|
340
340
|
if (attrValue.includes(`${prop}:`)){
|
341
341
|
let propStart = attrValue.indexOf(`${prop}:`);
|
342
|
-
let propString = attrValue.
|
342
|
+
let propString = attrValue.substring(propStart);
|
343
343
|
let propEnd = propString.indexOf(" ");
|
344
344
|
if (propEnd > 0)
|
345
345
|
propString = propString.slice(0, propEnd);
|