UNPKG

vue-3-linkify

Version:

Linkify.js for Vue.js 3

25 lines 667 B
import linkifyHtml from "linkify-html"; import xss from "xss"; const linkify = (rawHtml, options) => { const sanitized = xss(rawHtml); return linkifyHtml(sanitized, options); }; const directive = { beforeMount(element, binding) { element.innerHTML = linkify(element.innerHTML, binding.value); }, updated(element, binding) { element.innerHTML = linkify(element.innerHTML, binding.value); }, }; const mixin = { directives: { Linkify: directive }, }; const plugin = { install(app) { app.directive("linkify", directive); }, }; export { directive, mixin }; export default plugin; //# sourceMappingURL=main.js.map