zydx-plus 1.32.182 → 1.32.183
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 +1 -1
- package/src/components/editor/src/butJson.js +9 -4
- package/src/components/editor/src/editor.vue +2 -0
- package/src/components/editor/src/extend/title-id.js +33 -0
- package/src/components/question/src/question.vue +7 -7
- package/src/components/treeList/src/treeList.vue +1 -0
- package/src/index.js +1 -1
package/package.json
CHANGED
|
@@ -18,10 +18,10 @@ export function butJson (editor,data) {
|
|
|
18
18
|
{name: '(左)黑体5号', key: 'blackLeft5'},
|
|
19
19
|
],
|
|
20
20
|
html: {
|
|
21
|
-
blackCenter4: `<p data-signId="title" style="text-align: center;"><span style="font-weight: 700;color: rgb(0, 0, 0);font-size: 16px;font-family: SimHei">${menusData(data,'titleMenu').text}</span></p>`,
|
|
22
|
-
blackLeft4: `<p data-signId="title" style="text-align: left;"><span style="font-weight: 700;color: rgb(0, 0, 0);font-size: 16px;font-family: SimHei">${menusData(data,'titleMenu').text}</span></p>`,
|
|
23
|
-
blackCenter5: `<p data-signId="title" style="text-align: center;"><span style="font-weight: 700;color: rgb(0, 0, 0);font-size: 14px;font-family: SimHei">${menusData(data,'titleMenu').text}</span></p>`,
|
|
24
|
-
blackLeft5: `<p data-signId="title" style="text-align: left;"><span style="font-weight: 700;color: rgb(0, 0, 0);font-size: 14px;font-family: SimHei">${menusData(data,'titleMenu').text}</span></p>`,
|
|
21
|
+
blackCenter4: `<p data-signId="title-1" id="${randomId()}" style="text-align: center;"><span style="font-weight: 700;color: rgb(0, 0, 0);font-size: 16px;font-family: SimHei">${menusData(data,'titleMenu').text}</span></p>`,
|
|
22
|
+
blackLeft4: `<p data-signId="title-2" id="${randomId()}" style="text-align: left;"><span style="font-weight: 700;color: rgb(0, 0, 0);font-size: 16px;font-family: SimHei">${menusData(data,'titleMenu').text}</span></p>`,
|
|
23
|
+
blackCenter5: `<p data-signId="title-3" id="${randomId()}" style="text-align: center;"><span style="font-weight: 700;color: rgb(0, 0, 0);font-size: 14px;font-family: SimHei">${menusData(data,'titleMenu').text}</span></p>`,
|
|
24
|
+
blackLeft5: `<p data-signId="title-4" id="${randomId()}" style="text-align: left;"><span style="font-weight: 700;color: rgb(0, 0, 0);font-size: 14px;font-family: SimHei">${menusData(data,'titleMenu').text}</span></p>`,
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
27
|
textMenu: {
|
|
@@ -133,6 +133,11 @@ function menusData(data,key) {
|
|
|
133
133
|
return arr
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
+
// 随机id
|
|
137
|
+
function randomId() {
|
|
138
|
+
return Math.random().toString(36).substr(2)
|
|
139
|
+
}
|
|
140
|
+
|
|
136
141
|
// 时间
|
|
137
142
|
function getTime() {
|
|
138
143
|
let date = new Date()
|
|
@@ -75,6 +75,7 @@ import Link from "@tiptap/extension-link";
|
|
|
75
75
|
import { FontSize } from "./extend/font-size";
|
|
76
76
|
import { signId } from "./extend/sign-id";
|
|
77
77
|
import { Contenteditable } from "./extend/contenteditable";
|
|
78
|
+
import { titleId } from "./extend/title-id";
|
|
78
79
|
|
|
79
80
|
export default {
|
|
80
81
|
name: 'zydx-editor',
|
|
@@ -181,6 +182,7 @@ export default {
|
|
|
181
182
|
StarterKit, // 基础
|
|
182
183
|
TextStyle, // 文本样式
|
|
183
184
|
Superscript, // 上标
|
|
185
|
+
titleId, // 标题id
|
|
184
186
|
Link.configure({
|
|
185
187
|
HTMLAttributes: {
|
|
186
188
|
class: 'custom-link',
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Extension } from '@tiptap/core'
|
|
2
|
+
|
|
3
|
+
export const titleId = Extension.create({
|
|
4
|
+
name: 'titleId',
|
|
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
|
+
titleId: {
|
|
18
|
+
default: null,
|
|
19
|
+
parseHTML: element => element.getAttribute('id'),
|
|
20
|
+
renderHTML: attributes => {
|
|
21
|
+
if (!attributes.titleId) {
|
|
22
|
+
return {}
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
'id': attributes.titleId,
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
})
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
<span>{{ item.easy }}</span>
|
|
21
21
|
</div>
|
|
22
22
|
<div v-else class="qu-input" :style="{'margin-left': readOnlys?'0px':'-10px'}">
|
|
23
|
-
<span v-if="readOnlys">{{ item.easy }}</span>
|
|
23
|
+
<span v-if="readOnlys">{{ item.easy === ''? '-': item.easy }}</span>
|
|
24
24
|
<input v-else type="number" placeholder="题量" :value="item.easy" @input="totalQuestions($event,1,index)" @keypress="isNumberKey($event,1)" />
|
|
25
25
|
</div>
|
|
26
26
|
</td>
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
<span>{{ item.hard }}</span>
|
|
30
30
|
</div>
|
|
31
31
|
<div v-else class="qu-input" :style="{'margin-left': readOnlys?'0px':'-10px'}">
|
|
32
|
-
<span v-if="readOnlys">{{ item.hard }}</span>
|
|
32
|
+
<span v-if="readOnlys">{{ item.hard === ''? '-': item.hard }}</span>
|
|
33
33
|
<input v-else type="number" placeholder="题量" :value="item.hard" @input="totalQuestions($event,2,index)" @keypress="isNumberKey($event,1)" />
|
|
34
34
|
</div>
|
|
35
35
|
</td>
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
<span>{{ item.mid }}</span>
|
|
39
39
|
</div>
|
|
40
40
|
<div v-else class="qu-input" :style="{'margin-left': readOnlys?'0px':'-10px'}">
|
|
41
|
-
<span v-if="readOnlys">{{ item.mid }}</span>
|
|
41
|
+
<span v-if="readOnlys">{{ item.mid === ''? '-': item.mid }}</span>
|
|
42
42
|
<input v-else type="number" placeholder="题量" :value="item.mid" @input="totalQuestions($event,3,index)" @keypress="isNumberKey($event,1)" />
|
|
43
43
|
</div>
|
|
44
44
|
</td>
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
<span>{{ item.easyScore }}</span>
|
|
56
56
|
</div>
|
|
57
57
|
<div v-else class="qu-input" :style="{'margin-left': readOnlys?'0px':'-10px'}">
|
|
58
|
-
<span v-if="readOnlys">{{ item.easyScore }}</span>
|
|
58
|
+
<span v-if="readOnlys">{{ item.easyScore === ''? '-': item.easyScore }}</span>
|
|
59
59
|
<input v-else type="number" placeholder="分值" :value="item.easyScore" @input="totalQuestions($event,4,index)" @keypress="isNumberKey($event,2)" />
|
|
60
60
|
</div>
|
|
61
61
|
</td>
|
|
@@ -64,16 +64,16 @@
|
|
|
64
64
|
<span>{{ item.hardScore }}</span>
|
|
65
65
|
</div>
|
|
66
66
|
<div v-else class="qu-input" :style="{'margin-left': readOnlys?'0px':'-10px'}">
|
|
67
|
-
<span v-if="readOnlys">{{ item.hardScore }}</span>
|
|
67
|
+
<span v-if="readOnlys">{{ item.hardScore === ''? '-': item.hardScore }}</span>
|
|
68
68
|
<input v-else type="number" placeholder="分值" :value="item.hardScore" @input="totalQuestions($event,5,index)" @keypress="isNumberKey($event,2)" />
|
|
69
69
|
</div>
|
|
70
70
|
</td>
|
|
71
71
|
<td>
|
|
72
72
|
<div v-if="empty" class="qu-input" :style="{'margin-left': '0px'}">
|
|
73
|
-
<span>{{ item.midScore }}</span>
|
|
73
|
+
<span>{{ item.midScore === ''? '-': item.midScore }}</span>
|
|
74
74
|
</div>
|
|
75
75
|
<div v-else class="qu-input" :style="{'margin-left': readOnlys?'0px':'-10px'}">
|
|
76
|
-
<span v-if="readOnlys">{{ item.midScore }}</span>
|
|
76
|
+
<span v-if="readOnlys">{{ item.midScore === ''? '-': item.midScore }}</span>
|
|
77
77
|
<input v-else type="number" placeholder="分值" :value="item.midScore" @input="totalQuestions($event,6,index)" @keypress="isNumberKey($event,2)" />
|
|
78
78
|
</div>
|
|
79
79
|
</td>
|