mirror of
https://github.com/nextcloud/server.git
synced 2026-04-06 09:37:01 -04:00
12 lines
14 KiB
JavaScript
12 lines
14 KiB
JavaScript
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=[window.OC.filePath('', '', 'dist/index-GnRymwze.chunk.mjs'),window.OC.filePath('', '', 'dist/index-Bp9-GhMo.chunk.mjs'),window.OC.filePath('', '', 'dist/NcAvatar-ruClKRzS-D00PbCEA.chunk.mjs'),window.OC.filePath('', '', 'dist/index-ClciYKp3.chunk.mjs'),window.OC.filePath('', '', 'dist/preload-helper-DoJVKVMq.chunk.mjs'),window.OC.filePath('', '', 'dist/util-Caafb9Jl.chunk.mjs'),window.OC.filePath('', '', 'dist/NcModal-kyWZ3UFC-BxKwwKAq.chunk.mjs'),window.OC.filePath('', '', 'dist/mdi-BUoBIgaz.chunk.mjs'),window.OC.filePath('', '', 'dist/NcIconSvgWrapper-De-2-ukl-CcvQeIAt.chunk.mjs'),window.OC.filePath('', '', 'dist/translation-DoG5ZELJ-DJHEP2RB.chunk.mjs'),window.OC.filePath('', '', 'dist/NcIconSvgWrapper-De-2-ukl-C_oBIsvc.chunk.css'),window.OC.filePath('', '', 'dist/public-CvthP4YJ.chunk.mjs'),window.OC.filePath('', '', 'dist/mdi-D7L4ZBkR.chunk.css'),window.OC.filePath('', '', 'dist/NcModal-kyWZ3UFC-DgqchLjq.chunk.css'),window.OC.filePath('', '', 'dist/colors-BfjxNgsx-Dyl_2CuU.chunk.mjs'),window.OC.filePath('', '', 'dist/NcUserStatusIcon-JWiuiAXe-BJYvYIQF.chunk.mjs'),window.OC.filePath('', '', 'dist/NcUserStatusIcon-JWiuiAXe-Bq_6hmXG.chunk.css'),window.OC.filePath('', '', 'dist/PencilOutline-BzoFsBsK.chunk.mjs'),window.OC.filePath('', '', 'dist/PencilOutline-DdQinVMt.chunk.css'),window.OC.filePath('', '', 'dist/NcDateTime.vue_vue_type_script_setup_true_lang-B4upiZjL-L27IwP9h.chunk.mjs'),window.OC.filePath('', '', 'dist/NcDateTime-DS-ziNw6.chunk.css'),window.OC.filePath('', '', 'dist/Web-rJva_rmF.chunk.mjs'),window.OC.filePath('', '', 'dist/Web-BYHcrfvW.chunk.css'),window.OC.filePath('', '', 'dist/NcAvatar-ruClKRzS-CVm1ngoc.chunk.css'),window.OC.filePath('', '', 'dist/emoji-V9hqFgPs-DG-_iBjD.chunk.mjs'),window.OC.filePath('', '', 'dist/index-CGU4a9vr.chunk.mjs'),window.OC.filePath('', '', 'dist/NcCheckboxRadioSwitch-D0gFwEVl-CZhGfPiT.chunk.mjs'),window.OC.filePath('', '', 'dist/NcCheckboxRadioSwitch-D0gFwEVl-CQwJiKOs.chunk.css'),window.OC.filePath('', '', 'dist/NcSelect-B1uITk_3-D769WsNG.chunk.mjs'),window.OC.filePath('', '', 'dist/NcSelect-B1uITk_3-B9mkBKAR.chunk.css'),window.OC.filePath('', '', 'dist/NcEmptyContent-CDgWCt_m-MnlDvtO9.chunk.mjs'),window.OC.filePath('', '', 'dist/NcEmptyContent-CDgWCt_m-DoZPzs7J.chunk.css'),window.OC.filePath('', '', 'dist/NcTextField.vue_vue_type_script_setup_true_lang-B-4HNjYH-C1HLa-yu.chunk.mjs'),window.OC.filePath('', '', 'dist/NcInputField-CPL-a_MM-DHVwy56P.chunk.mjs'),window.OC.filePath('', '', 'dist/NcInputField-CPL-a_MM-Bsffit-T.chunk.css'),window.OC.filePath('', '', 'dist/index--M3XHucY.chunk.css'),window.OC.filePath('', '', 'dist/index-DK2nV6zf.chunk.css')])))=>i.map(i=>d[i]);
|
||
import{o as n,f as h,g as u,t as y,h as N,m as V,a as T,K as U,L as H,c as p,w as m,F as w,P as W,_ as v,r as c,k as d,H as K,j as C,M as Z,b as G}from"./preload-helper-DoJVKVMq.chunk.mjs";import{a as f,c as J}from"./index-Bp9-GhMo.chunk.mjs";import{t as Q}from"./translation-DoG5ZELJ-DJHEP2RB.chunk.mjs";import{d as X,m as A}from"./pinia-BrO7AuLF.chunk.mjs";import{N as Y,P as ee}from"./PencilOutline-BzoFsBsK.chunk.mjs";import{a as te}from"./NcModal-kyWZ3UFC-BxKwwKAq.chunk.mjs";/* empty css */import{_ as oe}from"./NcIconSvgWrapper-De-2-ukl-CcvQeIAt.chunk.mjs";import{N as ie}from"./NcAvatar-ruClKRzS-D00PbCEA.chunk.mjs";import{N as se,A as ae}from"./mdi-BUoBIgaz.chunk.mjs";import{_ as re}from"./NcDateTime.vue_vue_type_script_setup_true_lang-B4upiZjL-L27IwP9h.chunk.mjs";import{N as ne}from"./Web-rJva_rmF.chunk.mjs";import{N as ce}from"./NcUserBubble-BE6yD-R0-BVT_gW8E.chunk.mjs";import{_ as S,l as me}from"./public-CvthP4YJ.chunk.mjs";import{D as de}from"./TrashCanOutline-D66Xz3gd.chunk.mjs";import{a as I,T as le,f as ue}from"./index-C1xmmKTZ-CmvjJKkk.chunk.mjs";import{l as g}from"./activity-DdSAHrqw.chunk.mjs";import{c as D,a as pe}from"./GetComments-DHvGzfol.chunk.mjs";import{c as x}from"./index-ClciYKp3.chunk.mjs";const he={name:"NcActionSeparator"},ge={class:"action action-separator action--disabled",role:"separator"};function ye(e,o,i,a,r,s){return n(),h("li",ge)}const fe=oe(he,[["render",ye],["__scopeId","data-v-3e2324b7"]]),be={name:"CloseIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}},_e=["aria-hidden","aria-label"],Ce=["fill","width","height"],Ie={d:"M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z"},Ne={key:0};function De(e,o,i,a,r,s){return n(),h("span",V(e.$attrs,{"aria-hidden":i.title?null:"true","aria-label":i.title,class:"material-design-icon close-icon",role:"img",onClick:o[0]||(o[0]=b=>e.$emit("click",b))}),[(n(),h("svg",{fill:i.fillColor,class:"material-design-icon__svg",width:i.size,height:i.size,viewBox:"0 0 24 24"},[u("path",Ie,[i.title?(n(),h("title",Ne,y(i.title),1)):N("",!0)])],8,Ce))],16,_e)}const ke=S(be,[["render",De]]);async function we(e,o,i){const a=["",e,o,i].join("/");await D.deleteFile(a)}async function Le(e,o,i,a){const r=["",e,o,i].join("/");return await D.customRequest(r,{method:"PROPPATCH",data:`<?xml version="1.0"?>
|
||
<d:propertyupdate
|
||
xmlns:d="DAV:"
|
||
xmlns:oc="http://owncloud.org/ns">
|
||
<d:set>
|
||
<d:prop>
|
||
<oc:message>${a}</oc:message>
|
||
</d:prop>
|
||
</d:set>
|
||
</d:propertyupdate>`})}function L(e,o=1){const i=new DOMParser;let a=e;for(let r=0;r<o;r++)a=i.parseFromString(a,"text/html").documentElement.textContent;return a}async function Te(e,o,i){const a=["",e,o].join("/"),r=await x.post(pe()+a,{actorDisplayName:f().displayName,actorId:f().uid,actorType:"users",creationDateTime:new Date().toUTCString(),message:i,objectType:e,verb:"comment"}),s=parseInt(r.headers["content-location"].split("/").pop()),b=a+"/"+s,_=await D.stat(b,{details:!0}),l=_.data.props;return l.actorDisplayName=L(l.actorDisplayName,2),l.message=L(l.message,2),_.data}const M=X("deletedCommentLimbo",{state:()=>({idsInLimbo:[]}),actions:{addId(e){this.idsInLimbo.push(e)},removeId(e){const o=this.idsInLimbo.indexOf(e);o>-1&&this.idsInLimbo.splice(o,1)},checkForId(e){return this.idsInLimbo.includes(e)}}}),ve={props:{id:{type:Number,default:null},message:{type:String,default:""},resourceId:{type:[String,Number],required:!0},resourceType:{type:String,default:"files"}},data(){return{deleted:!1,editing:!1,loading:!1}},computed:{...A(M)},methods:{onEdit(){this.editing=!0},onEditCancel(){this.editing=!1,this.updateLocalMessage(this.message)},async onEditComment(e){this.loading=!0;try{await Le(this.resourceType,this.resourceId,this.id,e),g.debug("Comment edited",{resourceType:this.resourceType,resourceId:this.resourceId,id:this.id,message:e}),this.$emit("update:message",e),this.editing=!1}catch(o){I(t("comments","An error occurred while trying to edit the comment")),g.error("An error occurred while trying to edit the comment",{error:o})}finally{this.loading=!1}},onDeleteWithUndo(){this.$emit("delete"),this.deleted=!0,this.deletedCommentLimboStore.addId(this.id);const e=setTimeout(this.onDelete,le);ue(t("comments","Comment deleted"),()=>{clearTimeout(e),this.deleted=!1,this.deletedCommentLimboStore.removeId(this.id)})},async onDelete(){try{await we(this.resourceType,this.resourceId,this.id),g.debug("Comment deleted",{resourceType:this.resourceType,resourceId:this.resourceId,id:this.id}),this.$emit("delete",this.id)}catch(e){I(t("comments","An error occurred while trying to delete the comment")),g.error("An error occurred while trying to delete the comment",{error:e}),this.deleted=!1,this.deletedCommentLimboStore.removeId(this.id)}},async onNewComment(e){this.loading=!0;try{const o=await Te(this.resourceType,this.resourceId,e);g.debug("New comment posted",{resourceType:this.resourceType,resourceId:this.resourceId,newComment:o}),this.$emit("new",o),this.$emit("update:message",""),this.localMessage=""}catch(o){I(t("comments","An error occurred while trying to create the comment")),g.error("An error occurred while trying to create the comment",{error:o})}finally{this.loading=!1}}}},Ae=T(()=>v(()=>import("./index-GnRymwze.chunk.mjs"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36]),import.meta.url)),Se=T(()=>v(()=>import("./index-CGU4a9vr.chunk.mjs").then(e=>e.i),__vite__mapDeps([25,4,7,8,9,1,10,11,12,26,21,22,27,3,5,28,6,13,29,30,31,32,33,34,35]),import.meta.url)),xe={name:"Comment",components:{IconArrowRight:ae,IconClose:ke,IconTrashCanOutline:de,IconPencilOutline:ee,NcActionButton:Y,NcActions:te,NcActionSeparator:fe,NcAvatar:ie,NcButton:se,NcDateTime:re,NcLoadingIcon:ne,NcRichContenteditable:Ae,NcRichText:Se},mixins:[ve],inheritAttrs:!1,props:{actorDisplayName:{type:String,required:!0},actorId:{type:String,required:!0},creationDateTime:{type:String,default:null},editor:{type:Boolean,default:!1},autoComplete:{type:Function,required:!0},userData:{type:Object,default:()=>({})},tag:{type:String,default:"div"}},data(){return{expanded:!1,localMessage:"",submitted:!1}},computed:{...A(M),isOwnComment(){return f().uid===this.actorId},richContent(){const e={};let o=this.localMessage;return Object.keys(this.userData).forEach((i,a)=>{const r=`mention-${a}`,s=new RegExp(`@${i}|@"${i}"`,"g");o=o.replace(s,`{${r}}`),e[r]={component:ce,props:{user:i,displayName:this.userData[i].label,primary:this.userData[i].primary}}}),{mentions:e,message:o}},isEmptyMessage(){return!this.localMessage||this.localMessage.trim()===""},timestamp(){return Date.parse(this.creationDateTime)},isLimbo(){return this.deletedCommentLimboStore.checkForId(this.id)}},watch:{message(e){this.updateLocalMessage(e)}},beforeMount(){this.updateLocalMessage(this.message)},methods:{t:Q,updateLocalMessage(e){this.localMessage=e.toString(),this.submitted=!1},onSubmit(){if(this.localMessage.trim()!==""){if(this.editor){this.onNewComment(this.localMessage.trim()),this.$nextTick(()=>{this.$refs.editor.$el.focus()});return}this.onEditComment(this.localMessage.trim())}},onExpand(){this.expanded=!0}}},Me={class:"comment__side"},Ee={class:"comment__body"},Oe={class:"comment__header"},Re={class:"comment__author"},$e={key:1,class:"comment_loading icon-loading-small"},Pe={class:"comment__editor-group"},je={class:"comment__submit"},ze={id:"tab-comments__editor-description",class:"comment__editor-description"};function qe(e,o,i,a,r,s){const b=c("NcAvatar"),_=c("IconPencilOutline"),l=c("NcActionButton"),E=c("NcActionSeparator"),O=c("IconTrashCanOutline"),R=c("IconClose"),$=c("NcActions"),P=c("NcDateTime"),j=c("NcRichContenteditable"),z=c("NcLoadingIcon"),q=c("IconArrowRight"),B=c("NcButton"),F=c("NcRichText");return U((n(),p(W(i.tag),{class:w([{"comment--loading":e.loading},"comment"])},{default:m(()=>[u("div",Me,[d(b,{class:"comment__avatar",displayName:i.actorDisplayName,user:i.actorId,size:32},null,8,["displayName","user"])]),u("div",Ee,[u("div",Oe,[u("span",Re,y(i.actorDisplayName),1),s.isOwnComment&&e.id&&!e.loading?(n(),p($,{key:0,class:"comment__actions"},{default:m(()=>[e.editing?(n(),p(l,{key:1,onClick:e.onEditCancel},{icon:m(()=>[d(R,{size:20})]),default:m(()=>[C(" "+y(s.t("comments","Cancel edit")),1)]),_:1},8,["onClick"])):(n(),h(K,{key:0},[d(l,{closeAfterClick:"",onClick:e.onEdit},{icon:m(()=>[d(_,{size:20})]),default:m(()=>[C(" "+y(s.t("comments","Edit comment")),1)]),_:1},8,["onClick"]),d(E),d(l,{closeAfterClick:"",onClick:e.onDeleteWithUndo},{icon:m(()=>[d(O,{size:20})]),default:m(()=>[C(" "+y(s.t("comments","Delete comment")),1)]),_:1},8,["onClick"])],64))]),_:1})):N("",!0),e.id&&e.loading?(n(),h("div",$e)):i.creationDateTime?(n(),p(P,{key:2,class:"comment__timestamp",timestamp:s.timestamp,ignoreSeconds:!0},null,8,["timestamp"])):N("",!0)]),i.editor||e.editing?(n(),h("form",{key:0,class:"comment__editor",onSubmit:o[2]||(o[2]=Z(()=>{},["prevent"]))},[u("div",Pe,[d(j,{ref:"editor",modelValue:r.localMessage,"onUpdate:modelValue":[o[0]||(o[0]=k=>r.localMessage=k),o[1]||(o[1]=k=>r.submitted=!1)],autoComplete:i.autoComplete,contenteditable:!e.loading,label:i.editor?s.t("comments","New comment"):s.t("comments","Edit comment"),placeholder:s.t("comments","Write a comment …"),userData:i.userData,"aria-describedby":"tab-comments__editor-description",onSubmit:s.onSubmit},null,8,["modelValue","autoComplete","contenteditable","label","placeholder","userData","onSubmit"]),u("div",je,[d(B,{variant:"tertiary-no-background",type:"submit","aria-label":s.t("comments","Post comment"),disabled:s.isEmptyMessage,onClick:s.onSubmit},{icon:m(()=>[e.loading?(n(),p(z,{key:0})):(n(),p(q,{key:1,size:20}))]),_:1},8,["aria-label","disabled","onClick"])])]),u("div",ze,y(s.t("comments","@ for mentions, : for emoji, / for smart picker")),1)],32)):(n(),p(F,{key:1,class:w(["comment__message",{"comment__message--expanded":r.expanded}]),text:s.richContent.message,arguments:s.richContent.mentions,useMarkdown:"",onClick:s.onExpand},null,8,["class","text","arguments","onClick"]))])]),_:1},8,["class"])),[[H,!e.deleted&&!s.isLimbo]])}const rt=S(xe,[["render",qe],["__scopeId","data-v-767e5a19"]]),nt=G({props:{resourceId:{type:Number,required:!0},resourceType:{type:String,default:"files"}},data(){return{editorData:{actorDisplayName:f().displayName,actorId:f().uid,key:"editor"},userData:{},currentResourceId:this.resourceId}},methods:{async autoComplete(e,o){const{data:i}=await x.get(J("core/autocomplete/get"),{params:{search:e,itemType:this.resourceType,itemId:this.currentResourceId,sorter:"commenters|share-recipients",limit:me("comments","maxAutoCompleteResults")}});return i.ocs.data.forEach(a=>{this.userData[a.id]=a}),o(Object.values(this.userData))},genMentionsData(e){return Object.values(e).flat().forEach(o=>{this.userData[o.mentionId]={icon:"icon-user",id:o.mentionId,label:o.mentionDisplayName,source:"users",primary:f()?.uid===o.mentionId}}),this.userData}}});export{nt as C,rt as a};
|
||
//# sourceMappingURL=CommentView-CB2dr6mD.chunk.mjs.map
|