vue-editify 0.0.47 → 0.0.49

Sign up to get free protection for your applications and to get access to all the features.
package/src/Editify.vue CHANGED
@@ -1,9 +1,9 @@
1
1
  <template>
2
- <div class="editify">
2
+ <div class="editify" :class="{ fullheight: height === true && !isFullScreen, fullscreen: isFullScreen }">
3
3
  <!-- 菜单区域 -->
4
4
  <Menu v-if="menuConfig.use" :config="menuConfig" :disabled="disabled || !canUseMenu" :color="color" ref="menu"></Menu>
5
5
  <!-- 编辑层,与编辑区域宽高相同必须适配 -->
6
- <div ref="body" class="editify-body" :class="{ border: border, menu_inner: menuConfig.use && menuConfig.mode == 'inner' }" :data-editify-uid="uid">
6
+ <div ref="body" class="editify-body" :class="{ border: showBorder, menu_inner: menuConfig.use && menuConfig.mode == 'inner' }" :data-editify-uid="uid">
7
7
  <!-- 编辑器 -->
8
8
  <div ref="content" class="editify-content" :class="{ placeholder: showPlaceholder, disabled: disabled }" :style="contentStyle" @keydown="handleEditorKeydown" @click="handleEditorClick" @compositionstart="isInputChinese = true" @compositionend="isInputChinese = false" :data-editify-placeholder="placeholder"></div>
9
9
  <!-- 代码视图 -->
@@ -12,7 +12,7 @@
12
12
  <Toolbar ref="toolbar" v-model="toolbarOptions.show" :node="toolbarOptions.node" :type="toolbarOptions.type" :config="toolbarConfig"></Toolbar>
13
13
  </div>
14
14
  <!-- 编辑器尾部 -->
15
- <div v-if="showWordLength" class="editify-footer">
15
+ <div v-if="showWordLength" class="editify-footer" :class="{ fullscreen: isFullScreen && !isSourceView }" ref="footer">
16
16
  <!-- 字数统计 -->
17
17
  <div class="editify-footer-words">{{ $editTrans('totalWordCount') }}{{ textValue.length }}</div>
18
18
  </div>
@@ -45,6 +45,8 @@ export default {
45
45
  isModelChange: false,
46
46
  //是否代码视图
47
47
  isSourceView: false,
48
+ //是否全屏
49
+ isFullScreen: false,
48
50
  //是否正在输入中文
49
51
  isInputChinese: false,
50
52
  //表格列宽拖拽记录数据
@@ -64,7 +66,9 @@ export default {
64
66
  //rangeUpdate更新延时器
65
67
  updateTimer: null,
66
68
  //菜单栏是否可以使用标识
67
- canUseMenu: false
69
+ canUseMenu: false,
70
+ //手动设定的编辑器编辑区域高度
71
+ contentHeight: 0
68
72
  }
69
73
  },
70
74
  computed: {
@@ -91,8 +95,21 @@ export default {
91
95
  }
92
96
  return false
93
97
  },
98
+ //是否显示边框
99
+ showBorder() {
100
+ //全屏模式下不显示边框
101
+ if (this.isFullScreen) {
102
+ return false
103
+ }
104
+ return this.border
105
+ },
94
106
  //编辑器样式设置
95
107
  contentStyle() {
108
+ if (this.height === true || this.isFullScreen) {
109
+ return {
110
+ height: this.contentHeight + 'px'
111
+ }
112
+ }
96
113
  return this.autoheight ? { minHeight: this.height } : { height: this.height }
97
114
  },
98
115
  //最终生效的工具栏配置
@@ -133,6 +150,21 @@ export default {
133
150
  this.handleToolbar()
134
151
  }
135
152
  }
153
+ },
154
+ //全屏切换
155
+ isFullScreen() {
156
+ this.$nextTick(() => {
157
+ this.setContentHeight()
158
+ })
159
+ },
160
+ //监听height为true
161
+ height: {
162
+ immediate: true,
163
+ handler: function () {
164
+ this.$nextTick(() => {
165
+ this.setContentHeight()
166
+ })
167
+ }
136
168
  }
137
169
  },
138
170
  mounted() {
@@ -149,7 +181,10 @@ export default {
149
181
  //鼠标点击箭头
150
182
  Dap.event.on(document.documentElement, `click.editify_${this.uid}`, this.documentClick)
151
183
  //监听窗口改变
152
- Dap.event.on(window, `resize.editify_${this.uid}`, this.setVideoHeight)
184
+ Dap.event.on(window, `resize.editify_${this.uid}`, () => {
185
+ this.setVideoHeight()
186
+ this.setContentHeight()
187
+ })
153
188
  },
154
189
  methods: {
155
190
  //初始创建编辑器
@@ -236,13 +271,13 @@ export default {
236
271
  removeScroll(this.$refs.content)
237
272
  },
238
273
  //工具条显示判断
239
- handleToolbar() {
274
+ handleToolbar(useCache = false) {
240
275
  if (this.disabled || this.isSourceView) {
241
276
  return
242
277
  }
243
278
  this.hideToolbar()
244
279
  this.$nextTick(() => {
245
- const table = this.getCurrentParsedomElement('table', true)
280
+ const table = this.getCurrentParsedomElement('table', useCache)
246
281
  const pre = this.getCurrentParsedomElement('pre', true)
247
282
  const link = this.getCurrentParsedomElement('a', true)
248
283
  const image = this.getCurrentParsedomElement('img', true)
@@ -288,7 +323,7 @@ export default {
288
323
  this.toolbarOptions.show = true
289
324
  }
290
325
  } else {
291
- const result = this.editor.getElementsByRange(true, true, true).filter(item => {
326
+ const result = this.editor.getElementsByRange(true).flatIncludes.filter(item => {
292
327
  return item.element.isText()
293
328
  })
294
329
  if (result.length && !this.hasTable(true) && !this.hasPreStyle(true) && !this.hasLink(true) && !this.hasImage(true) && !this.hasVideo(true)) {
@@ -472,7 +507,7 @@ export default {
472
507
  if (this.disabled) {
473
508
  return
474
509
  }
475
- if (this.border && this.color) {
510
+ if (this.border && this.color && !this.isFullScreen) {
476
511
  //恢复编辑区域边框颜色
477
512
  this.$refs.body.style.borderColor = ''
478
513
  //恢复编辑区域阴影颜色
@@ -490,7 +525,7 @@ export default {
490
525
  if (this.disabled) {
491
526
  return
492
527
  }
493
- if (this.border && this.color) {
528
+ if (this.border && this.color && !this.isFullScreen) {
494
529
  //编辑区域边框颜色
495
530
  this.$refs.body.style.borderColor = this.color
496
531
  //转换颜色值
@@ -576,7 +611,7 @@ export default {
576
611
  this.$emit('insertparagraph', this.value)
577
612
  },
578
613
  //编辑器焦点更新
579
- handleRangeUpdate(range) {
614
+ handleRangeUpdate() {
580
615
  if (this.disabled) {
581
616
  return
582
617
  }
@@ -584,21 +619,21 @@ export default {
584
619
  clearTimeout(this.updateTimer)
585
620
  }
586
621
  this.updateTimer = setTimeout(() => {
587
- //如果使用菜单栏或者工具条事先调用两次作数据缓存
622
+ //如果使用工具条或者菜单栏
588
623
  if (this.toolbarConfig.use || this.menuConfig.use) {
589
- this.editor.getElementsByRange(true, false)
590
- this.editor.getElementsByRange(true, true)
591
- }
592
- //如果使用工具条
593
- if (this.toolbarConfig.use) {
594
- this.handleToolbar()
595
- }
596
- //如果使用菜单栏
597
- if (this.menuConfig.use) {
598
- this.$refs.menu.handleRangeUpdate()
624
+ //先获取选区内的元素设置内部缓存
625
+ this.editor.getElementsByRange()
626
+ //如果使用工具条
627
+ if (this.toolbarConfig.use) {
628
+ this.handleToolbar(true)
629
+ }
630
+ //如果使用菜单栏
631
+ if (this.menuConfig.use) {
632
+ this.$refs.menu.handleRangeUpdate(true)
633
+ }
599
634
  }
600
635
  }, 200)
601
- this.$emit('rangeupdate', this.value, range)
636
+ this.$emit('rangeupdate', this.value)
602
637
  },
603
638
  //编辑器复制
604
639
  handleCopy(text, html) {
@@ -613,7 +648,7 @@ export default {
613
648
  this.$emit('paste-text', data)
614
649
  },
615
650
  //编辑器粘贴html
616
- handlePasteHtml(elements, data) {
651
+ handlePasteHtml(elements) {
617
652
  const keepStyles = Object.assign(pasteKeepData.styles, this.pasteKeepStyles || {})
618
653
  const keepMarks = Object.assign(pasteKeepData.marks, this.pasteKeepMarks || {})
619
654
  //粘贴html时过滤元素的样式和属性
@@ -677,6 +712,23 @@ export default {
677
712
  video.style.height = video.offsetWidth / this.videoRatio + 'px'
678
713
  })
679
714
  },
715
+ //设置编辑器主体高度
716
+ setContentHeight() {
717
+ if (this.height === true || this.isFullScreen) {
718
+ let height = this.$el.offsetHeight
719
+ if (this.menuConfig.use) {
720
+ height -= this.$refs.menu.$el.offsetHeight
721
+ }
722
+ if (this.showWordLength) {
723
+ height -= this.$refs.footer.offsetHeight
724
+ }
725
+ if (this.$refs.menu.menuMode == 'default') {
726
+ height -= 10
727
+ }
728
+ //这里减去2px是因为body设了padding:1px
729
+ this.contentHeight = height - 2
730
+ }
731
+ },
680
732
 
681
733
  //api:光标设置到文档底部
682
734
  collapseToEnd() {
@@ -727,7 +779,7 @@ export default {
727
779
  if (this.editor.range.anchor.element.isEqual(this.editor.range.focus.element)) {
728
780
  return this.getParsedomElementByElement(this.editor.range.anchor.element, parsedom)
729
781
  }
730
- const arr = this.editor.getElementsByRange(true, false, useCache).map(item => {
782
+ const arr = this.editor.getElementsByRange(useCache).includes.map(item => {
731
783
  return this.getParsedomElementByElement(item.element, parsedom)
732
784
  })
733
785
  let hasNull = arr.some(el => {
@@ -814,7 +866,7 @@ export default {
814
866
  //设置标题
815
867
  block.parsedom = parsedom
816
868
  } else {
817
- const result = this.editor.getElementsByRange(true, false, useCache)
869
+ const result = this.editor.getElementsByRange(useCache).includes
818
870
  result.forEach(el => {
819
871
  if (el.element.isBlock()) {
820
872
  blockToParagraph(el.element)
@@ -853,7 +905,7 @@ export default {
853
905
  //起点和终点不在一起
854
906
  else {
855
907
  let blocks = []
856
- const result = this.editor.getElementsByRange(true, false, useCache)
908
+ const result = this.editor.getElementsByRange(useCache).includes
857
909
  result.forEach(item => {
858
910
  const block = item.element.getBlock()
859
911
  const exist = blocks.some(el => block.isEqual(el))
@@ -897,7 +949,7 @@ export default {
897
949
  //起点和终点不在一起
898
950
  else {
899
951
  let blocks = []
900
- const result = this.editor.getElementsByRange(true, false, useCache)
952
+ const result = this.editor.getElementsByRange(useCache).includes
901
953
  result.forEach(item => {
902
954
  const block = item.element.getBlock()
903
955
  const exist = blocks.some(el => block.isEqual(el))
@@ -930,11 +982,11 @@ export default {
930
982
  }
931
983
  const active = this.queryTextStyle(name, value, useCache)
932
984
  if (active) {
933
- this.editor.removeTextStyle([name], useCache)
985
+ this.editor.removeTextStyle([name], true)
934
986
  } else {
935
987
  let styles = {}
936
988
  styles[name] = value
937
- this.editor.setTextStyle(styles, useCache)
989
+ this.editor.setTextStyle(styles, true)
938
990
  }
939
991
  if (isRender) {
940
992
  this.editor.formatElementStack()
@@ -956,11 +1008,11 @@ export default {
956
1008
  }
957
1009
  const active = this.queryTextMark(name, value, useCache)
958
1010
  if (active) {
959
- this.editor.removeTextMark([name], useCache)
1011
+ this.editor.removeTextMark([name], true)
960
1012
  } else {
961
1013
  let marks = {}
962
1014
  marks[name] = value
963
- this.editor.setTextMark(marks, useCache)
1015
+ this.editor.setTextMark(marks, true)
964
1016
  }
965
1017
  if (isRender) {
966
1018
  this.editor.formatElementStack()
@@ -981,7 +1033,8 @@ export default {
981
1033
  return
982
1034
  }
983
1035
  this.editor.removeTextStyle(null, useCache)
984
- this.editor.removeTextMark(null, useCache)
1036
+ //这里不能使用缓存,因为removeTextStyle会更新光标位置
1037
+ this.editor.removeTextMark(null)
985
1038
  if (isRender) {
986
1039
  this.editor.formatElementStack()
987
1040
  this.editor.domRender()
@@ -1017,7 +1070,7 @@ export default {
1017
1070
  }
1018
1071
  }
1019
1072
  } else {
1020
- const result = this.editor.getElementsByRange(true, false, useCache)
1073
+ const result = this.editor.getElementsByRange(useCache).includes
1021
1074
  result.forEach(el => {
1022
1075
  if (el.element.isBlock() || el.element.isInblock()) {
1023
1076
  if (el.element.hasStyles()) {
@@ -1106,7 +1159,7 @@ export default {
1106
1159
  //起点和终点不在一起
1107
1160
  else {
1108
1161
  let blocks = []
1109
- const result = this.editor.getElementsByRange(true, false, useCache)
1162
+ const result = this.editor.getElementsByRange(useCache).includes
1110
1163
  result.forEach(item => {
1111
1164
  const block = item.element.getBlock()
1112
1165
  const exist = blocks.some(el => block.isEqual(el))
@@ -1157,7 +1210,7 @@ export default {
1157
1210
  }
1158
1211
  }
1159
1212
  } else {
1160
- const result = this.editor.getElementsByRange(true, false, useCache)
1213
+ const result = this.editor.getElementsByRange(useCache).includes
1161
1214
  result.forEach(el => {
1162
1215
  if (el.element.isBlock() || el.element.isInblock()) {
1163
1216
  if (el.element.hasStyles()) {
@@ -1232,7 +1285,7 @@ export default {
1232
1285
  fn(block)
1233
1286
  }
1234
1287
  } else {
1235
- const result = this.editor.getElementsByRange(true, false, useCache)
1288
+ const result = this.editor.getElementsByRange(useCache).includes
1236
1289
  result.forEach(item => {
1237
1290
  const block = item.element.getBlock()
1238
1291
  const inblock = item.element.getInblock()
@@ -1277,7 +1330,7 @@ export default {
1277
1330
  fn(block)
1278
1331
  }
1279
1332
  } else {
1280
- const result = this.editor.getElementsByRange(true, false, useCache)
1333
+ const result = this.editor.getElementsByRange(useCache).includes
1281
1334
  result.forEach(item => {
1282
1335
  const block = item.element.getBlock()
1283
1336
  const inblock = item.element.getInblock()
@@ -1295,7 +1348,7 @@ export default {
1295
1348
  }
1296
1349
  },
1297
1350
  //api:插入图片
1298
- insertImage(url, isRender = true) {
1351
+ insertImage(url, isRender = true, useCache = false) {
1299
1352
  if (this.disabled) {
1300
1353
  return
1301
1354
  }
@@ -1314,7 +1367,7 @@ export default {
1314
1367
  null,
1315
1368
  null
1316
1369
  )
1317
- this.editor.insertElement(image)
1370
+ this.editor.insertElement(image, true, useCache)
1318
1371
  if (isRender) {
1319
1372
  this.editor.formatElementStack()
1320
1373
  this.editor.domRender()
@@ -1322,7 +1375,7 @@ export default {
1322
1375
  }
1323
1376
  },
1324
1377
  //api:插入视频
1325
- insertVideo(url, isRender = true) {
1378
+ insertVideo(url, isRender = true, useCache = false) {
1326
1379
  if (this.disabled) {
1327
1380
  return
1328
1381
  }
@@ -1341,7 +1394,7 @@ export default {
1341
1394
  null,
1342
1395
  null
1343
1396
  )
1344
- this.editor.insertElement(video)
1397
+ this.editor.insertElement(video, true, useCache)
1345
1398
  const leftSpace = AlexElement.getSpaceElement()
1346
1399
  const rightSpace = AlexElement.getSpaceElement()
1347
1400
  this.editor.addElementAfter(rightSpace, video)
@@ -1362,7 +1415,7 @@ export default {
1362
1415
  if (this.editor.range.anchor.isEqual(this.editor.range.focus)) {
1363
1416
  return this.editor.range.anchor.element.isPreStyle()
1364
1417
  }
1365
- const result = this.editor.getElementsByRange(true, false, useCache)
1418
+ const result = this.editor.getElementsByRange(useCache).includes
1366
1419
  return result.some(item => {
1367
1420
  return item.element.isPreStyle()
1368
1421
  })
@@ -1376,7 +1429,7 @@ export default {
1376
1429
  const block = this.editor.range.anchor.element.getBlock()
1377
1430
  return block.parsedom == 'blockquote'
1378
1431
  }
1379
- const result = this.editor.getElementsByRange(true, false, useCache)
1432
+ const result = this.editor.getElementsByRange(useCache).includes
1380
1433
  return result.some(item => {
1381
1434
  if (item.element.isBlock()) {
1382
1435
  return item.element.parsedom == 'blockquote'
@@ -1395,7 +1448,7 @@ export default {
1395
1448
  const block = this.editor.range.anchor.element.getBlock()
1396
1449
  return blockIsList(block, ordered)
1397
1450
  }
1398
- const result = this.editor.getElementsByRange(true, false, useCache)
1451
+ const result = this.editor.getElementsByRange(useCache).includes
1399
1452
  return result.some(item => {
1400
1453
  if (item.element.isBlock()) {
1401
1454
  return blockIsList(item.element, ordered)
@@ -1413,7 +1466,7 @@ export default {
1413
1466
  if (this.editor.range.anchor.isEqual(this.editor.range.focus)) {
1414
1467
  return !!this.getParsedomElementByElement(this.editor.range.anchor.element, 'a')
1415
1468
  }
1416
- const result = this.editor.getElementsByRange(true, true, useCache).filter(item => {
1469
+ const result = this.editor.getElementsByRange(useCache).flatIncludes.filter(item => {
1417
1470
  return item.element.isText()
1418
1471
  })
1419
1472
  return result.some(item => {
@@ -1429,7 +1482,7 @@ export default {
1429
1482
  const block = this.editor.range.anchor.element.getBlock()
1430
1483
  return block.parsedom == 'table'
1431
1484
  }
1432
- const result = this.editor.getElementsByRange(true, false, useCache)
1485
+ const result = this.editor.getElementsByRange(useCache).includes
1433
1486
  return result.some(item => {
1434
1487
  if (item.element.isBlock()) {
1435
1488
  return item.element.parsedom == 'table'
@@ -1448,7 +1501,7 @@ export default {
1448
1501
  const block = this.editor.range.anchor.element.getBlock()
1449
1502
  return blockIsTask(block)
1450
1503
  }
1451
- const result = this.editor.getElementsByRange(true, false, useCache)
1504
+ const result = this.editor.getElementsByRange(useCache).includes
1452
1505
  return result.some(item => {
1453
1506
  if (item.element.isBlock()) {
1454
1507
  return blockIsTask(item.element)
@@ -1466,7 +1519,7 @@ export default {
1466
1519
  if (this.editor.range.anchor.isEqual(this.editor.range.focus)) {
1467
1520
  return this.editor.range.anchor.element.isClosed() && this.editor.range.anchor.element.parsedom == 'img'
1468
1521
  }
1469
- const result = this.editor.getElementsByRange(true, true, useCache)
1522
+ const result = this.editor.getElementsByRange(useCache).flatIncludes
1470
1523
  return result.some(item => {
1471
1524
  return item.element.isClosed() && item.element.parsedom == 'img'
1472
1525
  })
@@ -1479,7 +1532,7 @@ export default {
1479
1532
  if (this.editor.range.anchor.isEqual(this.editor.range.focus)) {
1480
1533
  return this.editor.range.anchor.element.isClosed() && this.editor.range.anchor.element.parsedom == 'video'
1481
1534
  }
1482
- const result = this.editor.getElementsByRange(true, true, useCache)
1535
+ const result = this.editor.getElementsByRange(useCache).flatIncludes
1483
1536
  return result.some(item => {
1484
1537
  return item.element.isClosed() && item.element.parsedom == 'video'
1485
1538
  })
@@ -1493,7 +1546,7 @@ export default {
1493
1546
  const block = this.editor.range.anchor.element.getBlock()
1494
1547
  return block.parsedom == 'blockquote'
1495
1548
  }
1496
- const result = this.editor.getElementsByRange(true, false, useCache)
1549
+ const result = this.editor.getElementsByRange(useCache).includes
1497
1550
  return result.every(item => {
1498
1551
  if (item.element.isBlock()) {
1499
1552
  return item.element.parsedom == 'blockquote'
@@ -1512,7 +1565,7 @@ export default {
1512
1565
  const block = this.editor.range.anchor.element.getBlock()
1513
1566
  return blockIsList(block, ordered)
1514
1567
  }
1515
- const result = this.editor.getElementsByRange(true, false, useCache)
1568
+ const result = this.editor.getElementsByRange(useCache).includes
1516
1569
  return result.every(item => {
1517
1570
  if (item.element.isBlock()) {
1518
1571
  return blockIsList(item.element, ordered)
@@ -1531,7 +1584,7 @@ export default {
1531
1584
  const block = this.editor.range.anchor.element.getBlock()
1532
1585
  return blockIsTask(block)
1533
1586
  }
1534
- const result = this.editor.getElementsByRange(true, false, useCache)
1587
+ const result = this.editor.getElementsByRange(useCache).includes
1535
1588
  return result.every(item => {
1536
1589
  if (item.element.isBlock()) {
1537
1590
  return blockIsTask(item.element)
@@ -1542,7 +1595,7 @@ export default {
1542
1595
  })
1543
1596
  },
1544
1597
  //api:创建一个空的表格
1545
- insertTable(rowLength, colLength, isRender = true) {
1598
+ insertTable(rowLength, colLength, isRender = true, useCache = false) {
1546
1599
  if (this.disabled) {
1547
1600
  return
1548
1601
  }
@@ -1562,7 +1615,7 @@ export default {
1562
1615
  }
1563
1616
  this.editor.addElementTo(row, tbody)
1564
1617
  }
1565
- this.editor.insertElement(table)
1618
+ this.editor.insertElement(table, true, useCache)
1566
1619
  //在表格后创建一个段落
1567
1620
  const paragraph = new AlexElement('block', AlexElement.BLOCK_NODE, null, null, null)
1568
1621
  const breakEl = new AlexElement('closed', 'br', null, null, null)
@@ -1615,10 +1668,10 @@ export default {
1615
1668
  }
1616
1669
  //起点和终点不在一起
1617
1670
  else {
1618
- let result = this.editor.getElementsByRange(true, false, useCache)
1671
+ let result = this.editor.getElementsByRange(true).includes
1619
1672
  this.editor.range.anchor.moveToStart(result[0].element.getBlock())
1620
1673
  this.editor.range.focus.moveToEnd(result[result.length - 1].element.getBlock())
1621
- const res = this.editor.getElementsByRange(true, true, useCache).filter(el => el.element.isText())
1674
+ const res = this.editor.getElementsByRange(true).flatIncludes.filter(el => el.element.isText())
1622
1675
  const obj = {}
1623
1676
  res.forEach(el => {
1624
1677
  if (obj[el.element.getBlock().key]) {
@@ -1660,14 +1713,14 @@ export default {
1660
1713
  }
1661
1714
  },
1662
1715
  //api:插入文本
1663
- insertText(text, isRender = true) {
1716
+ insertText(text, isRender = true, useCache = false) {
1664
1717
  if (this.disabled) {
1665
1718
  return
1666
1719
  }
1667
1720
  if (!this.editor.range) {
1668
1721
  return
1669
1722
  }
1670
- this.editor.insertText(text)
1723
+ this.editor.insertText(text, useCache)
1671
1724
  if (isRender) {
1672
1725
  this.editor.formatElementStack()
1673
1726
  this.editor.domRender()
@@ -1675,7 +1728,7 @@ export default {
1675
1728
  }
1676
1729
  },
1677
1730
  //api:插入html
1678
- insertHtml(html, isRender = true) {
1731
+ insertHtml(html, isRender = true, useCache = false) {
1679
1732
  if (this.disabled) {
1680
1733
  return
1681
1734
  }
@@ -1684,7 +1737,7 @@ export default {
1684
1737
  }
1685
1738
  const elements = this.editor.parseHtml(html)
1686
1739
  for (let i = 0; i < elements.length; i++) {
1687
- this.editor.insertElement(elements[i], false)
1740
+ this.editor.insertElement(elements[i], false, i == 0 ? useCache : false)
1688
1741
  }
1689
1742
  if (isRender) {
1690
1743
  this.editor.formatElementStack()
@@ -1723,6 +1776,23 @@ export default {
1723
1776
  -webkit-tap-highlight-color: transparent;
1724
1777
  outline: none;
1725
1778
  }
1779
+
1780
+ &.fullheight {
1781
+ height: 100%;
1782
+ }
1783
+
1784
+ &.fullscreen {
1785
+ position: fixed;
1786
+ z-index: 1000;
1787
+ left: 0;
1788
+ top: 0;
1789
+ width: 100vw;
1790
+ height: 100vh;
1791
+
1792
+ .editify-body {
1793
+ border-radius: 0;
1794
+ }
1795
+ }
1726
1796
  }
1727
1797
 
1728
1798
  .editify-body {
@@ -1731,22 +1801,24 @@ export default {
1731
1801
  position: relative;
1732
1802
  background-color: @background;
1733
1803
  padding: 1px;
1804
+ border-radius: 4px;
1734
1805
 
1735
1806
  &.border {
1736
1807
  border: 1px solid @border-color;
1737
- border-radius: 4px;
1738
1808
  transition: all 500ms;
1739
1809
 
1740
1810
  &.menu_inner {
1741
- border-radius: 0 0 4px 4px;
1742
1811
  border-top: none;
1743
- padding-top: 21px;
1812
+ border-radius: 0 0 4px 4px;
1813
+ }
1814
+ }
1744
1815
 
1745
- .editify-source {
1746
- top: 21px;
1747
- border-radius: 0 0 4px 4px;
1748
- height: calc(100% - 21px);
1749
- }
1816
+ &.menu_inner {
1817
+ padding-top: 21px;
1818
+
1819
+ .editify-source {
1820
+ top: 21px;
1821
+ height: calc(100% - 21px);
1750
1822
  }
1751
1823
  }
1752
1824
 
@@ -1779,6 +1851,8 @@ export default {
1779
1851
  line-height: inherit;
1780
1852
  padding: 6px 10px;
1781
1853
  cursor: text;
1854
+ touch-action: none;
1855
+ user-select: none;
1782
1856
  }
1783
1857
 
1784
1858
  //段落样式和标题
@@ -2072,5 +2146,10 @@ export default {
2072
2146
  color: @font-color-light;
2073
2147
  line-height: 1;
2074
2148
  }
2149
+
2150
+ //全屏模式下并且不是代码视图下,显示一个上边框
2151
+ &.fullscreen {
2152
+ border-top: 1px solid @border-color;
2153
+ }
2075
2154
  }
2076
2155
  </style>