zydx-plus 1.30.161 → 1.30.162

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.30.161",
3
+ "version": "1.30.162",
4
4
  "description": "Vue.js",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -15,9 +15,9 @@
15
15
  <div class="drag-cont-slot">
16
16
  <slot name="content"></slot>
17
17
  </div>
18
- <i class="down" v-if="dragStatus" @mousedown="footDown($event,'d')" @mouseup="footUp"></i>
19
- <i class="in" v-if="dragStatus" @mousedown="footDown($event,'in')" @mouseup="footUp"></i>
20
- <i class="right" v-if="dragStatus" @mousedown="footDown($event,'r')" @mouseup="footUp"></i>
18
+ <i class="drag-down" v-if="dragStatus" @mousedown="footDown($event,'d')" @mouseup="footUp"></i>
19
+ <i class="drag-in" v-if="dragStatus" @mousedown="footDown($event,'in')" @mouseup="footUp"></i>
20
+ <i class="drag-right" v-if="dragStatus" @mousedown="footDown($event,'r')" @mouseup="footUp"></i>
21
21
  </div>
22
22
  <div class="down-text" v-if="dragStatus">
23
23
  <div class="down-text-cont">
@@ -98,7 +98,7 @@ export default {
98
98
  },
99
99
  computed: {
100
100
  position() {
101
- return `top:${this.y}px;left:${this.x}px;width:${this.footRightOffset}px;height:${this.footDownOffset}px;`;
101
+ return `transform: translate(${this.x}px, ${this.y}px);width:${this.footRightOffset}px;height:${this.footDownOffset}px;`;
102
102
  },
103
103
  },
104
104
  emits: ['dragStatus','close'],
@@ -201,7 +201,7 @@ export default {
201
201
  padding: 0 10px;
202
202
  text-align: right;
203
203
  }
204
- .down{
204
+ .drag-down{
205
205
  position: absolute;
206
206
  bottom: -50px;
207
207
  right: 20px;
@@ -212,7 +212,7 @@ export default {
212
212
  cursor: ns-resize;
213
213
  user-select: none;
214
214
  }
215
- .in{
215
+ .drag-in{
216
216
  position: absolute;
217
217
  bottom: -40px;
218
218
  right: -20px;
@@ -223,7 +223,7 @@ export default {
223
223
  cursor: nwse-resize;
224
224
  user-select: none;
225
225
  }
226
- .right{
226
+ .drag-right{
227
227
  position: absolute;
228
228
  bottom: 0;
229
229
  right: -20px;
@@ -272,6 +272,8 @@ export default {
272
272
  }
273
273
  .drag-pop {
274
274
  position: fixed;
275
+ top: 0;
276
+ left: 0;
275
277
  box-shadow: 0 0 3px 2px #ccc;
276
278
  background-color: #fff;
277
279
  border-radius: 3px;
@@ -75,7 +75,6 @@
75
75
  </div>
76
76
  </template>
77
77
  <script>
78
-
79
78
  import { html2json, json2html } from 'html2json'
80
79
  import { Editor, EditorContent } from '@tiptap/vue-3'
81
80
  import StarterKit from '@tiptap/starter-kit'
@@ -84,6 +83,7 @@ import TextAlign from '@tiptap/extension-text-align'
84
83
  import Placeholder from '@tiptap/extension-placeholder'
85
84
  import Color from '@tiptap/extension-color'
86
85
  import textStyle from '@tiptap/extension-text-style'
86
+ import { sid } from "./sign-id";
87
87
  export default {
88
88
  name: 'zydx-xiao-editor',
89
89
  components: {
@@ -206,6 +206,7 @@ export default {
206
206
  }
207
207
  },
208
208
  mounted() {
209
+ let _this = this
209
210
  this.uploadAttData = (this.data.enclosure === undefined)? [] : this.enclosureAction(this.data.enclosure)
210
211
  this.heightStyle = (this.height === '100%')? {height: '100%'} : {'min-height': this.height}
211
212
  const height = this.height.split('px')[0] - 44
@@ -214,6 +215,7 @@ export default {
214
215
  content: json2html({node: "root",child: (this.data.html === undefined)? [] : this.data.html}),
215
216
  editable: this.readOnly,
216
217
  extensions: [
218
+ sid,
217
219
  StarterKit,
218
220
  textStyle,
219
221
  Color.configure({
@@ -237,7 +239,18 @@ export default {
237
239
  html: html2json(editor.getHTML()).child,
238
240
  enclosure: this.uploadAttData
239
241
  })
240
- },
242
+ }
243
+ })
244
+ document.addEventListener('keydown', function (e) {
245
+ if (e.keyCode === 8 || e.keyCode === 46) {
246
+ const sid = _this.editor.state.selection.$anchor.parent.attrs.sid
247
+ if(sid === 'prohibit') {
248
+ _this.editor.setEditable(false);
249
+ setTimeout(() => {
250
+ _this.editor.setEditable(true);
251
+ }, 0);
252
+ }
253
+ }
241
254
  })
242
255
  },
243
256
  methods: {
@@ -341,7 +354,6 @@ export default {
341
354
  insertContent(v) {
342
355
  for(let i=0; i< v.length; i++) {
343
356
  let html = json2html(v[i])
344
- console.log(html)
345
357
  this.editor.chain().focus().insertContentAt(this.selection(),html).run()
346
358
  }
347
359
  },
@@ -0,0 +1,33 @@
1
+ import { Extension } from '@tiptap/core'
2
+
3
+ export const sid = Extension.create({
4
+ name: 'sid',
5
+
6
+ addOptions() {
7
+ return {
8
+ types: ['heading', 'paragraph'],
9
+ }
10
+ },
11
+
12
+ addGlobalAttributes() {
13
+ return [
14
+ {
15
+ types: this.options.types,
16
+ attributes: {
17
+ sid: {
18
+ default: null,
19
+ parseHTML: element => element.getAttribute('data-sid'),
20
+ renderHTML: attributes => {
21
+ if (!attributes.sid) {
22
+ return {}
23
+ }
24
+ return {
25
+ 'data-sid': attributes.sid,
26
+ }
27
+ },
28
+ },
29
+ },
30
+ },
31
+ ]
32
+ }
33
+ })
package/src/index.js CHANGED
@@ -71,7 +71,7 @@ function install(app) {
71
71
  }
72
72
 
73
73
  export default {
74
- version: '1.30.161',
74
+ version: '1.30.162',
75
75
  install,
76
76
  Calendar,
77
77
  Message,