nubitel-vue-tiptap
Advanced tools
Comparing version 1.4.2 to 1.4.4
@@ -1,1 +0,1 @@ | ||
"use strict";var e=require("vue"),t=require("@tiptap/vue-3"),o=require("@tiptap/starter-kit"),i=require("@tiptap/extension-text-align"),a=require("@tiptap/extension-underline"),r=require("@tiptap/extension-subscript"),l=require("@tiptap/extension-superscript"),n=require("@tiptap/extension-character-count"),s=require("@fortawesome/vue-fontawesome"),c=require("@fortawesome/fontawesome-svg-core"),u=require("@fortawesome/free-solid-svg-icons"),d=require("@fortawesome/free-regular-svg-icons"),f=require("@fortawesome/free-brands-svg-icons"),g=require("@heroicons/vue/24/outline");function m(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function p(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(o){if("default"!==o){var i=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,i.get?i:{enumerable:!0,get:function(){return e[o]}})}})),t.default=e,Object.freeze(t)}var v=m(o),b=m(i),x=m(a),y=m(r),h=m(l),L=m(n),k=p(g);const w=["onClick"],C={class:"words-count"};var E=Object.assign({name:"NubitelEditor",components:{EditorContent:t.EditorContent}},{__name:"NubitelEditor",props:{modelValue:{type:String,default:""},editoring:{type:[Object,Array,Boolean,String],default:""},maxLimit:{type:Number,default:3e3},isShowMaxLimit:{type:Boolean,default:!0},isToolbar:{type:Boolean,default:!0},toolbarClass:{type:String,default:""},footerClass:{type:String,default:""}},emits:["update:modelValue"],setup(o,{emit:i}){const a=[{slug:"bold",icon:"fa-solid fa-bold",active:"bold"},{slug:"italic",icon:"fa-solid fa-italic",active:"italic"},{slug:"underline",icon:"fa-solid fa-underline",active:"underline"},{slug:"strike",icon:"fa-solid fa-strikethrough",active:"strike"},{slug:"align",option:"left",icon:"fa-solid fa-align-left",active:{textAlign:"left"}},{slug:"align",option:"center",icon:"fa-solid fa-align-center",active:{textAlign:"center"}},{slug:"align",option:"right",icon:"fa-solid fa-align-right",active:{textAlign:"right"}},{slug:"align",option:"justify",icon:"fa-solid fa-align-justify",active:{textAlign:"justify"}},{slug:"bulletList",icon:"fa-solid fa-list",active:"bulletList"},{slug:"orderedList",icon:"fa-solid fa-list-ol",active:"orderedList"},{slug:"code",icon:"fa-solid fa-code",active:"code"}],r=o,l=i,n=t.useEditor({content:r.modelValue,editorProps:{attributes:{class:""}},extensions:[v.default.configure({orderedList:{HTMLAttributes:{class:"list-decimal px-3"}},bulletList:{HTMLAttributes:{class:"list-disc px-3"}}}),x.default,y.default,h.default,L.default.configure({limit:r.maxLimit}),b.default.configure({types:["heading","paragraph"]})],onUpdate:()=>{const e=n.value.isEmpty?"":n.value.getHTML();console.log("onUpdate",e),l("update:modelValue",e)},...r.editoring}),s=e.computed((()=>n.value.storage.characterCount.characters())),c=e.computed((()=>n.value.storage.characterCount.words())),u=e.computed((()=>{const e=s>=r.maxLimit-20,t=s===r.maxLimit;return e&&!t?"warning":t?"danger":""}));e.watch((()=>r.modelValue),(e=>{console.log("watch",e),n.value.getHTML()!==e&&n.value.commands.setContent(r.modelValue,!1)}));return(o,i)=>{const l=e.resolveComponent("FontAwesomeIcon");return e.openBlock(),e.createElementBlock("div",{id:"nubitel-editor",class:e.normalizeClass(o.$attrs.class)},[r.isToolbar?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["toolbar",r.toolbarClass])},[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(a,(({slug:t,option:o,active:i,icon:a},r)=>e.createElementVNode("button",{class:e.normalizeClass({active:e.unref(n).isActive(i)}),onClick:e.withModifiers((e=>((e,t=null)=>{const o=n.value.chain().focus();({bold:()=>o.toggleBold().run(),italic:()=>o.toggleItalic().run(),underline:()=>o.toggleUnderline().run(),strike:()=>o.toggleStrike().run(),bulletList:()=>o.toggleBulletList().run(),orderedList:()=>o.toggleOrderedList().run(),align:()=>o.setTextAlign(t).run(),code:()=>o.toggleCodeBlock().run()})[e]()})(t,o)),["prevent"])},[e.createVNode(l,{icon:a},null,8,["icon"])],10,w))),64))],2)):e.createCommentVNode("v-if",!0),e.createVNode(e.unref(t.EditorContent),{editor:e.unref(n)},null,8,["editor"]),r.isShowMaxLimit?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["footer",r.footerClass])},[e.createElementVNode("span",{class:e.normalizeClass(["characters-count",r.maxLimit?u.value:""])},e.toDisplayString(s.value)+" "+e.toDisplayString(r.maxLimit?`/ ${r.maxLimit} characters`:"characters"),3),e.createTextVNode(" | "),e.createElementVNode("span",C,e.toDisplayString(c.value)+" words ",1)],2)):e.createCommentVNode("v-if",!0)],2)}}});E.__file="src/plugin/NubitelEditor.vue";const q={NubitelEditor:E,FontAwesomeIcon:s.FontAwesomeIcon};var B={install(e){c.library.add(f.fab,d.far,u.fas);for(const t in q)q.hasOwnProperty(t)&&e.component(q[t].name,q[t]);if(k){Object.keys(k).forEach((t=>{e.component(t,k[t])}))}}};module.exports=B; | ||
"use strict";var e=require("vue"),t=require("@tiptap/vue-3"),o=require("@tiptap/starter-kit"),i=require("@tiptap/extension-text-align"),a=require("@tiptap/extension-underline"),r=require("@tiptap/extension-subscript"),l=require("@tiptap/extension-superscript"),n=require("@tiptap/extension-character-count"),s=require("@fortawesome/vue-fontawesome"),c=require("@fortawesome/fontawesome-svg-core"),u=require("@fortawesome/free-solid-svg-icons"),d=require("@fortawesome/free-regular-svg-icons"),f=require("@fortawesome/free-brands-svg-icons"),g=require("@heroicons/vue/24/outline");function m(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function p(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(o){if("default"!==o){var i=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,i.get?i:{enumerable:!0,get:function(){return e[o]}})}})),t.default=e,Object.freeze(t)}var v=m(o),b=m(i),x=m(a),y=m(r),h=m(l),L=m(n),k=p(g);const w=["onClick"],C={class:"words-count"};var E=Object.assign({name:"NubitelEditor",components:{EditorContent:t.EditorContent}},{__name:"NubitelEditor",props:{modelValue:{type:String,default:""},editoring:{type:[Object,Array,Boolean,String],default:""},maxLimit:{type:Number,default:3e3},isShowMaxLimit:{type:Boolean,default:!0},isToolbar:{type:Boolean,default:!0},toolbarClass:{type:String,default:""},footerClass:{type:String,default:""}},emits:["update:modelValue"],setup(o,{emit:i}){const a=[{slug:"bold",icon:"fa-solid fa-bold",active:"bold"},{slug:"italic",icon:"fa-solid fa-italic",active:"italic"},{slug:"underline",icon:"fa-solid fa-underline",active:"underline"},{slug:"strike",icon:"fa-solid fa-strikethrough",active:"strike"},{slug:"align",option:"left",icon:"fa-solid fa-align-left",active:{textAlign:"left"}},{slug:"align",option:"center",icon:"fa-solid fa-align-center",active:{textAlign:"center"}},{slug:"align",option:"right",icon:"fa-solid fa-align-right",active:{textAlign:"right"}},{slug:"align",option:"justify",icon:"fa-solid fa-align-justify",active:{textAlign:"justify"}},{slug:"bulletList",icon:"fa-solid fa-list",active:"bulletList"},{slug:"orderedList",icon:"fa-solid fa-list-ol",active:"orderedList"},{slug:"code",icon:"fa-solid fa-code",active:"code"}],r=o,l=i,n=t.useEditor({content:r.modelValue,editorProps:{attributes:{class:""}},extensions:[v.default.configure({orderedList:{HTMLAttributes:{class:"list-decimal px-3"}},bulletList:{HTMLAttributes:{class:"list-disc px-3"}}}),x.default,y.default,h.default,L.default.configure({limit:r.maxLimit}),b.default.configure({types:["heading","paragraph"]})],onUpdate:()=>{const e=n.value.isEmpty?"":n.value.getHTML();console.log("onUpdate",e),l("update:modelValue",e)},...r.editoring}),s=e.computed((()=>n.value.storage.characterCount.characters())),c=e.computed((()=>n.value.storage.characterCount.words())),u=e.computed((()=>{const e=s>=r.maxLimit-20,t=s===r.maxLimit;return e&&!t?"warning":t?"danger":""}));e.watch((()=>r.modelValue),(e=>{console.log("watch",e),n.value.getHTML()!==e&&n.value.commands.setContent(r.modelValue,!1)}));return(o,i)=>{const l=e.resolveComponent("FontAwesomeIcon");return e.openBlock(),e.createElementBlock("div",{id:"nubitel-editor",class:e.normalizeClass(o.$attrs.class)},[r.isToolbar&&e.unref(n)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["toolbar",r.toolbarClass])},[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(a,(({slug:t,option:o,active:i,icon:a},r)=>e.createElementVNode("button",{class:e.normalizeClass({active:e.unref(n).isActive(i)}),onClick:e.withModifiers((e=>((e,t=null)=>{const o=n.value.chain().focus();({bold:()=>o.toggleBold().run(),italic:()=>o.toggleItalic().run(),underline:()=>o.toggleUnderline().run(),strike:()=>o.toggleStrike().run(),bulletList:()=>o.toggleBulletList().run(),orderedList:()=>o.toggleOrderedList().run(),align:()=>o.setTextAlign(t).run(),code:()=>o.toggleCodeBlock().run()})[e]()})(t,o)),["prevent"])},[e.createVNode(l,{icon:a},null,8,["icon"])],10,w))),64))],2)):e.createCommentVNode("v-if",!0),e.createVNode(e.unref(t.EditorContent),{editor:e.unref(n)},null,8,["editor"]),e.unref(n)&&r.isShowMaxLimit?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["footer",r.footerClass])},[e.createElementVNode("span",{class:e.normalizeClass(["characters-count",r.maxLimit?u.value:""])},e.toDisplayString(s.value)+" "+e.toDisplayString(r.maxLimit?`/ ${r.maxLimit} characters`:"characters"),3),e.createTextVNode(" | "),e.createElementVNode("span",C,e.toDisplayString(c.value)+" words ",1)],2)):e.createCommentVNode("v-if",!0)],2)}}});E.__file="src/plugin/NubitelEditor.vue";const q={NubitelEditor:E,FontAwesomeIcon:s.FontAwesomeIcon};var B={install(e){c.library.add(f.fab,d.far,u.fas);for(const t in q)q.hasOwnProperty(t)&&e.component(q[t].name,q[t]);if(k){Object.keys(k).forEach((t=>{e.component(t,k[t])}))}}};module.exports=B; |
{ | ||
"name": "nubitel-vue-tiptap", | ||
"version": "1.4.2", | ||
"version": "1.4.4", | ||
"description": "Vue 3 rich text editor based on tiptap", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
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
17620
126