zydx-plus 1.33.332 → 1.33.334

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.332",
3
+ "version": "1.33.334",
4
4
  "description": "Vue.js",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -26,22 +26,28 @@
26
26
  "katex": "^0.15.6",
27
27
  "simple-mind-map": "^0.9.6",
28
28
  "html2json": "^1.0.2",
29
- "@tiptap/extension-image": "^2.0.3",
30
29
  "@tiptap/starter-kit": "^2.0.3",
31
30
  "@tiptap/vue-3": "^2.0.3",
31
+ "@tiptap/extension-bubble-menu": "^2.1.0",
32
32
  "@tiptap/extension-color": "^2.0.3",
33
+ "@tiptap/extension-focus": "^2.1.13",
33
34
  "@tiptap/extension-font-family": "^2.0.3",
35
+ "@tiptap/extension-heading": "^2.0.4",
34
36
  "@tiptap/extension-horizontal-rule": "^2.0.3",
37
+ "@tiptap/extension-image": "^2.0.3",
38
+ "@tiptap/extension-link": "^2.0.3",
35
39
  "@tiptap/extension-paragraph": "^2.0.3",
36
40
  "@tiptap/extension-placeholder": "^2.0.3",
37
41
  "@tiptap/extension-superscript": "^2.0.3",
38
42
  "@tiptap/extension-text-align": "^2.0.3",
39
43
  "@tiptap/extension-text-style": "^2.0.3",
40
- "@tiptap/extension-link": "^2.0.3",
41
44
  "@vue-office/docx": "^1.1.3",
42
45
  "@vue-office/excel": "^1.1.3",
43
46
  "js-export-word": "^1.0.5",
44
- "js-audio-recorder": "^1.0.7"
47
+ "js-audio-recorder": "^1.0.7",
48
+ "react": "^18.2.0",
49
+ "react-dom": "^18.2.0",
50
+ "tldraw": "^2.0.2"
45
51
  },
46
52
  "peerDependencies": {
47
53
  "vue": "^3.2.13"
@@ -226,8 +226,9 @@ export default {
226
226
  // 判断两个日期的大小
227
227
  let start = (this.rangeStart_ === undefined)? null:this.rangeStart_.replace(/-/g, '')
228
228
  let end = (this.rangeEnd_ === undefined)? null:this.rangeEnd_.replace(/-/g, '')
229
- if(start > end) {
230
- date = {end: this.rangeStart_, start: this.rangeEnd_}
229
+ date = {start: this.rangeStart_, end: this.rangeEnd_}
230
+ if(Number(start) > Number(end)) {
231
+ date = {start: this.rangeEnd_, end: this.rangeStart_}
231
232
  }else {
232
233
  date = {start: this.rangeStart_, end: this.rangeEnd_}
233
234
  }
@@ -54,12 +54,12 @@
54
54
  <div class="complete" v-if="!readOnly && toolbar.length > 0">
55
55
  <button class="but" v-if="butShow" @click="confirm">完成</button>
56
56
  </div>
57
+ <div class="menus" v-if="menus&&readOnly" :style="menusStyle">
58
+ <button class="but" @click="enlSee" v-if="readOnly">查看</button>
59
+ <button class="but" @click="enlDownload" v-if="readOnly">下载</button>
60
+ <button class="but" @click="enlDel" v-if="!readOnly">删除</button>
61
+ </div>
57
62
  <div class="read-only" v-if="page&&readOnly" :style="{width: (wit + 20) + 'px'}">
58
- <div class="menus" v-if="menus&&readOnly" :style="menusStyle">
59
- <button class="but" @click="enlSee" v-if="readOnly">查看</button>
60
- <button class="but" @click="enlDownload" v-if="readOnly">下载</button>
61
- <button class="but" @click="enlDel" v-if="!readOnly">删除</button>
62
- </div>
63
63
  <div class="editing-header" v-if="signMenuShow">
64
64
  <img :src="menusData('signMenu')?.ico" alt=""/>
65
65
  <span>{{ menusData('signMenu')?.text }}</span>
@@ -704,12 +704,12 @@ export default {
704
704
  const last = this.editor.state.selection.$anchor.path[0].content.size
705
705
  if (t === -1) this.editor.chain().focus().insertContentAt(last, html).run()
706
706
  const num = this.upSort(this.editor, 'enclosure')
707
- const html2 = `<p contenteditable="false" data-signId="u-${num.num}" data-url="${url}"><span class="mu">${num.num}. ${name}</span></p>`
707
+ const html2 = `<p contenteditable="false" data-signId="u-${num.num}" data-url="${url}" class="mu"><span>${num.num}. ${name}</span></p>`
708
708
  this.editor.chain().focus().insertContentAt(num.len, html2).run()
709
709
  } else {
710
710
  if (t === -1) this.editor.chain().focus().insertContentAt(this.selectionPath('paragraph', b - 1), html).run()
711
711
  const num = this.upSort(this.editor, 'enclosure')
712
- const html2 = `<p contenteditable="false" data-signId="u-${num.num}" data-url="${url}"><span class="mu">${num.num}. ${name}</span></p>`
712
+ const html2 = `<p contenteditable="false" data-signId="u-${num.num}" data-url="${url}" class="mu"><span>${num.num}. ${name}</span></p>`
713
713
  this.editor.chain().focus().insertContentAt(num.len, html2).run()
714
714
  }
715
715
  })
@@ -0,0 +1,6 @@
1
+ import main from './src/sketchpad';
2
+
3
+ main.install = function(Vue) {
4
+ Vue.component(main.name, main);
5
+ };
6
+ export default main;
@@ -0,0 +1,178 @@
1
+ <template>
2
+ <div ref="reactRef" class="react"></div>
3
+ </template>
4
+
5
+ <script>
6
+ import { createElement } from 'react'
7
+ import { createRoot } from 'react-dom/client'
8
+ import { Tldraw } from 'tldraw'
9
+ import 'tldraw/tldraw.css'
10
+
11
+ const clearJson = {
12
+ store:{
13
+ "document:document":{
14
+ gridSize:10,
15
+ name:"",
16
+ meta:{},
17
+ id:"document:document",
18
+ typeName:"document"
19
+ },
20
+ "page:page":{
21
+ meta:{},
22
+ id:"page:page",
23
+ name:"Page 1",
24
+ index:"a1",
25
+ typeName:"page"
26
+ }
27
+ },
28
+ schema:{
29
+ schemaVersion:1,
30
+ storeVersion:4,
31
+ recordVersions:{
32
+ asset:{
33
+ version:1,
34
+ subTypeKey:"type",
35
+ subTypeVersions:{
36
+ image:3,
37
+ video:3,
38
+ bookmark:1
39
+ }
40
+ },
41
+ camera:{version:1},
42
+ document:{version:2},
43
+ instance:{version:24},
44
+ instance_page_state:{version:5},
45
+ page:{"version":1},
46
+ shape:{
47
+ version:3,
48
+ subTypeKey:"type",
49
+ subTypeVersions:{
50
+ group:0,
51
+ text:1,
52
+ bookmark:2,
53
+ draw:1,
54
+ geo:8,
55
+ note:5,
56
+ line:4,
57
+ frame:0,
58
+ arrow:3,
59
+ highlight:0,
60
+ embed:4,
61
+ image:3,
62
+ video:2
63
+ }
64
+ },
65
+ instance_presence:{version:5},pointer:{version:1}
66
+ }
67
+ }
68
+ }
69
+
70
+ export default {
71
+ name: "zydx-sketchpad",
72
+ data() {
73
+ return {
74
+ editor:null
75
+ }
76
+ },
77
+ mounted() {
78
+ const root = createRoot(this.$refs.reactRef)
79
+ root.render(createElement(Tldraw, {
80
+ onMount: this.handleMountedEditor,
81
+ hideUi: true
82
+ }, null))
83
+ },
84
+ methods: {
85
+ handleMountedEditor(editor) {
86
+ this.editor = editor
87
+ // editor.store.listen((entry) => {
88
+ // const up = entry.changes.updated
89
+ // })
90
+ },
91
+ // 清空
92
+ clear() {
93
+ this.editor.store.loadSnapshot(clearJson)
94
+ },
95
+ // 添加快照
96
+ setSnapshot(v) {
97
+ this.editor.store.loadSnapshot(v)
98
+ },
99
+ // 获取快照
100
+ getSnapshot() {
101
+ return this.editor.store.getSnapshot()
102
+ },
103
+ draw(v) {
104
+ this.styleProps('draw','color').defaultValue = v?.color?? 'black'
105
+ this.styleProps('draw','size').defaultValue = v?.size?? 'm'
106
+ this.editor.setCurrentTool('draw')
107
+ },
108
+ select() {
109
+ this.editor.setCurrentTool('select')
110
+ },
111
+ hand() {
112
+ this.editor.setCurrentTool('hand')
113
+ },
114
+ eraser() {
115
+ this.editor.setCurrentTool('eraser')
116
+ },
117
+ arrow(v) {
118
+ this.styleProps('arrow','color').defaultValue = v?.color?? 'black'
119
+ this.styleProps('arrow','size').defaultValue = v?.size?? 'm'
120
+ this.editor.setCurrentTool('arrow')
121
+ },
122
+ text(v) {
123
+ this.styleProps('arrow','color').defaultValue = v?.color?? 'black'
124
+ this.styleProps('arrow','size').defaultValue = v?.size?? 'm'
125
+ this.editor.setCurrentTool('text')
126
+ },
127
+ line(v) {
128
+ this.styleProps('arrow','color').defaultValue = v?.color?? 'black'
129
+ this.styleProps('arrow','size').defaultValue = v?.size?? 'm'
130
+ this.editor.setCurrentTool('line')
131
+ },
132
+ rectangle(v) {
133
+ this.styleProps('geo','geo').defaultValue = 'rectangle'
134
+ this.styleProps('geo','color').defaultValue = v?.color?? 'black'
135
+ this.styleProps('geo','size').defaultValue = v?.size?? 'm'
136
+ this.editor.setCurrentTool('geo')
137
+ },
138
+ ellipse(v) {
139
+ this.styleProps('geo','geo').defaultValue = 'ellipse'
140
+ this.styleProps('geo','color').defaultValue = v?.color?? 'black'
141
+ this.styleProps('geo','size').defaultValue = v?.size?? 'm'
142
+ this.editor.setCurrentTool('geo')
143
+ },
144
+ triangle(v) {
145
+ this.styleProps('geo','geo').defaultValue = 'triangle'
146
+ this.styleProps('geo','color').defaultValue = v?.color?? 'black'
147
+ this.styleProps('geo','size').defaultValue = v?.size?? 'm'
148
+ this.editor.setCurrentTool('geo')
149
+ },
150
+ star(v) {
151
+ this.styleProps('geo','geo').defaultValue = 'star'
152
+ this.styleProps('geo','color').defaultValue = v?.color?? 'black'
153
+ this.styleProps('geo','size').defaultValue = v?.size?? 'm'
154
+ this.editor.setCurrentTool('geo')
155
+ },
156
+ highlight(v) {
157
+ this.styleProps('geo','color').defaultValue = v?.color?? 'black'
158
+ this.styleProps('geo','size').defaultValue = v?.size?? 'm'
159
+ this.editor.setCurrentTool('highlight')
160
+ },
161
+ laser() {
162
+ this.editor.setCurrentTool('laser')
163
+ },
164
+ styleProps(t,e) {
165
+ const style = [...this.editor.styleProps[t]]
166
+ const index = style.findIndex(item => item[1] === e)
167
+ return style[index][0]
168
+ }
169
+ }
170
+ }
171
+ </script>
172
+
173
+ <style scoped>
174
+ .react{
175
+ width: 100%;
176
+ height: 100%;
177
+ }
178
+ </style>
@@ -69,9 +69,10 @@ export default {
69
69
  methods: {
70
70
  splitHtml(v) {
71
71
  if(v === '' || v === null) return ''
72
- const arr = v.split('<br>')
72
+ const arr = v.split('\n')
73
73
  let html = ''
74
74
  arr.forEach(item => {
75
+ item = item.replace(/ /g, '&nbsp;')
75
76
  html += `<p>${item}</p>`
76
77
  })
77
78
  return html
@@ -101,16 +102,23 @@ export default {
101
102
  },
102
103
  getContent() {
103
104
  const html = this.$refs.textarea.innerHTML
104
- const br = html.replace(/<div>/g, '<br>').replace(/<\/div>/g, '').replace(/<p>/g, '<br>').replace(/<\/p>/g, '')
105
+ const br = html
106
+ .replace(/<div>/g, '\n')
107
+ .replace(/<\/div>/g, '')
108
+ .replace(/<p>/g, '\n')
109
+ .replace(/<\/p>/g, '')
110
+ .replace(/<span style="text-indent: 2em;">/g, '')
111
+ .replace(/<\/span>/g, '')
112
+ .replace(/&nbsp;/g, ' ')
105
113
  // 如果br后边没有内容,就去掉br
106
- if (br.indexOf('<br>') !== -1) {
107
- const arr = br.split('<br>')
114
+ if (br.indexOf('\n') !== -1) {
115
+ const arr = br.split('\n')
108
116
  arr.forEach((item, index) => {
109
117
  if (item === '') {
110
118
  arr.splice(index, 1)
111
119
  }
112
120
  })
113
- return arr.join('<br>')
121
+ return arr.join('\n')
114
122
  }else {
115
123
  return br
116
124
  }
package/src/index.js CHANGED
@@ -34,6 +34,7 @@ import paper from './components/word2/index';
34
34
  import question from './components/question/index';
35
35
  import tagging from './components/tagging/index';
36
36
  import seek from './components/seek/index';
37
+ import sketchpad from './components/sketchpad/index';
37
38
 
38
39
  const components = [
39
40
  Calendar,
@@ -68,7 +69,8 @@ const components = [
68
69
  paper,
69
70
  question,
70
71
  tagging,
71
- seek
72
+ seek,
73
+ sketchpad
72
74
  ];
73
75
 
74
76
  function install(app) {
@@ -81,7 +83,7 @@ function install(app) {
81
83
  }
82
84
 
83
85
  export default {
84
- version: '1.33.332',
86
+ version: '1.33.334',
85
87
  install,
86
88
  Calendar,
87
89
  Message,
@@ -118,6 +120,7 @@ export default {
118
120
  paper,
119
121
  question,
120
122
  tagging,
121
- seek
123
+ seek,
124
+ sketchpad
122
125
  };
123
126