Skip to content

Commit

Permalink
Merge pull request #154 from coding-blocks/disable-copyPaste
Browse files Browse the repository at this point in the history
disable copy/paste from find and replace
  • Loading branch information
vdvibhu20 authored Jan 24, 2024
2 parents e095a99 + 3550b91 commit dbdaefc
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions app/pods/components/code-window/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,18 @@ export default class CodeWindowComponent extends Component {
event.preventDefault();
}
});

//stop user to perform copy/paste and right click in find and replace
const editorDoc = editor._domElement;
const findWidgetParent = editorDoc.querySelector('.monaco-editor .overflow-guard .overlayWidgets');

findWidgetParent.addEventListener('contextmenu', event => event.preventDefault());
findWidgetParent.addEventListener('keydown',(event)=>{
const { keyCode, ctrlKey, metaKey } = event;
if ((keyCode === 33 || 52) && (metaKey || ctrlKey)) {
event.preventDefault();
}
});
}
// this.set('editor', editor)
this.trigger("restoreCodeFromStorage")
Expand Down

0 comments on commit dbdaefc

Please sign in to comment.