|
@@ -49,7 +49,7 @@
|
|
|
<PreventDialog />
|
|
|
<MeasurePop />
|
|
|
<div v-if="loading && loadingPercent < 100" class="loading-state">{{ $t('loading') }}...</div>
|
|
|
- <div v-show="!load && loadingPercent <= 0 && activePanelTab !== 'COMPARISON' && ['compare', 'view'].includes(toolMode)" class="upload-container">
|
|
|
+ <div v-show="!load && loadingPercent <= 0 && showUploadButton && activePanelTab !== 'COMPARISON' && ['compare', 'view'].includes(toolMode)" class="upload-container">
|
|
|
<input id="fileInput" type="file" accept=".pdf" @change="handleUpload" />
|
|
|
<label for="fileInput">{{ $t('upload') }}</label>
|
|
|
</div>
|
|
@@ -85,6 +85,7 @@ const topSpace = computed(() => {
|
|
|
})
|
|
|
const loading = computed(() => useViewer.getUploadLoading && useViewer.getUpload)
|
|
|
const activePanelTab = computed(() => useViewer.getActiveElementTab('leftPanelTab'))
|
|
|
+const showUploadButton = computed(() => useViewer.getShowUploadButton)
|
|
|
const load = computed(() => useViewer.getUpload)
|
|
|
|
|
|
async function handleUpload(evt) {
|
|
@@ -173,6 +174,9 @@ window.instance.initOptions = async (options) => {
|
|
|
// const res = await initConfig({
|
|
|
// license: 'NjY0ZGE0N2ZhYTBiZQ=='
|
|
|
// })
|
|
|
+ if (showUploadButton in options) {
|
|
|
+ useViewer.setShowUploadButton(options.showUploadButton)
|
|
|
+ }
|
|
|
const webviewerMode = !!(options && options.webviewerServer) ? options.webviewerServer : 'Standalone'
|
|
|
useViewer.setWebviewerMode(webviewerMode)
|
|
|
if (!res) return
|
|
@@ -261,6 +265,38 @@ window.instances.UI.loadDocument = async (file) => {
|
|
|
await handlePdf(url, filename)
|
|
|
useViewer.setUploadLoading(false)
|
|
|
}
|
|
|
+
|
|
|
+window.instances.UI.closeDocument = async () => {
|
|
|
+ if (isLeftPanelOpen.value) {
|
|
|
+ core.toggleSidebar()
|
|
|
+ }
|
|
|
+ useViewer.$patch({
|
|
|
+ fullMode: false,
|
|
|
+ currentPage: 0,
|
|
|
+ scale: '',
|
|
|
+ themeMode: 'Light',
|
|
|
+ pageMode: 0,
|
|
|
+ scrollMode: 'Vertical',
|
|
|
+ activeTab: 0,
|
|
|
+ searchStatus: false,
|
|
|
+ activeElements: {
|
|
|
+ leftPanel: false,
|
|
|
+ rightPanel: false
|
|
|
+ },
|
|
|
+ activeElementsTab: {
|
|
|
+ leftPanelTab: 'THUMBS',
|
|
|
+ rightPanelTab: 'GENERAL'
|
|
|
+ }
|
|
|
+ })
|
|
|
+ useDocument.resetSetting()
|
|
|
+ core.clearSearchResults()
|
|
|
+ useDocument.setToolState('')
|
|
|
+ useViewer.setActiceToolMode('view')
|
|
|
+
|
|
|
+ useViewer.setUpload(false)
|
|
|
+ useViewer.setUploadLoading(false)
|
|
|
+ await core.closeDocument()
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss">
|