mirror of
https://github.com/DustinBrett/daedalOS.git
synced 2025-12-06 00:20:05 +01:00
This commit is contained in:
parent
2738f37acb
commit
2640b53fce
|
|
@ -51,7 +51,7 @@ const Browser: FC<ComponentProcessProps> = ({ id }) => {
|
|||
processes: { [id]: process },
|
||||
open,
|
||||
} = useProcesses();
|
||||
const { setForegroundId } = useSession();
|
||||
const { setForegroundId, updateRecentFiles } = useSession();
|
||||
const { prependFileToTitle } = useTitle(id);
|
||||
const { initialTitle = "", url = "" } = process || {};
|
||||
const initialUrl = url || HOME_PAGE;
|
||||
|
|
@ -263,8 +263,13 @@ const Browser: FC<ComponentProcessProps> = ({ id }) => {
|
|||
fs,
|
||||
decodeURI(pathname),
|
||||
getExtension(pathname),
|
||||
({ pid, url: infoUrl }) =>
|
||||
open(pid || "OpenWith", { url: infoUrl })
|
||||
({ pid, url: infoUrl }) => {
|
||||
open(pid || "OpenWith", { url: infoUrl });
|
||||
|
||||
if (pid && infoUrl) {
|
||||
updateRecentFiles(infoUrl, pid);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
});
|
||||
|
|
@ -356,6 +361,7 @@ const Browser: FC<ComponentProcessProps> = ({ id }) => {
|
|||
readdir,
|
||||
setIcon,
|
||||
stat,
|
||||
updateRecentFiles,
|
||||
]
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import Icon from "styles/common/Icon";
|
|||
import { DISBALE_AUTO_INPUT_FEATURES, ROOT_NAME } from "utils/constants";
|
||||
import { getExtension, label } from "utils/functions";
|
||||
import { getProcessByFileExtension } from "components/system/Files/FileEntry/functions";
|
||||
import { useSession } from "contexts/session";
|
||||
|
||||
type AddressBarProps = {
|
||||
id: string;
|
||||
|
|
@ -40,6 +41,7 @@ const AddressBar = forwardRef<HTMLInputElement, AddressBarProps>(
|
|||
const displayName = basename(url) || ROOT_NAME;
|
||||
const [addressBar, setAddressBar] = useState(displayName);
|
||||
const { exists, stat, updateFolder } = useFileSystem();
|
||||
const { updateRecentFiles } = useSession();
|
||||
|
||||
useEffect(() => {
|
||||
if (addressBarRef.current) {
|
||||
|
|
@ -67,11 +69,15 @@ const AddressBar = forwardRef<HTMLInputElement, AddressBarProps>(
|
|||
if (value && (await exists(value))) {
|
||||
if ((await stat(value)).isDirectory()) changeUrl(id, value);
|
||||
else {
|
||||
open(
|
||||
getProcessByFileExtension(getExtension(value)) ||
|
||||
"OpenWith",
|
||||
{ url: value }
|
||||
const openPid = getProcessByFileExtension(
|
||||
getExtension(value)
|
||||
);
|
||||
|
||||
open(openPid || "OpenWith", { url: value });
|
||||
|
||||
if (openPid && value) {
|
||||
updateRecentFiles(value, openPid);
|
||||
}
|
||||
}
|
||||
}
|
||||
addressBarRef.current.blur();
|
||||
|
|
|
|||
|
|
@ -1089,6 +1089,7 @@ const useCommandInterpreter = (
|
|||
case "wsl":
|
||||
case "linux":
|
||||
open("V86", { url: LINUX_IMAGE_PATH });
|
||||
updateRecentFiles(LINUX_IMAGE_PATH, "V86");
|
||||
break;
|
||||
case "xlsx": {
|
||||
const [file, format = "xlsx"] = commandArgs;
|
||||
|
|
|
|||
|
|
@ -568,9 +568,7 @@ const useFolderContextMenu = (
|
|||
}
|
||||
|
||||
open("MonacoEditor", { url: INDEX_FILE });
|
||||
if (INDEX_FILE) {
|
||||
updateRecentFiles(INDEX_FILE, "MonacoEditor");
|
||||
}
|
||||
},
|
||||
label: "View page source",
|
||||
},
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import { isCorsUrl } from "components/apps/TinyMCE/functions";
|
|||
import { getProcessByFileExtension } from "components/system/Files/FileEntry/functions";
|
||||
import { useProcesses } from "contexts/process";
|
||||
import { haltEvent, isYouTubeUrl, getExtension } from "utils/functions";
|
||||
import { useSession } from "contexts/session";
|
||||
|
||||
type LinkHandler = (
|
||||
event: Event,
|
||||
|
|
@ -14,6 +15,7 @@ type LinkHandler = (
|
|||
|
||||
export const useLinkHandler = (): LinkHandler => {
|
||||
const { open } = useProcesses();
|
||||
const { updateRecentFiles } = useSession();
|
||||
|
||||
return useCallback(
|
||||
(event: Event, url: string, pathName: string, title?: string) => {
|
||||
|
|
@ -37,11 +39,17 @@ export const useLinkHandler = (): LinkHandler => {
|
|||
getExtension(pathName)
|
||||
);
|
||||
|
||||
if (defaultProcess) open(defaultProcess, { url: decodeURI(pathName) });
|
||||
if (defaultProcess) {
|
||||
const pathUrl = decodeURI(pathName);
|
||||
|
||||
open(defaultProcess, { url: pathUrl });
|
||||
|
||||
if (pathUrl) updateRecentFiles(pathUrl, defaultProcess);
|
||||
}
|
||||
} else {
|
||||
window.open(url, "_blank", "noopener, noreferrer");
|
||||
}
|
||||
},
|
||||
[open]
|
||||
[open, updateRecentFiles]
|
||||
);
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user