Skip to content

Commit

Permalink
Little changes
Browse files Browse the repository at this point in the history
  • Loading branch information
notangelmario committed Nov 5, 2023
1 parent 59b7fce commit e804295
Show file tree
Hide file tree
Showing 5 changed files with 119 additions and 12 deletions.
112 changes: 105 additions & 7 deletions src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ tauri-build = { version = "1.5.0", features = [] }
[dependencies]
serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }
tauri = { version = "1.5.2", features = [ "window-all", "fs-all", "dialog-all"] }
tauri = { version = "1.5.2", features = [ "shell-all", "window-all", "fs-all", "dialog-all"] }

[features]
# this feature is used for production builds or when `devPath` points to the filesystem and the built-in dev server is disabled.
Expand Down
3 changes: 3 additions & 0 deletions src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
},
"window": {
"all": true
},
"shell": {
"all": true
}
},
"bundle": {
Expand Down
5 changes: 3 additions & 2 deletions src/lib/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { initVimMode } from "monaco-vim";
import { onClose, onOpen, onSave, onCreate, startAutosave, initDropFileListener } from "./file";
import { Store } from "./store";
import { addMarkdownActions } from "./languages/markdown";
import { open } from "@tauri-apps/api/shell";
import { addVimActions } from "./vim";
import { createNotice } from "./status";

Expand Down Expand Up @@ -32,7 +33,7 @@ export function initEditor(editorWrapper: HTMLElement, store: Store) {
minimap: {
autohide: true,
},
fontFamily: "Fira Code",
fontFamily: "'Fira Code', sans-serif",
fontLigatures: true,
padding: {
top: 32,
Expand Down Expand Up @@ -159,7 +160,7 @@ function addActions(editor: monaco.editor.IStandaloneCodeEditor, store: Store) {
id: "marker.open_repo",
label: "Show Marker on GitHub",
run: () => {
window.open("https://github.com/notangelmario/marker", "_blank", "noopener noreferrer")
open("https://github.com/notangelmario/marker")
},
contextMenuGroupId: "9_marker"
});
Expand Down
9 changes: 7 additions & 2 deletions src/lib/languages/markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { createNotice } from "../status";
import monaco from "../monaco";
import { writeTextFile } from "@tauri-apps/api/fs";
import { save as saveFile } from "@tauri-apps/api/dialog";
import { WebviewWindow } from "@tauri-apps/api/window";
import { appWindow, WebviewWindow } from "@tauri-apps/api/window";

export function addMarkdownActions(editor: monaco.editor.IStandaloneCodeEditor) {
editor.addAction({
Expand Down Expand Up @@ -48,9 +48,14 @@ export function startPreviewWatcher(editor: monaco.editor.IStandaloneCodeEditor,
const dispose = editor.getModel()?.onDidChangeContent(() => {
previewWindow.emit("load-content", editor.getValue());
})

appWindow.onCloseRequested(() => {
stopPreviewWatcher(previewWindow);
dispose?.dispose();
})

previewWindow.onCloseRequested(() => {
stopPreviewWatcher(previewWindow),
stopPreviewWatcher(previewWindow);
dispose?.dispose();
})
}
Expand Down

0 comments on commit e804295

Please sign in to comment.