Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

feat(web): editor 26.10.26 with Markdown mode, checklist chip and plain tags in source mode (#6498)

Johnny0bfa31e89ec5
diff --git a/web/package.json b/web/package.json
index b367b699e..f1d75087e 100644
--- a/web/package.json
+++ b/web/package.json
@@ -26,7 +26,7 @@
"@tailwindcss/vite": "^4.2.4",
"@tanstack/react-query": "^5.100.9",
"@tanstack/react-query-devtools": "^5.100.9",
- "@usememos/editor": "26.10.25",
+ "@usememos/editor": "26.10.26",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"copy-to-clipboard": "^4.0.2",
diff --git a/web/pnpm-lock.yaml b/web/pnpm-lock.yaml
index dff8a8160..ca41597a2 100644
--- a/web/pnpm-lock.yaml
+++ b/web/pnpm-lock.yaml
@@ -39,8 +39,8 @@ importers:
specifier: ^5.100.9
'@usememos/editor':
- specifier: 26.10.25
+ specifier: 26.10.26
class-variance-authority:
specifier: ^0.7.1
version: 0.7.1
@@ -1009,8 +1009,8 @@ packages:
resolution: {integrity: sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==}
deprecated: Potential CWE-502 - Update to 1.3.1 or higher
- '@usememos/[email protected]':
- resolution: {integrity: sha512-3lxCH9WcwiB+2G7q0woodTXhfTiFY7iIex3S7TxHwNxwWB/Ub0RDFIXm5eWE+ODynT50zAG4Lb3tK5lZPSEvQg==}
+ '@usememos/[email protected]':
+ resolution: {integrity: sha512-0fij2QWZhW7t7sTrDidBCJgFY7gduEfI0KVKi9fyudtkVZRdhP4piRPpOtWtGZbi0vmBYp8kZmqRhx/2+c0MvQ==}
peerDependencies:
react: '>=18'
react-dom: '>=18'
@@ -2695,7 +2695,7 @@ snapshots:
'@ungap/[email protected]': {}
optionalDependencies:
react: 19.2.6
react-dom: 19.2.6([email protected])
diff --git a/web/src/components/MemoEditor/README.md b/web/src/components/MemoEditor/README.md
index 8caac4985..337e8aa8e 100644
--- a/web/src/components/MemoEditor/README.md
+++ b/web/src/components/MemoEditor/README.md
@@ -23,7 +23,7 @@ MemoEditor memo level: name | draft seed, mode, data, draft stor
└── Editor MemoMarkdown editable, with the composer's extensions, behind EditorController
```
-- **`MemoMarkdown.tsx`** binds the editor to memos once: the memo Markdown dialect, the theme in the app's CSS variables, translated labels, the image and link URL policy, the memo syntax extensions (math, footnotes, tags, mentions, highlighted code, Mermaid diagrams drawn by Pele, sanitized HTML) and the stylesheet. `useMemoDecorations` is the one flow for tag colors and resolved mentions, with one redecorate effect. Everything a surface adds sits around this component; nothing in memos styles the editor's own classes.
+- **`MemoMarkdown.tsx`** binds the editor to memos once: the memo Markdown dialect, the theme in the app's CSS variables, translated labels, the image and link URL policy, the memo syntax extensions (math, footnotes, tags, mentions, highlighted code, Mermaid diagrams drawn by Pele, sanitized HTML) and the stylesheet. `useMemoDecorations` is the one flow for tag colors and resolved mentions, with one redecorate effect. Everything a surface adds sits around this component; nothing in memos styles the editor's own classes. The tag and mention classes memos hands the editor apply in source mode too, so the parts that draw a pill take the `rich:` variant (index.css), which is everything outside the editor's `.mbe-source-mode` root; source mode shows a tag as text in its color.
- **`view/`** is the read-only surface over `MemoMarkdown`: tags and mentions navigate, in-memo anchors scroll, a paragraph that is one bare link becomes a preview card through the editor's block view (`linkCards.ts`), the page's search matches are painted, and heading ids match the outline. Tag and mention clicks arrive through the editor's `onClick` callbacks, so nothing in memos matches the editor's class names or mutates its DOM. Previews that have Markdown but no memo query (the link-memo search, the share image) use `MemoContentView` directly.
- **`edit/`** is the editing surface: `EditSession` renders the chrome (timestamp, attachments, suggestions, toolbar, focus mode, audio recording) over the draft store `MemoEditor` provides, persists the draft while open, and saves through the memo mutations. `Editor.tsx` is the composer's editor: `MemoMarkdown` editable with the composer's own extensions (`#tag` and `:emoji` autocomplete, file paste and drop), behind the `EditorController` contract in `controller.ts`.
@@ -47,7 +47,7 @@ A reducer (`edit/state/reducer.ts`) drives an external store; consumers subscrib
### Formatting and source mode
-Formatting is the editor's own: its toolbar appears over selected text, the slash menu and Markdown shortcuts change block types, and its keys cover the rest. The editor's `mode` option shows the whole memo as Markdown text and edits it as plain text; `useSourceMode` remembers the choice per device. In source mode the toolbar, slash menu, autocomplete and formatting keys are off, the checklist chip is hidden, and the controller reads tags and checklists from the text parsed as a memo.
+Formatting is the editor's own: its toolbar appears over selected text, the slash menu and Markdown shortcuts change block types, and its keys cover the rest. The editor's `mode` option shows the whole memo as Markdown text, with its syntax highlighted, and edits it as text; `useSourceMode` remembers the choice per device. To people it is "Markdown mode", the + menu's item with the pilcrow (the word processors' "show formatting marks" glyph), checked while on; in code it keeps the editor's name, source mode. Nothing in the editor names the mode: the text shows it, as it does in Obsidian and GitLab, and the memo's chrome stays the memo's. Switching changes no text and emits no change. In source mode the toolbar, slash menu, block handle and link card do not show; the `#tag` and `:emoji` popups open as in rich mode, the formatting keys edit the Markdown, and the checklist chip toggles the task marker on the caret's line through the same `toggleTaskList` command. The controller reads tags and checklists from the text parsed as a memo. The source text is in the body font (the editor's `sourceFont` token is left at its default) so a switch keeps the text's rhythm; nothing in memos targets the editor's source classes.
### Saving
diff --git a/web/src/components/MemoEditor/edit/EditSession.tsx b/web/src/components/MemoEditor/edit/EditSession.tsx
index 223fb0deb..3d433ce4b 100644
--- a/web/src/components/MemoEditor/edit/EditSession.tsx
+++ b/web/src/components/MemoEditor/edit/EditSession.tsx
@@ -310,9 +310,6 @@ export const EditSession: React.FC<EditSessionProps> = ({
onToggleFocusMode: handleToggleFocusMode,
};
- // The checklist chip formats a block, which source mode cannot do.
- const visibleSuggestions = isSourceMode ? suggestions.filter((suggestion) => suggestion.kind !== "checklist") : suggestions;
-
const handleSave = useMemoSave({
memoName,
parentMemoName,
@@ -397,8 +394,8 @@ export const EditSession: React.FC<EditSessionProps> = ({
transcribingAttachment={transcribingAttachment}
transcriptionDisabled={isSaving || audioRecorder.isBusy || isTranscribingAudio}
/>
- {!memo && !parentMemoName && isInitialized && visibleSuggestions.length > 0 && (
- <EditorSuggestions suggestions={visibleSuggestions} controllerRef={editorRef} space={editorSpace} />
+ {!memo && !parentMemoName && isInitialized && suggestions.length > 0 && (
+ <EditorSuggestions suggestions={suggestions} controllerRef={editorRef} space={editorSpace} />
)}
<EditorToolbar
onSave={handleSave}
diff --git a/web/src/components/MemoEditor/edit/Editor.tsx b/web/src/components/MemoEditor/edit/Editor.tsx
index 2ae10b854..bd5cf52cf 100644
--- a/web/src/components/MemoEditor/edit/Editor.tsx
+++ b/web/src/components/MemoEditor/edit/Editor.tsx
@@ -1,5 +1,5 @@
import type { EditorMode, Editor as MarkdownEditorInstance } from "@usememos/editor";
-import { forwardRef, useImperativeHandle, useMemo, useRef } from "react";
+import { forwardRef, useImperativeHandle, useLayoutEffect, useMemo, useRef } from "react";
import { useTagCounts } from "@/hooks/useUserQueries";
import { cn } from "@/lib/utils";
import type { Attachment } from "@/types/proto/api/attachment_service_pb";
@@ -40,10 +40,14 @@ const Editor = forwardRef(function Editor(props: EditorProps, ref: React.Forward
const { className, value, placeholder, onContentChange, onFiles, onSubmit, isFocusMode, mode, attachments } = props;
const t = useTranslate();
const editorRef = useRef<MarkdownEditorInstance | null>(null);
+ // The extensions read the latest callbacks through refs, written after commit so
+ // a render React discards never leaves its callbacks behind.
const onContentChangeRef = useRef(onContentChange);
- onContentChangeRef.current = onContentChange;
const onFilesRef = useRef(onFiles);
- onFilesRef.current = onFiles;
+ useLayoutEffect(() => {
+ onContentChangeRef.current = onContentChange;
+ onFilesRef.current = onFiles;
+ });
// A user can only author their own memos. Reuse the current-user stats query
// instead of fetching and aggregating every user's tags for autocomplete.
const { data: tagData } = useTagCounts(true);
diff --git a/web/src/components/MemoEditor/edit/Toolbar/InsertMenu.tsx b/web/src/components/MemoEditor/edit/Toolbar/InsertMenu.tsx
index b8788a9d4..feb61f950 100644
--- a/web/src/components/MemoEditor/edit/Toolbar/InsertMenu.tsx
+++ b/web/src/components/MemoEditor/edit/Toolbar/InsertMenu.tsx
@@ -1,5 +1,5 @@
import { uniqBy } from "lodash-es";
-import { FileCodeIcon, ImageIcon, LinkIcon, LoaderIcon, MapPinIcon, Maximize2Icon, MicIcon, PaperclipIcon, PlusIcon } from "lucide-react";
+import { ImageIcon, LinkIcon, LoaderIcon, MapPinIcon, Maximize2Icon, MicIcon, PaperclipIcon, PilcrowIcon, PlusIcon } from "lucide-react";
import { useCallback, useEffect, useRef, useState } from "react";
import { LinkMemoDialog, LocationDialog } from "@/components/MemoMetadata";
import type { MapPoint } from "@/components/map/types";
@@ -158,8 +158,11 @@ const InsertMenu = (props: InsertMenuProps) => {
{item.label}
</DropdownMenuItem>
))}
- {/* View toggles. Focus mode is absent when a host owns the editor's presentation;
- source mode only changes how the text is edited, so every composer has it. */}
+ {/* How the composer presents itself. Focus mode is absent when a host owns the
+ editor's presentation; Markdown mode (the editor's source mode) only changes how
+ the text is edited, so every composer has it. Checked while on: the text shows
+ the mode, and nothing in the editor names it. The pilcrow is the "show formatting
+ marks" glyph of word processors: this mode shows the markup. */}
<DropdownMenuSeparator />
{viewToggles && (
<DropdownMenuItem onClick={viewToggles.onToggleFocusMode}>
@@ -168,8 +171,8 @@ const InsertMenu = (props: InsertMenuProps) => {
</DropdownMenuItem>
)}
<DropdownMenuCheckboxItem checked={sourceMode.isSourceMode} onCheckedChange={sourceMode.onToggle} closeOnClick indicator="end">
- <FileCodeIcon />
- {t("editor.source-mode")}
+ <PilcrowIcon />
+ {t("editor.markdown-mode")}
</DropdownMenuCheckboxItem>
</DropdownMenuContent>
</DropdownMenu>
diff --git a/web/src/components/MemoEditor/edit/components/EditorContent.tsx b/web/src/components/MemoEditor/edit/components/EditorContent.tsx
index 68d1e62a0..7f5b98f73 100644
--- a/web/src/components/MemoEditor/edit/components/EditorContent.tsx
+++ b/web/src/components/MemoEditor/edit/components/EditorContent.tsx
@@ -1,6 +1,4 @@
-import { forwardRef, useLayoutEffect, useRef } from "react";
-import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
-import { useTranslate } from "@/utils/i18n";
+import { forwardRef } from "react";
import Editor from "../Editor";
import { useEditorContext, useEditorSelector } from "../state";
import type { EditorContentProps } from "../types";
@@ -15,16 +13,7 @@ import type { EditorController } from "../types/editorController";
* editor writes into state.content on every change.
*/
export const EditorContent = forwardRef<EditorController, EditorContentProps>(({ placeholder, sourceMode, onSubmit, onFiles }, ref) => {
- const t = useTranslate();
- const wrapperRef = useRef<HTMLDivElement>(null);
- const sourceTagRef = useRef<HTMLButtonElement>(null);
const isSourceMode = sourceMode.isSourceMode;
- const sourceLabel = t("editor.source");
- // The first line of the text leaves room for the tag; its width varies by language.
- useLayoutEffect(() => {
- const width = isSourceMode ? sourceTagRef.current?.offsetWidth : undefined;
- wrapperRef.current?.style.setProperty("--memo-source-tag-width", width ? `${width}px` : "0px");
- }, [isSourceMode, sourceLabel]);
const { actions, dispatch } = useEditorContext();
const content = useEditorSelector((s) => s.content);
const isFocusMode = useEditorSelector((s) => s.ui.isFocusMode);
@@ -35,7 +24,7 @@ export const EditorContent = forwardRef<EditorController, EditorContentProps>(({
};
return (
- <div ref={wrapperRef} className="relative w-full flex flex-col flex-1">
+ <div className="relative w-full flex flex-col flex-1">
<Editor
ref={ref}
className="memo-editor-content"
@@ -48,25 +37,6 @@ export const EditorContent = forwardRef<EditorController, EditorContentProps>(({
onFiles={onFiles}
onSubmit={onSubmit}
/>
- {/* Source mode names itself in the corner, as a code block names its language, and switches back from there.
- It fills on hover like the toolbar's quiet buttons, so it reads as a button once pointed at. */}
- {isSourceMode && (
- <Tooltip>
- <TooltipTrigger
- render={
- <button
- ref={sourceTagRef}
- type="button"
- onClick={sourceMode.onToggle}
- className="absolute end-0 top-0.5 flex h-5 cursor-pointer items-center rounded px-1 text-2xs text-muted-foreground outline-none transition-colors hover:bg-muted/60 hover:text-foreground focus-visible:bg-muted/60 focus-visible:text-foreground"
- />
- }
- >
- {sourceLabel}
- </TooltipTrigger>
- <TooltipContent side="top">{t("editor.switch-to-rich-text")}</TooltipContent>
- </Tooltip>
- )}
</div>
);
});
diff --git a/web/src/components/MemoEditor/edit/editor.css b/web/src/components/MemoEditor/edit/editor.css
index e4ef3735c..a5089cb30 100644
--- a/web/src/components/MemoEditor/edit/editor.css
+++ b/web/src/components/MemoEditor/edit/editor.css
@@ -28,14 +28,6 @@
& .memo-editor-root ::selection {
background: var(--accent);
}
- /* Source mode: the first line leaves room for the tag EditorContent puts in the corner. */
- &[data-source-mode] .memo-editor-root::before {
- content: "";
- float: inline-end;
- /* The tag's width plus a gap, so the first line never runs into it. */
- width: calc(var(--memo-source-tag-width, 0px) + 0.5rem);
- height: 1lh;
- }
}
.memo-upload-anchor {
diff --git a/web/src/components/MemoEditor/edit/types/components.ts b/web/src/components/MemoEditor/edit/types/components.ts
index c6d87ecc5..b61547bfa 100644
--- a/web/src/components/MemoEditor/edit/types/components.ts
+++ b/web/src/components/MemoEditor/edit/types/components.ts
@@ -65,7 +65,7 @@ export interface EditorViewToggles {
onToggleFocusMode: () => void;
}
-/** The composer's source-mode switch: an item in the + menu, and a tag in the editor's corner while on. */
+/** The composer's source-mode switch: a checked item in the + menu. The text itself shows the mode. */
export interface EditorSourceModeToggle {
isSourceMode: boolean;
onToggle: () => void;
diff --git a/web/src/index.css b/web/src/index.css
index 5f17a6b56..5085c3e7a 100644
--- a/web/src/index.css
+++ b/web/src/index.css
@@ -2,6 +2,14 @@
@import "tw-animate-css";
@import "./themes/default.css";
+/*
+ * Rich text in the memo editor: everything outside its source mode, which shows the
+ * Markdown as text (the editor marks its root `.mbe-source-mode`). The editor applies
+ * memos' tag and mention classes in both modes, so the parts that draw a shape take
+ * this variant and source mode keeps the text and its color.
+ */
+@custom-variant rich (&:not(.mbe-source-mode *));
+
@layer base {
* {
@apply border-border outline-none ring-0;
diff --git a/web/src/lib/markdownStyles.ts b/web/src/lib/markdownStyles.ts
index ad5fe7af8..9f54ca817 100644
--- a/web/src/lib/markdownStyles.ts
+++ b/web/src/lib/markdownStyles.ts
@@ -27,15 +27,19 @@ export const markdownStyles = {
} as const;
/**
- * Tag pill styling for the memo view. Split into two tokens so the view can swap
- * `defaultColor` for a custom tag color (MemoEditor/view/MemoContentView.tsx). The composer
- * colors tags as text instead (MemoEditor/MemoMarkdown.tsx).
+ * `#tag` styling wherever the editor shows a memo. In rich text and the memo view a tag
+ * is a pill, in the theme color or the color the user gave it; in source mode the
+ * `rich:` variant (index.css) leaves only the text and its color, as the editor's own
+ * syntax highlighting does around it.
*/
export const tagStyles = {
- /** Shape, padding, and typography — always applied. */
- base: "inline-flex items-center align-baseline px-1.5 py-0.5 text-[0.9em] leading-none font-normal rounded-full border",
- /** Default theme color, used when no custom tag color is set. */
- defaultColor: "border-primary text-primary bg-primary/15",
+ /** The pill: shape, padding and typography. */
+ base: "rich:inline-flex rich:items-center rich:align-baseline rich:px-1.5 rich:py-0.5 rich:text-[0.9em] rich:leading-none rich:font-normal rich:rounded-full rich:border",
+ /** The theme color, used when the tag has no color of its own. */
+ defaultColor: "text-primary rich:border-primary rich:bg-primary/15",
+ /** The user's color, read from `--tag-color` on the element: the text darkened for contrast, the pill a light tint of it. */
+ customColor:
+ "text-[color:color-mix(in_srgb,var(--tag-color)_60%,black)] rich:border-(--tag-color) rich:bg-[color-mix(in_srgb,var(--tag-color)_15%,transparent)]",
} as const;
/**
diff --git a/web/src/lib/memo-markdown.ts b/web/src/lib/memo-markdown.ts
index a26800b81..1cd9f3445 100644
--- a/web/src/lib/memo-markdown.ts
+++ b/web/src/lib/memo-markdown.ts
@@ -140,32 +140,29 @@ const renderHtml: SyntaxView = (source, element, kind) => {
return htmlRendererPromise.then((render) => render(source, element, kind));
};
-/**
- * A tag's custom color from the user's tag settings, as a style attribute, or undefined
- * for the theme color. Text uses a darkened variant (60% color + black) for contrast.
- */
-function tagColorStyle(tag: string, tagsSetting: UserSetting_TagsSetting | undefined): string | undefined {
+/** A tag's custom color from the user's tag settings, as a hex value, or undefined for the theme color. */
+function tagColor(tag: string, tagsSetting: UserSetting_TagsSetting | undefined): string | undefined {
const metadata = tagsSetting ? findTagMetadata(tag, tagsSetting) : undefined;
- const bgHex = colorToHex(metadata?.backgroundColor);
- if (!bgHex) return undefined;
- return `border-color: ${bgHex}; color: color-mix(in srgb, ${bgHex} 60%, black); background-color: color-mix(in srgb, ${bgHex} 15%, transparent)`;
+ return colorToHex(metadata?.backgroundColor);
}
// `mbe-tag` is the editor's own class; the memo view finds tags by it.
const TAG_CLASS = cn("mbe-tag", tagStyles.base);
const DEFAULT_TAG_CLASS = cn(TAG_CLASS, tagStyles.defaultColor);
+const CUSTOM_TAG_CLASS = cn(TAG_CLASS, tagStyles.customColor);
/**
* How a #tag looks wherever a memo is shown, in the composer and the memo view alike:
- * a pill in the theme color, or in the color the user gave the tag. `getTagsSetting`
+ * a pill in the theme color, or in the color the user gave the tag, which the element
+ * carries as `--tag-color` for tagStyles.customColor to draw from. `getTagsSetting`
* is read when a block is decorated; call `editor.redecorate()` when it changes.
*/
export const memoTagOptions = (getTagsSetting: () => UserSetting_TagsSetting | undefined): Pick<TagsOptions, "class" | "attributes"> => ({
- class: (match) => (tagColorStyle(match.slice(1), getTagsSetting()) ? TAG_CLASS : DEFAULT_TAG_CLASS),
+ class: (match) => (tagColor(match.slice(1), getTagsSetting()) ? CUSTOM_TAG_CLASS : DEFAULT_TAG_CLASS),
attributes: (match): Record<string, string> => {
const tag = match.slice(1);
- const style = tagColorStyle(tag, getTagsSetting());
- return style ? { "data-tag": tag, style } : { "data-tag": tag };
+ const color = tagColor(tag, getTagsSetting());
+ return color ? { "data-tag": tag, style: `--tag-color: ${color}` } : { "data-tag": tag };
},
});
diff --git a/web/src/locales/ar.json b/web/src/locales/ar.json
index b9ea1aa4d..4426eb47d 100644
--- a/web/src/locales/ar.json
+++ b/web/src/locales/ar.json
@@ -149,9 +149,7 @@
"any-thoughts": "أية أفكار...",
"exit-focus-mode": "الخروج من وضع التركيز",
"focus-mode": "وضع التركيز",
- "source": "المصدر",
- "source-mode": "وضع المصدر",
- "switch-to-rich-text": "التبديل إلى النص المنسق",
+ "markdown-mode": "وضع Markdown",
"no-changes-detected": "لم يتم الكشف عن تغييرات",
"save": "حفظ",
"insert-menu": {
diff --git a/web/src/locales/az.json b/web/src/locales/az.json
index 7fb5423f0..3cb58701a 100644
--- a/web/src/locales/az.json
+++ b/web/src/locales/az.json
@@ -246,9 +246,7 @@
"any-thoughts": "Ağlınıza nə gəlir...",
"exit-focus-mode": "Fokus rejimindən çıx",
"focus-mode": "Fokus rejimi",
- "source": "Mənbə",
- "source-mode": "Mənbə rejimi",
- "switch-to-rich-text": "Zəngin mətnə keç",
+ "markdown-mode": "Markdown rejimi",
"comment": "Şərh",
"footnotes": "Qeydlər",
"back-to-reference": "İstinada qayıt",
diff --git a/web/src/locales/bg.json b/web/src/locales/bg.json
index 8d189fe60..5ac8b2567 100644
--- a/web/src/locales/bg.json
+++ b/web/src/locales/bg.json
@@ -187,9 +187,7 @@
"any-thoughts": "Някакви мисли...",
"exit-focus-mode": "Излезте от режима на фокусиране",
"focus-mode": "Режим на фокусиране",
- "source": "Изходен код",
- "source-mode": "Режим на изходен код",
- "switch-to-rich-text": "Превключване към форматиран текст",
+ "markdown-mode": "Режим Markdown",
"insert-menu": {
"add-location": "Добавете местоположение",
"link-memo": "Бележка за връзка",
diff --git a/web/src/locales/ca.json b/web/src/locales/ca.json
index 5f7dff2e2..f54e3707f 100644
--- a/web/src/locales/ca.json
+++ b/web/src/locales/ca.json
@@ -149,9 +149,7 @@
"any-thoughts": "Alguna idea...",
"exit-focus-mode": "Surt del mode focus",
"focus-mode": "Mode focus",
- "source": "Font",
- "source-mode": "Mode font",
- "switch-to-rich-text": "Canvia a text enriquit",
+ "markdown-mode": "Mode Markdown",
"insert-menu": {
"add-location": "Afegeix la ubicació",
"link-memo": "Nota d'enllaç",
diff --git a/web/src/locales/cs.json b/web/src/locales/cs.json
index 06af1b145..6f6936f8b 100644
--- a/web/src/locales/cs.json
+++ b/web/src/locales/cs.json
@@ -149,9 +149,7 @@
"any-thoughts": "Jakékoli myšlenky...",
"exit-focus-mode": "Ukončit režim soustředění",
"focus-mode": "Režim soustředění",
- "source": "Zdroj",
- "source-mode": "Režim zdroje",
- "switch-to-rich-text": "Přepnout na formátovaný text",
+ "markdown-mode": "Režim Markdown",
"insert-menu": {
"add-location": "Přidat umístění",
"link-memo": "Odkaz na poznámku",
diff --git a/web/src/locales/da.json b/web/src/locales/da.json
index a3065fdd4..8f95b6ef9 100644
--- a/web/src/locales/da.json
+++ b/web/src/locales/da.json
@@ -187,9 +187,7 @@
"any-thoughts": "Nogen tanker...",
"exit-focus-mode": "Afslut fokustilstand",
"focus-mode": "Fokustilstand",
- "source": "Kilde",
- "source-mode": "Kildetilstand",
- "switch-to-rich-text": "Skift til formateret tekst",
+ "markdown-mode": "Markdown-tilstand",
"insert-menu": {
"add-location": "Tilføj placering",
"link-memo": "Link memo",
diff --git a/web/src/locales/de.json b/web/src/locales/de.json
index 62d3c395e..c122e1c35 100644
--- a/web/src/locales/de.json
+++ b/web/src/locales/de.json
@@ -149,9 +149,7 @@
"any-thoughts": "Ein Gedanke...",
"exit-focus-mode": "Fokus Modus verlassen",
"focus-mode": "Fokus Modus",
- "source": "Quelltext",
- "source-mode": "Quelltext Modus",
- "switch-to-rich-text": "Zu formatiertem Text wechseln",
+ "markdown-mode": "Markdown-Modus",
"insert-menu": {
"add-location": "Standort hinzufügen",
"link-memo": "Link-Memo",
diff --git a/web/src/locales/el.json b/web/src/locales/el.json
index a0737d8f5..c56ec1ee1 100644
--- a/web/src/locales/el.json
+++ b/web/src/locales/el.json
@@ -187,9 +187,7 @@
"any-thoughts": "Οποιαδήποτε σκέψη...",
"exit-focus-mode": "Έξοδος από τη λειτουργία εστίασης",
"focus-mode": "Λειτουργία εστίασης",
- "source": "Πηγή",
- "source-mode": "Λειτουργία πηγής",
- "switch-to-rich-text": "Εναλλαγή σε μορφοποιημένο κείμενο",
+ "markdown-mode": "Λειτουργία Markdown",
"insert-menu": {
"add-location": "Προσθήκη τοποθεσίας",
"link-memo": "Σημείωμα σύνδεσης",
diff --git a/web/src/locales/en-GB.json b/web/src/locales/en-GB.json
index acfceb099..c91331390 100644
--- a/web/src/locales/en-GB.json
+++ b/web/src/locales/en-GB.json
@@ -149,9 +149,7 @@
"any-thoughts": "Any thoughts...",
"exit-focus-mode": "Exit Focus Mode",
"focus-mode": "Focus Mode",
- "source": "Source",
- "source-mode": "Source Mode",
- "switch-to-rich-text": "Switch to rich text",
+ "markdown-mode": "Markdown mode",
"insert-menu": {
"add-location": "Add location",
"link-memo": "Link memo",
diff --git a/web/src/locales/en.json b/web/src/locales/en.json
index e057926a5..b7f6c8247 100644
--- a/web/src/locales/en.json
+++ b/web/src/locales/en.json
@@ -246,9 +246,7 @@
"any-thoughts": "Any thoughts...",
"exit-focus-mode": "Exit Focus Mode",
"focus-mode": "Focus Mode",
- "source": "Source",
- "source-mode": "Source Mode",
- "switch-to-rich-text": "Switch to rich text",
+ "markdown-mode": "Markdown mode",
"comment": "Comment",
"footnotes": "Footnotes",
"back-to-reference": "Back to reference",
diff --git a/web/src/locales/es.json b/web/src/locales/es.json
index f3be21e3c..8409638df 100644
--- a/web/src/locales/es.json
+++ b/web/src/locales/es.json
@@ -149,9 +149,7 @@
"any-thoughts": "Alguna idea...",
"exit-focus-mode": "Salir del modo enfoque",
"focus-mode": "Modo enfoque",
- "source": "Fuente",
- "source-mode": "Modo fuente",
- "switch-to-rich-text": "Cambiar a texto enriquecido",
+ "markdown-mode": "Modo Markdown",
"insert-menu": {
"add-location": "Agregar ubicación",
"link-memo": "Nota de enlace",
diff --git a/web/src/locales/et.json b/web/src/locales/et.json
index a3f673c17..aba0602f1 100644
--- a/web/src/locales/et.json
+++ b/web/src/locales/et.json
@@ -187,9 +187,7 @@
"any-thoughts": "Mingid mõtted...",
"exit-focus-mode": "Välju teravustamisrežiimist",
"focus-mode": "Fookusrežiim",
- "source": "Lähtetekst",
- "source-mode": "Lähtetekstirežiim",
- "switch-to-rich-text": "Lülitu vormindatud tekstile",
+ "markdown-mode": "Markdown-režiim",
"insert-menu": {
"add-location": "Lisa asukoht",
"link-memo": "Lingi memo",
diff --git a/web/src/locales/fa.json b/web/src/locales/fa.json
index 8c9887e38..9a4b3ac31 100644
--- a/web/src/locales/fa.json
+++ b/web/src/locales/fa.json
@@ -149,9 +149,7 @@
"any-thoughts": "فکر شما...",
"exit-focus-mode": "خروج از حالت تمرکز",
"focus-mode": "حالت تمرکز",
- "source": "منبع",
- "source-mode": "حالت منبع",
- "switch-to-rich-text": "تغییر به متن قالب‌دار",
+ "markdown-mode": "حالت Markdown",
"no-changes-detected": "تغییری شناسایی نشد",
"save": "ذخیره",
"insert-menu": {
diff --git a/web/src/locales/fi.json b/web/src/locales/fi.json
index 5442c138d..3ea69374c 100644
--- a/web/src/locales/fi.json
+++ b/web/src/locales/fi.json
@@ -187,9 +187,7 @@
"any-thoughts": "Mitään ajatuksia...",
"exit-focus-mode": "Poistu tarkennustilasta",
"focus-mode": "Tarkennustila",
- "source": "Lähde",
- "source-mode": "Lähdetila",
- "switch-to-rich-text": "Vaihda muotoiltuun tekstiin",
+ "markdown-mode": "Markdown-tila",
"insert-menu": {
"add-location": "Lisää sijainti",
"link-memo": "Linkkimuistio",
diff --git a/web/src/locales/fr.json b/web/src/locales/fr.json
index a0624dd95..a63e4d394 100644
--- a/web/src/locales/fr.json
+++ b/web/src/locales/fr.json
@@ -149,9 +149,7 @@
"any-thoughts": "Des idées...",
"exit-focus-mode": "Quitter le mode concentration",
"focus-mode": "Mode concentration",
- "source": "Source",
- "source-mode": "Mode source",
- "switch-to-rich-text": "Passer au texte enrichi",
+ "markdown-mode": "Mode Markdown",
"insert-menu": {
"add-location": "Ajouter un emplacement",
"link-memo": "Lien vers un mémo",
diff --git a/web/src/locales/gl.json b/web/src/locales/gl.json
index 6bc44c5fe..0567fa896 100644
--- a/web/src/locales/gl.json
+++ b/web/src/locales/gl.json
@@ -149,9 +149,7 @@
"any-thoughts": "O que pensas...",
"exit-focus-mode": "Saír do modo sen distraccións",
"focus-mode": "Modo Sen distraccións",
- "source": "Fonte",
- "source-mode": "Modo fonte",
- "switch-to-rich-text": "Cambiar a texto enriquecido",
+ "markdown-mode": "Modo Markdown",
"insert-menu": {
"add-location": "Engadir localización",
"link-memo": "Nota de ligazón",
diff --git a/web/src/locales/he.json b/web/src/locales/he.json
index fdad66d82..dd8e4acb4 100644
--- a/web/src/locales/he.json
+++ b/web/src/locales/he.json
@@ -220,9 +220,7 @@
"any-thoughts": "יש מחשבות...",
"exit-focus-mode": "יציאה ממצב מיקוד",
"focus-mode": "מצב מיקוד",
- "source": "מקור",
- "source-mode": "מצב מקור",
- "switch-to-rich-text": "מעבר לטקסט מעוצב",
+ "markdown-mode": "מצב Markdown",
"format": {
"paragraph": "פסקה",
"heading-1": "כותרת 1",
diff --git a/web/src/locales/hi.json b/web/src/locales/hi.json
index 6faa2229f..adc96b2cf 100644
--- a/web/src/locales/hi.json
+++ b/web/src/locales/hi.json
@@ -149,9 +149,7 @@
"any-thoughts": "कोई विचार...",
"exit-focus-mode": "फोकस मोड से बाहर निकलें",
"focus-mode": "फोकस मोड",
- "source": "स्रोत",
- "source-mode": "स्रोत मोड",
- "switch-to-rich-text": "रिच टेक्स्ट पर जाएँ",
+ "markdown-mode": "Markdown मोड",
"no-changes-detected": "कोई बदलाव नहीं पाया गया",
"save": "सहेजें",
"insert-menu": {
diff --git a/web/src/locales/hr.json b/web/src/locales/hr.json
index d4e5127fc..656f1a7be 100644
--- a/web/src/locales/hr.json
+++ b/web/src/locales/hr.json
@@ -149,9 +149,7 @@
"any-thoughts": "Imaš li misli...",
"exit-focus-mode": "Izlazi iz načina rada za fokus",
"focus-mode": "Način rada za fokus",
- "source": "Izvor",
- "source-mode": "Način rada izvora",
- "switch-to-rich-text": "Prebaci na oblikovani tekst",
+ "markdown-mode": "Način rada Markdown",
"insert-menu": {
"add-location": "Dodajte lokaciju",
"link-memo": "Link dopis",
diff --git a/web/src/locales/hu.json b/web/src/locales/hu.json
index feae1dbe5..9a5fbb54a 100644
--- a/web/src/locales/hu.json
+++ b/web/src/locales/hu.json
@@ -149,9 +149,7 @@
"any-thoughts": "Bármi ami a fejedben jár...",
"exit-focus-mode": "Kilépés a fókusz módból",
"focus-mode": "Fókusz mód",
- "source": "Forrás",
- "source-mode": "Forrás mód",
- "switch-to-rich-text": "Váltás formázott szövegre",
+ "markdown-mode": "Markdown mód",
"insert-menu": {
"add-location": "Hely hozzáadása",
"link-memo": "Linkjegyzet",
diff --git a/web/src/locales/id.json b/web/src/locales/id.json
index 4eae90b5e..b92477aad 100644
--- a/web/src/locales/id.json
+++ b/web/src/locales/id.json
@@ -149,9 +149,7 @@
"any-thoughts": "Punya pemikiran...",
"exit-focus-mode": "Keluar dari Mode Fokus",
"focus-mode": "Mode Fokus",
- "source": "Sumber",
- "source-mode": "Mode Sumber",
- "switch-to-rich-text": "Beralih ke Teks Kaya",
+ "markdown-mode": "Mode Markdown",
"no-changes-detected": "Tidak ada perubahan yang terdeteksi",
"save": "Simpan",
"insert-menu": {
diff --git a/web/src/locales/it.json b/web/src/locales/it.json
index 775f80cbb..5cd990aaa 100644
--- a/web/src/locales/it.json
+++ b/web/src/locales/it.json
@@ -149,9 +149,7 @@
"any-thoughts": "Qualsiasi cosa pensi...",
"exit-focus-mode": "Esci Modalità Focus",
"focus-mode": "Modalità Focus",
- "source": "Sorgente",
- "source-mode": "Modalità Sorgente",
- "switch-to-rich-text": "Passa al testo formattato",
+ "markdown-mode": "Modalità Markdown",
"insert-menu": {
"add-location": "Aggiungi posizione",
"link-memo": "Collegamento promemoria",
diff --git a/web/src/locales/ja.json b/web/src/locales/ja.json
index 7421858ce..614e5b927 100644
--- a/web/src/locales/ja.json
+++ b/web/src/locales/ja.json
@@ -149,9 +149,7 @@
"any-thoughts": "今思ったことは...",
"exit-focus-mode": "フォーカスを終了",
"focus-mode": "フォーカスモード",
- "source": "ソース",
- "source-mode": "ソースモード",
- "switch-to-rich-text": "リッチテキストに切り替え",
+ "markdown-mode": "Markdown モード",
"no-changes-detected": "変更はありません",
"save": "保存",
"insert-menu": {
diff --git a/web/src/locales/ka-GE.json b/web/src/locales/ka-GE.json
index 98adec48b..7ea40a718 100644
--- a/web/src/locales/ka-GE.json
+++ b/web/src/locales/ka-GE.json
@@ -149,9 +149,7 @@
"any-thoughts": "რამე იდეები...",
"exit-focus-mode": "ფოკუსის რეჟიმიდან გასვლა",
"focus-mode": "ფოკუსის რეჟიმი",
- "source": "წყარო",
- "source-mode": "წყაროს რეჟიმი",
- "switch-to-rich-text": "ფორმატირებულ ტექსტზე გადართვა",
+ "markdown-mode": "Markdown რეჟიმი",
"insert-menu": {
"add-location": "მდებარეობის დამატება",
"link-memo": "ლინკ შენიშვნა",
diff --git a/web/src/locales/ko.json b/web/src/locales/ko.json
index 15f471a62..dbcee783d 100644
--- a/web/src/locales/ko.json
+++ b/web/src/locales/ko.json
@@ -149,9 +149,7 @@
"any-thoughts": "떠오르는 게 있나요...",
"exit-focus-mode": "집중 모드 종료",
"focus-mode": "집중 모드",
- "source": "소스",
- "source-mode": "소스 모드",
- "switch-to-rich-text": "서식 있는 텍스트로 전환",
+ "markdown-mode": "Markdown 모드",
"no-changes-detected": "변경사항이 없습니다",
"save": "저장",
"insert-menu": {
diff --git a/web/src/locales/lt.json b/web/src/locales/lt.json
index 72118d5e0..6e9f9d51f 100644
--- a/web/src/locales/lt.json
+++ b/web/src/locales/lt.json
@@ -187,9 +187,7 @@
"any-thoughts": "Bet kokios mintys...",
"exit-focus-mode": "Išeikite iš fokusavimo režimo",
"focus-mode": "Fokusavimo režimas",
- "source": "Šaltinis",
- "source-mode": "Šaltinio režimas",
- "switch-to-rich-text": "Perjungti į formatuotą tekstą",
+ "markdown-mode": "Markdown režimas",
"insert-menu": {
"add-location": "Pridėti vietą",
"link-memo": "Nuorodos atmintinė",
diff --git a/web/src/locales/lv.json b/web/src/locales/lv.json
index 576e3a61b..366f32cb4 100644
--- a/web/src/locales/lv.json
+++ b/web/src/locales/lv.json
@@ -187,9 +187,7 @@
"any-thoughts": "Jebkuras domas...",
"exit-focus-mode": "Iziet no fokusa režīma",
"focus-mode": "Fokusa režīms",
- "source": "Avots",
- "source-mode": "Avota režīms",
- "switch-to-rich-text": "Pārslēgties uz formatētu tekstu",
+ "markdown-mode": "Markdown režīms",
"insert-menu": {
"add-location": "Pievienot atrašanās vietu",
"link-memo": "Saites piezīme",
diff --git a/web/src/locales/mr.json b/web/src/locales/mr.json
index e001cfddd..94450b7a3 100644
--- a/web/src/locales/mr.json
+++ b/web/src/locales/mr.json
@@ -149,9 +149,7 @@
"any-thoughts": "आपले विचार...",
"exit-focus-mode": "फोकस मोड सोडा",
"focus-mode": "फोकस मोड",
- "source": "स्रोत",
- "source-mode": "स्रोत मोड",
- "switch-to-rich-text": "रिच टेक्स्टवर जा",
+ "markdown-mode": "Markdown मोड",
"no-changes-detected": "कोणतेही बदल आढळले नाहीत",
"save": "जतन",
"insert-menu": {
diff --git a/web/src/locales/nb.json b/web/src/locales/nb.json
index 9a59940d9..4ea98010b 100644
--- a/web/src/locales/nb.json
+++ b/web/src/locales/nb.json
@@ -149,9 +149,7 @@
"any-thoughts": "Noen tanker...",
"exit-focus-mode": "Avslutt fokusmodus",
"focus-mode": "Fokusmodus",
- "source": "Kilde",
- "source-mode": "Kildemodus",
- "switch-to-rich-text": "Bytt til formatert tekst",
+ "markdown-mode": "Markdown-modus",
"insert-menu": {
"add-location": "Legg til plassering",
"link-memo": "Koblingsnotat",
diff --git a/web/src/locales/nl.json b/web/src/locales/nl.json
index 75b9f5b41..4fa96c55a 100644
--- a/web/src/locales/nl.json
+++ b/web/src/locales/nl.json
@@ -149,9 +149,7 @@
"any-thoughts": "Enkele gedachten…",
"exit-focus-mode": "Focusmodus afsluiten",
"focus-mode": "Focusmodus",
- "source": "Bron",
- "source-mode": "Bronmodus",
- "switch-to-rich-text": "Overschakelen naar opgemaakte tekst",
+ "markdown-mode": "Markdown-modus",
"insert-menu": {
"add-location": "Locatie toevoegen",
"link-memo": "Link-memo",
diff --git a/web/src/locales/nn.json b/web/src/locales/nn.json
index bc8b91044..a46cf9f46 100644
--- a/web/src/locales/nn.json
+++ b/web/src/locales/nn.json
@@ -243,9 +243,7 @@
"back-to-reference": "Tilbake til referansen",
"exit-focus-mode": "Gå ut av fokusmodus",
"focus-mode": "Fokusmodus",
- "source": "Kjelde",
- "source-mode": "Kjeldemodus",
- "switch-to-rich-text": "Byt til formatert tekst",
+ "markdown-mode": "Markdown-modus",
"format": {
"bold": "Feit skrift",
"bullet-list": "Punktliste",
diff --git a/web/src/locales/pl.json b/web/src/locales/pl.json
index 09f94f734..4b042c59a 100644
--- a/web/src/locales/pl.json
+++ b/web/src/locales/pl.json
@@ -149,9 +149,7 @@
"any-thoughts": "Jakieś przemyślenia...",
"exit-focus-mode": "Wyjdź z Trybu Skupienia",
"focus-mode": "Tryb Skupienia",
- "source": "Źródło",
- "source-mode": "Tryb Źródła",
- "switch-to-rich-text": "Przełącz na tekst sformatowany",
+ "markdown-mode": "Tryb Markdown",
"format": {
"paragraph": "Akapit",
"heading-1": "Nagłówek 1",
diff --git a/web/src/locales/pt-BR.json b/web/src/locales/pt-BR.json
index 9038da248..8fc9ee09e 100644
--- a/web/src/locales/pt-BR.json
+++ b/web/src/locales/pt-BR.json
@@ -149,9 +149,7 @@
"any-thoughts": "Alguma ideia…",
"exit-focus-mode": "Sair do Modo Foco",
"focus-mode": "Modo Foco",
- "source": "Código",
- "source-mode": "Modo Código",
- "switch-to-rich-text": "Mudar para texto formatado",
+ "markdown-mode": "Modo Markdown",
"no-changes-detected": "Nenhuma alteração detectada",
"save": "Salvar",
"insert-menu": {
diff --git a/web/src/locales/pt-PT.json b/web/src/locales/pt-PT.json
index 2af9d8392..6e17732c0 100644
--- a/web/src/locales/pt-PT.json
+++ b/web/src/locales/pt-PT.json
@@ -149,9 +149,7 @@
"any-thoughts": "Alguma ideia…",
"exit-focus-mode": "Sair do Modo Foco",
"focus-mode": "Modo Foco",
- "source": "Código",
- "source-mode": "Modo Código",
- "switch-to-rich-text": "Mudar para texto formatado",
+ "markdown-mode": "Modo Markdown",
"insert-menu": {
"add-location": "Adicionar local",
"link-memo": "Vincular memorando",
diff --git a/web/src/locales/ro.json b/web/src/locales/ro.json
index 6a728067f..e9bd57f14 100644
--- a/web/src/locales/ro.json
+++ b/web/src/locales/ro.json
@@ -187,9 +187,7 @@
"any-thoughts": "Orice gânduri...",
"exit-focus-mode": "Ieșiți din modul de focalizare",
"focus-mode": "Modul de focalizare",
- "source": "Sursă",
- "source-mode": "Modul sursă",
- "switch-to-rich-text": "Comută la text formatat",
+ "markdown-mode": "Modul Markdown",
"insert-menu": {
"add-location": "Adăugați locația",
"link-memo": "Notă de legături",
diff --git a/web/src/locales/ru.json b/web/src/locales/ru.json
index 3c75cdb4f..784357e43 100644
--- a/web/src/locales/ru.json
+++ b/web/src/locales/ru.json
@@ -149,9 +149,7 @@
"any-thoughts": "Напишите что-нибудь...",
"exit-focus-mode": "Выйти из режима фокуса",
"focus-mode": "Режим фокуса",
- "source": "Исходник",
- "source-mode": "Режим исходника",
- "switch-to-rich-text": "Переключиться на форматированный текст",
+ "markdown-mode": "Режим Markdown",
"insert-menu": {
"add-location": "Добавить местоположение",
"link-memo": "Ссылка на заметку",
diff --git a/web/src/locales/sk.json b/web/src/locales/sk.json
index 822f8e3f0..022d3a07b 100644
--- a/web/src/locales/sk.json
+++ b/web/src/locales/sk.json
@@ -187,9 +187,7 @@
"any-thoughts": "Akékoľvek myšlienky...",
"exit-focus-mode": "Ukončite režim zaostrenia",
"focus-mode": "Režim zaostrenia",
- "source": "Zdroj",
- "source-mode": "Režim zdroja",
- "switch-to-rich-text": "Prepnúť na formátovaný text",
+ "markdown-mode": "Režim Markdown",
"insert-menu": {
"add-location": "Pridať polohu",
"link-memo": "Odkaz na poznámku",
diff --git a/web/src/locales/sl.json b/web/src/locales/sl.json
index 9ac41e7cb..93cef075b 100644
--- a/web/src/locales/sl.json
+++ b/web/src/locales/sl.json
@@ -149,9 +149,7 @@
"any-thoughts": "Kakšne misli...",
"exit-focus-mode": "Izhod iz načina osredotočanja",
"focus-mode": "Način osredotočanja",
- "source": "Izvor",
- "source-mode": "Način izvora",
- "switch-to-rich-text": "Preklopi na oblikovano besedilo",
+ "markdown-mode": "Način Markdown",
"insert-menu": {
"add-location": "Dodajte lokacijo",
"link-memo": "Beležka povezave",
diff --git a/web/src/locales/sr.json b/web/src/locales/sr.json
index 5920aca33..3440e64bf 100644
--- a/web/src/locales/sr.json
+++ b/web/src/locales/sr.json
@@ -187,9 +187,7 @@
"any-thoughts": "Било каква размишљања...",
"exit-focus-mode": "Изађите из режима фокуса",
"focus-mode": "Фоцус Моде",
- "source": "Извор",
- "source-mode": "Режим извора",
- "switch-to-rich-text": "Пребаци на форматирани текст",
+ "markdown-mode": "Режим Markdown",
"insert-menu": {
"add-location": "Додајте локацију",
"link-memo": "Меморандум о вези",
diff --git a/web/src/locales/sv.json b/web/src/locales/sv.json
index 29c9ff63a..5b1362063 100644
--- a/web/src/locales/sv.json
+++ b/web/src/locales/sv.json
@@ -149,9 +149,7 @@
"any-thoughts": "Några tankar...",
"exit-focus-mode": "Avsluta fokusläge",
"focus-mode": "Fokusläge",
- "source": "Källa",
- "source-mode": "Källäge",
- "switch-to-rich-text": "Växla till formaterad text",
+ "markdown-mode": "Markdown-läge",
"insert-menu": {
"add-location": "Lägg till plats",
"link-memo": "Länkmemo",
diff --git a/web/src/locales/th.json b/web/src/locales/th.json
index 9cf612d1e..024795590 100644
--- a/web/src/locales/th.json
+++ b/web/src/locales/th.json
@@ -149,9 +149,7 @@
"any-thoughts": "ความคิดใดๆ...",
"exit-focus-mode": "ออกจากโหมดโฟกัส",
"focus-mode": "โหมดโฟกัส",
- "source": "ซอร์ส",
- "source-mode": "โหมดซอร์ส",
- "switch-to-rich-text": "สลับเป็นข้อความแบบจัดรูปแบบ",
+ "markdown-mode": "โหมด Markdown",
"no-changes-detected": "ไม่มีการเปลี่ยนแปลง",
"save": "บันทึก",
"insert-menu": {
diff --git a/web/src/locales/tr.json b/web/src/locales/tr.json
index a88b1f17c..99e82f5b2 100644
--- a/web/src/locales/tr.json
+++ b/web/src/locales/tr.json
@@ -175,9 +175,7 @@
"any-thoughts": "Düşünceleriniz...",
"exit-focus-mode": "Odak modundan çık",
"focus-mode": "Odak modu",
- "source": "Kaynak",
- "source-mode": "Kaynak modu",
- "switch-to-rich-text": "Zengin metne geç",
+ "markdown-mode": "Markdown modu",
"comment": "Yorum yap",
"footnotes": "Dipnotlar",
"back-to-reference": "Referansa geri dön",
diff --git a/web/src/locales/uk.json b/web/src/locales/uk.json
index 75b108fd5..3e763d530 100644
--- a/web/src/locales/uk.json
+++ b/web/src/locales/uk.json
@@ -149,9 +149,7 @@
"any-thoughts": "Якісь думки...",
"exit-focus-mode": "Вийти з режиму фокусування",
"focus-mode": "Режим фокусування",
- "source": "Вихідний код",
- "source-mode": "Режим вихідного коду",
- "switch-to-rich-text": "Перейти до форматованого тексту",
+ "markdown-mode": "Режим Markdown",
"insert-menu": {
"add-location": "Додайте місцезнаходження",
"link-memo": "Пам'ятка про посилання",
diff --git a/web/src/locales/vi.json b/web/src/locales/vi.json
index 056223fd5..6e5e0face 100644
--- a/web/src/locales/vi.json
+++ b/web/src/locales/vi.json
@@ -149,9 +149,7 @@
"any-thoughts": "Có suy nghĩ gì...",
"exit-focus-mode": "Thoát chế độ tập trung",
"focus-mode": "Chế độ tập trung",
- "source": "Mã nguồn",
- "source-mode": "Chế độ mã nguồn",
- "switch-to-rich-text": "Chuyển sang văn bản định dạng",
+ "markdown-mode": "Chế độ Markdown",
"no-changes-detected": "Không phát hiện thay đổi",
"save": "Lưu",
"insert-menu": {
diff --git a/web/src/locales/zh-Hans.json b/web/src/locales/zh-Hans.json
index d07204146..6f0e6b8fd 100644
--- a/web/src/locales/zh-Hans.json
+++ b/web/src/locales/zh-Hans.json
@@ -180,9 +180,7 @@
"any-thoughts": "此刻的想法...",
"exit-focus-mode": "退出聚焦模式",
"focus-mode": "聚焦模式",
- "source": "源码",
- "source-mode": "源码模式",
- "switch-to-rich-text": "切换到富文本",
+ "markdown-mode": "Markdown 模式",
"format": {
"paragraph": "正文",
"heading-1": "一级标题",
diff --git a/web/src/locales/zh-Hant.json b/web/src/locales/zh-Hant.json
index eae179c24..6cdd29d0c 100644
--- a/web/src/locales/zh-Hant.json
+++ b/web/src/locales/zh-Hant.json
@@ -228,9 +228,7 @@
"any-thoughts": "任何想法...",
"exit-focus-mode": "退出專注模式",
"focus-mode": "專注模式",
- "source": "原始碼",
- "source-mode": "原始碼模式",
- "switch-to-rich-text": "切換到富文字",
+ "markdown-mode": "Markdown 模式",
"format": {
"paragraph": "段落",
"heading-1": "標題 1",
diff --git a/web/tests/editor-controller.test.tsx b/web/tests/editor-controller.test.tsx
index b4557fa02..5b09994b6 100644
--- a/web/tests/editor-controller.test.tsx
+++ b/web/tests/editor-controller.test.tsx
@@ -190,7 +190,25 @@ describe("source mode", () => {
it("shows the memo as Markdown text, the same document rich mode saves", () => {
const { c, container } = setup(memo, "source");
- expect(container.querySelector(".mbe-source")?.textContent).toBe(memo);
+ // One element per line; the line endings are the boundaries between them, not in the DOM.
+ const lines = Array.from(container.querySelectorAll(".mbe-source .mbe-source-line"), (line) => line.textContent);
+ expect(lines.join("\n")).toBe(memo);
expect(c.getMarkdown()).toBe(memo);
});
+
+ it("toggles a task item on the caret's line as a text edit", () => {
+ const { c } = setup(memo, "source");
+ caretAtEnd(c, 0, "# Plan".length);
+ // The task marker takes the line's prefix, as a heading becomes a task in rich mode.
+ expect(c.toggleTaskList()).toBe(true);
+ expect(c.getMarkdown()).toBe("- [ ] Plan\n\n- [ ] Ship #work\n\n`#code`");
+ expect(c.hasChecklist()).toBe(true);
+ });
+
+ it("toggles only the caret's line in the middle of the text", () => {
+ const { c } = setup("Intro\nGroceries\nOutro", "source");
+ caretAtEnd(c, 0, "Intro\nGro".length);
+ expect(c.toggleTaskList()).toBe(true);
+ expect(c.getMarkdown()).toBe("Intro\n- [ ] Groceries\nOutro");
+ });
});
diff --git a/web/tests/editor.test.tsx b/web/tests/editor.test.tsx
index c1a2ffc11..904b49146 100644
--- a/web/tests/editor.test.tsx
+++ b/web/tests/editor.test.tsx
@@ -96,15 +96,41 @@ describe("Editor", () => {
queries.tagsSetting = undefined;
const { container, rerender } = render(<Editor {...baseProps} value="#work and #life" />);
const tag = (name: string) => container.querySelector<HTMLElement>(`.mbe-tag[data-tag="${name}"]`);
- expect(tag("life")).toHaveClass("rounded-full", "border-primary");
+ expect(tag("life")).toHaveClass("rich:rounded-full", "rich:border-primary");
expect(tag("work")).not.toHaveAttribute("style");
queries.tagsSetting = create(UserSetting_TagsSettingSchema, {
tags: { work: { backgroundColor: create(ColorSchema, { red: 1, green: 0, blue: 0 }) } },
});
rerender(<Editor {...baseProps} value="#work and #life" />);
- await waitFor(() => expect(tag("work")?.getAttribute("style")).toContain("color-mix"));
- expect(tag("work")).not.toHaveClass("border-primary");
+ await waitFor(() => expect(tag("work")?.style.getPropertyValue("--tag-color")).toBe("#ff0000"));
+ expect(tag("work")).not.toHaveClass("rich:border-primary");
+
+ // The pill is rich text's: every memos class but the text color takes the `rich:`
+ // variant, so source mode, where the editor applies the same classes, keeps plain text.
+ for (const name of ["work", "life"]) {
+ const classes = Array.from(tag(name)!.classList).filter((cls) => !cls.startsWith("mbe-"));
+ expect(classes.filter((cls) => cls.startsWith("text-"))).toHaveLength(1);
+ expect(classes.filter((cls) => !cls.startsWith("text-") && !cls.startsWith("rich:"))).toEqual([]);
+ }
+ queries.tagsSetting = undefined;
+ });
+
+ it("keeps a tag's text color and nothing of its pill in source mode", async () => {
+ queries.tagsSetting = create(UserSetting_TagsSettingSchema, {
+ tags: { work: { backgroundColor: create(ColorSchema, { red: 1, green: 0, blue: 0 }) } },
+ });
+ const { container } = render(<Editor {...baseProps} value="#work and #life" mode="source" />);
+ const tag = (name: string) => container.querySelector<HTMLElement>(`.mbe-source-mode .mbe-tag[data-tag="${name}"]`);
+
+ // The editor decorates tags in the source text with the same classes as in rich text;
+ // the `rich:` variant is what keeps the pill out of it.
+ await waitFor(() => expect(tag("work")?.style.getPropertyValue("--tag-color")).toBe("#ff0000"));
+ for (const name of ["work", "life"]) {
+ const classes = Array.from(tag(name)!.classList).filter((cls) => !cls.startsWith("mbe-"));
+ expect(classes.filter((cls) => cls.startsWith("text-"))).toHaveLength(1);
+ expect(classes.filter((cls) => !cls.startsWith("text-") && !cls.startsWith("rich:"))).toEqual([]);
+ }
queries.tagsSetting = undefined;
});
diff --git a/web/tests/insert-menu.test.tsx b/web/tests/insert-menu.test.tsx
index 4dcbabba7..f84dbcedf 100644
--- a/web/tests/insert-menu.test.tsx
+++ b/web/tests/insert-menu.test.tsx
@@ -67,7 +67,7 @@ describe("InsertMenu", () => {
const labels = screen.getAllByRole("menuitem").map((item) => item.textContent);
expect(labels).not.toContain("editor.focus-mode");
- expect(screen.getByRole("menuitemcheckbox", { name: "editor.source-mode" })).toBeInTheDocument();
+ expect(screen.getByRole("menuitemcheckbox", { name: "editor.markdown-mode" })).toBeInTheDocument();
});
test.each([false, true])("shows source mode as a checkbox item that toggles it (on: %s)", (isSourceMode) => {
@@ -75,7 +75,7 @@ describe("InsertMenu", () => {
renderMenu(vi.fn(), false, false, { isSourceMode, onToggle });
fireEvent.click(screen.getByRole("button", { name: "common.add" }));
- const item = screen.getByRole("menuitemcheckbox", { name: "editor.source-mode" });
+ const item = screen.getByRole("menuitemcheckbox", { name: "editor.markdown-mode" });
expect(item).toHaveAttribute("aria-checked", String(isSourceMode));
fireEvent.click(item);
diff --git a/web/tests/memo-editor-source-mode.test.tsx b/web/tests/memo-editor-source-mode.test.tsx
index 269ac5076..302faaf0c 100644
--- a/web/tests/memo-editor-source-mode.test.tsx
+++ b/web/tests/memo-editor-source-mode.test.tsx
@@ -50,6 +50,9 @@ const mount = (suggestions?: readonly MemoSuggestion[]) =>
);
const sourceText = (container: HTMLElement) => container.querySelector(".mbe-source");
+/** The Markdown source mode shows: one element per line, the line endings between them. */
+const sourceLines = (container: HTMLElement) =>
+ Array.from(container.querySelectorAll(".mbe-source .mbe-source-line"), (line) => line.textContent).join("\n");
afterEach(() => {
localStorage.clear();
@@ -57,25 +60,23 @@ afterEach(() => {
});
describe("MemoEditor source mode", () => {
- it("switches from the + menu, names itself in the editor's corner while on, and switches back from there", () => {
+ it("switches from the + menu and back, and nothing in the editor names the mode", () => {
const { container } = mount();
expect(sourceText(container)).toBeNull();
- expect(screen.queryByRole("button", { name: "editor.source" })).not.toBeInTheDocument();
fireEvent.click(screen.getByRole("button", { name: "common.add" }));
- fireEvent.click(screen.getByRole("menuitemcheckbox", { name: "editor.source-mode" }));
+ fireEvent.click(screen.getByRole("menuitemcheckbox", { name: "editor.markdown-mode" }));
expect(sourceText(container)).not.toBeNull();
expect(localStorage.getItem(MODE_KEY)).toBe(JSON.stringify("source"));
- // The tag belongs to the writing area, not the toolbar, and the first line leaves room for it.
- const tag = screen.getByRole("button", { name: "editor.source" });
- expect(tag.parentElement?.querySelector(":scope > .memo-editor-content")).not.toBeNull();
+ // The text shows the mode; the composer adds no tag or indicator for it.
+ expect(screen.queryByRole("button", { name: "editor.source" })).not.toBeInTheDocument();
expect(container.querySelector(".memo-editor-content")).toHaveAttribute("data-source-mode");
- fireEvent.click(screen.getByRole("button", { name: "editor.source" }));
+ fireEvent.click(screen.getByRole("button", { name: "common.add" }));
+ fireEvent.click(screen.getByRole("menuitemcheckbox", { name: "editor.markdown-mode" }));
expect(sourceText(container)).toBeNull();
- expect(screen.queryByRole("button", { name: "editor.source" })).not.toBeInTheDocument();
expect(localStorage.getItem(MODE_KEY)).toBe(JSON.stringify("rich"));
});
@@ -84,25 +85,51 @@ describe("MemoEditor source mode", () => {
const { container } = mount();
expect(sourceText(container)).not.toBeNull();
- expect(screen.getByRole("button", { name: "editor.source" })).toBeInTheDocument();
+ fireEvent.click(screen.getByRole("button", { name: "common.add" }));
+ expect(screen.getByRole("menuitemcheckbox", { name: "editor.markdown-mode" })).toHaveAttribute("aria-checked", "true");
+ });
+
+ it("switches without changing the text", () => {
+ const markdown = "# Plan\n\n- [ ] Ship **it**";
+ cacheService.saveNow(cacheService.key("users/1", draftKeyFor({ kind: "new", scope: CACHE_KEY })), {
+ content: markdown,
+ attachments: [],
+ });
+ const { container } = mount();
+ const toggle = () => {
+ fireEvent.click(screen.getByRole("button", { name: "common.add" }));
+ fireEvent.click(screen.getByRole("menuitemcheckbox", { name: "editor.markdown-mode" }));
+ };
+
+ toggle();
+ expect(sourceLines(container)).toBe(markdown);
+
+ toggle();
+ expect(sourceText(container)).toBeNull();
+ expect(screen.getByRole("heading", { level: 1 })).toHaveTextContent("Plan");
+
+ // Rich mode shows no Markdown string, so the source text after a third switch is the round trip's result.
+ toggle();
+ expect(sourceLines(container)).toBe(markdown);
});
- it.each([
- ["rich", true],
- ["source", false],
- ])("offers the checklist suggestion in %s mode: %s", async (mode, offered) => {
+ it.each(["rich", "source"])("offers the checklist suggestion in %s mode and applies it there", async (mode) => {
localStorage.setItem(MODE_KEY, JSON.stringify(mode));
cacheService.saveNow(cacheService.key("users/1", draftKeyFor({ kind: "new", scope: CACHE_KEY })), {
content: "Groceries",
attachments: [],
});
- mount([
+ const { container } = mount([
{ id: "tag:food", source: "view", kind: "tag", tag: "food" },
{ id: "checklist", source: "view", kind: "checklist" },
]);
- // The tag chip works in both modes, so the bar renders either way and only the checklist chip differs.
await waitFor(() => expect(screen.getByRole("button", { name: "common.add #food" })).toBeInTheDocument());
- expect(screen.queryByRole("button", { name: "editor.format.task-list" }) !== null).toBe(offered);
+ fireEvent.click(screen.getByRole("button", { name: "editor.format.task-list" }));
+
+ // In source mode the chip is a text edit; in rich mode it changes the block. Both save the same Markdown.
+ await waitFor(() => expect(screen.queryByRole("button", { name: "editor.format.task-list" })).not.toBeInTheDocument());
+ if (mode === "source") expect(sourceLines(container)).toBe("- [ ] Groceries");
+ else expect(container.querySelector(".memo-editor-root input[type=checkbox]")).not.toBeNull();
});
});