zydx-plus 1.35.470 → 1.35.472

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.35.470",
3
+ "version": "1.35.472",
4
4
  "description": "Vue.js",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -49,7 +49,8 @@
49
49
  "react": "^18.2.0",
50
50
  "react-dom": "^18.2.0",
51
51
  "tldraw": "^2.0.2",
52
- "@tldraw/editor": "^2.0.2"
52
+ "@tldraw/editor": "^2.0.2",
53
+ "buffer": "^5.7.1"
53
54
  },
54
55
  "peerDependencies": {
55
56
  "vue": "^3.2.13"
@@ -161,10 +161,10 @@ input[name='check'] {
161
161
  left: 0;
162
162
  }
163
163
  .subject-but{
164
- position: relative;
164
+ display: inline-block;
165
+ float: right;
165
166
  }
166
167
  .subject-but b{
167
- position: absolute;
168
168
  z-index: 1;
169
169
  display: flex;
170
170
  }
@@ -9,9 +9,9 @@
9
9
  <span :style="{'font-weight': titleCrude?700:'normal'}">{{ item.order ? item.order : index + 1 }}{{ item.order === ' ' ? '' : '.' }}<em
10
10
  v-html="item.title"></em><em v-if="scoreShow">({{ item.score }}分)</em>
11
11
  <i class="subject-but" ref="subject">
12
- <b :style="{right: -item.right + 'px', top: item.top + 'px'}" ref="b">
12
+ <!-- <b :style="{right: -item.right + 'px', top: item.top + 'px'}" ref="b"> -->
13
13
  <button class="but" :disabled="it.disabled" v-for="(it) in item.customBut" :class="{'buts-actives theme-text': it.active&&it.butStart,'buts-disabled': it.disabled}" @click="customButTap(it,item)">{{ it.active? it.nameActive: it.name }}</button>
14
- </b>
14
+ <!-- </b> -->
15
15
  </i>
16
16
  </span>
17
17
  </div>
@@ -181,9 +181,11 @@ export default {
181
181
  })
182
182
  if( copy.length && this.value.length) {
183
183
  copy.forEach((item, index) => {
184
- if(item.resourceId===this.value[index].resourceId){
185
- this.value[index].open = item.open
186
- this.value[index].customBut[0].active = item.open
184
+ if(this.value[index]){
185
+ if(item.resourceId===this.value[index].resourceId){
186
+ this.value[index].open = item.open
187
+ this.value[index].customBut[0].active = item.open
188
+ }
187
189
  }
188
190
  })
189
191
  }
@@ -8,6 +8,11 @@ import {createElement} from 'react'
8
8
  import {createRoot} from 'react-dom/client'
9
9
  import {AssetRecordType,createShapeId, Tldraw, FileHelpers} from 'tldraw'
10
10
  import 'tldraw/tldraw.css'
11
+ import * as buffer from "buffer"; //引入buffer
12
+
13
+ if (typeof window.Buffer === "undefined") { // 判断当前环境是否有Buffer对象
14
+ window.Buffer = buffer.Buffer; // Buffer对象不存在则创建导入的buffer
15
+ }
11
16
 
12
17
  const clearJson = {
13
18
  store: {
@@ -102,27 +107,27 @@ export default {
102
107
  }, null))
103
108
  },
104
109
  methods: {
105
- exportImg() {
106
- return new Promise((rl,ri) => {
107
- editorAPP.getSvg([...editorAPP.getCurrentPageShapeIds()],{}).then(r => {
108
- const s = new XMLSerializer().serializeToString(r);
109
- const src = `data:image/svg+xml;base64,${window.btoa(s)}`;
110
- const img = new Image(); // 创建图片容器承载过渡
111
- img.src = src;
112
- img.onload = () => {
113
- // ↓ 第二部分
114
- const canvas = document.createElement('canvas');
115
- canvas.width = img.width;
116
- canvas.height = img.height;
117
- const context = canvas.getContext('2d');
118
- context.drawImage(img, 0, 0);
119
- const ImgBase64 = canvas.toDataURL('image/png');
120
- let blob = this.dataURLtoBlob(ImgBase64);
121
- let file = new File([blob], `${new Date().getTime()}.png`, {lastModified: Date.now()});
122
- rl(file)
123
- }
124
- })
125
- })
110
+ exportImg() {
111
+ return new Promise((rl,ri) => {
112
+ editorAPP.getSvg([...editorAPP.getCurrentPageShapeIds()],{}).then(r => {
113
+ const s = new XMLSerializer().serializeToString(r);
114
+ const src = `data:image/svg+xml;base64,${Buffer.from(s).toString('base64')}`;
115
+ const img = new Image(); // 创建图片容器承载过渡
116
+ img.src = src;
117
+ img.onload = () => {
118
+ // ↓ 第二部分
119
+ const canvas = document.createElement('canvas');
120
+ canvas.width = img.width;
121
+ canvas.height = img.height;
122
+ const context = canvas.getContext('2d');
123
+ context.drawImage(img, 0, 0);
124
+ const ImgBase64 = canvas.toDataURL('image/png');
125
+ let blob = this.dataURLtoBlob(ImgBase64);
126
+ let file = new File([blob], `${new Date().getTime()}.png`, {lastModified: Date.now()});
127
+ rl(file)
128
+ }
129
+ })
130
+ })
126
131
  },
127
132
  dataURLtoBlob(dataurl) {
128
133
  let arr = dataurl.split(',');
@@ -390,7 +395,6 @@ export default {
390
395
  },
391
396
  styleProps(t, e) {
392
397
  const style = [...editorAPP.styleProps[t]]
393
- console.log(style)
394
398
  const index = style.findIndex(item => item[1] === e)
395
399
  return style[index][0]
396
400
  },
package/src/index.js CHANGED
@@ -87,7 +87,7 @@ function install(app) {
87
87
  }
88
88
 
89
89
  export default {
90
- version: '1.35.470',
90
+ version: '1.35.472',
91
91
  install,
92
92
  Calendar,
93
93
  Message,