File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change 4
4
<Editor v-on:change =" handleChange" v-bind:initialCode =" state.code" ></Editor >
5
5
<Toolbar >
6
6
<Menu triggerLabel =" Menu" >
7
+ <MenuItem label =" Copy as Markdown" @click =" handleCopyAsMD"
8
+ modifier =" ⌘ + ⇧ + c"
9
+ />
7
10
<MenuItem label =" Copy as HTML" @click =" handleCopyAsHTML" />
8
11
<MenuItem label =" Save File" modifier =" ⌘ + s" @click =" handleSaveFile" />
9
12
<MenuItem
@@ -106,6 +109,11 @@ onUnmounted(() => {
106
109
});
107
110
108
111
function shortcutListener (e ) {
112
+ if (e .key === " c" && (e .ctrlKey || e .metaKey ) && e .shiftKey ) {
113
+ e .preventDefault ();
114
+ return handleCopyAsMD ();
115
+ }
116
+
109
117
if (e .key === " s" && (e .ctrlKey || e .metaKey ) && e .shiftKey ) {
110
118
e .preventDefault ();
111
119
return handleSaveAsHTML ();
@@ -122,6 +130,17 @@ function handleChange(code) {
122
130
localStorage .setItem (STORAGE_TOKEN , code);
123
131
}
124
132
133
+ async function handleCopyAsMD (){
134
+ if (! state .code ) {
135
+ return ;
136
+ }
137
+ await copy (state .code )
138
+ state .copied = true
139
+ setTimeout (() => {
140
+ state .copied = false ;
141
+ }, 2500 );
142
+ }
143
+
125
144
async function handleCopyAsHTML () {
126
145
if (! state .code ) {
127
146
return ;
You can’t perform that action at this time.
0 commit comments