select workspace dir for saving subtree

This commit is contained in:
codetypes committed 2025-05-08 11:58:16 +08:00
1 parent dda5a1d19b
commit 4c6796a399
3 files changed
+7 -5

No files matched your search

+1 -1
View File
@@ -976,7 +976,7 @@ export class Graph {
} }
const ret = await dialog.showSaveDialog({ const ret = await dialog.showSaveDialog({
defaultPath: workspace.workdir, defaultPath: workspace.workdir.replaceAll("/", Path.sep),
properties: ["showOverwriteConfirmation"], properties: ["showOverwriteConfirmation"],
filters: [{ name: "Json", extensions: ["json"] }], filters: [{ name: "Json", extensions: ["json"] }],
}); });
+2
View File
@@ -14,6 +14,7 @@ import { useWorkspace } from "../contexts/workspace-context";
import * as b3util from "../misc/b3util"; import * as b3util from "../misc/b3util";
import i18n from "../misc/i18n"; import i18n from "../misc/i18n";
import { Hotkey, isMacos } from "../misc/keys"; import { Hotkey, isMacos } from "../misc/keys";
import Path from "../misc/path";
const MenuItemLabel: FC<FlexProps> = (itemProps) => { const MenuItemLabel: FC<FlexProps> = (itemProps) => {
return ( return (
@@ -107,6 +108,7 @@ export const Menu: FC<LayoutProps> = () => {
click: () => { click: () => {
console.log("newFile"); console.log("newFile");
const path = dialog.showSaveDialogSync({ const path = dialog.showSaveDialogSync({
defaultPath: workspace.workdir.replaceAll("/", Path.sep),
properties: ["showOverwriteConfirmation"], properties: ["showOverwriteConfirmation"],
filters: [{ name: "Json", extensions: ["json"] }], filters: [{ name: "Json", extensions: ["json"] }],
}); });
+4 -4
View File
@@ -189,8 +189,8 @@ b3util.setSizeCalculator((data: NodeData) => {
height += 20; height += 20;
} }
updateHeight(data.args); updateHeight(data.args);
updateHeight(data.input); data.input?.find((v) => !!v) && updateHeight(data.input);
updateHeight(data.output); data.output?.find((v) => !!v) && updateHeight(data.output);
return [width, height]; return [width, height];
}); });
@@ -513,7 +513,7 @@ class TreeNode extends Rect {
} }
private drawInputText(attributes: Required<RectStyleProps>, container: Group) { private drawInputText(attributes: Required<RectStyleProps>, container: Group) {
const input = this._data.input ?? []; const input = this._data.input?.find((v) => !!v) ? this._data.input : [];
const { str, line } = const { str, line } =
input.length > 0 input.length > 0
? toBreakWord(`${i18n.t("regnode.input")}${JSON.stringify(input)}`, 200) ? toBreakWord(`${i18n.t("regnode.input")}${JSON.stringify(input)}`, 200)
@@ -552,7 +552,7 @@ class TreeNode extends Rect {
} }
private drawOutputText(attributes: Required<RectStyleProps>, container: Group) { private drawOutputText(attributes: Required<RectStyleProps>, container: Group) {
const output = this._data.output ?? []; const output = this._data.output?.find((v) => !!v) ? this._data.output : [];
const { str, line } = const { str, line } =
output.length > 0 output.length > 0
? toBreakWord(`${i18n.t("regnode.output")}${JSON.stringify(output)}`, 200) ? toBreakWord(`${i18n.t("regnode.output")}${JSON.stringify(output)}`, 200)