askbot-dragon 1.8.21-beta → 1.8.23-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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "askbot-dragon",
3
- "version": "1.8.21-beta",
3
+ "version": "1.8.23-beta",
4
4
  "scripts": {
5
5
  "serve": "vue-cli-service serve",
6
6
  "build": "vue-cli-service build",
@@ -147,7 +147,7 @@ function newInitWaterMark(elId, textValue) {
147
147
 
148
148
  //获取页面最大高度
149
149
  var page_height = document.getElementById(elId).scrollHeight;
150
- console.log('page_height',page_height, page_width,document.getElementById('docView').clientHeight);
150
+ console.log('page_height',page_height, page_width);
151
151
 
152
152
  // var page_height = Math.max(document.body.scrollHeight, document.body.clientHeight);
153
153
 
@@ -240,11 +240,7 @@ function newInitWaterMark(elId, textValue) {
240
240
 
241
241
  mask_div.style.width = defaultSettings.watermark_width + "px";
242
242
 
243
- if (elId === 'docHtml'){
244
- mask_div.style.height = document.getElementById('docView').clientHeight + "px";
245
- } else {
246
- mask_div.style.height = defaultSettings.watermark_width + "px";
247
- }
243
+ mask_div.style.height = defaultSettings.watermark_width + "px";
248
244
 
249
245
  mask_div.style.display = "block";
250
246
 
@@ -314,7 +314,7 @@ export default {
314
314
  }
315
315
 
316
316
  &-active {
317
- background-color: @background-content-color;
317
+ background-color: @primary-color;
318
318
  border: 1px solid @border-color-primary;
319
319
  color: @font-primary-light-color;
320
320
  }
@@ -84,6 +84,11 @@ export default {
84
84
  paragraphs.forEach(paragraph => {
85
85
  paragraph.style.background = this.colors[colorIndex]
86
86
  })
87
+ } else if (this.fileSuffix === 'HTML'){
88
+ const paragraphs = this.$el.querySelectorAll(`[data-paragraph-id="${items.paragraph_id}"]`);
89
+ paragraphs.forEach(paragraph => {
90
+ paragraph.style.background = this.colors[colorIndex]
91
+ })
87
92
  } else if (dom){
88
93
  dom.style.background = this.colors[colorIndex];
89
94
  }
@@ -0,0 +1,70 @@
1
+ <template>
2
+ <div class="downView">
3
+ <div class="mark_down" id="mark_down" ref="markDown" v-html="compiledMarkdown">
4
+ </div>
5
+ </div>
6
+ </template>
7
+
8
+ <script>
9
+ import hljs from "highlight.js";
10
+ import { newInitWaterMark } from "../../assets/js/common";
11
+
12
+ const marked = require("marked")
13
+ export default {
14
+ name: "markDownView",
15
+ data(){
16
+ return{
17
+ markdownContent:"",
18
+ compiledMarkdown:""
19
+ }
20
+ },
21
+ props:{
22
+ url:{
23
+ type:String,
24
+ default:""
25
+ },
26
+ textWatermarkStr:{
27
+ type:String,
28
+ default:""
29
+ }
30
+ },
31
+ computed:{
32
+
33
+ },
34
+ mounted(){
35
+ this.$http.get(this.url).then(res => {
36
+ console.log('getMdText',res)
37
+ let markdown = marked.marked(res.bodyText, {
38
+ breaks: true
39
+ })
40
+ this.compiledMarkdown = this.parseCode(markdown, "content");
41
+ setTimeout(() => {
42
+ if (this.textWatermarkStr){
43
+ newInitWaterMark('mark_down',this.textWatermarkStr)
44
+ }
45
+ },500)
46
+ })
47
+ },
48
+ methods:{
49
+ parseCode(markDownText) {
50
+ const parser = new DOMParser();
51
+ const doc = parser.parseFromString(markDownText, 'text/html');
52
+ doc.querySelectorAll('pre code').forEach((block) => {
53
+ hljs.highlightBlock(block);
54
+ });
55
+ return doc.documentElement.outerHTML
56
+ },
57
+ }
58
+ };
59
+ </script>
60
+
61
+ <style scoped lang="less">
62
+ .downView{
63
+ width: 100%;
64
+ flex: none;
65
+ box-sizing: border-box;
66
+ .mark_down{
67
+ position: relative;
68
+ }
69
+ }
70
+ </style>
@@ -17,6 +17,7 @@
17
17
  :textWatermarkStr="textWatermarkStr"
18
18
  ></excel-view>
19
19
  <pdf-view v-else-if="fileType === 'PDF'" ref="pdfView" :split_paragraphs="splitParagraph" :ossPath="url" :isPC="isPC" :textWatermarkStr="textWatermarkStr"></pdf-view>
20
+ <mark-down-view v-else-if="fileType === 'MD'" :url="url" :split_paragraphs="splitParagraph" :textWatermarkStr="textWatermarkStr"></mark-down-view>
20
21
  </div>
21
22
  <template v-if="splitParagraph.length > 1 && fileType !== 'XLS' && fileType !== 'XLSX'">
22
23
  <div class="btn_footer" v-if="!isPC">
@@ -37,9 +38,10 @@
37
38
  import DocView from "./docView";
38
39
  import ExcelView from "./excelView";
39
40
  import PdfView from "./pdfView";
41
+ import MarkDownView from "./markDownView";
40
42
  export default {
41
43
  name: "newPositionPreview",
42
- components: { PdfView, ExcelView, DocView },
44
+ components: { MarkDownView, PdfView, ExcelView, DocView },
43
45
  data(){
44
46
  return{
45
47
  tagId:[],
@@ -5,7 +5,7 @@
5
5
  -->
6
6
  <template>
7
7
  <el-drawer title="" :visible.sync="drawer" :with-header="false" :append-to-body="true" :destroy-on-close="true"
8
- :modal="false" :direction="previewShowPopup ? 'btt' : 'rtl'" :size="previewShowPopup ? '90%' : '65%'"
8
+ :modal="false" :direction="!isPc ? 'btt' : 'rtl'" :size="!isPc ? '90%' : '65%'"
9
9
  custom-class="pdf-preview-drawer" v-if="drawer">
10
10
  <div class="drawer-header"
11
11
  :class="(isDownload || (isHasChat && fileType != 'IMAGE')) && isLiBang ? 'has_btn_libang_head' : (isLiBang ? 'libang_head' : (isDownload || (isHasChat && fileType != 'IMAGE') ? 'has_btn_head' : ''))"
@@ -104,7 +104,7 @@
104
104
  </pdfPosition>
105
105
  </div>
106
106
  <new-position-preview ref="newPositionPreview"
107
- v-else-if="tagIds && tagIds.length != 0 && newVersion && newFileType !== 'PPT'"
107
+ v-else-if="tagIds && tagIds.length != 0 && newVersion && newFileType !== 'PPT' && newFileType !== 'IMAGE'"
108
108
  :textWatermarkStr="textWatermarkStr"
109
109
  :knowledgeId="knowledgeId" :tagIds="tagIds" :url="previewHref"></new-position-preview>
110
110
  <template v-else>
@@ -354,7 +354,7 @@ export default {
354
354
  this.showSummary = false;
355
355
  },
356
356
  loadIframe() {
357
- if (this.fileType == 'VIDEO' || this.fileType == 'WECHAT' || (this.tagIds && this.tagIds.length != 0 && this.newFileType !== 'PPT')) {
357
+ if (this.fileType == 'VIDEO' || this.fileType == 'WECHAT' || (this.tagIds && this.tagIds.length != 0 && this.newFileType !== 'PPT'&& this.newFileType !== 'IMAGE')) {
358
358
  this.loading = false
359
359
  } else {
360
360
  let iframe = document.getElementsByClassName('preview_iframe')[0] || document.getElementsByClassName('preview_iframe_kk')[0];
@@ -519,17 +519,20 @@ export default {
519
519
  if (/(iPhone|iPad|iPod|iOS|Android)/i.test(navigator.userAgent)) {
520
520
  this.isPc = false
521
521
  } else {
522
- this.isPc = true
522
+ let documentWidth = document.documentElement.clientWidth;
523
+ if(documentWidth < 750) {
524
+ this.isPc = false
525
+ } else {this.isPc = true
523
526
  }
524
- },
525
- clickFloder() {
527
+ }
528
+ },clickFloder() {
526
529
  this.$emit('previewClickFloder')
527
530
  },
528
531
  getOssPath(url) {
529
532
  let httpUrl = '/knowledge-api/knowledge/getTemporaryCertificate';
530
533
  let type = this.getFileType(url)
531
534
  this.newFileType = type;
532
- if (type === 'VIDEO' || type === 'PDF' || type === 'EXCEL' || type === 'TXT' || type === 'DOC') {
535
+ if (type === 'VIDEO' || type === 'PDF' || type === 'EXCEL' || type === 'TXT' || type === 'DOC'|| type === 'MD') {
533
536
  httpUrl += '?needEncrypt=false'
534
537
  } else {
535
538
  httpUrl += '?needEncrypt=true'
@@ -563,7 +566,8 @@ export default {
563
566
  } else if (fileType === '.pdf') {
564
567
  return 'PDF'
565
568
  } else if (fileType === '.txt') {
566
- return 'TXT'
569
+ return 'TXT'} else if (fileType === '.md'){
570
+ return 'MD'
567
571
  } else {
568
572
  return 'OTHER'
569
573
  }
@@ -577,7 +581,7 @@ export default {
577
581
  if (res.data.code == 0) {
578
582
  if (res.data.data && res.data.data.length > 0 && res.data.data[0].extractVersion == 'v3') {
579
583
  this.newVersion = true;
580
- if (this.newFileType !== 'PPT') {
584
+ if (this.newFileType !== 'PPT'|| this.newFileType !== 'IMAGE') {
581
585
  this.loading = false;
582
586
  }
583
587
  for (let i = 0; i < res.data.data.length; i++) {