I'm stuck to that issues and don't know how to fix that, so As I know standard library such as 'NavigationMixin' for file preview won't correctly work in the community page, so that code won't work
const docId = 'testcontdocid'
this[NavigationMixin.Navigate]({
type: 'standard__namedPage',
attributes: {
pageName: 'filePreview'
},
state : {
selectedRecordId: docId
}
})
Anyway i found a solution, its to create corresponding record in 'ContentDistribution' object and DistributionPublicUrl field on contentDistribution gets populated automatically. then i can use it something like that:
this[NavigationMixin.Navigate]({
type: 'standard__webPage',
attributes: {
url: DistributionPublicUrl
}
});
And it works perfect, but opens the file in the new browser window, not in popup window. Does anyone knows how to fix that? Thanks in advance. By the way i use lwc