diff --git a/core/client/components/document/KBrowser.vue b/core/client/components/document/KBrowser.vue index 2888122c5..4ac715910 100644 --- a/core/client/components/document/KBrowser.vue +++ b/core/client/components/document/KBrowser.vue @@ -5,7 +5,6 @@ v-if="document" class="text-subtitle1" > - {{ document.name }} @@ -18,6 +17,7 @@ id="previous-button" icon="las la-angle-left" size="1rem" + color="white" :handler="previous" /> @@ -36,6 +36,7 @@ id="next-button" icon="las la-angle-right" size="1rem" + color="white" :handler="next" /> @@ -76,7 +77,6 @@ const hasNext = computed(() => { // Watch watch(() => [props.documents, props.default], async () => { - console.log('[DEBUG] Props changed') index.value = _.findIndex(props.documents, { name: props.default }) if (index.value > -1) await refresh() }, { immediate: true }) diff --git a/core/client/document.js b/core/client/document.js index 25b21010d..77a878087 100644 --- a/core/client/document.js +++ b/core/client/document.js @@ -7,8 +7,7 @@ import { i18n } from './i18n.js' export const Document = { initialize () { - this.options = _.get(config, 'document') - this.options = _.defaultsDeep(this.options, { + this.options = _.defaultsDeep(_.get(config, 'document'), { viewers: { htm: 'document/KHtml', html: 'document/KHtml', @@ -38,13 +37,15 @@ export const Document = { }) logger.debug('[KDK] Configuring documents with options:', this.options) }, - register (type, viewer) { - if (!_.isArray(type)) type = [type] - _.forEach(type, mimeType => { - _.set(this.options, `viewers.${mimeType}`, viewer) + register (types, viewer) { + if (!_.isArray(types)) types = [types] + _.forEach(types, type => { + _.set(this.options, `viewers.${type}`, viewer) }) }, - + hasViewer (type) { + return _.get(this.options, `viewers.${type}`) ? true: false + }, sanitizeHtml (html) { if (_.isNil(html)) return null return sanitize(html, this.options.htmlSanitizer) diff --git a/core/client/index.js b/core/client/index.js index 1615c8061..c470dd6d8 100644 --- a/core/client/index.js +++ b/core/client/index.js @@ -43,6 +43,7 @@ export { Units } export { Layout } export { Filter } export { Sorter } +export { Document } export { Exporter } export { Reader } export { services }