@bagelink/vue 0.0.356 → 0.0.358
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/components/Card.vue.d.ts +2 -2
- package/dist/components/form/inputs/RichText.vue.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/style.css +26 -22
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/BagelFormUtils.d.ts +15 -5
- package/dist/utils/BagelFormUtils.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/form/inputs/RichText.vue +169 -158
- package/src/types/index.ts +12 -11
- package/src/utils/BagelFormUtils.ts +19 -6
|
@@ -4,14 +4,14 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
4
4
|
h100?: boolean | undefined;
|
|
5
5
|
overflowX?: boolean | undefined;
|
|
6
6
|
overflowY?: boolean | undefined;
|
|
7
|
-
bg?: "info" | "light" | "warning" | "
|
|
7
|
+
bg?: "info" | "light" | "warning" | "white" | "gray" | "primary" | "transparent" | "dark" | "secondary" | "success" | "danger" | undefined;
|
|
8
8
|
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
9
9
|
thin?: boolean | undefined;
|
|
10
10
|
outline?: boolean | undefined;
|
|
11
11
|
h100?: boolean | undefined;
|
|
12
12
|
overflowX?: boolean | undefined;
|
|
13
13
|
overflowY?: boolean | undefined;
|
|
14
|
-
bg?: "info" | "light" | "warning" | "
|
|
14
|
+
bg?: "info" | "light" | "warning" | "white" | "gray" | "primary" | "transparent" | "dark" | "secondary" | "success" | "danger" | undefined;
|
|
15
15
|
}>>>, {}, {}>, {
|
|
16
16
|
default?(_: {}): any;
|
|
17
17
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RichText.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/form/inputs/RichText.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RichText.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/form/inputs/RichText.vue"],"names":[],"mappings":"AAcA;;gBAwPyD,MAAM;;;;gBAAN,MAAM;;;;AAL/D,wBAOG;AACH,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AACjE,KAAK,6BAA6B,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CAAE,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -4928,7 +4928,7 @@ function slctField(id, label, options, config) {
|
|
|
4928
4928
|
required: config == null ? void 0 : config.required,
|
|
4929
4929
|
label,
|
|
4930
4930
|
defaultValue: config == null ? void 0 : config.defaultValue,
|
|
4931
|
-
attrs: { disabled: config == null ? void 0 : config.disabled }
|
|
4931
|
+
attrs: { disabled: config == null ? void 0 : config.disabled, searchable: config == null ? void 0 : config.searchable }
|
|
4932
4932
|
};
|
|
4933
4933
|
}
|
|
4934
4934
|
function numField(id, label, options) {
|
package/dist/index.mjs
CHANGED
|
@@ -4926,7 +4926,7 @@ function slctField(id, label, options, config) {
|
|
|
4926
4926
|
required: config == null ? void 0 : config.required,
|
|
4927
4927
|
label,
|
|
4928
4928
|
defaultValue: config == null ? void 0 : config.defaultValue,
|
|
4929
|
-
attrs: { disabled: config == null ? void 0 : config.disabled }
|
|
4929
|
+
attrs: { disabled: config == null ? void 0 : config.disabled, searchable: config == null ? void 0 : config.searchable }
|
|
4930
4930
|
};
|
|
4931
4931
|
}
|
|
4932
4932
|
function numField(id, label, options) {
|
package/dist/style.css
CHANGED
|
@@ -1622,12 +1622,12 @@ img.preview[data-v-1be8d7b1] {
|
|
|
1622
1622
|
}
|
|
1623
1623
|
|
|
1624
1624
|
/* Basic editor styles */
|
|
1625
|
-
.tiptap
|
|
1626
|
-
|
|
1625
|
+
.tiptap > * + * {
|
|
1626
|
+
margin-top: 0.75em;
|
|
1627
1627
|
}
|
|
1628
1628
|
.tiptap ul,
|
|
1629
1629
|
.tiptap ol {
|
|
1630
|
-
|
|
1630
|
+
padding: 0 1rem;
|
|
1631
1631
|
}
|
|
1632
1632
|
.tiptap h1,
|
|
1633
1633
|
.tiptap h2,
|
|
@@ -1635,37 +1635,41 @@ img.preview[data-v-1be8d7b1] {
|
|
|
1635
1635
|
.tiptap h4,
|
|
1636
1636
|
.tiptap h5,
|
|
1637
1637
|
.tiptap h6 {
|
|
1638
|
-
|
|
1638
|
+
line-height: 1.1;
|
|
1639
1639
|
}
|
|
1640
1640
|
.tiptap code {
|
|
1641
|
-
|
|
1642
|
-
|
|
1641
|
+
background-color: rgba(97, 97, 97, 0.1);
|
|
1642
|
+
color: #616161;
|
|
1643
1643
|
}
|
|
1644
1644
|
.tiptap pre {
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1645
|
+
background: #0d0d0d;
|
|
1646
|
+
color: #fff;
|
|
1647
|
+
font-family: 'JetBrainsMono', monospace;
|
|
1648
|
+
padding: 0.75rem 1rem;
|
|
1649
|
+
border-radius: 0.5rem;
|
|
1650
1650
|
}
|
|
1651
1651
|
.tiptap pre code {
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1652
|
+
color: inherit;
|
|
1653
|
+
padding: 0;
|
|
1654
|
+
background: none;
|
|
1655
|
+
font-size: 0.8rem;
|
|
1656
1656
|
}
|
|
1657
1657
|
.tiptap img {
|
|
1658
|
-
|
|
1659
|
-
|
|
1658
|
+
max-width: 100%;
|
|
1659
|
+
height: auto;
|
|
1660
1660
|
}
|
|
1661
1661
|
.tiptap blockquote {
|
|
1662
|
-
|
|
1663
|
-
|
|
1662
|
+
padding-left: 1rem;
|
|
1663
|
+
border-left: 2px solid rgba(13, 13, 13, 0.1);
|
|
1664
1664
|
}
|
|
1665
1665
|
.tiptap hr {
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1666
|
+
border: none;
|
|
1667
|
+
border-top: 2px solid rgba(13, 13, 13, 0.1);
|
|
1668
|
+
margin: 2rem 0;
|
|
1669
|
+
}
|
|
1670
|
+
.tiptap {
|
|
1671
|
+
min-height: 500px;
|
|
1672
|
+
background: var(--input-bg);
|
|
1669
1673
|
}
|
|
1670
1674
|
|
|
1671
1675
|
.chart-line {
|
package/dist/types/index.d.ts
CHANGED
|
@@ -11,5 +11,5 @@ export type Tab = {
|
|
|
11
11
|
id: string;
|
|
12
12
|
icon?: MaterialIcons;
|
|
13
13
|
} | string;
|
|
14
|
-
export type ThemeType = 'light' | 'red' | 'gray' | 'gray-light' | 'black' | 'green' | 'primary' | 'blue';
|
|
14
|
+
export type ThemeType = 'light' | 'white' | 'red' | 'gray' | 'gray-light' | 'black' | 'green' | 'primary' | 'blue';
|
|
15
15
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACX,uBAAuB,EAAE,QAAQ,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,YAAY,GACtF,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,YAAY,EAAE,aAAa,EAAE,CAAC;AAC9B,YAAY,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAChE,YAAY,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAC1C,YAAY,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAE5B,MAAM,MAAM,GAAG,GAAG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACX,uBAAuB,EAAE,QAAQ,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,YAAY,GACtF,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,YAAY,EAAE,aAAa,EAAE,CAAC;AAC9B,YAAY,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAChE,YAAY,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAC1C,YAAY,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAE5B,MAAM,MAAM,GAAG,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,CAAC,EAAE,aAAa,CAAC;CACrB,GAAG,MAAM,CAAA;AAEV,MAAM,MAAM,SAAS,GACpB,OAAO,GACL,OAAO,GACP,KAAK,GACL,MAAM,GACN,YAAY,GACZ,OAAO,GACP,OAAO,GACP,SAAS,GACT,MAAM,CAAA"}
|
|
@@ -3,18 +3,28 @@ export type Option = string | number | Record<string, any> | {
|
|
|
3
3
|
label: string;
|
|
4
4
|
value: string | number;
|
|
5
5
|
};
|
|
6
|
-
|
|
6
|
+
interface InputOptions {
|
|
7
7
|
required?: boolean;
|
|
8
|
-
type?: 'text' | 'tel' | 'email';
|
|
9
8
|
placeholder?: string;
|
|
10
9
|
class?: string;
|
|
11
10
|
defaultValue?: string;
|
|
12
11
|
disabled?: boolean;
|
|
12
|
+
}
|
|
13
|
+
interface TextInputOptions extends InputOptions {
|
|
14
|
+
type?: 'text' | 'tel' | 'email';
|
|
13
15
|
pattern?: string;
|
|
14
|
-
}
|
|
16
|
+
}
|
|
17
|
+
interface SlctInputOptions extends InputOptions {
|
|
18
|
+
searchable?: boolean;
|
|
19
|
+
}
|
|
20
|
+
interface NumFieldOptions extends InputOptions {
|
|
21
|
+
max?: number;
|
|
22
|
+
min?: number;
|
|
23
|
+
step?: number;
|
|
24
|
+
}
|
|
15
25
|
export declare function txtField(id: string, label?: string, options?: TextInputOptions): Field;
|
|
16
|
-
export declare function slctField(id: string, label?: string, options?: Option[] | (() => Option[]), config?:
|
|
17
|
-
export declare function numField(id: string, label?: string, options?:
|
|
26
|
+
export declare function slctField(id: string, label?: string, options?: Option[] | (() => Option[]), config?: SlctInputOptions): Field;
|
|
27
|
+
export declare function numField(id: string, label?: string, options?: NumFieldOptions): Field;
|
|
18
28
|
export declare function frmRow(...children: Field[]): {
|
|
19
29
|
$el: string;
|
|
20
30
|
class: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BagelFormUtils.d.ts","sourceRoot":"","sources":["../../src/utils/BagelFormUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAE3C,MAAM,MAAM,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CAAC;AAEvG,KAAK,
|
|
1
|
+
{"version":3,"file":"BagelFormUtils.d.ts","sourceRoot":"","sources":["../../src/utils/BagelFormUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAE3C,MAAM,MAAM,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CAAC;AAEvG,UAAU,YAAY;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,UAAU,gBAAiB,SAAQ,YAAY;IAC9C,IAAI,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,OAAO,CAAC;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,UAAU,gBAAiB,SAAQ,YAAY;IAC9C,UAAU,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,UAAU,eAAgB,SAAQ,YAAY;IAC7C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,KAAK,CAUtF;AAED,wBAAgB,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,MAAM,EAAE,CAAC,EAAE,MAAM,CAAC,EAAE,gBAAgB,GAAG,KAAK,CAY7H;AAED,wBAAgB,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,KAAK,CAUrF;AAED,wBAAgB,MAAM,CAAC,GAAG,QAAQ,EAAE,KAAK,EAAE;;;;EAM1C"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
<div v-if="editor">
|
|
3
|
+
<Btn
|
|
4
|
+
:flat="!editor.isActive(item.name, item.option)"
|
|
5
|
+
@click="item.command"
|
|
6
|
+
thin
|
|
7
|
+
v-for="item in config"
|
|
8
|
+
v-tooltip="item.name"
|
|
9
|
+
:key="item.name"
|
|
10
|
+
:icon="item.icon"
|
|
11
|
+
:disabled="item.disabled?.()" />
|
|
12
|
+
</div>
|
|
13
|
+
<editor-content :editor="editor" />
|
|
7
14
|
</template>
|
|
8
15
|
|
|
9
16
|
<script setup lang="ts">
|
|
@@ -18,144 +25,143 @@ let editor = $ref<Editor>();
|
|
|
18
25
|
const props = defineProps<{ modelValue: string }>();
|
|
19
26
|
|
|
20
27
|
const focus = () => {
|
|
21
|
-
|
|
22
|
-
|
|
28
|
+
if (!editor) throw new Error('editor is not defined');
|
|
29
|
+
return editor.chain().focus();
|
|
23
30
|
};
|
|
24
31
|
|
|
25
|
-
const config: {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
},
|
|
32
|
+
const config: {
|
|
33
|
+
name: string;
|
|
34
|
+
command: any;
|
|
35
|
+
icon: MaterialIcons;
|
|
36
|
+
option?: Record<string, any>;
|
|
37
|
+
disabled?: () => boolean;
|
|
38
|
+
}[] = [
|
|
39
|
+
{
|
|
40
|
+
name: 'bold',
|
|
41
|
+
command: () => focus()?.toggleBold().run(),
|
|
42
|
+
icon: 'format_bold',
|
|
43
|
+
disabled: () => !editor?.can().chain().focus().toggleBold().run(),
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: 'italic',
|
|
47
|
+
command: () => focus().toggleItalic().run(),
|
|
48
|
+
icon: 'format_italic',
|
|
49
|
+
disabled: () => !editor?.can().chain().focus().toggleItalic().run(),
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: 'strike',
|
|
53
|
+
command: () => focus().toggleStrike().run(),
|
|
54
|
+
icon: 'format_strikethrough',
|
|
55
|
+
disabled: () => !editor?.can().chain().focus().toggleStrike().run(),
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: 'code',
|
|
59
|
+
command: () => focus().toggleCode().run(),
|
|
60
|
+
icon: 'code',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: 'clearMarks',
|
|
64
|
+
command: () => focus().unsetAllMarks(),
|
|
65
|
+
icon: 'clear',
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: 'clearNodes',
|
|
69
|
+
command: () => focus().clearNodes().run(),
|
|
70
|
+
icon: 'clear',
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
name: 'paragraph',
|
|
74
|
+
command: () => focus().setParagraph().run(),
|
|
75
|
+
icon: 'format_paragraph',
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
name: 'heading',
|
|
79
|
+
command: () => focus().toggleHeading({ level: 1 }).run(),
|
|
80
|
+
icon: 'format_h1',
|
|
81
|
+
option: { level: 1 },
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
name: 'heading',
|
|
85
|
+
command: () => focus().toggleHeading({ level: 2 }).run(),
|
|
86
|
+
icon: 'format_h2',
|
|
87
|
+
option: { level: 2 },
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
name: 'heading',
|
|
91
|
+
command: () => focus().toggleHeading({ level: 3 }).run(),
|
|
92
|
+
icon: 'format_h3',
|
|
93
|
+
option: { level: 3 },
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: 'heading',
|
|
97
|
+
command: () => focus().toggleHeading({ level: 4 }).run(),
|
|
98
|
+
icon: 'format_h4',
|
|
99
|
+
option: { level: 4 },
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
name: 'heading',
|
|
103
|
+
command: () => focus().toggleHeading({ level: 5 }).run(),
|
|
104
|
+
icon: 'format_h5',
|
|
105
|
+
option: { level: 5 },
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
name: 'heading',
|
|
109
|
+
command: () => focus().toggleHeading({ level: 6 }).run(),
|
|
110
|
+
icon: 'format_h6',
|
|
111
|
+
option: { level: 6 },
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
name: 'bulletList',
|
|
115
|
+
command: () => focus().toggleBulletList().run(),
|
|
116
|
+
icon: 'format_list_bulleted',
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
name: 'orderedList',
|
|
120
|
+
command: () => focus().toggleOrderedList().run(),
|
|
121
|
+
icon: 'format_list_numbered',
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
name: 'codeBlock',
|
|
125
|
+
command: () => focus().toggleCodeBlock().run(),
|
|
126
|
+
icon: 'code',
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
name: 'blockquote',
|
|
130
|
+
command: () => focus().toggleBlockquote().run(),
|
|
131
|
+
icon: 'format_quote',
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
name: 'horizontalRule',
|
|
135
|
+
command: () => focus().setHorizontalRule().run(),
|
|
136
|
+
icon: 'horizontal_rule',
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
name: 'hardBreak',
|
|
140
|
+
command: () => focus().setHardBreak().run(),
|
|
141
|
+
icon: 'keyboard_return',
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
name: 'undo',
|
|
145
|
+
command: () => focus().undo().run(),
|
|
146
|
+
icon: 'undo',
|
|
147
|
+
disabled: () => !editor?.can().chain().focus().undo().run(),
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
name: 'redo',
|
|
151
|
+
command: () => focus().redo().run(),
|
|
152
|
+
icon: 'redo',
|
|
153
|
+
disabled: () => !editor?.can().chain().focus().redo().run(),
|
|
154
|
+
},
|
|
149
155
|
];
|
|
150
156
|
|
|
151
157
|
const emit = defineEmits(['update:modelValue']);
|
|
152
158
|
|
|
153
159
|
onMounted(() => {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
160
|
+
editor = new Editor({
|
|
161
|
+
extensions: [StarterKit],
|
|
162
|
+
content: props.modelValue,
|
|
163
|
+
onUpdate: ({ editor }) => emit('update:modelValue', editor.getHTML()),
|
|
164
|
+
});
|
|
159
165
|
});
|
|
160
166
|
|
|
161
167
|
onBeforeUnmount(() => editor?.destroy());
|
|
@@ -163,13 +169,13 @@ onBeforeUnmount(() => editor?.destroy());
|
|
|
163
169
|
|
|
164
170
|
<style>
|
|
165
171
|
/* Basic editor styles */
|
|
166
|
-
.tiptap
|
|
167
|
-
|
|
172
|
+
.tiptap > * + * {
|
|
173
|
+
margin-top: 0.75em;
|
|
168
174
|
}
|
|
169
175
|
|
|
170
176
|
.tiptap ul,
|
|
171
177
|
.tiptap ol {
|
|
172
|
-
|
|
178
|
+
padding: 0 1rem;
|
|
173
179
|
}
|
|
174
180
|
|
|
175
181
|
.tiptap h1,
|
|
@@ -178,42 +184,47 @@ onBeforeUnmount(() => editor?.destroy());
|
|
|
178
184
|
.tiptap h4,
|
|
179
185
|
.tiptap h5,
|
|
180
186
|
.tiptap h6 {
|
|
181
|
-
|
|
187
|
+
line-height: 1.1;
|
|
182
188
|
}
|
|
183
189
|
|
|
184
190
|
.tiptap code {
|
|
185
|
-
|
|
186
|
-
|
|
191
|
+
background-color: rgba(97, 97, 97, 0.1);
|
|
192
|
+
color: #616161;
|
|
187
193
|
}
|
|
188
194
|
|
|
189
195
|
.tiptap pre {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
196
|
+
background: #0d0d0d;
|
|
197
|
+
color: #fff;
|
|
198
|
+
font-family: 'JetBrainsMono', monospace;
|
|
199
|
+
padding: 0.75rem 1rem;
|
|
200
|
+
border-radius: 0.5rem;
|
|
195
201
|
}
|
|
196
202
|
|
|
197
203
|
.tiptap pre code {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
204
|
+
color: inherit;
|
|
205
|
+
padding: 0;
|
|
206
|
+
background: none;
|
|
207
|
+
font-size: 0.8rem;
|
|
202
208
|
}
|
|
203
209
|
|
|
204
210
|
.tiptap img {
|
|
205
|
-
|
|
206
|
-
|
|
211
|
+
max-width: 100%;
|
|
212
|
+
height: auto;
|
|
207
213
|
}
|
|
208
214
|
|
|
209
215
|
.tiptap blockquote {
|
|
210
|
-
|
|
211
|
-
|
|
216
|
+
padding-left: 1rem;
|
|
217
|
+
border-left: 2px solid rgba(13, 13, 13, 0.1);
|
|
212
218
|
}
|
|
213
219
|
|
|
214
220
|
.tiptap hr {
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
221
|
+
border: none;
|
|
222
|
+
border-top: 2px solid rgba(13, 13, 13, 0.1);
|
|
223
|
+
margin: 2rem 0;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.tiptap {
|
|
227
|
+
min-height: 500px;
|
|
228
|
+
background: var(--input-bg);
|
|
218
229
|
}
|
|
219
230
|
</style>
|
package/src/types/index.ts
CHANGED
|
@@ -13,17 +13,18 @@ export * from './BtnOptions';
|
|
|
13
13
|
export * from './BagelForm';
|
|
14
14
|
|
|
15
15
|
export type Tab = {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
label: string;
|
|
17
|
+
id: string;
|
|
18
|
+
icon?: MaterialIcons;
|
|
19
19
|
} | string
|
|
20
20
|
|
|
21
21
|
export type ThemeType = |
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
22
|
+
'light'
|
|
23
|
+
| 'white'
|
|
24
|
+
| 'red'
|
|
25
|
+
| 'gray'
|
|
26
|
+
| 'gray-light'
|
|
27
|
+
| 'black'
|
|
28
|
+
| 'green'
|
|
29
|
+
| 'primary'
|
|
30
|
+
| 'blue' // ! blue does nothing
|
|
@@ -2,16 +2,29 @@ import type { Field } from '@bagelink/vue';
|
|
|
2
2
|
|
|
3
3
|
export type Option = string | number | Record<string, any> | { label: string, value: string | number };
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
interface InputOptions {
|
|
6
6
|
required?: boolean;
|
|
7
|
-
type?: 'text' | 'tel' | 'email';
|
|
8
7
|
placeholder?: string;
|
|
9
|
-
class?: string
|
|
8
|
+
class?: string;
|
|
10
9
|
defaultValue?: string;
|
|
11
10
|
disabled?: boolean;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface TextInputOptions extends InputOptions {
|
|
14
|
+
type?: 'text' | 'tel' | 'email';
|
|
12
15
|
pattern?: string;
|
|
13
16
|
}
|
|
14
17
|
|
|
18
|
+
interface SlctInputOptions extends InputOptions {
|
|
19
|
+
searchable?: boolean;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface NumFieldOptions extends InputOptions {
|
|
23
|
+
max?: number;
|
|
24
|
+
min?: number;
|
|
25
|
+
step?: number;
|
|
26
|
+
}
|
|
27
|
+
|
|
15
28
|
export function txtField(id: string, label?: string, options?: TextInputOptions): Field {
|
|
16
29
|
return {
|
|
17
30
|
$el: 'text',
|
|
@@ -24,7 +37,7 @@ export function txtField(id: string, label?: string, options?: TextInputOptions)
|
|
|
24
37
|
};
|
|
25
38
|
}
|
|
26
39
|
|
|
27
|
-
export function slctField(id: string, label?: string, options?: Option[] | (() => Option[]), config?:
|
|
40
|
+
export function slctField(id: string, label?: string, options?: Option[] | (() => Option[]), config?: SlctInputOptions): Field {
|
|
28
41
|
return {
|
|
29
42
|
$el: 'select',
|
|
30
43
|
id,
|
|
@@ -34,11 +47,11 @@ export function slctField(id: string, label?: string, options?: Option[] | (() =
|
|
|
34
47
|
required: config?.required,
|
|
35
48
|
label,
|
|
36
49
|
defaultValue: config?.defaultValue,
|
|
37
|
-
attrs: { disabled: config?.disabled },
|
|
50
|
+
attrs: { disabled: config?.disabled, searchable: config?.searchable },
|
|
38
51
|
};
|
|
39
52
|
}
|
|
40
53
|
|
|
41
|
-
export function numField(id: string, label?: string, options?:
|
|
54
|
+
export function numField(id: string, label?: string, options?: NumFieldOptions): Field {
|
|
42
55
|
return {
|
|
43
56
|
$el: 'text',
|
|
44
57
|
class: options?.class,
|