Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/renderer/components/FileTree/FileTree.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ function FileTreeNode({
<div className="context-menu-separator" />
<div className="context-menu-item danger" onClick={handleDeleteMenuClick}>
<span>Delete</span>
<span style={{ color: "var(--text-muted)" }}>Del</span>
<span style={{ color: "var(--text-muted)" }}>{isWindows ? "Del" : "⌘⌫"}</span>
</div>
</div>,
document.body,
Expand Down
10 changes: 8 additions & 2 deletions src/renderer/components/Settings/SettingsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
} from "../../services/appwrite";
import { cacheCredentials } from "../../services/localStore";
import { Team } from "../../../shared/types";
import { formatKey } from "../../utils/shortcut";
import { formatKey, isMac } from "../../utils/shortcut";
import "./SettingsModal.css";

interface SettingsModalProps {
Expand Down Expand Up @@ -222,13 +222,19 @@ export default function SettingsModal({
{ action: "Toggle Explorer", keys: [formatKey("Ctrl"), "B"] },
{ action: "Toggle Preview Panel", keys: [formatKey("Ctrl"), "Shift", "V"] },
{ action: "Toggle Preview Tab", keys: [formatKey("Ctrl"), "Shift", "B"] },
{ action: "Rename File / Folder", keys: ["F2"] },
{ action: "Delete File / Folder", keys: isMac ? ["⌘", "⌫"] : ["Del"] },
{ action: "Undo Delete", keys: [formatKey("Ctrl"), "Z"] },
];

const filteredShortcuts = shortcuts.filter(
(s) =>
matchesSearch(s.action) ||
s.keys.some((k) => matchesSearch(k)) ||
matchesSearch("Keyboard Shortcuts"),
matchesSearch("Keyboard Shortcuts") ||
matchesSearch("rename") ||
matchesSearch("delete") ||
matchesSearch("undo"),
);

const showKeyboardShortcuts = !isSearching
Expand Down
11 changes: 8 additions & 3 deletions src/renderer/context/CollaborationContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1005,9 +1005,14 @@ export function CollaborationProvider({

const ytext = ydocRef.current.getText(docName);
if (ytext.toString() !== content) {
// Clear and replace the content
ytext.delete(0, ytext.length);
ytext.insert(0, content);
// Use a single transaction so MonacoBinding sees one atomic update
// instead of a delete followed by an insert (which would flash empty).
ydocRef.current.transact(() => {
ytext.delete(0, ytext.length);
if (content.length > 0) {
ytext.insert(0, content);
}
});
}
},
[],
Expand Down
7 changes: 7 additions & 0 deletions src/renderer/pages/IDE.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,13 @@ function IDEContent() {
try {
const wsRoot = workspaceRootRef.current;
if (collabActiveRef.current && wsRoot) {
// Clear Y.Text for the deleted file(s) so that stale content is
// never returned by getFileContent if the user later undoes the
// delete. Without this, setFileContent in handleFileCreated would
// see non-empty Y.Text and skip writing the restored savedContent.
if (type === "file") {
setFileContentRef.current(deletedPath, "", wsRoot);
}
const relativePath = toRelativePath(deletedPath, wsRoot);
broadcastFileOpRef.current({
type: "delete",
Expand Down
12 changes: 6 additions & 6 deletions src/renderer/utils/shortcut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ export function formatKey(key: string): string {
switch (key.toLowerCase()) {
case 'ctrl':
case 'control':
return 'Cmd';
return '';
case 'alt':
return 'Option';
case 'windows':
case 'win':
return 'Cmd';
return '';
default:
return key;
}
Expand All @@ -23,9 +23,9 @@ export function formatShortcut(shortcutString: string): string {
// Replace common Windows modifier keys with their Mac equivalents.
// E.g. "Ctrl+B" -> "Cmd+B", "Ctrl+Alt+Enter" -> "Cmd+Option+Enter"
return shortcutString
.replace(/\bCtrl\b/gi, 'Cmd')
.replace(/\bControl\b/gi, 'Cmd')
.replace(/\bCtrl\b/gi, '')
.replace(/\bControl\b/gi, '')
.replace(/\bAlt\b/gi, 'Option')
.replace(/\bWin\b/gi, 'Cmd')
.replace(/\bWindows\b/gi, 'Cmd');
.replace(/\bWin\b/gi, '')
.replace(/\bWindows\b/gi, '');
}
Loading