@fishawack/lab-velocity 0.3.7 → 0.3.9
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/form/Wysiwyg.vue +18 -1
- package/package.json +3 -2
package/form/Wysiwyg.vue
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
import Quill from "quill";
|
|
12
12
|
import input from "./input.js";
|
|
13
13
|
import XInput from "./input.vue";
|
|
14
|
+
import sanitizeHtml from 'sanitize-html';
|
|
14
15
|
|
|
15
16
|
export default {
|
|
16
17
|
mixins: [input],
|
|
@@ -56,11 +57,27 @@ export default {
|
|
|
56
57
|
: this.editor.root.innerHTML;
|
|
57
58
|
},
|
|
58
59
|
setValue() {
|
|
59
|
-
|
|
60
|
+
const temp =
|
|
60
61
|
this.simple && this.modelValue // Surround text in p tags to keep it grouped correctly on simple strings. Ignore if modelValue empty otherwise you'll end up with <p>null</p>
|
|
61
62
|
? `<p>${this.modelValue}</p>`
|
|
62
63
|
: this.modelValue;
|
|
64
|
+
this.editor.root.innerHTML = this.formatCleaner(temp);
|
|
63
65
|
},
|
|
66
|
+
// Function to remove p tags from inside li tags, breaks the wysiwyg
|
|
67
|
+
formatCleaner(unformmatted) {
|
|
68
|
+
if(!unformmatted) {
|
|
69
|
+
return "";
|
|
70
|
+
}
|
|
71
|
+
let parser = document.createElement('div');
|
|
72
|
+
parser.innerHTML = unformmatted.replace(/(\r\n|\n|\r|\t)/gm,"");
|
|
73
|
+
const lists = parser.getElementsByTagName('ul');
|
|
74
|
+
for(var x = 0; x < lists.length; x++) {
|
|
75
|
+
lists[x].innerHTML = sanitizeHtml(lists[x].innerHTML, {
|
|
76
|
+
allowedTags: [ 'b', 'i', 'em', 'strong', 'a','li']
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
return parser.innerHTML;
|
|
80
|
+
}
|
|
64
81
|
},
|
|
65
82
|
|
|
66
83
|
mounted() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fishawack/lab-velocity",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.9",
|
|
4
4
|
"description": "Avalere Health branded style system",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"setup": "npm ci || npm i && npm run content",
|
|
@@ -41,7 +41,8 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"element-plus": "^2.7.8",
|
|
44
|
-
"quill": "^1.3.7"
|
|
44
|
+
"quill": "^1.3.7",
|
|
45
|
+
"sanitize-html": "^2.13.1"
|
|
45
46
|
},
|
|
46
47
|
"files": [
|
|
47
48
|
"*.scss",
|