@cocreate/selection 1.2.21 → 1.3.3

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,36 @@
1
+ ## [1.3.3](https://github.com/CoCreate-app/CoCreate-selection/compare/v1.3.2...v1.3.3) (2022-01-01)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * removed data- from attributes ([eeb5317](https://github.com/CoCreate-app/CoCreate-selection/commit/eeb5317308f8edaafac66fe5e39e427cd2c7234f))
7
+
8
+ ## [1.3.2](https://github.com/CoCreate-app/CoCreate-selection/compare/v1.3.1...v1.3.2) (2021-12-15)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * update dependencies ([4204d0b](https://github.com/CoCreate-app/CoCreate-selection/commit/4204d0b9d2848c11b832b556fd184bf1da1610d4))
14
+
15
+ ## [1.3.1](https://github.com/CoCreate-app/CoCreate-selection/compare/v1.3.0...v1.3.1) (2021-12-14)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * update dependencies ([584a23c](https://github.com/CoCreate-app/CoCreate-selection/commit/584a23c2fafbc2410356f7ac5bff3f9149f5152f))
21
+
22
+ # [1.3.0](https://github.com/CoCreate-app/CoCreate-selection/compare/v1.2.21...v1.3.0) (2021-12-14)
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * update dependencies ([4fa877a](https://github.com/CoCreate-app/CoCreate-selection/commit/4fa877ad1df7ec4a58f050a7132aa3f071ccfd5d))
28
+
29
+
30
+ ### Features
31
+
32
+ * support nested contenteditable and selections for cursor positions ([8efc22d](https://github.com/CoCreate-app/CoCreate-selection/commit/8efc22d303ba88dbb6fdbf4d65cb2988afec73ca))
33
+
1
34
  ## [1.2.21](https://github.com/CoCreate-app/CoCreate-selection/compare/v1.2.20...v1.2.21) (2021-12-08)
2
35
 
3
36
 
package/docs/index.html CHANGED
@@ -6,7 +6,7 @@
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1">
7
7
  <title>CoCreate-selection Documentation | CoCreateJS </title>
8
8
  <link rel="icon" type="image/png" sizes="32x32" href="https://cocreate.app/images/favicon.ico">
9
- <meta name="description" content="A simple HTML5 and pure javascript component. Easy configuration using data-attributes and highly styleable." />
9
+ <meta name="description" content="A headless javascript micro component. Easy configuration using HTML5 attributes or JavaScript api." />
10
10
  <meta name="keywords" content="helper classes, utility classes, css framework, css library, inline style classes" />
11
11
  <meta name="robots" content="index,follow" />
12
12
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/selection",
3
- "version": "1.2.21",
3
+ "version": "1.3.3",
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",
@@ -61,8 +61,8 @@
61
61
  "webpack-log": "^3.0.1"
62
62
  },
63
63
  "dependencies": {
64
- "@cocreate/docs": "^1.2.60",
65
- "@cocreate/hosting": "^1.2.56",
66
- "@cocreate/utils": "^1.3.16"
64
+ "@cocreate/docs": "^1.2.62",
65
+ "@cocreate/hosting": "^1.2.58",
66
+ "@cocreate/utils": "^1.4.0"
67
67
  }
68
68
  }
package/src/index.js CHANGED
@@ -62,6 +62,7 @@ export function getSelection(element) {
62
62
 
63
63
  let rangeObj = {
64
64
  element: contenteditable,
65
+ // domTextEditor,
65
66
  startOffset: range.startOffset,
66
67
  endOffset: range.endOffset,
67
68
  startContainer,
@@ -288,9 +289,17 @@ function getInsertPosition(element){
288
289
 
289
290
  export function getStringPosition({string, target, position, attribute, property, value}) {
290
291
  try {
292
+ let element;
291
293
  let selector = cssPath(target, '[contenteditable]');
292
294
  let dom = domParser(string);
293
- let element = dom.querySelector(selector);
295
+ if (!selector.includes('[eid=') && dom.tagName == "DOM-PARSER"){
296
+ let containerEl = document.createElement('div');
297
+ containerEl.appendChild(dom)
298
+ selector = `dom-parser > ${selector}`
299
+ element = containerEl.querySelector(selector);
300
+ }
301
+ else
302
+ element = dom.querySelector(selector);
294
303
  if (!element){
295
304
  console.log('element could not be found using selector:', selector);
296
305
  return;