@cocreate/selection 1.3.4 → 1.4.3
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 +28 -0
- package/docs/index.html +1 -1
- package/package.json +4 -4
- package/src/index.js +7 -3
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,31 @@
|
|
1
|
+
## [1.4.3](https://github.com/CoCreate-app/CoCreate-selection/compare/v1.4.2...v1.4.3) (2022-02-07)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* bump dependency versions ([3a3094f](https://github.com/CoCreate-app/CoCreate-selection/commit/3a3094f4f9812f76bbbc6b7711d680ddac54ee10))
|
7
|
+
|
8
|
+
## [1.4.2](https://github.com/CoCreate-app/CoCreate-selection/compare/v1.4.1...v1.4.2) (2022-02-03)
|
9
|
+
|
10
|
+
|
11
|
+
### Bug Fixes
|
12
|
+
|
13
|
+
* replaced show and hide class hidden with attribute hidden ([25ce786](https://github.com/CoCreate-app/CoCreate-selection/commit/25ce78697207e5194dda27f7a6e5bed92e00b3bd))
|
14
|
+
|
15
|
+
## [1.4.1](https://github.com/CoCreate-app/CoCreate-selection/compare/v1.4.0...v1.4.1) (2022-02-01)
|
16
|
+
|
17
|
+
|
18
|
+
### Bug Fixes
|
19
|
+
|
20
|
+
* update dependency versions ([1b494f0](https://github.com/CoCreate-app/CoCreate-selection/commit/1b494f081a012afbd8fcfe195400946656320fa4))
|
21
|
+
|
22
|
+
# [1.4.0](https://github.com/CoCreate-app/CoCreate-selection/compare/v1.3.4...v1.4.0) (2022-01-22)
|
23
|
+
|
24
|
+
|
25
|
+
### Features
|
26
|
+
|
27
|
+
* removeClass and removeStyle to remove the className or property from CRDT string ([a610075](https://github.com/CoCreate-app/CoCreate-selection/commit/a6100751ec02da5cb3c592f9a1854376d52d55fc))
|
28
|
+
|
1
29
|
## [1.3.4](https://github.com/CoCreate-app/CoCreate-selection/compare/v1.3.3...v1.3.4) (2022-01-01)
|
2
30
|
|
3
31
|
|
package/docs/index.html
CHANGED
@@ -72,7 +72,7 @@
|
|
72
72
|
<div class="container svColumn overflow:hidden card position:relative border-radius:2px width:auto height:100%" id="sandbox">
|
73
73
|
<div class="font-size:20px position:absolute top:10px right:10px opacity:0.6">
|
74
74
|
<a class="margin-right:10px" id="code" show="#preview" hide="#code, #view"><i class="far fa-eye"></i></a>
|
75
|
-
<a class="margin-right:10px
|
75
|
+
<a class="margin-right:10px" id="preview" show="#code, #view" hide="#preview" hidden><i class="fas fa-code"></i></a>
|
76
76
|
<a class="margin-right:5px" fullscreen target="#playground"><i class="fas fa-expand"></i></a>
|
77
77
|
</div>
|
78
78
|
<div class="svRow">
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@cocreate/selection",
|
3
|
-
"version": "1.3
|
3
|
+
"version": "1.4.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.
|
65
|
-
"@cocreate/hosting": "^1.2.
|
66
|
-
"@cocreate/utils": "^1.
|
64
|
+
"@cocreate/docs": "^1.2.67",
|
65
|
+
"@cocreate/hosting": "^1.2.62",
|
66
|
+
"@cocreate/utils": "^1.6.2"
|
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
|
-
|
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
|
-
|
346
|
+
if (!remove)
|
347
|
+
element.classList.add(value);
|
344
348
|
value = element.getAttribute(attribute);
|
345
349
|
}
|
346
350
|
else {
|