vue-contenteditable
Advanced tools
Comparing version 4.0.4 to 4.1.0
@@ -1,3 +0,3 @@ | ||
"use strict";var o=require("vue");const s=o.defineComponent({__name:"contenteditable",props:{tag:String,contenteditable:{type:[Boolean,String],default:!0},modelValue:String,noHtml:{type:Boolean,default:!0},noNl:{type:Boolean,default:!1}},emits:{returned:String,"update:modelValue":String},setup(r,{emit:d}){const n=r;function u(e,t,a){return e.split(t).join(a)}const l=o.ref();function i(){return n.noHtml?l.value.innerText:l.value.innerHTML}function c(e){n.noHtml?l.value.innerText=e:l.value.innerHTML=e}function f(e){d("update:modelValue",i())}function m(e){e.preventDefault();let t=(e.originalEvent||e).clipboardData.getData("text/plain");n.noNl&&(t=u(t,`\r | ||
`," "),t=u(t,` | ||
`," "),t=u(t,"\r"," ")),window.document.execCommand("insertText",!1,t)}function p(e){e.key=="Enter"&&n.noNl&&(e.preventDefault(),d("returned",i()))}return o.onMounted(()=>{var e;c((e=n.modelValue)!=null?e:"")}),o.watch(()=>n.modelValue,(e,t)=>{e!=i()&&c(e!=null?e:"")}),o.watch(()=>n.noHtml,(e,t)=>{var a;c((a=n.modelValue)!=null?a:"")}),(e,t)=>(o.openBlock(),o.createBlock(o.resolveDynamicComponent(r.tag),{contenteditable:r.contenteditable,onInput:f,onBlur:f,onPaste:m,onKeypress:p,ref_key:"element",ref:l},null,40,["contenteditable"]))}});module.exports=s; | ||
"use strict";var l=require("vue");const s=l.defineComponent({__name:"contenteditable",props:{tag:String,contenteditable:{type:[Boolean,String],default:!0},modelValue:String,noHtml:{type:Boolean,default:!0},noNl:{type:Boolean,default:!1}},emits:{returned:String,"update:modelValue":String},setup(u,{emit:d}){const n=u;function i(e,t,o){return e.split(t).join(o)}const a=l.ref();function c(){return n.noHtml?a.value.innerText:a.value.innerHTML}function r(e){n.noHtml?a.value.innerText=e:a.value.innerHTML=e}function f(e){d("update:modelValue",c())}function m(e){e.preventDefault();let t=(e.originalEvent||e).clipboardData.getData("text/plain");n.noNl&&(t=i(t,`\r | ||
`," "),t=i(t,` | ||
`," "),t=i(t,"\r"," ")),window.document.execCommand("insertText",!1,t)}function p(e){e.key=="Enter"&&n.noNl&&(e.preventDefault(),d("returned",c()))}return l.onMounted(()=>{var e;r((e=n.modelValue)!=null?e:"")}),l.watch(()=>n.modelValue,(e,t)=>{e!=c()&&r(e!=null?e:"")}),l.watch(()=>n.noHtml,(e,t)=>{var o;r((o=n.modelValue)!=null?o:"")}),l.watch(()=>n.tag,(e,t)=>{var o;r((o=n.modelValue)!=null?o:"")},{flush:"post"}),(e,t)=>(l.openBlock(),l.createBlock(l.resolveDynamicComponent(u.tag),{contenteditable:u.contenteditable,onInput:f,onBlur:f,onPaste:m,onKeypress:p,ref_key:"element",ref:a},null,40,["contenteditable"]))}});module.exports=s; |
@@ -72,2 +72,6 @@ import { defineComponent, ref, onMounted, watch, openBlock, createBlock, resolveDynamicComponent } from "vue"; | ||
}); | ||
watch(() => props.tag, (newval, oldval) => { | ||
var _a; | ||
updateContent((_a = props.modelValue) != null ? _a : ""); | ||
}, { flush: "post" }); | ||
return (_ctx, _cache) => { | ||
@@ -74,0 +78,0 @@ return openBlock(), createBlock(resolveDynamicComponent(__props.tag), { |
@@ -1,3 +0,3 @@ | ||
(function(t,i){typeof exports=="object"&&typeof module!="undefined"?module.exports=i(require("vue")):typeof define=="function"&&define.amd?define(["vue"],i):(t=typeof globalThis!="undefined"?globalThis:t||self,t.contenteditable=i(t.Vue))})(this,function(t){"use strict";return t.defineComponent({__name:"contenteditable",props:{tag:String,contenteditable:{type:[Boolean,String],default:!0},modelValue:String,noHtml:{type:Boolean,default:!0},noNl:{type:Boolean,default:!1}},emits:{returned:String,"update:modelValue":String},setup(r,{emit:c}){const o=r;function u(e,n,a){return e.split(n).join(a)}const l=t.ref();function d(){return o.noHtml?l.value.innerText:l.value.innerHTML}function f(e){o.noHtml?l.value.innerText=e:l.value.innerHTML=e}function p(e){c("update:modelValue",d())}function m(e){e.preventDefault();let n=(e.originalEvent||e).clipboardData.getData("text/plain");o.noNl&&(n=u(n,`\r | ||
`," "),n=u(n,` | ||
`," "),n=u(n,"\r"," ")),window.document.execCommand("insertText",!1,n)}function s(e){e.key=="Enter"&&o.noNl&&(e.preventDefault(),c("returned",d()))}return t.onMounted(()=>{var e;f((e=o.modelValue)!=null?e:"")}),t.watch(()=>o.modelValue,(e,n)=>{e!=d()&&f(e!=null?e:"")}),t.watch(()=>o.noHtml,(e,n)=>{var a;f((a=o.modelValue)!=null?a:"")}),(e,n)=>(t.openBlock(),t.createBlock(t.resolveDynamicComponent(r.tag),{contenteditable:r.contenteditable,onInput:p,onBlur:p,onPaste:m,onKeypress:s,ref_key:"element",ref:l},null,40,["contenteditable"]))}})}); | ||
(function(t,i){typeof exports=="object"&&typeof module!="undefined"?module.exports=i(require("vue")):typeof define=="function"&&define.amd?define(["vue"],i):(t=typeof globalThis!="undefined"?globalThis:t||self,t.contenteditable=i(t.Vue))})(this,function(t){"use strict";return t.defineComponent({__name:"contenteditable",props:{tag:String,contenteditable:{type:[Boolean,String],default:!0},modelValue:String,noHtml:{type:Boolean,default:!0},noNl:{type:Boolean,default:!1}},emits:{returned:String,"update:modelValue":String},setup(r,{emit:c}){const o=r;function d(e,n,l){return e.split(n).join(l)}const a=t.ref();function f(){return o.noHtml?a.value.innerText:a.value.innerHTML}function u(e){o.noHtml?a.value.innerText=e:a.value.innerHTML=e}function p(e){c("update:modelValue",f())}function s(e){e.preventDefault();let n=(e.originalEvent||e).clipboardData.getData("text/plain");o.noNl&&(n=d(n,`\r | ||
`," "),n=d(n,` | ||
`," "),n=d(n,"\r"," ")),window.document.execCommand("insertText",!1,n)}function m(e){e.key=="Enter"&&o.noNl&&(e.preventDefault(),c("returned",f()))}return t.onMounted(()=>{var e;u((e=o.modelValue)!=null?e:"")}),t.watch(()=>o.modelValue,(e,n)=>{e!=f()&&u(e!=null?e:"")}),t.watch(()=>o.noHtml,(e,n)=>{var l;u((l=o.modelValue)!=null?l:"")}),t.watch(()=>o.tag,(e,n)=>{var l;u((l=o.modelValue)!=null?l:"")},{flush:"post"}),(e,n)=>(t.openBlock(),t.createBlock(t.resolveDynamicComponent(r.tag),{contenteditable:r.contenteditable,onInput:p,onBlur:p,onPaste:s,onKeypress:m,ref_key:"element",ref:a},null,40,["contenteditable"]))}})}); |
{ | ||
"name": "vue-contenteditable", | ||
"version": "4.0.4", | ||
"version": "4.1.0", | ||
"scripts": { | ||
"build": "vite build && vue-tsc --declaration --emitDeclarationOnly --outFile dist/vue-contenteditable.js" | ||
}, | ||
"author": "Léo Falventin Hauchecorne", | ||
@@ -39,6 +42,3 @@ "description": "This plugin provides a `<contenteditable/>` element supporting `v-model`. It also provides some (optional) features, like preventing html input and paste, or new lines.", | ||
"main": "dist/vue-contenteditable.es.js", | ||
"types": "dist/vue-contenteditable.d.ts", | ||
"scripts": { | ||
"build": "vite build && vue-tsc --declaration --emitDeclarationOnly --outFile dist/vue-contenteditable.js" | ||
} | ||
} | ||
"types": "dist/vue-contenteditable.d.ts" | ||
} |
@@ -108,3 +108,3 @@ | ||
<template> | ||
<contenteditable tag="div" :contenteditable="isEditable" v-model="message" :noNL="true" :noHTML="true" @returned="enterPressed" /> | ||
<contenteditable tag="div" :contenteditable="isEditable" v-model="message" :no-nl="true" :no-html="true" @returned="enterPressed" /> | ||
</template> | ||
@@ -111,0 +111,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
24549
341