How to removeAction or removeCommand after adding any addAction or addCommand #4302
Unanswered
Rajgupta7080
asked this question in
Q&A
Replies: 1 comment
-
See solution here.
const value = /* set from `myEditor.getModel()`: */ `function hello() {
alert('Hello world!');
}
`;
// Hover on each property to see its docs!
const myEditor = monaco.editor.create(document.getElementById("container"), {
value,
language: "javascript",
automaticLayout: true,
});
const disposable = myEditor.addAction({
id: "monaco-bug",
label: "temporary action",
run: () => {
console.log(`ran ${new Date()}`);
}
})
myEditor.addAction({
id: "monaco-bug-cleanup",
label: "dispose action",
run: () => {
console.log("Disposing...");
disposable.dispose();
console.log("Disposed...");
}
}) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
`const handleCommandLogic = () => {
Beta Was this translation helpful? Give feedback.
All reactions