
Ctrl + F open search at editorCtrl + Z undo inputOS and Theia version:
Diagnostics:
Something wrong with registered keybindings, i.e. there should be undo handler for the search widget registered from Monaco which takes priority over default handler by when closure.
The same problem applies to all other input fields: Search view (search text), Git view (commit message) etc.
I just encountered that as well, I can't use undo/redo in any input text or textarea I used.
The fix for me was to add this:
const isTextElementFocused = () => {
const activeElement = document.activeElement;
return (activeElement instanceof HTMLInputElement && activeElement.type === "text") ||
activeElement instanceof HTMLTextAreaElement;
};
commands.registerHandler(CommonCommands.UNDO.id, {
execute: () => {
document.execCommand("undo", true);
},
isEnabled: isTextElementFocused
});
commands.registerHandler(CommonCommands.REDO.id, {
execute: () => {
document.execCommand("redo", true);
},
isEnabled: isTextElementFocused
});
Although the documentation says document.execCommand might not work for every browser. Works well so far (tested on chrome and safari).
@spoenemann @502647092 @Hanksha Could you reproduce it against https://github.com/eclipse-theia/theia/pull/7481? fyi I cannot
Please help with testing 馃檹 You can test with Gitpod: https://gitpod.io#https://github.com/eclipse-theia/theia/pull/7481
Yes it seems the issue is fixed in that revision!
Looks like it's fixed, I'll try within my project as well once it's merged.
Most helpful comment
@spoenemann @502647092 @Hanksha Could you reproduce it against https://github.com/eclipse-theia/theia/pull/7481? fyi I cannot
Please help with testing 馃檹 You can test with Gitpod: https://gitpod.io#https://github.com/eclipse-theia/theia/pull/7481