auto-git:
[change] src-tauri/gen/schemas/acl-manifests.json [change] src-tauri/gen/schemas/capabilities.json [change] src-tauri/gen/schemas/desktop-schema.json [change] src-tauri/gen/schemas/macOS-schema.json [change] src/App.tsx
This commit is contained in:
14
src/App.tsx
14
src/App.tsx
@@ -1,5 +1,6 @@
|
||||
import React, { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
||||
import { open, save } from "@tauri-apps/plugin-dialog";
|
||||
import { open as openExternal } from "@tauri-apps/plugin-shell";
|
||||
import { readTextFile, writeTextFile } from "@tauri-apps/plugin-fs";
|
||||
import { getCurrentWindow } from "@tauri-apps/api/window";
|
||||
import { appDataDir } from "@tauri-apps/api/path";
|
||||
@@ -142,6 +143,19 @@ export default function App() {
|
||||
const hasText = body.trim().length > 0;
|
||||
const showLineNumbersActive = showLineNumbers && !markdownPreview;
|
||||
|
||||
const handleMarkdownLinkClick = useCallback(
|
||||
(event: React.MouseEvent<HTMLDivElement>) => {
|
||||
const target = event.target as HTMLElement | null;
|
||||
const link = target?.closest?.("a");
|
||||
if (!link) return;
|
||||
const href = link.getAttribute("href");
|
||||
if (!href || href.startsWith("#") || href.startsWith("/")) return;
|
||||
event.preventDefault();
|
||||
openExternal(href);
|
||||
},
|
||||
[]
|
||||
);
|
||||
|
||||
const statusKey = useMemo(() => {
|
||||
if (isViewingHistory) return "history";
|
||||
if (isDirty) return "unsaved";
|
||||
|
||||
Reference in New Issue
Block a user