fix(data-process): 优化预览分页与PDF兼容
This commit is contained in:
@@ -220,10 +220,12 @@ async function renderCurrentPage(force = false) {
|
||||
) return
|
||||
throw error
|
||||
})
|
||||
const textContent = await page.getTextContent()
|
||||
// WebKit 兼容:PDF.js 的 getTextContent() 依赖 ReadableStream 异步迭代,
|
||||
// 部分 Safari/WKWebView 未实现该接口。TextLayer 可直接通过 getReader() 消费文本流。
|
||||
const textContentSource = page.streamTextContent()
|
||||
if (sequence !== renderSequence) return
|
||||
const activeTextLayer = new TextLayer({
|
||||
textContentSource: textContent,
|
||||
textContentSource,
|
||||
container: layerContainer,
|
||||
viewport,
|
||||
})
|
||||
|
||||
@@ -28,7 +28,7 @@ const emit = defineEmits<{
|
||||
const sourceViewerRef = ref<HTMLElement | null>(null)
|
||||
const search = ref('')
|
||||
const currentPage = ref(1)
|
||||
const PREVIEW_PAGE_SIZE = 6
|
||||
const PREVIEW_PAGE_SIZE = 10
|
||||
const editingItemId = ref<string | null>(null)
|
||||
const editorDraft = ref('')
|
||||
const lines = computed(() => sourceLines(props.sourceText))
|
||||
|
||||
Reference in New Issue
Block a user