zydx-plus 1.33.387 → 1.33.389

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": "zydx-plus",
3
- "version": "1.33.387",
3
+ "version": "1.33.389",
4
4
  "description": "Vue.js",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -83,6 +83,41 @@
83
83
  </div>
84
84
  </div>
85
85
 
86
+ <!--图片的浮动菜单-->
87
+ <div class="bubble-menu-img">
88
+ <template v-if="editor">
89
+ <div class="line">
90
+ <div class="label">图片缩放:</div>
91
+ <div class="percent">
92
+ <div class="symbol">%</div>
93
+ <input type="number" v-model="imgSizeVal" @input="changePercent" onfocus="this.select()" placeholder="10-100">
94
+ </div>
95
+ </div>
96
+ <div class="line">
97
+ <div class="label">图片位置:</div>
98
+ <div class="alignmentMode">
99
+ <div @click="changeAlign('left')">
100
+ <div class="imgBgc" :class="{imgBgcAction: editor.isActive({ textAlign: 'left' })}">
101
+ <img :src="alignmentModeLeft">
102
+ </div>
103
+ </div>
104
+ <div class="segmentation"></div>
105
+ <div @click="changeAlign('center')">
106
+ <div class="imgBgc" :class="{imgBgcAction: editor.isActive({ textAlign: 'center' })}">
107
+ <img :src="alignmentModeCenter">
108
+ </div>
109
+ </div>
110
+ <div class="segmentation"></div>
111
+ <div @click="changeAlign('right')">
112
+ <div class="imgBgc" :class="{imgBgcAction: editor.isActive({ textAlign: 'right' })}">
113
+ <img :src="alignmentModeRight">
114
+ </div>
115
+ </div>
116
+ </div>
117
+ </div>
118
+ </template>
119
+ </div>
120
+
86
121
  <div v-if="!readOnly && toolbar.length > 0" class="complete">
87
122
  <button v-if="butShow" class="but" @click="confirm">完成</button>
88
123
  </div>
@@ -182,13 +217,11 @@
182
217
  <div class="p-popup-title">缩进设置</div>
183
218
  <div class="p-popup-retraction">
184
219
  <div class="p-popup-setting">
185
- <div class="name">左侧缩进</div>
186
-
220
+ <div class="name">左侧缩进</div>:
187
221
  <input v-model="paragraph.left" min="0" type="number" @input="checkNum"/>
188
222
  <p>px</p></div>
189
223
  <div class="p-popup-setting">
190
- <div class="name">右侧缩进</div>
191
-
224
+ <div class="name">右侧缩进</div>:
192
225
  <input v-model="paragraph.right" min="0" type="number" @input="checkNum"/>
193
226
  <p>px</p></div>
194
227
  </div>
@@ -338,7 +371,6 @@
338
371
  <div class="page-margin-title"> 切换版式</div>
339
372
  <div class="page-line-select">
340
373
  <div class="name">选择版式:</div>
341
-
342
374
  <zydx-select v-model:value="templateType" :options="templateOptions"></zydx-select>
343
375
  </div>
344
376
  </div>
@@ -616,6 +648,10 @@ import MarginNarrow from "../src/margin-narrow.vue";
616
648
  import MarginStandard from "../src/margin-standard.vue";
617
649
  import MarginWide from "../src/margin-wide.vue";
618
650
  import isSelect from "../src/isSelect.vue";
651
+ import {CustomImage} from "./image-size";
652
+ import alignmentModeCenter from './image/center.png'
653
+ import alignmentModeLeft from './image/left.png'
654
+ import alignmentModeRight from './image/right.png'
619
655
 
620
656
  const img = require('./image/annotation.png')
621
657
  export default {
@@ -821,7 +857,12 @@ export default {
821
857
  menuKeys: [],
822
858
  html: `<p data-signid="subject" style="text-align: center;"><strong><span style="font-size: 24px; font-family: SimHei; color: rgb(0, 0, 0);">请在此处输入题目</span></strong></p><p data-signid="author" class="author" style="text-align: center;padding-bottom: 30px;"><span style="font-size: 14px; font-family: FangSong; color: rgb(0, 0, 0);">请在此处输入作者</span></p><p data-signid="abstract" class="abstract abstract"><strong><span style="font-size: 14px; font-family: SimSun; color: rgb(0, 0, 0)">摘要:</span></strong> <span style="font-size: 14px; font-family: FangSong; color: rgb(0, 0, 0)">请在此处输入摘要文本...</span></p><p data-signid="keyword" class="keyword keyword"><strong><span contenteditable="false" style="font-size: 14px; font-family: SimSun; color: rgb(0, 0, 0)">关键词:</span></strong> <span style="font-size: 14px; font-family: FangSong; color: rgb(0, 0, 0)"> 请在此处输入关键字...</span></p><p></p><p class="indent indent"><span style="font-size: 14px; font-family: SimHei; color: rgb(0, 0, 0)">请在此处输入正文文本</span></p><p data-signid="title-1" class="title drrvcvmj indent"><strong><span style="font-size: 14px; font-family: SimHei; color: rgb(0, 0, 0)">一、请在此处输入一级标题</span></strong></p><p class="indent indent"><span style="font-size: 14px; font-family: SimHei; color: rgb(0, 0, 0)">请在此处输入正文文本</span></p><p data-signid="title-2" class="title xxhnhuja indent"><strong><span style="font-size: 14px; font-family: SimHei; color: rgb(0, 0, 0)">(一)请在此处输入二级标题</span></strong></p><p class="indent indent"><span style="font-size: 14px; font-family: SimHei; color: rgb(0, 0, 0)">请在此处输入正文文本(复用格式建议直接复制粘贴段落)</span></p><p data-signid="splitLine" contenteditable="false" class="paging-line">分 页 线(保存文档时线下内容另起一页)</p><p></p><p data-signid="annotation" contenteditable="false" style="text-align: center;"><strong><span style="font-size: 24px; font-family: SimHei; color: rgb(0, 0, 0);">注释</span></strong></p><p data-signid="author" contenteditable="false" class="author" style="text-align: center;padding-bottom: 30px;"><span style="font-size: 14px;font-weight: 700; color: rgba(0, 0, 0, 0.5);">(请在文中标识要注释的内容,此处将生成注释的序号而后需要作者填写注释内容)</span></p><p data-signid="a-l" class="text" contenteditable="false"><span style="font-size: 12px; font-family: FangSong;text-indent: 2em;">① 注释:是指解释字句的文字,也指用文字解释字句,可以是文字符号图片等多种形式。(当前文本只是示例展示,不会出现在保存的文本中。)</span></p><p data-signid="annotationSplitLine" contenteditable="false" class="paging-line">分 页 线(保存文档时线下内容另起一页)</p><p></p><p contenteditable="false" data-signId="reference" style="text-align: center;margin-bottom: 30px;"><span font-family: SimHei; style="font-weight: 700;font-size: 24px;">参考文献</span></p><p data-signid="author" contenteditable="false" class="author" style="text-align: center;padding-bottom: 30px;"><span style="font-size: 14px;font-weight: 700; color: rgba(0, 0, 0, 0.5);">(请在文中标识要注释的内容,此处将生成注释的序号而后需要作者填写注释内容)</span></p><p data-signid="r-l" class="text" contenteditable="false"><span style="font-size: 12px; font-family: FangSong;text-indent: 2em;"> [1] 孙品一.高校学报编辑工作现代化特征[C].中国高等学校自然科学学报研究会.科技编辑学论文集(2).北京:北京师范大学出版社,1998:10-22. (当前文本只是示例展示,不会出现在保存的文本中。)</span></p><p data-signid="r-l" class="text" contenteditable="false"><span style="font-size: 12px; font-family: FangSong;text-indent: 2em;"> [2] 张和生.地质力学系统理论[D].太原:太原理工大学,1998. (当前文本只是示例展示,不会出现在保存的文本中。)</span></p><p data-signid="referenceSplitLine" contenteditable="false" class="paging-line">分 页 线(保存文档时线下内容另起一页)</p><p></p><p data-signid="ack" style="text-align: center"><strong><span style="font-size: 16px; color: rgb(0, 0, 0)">致谢</span></strong></p><p><span style="font-size: 14px; font-family: KaiTi; color: rgb(0, 0, 0)">致谢内容...</span></p><p data-signid="paragraph" style="margin: 30px 0px 0px; text-align: right"><strong><span style="font-size: 14px; color: rgb(0, 0, 0)">请在此处输入落款</span></strong></p><p style="text-align: right"><strong><span style="font-size: 14px; color: rgb(0, 0, 0)">请在此处输入日期</span></strong></p>`
823
859
  }
824
- ]
860
+ ],
861
+ imgSizeVal: '',
862
+ imgSizeLock: true,
863
+ alignmentModeLeft: alignmentModeLeft,
864
+ alignmentModeCenter: alignmentModeCenter,
865
+ alignmentModeRight: alignmentModeRight,
825
866
  }
826
867
  },
827
868
  props: {
@@ -1061,6 +1102,7 @@ export default {
1061
1102
  titleId, // 标题id
1062
1103
  lineHeightId,//行高
1063
1104
  dataUrl,
1105
+ CustomImage,// 自定义图片大小
1064
1106
  Superscript.configure({
1065
1107
  HTMLAttributes: {
1066
1108
  class: 'annotation',
@@ -1108,6 +1150,19 @@ export default {
1108
1150
  }
1109
1151
  },
1110
1152
  }),
1153
+ BubbleMenu.configure({
1154
+ pluginKey: 'bubbleMenuImg',
1155
+ element: document.querySelector('.bubble-menu-img'),
1156
+ tippyOptions: { duration: 100 },
1157
+ shouldShow: ({editor, view, state, oldState, from, to}) => {
1158
+ if(editor.isActive('image')) {
1159
+ this.imgSizeVal = parseInt(this.editor.getAttributes('image').width)
1160
+ } else {
1161
+ this.imgSizeVal = ''
1162
+ }
1163
+ return editor.isActive('image')
1164
+ },
1165
+ }),
1111
1166
  Link.configure({
1112
1167
  openOnClick: false,
1113
1168
  HTMLAttributes: {
@@ -1274,6 +1329,26 @@ export default {
1274
1329
  },
1275
1330
  emits: ['confirm', 'enclosure', 'enlDownload', 'enlSee'],
1276
1331
  methods: {
1332
+ changeAlign(tag) {
1333
+ // 图片对齐方式
1334
+ this.editor.chain().setTextAlign(tag).run()
1335
+ },
1336
+ changePercent(e) {
1337
+ // 改变图片百分比
1338
+ if(parseInt(e.target.value) > 100) {
1339
+ this.imgSizeVal = 100
1340
+ this.editor.chain().setImageWidth('100%').focus().run()
1341
+ } else if(parseInt(e.target.value) < 10) {
1342
+ } else {
1343
+ if(this.imgSizeLock) {
1344
+ this.imgSizeLock = false
1345
+ setTimeout(() => {
1346
+ this.editor.chain().setImageWidth(e.target.value + '%').focus().run()
1347
+ this.imgSizeLock = true
1348
+ }, 500)
1349
+ }
1350
+ }
1351
+ },
1277
1352
  selectMargin(selectItem) {
1278
1353
  this.pageMarginSvg.forEach(item => {
1279
1354
  item.isSelect = item.title === selectItem.title;
@@ -4680,4 +4755,67 @@ li {
4680
4755
  border:1px solid #000;
4681
4756
  border-radius: 50%;
4682
4757
  }
4758
+ .bubble-menu-img {
4759
+ position: relative;
4760
+ padding: 15px;
4761
+ background-color: #fff;
4762
+ border-radius: 5px;
4763
+ box-shadow: 0 1px 6px #d2d2d2;
4764
+ }
4765
+ .line {
4766
+ display: flex;
4767
+ align-items: center;
4768
+ padding-bottom: 10px;
4769
+ }
4770
+ .line:last-child {
4771
+ padding-bottom: 0
4772
+ }
4773
+ .percent {
4774
+ position: relative;
4775
+ }
4776
+ .percent input{
4777
+ border-radius: 4px;
4778
+ width: 68px;
4779
+ }
4780
+ .percent input::-webkit-outer-spin-button,
4781
+ .percent input::-webkit-inner-spin-button {
4782
+ -webkit-appearance: none !important;
4783
+ }
4784
+ .percent input[type='number']{
4785
+ -moz-appearance: textfield;
4786
+ box-shadow: none;
4787
+ border: 1px solid #8c939d;
4788
+ padding: 5px 15px 5px 5px;
4789
+ }
4790
+ .symbol {
4791
+ position: absolute;
4792
+ right: 5px;
4793
+ top: 5px
4794
+ }
4795
+
4796
+ .alignmentMode {
4797
+ display: flex;
4798
+ justify-content: center;
4799
+ align-items: center;
4800
+ }
4801
+ .segmentation {
4802
+ height: 13px;
4803
+ width: 1px;
4804
+ margin: 0 5px;
4805
+ background-color: #565656;
4806
+ }
4807
+ .imgBgc {
4808
+ border-radius: 3px;
4809
+ width: 20px;
4810
+ height: 20px;
4811
+ background-color: #CCCCCC;
4812
+ }
4813
+ .imgBgcAction {
4814
+ background-color: #2A82E4;
4815
+ }
4816
+ .imgBgc > img {
4817
+ padding: 1px;
4818
+ width: 100%;
4819
+ height: 100%;
4820
+ }
4683
4821
  </style>
@@ -33,12 +33,12 @@ export const borderBottom = Extension.create({
33
33
 
34
34
  addCommands() {
35
35
  return {
36
- setMargin: borderBottom => ({ chain }) => {
36
+ setBorder: borderBottom => ({ chain }) => {
37
37
  return chain()
38
38
  .setNode('paragraph', { borderBottom })
39
39
  .run()
40
40
  },
41
- unsetMargin: () => ({ chain }) => {
41
+ unsetBorder: () => ({ chain }) => {
42
42
  return chain()
43
43
  .setNode('paragraph', { borderBottom: null })
44
44
  .run()
@@ -0,0 +1,23 @@
1
+ import Image from '@tiptap/extension-image'
2
+
3
+ export const CustomImage = Image.extend({
4
+ addCommands() {
5
+ return {
6
+ setImageWidth: width => ({commands}) => {
7
+ return commands.updateAttributes('image', {width: width})
8
+ },
9
+ }
10
+ },
11
+ addAttributes() {
12
+ return {
13
+ width: {
14
+ default: '',
15
+ renderHTML: attributes => {
16
+ return {
17
+ style: `width: ${attributes.width}`,
18
+ }
19
+ }
20
+ }
21
+ }
22
+ }
23
+ })
@@ -409,14 +409,15 @@ export default {
409
409
  })
410
410
  },
411
411
  methods: {
412
- // 下面三个方法是改变图片大小的方法
413
412
  changeAlign(tag) {
413
+ // 图片对齐方式
414
414
  this.editor.chain().setTextAlign(tag).run()
415
415
  },
416
416
  changePercent(e) {
417
+ // 改变图片百分比
417
418
  if(parseInt(e.target.value) > 100) {
418
419
  this.imgSizeVal = 100
419
- this.editor.chain().setImageWidth('100%').run()
420
+ this.editor.chain().setImageWidth('100%').focus().run()
420
421
  } else if(parseInt(e.target.value) < 10) {
421
422
  } else {
422
423
  if(this.lock) {
@@ -429,6 +430,7 @@ export default {
429
430
  }
430
431
  },
431
432
  shouldShowFn({ editor, view, state, oldState, from, to }) {
433
+ // BubbleMenu是否显示
432
434
  this.$nextTick(() => {
433
435
  this.showBubble = editor.isActive('image')
434
436
  if(editor.isActive('image')) {
@@ -907,6 +909,7 @@ export default {
907
909
 
908
910
  :deep(.imgCont) {
909
911
  line-height: 0 !important;
912
+ text-indent: 0 !important;
910
913
  }
911
914
 
912
915
  :deep(.ProseMirror-separator) {
@@ -954,7 +957,7 @@ export default {
954
957
  }
955
958
 
956
959
  :deep(.editor-img) {
957
- max-width: calc(100% - 4em);
960
+ max-width: 100%;
958
961
  padding: 2px 0;
959
962
  }
960
963
 
@@ -2,22 +2,22 @@
2
2
  <div class="docView">
3
3
  <div class="full-screen">
4
4
  <div class="full-screen-img" @click.stop="fullScreen">
5
- <div class="full-screen-title" style="" v-if="showText">全屏查看</div>
6
- <img @mouseover="showText=true" @mouseout="showText=false" src="../img/full-screen.png" alt="">
5
+ <!-- <div class="full-screen-title" style="" v-if="showText">全屏查看</div>-->
6
+ <img @mouseover="showText=true" @mouseout="showText=false" src="../img/full-screen.png" alt="" title="全屏查看">
7
7
  </div>
8
- <div class="full-screen-img" v-if="doublePage" @click.stop="doublePage=!doublePage">
9
- <div class="full-screen-title" style="" v-if="showMultiText">多页查看</div>
10
- <img @mouseover="showMultiText=true" @mouseout="showMultiText=false" src="../img/multi-page.png" alt="">
8
+ <div class="full-screen-img" v-if="doublePage" @click.stop="changeView">
9
+ <!-- <div class="full-screen-title" style="" v-if="showMultiText">多页查看</div>-->
10
+ <img @mouseover="showMultiText=true" @mouseout="showMultiText=false" src="../img/multi-page.png" alt="" title="多页查看">
11
11
  </div>
12
- <div class="full-screen-img" v-else @click.stop="doublePage=!doublePage">
13
- <div class="full-screen-title" style="" v-if="showSingleText">单页查看</div>
14
- <img @mouseover="showSingleText=true" @mouseout="showSingleText=false" src="../img/single-page.png" alt="">
12
+ <div class="full-screen-img" v-else @click.stop="changeView">
13
+ <!-- <div class="full-screen-title" style="" v-if="showSingleText">单页查看</div>-->
14
+ <img @mouseover="showSingleText=true" @mouseout="showSingleText=false" src="../img/single-page.png" alt="" title="单页查看">
15
15
  </div>
16
16
  </div>
17
17
  <div>
18
18
  <div class="book">
19
19
  <div class="pages">
20
- <div class="wrap-box" v-if="doublePage">
20
+ <div class="wrap-box" ref="wrap-box" v-if="doublePage">
21
21
  <div class="wrap wrap-block" :ref="`wrap-${item.id}`" v-for="(item,index) in pageInfoArr" :key="index">
22
22
  <div class="wrap-can" v-show="!loading" ref="wrapCan">
23
23
  <canvas @click.stop="turnText" class="wrap-can-one" @mousedown.stop="mouseDown"
@@ -123,7 +123,7 @@ export default {
123
123
  flipRights: false,
124
124
  flipLefts: false,
125
125
  oneIndex: 'right',
126
- scales: 1.3,
126
+ scales: 1.35,
127
127
  timer: null,
128
128
  resultImg: '',
129
129
  startX: 0,
@@ -164,6 +164,7 @@ export default {
164
164
  showText:false,
165
165
  showMultiText:false,
166
166
  showSingleText:false,
167
+ boxWidth:''
167
168
  }
168
169
  },
169
170
  props: {
@@ -185,7 +186,7 @@ export default {
185
186
  },
186
187
  scale: {
187
188
  type: Number,
188
- default: 1.3
189
+ default: 1.35
189
190
  },
190
191
  scaleStyle: {
191
192
  type: Object,
@@ -261,15 +262,13 @@ export default {
261
262
  deep: true,
262
263
  immediate: true
263
264
  },
264
- // pageInfoArr:{
265
- // handler: function (val){
266
- // if(val.length===this.pdfPages){
267
- // this.sourceUrl()
268
- // }
269
- // },
270
- // deep: true,
271
- // immediate: true
272
- // }
265
+ scale:{
266
+ handler: function (val){
267
+ this.scales = val
268
+ },
269
+ deep: true,
270
+ immediate: true
271
+ }
273
272
  },
274
273
  emits: ['flip'],
275
274
  mounted() {
@@ -287,6 +286,12 @@ export default {
287
286
  window.removeEventListener('keydown', this.handleKeyEvent)
288
287
  },
289
288
  methods: {
289
+ changeView(){
290
+ this.$emit('changeViewDoublePage',!this.doublePage)
291
+ setTimeout(()=>{
292
+ this.doublePage = !this.doublePage
293
+ },500)
294
+ },
290
295
  fullScreen(){
291
296
  window.open(this.source)
292
297
  },
@@ -1145,6 +1150,7 @@ export default {
1145
1150
  let ctx2 = canvas2.getContext('2d');
1146
1151
  let viewport = page.getViewport({scale: that.scales})
1147
1152
  const sc = viewport.width / viewport.height
1153
+ that.boxWidth = that.$refs.wrap.offsetWidth
1148
1154
  const wid = that.$refs.wrap.offsetWidth - 10
1149
1155
  const hei = wid / sc
1150
1156
  canvas.width = wid * that.sratio
@@ -1195,7 +1201,9 @@ export default {
1195
1201
  let canvas2 = document.getElementById(`${item.id}2`)
1196
1202
  item.ctx = canvas.getContext('2d');
1197
1203
  item.ctx2 = canvas2.getContext('2d');
1198
- let viewport = page.getViewport({scale: that.scales/2.06})
1204
+ let wrapBoxWidth = that.$refs['wrap-box'].offsetWidth
1205
+ let newScale=(wrapBoxWidth/that.boxWidth)*that.scales
1206
+ let viewport = page.getViewport({scale: newScale/2})
1199
1207
  const sc = viewport.width / viewport.height
1200
1208
  const wid = that.$refs[`wrap-${item.id}`][0].offsetWidth-15
1201
1209
  const hei = wid / sc
@@ -1304,7 +1312,7 @@ export default {
1304
1312
  display: inline-block;
1305
1313
  margin: 0 auto;
1306
1314
  position: relative;
1307
- box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
1315
+ box-shadow: 0 0 10px rgba(0, 0, 0, 0.25);
1308
1316
  //cursor: none;
1309
1317
  }
1310
1318
 
@@ -1467,7 +1475,7 @@ div{
1467
1475
  .full-screen{
1468
1476
  position: absolute;
1469
1477
  top: 20px;
1470
- right: -60px;
1478
+ right: -20px;
1471
1479
  z-index: 100;
1472
1480
  }
1473
1481
 
@@ -1497,6 +1505,6 @@ div{
1497
1505
  .full-screen-img>img{
1498
1506
  width: 20px;
1499
1507
  height: 20px;
1500
- margin-left: 5px;
1508
+ //margin-left: 5px;
1501
1509
  }
1502
1510
  </style>
@@ -5,11 +5,12 @@
5
5
  :style="{'border-bottom': (link)? '1px solid #ccc': '0', 'color': (active === index)? activeColor : '#333'}"
6
6
  @click="listTap(item,index)" v-for="(item,index) in list" :key="index">
7
7
  <div class="list-title">
8
- <span :style="{'font-size': column[0].fontSize + 'px', 'font-weight': column[0].fontWeight}">{{
8
+ <!-- <span :style="{'font-size': column[0].fontSize + 'px', 'font-weight': column[0].fontWeight}">{{
9
9
  index + 1
10
10
  }}. {{ (angleBrackets) ? '《' : '' }} {{ item[column[0].label] }} {{
11
11
  (angleBrackets) ? '》' : ''
12
- }}</span>
12
+ }}</span> -->
13
+ <span :style="{'font-size': column[0].fontSize + 'px', 'font-weight': column[0].fontWeight}" v-html="(index + 1) + '.' + (angleBrackets ? '《' : '') + item[column[0].label] + (angleBrackets ? '》' : '')"></span>
13
14
  <button v-if="delShow" @click="del(item)">{{ delText }}</button>
14
15
  </div>
15
16
  <div class="list-cont" v-if="open">
package/src/index.js CHANGED
@@ -83,7 +83,7 @@ function install(app) {
83
83
  }
84
84
 
85
85
  export default {
86
- version: '1.33.387',
86
+ version: '1.33.389',
87
87
  install,
88
88
  Calendar,
89
89
  Message,