mirror of
http://112.124.100.131/ebiz-ai/ebiz-ai-knowledge-manage.git
synced 2025-12-24 02:03:00 +08:00
feat(RenderMinerU): 优化 PDF 渲染组件功能
- 添加 isShowPdf 属性,控制 PDF 预览的显示- 调整编辑模式下的界面布局 - 优化按钮生成事件的命名 - 添加初始 Markdown 文档获取方法
This commit is contained in:
@@ -1,21 +1,22 @@
|
||||
<template>
|
||||
<div style="height: 100%;">
|
||||
<div class="mv10 mh20 text-right">
|
||||
<div class="mv10 mh20 text-right" v-if="isEdit">
|
||||
<el-button type="primary" size="medium" @click="saveMarkDown">保存并处理</el-button>
|
||||
<el-button size="medium">取消</el-button>
|
||||
</div>
|
||||
<div class="flex" style="height:calc(100% - 35px);flex:1">
|
||||
<div :class="!isEdit ? 'mt10 flex' : 'flex'" style="height:calc(100% - 35px);flex:1">
|
||||
<iframe
|
||||
v-if="isShowPdf"
|
||||
id="iframe"
|
||||
:src="`${iframeSrc}/pdfjs-dist/web/viewer.html?file=${encodeURIComponent(prdUrl)}`"
|
||||
class="miner-u el-card is-always-shadow ml20"
|
||||
></iframe>
|
||||
<div style="flex:1;max-width: 800px;" class="mh20 miner-u-md">
|
||||
<div style="flex:1;" class="mh20 miner-u-md">
|
||||
<el-tabs type="border-card" style="height: 100%;overflow: hidden" @tab-click="changeTab">
|
||||
<el-tab-pane label="预览" style="overflow:scroll;">
|
||||
<div v-html="markdownHtml" class="view-body" id="viewBody" ref="viewBody"></div>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="编辑">
|
||||
<el-tab-pane label="编辑" :disabled="!isEdit" v-if="isEdit">
|
||||
<div class="lineH25 view-body" contenteditable id="md-editor" @blur="emitMarkDown" v-html="markdown">
|
||||
<!-- <pre id="viewBody"></pre>-->
|
||||
</div>
|
||||
@@ -96,13 +97,17 @@ export default {
|
||||
isEdit: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
isShowPdf: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
},
|
||||
watch: {},
|
||||
components: {},
|
||||
filters: {},
|
||||
methods: {
|
||||
// 封装 按钮生成时间
|
||||
// 封装 按钮生成事件
|
||||
generateButton(tableElement, buttonContainer, actionButtons) {
|
||||
let contenteditable = tableElement.getAttribute('contenteditable')
|
||||
let buttons = !actionButtons ? (contenteditable === 'false' ? this.tableActionButtons : this.tableActionConfirm) : actionButtons
|
||||
@@ -123,7 +128,6 @@ export default {
|
||||
viewHtmlModel() {
|
||||
this.$nextTick(() => {
|
||||
const mdHtml = document.getElementById('md-editor')
|
||||
|
||||
mdHtml.addEventListener('mouseover', e => {
|
||||
const tableElement = e.target.closest('table')
|
||||
if (tableElement) {
|
||||
@@ -215,6 +219,7 @@ export default {
|
||||
// copyMdHtml = copyMdHtml.re
|
||||
this.markdownHtml = md.render(pre.replace(/class="m-view"/g, ''))
|
||||
},
|
||||
// 初始md 文档
|
||||
async getPDFDetailMarkDown() {
|
||||
const response = await fetch(minerUMarkDown({ documentId: this.documentId }))
|
||||
this.markdown = await response.text()
|
||||
|
||||
Reference in New Issue
Block a user