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 44 <Editor v-on:change =" handleChange" v-bind:initialCode =" state.code" ></Editor >
55 <Toolbar >
66 <Menu triggerLabel =" Menu" >
7+ <MenuItem label =" Copy as Markdown" @click =" handleCopyAsMD"
8+ modifier =" ⌘ + ⇧ + c"
9+ />
710 <MenuItem label =" Copy as HTML" @click =" handleCopyAsHTML" />
811 <MenuItem label =" Save File" modifier =" ⌘ + s" @click =" handleSaveFile" />
912 <MenuItem
@@ -106,6 +109,11 @@ onUnmounted(() => {
106109});
107110
108111function shortcutListener (e ) {
112+ if (e .key === " c" && (e .ctrlKey || e .metaKey ) && e .shiftKey ) {
113+ e .preventDefault ();
114+ return handleCopyAsMD ();
115+ }
116+
109117 if (e .key === " s" && (e .ctrlKey || e .metaKey ) && e .shiftKey ) {
110118 e .preventDefault ();
111119 return handleSaveAsHTML ();
@@ -122,6 +130,17 @@ function handleChange(code) {
122130 localStorage .setItem (STORAGE_TOKEN , code);
123131}
124132
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+
125144async function handleCopyAsHTML () {
126145 if (! state .code ) {
127146 return ;
You can’t perform that action at this time.
0 commit comments