File tree Expand file tree Collapse file tree 3 files changed +31
-1
lines changed Expand file tree Collapse file tree 3 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,21 @@ const formatItems = [
40
40
kbd: [ctrlSign , ` E ` ],
41
41
emitArgs: [` addFormat ` , ` ${ctrlKey }-E ` ],
42
42
},
43
+ {
44
+ label: ` 标题 ` ,
45
+ kbd: [ctrlSign , ` H ` ],
46
+ emitArgs: [` addFormat ` , ` ${ctrlKey }-H ` ],
47
+ },
48
+ {
49
+ label: ` 无序列表 ` ,
50
+ kbd: [ctrlSign , ` U ` ],
51
+ emitArgs: [` addFormat ` , ` ${ctrlKey }-U ` ],
52
+ },
53
+ {
54
+ label: ` 有序列表 ` ,
55
+ kbd: [ctrlSign , ` O ` ],
56
+ emitArgs: [` addFormat ` , ` ${ctrlKey }-O ` ],
57
+ },
43
58
{
44
59
label: ` 格式化 ` ,
45
60
kbd: [altSign , shiftSign , ` F ` ],
Original file line number Diff line number Diff line change @@ -562,7 +562,7 @@ async function sendMessage() {
562
562
<!-- ============ 输入框 ============ -->
563
563
<div v-if =" !configVisible" class =" relative mt-2" >
564
564
<div
565
- class =" item-start bg-background border-border flex flex-col items-baseline gap-2 border rounded-xl px-3 py-2 pr-12 shadow-inner"
565
+ class =" bg-background item-start border-border flex flex-col items-baseline gap-2 border rounded-xl px-3 py-2 pr-12 shadow-inner"
566
566
>
567
567
<Textarea
568
568
v-model =" input"
Original file line number Diff line number Diff line change @@ -242,6 +242,21 @@ function initEditor() {
242
242
const selected = editor .getSelection ()
243
243
editor .replaceSelection (` \` ${selected }\` ` )
244
244
},
245
+ [` ${ctrlKey }-H ` ]: function heading(editor ) {
246
+ const selected = editor .getSelection ()
247
+ editor .replaceSelection (` # ${selected } ` )
248
+ },
249
+ [` ${ctrlKey }-U ` ]: function unorderedList(editor ) {
250
+ const selected = editor .getSelection ()
251
+ const lines = selected .split (` \n ` ).map (line => ` - ${line } ` )
252
+ editor .replaceSelection (lines .join (` \n ` ))
253
+ },
254
+
255
+ [` ${ctrlKey }-O ` ]: function orderedList(editor ) {
256
+ const selected = editor .getSelection ()
257
+ const lines = selected .split (` \n ` ).map ((line , i ) => ` ${i + 1 }. ${line } ` )
258
+ editor .replaceSelection (lines .join (` \n ` ))
259
+ },
245
260
// 预备弃用
246
261
[` ${ctrlKey }-L ` ]: function code(editor ) {
247
262
const selected = editor .getSelection ()
You can’t perform that action at this time.
0 commit comments