aloha-vue 1.0.211 → 1.0.212

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.
@@ -1,7 +1,12 @@
1
+ import ASafeHtml from "../../../../src/directives/ASafeHtml";
2
+
1
3
  export default {
2
4
  name: "PageSvg",
3
5
  components: {
4
6
 
7
+ },
8
+ directives: {
9
+ ASafeHtml,
5
10
  },
6
11
  setup() {
7
12
  const pathD = `M3,1
@@ -16,7 +21,10 @@ export default {
16
21
  A3,1 0 0,0 7,1
17
22
  A2.4,1 0 0,0 3,1`;
18
23
 
24
+ const linkHtml = "<a href='https://www.google.com/' target='_blank'>https://www.google.com/</a>";
25
+
19
26
  return {
27
+ linkHtml,
20
28
  pathD,
21
29
  };
22
30
  },
@@ -15,4 +15,8 @@ div
15
15
 
16
16
  img(
17
17
  src="public/Width.png"
18
- )
18
+ )
19
+
20
+ div(
21
+ v-a-safe-html="linkHtml"
22
+ )
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "aloha-vue",
3
3
  "description": "Project aloha",
4
- "version": "1.0.211",
4
+ "version": "1.0.212",
5
5
  "author": "Ilia Brykin",
6
6
  "scripts": {
7
7
  "build-icons": "node scriptsNode/iconsSvgToJs.js bootstrap3 && node scriptsNode/iconsSvgToJs.js bootstrap-1-9-1"
@@ -1,22 +1,12 @@
1
- import DOMPurify from "dompurify";
2
-
3
1
  import {
4
- isNumber,
5
- toString,
6
- } from "lodash-es";
2
+ sanitizeLocal,
3
+ } from "../utils/utils";
7
4
 
8
5
  export default {
9
6
  beforeMount(el, binding) {
10
- el.innerHTML = DOMPurify.sanitize(toCorrectFormat(binding.value));
7
+ el.innerHTML = sanitizeLocal(binding.value);
11
8
  },
12
9
  updated(el, binding) {
13
- el.innerHTML = DOMPurify.sanitize(toCorrectFormat(binding.value));
10
+ el.innerHTML = sanitizeLocal(binding.value);
14
11
  },
15
12
  };
16
-
17
- function toCorrectFormat(value) {
18
- if (isNumber(value)) {
19
- return toString(value);
20
- }
21
- return value;
22
- }
@@ -1,7 +1,22 @@
1
1
  import DOMPurify from "dompurify";
2
2
 
3
- export const sanitize = DOMPurify.sanitize;
3
+ import {
4
+ isNumber,
5
+ toString,
6
+ } from "lodash-es";
7
+
4
8
  export const dompurify = DOMPurify;
9
+ export const sanitize = DOMPurify.sanitize;
10
+ export function sanitizeLocal(value) {
11
+ return DOMPurify.sanitize(toCorrectFormat(value), { ADD_ATTR: ["target"] });
12
+ }
13
+
14
+ function toCorrectFormat(value) {
15
+ if (isNumber(value)) {
16
+ return toString(value);
17
+ }
18
+ return value;
19
+ }
5
20
 
6
21
  export function getPropByPath(object, path, defaultValue) {
7
22
  const _path = Array.isArray(path)