Skip to content

Commit

Permalink
wip: Refactor documents related components #904
Browse files Browse the repository at this point in the history
  • Loading branch information
cnouguier committed Nov 25, 2024
1 parent 321d6fb commit d435272
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
6 changes: 5 additions & 1 deletion core/client/components/document/KDocument.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ const props = defineProps({
type: String,
default: null
},
mimeType: {
type: String,
default: null
},
localize: {
type: Boolean,
default: true
Expand All @@ -31,7 +35,7 @@ const props = defineProps({
// Computed
const viewer = computed(() => {
const mimeType = guessMimeType()
const mimeType = props.mimeType || guessMimeType()
if (!mimeType) return null
const viewer = _.get(Document.options, `viewers.${mimeType}`)
if (!viewer) return null
Expand Down
7 changes: 6 additions & 1 deletion core/client/document.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,16 @@ export const Document = {
viewers: {
htm: 'document/KHtml',
html: 'document/KHtml',
'text/html': 'document/KHtml',
md: 'document/KMarkdown',
'text/markdown': 'document/KMarkdown',
pdf: 'document/KPdf',
'application/pdf': 'document/KPdf',
jpg: 'document/KImage',
jpeg: 'document/KImage',
png: 'document/KImage'
'image/jpeg': 'document/KImage',
png: 'document/KImage',
'image/png': 'document/KImage',
},
htmlSanitizer: {
allowedTags: sanitize.defaults.allowedTags.concat(['img'])
Expand Down

0 comments on commit d435272

Please sign in to comment.