vue-contenteditable
Advanced tools
Comparing version 4.0.3 to 4.0.4
@@ -1,3 +0,3 @@ | ||
"use strict";var n=require("vue");const s=n.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 o=u;function r(e,t,a){return e.split(t).join(a)}const l=n.ref();n.onMounted(()=>{console.log({"element.value":l.value})});function i(){return o.noHtml?l.value.innerText:l.value.innerHTML}function c(e){o.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");o.noNl&&(t=r(t,`\r | ||
`," "),t=r(t,` | ||
`," "),t=r(t,"\r"," ")),window.document.execCommand("insertText",!1,t)}function p(e){e.key=="Enter"&&o.noNl&&(e.preventDefault(),d("returned",i()))}return n.onMounted(()=>{var e;c((e=o.modelValue)!=null?e:"")}),n.watch(()=>o.modelValue,(e,t)=>{e!=i()&&c(e!=null?e:"")}),n.watch(()=>o.noHtml,(e,t)=>{var a;c((a=o.modelValue)!=null?a:"")}),(e,t)=>(n.openBlock(),n.createBlock(n.resolveDynamicComponent(u.tag),{contenteditable:u.contenteditable,onInput:f,onBlur:f,onPaste:m,onKeypress:p,ref_key:"element",ref:l},null,40,["contenteditable"]))}});module.exports=s; | ||
"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; |
@@ -30,7 +30,2 @@ import { defineComponent, ref, onMounted, watch, openBlock, createBlock, resolveDynamicComponent } from "vue"; | ||
const element = ref(); | ||
onMounted(() => { | ||
console.log({ | ||
"element.value": element.value | ||
}); | ||
}); | ||
function currentContent() { | ||
@@ -37,0 +32,0 @@ return props.noHtml ? element.value.innerText : element.value.innerHTML; |
@@ -1,3 +0,3 @@ | ||
(function(n,i){typeof exports=="object"&&typeof module!="undefined"?module.exports=i(require("vue")):typeof define=="function"&&define.amd?define(["vue"],i):(n=typeof globalThis!="undefined"?globalThis:n||self,n.contenteditable=i(n.Vue))})(this,function(n){"use strict";return n.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:f}){const o=u;function r(e,t,a){return e.split(t).join(a)}const l=n.ref();n.onMounted(()=>{console.log({"element.value":l.value})});function d(){return o.noHtml?l.value.innerText:l.value.innerHTML}function c(e){o.noHtml?l.value.innerText=e:l.value.innerHTML=e}function m(e){f("update:modelValue",d())}function p(e){e.preventDefault();let t=(e.originalEvent||e).clipboardData.getData("text/plain");o.noNl&&(t=r(t,`\r | ||
`," "),t=r(t,` | ||
`," "),t=r(t,"\r"," ")),window.document.execCommand("insertText",!1,t)}function s(e){e.key=="Enter"&&o.noNl&&(e.preventDefault(),f("returned",d()))}return n.onMounted(()=>{var e;c((e=o.modelValue)!=null?e:"")}),n.watch(()=>o.modelValue,(e,t)=>{e!=d()&&c(e!=null?e:"")}),n.watch(()=>o.noHtml,(e,t)=>{var a;c((a=o.modelValue)!=null?a:"")}),(e,t)=>(n.openBlock(),n.createBlock(n.resolveDynamicComponent(u.tag),{contenteditable:u.contenteditable,onInput:m,onBlur:m,onPaste:p,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 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"]))}})}); |
{ | ||
"name": "vue-contenteditable", | ||
"version": "4.0.3", | ||
"version": "4.0.4", | ||
"author": "LÊo Falventin Hauchecorne", | ||
@@ -5,0 +5,0 @@ "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.", |
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
24232
337