File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,15 @@ function activate(context) {
4545 } )
4646 } )
4747
48+ vscode . window . onDidChangeTextEditorSelection ( e => {
49+ if ( e . selections [ 0 ] && ! e . selections [ 0 ] . isEmpty ) {
50+ vscode . commands . executeCommand ( 'editor.action.clipboardCopyAction' )
51+ vscode . commands . executeCommand ( '_workbench.htmlPreview.postMessage' , indexUri , {
52+ type : 'update'
53+ } )
54+ }
55+ } )
56+
4857 vscode . commands . registerCommand ( 'polacode._onmessage' , ( { type, data } ) => {
4958 if ( type === 'updateBgColor' ) {
5059 context . globalState . update ( 'polacode.bgColor' , data . bgColor )
Original file line number Diff line number Diff line change @@ -56,7 +56,6 @@ function getSnippetBgColor(html) {
5656 return html . match ( / b a c k g r o u n d - c o l o r : ( # [ a - f A - F 0 - 9 ] + ) / ) [ 1 ]
5757}
5858
59-
6059function updateEnvironment ( snippetBgColor ) {
6160 // update snippet bg color
6261 document . getElementById ( 'snippet' ) . style . backgroundColor = snippetBgColor
@@ -171,6 +170,8 @@ window.addEventListener('message', e => {
171170 }
172171
173172 snippetContainerNode . style . opacity = 1
173+ } else if ( e . data . type === 'update' ) {
174+ document . execCommand ( 'paste' )
174175 }
175176 }
176177} )
You can’t perform that action at this time.
0 commit comments