askbot-dragon 1.6.13-beta → 1.6.15-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -211,7 +211,7 @@ export default {
|
|
|
211
211
|
"knowledgeId": "658a93de63d378228271913a",
|
|
212
212
|
"knowledgePartId": "ypZaqYwBD3jzLtPbz5K8",
|
|
213
213
|
"from": "ppt_preview",
|
|
214
|
-
"introduction": "Spark是什么Spark 是一个开源的大数据处理引擎,它提供了一整套开发 API
|
|
214
|
+
"introduction": "Spark是什么Spark 是一个开源的大数据处理引擎,它提供了一整套开发 API,。",
|
|
215
215
|
"previewImage": "https://askbot-pdf-all.oss-cn-zhangjiakou.aliyuncs.com/31623ccfe9dd4957bbd59c5823878bbe/2023/12/27/03/39/08/658b9c477cf604285f7cb81d/pdf-image-1913302477976388839.png"
|
|
216
216
|
}
|
|
217
217
|
],
|
|
@@ -251,13 +251,12 @@ export default {
|
|
|
251
251
|
if (this.$refs.pdfView.clientWidth / this.pageSize.width >= 1 || this.isMessageRecord) {
|
|
252
252
|
this.contentView.style.width = `${pageSize.width - 10}px`;
|
|
253
253
|
this.contentView.style.height = `${(this.totalPageCount * (pageSize.height + this.PAGE_INTVERVAL)) + this.PAGE_INTVERVAL}px`;
|
|
254
|
-
this.contentView.style.margin = '0 auto 0'
|
|
255
254
|
} else {
|
|
256
|
-
this.transformSalce = this.$refs.pdfView.clientWidth / this.pageSize.width
|
|
255
|
+
this.transformSalce = this.$refs.pdfView.clientWidth / this.pageSize.width
|
|
257
256
|
this.contentView.style.width = `${pageSize.width * this.transformSalce - 10}px`;
|
|
258
257
|
this.contentView.style.height = `${(this.totalPageCount * (pageSize.height * (this.transformSalce) + this.PAGE_INTVERVAL)) + this.PAGE_INTVERVAL}px`;
|
|
259
258
|
}
|
|
260
|
-
|
|
259
|
+
this.contentView.style.margin = '0 auto 0'
|
|
261
260
|
this.contentView.style.position = 'relative'
|
|
262
261
|
this.contentView.style.paddingBottom = '60px'
|
|
263
262
|
// contentView.style.overflowY = 'auto'
|
|
@@ -299,30 +298,25 @@ export default {
|
|
|
299
298
|
const canvas = document.createElement('canvas');
|
|
300
299
|
const context = canvas.getContext('2d');
|
|
301
300
|
// canvas.getContext('2d');
|
|
302
|
-
canvas.height = this.pageSize.height
|
|
303
|
-
canvas.width = this.pageSize.width
|
|
301
|
+
canvas.height = this.pageSize.height;
|
|
302
|
+
canvas.width = this.pageSize.width;
|
|
304
303
|
canvas.style.position = 'relative'
|
|
305
304
|
canvas.style.top = -3 + 'px'
|
|
306
305
|
// 创建渲染的dom
|
|
307
306
|
const pageDom = document.createElement('div');
|
|
308
307
|
pageDom.style.position = 'absolute';
|
|
309
|
-
pageDom.style.top = `${((pageNo - 1) * (this.pageSize.height + this.PAGE_INTVERVAL)
|
|
310
|
-
pageDom.style.width = `${this.pageSize.width
|
|
311
|
-
pageDom.style.height = `${this.pageSize.height
|
|
308
|
+
pageDom.style.top = `${((pageNo - 1) * (this.pageSize.height + this.PAGE_INTVERVAL)) + this.PAGE_INTVERVAL}px`;
|
|
309
|
+
pageDom.style.width = `${this.pageSize.width}px`;
|
|
310
|
+
pageDom.style.height = `${this.pageSize.height}px`;
|
|
312
311
|
pageDom.setAttribute('data-id', 'page' + pageNo)
|
|
313
|
-
|
|
312
|
+
pageDom.appendChild(canvas);
|
|
314
313
|
// 渲染内容
|
|
315
314
|
let renderContext = {
|
|
316
315
|
canvasContext: context,
|
|
317
316
|
viewport: viewport,
|
|
318
|
-
transform: this.fileName ? [CSS_UNITS, 0, 0, CSS_UNITS, 0, 0] : '',
|
|
319
317
|
}
|
|
320
318
|
await pdfPage.render(renderContext).promise.then(() => {
|
|
321
|
-
|
|
322
|
-
let image = document.createElement('img');
|
|
323
|
-
image.setAttribute('src',html)
|
|
324
|
-
pageDom.appendChild(image);
|
|
325
|
-
return pdfPage.getTextContent()
|
|
319
|
+
return pdfPage.getTextContent()
|
|
326
320
|
}).then(async (textContent) => {
|
|
327
321
|
const textLayerDiv = document.createElement('div');
|
|
328
322
|
textLayerDiv.setAttribute('class', 'textLayer');
|
|
@@ -352,35 +346,36 @@ export default {
|
|
|
352
346
|
let postionArr = lines[index].location
|
|
353
347
|
let div = document.createElement('div')
|
|
354
348
|
div.style.position = 'absolute';
|
|
355
|
-
div.style.left = postionArr[0] * this.scale
|
|
349
|
+
div.style.left = postionArr[0] * this.scale + 'px',
|
|
356
350
|
// 后端返回的坐标有基线对齐的问题,top 值是后端算好(基线top - 文字高度),在此加上文字高度的 1/9 (大致比例)为实际展示出文字的top值
|
|
357
|
-
div.style.top = postionArr[1] * this.scale
|
|
358
|
-
div.style.height = postionArr[3] * this.scale
|
|
359
|
-
div.style.width = postionArr[2] * this.scale
|
|
351
|
+
div.style.top = postionArr[1] * this.scale + 'px'
|
|
352
|
+
div.style.height = postionArr[3] * this.scale + 'px';
|
|
353
|
+
div.style.width = postionArr[2] * this.scale + 'px'
|
|
360
354
|
div.style.backgroundColor = 'rgba(54, 106, 255, 0.3)'
|
|
361
355
|
div.classList.add('lineHeight')
|
|
362
356
|
rectdom.appendChild(div)
|
|
363
357
|
if (index == 0 && j == 0) {
|
|
364
358
|
if (this.transformSalce !== null) {
|
|
365
|
-
rectdomTop = postionArr[1]* this.scale *
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
359
|
+
rectdomTop = postionArr[1] * this.scale * this.transformSalce
|
|
360
|
+
} else {
|
|
361
|
+
rectdomTop = postionArr[1] * this.scale
|
|
362
|
+
}
|
|
363
|
+
// if(this.isPC) {
|
|
364
|
+
// rectdomTop = rectdomTop - 50 < 0 ? 0 : rectdomTop - 50
|
|
365
|
+
// }
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
if (rectdom.children.length > 0) {
|
|
370
|
+
pageDom.appendChild(rectdom)
|
|
371
|
+
}
|
|
372
372
|
}
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
if (rectdom.children.length > 0) {
|
|
376
|
-
pageDom.appendChild(rectdom)
|
|
377
373
|
}
|
|
378
|
-
}
|
|
379
374
|
}
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
375
|
+
textLayer.setTextContent(textContent);
|
|
376
|
+
textLayer.render()
|
|
377
|
+
pageDom.appendChild(textLayerDiv);
|
|
378
|
+
|
|
384
379
|
let backgroundDom = document.getElementById('backgroundLoad' + pageNo)
|
|
385
380
|
if (backgroundDom) {
|
|
386
381
|
this.contentView.removeChild(backgroundDom);
|
|
@@ -392,18 +387,8 @@ export default {
|
|
|
392
387
|
if (pdf_view && pdf_view[0]){
|
|
393
388
|
pdf_view[0].style.backgroundImage = 'none'
|
|
394
389
|
}
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
let AllLines = findPage.allLines
|
|
398
|
-
if (AllLines.length){
|
|
399
|
-
postionArr = AllLines[0].lines[0].location
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
if(this.transformSalce !== null && this.fileName) {
|
|
403
|
-
this.contentView.style.transform = `scale(${this.transformSalce}, ${this.transformSalce})`
|
|
404
|
-
} else {
|
|
405
|
-
this.contentView.style.transform = `scale(${this.defaultTransform})`;
|
|
406
|
-
|
|
390
|
+
if (this.transformSalce !== null) {
|
|
391
|
+
this.contentView.style.transform = `scale(${this.transformSalce}, ${this.transformSalce})`
|
|
407
392
|
}
|
|
408
393
|
if (this.changetoolbar) {
|
|
409
394
|
setTimeout(() => {
|
|
@@ -415,21 +400,22 @@ export default {
|
|
|
415
400
|
setTimeout(() => {
|
|
416
401
|
let pageoffsetHeight = 0
|
|
417
402
|
if (this.transformSalce !== null) {
|
|
418
|
-
pageoffsetHeight = (this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce
|
|
403
|
+
pageoffsetHeight = (this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce
|
|
419
404
|
} else {
|
|
420
|
-
pageoffsetHeight = (this.pageSize.height + this.PAGE_INTVERVAL)
|
|
405
|
+
pageoffsetHeight = (this.pageSize.height + this.PAGE_INTVERVAL)
|
|
421
406
|
}
|
|
422
407
|
if (this.$refs.pdfView.clientHeight - pageoffsetHeight > 0 && pageIndex == 1) {
|
|
423
408
|
const height = this.$refs.pdfView.clientHeight;
|
|
424
409
|
let startNum = 0
|
|
425
410
|
let endNum = 0
|
|
426
411
|
if (this.transformSalce !== null) {
|
|
427
|
-
startNum = Math.ceil(this.$refs.pdfView.scrollTop / ((this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce
|
|
428
|
-
endNum = startNum + Math.ceil(height / ((this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
endNum = startNum + Math.ceil(height / (
|
|
432
|
-
|
|
412
|
+
startNum = Math.ceil(this.$refs.pdfView.scrollTop / ((this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce))
|
|
413
|
+
endNum = startNum + Math.ceil(height / ((this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce))
|
|
414
|
+
} else {
|
|
415
|
+
startNum = Math.ceil(this.$refs.pdfView.scrollTop / (this.pageSize.height + this.PAGE_INTVERVAL))
|
|
416
|
+
endNum = startNum + Math.ceil(height / (this.pageSize.height + this.PAGE_INTVERVAL))
|
|
417
|
+
|
|
418
|
+
}
|
|
433
419
|
for (let pageIndex = startNum; pageIndex <= endNum; pageIndex++) {
|
|
434
420
|
if (pageIndex > 0 && pageIndex <= this.pages.length) {
|
|
435
421
|
this.loadPdfData(pageIndex)
|
|
@@ -461,11 +447,11 @@ export default {
|
|
|
461
447
|
let startNum = 0
|
|
462
448
|
let endNum = 0
|
|
463
449
|
if (this.transformSalce !== null) {
|
|
464
|
-
startNum = Math.ceil(scrollTop / ((that.pageSize.height + that.PAGE_INTVERVAL) * this.transformSalce
|
|
465
|
-
endNum = startNum + Math.ceil(height / ((that.pageSize.height + that.PAGE_INTVERVAL) * this.transformSalce
|
|
450
|
+
startNum = Math.ceil(scrollTop / ((that.pageSize.height + that.PAGE_INTVERVAL) * this.transformSalce))
|
|
451
|
+
endNum = startNum + Math.ceil(height / ((that.pageSize.height + that.PAGE_INTVERVAL) * this.transformSalce))
|
|
466
452
|
} else {
|
|
467
|
-
startNum = Math.ceil(scrollTop / (
|
|
468
|
-
endNum = startNum + Math.ceil(height / (
|
|
453
|
+
startNum = Math.ceil(scrollTop / (that.pageSize.height + that.PAGE_INTVERVAL))
|
|
454
|
+
endNum = startNum + Math.ceil(height / (that.pageSize.height + that.PAGE_INTVERVAL))
|
|
469
455
|
}
|
|
470
456
|
for (let pageIndex = startNum; pageIndex <= endNum; pageIndex++) {
|
|
471
457
|
if (pageIndex > 0 && pageIndex <= that.pages.length) {
|
|
@@ -553,10 +539,10 @@ export default {
|
|
|
553
539
|
return
|
|
554
540
|
}
|
|
555
541
|
const pageDom = document.createElement('div');
|
|
556
|
-
pageDom.style.width = `${this.pageSize.width
|
|
557
|
-
pageDom.style.height = `${this.pageSize.height
|
|
542
|
+
pageDom.style.width = `${this.pageSize.width}px`;
|
|
543
|
+
pageDom.style.height = `${this.pageSize.height}px`;
|
|
558
544
|
pageDom.style.position = 'absolute';
|
|
559
|
-
pageDom.style.top = `${((pageNo - 1) * (this.pageSize.height + this.PAGE_INTVERVAL)
|
|
545
|
+
pageDom.style.top = `${((pageNo - 1) * (this.pageSize.height + this.PAGE_INTVERVAL)) + this.PAGE_INTVERVAL
|
|
560
546
|
}px`;
|
|
561
547
|
pageDom.style.backgroundImage = `url('https://guoranopen-zjk.oss-cn-zhangjiakou.aliyuncs.com/cdn-common/images/loading.gif')`
|
|
562
548
|
pageDom.style.backgroundPosition = 'center'
|
|
@@ -631,9 +617,9 @@ export default {
|
|
|
631
617
|
this.renderHighlights()
|
|
632
618
|
})
|
|
633
619
|
if (this.transformSalce !== null) {
|
|
634
|
-
this.$refs.pdfView.scrollTop = `${((pdfResloute.page - 1) * (this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce
|
|
620
|
+
this.$refs.pdfView.scrollTop = `${((pdfResloute.page - 1) * (this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce) + (this.identifyTextPostion.top * this.scale * this.transformSalce)}`
|
|
635
621
|
} else {
|
|
636
|
-
this.$refs.pdfView.scrollTop = `${((pdfResloute.page - 1) * (this.pageSize.height + this.PAGE_INTVERVAL)
|
|
622
|
+
this.$refs.pdfView.scrollTop = `${((pdfResloute.page - 1) * (this.pageSize.height + this.PAGE_INTVERVAL)) + (this.identifyTextPostion.top * this.scale * this.transformSalce)}`
|
|
637
623
|
}
|
|
638
624
|
},
|
|
639
625
|
scrollToExcalTop (currentPage) {
|
|
@@ -1504,6 +1490,7 @@ export default {
|
|
|
1504
1490
|
0% {
|
|
1505
1491
|
background: rgba(255, 136, 0, 0.3);
|
|
1506
1492
|
}
|
|
1493
|
+
|
|
1507
1494
|
25% {
|
|
1508
1495
|
background: rgba(255, 136, 0, 0.6);
|
|
1509
1496
|
}
|