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
9 changes: 8 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,21 @@
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"cSpell.words": [
"commonmark",
"contenteditable",
"execall",
"frontmatter",
"Häusler",
"hfelix",
"Jocs",
"katex",
"laynezh",
"marktext",
"muya",
"Setext",
"snabbdom",
"Tkaixiang"
"snapsvg",
"Tkaixiang",
"webfontloader"
]
}
2 changes: 1 addition & 1 deletion packages/desktop/src/common/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import path from 'path'

export type Translations = Record<string, unknown>

const SUPPORTED_LANGUAGES = ['en', 'zh-CN', 'zh-TW', 'es', 'fr', 'de', 'ja', 'ko', 'pt'] as const
const SUPPORTED_LANGUAGES = ['en', 'zh-CN', 'zh-TW', 'es', 'fr', 'de', 'ja', 'ko', 'pt', 'tr'] as const

export type SupportedLanguage = (typeof SUPPORTED_LANGUAGES)[number]

Expand Down
6 changes: 6 additions & 0 deletions packages/desktop/src/main/preferences/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,12 @@
"enum": ["hand", "simple"],
"default": "hand"
},
"plantumlServer": {
"description": "Markdown--PlantUML server URL for rendering diagrams",
"type": "string",
"pattern": "^(https?://|$)",
"default": "https://www.plantuml.com/plantuml"
},
"theme": {
"description": "Theme--Select the theme used in MarkText",
"type": "string",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ import {
ja,
ko,
pt,
tr,
zhCN,
zhTW,
type ILocale
Expand Down Expand Up @@ -157,6 +158,7 @@ const MUYA_LOCALES: Record<string, ILocale> = {
ja,
ko,
pt,
tr,
'zh-CN': zhCN,
'zh-TW': zhTW
}
Expand Down Expand Up @@ -584,6 +586,12 @@ watch(sequenceTheme, (value, oldValue) => {
}
})

watch(() => preferencesStore.plantumlServer, (value, oldValue) => {
if (value !== oldValue && editor.value) {
editor.value.setOptions({ plantumlServer: value }, true)
}
})

watch(listIndentation, (value, oldValue) => {
if (value !== oldValue && editor.value) {
editor.value.setListIndentation(value)
Expand Down Expand Up @@ -1450,6 +1458,13 @@ const handleFileChange = (payload: unknown) => {
if (savedEngineHistory) {
editor.value.setHistory(savedEngineHistory)
}
// First activation of a tab the save-tracking allocator has never seen:
// seed its clean baseline from the engine's serialization now, before
// any edit. For a tab that already has a tracker this is a no-op —
// switching back must keep the existing content -> id map.
if (id) {
getSyntheticHistory(id, editor.value.getMarkdown())
}
}
} else if (newCursor) {
editor.value.setCursor(newCursor)
Expand Down Expand Up @@ -1578,6 +1593,7 @@ onMounted(() => {
hideLinkPopup: hideLinkPopup.value,
autoCheck: autoCheck.value,
sequenceTheme: sequenceTheme.value,
plantumlServer: preferencesStore.plantumlServer,
spellcheckEnabled: spellcheckerEnabled.value,
// Resolve the OS clipboard to a local file path on paste (image-from-file).
clipboardFilePath: guessClipboardFilePath,
Expand Down Expand Up @@ -1613,6 +1629,15 @@ onMounted(() => {
muya.init()
editor.value = muya

// Seed the save-tracking baseline for the mount-loaded document (from the
// engine's OWN serialization, same reason as setMarkdownToEditor). Without
// this the allocator is created lazily on the first `json-change` — i.e.
// after the first edit — so the pristine content never maps to id 0 and
// undoing back to the on-disk content can never read as clean again (PG15).
if (currentFile.value?.id) {
getSyntheticHistory(currentFile.value.id, muya.getMarkdown())
}

const container = getScrollContainer()!

// Listen for language changes and update the engine locale.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@
</div>
<cur-select
:description="t('exportSettings.theme.theme')"
more="https://github.com/marktext/marktext/blob/develop/docs/EXPORT_THEMES.md"
more="https://marktext.me/docs/export-themes"
:value="theme"
:options="themeList"
:on-change="(value: unknown) => onSelectChange('theme', value)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,5 +131,9 @@ export const getLanguageOptions = (): PrefSelectOption<string>[] => [
{
label: t('preferences.general.misc.language.portuguese'),
value: 'pt'
},
{
label: t('preferences.general.misc.language.turkish'),
value: 'tr'
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<template #head>
<bool
:description="t('preferences.image.folderSetting.preferRelative')"
more="https://github.com/marktext/marktext/blob/develop/docs/end-user/IMAGES.md"
more="https://marktext.me/docs/images"
:bool="imagePreferRelativeDirectory"
:on-change="(value) => onSelectChange('imagePreferRelativeDirectory', value)"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
class="link"
:title="t('preferences.keybindings.online')"
:aria-label="t('preferences.keybindings.online')"
@click="openKeybindingWiki"
@click="openKeybindingDocs"
><LinkIcon
:size="14"
class="link-icon"
Expand Down Expand Up @@ -167,9 +167,9 @@ onUnmounted(() => {
keybindingConfigurator.value = null
})

const openKeybindingWiki = (): void => {
const openKeybindingDocs = (): void => {
window.electron.shell.openExternal(
'https://github.com/marktext/marktext/blob/develop/docs/end-user/KEYBINDINGS.md'
'https://marktext.me/docs/key-bindings'
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@
:on-change="(value) => onSelectChange('sequenceTheme', value)"
more="https://bramp.github.io/js-sequence-diagrams/"
/>
<text-box
:description="t('preferences.markdown.diagrams.plantumlServer.title')"
:input="plantumlServer"
:on-change="(value) => onSelectChange('plantumlServer', value)"
:default-value="'https://www.plantuml.com/plantuml'"
/>
</template>
</compound>

Expand Down Expand Up @@ -129,6 +135,7 @@ import { usePreferencesStore } from '@/store/preferences'
import type { PreferencesState } from '@/store/preferences'
import Bool from '../common/bool/index.vue'
import CurSelect from '../common/select/index.vue'
import TextBox from '../common/textBox/index.vue'
import {
bulletListMarkerOptions,
orderListDelimiterOptions,
Expand All @@ -154,7 +161,8 @@ const {
footnote,
isHtmlEnabled,
isGitlabCompatibilityEnabled,
sequenceTheme
sequenceTheme,
plantumlServer
} = storeToRefs(preferenceStore)

const onSelectChange = (type: keyof PreferencesState, value: unknown): void => {
Expand Down
2 changes: 2 additions & 0 deletions packages/desktop/src/renderer/src/store/preferences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export interface PreferencesState {
isHtmlEnabled: boolean
isGitlabCompatibilityEnabled: boolean
sequenceTheme: SequenceTheme | string
plantumlServer: string

// ----- Theme -----
theme: string
Expand Down Expand Up @@ -195,6 +196,7 @@ export const usePreferencesStore = defineStore('preferences', {
isHtmlEnabled: true,
isGitlabCompatibilityEnabled: false,
sequenceTheme: 'hand',
plantumlServer: 'https://www.plantuml.com/plantuml',

theme: 'light',
followSystemTheme: true,
Expand Down
1 change: 1 addition & 0 deletions packages/desktop/src/types/muya-core.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ declare module '@muyajs/core' {
export const ja: ILocale
export const ko: ILocale
export const pt: ILocale
export const tr: ILocale
export const zhCN: ILocale
export const zhTW: ILocale

Expand Down
7 changes: 6 additions & 1 deletion packages/desktop/static/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,7 @@
"isHtmlEnabled": "HTML-Rendering aktivieren",
"isGitlabCompatibilityEnabled": "GitLab-Kompatibilitätsmodus aktivieren",
"sequenceTheme": "Sequenzdiagramm-Theme",
"plantumlServer": "PlantUML-Server-URL",
"theme": "Das in MarkText verwendete Theme auswählen",
"followSystemTheme": "Systemdesign folgen",
"lightModeTheme": "Design, das verwendet werden soll, wenn sich das System im hellen Modus befindet",
Expand Down Expand Up @@ -551,7 +552,8 @@
"german": "Deutsch",
"japanese": "日本語",
"korean": "한국어",
"portuguese": "Português"
"portuguese": "Português",
"turkish": "Türkçe"
}
}
},
Expand Down Expand Up @@ -770,6 +772,9 @@
"title": "Sequenz-Design",
"handDrawn": "Handgezeichnet",
"simple": "Einfach"
},
"plantumlServer": {
"title": "PlantUML-Server-URL"
}
},
"math": {
Expand Down
7 changes: 6 additions & 1 deletion packages/desktop/static/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,7 @@
"isHtmlEnabled": "Enable HTML rendering",
"isGitlabCompatibilityEnabled": "Enable GitLab compatibility mode",
"sequenceTheme": "Sequence diagram theme",
"plantumlServer": "PlantUML server URL",
"theme": "Select the theme used in MarkText",
"followSystemTheme": "Follow System Theme",
"lightModeTheme": "Theme to use when system is in light mode",
Expand Down Expand Up @@ -550,7 +551,8 @@
"german": "Deutsch",
"japanese": "日本語",
"korean": "한국어",
"portuguese": "Português"
"portuguese": "Português",
"turkish": "Türkçe"
}
}
},
Expand Down Expand Up @@ -769,6 +771,9 @@
"title": "Sequence Theme",
"handDrawn": "Hand Drawn",
"simple": "Simple"
},
"plantumlServer": {
"title": "PlantUML Server URL"
}
},
"math": {
Expand Down
7 changes: 6 additions & 1 deletion packages/desktop/static/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,7 @@
"isHtmlEnabled": "Habilitar renderizado HTML",
"isGitlabCompatibilityEnabled": "Habilitar modo de compatibilidad GitLab",
"sequenceTheme": "Tema del diagrama de secuencia",
"plantumlServer": "URL del servidor PlantUML",
"theme": "Seleccionar el tema usado en MarkText",
"followSystemTheme": "Seguir tema del sistema",
"lightModeTheme": "Tema a usar cuando el sistema está en modo claro",
Expand Down Expand Up @@ -551,7 +552,8 @@
"german": "Deutsch",
"japanese": "日本語",
"korean": "한국어",
"portuguese": "Português"
"portuguese": "Português",
"turkish": "Türkçe"
}
}
},
Expand Down Expand Up @@ -770,6 +772,9 @@
"title": "Tema de Secuencia",
"handDrawn": "Dibujado a Mano",
"simple": "Simple"
},
"plantumlServer": {
"title": "URL del servidor PlantUML"
}
},
"math": {
Expand Down
7 changes: 6 additions & 1 deletion packages/desktop/static/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,7 @@
"isHtmlEnabled": "Activer le rendu HTML",
"isGitlabCompatibilityEnabled": "Activer le mode de compatibilité GitLab",
"sequenceTheme": "Thème du diagramme de séquence",
"plantumlServer": "URL du serveur PlantUML",
"theme": "Sélectionner le thème utilisé dans MarkText",
"followSystemTheme": "Suivre le thème du système",
"lightModeTheme": "Thème à utiliser lorsque le système est en mode clair",
Expand Down Expand Up @@ -552,7 +553,8 @@
"german": "Deutsch",
"japanese": "日本語",
"korean": "한국어",
"portuguese": "Português"
"portuguese": "Português",
"turkish": "Türkçe"
}
}
},
Expand Down Expand Up @@ -772,6 +774,9 @@
"title": "Thème de séquence",
"handDrawn": "Dessiné à la main",
"simple": "Simple"
},
"plantumlServer": {
"title": "URL du serveur PlantUML"
}
},
"math": {
Expand Down
7 changes: 6 additions & 1 deletion packages/desktop/static/locales/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,7 @@
"isHtmlEnabled": "HTMLレンダリングを有効にする",
"isGitlabCompatibilityEnabled": "GitLab互換モードを有効にする",
"sequenceTheme": "シーケンス図のテーマ",
"plantumlServer": "PlantUMLサーバーのURL",
"theme": "MarkTextで使用するテーマを選択",
"followSystemTheme": "システムのテーマに従う",
"lightModeTheme": "システムがライトモードの時に使用するテーマ",
Expand Down Expand Up @@ -552,7 +553,8 @@
"german": "Deutsch",
"japanese": "日本語",
"korean": "한국어",
"portuguese": "Português"
"portuguese": "Português",
"turkish": "Türkçe"
}
}
},
Expand Down Expand Up @@ -772,6 +774,9 @@
"title": "シーケンステーマ",
"handDrawn": "手描き",
"simple": "シンプル"
},
"plantumlServer": {
"title": "PlantUMLサーバーのURL"
}
},
"math": {
Expand Down
7 changes: 6 additions & 1 deletion packages/desktop/static/locales/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,7 @@
"isHtmlEnabled": "HTML 렌더링 활성화",
"isGitlabCompatibilityEnabled": "GitLab 호환 모드 활성화",
"sequenceTheme": "시퀀스 다이어그램 테마",
"plantumlServer": "PlantUML 서버 URL",
"theme": "MarkText에서 사용할 테마 선택",
"followSystemTheme": "시스템 테마 따르기",
"lightModeTheme": "시스템이 라이트 모드일 때 사용할 테마",
Expand Down Expand Up @@ -552,7 +553,8 @@
"german": "Deutsch",
"japanese": "日本語",
"korean": "한국어",
"portuguese": "Português"
"portuguese": "Português",
"turkish": "Türkçe"
}
}
},
Expand Down Expand Up @@ -772,6 +774,9 @@
"title": "시퀀스 테마",
"handDrawn": "손으로 그린",
"simple": "간단"
},
"plantumlServer": {
"title": "PlantUML 서버 URL"
}
},
"math": {
Expand Down
Loading
Loading