starfish-form-custom 1.0.33 → 1.0.35
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/dist/{formAction-cfa5fd87.mjs → formAction-5d0e6e20.mjs} +1 -2
- package/dist/{index-b6de786a.mjs → index-2fe91869.mjs} +2 -3
- package/dist/{index-cdc52674.mjs → index-4dabe1d8.mjs} +1 -2
- package/dist/{index-89d6b690.mjs → index-a1e32b9f.mjs} +26 -7
- package/dist/{main-8dad66de.mjs → main-b0acaeb8.mjs} +115 -93
- package/dist/{starfish-form-4c2ab774.mjs → starfish-form-54bcfdaa.mjs} +1 -2
- package/dist/starfish-form.mjs +1 -2
- package/dist/style.css +81 -12
- package/dist/types/form/src/components/RichText/MenuItem.vue.d.ts +2 -1
- package/package.json +1 -1
- package/src/components/RichText/MenuItem.vue +40 -16
- package/src/components/RichText/index.vue +94 -3
- package/stats.html +1 -1
package/dist/style.css
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
display: flex;
|
|
14
14
|
align-items: center;
|
|
15
15
|
}
|
|
16
|
-
.menu-item[data-v-
|
|
16
|
+
.menu-item[data-v-6c37ffa3] {
|
|
17
17
|
display: flex;
|
|
18
18
|
align-items: center;
|
|
19
19
|
justify-content: center;
|
|
@@ -23,19 +23,20 @@
|
|
|
23
23
|
border: 1px solid #ddd;
|
|
24
24
|
border-radius: 4px;
|
|
25
25
|
cursor: pointer;
|
|
26
|
-
transition: all 0.2s ease;
|
|
26
|
+
transition: all 0.2s ease;
|
|
27
|
+
font-style: normal;
|
|
27
28
|
}
|
|
28
|
-
.menu-item[data-v-
|
|
29
|
+
.menu-item[data-v-6c37ffa3]:hover {
|
|
29
30
|
background-color: #f0f0f0;
|
|
30
31
|
border-color: #999;
|
|
31
32
|
}
|
|
32
|
-
.menu-item.is-active[data-v-
|
|
33
|
+
.menu-item.is-active[data-v-6c37ffa3] {
|
|
33
34
|
background-color: #e0e0e0;
|
|
34
35
|
border-color: #666;
|
|
35
36
|
}
|
|
36
|
-
.
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
.menu-icon[data-v-6c37ffa3] {
|
|
38
|
+
font-size: 16px;
|
|
39
|
+
color: #333;
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
.editor__header[data-v-45d3fb0a] {
|
|
@@ -468,23 +469,91 @@
|
|
|
468
469
|
min-height: 60px;
|
|
469
470
|
height: 100%;
|
|
470
471
|
}
|
|
471
|
-
.rich-text-editor[data-v-
|
|
472
|
+
.rich-text-editor[data-v-544977e4] {
|
|
472
473
|
min-height: 200px;
|
|
473
474
|
}
|
|
474
|
-
[data-v-
|
|
475
|
+
[data-v-544977e4] .editor-content {
|
|
475
476
|
min-height: 200px;
|
|
476
477
|
}
|
|
477
|
-
[data-v-
|
|
478
|
+
[data-v-544977e4] .ProseMirror {
|
|
478
479
|
min-height: 180px;
|
|
479
|
-
outline: none;
|
|
480
|
+
outline: none;
|
|
481
|
+
padding: 12px;
|
|
480
482
|
}
|
|
481
|
-
[data-v-
|
|
483
|
+
[data-v-544977e4] .ProseMirror p.is-editor-empty:first-child::before {
|
|
482
484
|
color: #adb5bd;
|
|
483
485
|
content: attr(data-placeholder);
|
|
484
486
|
float: left;
|
|
485
487
|
height: 0;
|
|
486
488
|
pointer-events: none;
|
|
487
489
|
}
|
|
490
|
+
|
|
491
|
+
/* 行内代码样式 */
|
|
492
|
+
[data-v-544977e4] .ProseMirror .inline-code {
|
|
493
|
+
background-color: #f3f4f6;
|
|
494
|
+
color: #e53e3e;
|
|
495
|
+
padding: 2px 6px;
|
|
496
|
+
border-radius: 4px;
|
|
497
|
+
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
|
|
498
|
+
font-size: 0.875em;
|
|
499
|
+
border: 1px solid #e5e7eb;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
/* 代码块样式 */
|
|
503
|
+
[data-v-544977e4] .ProseMirror code {
|
|
504
|
+
background-color: #1f2937;
|
|
505
|
+
color: #f9fafb;
|
|
506
|
+
padding: 16px;
|
|
507
|
+
border-radius: 8px;
|
|
508
|
+
margin: 12px 0;
|
|
509
|
+
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
|
|
510
|
+
font-size: 0.875em;
|
|
511
|
+
line-height: 1.5;
|
|
512
|
+
position: relative;
|
|
513
|
+
border: 1px solid #374151;
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
|
|
517
|
+
/* 引用块样式 */
|
|
518
|
+
[data-v-544977e4] .ProseMirror blockquote {
|
|
519
|
+
border-left: 4px solid #3b82f6;
|
|
520
|
+
background-color: #f8fafc;
|
|
521
|
+
padding: 12px 16px;
|
|
522
|
+
margin: 12px 0;
|
|
523
|
+
border-radius: 0 8px 8px 0;
|
|
524
|
+
font-style: italic;
|
|
525
|
+
color: #4b5563;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
/* 水平分割线样式 */
|
|
529
|
+
[data-v-544977e4] .ProseMirror hr {
|
|
530
|
+
border: none;
|
|
531
|
+
border-top: 2px solid #e5e7eb;
|
|
532
|
+
margin: 24px 0;
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
/* 列表样式 */
|
|
536
|
+
[data-v-544977e4] .ProseMirror ul,[data-v-544977e4] .ProseMirror ol {
|
|
537
|
+
padding-left: 24px;
|
|
538
|
+
margin: 12px 0;
|
|
539
|
+
}
|
|
540
|
+
[data-v-544977e4] .ProseMirror li {
|
|
541
|
+
margin: 4px 0;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
/* 标题样式 */
|
|
545
|
+
[data-v-544977e4] .ProseMirror h1 {
|
|
546
|
+
font-size: 1.875em;
|
|
547
|
+
font-weight: bold;
|
|
548
|
+
margin: 24px 0 16px 0;
|
|
549
|
+
color: #111827;
|
|
550
|
+
}
|
|
551
|
+
[data-v-544977e4] .ProseMirror h2 {
|
|
552
|
+
font-size: 1.5em;
|
|
553
|
+
font-weight: bold;
|
|
554
|
+
margin: 20px 0 12px 0;
|
|
555
|
+
color: #111827;
|
|
556
|
+
}
|
|
488
557
|
.cm-gutters.cm-gutters-before {
|
|
489
558
|
background: #133F63;
|
|
490
559
|
}.el-collapse-item {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ComputedRef } from '@vue/reactivity';
|
|
1
2
|
import type { DefineComponent, ComponentOptionsMixin, VNodeProps, AllowedComponentProps, ComponentCustomProps, ExtractPropTypes } from '@vue/runtime-core';
|
|
2
3
|
declare const _sfc_main: DefineComponent<{
|
|
3
4
|
icon: {
|
|
@@ -17,7 +18,7 @@ declare const _sfc_main: DefineComponent<{
|
|
|
17
18
|
default: null;
|
|
18
19
|
};
|
|
19
20
|
}, {
|
|
20
|
-
|
|
21
|
+
chineseTitle: ComputedRef<string>;
|
|
21
22
|
}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, Record<string, any>, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<ExtractPropTypes<{
|
|
22
23
|
icon: {
|
|
23
24
|
type: StringConstructor;
|
package/package.json
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
:
|
|
5
|
-
|
|
6
|
-
:title="title"
|
|
2
|
+
<el-tooltip
|
|
3
|
+
effect="dark"
|
|
4
|
+
:content="chineseTitle"
|
|
5
|
+
placement="top"
|
|
7
6
|
>
|
|
8
|
-
<
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
<button
|
|
8
|
+
class="menu-item"
|
|
9
|
+
:class="{ 'is-active': isActive && isActive() }"
|
|
10
|
+
@click="action"
|
|
11
|
+
>
|
|
12
|
+
<i :class="`ri-${icon}`" class="menu-icon"></i>
|
|
13
|
+
</button>
|
|
14
|
+
</el-tooltip>
|
|
12
15
|
</template>
|
|
13
16
|
|
|
14
17
|
<script lang="ts">
|
|
15
|
-
import { defineComponent } from 'vue'
|
|
16
|
-
import remixiconUrl from 'remixicon/fonts/remixicon.symbol.svg'
|
|
18
|
+
import { defineComponent, computed } from 'vue'
|
|
17
19
|
|
|
18
20
|
export default defineComponent({
|
|
19
21
|
name: 'MenuItem',
|
|
@@ -35,9 +37,30 @@ export default defineComponent({
|
|
|
35
37
|
default: null
|
|
36
38
|
}
|
|
37
39
|
},
|
|
38
|
-
setup() {
|
|
40
|
+
setup(props) {
|
|
41
|
+
const titleMap: Record<string, string> = {
|
|
42
|
+
'Bold': '粗体',
|
|
43
|
+
'Italic': '斜体',
|
|
44
|
+
'Strike': '删除线',
|
|
45
|
+
'Code': '行内代码',
|
|
46
|
+
'Heading 1': '标题 1',
|
|
47
|
+
'Heading 2': '标题 2',
|
|
48
|
+
'Paragraph': '段落',
|
|
49
|
+
'Bullet list': '无序列表',
|
|
50
|
+
'Ordered list': '有序列表',
|
|
51
|
+
'Code block': '代码块',
|
|
52
|
+
'Blockquote': '引用块',
|
|
53
|
+
'Horizontal rule': '水平分割线',
|
|
54
|
+
'Undo': '撤销',
|
|
55
|
+
'Redo': '重做'
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const chineseTitle = computed(() => {
|
|
59
|
+
return titleMap[props.title] || props.title
|
|
60
|
+
})
|
|
61
|
+
|
|
39
62
|
return {
|
|
40
|
-
|
|
63
|
+
chineseTitle
|
|
41
64
|
}
|
|
42
65
|
}
|
|
43
66
|
})
|
|
@@ -55,6 +78,7 @@ export default defineComponent({
|
|
|
55
78
|
border-radius: 4px;
|
|
56
79
|
cursor: pointer;
|
|
57
80
|
transition: all 0.2s ease;
|
|
81
|
+
font-style: normal;
|
|
58
82
|
}
|
|
59
83
|
|
|
60
84
|
.menu-item:hover {
|
|
@@ -67,8 +91,8 @@ export default defineComponent({
|
|
|
67
91
|
border-color: #666;
|
|
68
92
|
}
|
|
69
93
|
|
|
70
|
-
.
|
|
71
|
-
|
|
72
|
-
|
|
94
|
+
.menu-icon {
|
|
95
|
+
font-size: 16px;
|
|
96
|
+
color: #333;
|
|
73
97
|
}
|
|
74
98
|
</style>
|
|
@@ -24,6 +24,7 @@ import StarterKit from '@tiptap/starter-kit'
|
|
|
24
24
|
import Code from '@tiptap/extension-code'
|
|
25
25
|
import Blockquote from '@tiptap/extension-blockquote'
|
|
26
26
|
import HorizontalRule from '@tiptap/extension-horizontal-rule'
|
|
27
|
+
import CodeBlock from '@tiptap/extension-code-block'
|
|
27
28
|
import { getFormConfig } from "../../utils/fieldConfig";
|
|
28
29
|
import fieldProps from "../../utils/fieldProps";
|
|
29
30
|
import { useWatch } from "../../utils/customHooks";
|
|
@@ -45,9 +46,28 @@ export default defineComponent({
|
|
|
45
46
|
const editor = useEditor({
|
|
46
47
|
content: props.data[props.item.data.fieldName] || props.item.data.defaultValue || '',
|
|
47
48
|
extensions: [
|
|
48
|
-
StarterKit
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
StarterKit.configure({
|
|
50
|
+
codeBlock: {
|
|
51
|
+
HTMLAttributes: {
|
|
52
|
+
class: 'code-block',
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
}),
|
|
56
|
+
Code.configure({
|
|
57
|
+
HTMLAttributes: {
|
|
58
|
+
class: 'inline-code',
|
|
59
|
+
},
|
|
60
|
+
}),
|
|
61
|
+
CodeBlock.configure({
|
|
62
|
+
HTMLAttributes: {
|
|
63
|
+
class: 'code-block',
|
|
64
|
+
},
|
|
65
|
+
}),
|
|
66
|
+
Blockquote.configure({
|
|
67
|
+
HTMLAttributes: {
|
|
68
|
+
class: 'blockquote',
|
|
69
|
+
},
|
|
70
|
+
}),
|
|
51
71
|
HorizontalRule,
|
|
52
72
|
],
|
|
53
73
|
editable: !props.readonly,
|
|
@@ -108,6 +128,7 @@ export default defineComponent({
|
|
|
108
128
|
:deep(.ProseMirror) {
|
|
109
129
|
min-height: 180px;
|
|
110
130
|
outline: none;
|
|
131
|
+
padding: 12px;
|
|
111
132
|
}
|
|
112
133
|
|
|
113
134
|
:deep(.ProseMirror p.is-editor-empty:first-child::before) {
|
|
@@ -117,4 +138,74 @@ export default defineComponent({
|
|
|
117
138
|
height: 0;
|
|
118
139
|
pointer-events: none;
|
|
119
140
|
}
|
|
141
|
+
|
|
142
|
+
/* 行内代码样式 */
|
|
143
|
+
:deep(.ProseMirror .inline-code) {
|
|
144
|
+
background-color: #f3f4f6;
|
|
145
|
+
color: #e53e3e;
|
|
146
|
+
padding: 2px 6px;
|
|
147
|
+
border-radius: 4px;
|
|
148
|
+
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
|
|
149
|
+
font-size: 0.875em;
|
|
150
|
+
border: 1px solid #e5e7eb;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/* 代码块样式 */
|
|
154
|
+
:deep(.ProseMirror code) {
|
|
155
|
+
background-color: #1f2937;
|
|
156
|
+
color: #f9fafb;
|
|
157
|
+
padding: 16px;
|
|
158
|
+
border-radius: 8px;
|
|
159
|
+
margin: 12px 0;
|
|
160
|
+
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
|
|
161
|
+
font-size: 0.875em;
|
|
162
|
+
line-height: 1.5;
|
|
163
|
+
position: relative;
|
|
164
|
+
border: 1px solid #374151;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
/* 引用块样式 */
|
|
169
|
+
:deep(.ProseMirror blockquote) {
|
|
170
|
+
border-left: 4px solid #3b82f6;
|
|
171
|
+
background-color: #f8fafc;
|
|
172
|
+
padding: 12px 16px;
|
|
173
|
+
margin: 12px 0;
|
|
174
|
+
border-radius: 0 8px 8px 0;
|
|
175
|
+
font-style: italic;
|
|
176
|
+
color: #4b5563;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/* 水平分割线样式 */
|
|
180
|
+
:deep(.ProseMirror hr) {
|
|
181
|
+
border: none;
|
|
182
|
+
border-top: 2px solid #e5e7eb;
|
|
183
|
+
margin: 24px 0;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/* 列表样式 */
|
|
187
|
+
:deep(.ProseMirror ul),
|
|
188
|
+
:deep(.ProseMirror ol) {
|
|
189
|
+
padding-left: 24px;
|
|
190
|
+
margin: 12px 0;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
:deep(.ProseMirror li) {
|
|
194
|
+
margin: 4px 0;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/* 标题样式 */
|
|
198
|
+
:deep(.ProseMirror h1) {
|
|
199
|
+
font-size: 1.875em;
|
|
200
|
+
font-weight: bold;
|
|
201
|
+
margin: 24px 0 16px 0;
|
|
202
|
+
color: #111827;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
:deep(.ProseMirror h2) {
|
|
206
|
+
font-size: 1.5em;
|
|
207
|
+
font-weight: bold;
|
|
208
|
+
margin: 20px 0 12px 0;
|
|
209
|
+
color: #111827;
|
|
210
|
+
}
|
|
120
211
|
</style>
|