Skip to content

Instantly share code, notes, and snippets.

@svierk
Created January 25, 2024 14:27
Show Gist options
  • Save svierk/91b9f292c92f640c6f1885fb029a6d25 to your computer and use it in GitHub Desktop.
Save svierk/91b9f292c92f640c6f1885fb029a6d25 to your computer and use it in GitHub Desktop.
JS Code for Content Document Preview LWC
import { CurrentPageReference, NavigationMixin } from 'lightning/navigation';
import { LightningElement, api, wire } from 'lwc';
export default class ContentDocumentPreview extends NavigationMixin(LightningElement) {
@wire(CurrentPageReference) pageRef;
@api preview;
showPreview() {
this[NavigationMixin.Navigate]({
type: 'standard__namedPage',
attributes: {
pageName: 'filePreview'
},
state: {
selectedRecordId: this.preview.id
}
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment