Files
Automata/packages/editor-ui/src/components/PageAlert.vue
OlegIvaniv ea2d18b66d feat(editor): Implement HTML sanitization for Notification and Message components (#4081)
* feat(editor): Implement HTML sanitization when using `dangerouslyUseHTMLString` option of Notification and Message components

* 🐛 Implement mechanism to allow for A href actions from locale strings

* 🐛 Prevent link action default

* ♻️ Use `xss` library instead of `sanitize-html` to handle sanitization

* 🔥 Remove `onLinkClick` functionality of `$showMessage`
2022-09-13 17:39:47 +02:00

49 lines
839 B
Vue

<template>
<fragment></fragment>
</template>
<script lang="ts">
import mixins from 'vue-typed-mixins';
import { showMessage } from './mixins/showMessage';
import { ElMessageComponent } from 'element-ui/types/message';
import { sanitizeHtml } from '@/utils';
export default mixins(
showMessage,
).extend({
name: 'PageAlert',
props: {
message: {
type: String,
required: true,
},
popupClass: {
type: String,
},
},
data() {
return {
alert: null as null | ElMessageComponent,
};
},
mounted() {
this.alert = this.$showAlert({
message: sanitizeHtml(this.message),
type: 'warning',
duration: 0,
showClose: true,
dangerouslyUseHTMLString: true,
// @ts-ignore
customClass: this.popupClass || '',
});
},
beforeDestroy() {
if (this.alert) {
this.alert.close();
}
},
});
</script>