@cocreate/selection 1.3.2 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,31 @@
1
+ ## [1.4.1](https://github.com/CoCreate-app/CoCreate-selection/compare/v1.4.0...v1.4.1) (2022-02-01)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * update dependency versions ([1b494f0](https://github.com/CoCreate-app/CoCreate-selection/commit/1b494f081a012afbd8fcfe195400946656320fa4))
7
+
8
+ # [1.4.0](https://github.com/CoCreate-app/CoCreate-selection/compare/v1.3.4...v1.4.0) (2022-01-22)
9
+
10
+
11
+ ### Features
12
+
13
+ * removeClass and removeStyle to remove the className or property from CRDT string ([a610075](https://github.com/CoCreate-app/CoCreate-selection/commit/a6100751ec02da5cb3c592f9a1854376d52d55fc))
14
+
15
+ ## [1.3.4](https://github.com/CoCreate-app/CoCreate-selection/compare/v1.3.3...v1.3.4) (2022-01-01)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * get-value attribute value now supports a selector added # to all values currently in get-value attributes ([c2e2f98](https://github.com/CoCreate-app/CoCreate-selection/commit/c2e2f98c7edc523f66d30e1f86cd6c3d512a6219))
21
+
22
+ ## [1.3.3](https://github.com/CoCreate-app/CoCreate-selection/compare/v1.3.2...v1.3.3) (2022-01-01)
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * removed data- from attributes ([eeb5317](https://github.com/CoCreate-app/CoCreate-selection/commit/eeb5317308f8edaafac66fe5e39e427cd2c7234f))
28
+
1
29
  ## [1.3.2](https://github.com/CoCreate-app/CoCreate-selection/compare/v1.3.1...v1.3.2) (2021-12-15)
2
30
 
3
31
 
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
 
@@ -85,7 +85,7 @@
85
85
  <div class="svSplitter svHorizontal"> </div>
86
86
 
87
87
  <div class="svPanel">
88
- <iframe get-value="demo" frameBorder="0" height="100%" width="100%" class="min-width:300px"></iframe>
88
+ <iframe get-value="#demo" frameBorder="0" height="100%" width="100%" class="min-width:300px"></iframe>
89
89
  </div>
90
90
 
91
91
  </div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/selection",
3
- "version": "1.3.2",
3
+ "version": "1.4.1",
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.62",
65
- "@cocreate/hosting": "^1.2.58",
66
- "@cocreate/utils": "^1.4.0"
64
+ "@cocreate/docs": "^1.2.65",
65
+ "@cocreate/hosting": "^1.2.60",
66
+ "@cocreate/utils": "^1.5.0"
67
67
  }
68
68
  }
package/src/index.js CHANGED
@@ -287,7 +287,7 @@ function getInsertPosition(element){
287
287
  return {target, position};
288
288
  }
289
289
 
290
- export function getStringPosition({string, target, position, attribute, property, value}) {
290
+ export function getStringPosition({string, target, position, attribute, property, value, remove}) {
291
291
  try {
292
292
  let element;
293
293
  let selector = cssPath(target, '[contenteditable]');
@@ -325,7 +325,10 @@ export function getStringPosition({string, target, position, attribute, property
325
325
  let attrStart = elString.indexOf(` ${attribute}=`);
326
326
  start = start + attrStart;
327
327
  if (attribute == 'style') {
328
- element.style[property] = value;
328
+ if (remove)
329
+ element.style.removeProperty(property);
330
+ else
331
+ element.style[property] = value;
329
332
  value = element.getAttribute(attribute);
330
333
  }
331
334
  else if (attribute == 'class') {
@@ -340,7 +343,8 @@ export function getStringPosition({string, target, position, attribute, property
340
343
  element.classList.remove(propString);
341
344
  }
342
345
  }
343
- element.classList.add(value);
346
+ if (!remove)
347
+ element.classList.add(value);
344
348
  value = element.getAttribute(attribute);
345
349
  }
346
350
  else {