@cocreate/selection 1.4.6 → 1.4.7

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## [1.4.7](https://github.com/CoCreate-app/CoCreate-selection/compare/v1.4.6...v1.4.7) (2022-03-24)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * if insert position is beforeend and the previousSibling is a textnode type=textNode ([031eac5](https://github.com/CoCreate-app/CoCreate-selection/commit/031eac52fdada4eb54675e64a07394a92c616b6e))
7
+ * typo if condition ended with ; and type updated to position for afterbegin ([b916009](https://github.com/CoCreate-app/CoCreate-selection/commit/b91600977f60c43071b06dc66e6ef48ab7fcfc34))
8
+
1
9
  ## [1.4.6](https://github.com/CoCreate-app/CoCreate-selection/compare/v1.4.5...v1.4.6) (2022-02-24)
2
10
 
3
11
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/selection",
3
- "version": "1.4.6",
3
+ "version": "1.4.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",
package/src/index.js CHANGED
@@ -188,10 +188,13 @@ export function getElementPosition(str, start, end) {
188
188
  element = insert.target;
189
189
  position = insert.position;
190
190
  type = 'insertAdjacent';
191
- if(!position)
191
+ if (!position)
192
192
  type = 'textNode';
193
- if (type == 'textNode' || type == 'afterbegin');
193
+ if (position == 'beforeend' && findEl.previousSibling && findEl.previousSibling.nodeType == 3 )
194
+ type = 'textNode';
195
+ if (type == 'textNode' || position == 'afterbegin')
194
196
  nodeStart = start - angleEnd - 1;
197
+
195
198
  findEl.remove();
196
199
  }
197
200
  }