mirror of
https://github.com/usememos/memos.git
synced 2026-11-19 10:29:11 +01:00
feat(markup): annotate images and unify canvas editing
Preserve source images and retain acknowledged uploads for retries. Share the canvas between viewing and editing to preserve the viewport.
This commit is contained in:
@@ -14,6 +14,10 @@ behavior; a design document does not have to.
|
||||
|
||||
## Index
|
||||
|
||||
Implemented, awaiting release:
|
||||
|
||||
- [Markup: image annotation and saving](drawing-annotation-and-recovery.md)
|
||||
|
||||
Implemented and frozen:
|
||||
|
||||
- [API abuse controls](api-abuse-controls.md)
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
# Markup: first release
|
||||
|
||||
Status: Implemented; awaiting a tagged release.
|
||||
|
||||
Date: 2026-11-15
|
||||
|
||||
Related: [MemoEditor](../../web/src/components/MemoEditor/README.md),
|
||||
[Canvas product definition](https://github.com/usememos/canvas/blob/main/docs/product-definition.md),
|
||||
[Canvas checkpoint contract](https://github.com/usememos/canvas/blob/main/docs/recovery-checkpoints.md).
|
||||
|
||||
## Decision and scope
|
||||
|
||||
Markup lets someone sketch an idea or mark a detail in an image, then attach the result to a memo. The first release completes
|
||||
these actions and keeps the interface small. Use **Markup** (Chinese: **标注**) with Lucide's **Palette** icon. Canvas remains the
|
||||
library name; the editable PNG format and existing resource names do not change.
|
||||
|
||||
Memos draft recovery is deferred. Do not add IndexedDB persistence, recovery notices, Continue markup, or a draft-management UI.
|
||||
An unfinished markup must not disable the containing memo's save. Canvas 26.11.3 retains its checkpoint capability for a future
|
||||
integration, but this release does not expose a Memos markup draft.
|
||||
|
||||
Keep one primary action and let the current context carry its meaning. Do not add a permanent More, Download or Discard menu,
|
||||
status rows, or routine success copy.
|
||||
|
||||
## Critical user journeys
|
||||
|
||||
### Sketch and add
|
||||
|
||||
The editor's insert menu offers Palette + Markup. It opens a blank drawing. **Add** exports an editable `.canvas.png` into the
|
||||
current memo's pending attachments. The memo's existing Save uploads it. Adding explanatory text is optional.
|
||||
|
||||
### Annotate an image
|
||||
|
||||
An ordinary local or instance-hosted image offers Palette + Markup. Saved image previews offer it when the current user can edit
|
||||
the memo. External images, motion-photo/video groups, standalone attachment-library editing, and replacing inline image references
|
||||
are outside this release.
|
||||
|
||||
Load the original file, never the thumbnail. Prevent duplicate opens, abort a dismissed load, and ignore late responses. A failed import keeps the source available and must not produce an apparently editable blank sheet. Fetching an existing attachment in the viewer shows a centered spinner before its canvas mounts; preparing a background image uses the existing primary action's spinner. Viewer fetch failures close the loading surface and show an error toast. Background preparation failures disable drawing and submission, with an error toast and a labeled retry icon whose tooltip explains the failure.
|
||||
|
||||
Insert the image as a locked background, then call `setScene(getScene())` to establish a clean baseline and clear its insertion
|
||||
undo step. `markSaved()` alone would leave Undo able to remove the background. Fit the image and start with red ink from the
|
||||
existing palette. Keep the library's 1440 px import cap and opaque-image JPEG policy; this is not full-resolution image editing.
|
||||
|
||||
The first annotation is a new editable PNG immediately after its source. Keep the original's bytes, identity and position. The PNG
|
||||
embeds its background, so subsequent edits do not require the source to remain available.
|
||||
|
||||
Inside an editor, **Add** joins the pending files. From a saved image preview, **Save copy** uploads and binds the annotation to
|
||||
that memo. Read current membership before binding or retrying, retain other attachments, and stop if the source has disappeared.
|
||||
Do not open a separate composer or save unrelated edits.
|
||||
|
||||
### Edit and save
|
||||
|
||||
Existing editable PNGs offer **Edit markup**. In the editor, **Save** updates the pending drawing; an owned saved attachment queues a
|
||||
replacement for the outer memo save. A file the user cannot replace remains intact and the result becomes a copy. In a saved
|
||||
markup viewer, **Save** replaces the owned attachment and updates the memo; **Save copy** retains an attachment the user cannot
|
||||
replace. Existing permission and upload APIs remain authoritative.
|
||||
|
||||
## Actions and exceptions
|
||||
|
||||
| Context | Primary action |
|
||||
| --- | --- |
|
||||
| New sketch or first annotation in the editor | Add |
|
||||
| Edit a pending drawing or queue an owned attachment replacement | Save |
|
||||
| Edit an owned drawing directly from its viewer | Save |
|
||||
| Direct image annotation or a direct edit requiring a new attachment | Save copy |
|
||||
|
||||
Use the same short translated labels on loading buttons. Do not repeat the destination in the visible text. Existing attachment
|
||||
New/Edited treatment identifies pending work in the composer. Export, adding a file to the editor, and server acceptance remain
|
||||
separate implementation states; normal states add no copy to the canvas.
|
||||
|
||||
Freeze the engine with `setReadOnly(true)` before export/submission. Block repeated submissions, scene replacement and editing
|
||||
until the result is known. Acknowledge with `markSaved()` only after the host accepts, while still frozen. On failure retain the
|
||||
scene and resume editing; after an acknowledged upload with a failed bind/timestamp, keep that revision frozen and retry only the
|
||||
remaining operation. Surface partial failure with an exception icon/tooltip and the existing error toast. No overall Saved claim
|
||||
until every required request is acknowledged.
|
||||
|
||||
Close unchanged work directly. Close changed work through a discard confirmation, with **Keep drawing** and **Discard**. This is
|
||||
the only ordinary discard action; it appears when the user is about to lose unsaved changes. Do not close during a server write.
|
||||
This release retains unsuccessful work in memory while the sheet is open; it does not claim recovery after reload or closure.
|
||||
|
||||
## Shared viewing and editing surface
|
||||
|
||||
Viewing and editing are modes of one Markup surface. Keep the same dialog, paper, canvas instance and control sizes when switching modes. Entering edit must preserve the visible content, pan and zoom; saving or closing unchanged edits returns to the same view. Discard restores the accepted scene and may fit it again. Do not mount a second dialog or measure a new canvas while the previous dialog is closing.
|
||||
|
||||
The top row is the same in both modes: a quiet X at the left and the current action at the right. The viewing action is Palette + **Edit** when permitted; editing replaces it with **Add**, **Save** or **Save copy**. Use no bordered container around these actions and no visible mode heading. The accessible dialog name remains Markup; icon labels and tooltips explain secondary actions. Viewing exposes no editing controls or save status.
|
||||
|
||||
Canvas navigation is separate from closing or saving. Display the current zoom as a rounded percentage (for example **100%**) on a ghost button that opens an upward action menu. Place it at the bottom left on desktop and above the bottom tools bar on phones, accounting for the safe area. Keep the same position in viewing and editing, including the space above the phone's tools bar when that bar is absent. Its idle state has no fill or bordered container. The percentage stays synchronized with menu actions, wheel/trackpad zoom, touch pinches, initial fitting and background-image preparation; changing zoom never makes the drawing dirty.
|
||||
|
||||
The menu contains **Zoom in**, **Zoom out**, a separator, **Zoom to fit** and **Reset zoom** (100%). Use Plus, Minus, ScanSearch and RotateCcw icons, respectively. The percentage replaces the standalone Fit button; names appear only in the menu and accessible label. Keep the same menu and actions in viewing and editing. Use the package's md Menu, retain focus in the dialog and let Escape dismiss the menu before affecting the drawing. Suspend canvas input while the menu is open so clicking the paper dismisses it without drawing or panning. Do not add selection zoom or a minimap in this first release. This follows Excalidraw's [zoom-to-fit magnifier and area icon](https://github.com/excalidraw/excalidraw/blob/master/packages/excalidraw/components/icons.tsx) and tldraw's [separate canvas navigation region](https://tldraw.dev/sdk-features/ui-components).
|
||||
|
||||
Editing adds the existing bordered tools bar at the top center on desktop and at the bottom on phones. Available phone Undo/Redo controls follow X as plain ghost icons; they have no separate container and unavailable history actions are omitted. Desktop history and image insertion stay in the editing tools bar. Do not add controls or permanent status text to make the two modes match.
|
||||
|
||||
Keep focus inside the dialog across mode changes: entering edit focuses the canvas; returning to view focuses Edit, or the canvas when Edit is unavailable. After a phone history action, focus returns to the canvas rather than a removed control. Close follows the existing unchanged/discard behavior.
|
||||
|
||||
## Retry and concurrency
|
||||
|
||||
Keep acknowledged uploads in memory. A copy whose bind failed is bound again without another upload. A replacement whose timestamp
|
||||
update failed retries the memo update. If memo text saved before a replacement failed, keep the replacement pending and say which
|
||||
part needs retry. Re-read membership for list-changing retries so another tab's attachment is retained. API calls are not an atomic
|
||||
cross-resource transaction and an unacknowledged response does not provide an exactly-once guarantee.
|
||||
|
||||
## Ownership and verification
|
||||
|
||||
Canvas owns drawing, text input, scene serialization, locked backgrounds and editable PNG export. Memos owns the shell, strings,
|
||||
permissions, placement and save orchestration. Pin `@usememos/canvas@26.11.3`; no backend schema or release workflow changes.
|
||||
|
||||
Extend neighboring drawing, viewer, image-preview, attachment-placement and memo-save tests. The browser suite exercises actual
|
||||
Canvas image preparation, annotation/export, original preservation and 360px controls. Cover viewing an existing drawing, entering edit, retaining visible content and viewport, returning without changes, discarding changes, saving, repeated mode changes and keyboard focus on desktop and phones. Check the zoom percentage's identical lower-left position in both modes, clearance above the phone tools bar, live zoom updates and all four menu actions in both modes, including keyboard dismissal and zoom without scene changes. It uses an isolated Vite server and cache;
|
||||
Playwright is a development dependency only.
|
||||
|
||||
From `web/`, run `pnpm lint`, `pnpm test`, `pnpm build`, and `pnpm test:drawings` (`pnpm exec playwright install chromium` once).
|
||||
Browser emulation does not establish real-device pen, keyboard or mobile suspension behavior.
|
||||
|
||||
## Deferred recovery
|
||||
|
||||
A later Memos integration can use Canvas `getCheckpoint()`, `restoreCheckpoint()` and `onCheckpoint`. It needs a separate product
|
||||
decision for discovering unfinished work, retaining companion text/files and upload progress, account/session identity, conflicts,
|
||||
storage failures and cleanup. Do not reintroduce that UI as part of this first release.
|
||||
+3
-1
@@ -13,6 +13,7 @@
|
||||
"lint:fix": "biome check --write src tests",
|
||||
"format": "biome format --write src tests",
|
||||
"test": "vitest run",
|
||||
"test:drawings": "playwright test --config tests/browser/playwright.config.ts",
|
||||
"test:watch": "vitest",
|
||||
"test:coverage": "vitest run --coverage"
|
||||
},
|
||||
@@ -26,7 +27,7 @@
|
||||
"@tailwindcss/vite": "^4.2.4",
|
||||
"@tanstack/react-query": "^5.100.9",
|
||||
"@tanstack/react-query-devtools": "^5.100.9",
|
||||
"@usememos/canvas": "26.11.2",
|
||||
"@usememos/canvas": "26.11.3",
|
||||
"@usememos/editor": "26.11.5",
|
||||
"@usememos/ui": "26.11.20",
|
||||
"class-variance-authority": "^0.7.1",
|
||||
@@ -58,6 +59,7 @@
|
||||
"@babel/core": "7.29.0",
|
||||
"@biomejs/biome": "^2.4.14",
|
||||
"@bufbuild/protobuf": "^2.12.0",
|
||||
"@playwright/test": "1.63.0",
|
||||
"@rolldown/plugin-babel": "0.2.3",
|
||||
"@testing-library/jest-dom": "^6.9.1",
|
||||
"@testing-library/react": "^16.3.2",
|
||||
|
||||
Generated
+33
-5
@@ -39,8 +39,8 @@ importers:
|
||||
specifier: ^5.100.9
|
||||
version: 5.100.9(@tanstack/react-query@5.100.9(react@19.2.6))(react@19.2.6)
|
||||
'@usememos/canvas':
|
||||
specifier: 26.11.2
|
||||
version: 26.11.2(react-dom@19.2.6(react@19.2.6))(react@19.2.6)
|
||||
specifier: 26.11.3
|
||||
version: 26.11.3(react-dom@19.2.6(react@19.2.6))(react@19.2.6)
|
||||
'@usememos/editor':
|
||||
specifier: 26.11.5
|
||||
version: 26.11.5(react-dom@19.2.6(react@19.2.6))(react@19.2.6)
|
||||
@@ -129,6 +129,9 @@ importers:
|
||||
'@bufbuild/protobuf':
|
||||
specifier: ^2.12.0
|
||||
version: 2.12.0(patch_hash=9d60cec35402ba36bc21a72fefc68ccef8db0acb883504cc47c05a00a0029f8c)
|
||||
'@playwright/test':
|
||||
specifier: 1.63.0
|
||||
version: 1.63.0
|
||||
'@rolldown/plugin-babel':
|
||||
specifier: 0.2.3
|
||||
version: 0.2.3(@babel/core@7.29.0)(@babel/runtime@7.29.7)(rolldown@1.0.0-rc.18)(vite@8.0.11(@types/node@24.12.2)(jiti@2.6.1))
|
||||
@@ -516,6 +519,11 @@ packages:
|
||||
'@pierre/highlights@0.3.0':
|
||||
resolution: {integrity: sha512-s6xZ/giPPrSeCO2w254GiysUXD4ditKMTOrl1vHynvPqP7VdlujYi01O9joxJ0T16XkoXGQMN6zkRi9+O8NCzg==}
|
||||
|
||||
'@playwright/test@1.63.0':
|
||||
resolution: {integrity: sha512-oxMK4vllB9RK5NQ2l1pq1IfOf2AvnEuj/vYGDj0H2nMtmtZpKtCwt/l00GEO6xjGfpBNAvjovvYdCm50dRQkpQ==}
|
||||
engines: {node: '>=20'}
|
||||
hasBin: true
|
||||
|
||||
'@react-leaflet/core@3.0.0':
|
||||
resolution: {integrity: sha512-3EWmekh4Nz+pGcr+xjf0KNyYfC3U2JjnkWsh0zcqaexYqmmB5ZhH37kz41JXGmKzpaMZCnPofBBm64i+YrEvGQ==}
|
||||
peerDependencies:
|
||||
@@ -951,8 +959,8 @@ packages:
|
||||
cpu: [x64]
|
||||
os: [win32]
|
||||
|
||||
'@usememos/canvas@26.11.2':
|
||||
resolution: {integrity: sha512-sgFrRUSUz5qq3JMiVqPVsLd8NPL+nmWfuEG45mpjbvBbPRxHdKSzNVYc6DwokG/Z670zJI3gDc5Lfsi75QYvGw==}
|
||||
'@usememos/canvas@26.11.3':
|
||||
resolution: {integrity: sha512-KMIGsm/1afZpSuV2uILNBmB9rTUNpplhcCI6A7IsP+2kQUVGNcVOsTFIfSyVyqcrUdTKgnbt+XlfG1NwRhi3SA==}
|
||||
peerDependencies:
|
||||
react: '>=18'
|
||||
react-dom: '>=18'
|
||||
@@ -1404,6 +1412,16 @@ packages:
|
||||
resolution: {integrity: sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==}
|
||||
engines: {node: '>=12'}
|
||||
|
||||
playwright-core@1.63.0:
|
||||
resolution: {integrity: sha512-rYCsBF/M5HjUch52bbtVONEFjv6Xu8sm8h72dNlR5bzIE1fvC/bxgspzkjSfU+MweEMmPM8KJebG6nnyxo5mCg==}
|
||||
engines: {node: '>=20'}
|
||||
hasBin: true
|
||||
|
||||
playwright@1.63.0:
|
||||
resolution: {integrity: sha512-+7ziBLidS4NaNCdt57SUDT+wYmmd5fmiQejUic/kb+YsYSCPyOOE9sebzMjNmQrsnNpDJqd4WHvV/8lfKfUDUg==}
|
||||
engines: {node: '>=20'}
|
||||
hasBin: true
|
||||
|
||||
postcss@8.5.14:
|
||||
resolution: {integrity: sha512-SoSL4+OSEtR99LHFZQiJLkT59C5B1amGO1NzTwj7TT1qCUgUO6hxOvzkOYxD+vMrXBM3XJIKzokoERdqQq/Zmg==}
|
||||
engines: {node: ^10 || ^12 || >=14}
|
||||
@@ -2075,6 +2093,10 @@ snapshots:
|
||||
|
||||
'@pierre/highlights@0.3.0': {}
|
||||
|
||||
'@playwright/test@1.63.0':
|
||||
dependencies:
|
||||
playwright: 1.63.0
|
||||
|
||||
'@react-leaflet/core@3.0.0(leaflet@1.9.4)(react-dom@19.2.6(react@19.2.6))(react@19.2.6)':
|
||||
dependencies:
|
||||
leaflet: 1.9.4
|
||||
@@ -2382,7 +2404,7 @@ snapshots:
|
||||
'@typescript/typescript-win32-x64@7.0.2':
|
||||
optional: true
|
||||
|
||||
'@usememos/canvas@26.11.2(react-dom@19.2.6(react@19.2.6))(react@19.2.6)':
|
||||
'@usememos/canvas@26.11.3(react-dom@19.2.6(react@19.2.6))(react@19.2.6)':
|
||||
optionalDependencies:
|
||||
react: 19.2.6
|
||||
react-dom: 19.2.6(react@19.2.6)
|
||||
@@ -2753,6 +2775,12 @@ snapshots:
|
||||
|
||||
picomatch@4.0.4: {}
|
||||
|
||||
playwright-core@1.63.0: {}
|
||||
|
||||
playwright@1.63.0:
|
||||
dependencies:
|
||||
playwright-core: 1.63.0
|
||||
|
||||
postcss@8.5.14:
|
||||
dependencies:
|
||||
nanoid: 3.3.11
|
||||
|
||||
@@ -1,18 +1,24 @@
|
||||
import { type CanvasError, type CanvasHandle, drawingFileName, type Scene, type ToolName } from "@usememos/canvas";
|
||||
import { type CanvasError, type CanvasHandle, drawingFileName, MAX_ZOOM, MIN_ZOOM, type Scene, type ToolName } from "@usememos/canvas";
|
||||
import { Canvas } from "@usememos/canvas/react";
|
||||
import { AlertDialog, Button, Dialog, Popover, Toggle, ToggleGroup, Tooltip } from "@usememos/ui";
|
||||
import { AlertDialog, Button, Dialog, Menu, Popover, Spinner, Toggle, ToggleGroup, Tooltip } from "@usememos/ui";
|
||||
import {
|
||||
CircleAlertIcon,
|
||||
CircleIcon,
|
||||
EraserIcon,
|
||||
ImagePlusIcon,
|
||||
MinusIcon,
|
||||
MousePointer2Icon,
|
||||
MoveUpRightIcon,
|
||||
PaletteIcon,
|
||||
PencilIcon,
|
||||
PlusIcon,
|
||||
Redo2Icon,
|
||||
ScanIcon,
|
||||
RotateCcwIcon,
|
||||
ScanSearchIcon,
|
||||
SquareIcon,
|
||||
TypeIcon,
|
||||
Undo2Icon,
|
||||
XIcon,
|
||||
} from "lucide-react";
|
||||
import { type ClipboardEvent, type ReactElement, useEffect, useRef, useState } from "react";
|
||||
import useMediaQuery from "@/hooks/useMediaQuery";
|
||||
@@ -21,6 +27,7 @@ import { cn } from "@/lib/utils";
|
||||
import { type Translations, useTranslate } from "@/utils/i18n";
|
||||
import { primaryModifierGlyph } from "@/utils/platform";
|
||||
import { DrawingDialogPopup, FloatingAction, FloatingBar, FloatingRow } from "./DrawingFrame";
|
||||
import { DrawingActionError } from "./drawing";
|
||||
import { DRAWING_HUES, useCanvasTheme } from "./useCanvasTheme";
|
||||
|
||||
const TOOLS: { name: ToolName; label: Translations; shortcut: string; icon: ReactElement }[] = [
|
||||
@@ -42,15 +49,21 @@ const WIDTHS: { value: number; label: Translations }[] = [
|
||||
];
|
||||
|
||||
export interface DrawingSheetProps {
|
||||
/** `edit` reopens a saved drawing; it changes the sheet's name and the discard prompt. */
|
||||
mode: "new" | "edit";
|
||||
mode: "new" | "edit" | "view";
|
||||
/** Present only when the viewer permits editing. */
|
||||
onEdit?: () => void;
|
||||
loading?: boolean;
|
||||
/** The scene read from the drawing's original file. */
|
||||
initialScene?: Scene;
|
||||
commitLabel?: Translations;
|
||||
/** Returns the accepted scene when an acknowledged upload has already replaced the source. */
|
||||
onDiscard?: () => Scene | void | Promise<Scene | void>;
|
||||
submissionPending?: boolean;
|
||||
/** A picture to draw on: a file named like a drawing whose scene could not be read. */
|
||||
background?: Blob;
|
||||
/**
|
||||
* The finished drawing, a PNG with the scene embedded, named `drawing-YYYYMMDD-HHMMSS.canvas.png`.
|
||||
* A promise keeps Done busy until it settles; a rejection keeps the sheet open to retry.
|
||||
* A promise keeps the action busy until it settles; a rejection keeps the sheet open to retry.
|
||||
*/
|
||||
onDone: (file: File) => void | Promise<void>;
|
||||
onClose: () => void;
|
||||
@@ -62,7 +75,18 @@ export interface DrawingSheetProps {
|
||||
* theme, discard prompt) is memos'. On a phone the tools float at the bottom, in thumb
|
||||
* reach, with each control 44 px apart.
|
||||
*/
|
||||
const DrawingSheet = ({ mode, initialScene, background, onDone, onClose }: DrawingSheetProps) => {
|
||||
const DrawingSheet = ({
|
||||
mode,
|
||||
onEdit,
|
||||
loading = false,
|
||||
initialScene,
|
||||
background,
|
||||
commitLabel,
|
||||
onDiscard,
|
||||
submissionPending,
|
||||
onDone,
|
||||
onClose,
|
||||
}: DrawingSheetProps) => {
|
||||
const t = useTranslate();
|
||||
const isWide = useMediaQuery("sm");
|
||||
// Small controls on a desktop; a phone keeps the 32px ones, 44px apart, for touch.
|
||||
@@ -71,39 +95,109 @@ const DrawingSheet = ({ mode, initialScene, background, onDone, onClose }: Drawi
|
||||
const canvasRef = useRef<CanvasHandle | null>(null);
|
||||
const surfaceRef = useRef<HTMLDivElement>(null);
|
||||
const fileInputRef = useRef<HTMLInputElement>(null);
|
||||
const editButtonRef = useRef<HTMLButtonElement>(null);
|
||||
const isViewing = mode === "view";
|
||||
const [tool, setTool] = useState<ToolName>("pen");
|
||||
const [history, setHistory] = useState({ undo: false, redo: false });
|
||||
const [zoom, setZoom] = useState(1);
|
||||
const [zoomMenuOpen, setZoomMenuOpen] = useState(false);
|
||||
const zoomFrame = useRef<number | undefined>(undefined);
|
||||
// Null follows the theme's ink, so a drawing started in one theme keeps reading in the other.
|
||||
const [color, setColor] = useState<string | null>(null);
|
||||
const [color, setColor] = useState<string | null>(background ? "#e03131" : null);
|
||||
const [width, setWidth] = useState(2);
|
||||
const [isExporting, setIsExporting] = useState(false);
|
||||
const [discardOpen, setDiscardOpen] = useState(false);
|
||||
// Drawing waits for a background picture, so no stroke can land before it and be marked saved with it.
|
||||
const [isPreparing, setIsPreparing] = useState(Boolean(background));
|
||||
const title = t(mode === "edit" ? "editor.drawing.edit" : "editor.drawing.new-title");
|
||||
const [commitError, setCommitError] = useState<Translations>();
|
||||
const [prepareFailed, setPrepareFailed] = useState(false);
|
||||
const busy = useRef(false);
|
||||
const locked = useRef(submissionPending);
|
||||
locked.current = isViewing || submissionPending;
|
||||
const preparing = useRef(Boolean(background));
|
||||
const alive = useRef(true);
|
||||
const actionLabel = commitLabel ?? (mode === "edit" ? "common.save" : "common.add");
|
||||
const title = t("editor.insert-menu.drawing");
|
||||
const currentColor = color ?? ink;
|
||||
|
||||
// Runs once the canvas has mounted (see CanvasMounted): the pen is ready, and a
|
||||
// picture without a scene becomes the drawing's locked background.
|
||||
const setUpCanvas = () => {
|
||||
useEffect(() => {
|
||||
alive.current = true;
|
||||
return () => {
|
||||
alive.current = false;
|
||||
if (zoomFrame.current !== undefined) cancelAnimationFrame(zoomFrame.current);
|
||||
};
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (isViewing) {
|
||||
if (editButtonRef.current) editButtonRef.current.focus();
|
||||
else canvasRef.current?.focus();
|
||||
} else {
|
||||
canvasRef.current?.setTool("pen");
|
||||
setTool("pen");
|
||||
setHistory({ undo: Boolean(canvasRef.current?.canUndo()), redo: Boolean(canvasRef.current?.canRedo()) });
|
||||
canvasRef.current?.focus();
|
||||
}
|
||||
}, [isViewing]);
|
||||
|
||||
const setUpCanvas = async () => {
|
||||
const canvas = canvasRef.current;
|
||||
if (!canvas) return;
|
||||
canvas.setTool("pen");
|
||||
if (!isViewing) canvas.setTool("pen");
|
||||
syncZoom();
|
||||
if (!background) return;
|
||||
canvas
|
||||
.insertImage(background, { background: true })
|
||||
.then(() => {
|
||||
// The picture is where the drawing starts, not a change to discard.
|
||||
canvas.markSaved();
|
||||
canvas.zoomToFit();
|
||||
})
|
||||
.catch(() => showErrorToast(t("editor.drawing.image-failed")))
|
||||
.finally(() => setIsPreparing(false));
|
||||
preparing.current = true;
|
||||
setIsPreparing(true);
|
||||
setPrepareFailed(false);
|
||||
canvas.setReadOnly(false);
|
||||
try {
|
||||
// The inert surface blocks user input while the import establishes its baseline.
|
||||
const id = await canvas.insertImage(background, { background: true });
|
||||
if (!alive.current) return;
|
||||
if (!id) throw new Error("Image preparation failed");
|
||||
canvas.setScene(canvas.getScene());
|
||||
canvas.setStyle({ strokeColor: "#e03131" });
|
||||
setColor("#e03131");
|
||||
canvas.zoomToFit();
|
||||
syncZoom();
|
||||
preparing.current = false;
|
||||
canvas.setReadOnly(false);
|
||||
} catch {
|
||||
if (alive.current) {
|
||||
setPrepareFailed(true);
|
||||
showErrorToast(t("editor.drawing.image-failed"));
|
||||
}
|
||||
} finally {
|
||||
if (alive.current) setIsPreparing(false);
|
||||
}
|
||||
};
|
||||
|
||||
const syncHistory = () => {
|
||||
const canvas = canvasRef.current;
|
||||
setHistory({ undo: Boolean(canvas?.canUndo()), redo: Boolean(canvas?.canRedo()) });
|
||||
syncZoom();
|
||||
};
|
||||
|
||||
const syncZoom = () => {
|
||||
const canvas = canvasRef.current;
|
||||
if (canvas) setZoom(canvas.getViewport().zoom);
|
||||
};
|
||||
|
||||
const scheduleZoom = () => {
|
||||
if (zoomFrame.current !== undefined) return;
|
||||
zoomFrame.current = requestAnimationFrame(() => {
|
||||
zoomFrame.current = undefined;
|
||||
syncZoom();
|
||||
});
|
||||
};
|
||||
|
||||
const changeZoom = (factor: number) => {
|
||||
const canvas = canvasRef.current;
|
||||
if (!canvas) return;
|
||||
canvas.zoomTo(canvas.getViewport().zoom * factor);
|
||||
syncZoom();
|
||||
};
|
||||
|
||||
const handleCanvasError = (error: CanvasError) => {
|
||||
@@ -114,16 +208,19 @@ const DrawingSheet = ({ mode, initialScene, background, onDone, onClose }: Drawi
|
||||
};
|
||||
|
||||
const chooseTool = (next: ToolName) => {
|
||||
if (isViewing || busy.current || preparing.current || prepareFailed || submissionPending) return;
|
||||
setTool(next);
|
||||
canvasRef.current?.setTool(next);
|
||||
};
|
||||
|
||||
const applyWidth = (strokeWidth: number) => {
|
||||
if (isViewing || busy.current || preparing.current || prepareFailed || submissionPending) return;
|
||||
canvasRef.current?.setStyle({ strokeWidth });
|
||||
setWidth(strokeWidth);
|
||||
};
|
||||
|
||||
const insertImages = (files: File[]) => {
|
||||
if (isViewing || busy.current || preparing.current || prepareFailed || submissionPending) return;
|
||||
for (const file of files.filter((candidate) => candidate.type.startsWith("image/"))) {
|
||||
canvasRef.current?.insertImage(file).catch(() => showErrorToast(t("editor.drawing.image-failed")));
|
||||
}
|
||||
@@ -135,32 +232,32 @@ const DrawingSheet = ({ mode, initialScene, background, onDone, onClose }: Drawi
|
||||
insertImages(Array.from(event.clipboardData.files));
|
||||
};
|
||||
|
||||
// Cancel, Escape and the system back gesture all ask first when the drawing has changes.
|
||||
const requestClose = () => {
|
||||
if (canvasRef.current?.isDirty()) {
|
||||
setDiscardOpen(true);
|
||||
return;
|
||||
}
|
||||
onClose();
|
||||
if (busy.current) return;
|
||||
if (!isViewing && canvasRef.current?.isDirty()) setDiscardOpen(true);
|
||||
else onClose();
|
||||
};
|
||||
|
||||
const handleDone = async () => {
|
||||
const canvas = canvasRef.current;
|
||||
if (!canvas || isExporting || isPreparing) return;
|
||||
// Text still being typed is part of the drawing.
|
||||
canvas.commitText();
|
||||
if (!canvas || isViewing || busy.current || preparing.current || prepareFailed) return;
|
||||
busy.current = true;
|
||||
setIsExporting(true);
|
||||
canvas.setReadOnly(true);
|
||||
setCommitError(undefined);
|
||||
try {
|
||||
const blob = await canvas.exportPng();
|
||||
await onDone(new File([blob], drawingFileName(), { type: "image/png" }));
|
||||
// Only once Done went through: after a failed save, Cancel still asks before discarding.
|
||||
// The host may have closed the sheet already.
|
||||
canvasRef.current?.markSaved();
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
showErrorToast(t("editor.drawing.export-failed"));
|
||||
const label = error instanceof DrawingActionError ? error.label : "editor.drawing.export-failed";
|
||||
setCommitError(label);
|
||||
showErrorToast(t(label));
|
||||
} finally {
|
||||
setIsExporting(false);
|
||||
busy.current = false;
|
||||
canvasRef.current?.setReadOnly(Boolean(locked.current));
|
||||
if (alive.current) setIsExporting(false);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -174,6 +271,7 @@ const DrawingSheet = ({ mode, initialScene, background, onDone, onClose }: Drawi
|
||||
size={size}
|
||||
aria-label={t(item.label)}
|
||||
icon={item.icon}
|
||||
disabled={isExporting || isPreparing || prepareFailed || submissionPending}
|
||||
pressed={tool === item.name}
|
||||
onPressedChange={() => chooseTool(item.name)}
|
||||
/>
|
||||
@@ -196,6 +294,7 @@ const DrawingSheet = ({ mode, initialScene, background, onDone, onClose }: Drawi
|
||||
<Button
|
||||
variant="ghost"
|
||||
size={size}
|
||||
disabled={isExporting || isPreparing || prepareFailed || submissionPending}
|
||||
aria-label={t("editor.drawing.style")}
|
||||
icon={<CircleIcon style={{ color: currentColor, fill: currentColor }} />}
|
||||
/>
|
||||
@@ -255,57 +354,80 @@ const DrawingSheet = ({ mode, initialScene, background, onDone, onClose }: Drawi
|
||||
const modifier = primaryModifierGlyph();
|
||||
const historyControls = (
|
||||
<>
|
||||
<IconAction
|
||||
size={size}
|
||||
label={t("editor.drawing.undo")}
|
||||
shortcut={`${modifier} Z`}
|
||||
icon={<Undo2Icon />}
|
||||
disabled={!history.undo}
|
||||
onClick={() => {
|
||||
canvasRef.current?.undo();
|
||||
syncHistory();
|
||||
}}
|
||||
/>
|
||||
<IconAction
|
||||
size={size}
|
||||
label={t("editor.drawing.redo")}
|
||||
shortcut={`⇧ ${modifier} Z`}
|
||||
icon={<Redo2Icon />}
|
||||
disabled={!history.redo}
|
||||
onClick={() => {
|
||||
canvasRef.current?.redo();
|
||||
syncHistory();
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
const viewControls = (
|
||||
<>
|
||||
<IconAction size={size} label={t("editor.drawing.zoom-to-fit")} icon={<ScanIcon />} onClick={() => canvasRef.current?.zoomToFit()} />
|
||||
<IconAction
|
||||
size={size}
|
||||
label={t("editor.insert-menu.insert-image")}
|
||||
icon={<ImagePlusIcon />}
|
||||
onClick={() => fileInputRef.current?.click()}
|
||||
/>
|
||||
{(isWide || history.undo) && (
|
||||
<IconAction
|
||||
size={size}
|
||||
label={t("editor.drawing.undo")}
|
||||
shortcut={`${modifier} Z`}
|
||||
icon={<Undo2Icon />}
|
||||
disabled={!history.undo || isExporting || isPreparing || prepareFailed || submissionPending}
|
||||
onClick={() => {
|
||||
canvasRef.current?.undo();
|
||||
syncHistory();
|
||||
if (!isWide) canvasRef.current?.focus();
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{(isWide || history.redo) && (
|
||||
<IconAction
|
||||
size={size}
|
||||
label={t("editor.drawing.redo")}
|
||||
shortcut={`⇧ ${modifier} Z`}
|
||||
icon={<Redo2Icon />}
|
||||
disabled={!history.redo || isExporting || isPreparing || prepareFailed || submissionPending}
|
||||
onClick={() => {
|
||||
canvasRef.current?.redo();
|
||||
syncHistory();
|
||||
if (!isWide) canvasRef.current?.focus();
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
const cancelButton = (
|
||||
<Button variant="ghost" size={size} onClick={requestClose}>
|
||||
{t("common.cancel")}
|
||||
</Button>
|
||||
<div className="flex items-center gap-1" data-theme="light">
|
||||
<Tooltip.Root>
|
||||
<Tooltip.Trigger
|
||||
render={
|
||||
<Button
|
||||
variant="ghost"
|
||||
size={size}
|
||||
aria-label={t("common.close")}
|
||||
icon={<XIcon />}
|
||||
onClick={() => void requestClose()}
|
||||
disabled={isExporting}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
<Tooltip.Popup>{t("common.close")}</Tooltip.Popup>
|
||||
</Tooltip.Root>
|
||||
</div>
|
||||
);
|
||||
const exception = prepareFailed || commitError;
|
||||
const doneButton = (
|
||||
<Button
|
||||
variant="primary"
|
||||
size={size}
|
||||
onClick={handleDone}
|
||||
disabled={isPreparing}
|
||||
loading={isExporting}
|
||||
loadingLabel={t("editor.drawing.done")}
|
||||
>
|
||||
{t("editor.drawing.done")}
|
||||
</Button>
|
||||
<div className="flex items-center gap-1" data-theme="light">
|
||||
{exception && (
|
||||
<IconAction
|
||||
size={size}
|
||||
label={t(prepareFailed ? "editor.drawing.image-failed" : (commitError ?? "editor.drawing.export-failed"))}
|
||||
icon={<CircleAlertIcon />}
|
||||
disabled={isExporting}
|
||||
onClick={() => {
|
||||
if (prepareFailed) void setUpCanvas();
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
<Button
|
||||
variant="primary"
|
||||
size={size}
|
||||
onClick={handleDone}
|
||||
disabled={isPreparing || prepareFailed}
|
||||
loading={isExporting || isPreparing}
|
||||
loadingLabel={isPreparing ? t("editor.blocks.loading") : t(actionLabel)}
|
||||
>
|
||||
{t(actionLabel)}
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
|
||||
return (
|
||||
@@ -316,8 +438,9 @@ const DrawingSheet = ({ mode, initialScene, background, onDone, onClose }: Drawi
|
||||
// The sheet closes only through requestClose, which asks first when there are changes.
|
||||
eventDetails.cancel();
|
||||
// Escape on the drawing surface leaves the current tool or selection; it belongs to the canvas.
|
||||
const escapeOnSurface = eventDetails.reason === "escape-key" && surfaceRef.current?.contains(eventDetails.event.target as Node);
|
||||
if (!escapeOnSurface) requestClose();
|
||||
const escapeOnSurface =
|
||||
!isViewing && eventDetails.reason === "escape-key" && surfaceRef.current?.contains(eventDetails.event.target as Node);
|
||||
if (!escapeOnSurface) void requestClose();
|
||||
}}
|
||||
>
|
||||
<DrawingDialogPopup label={title}>
|
||||
@@ -328,29 +451,47 @@ const DrawingSheet = ({ mode, initialScene, background, onDone, onClose }: Drawi
|
||||
<div
|
||||
ref={surfaceRef}
|
||||
className={cn("absolute inset-0", isPreparing && "pointer-events-none")}
|
||||
inert={isPreparing || prepareFailed || zoomMenuOpen}
|
||||
aria-busy={isPreparing || undefined}
|
||||
onPointerUp={syncHistory}
|
||||
onPointerCancel={syncHistory}
|
||||
onPointerMove={scheduleZoom}
|
||||
onWheel={scheduleZoom}
|
||||
onKeyUp={syncHistory}
|
||||
>
|
||||
<Canvas
|
||||
ref={canvasRef}
|
||||
className="absolute inset-0"
|
||||
autoFocus
|
||||
ariaLabel={title}
|
||||
initialScene={initialScene}
|
||||
theme={theme}
|
||||
tools={TOOL_NAMES}
|
||||
fontFamily={fontFamily}
|
||||
onChange={syncHistory}
|
||||
onToolChange={setTool}
|
||||
onError={handleCanvasError}
|
||||
/>
|
||||
<CanvasMounted onMounted={setUpCanvas} />
|
||||
{loading ? (
|
||||
<div className="absolute inset-0 flex items-center justify-center">
|
||||
<Spinner label={t("editor.blocks.loading")} />
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
<Canvas
|
||||
ref={canvasRef}
|
||||
className="absolute inset-0"
|
||||
readOnly={isViewing || isExporting || prepareFailed || submissionPending}
|
||||
autoFocus={!isViewing && !background}
|
||||
ariaLabel={title}
|
||||
initialScene={initialScene}
|
||||
theme={theme}
|
||||
tools={TOOL_NAMES}
|
||||
fontFamily={fontFamily}
|
||||
onChange={syncHistory}
|
||||
onToolChange={setTool}
|
||||
onError={handleCanvasError}
|
||||
/>
|
||||
<CanvasMounted onMounted={setUpCanvas} />
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{isWide ? (
|
||||
<FloatingRow edge="top">
|
||||
<FloatingAction>{cancelButton}</FloatingAction>
|
||||
<FloatingRow edge="top" className="sm:min-h-[34px]">
|
||||
<FloatingAction>
|
||||
<div className="flex items-center gap-3 sm:gap-0.5">
|
||||
{cancelButton}
|
||||
{!isWide && !isViewing && historyControls}
|
||||
</div>
|
||||
</FloatingAction>
|
||||
{isWide && !isViewing && (
|
||||
<FloatingBar>
|
||||
{toolRow}
|
||||
<Divider />
|
||||
@@ -358,20 +499,72 @@ const DrawingSheet = ({ mode, initialScene, background, onDone, onClose }: Drawi
|
||||
<Divider />
|
||||
{historyControls}
|
||||
<Divider />
|
||||
{viewControls}
|
||||
<IconAction
|
||||
size={size}
|
||||
label={t("editor.insert-menu.insert-image")}
|
||||
icon={<ImagePlusIcon />}
|
||||
onClick={() => fileInputRef.current?.click()}
|
||||
/>
|
||||
</FloatingBar>
|
||||
<FloatingAction>{doneButton}</FloatingAction>
|
||||
</FloatingRow>
|
||||
) : (
|
||||
)}
|
||||
<FloatingAction>
|
||||
{isViewing
|
||||
? onEdit && (
|
||||
<Button ref={editButtonRef} variant="ghost" size={size} icon={<PaletteIcon />} disabled={loading} onClick={onEdit}>
|
||||
{t("common.edit")}
|
||||
</Button>
|
||||
)
|
||||
: doneButton}
|
||||
</FloatingAction>
|
||||
</FloatingRow>
|
||||
<FloatingRow edge="bottom" className="justify-start max-sm:bottom-[calc(64px+env(safe-area-inset-bottom))]">
|
||||
<FloatingAction>
|
||||
<Menu.Root size="md" open={zoomMenuOpen} onOpenChange={setZoomMenuOpen}>
|
||||
<Menu.Trigger
|
||||
render={
|
||||
<Button
|
||||
variant="ghost"
|
||||
size={size}
|
||||
disabled={loading}
|
||||
className="min-w-14 tabular-nums"
|
||||
aria-label={`${t("editor.drawing.zoom")} ${Math.round(zoom * 100)}%`}
|
||||
/>
|
||||
}
|
||||
>
|
||||
{Math.round(zoom * 100)}%
|
||||
</Menu.Trigger>
|
||||
<Menu.Popup side="top" align="start" data-theme="light" aria-label={t("editor.drawing.zoom")}>
|
||||
<Menu.Item icon={<PlusIcon />} disabled={zoom >= MAX_ZOOM} onClick={() => changeZoom(1.2)}>
|
||||
{t("map.zoom-in")}
|
||||
</Menu.Item>
|
||||
<Menu.Item icon={<MinusIcon />} disabled={zoom <= MIN_ZOOM} onClick={() => changeZoom(1 / 1.2)}>
|
||||
{t("map.zoom-out")}
|
||||
</Menu.Item>
|
||||
<Menu.Separator />
|
||||
<Menu.Item
|
||||
icon={<ScanSearchIcon />}
|
||||
onClick={() => {
|
||||
canvasRef.current?.zoomToFit();
|
||||
syncZoom();
|
||||
}}
|
||||
>
|
||||
{t("editor.drawing.zoom-to-fit")}
|
||||
</Menu.Item>
|
||||
<Menu.Item
|
||||
icon={<RotateCcwIcon />}
|
||||
onClick={() => {
|
||||
canvasRef.current?.zoomTo(1);
|
||||
syncZoom();
|
||||
}}
|
||||
>
|
||||
{t("attachment-preview.reset-zoom")}
|
||||
</Menu.Item>
|
||||
</Menu.Popup>
|
||||
</Menu.Root>
|
||||
</FloatingAction>
|
||||
</FloatingRow>
|
||||
{!isWide && !isViewing && (
|
||||
<>
|
||||
<FloatingRow edge="top">
|
||||
<FloatingAction>{cancelButton}</FloatingAction>
|
||||
<FloatingBar className="gap-3">
|
||||
{historyControls}
|
||||
{viewControls}
|
||||
</FloatingBar>
|
||||
<FloatingAction>{doneButton}</FloatingAction>
|
||||
</FloatingRow>
|
||||
{/* The tools in thumb reach. Under 380px the divider goes and the bar nears the
|
||||
edges, so a 360px screen keeps 44px between targets. */}
|
||||
<FloatingRow edge="bottom" className="max-[380px]:inset-x-1.5">
|
||||
@@ -402,15 +595,23 @@ const DrawingSheet = ({ mode, initialScene, background, onDone, onClose }: Drawi
|
||||
{t(mode === "edit" ? "editor.drawing.discard-edit-title" : "editor.drawing.discard-title")}
|
||||
</AlertDialog.Title>
|
||||
<AlertDialog.Description>
|
||||
{t(mode === "edit" ? "editor.drawing.discard-edit-description" : "editor.drawing.discard-description")}
|
||||
{t(commitError ?? (mode === "edit" ? "editor.drawing.discard-edit-description" : "editor.drawing.discard-description"))}
|
||||
</AlertDialog.Description>
|
||||
<AlertDialog.Footer>
|
||||
<AlertDialog.Close render={<Button variant="ghost">{t("editor.drawing.keep-drawing")}</Button>} />
|
||||
<Button
|
||||
variant="danger"
|
||||
onClick={() => {
|
||||
setDiscardOpen(false);
|
||||
onClose();
|
||||
onClick={async () => {
|
||||
try {
|
||||
const accepted = (await onDiscard?.()) ?? initialScene;
|
||||
if (accepted) canvasRef.current?.setScene(accepted);
|
||||
setCommitError(undefined);
|
||||
syncHistory();
|
||||
setDiscardOpen(false);
|
||||
onClose();
|
||||
} catch {
|
||||
showErrorToast(t("editor.drawing.export-failed"));
|
||||
}
|
||||
}}
|
||||
>
|
||||
{t("editor.drawing.discard")}
|
||||
|
||||
@@ -1,71 +1,63 @@
|
||||
import type { CanvasHandle, Scene } from "@usememos/canvas";
|
||||
import { Canvas } from "@usememos/canvas/react";
|
||||
import { Button, Dialog, Spinner, Tooltip } from "@usememos/ui";
|
||||
import { PencilLineIcon, ScanIcon, XIcon } from "lucide-react";
|
||||
import { type ReactElement, useEffect, useEffectEvent, useRef, useState } from "react";
|
||||
import type { Scene } from "@usememos/canvas";
|
||||
import { useEffect, useEffectEvent, useRef, useState } from "react";
|
||||
import { uploadService } from "@/components/MemoEditor/edit/services/uploadService";
|
||||
import { memoServiceClient } from "@/connect";
|
||||
import useCurrentUser from "@/hooks/useCurrentUser";
|
||||
import useMediaQuery from "@/hooks/useMediaQuery";
|
||||
import { useUpdateMemo } from "@/hooks/useMemoQueries";
|
||||
import { showErrorToast } from "@/lib/toast";
|
||||
import { cn } from "@/lib/utils";
|
||||
import type { Attachment } from "@/types/proto/api/attachment_service_pb";
|
||||
import type { Memo } from "@/types/proto/api/memo_service_pb";
|
||||
import { useTranslate } from "@/utils/i18n";
|
||||
import { canManageAttachment } from "@/utils/user";
|
||||
import { DrawingDialogPopup, FloatingBar, FloatingRow } from "./DrawingFrame";
|
||||
import { canManageAttachment, canManageMemo } from "@/utils/user";
|
||||
import DrawingSheet from "./DrawingSheet";
|
||||
import { fetchDrawingFile, readDrawing } from "./drawing";
|
||||
import { useCanvasTheme } from "./useCanvasTheme";
|
||||
import { DrawingActionError, fetchDrawingFile, readDrawing, sceneContent } from "./drawing";
|
||||
|
||||
export interface DrawingViewerProps {
|
||||
attachment: Attachment;
|
||||
/** The memo the drawing belongs to; with `canEdit`, Edit saves the drawing back to it. */
|
||||
memo: Pick<Memo, "name" | "attachments">;
|
||||
/** Whether the viewer may change the memo: its author or an admin. */
|
||||
canEdit: boolean;
|
||||
annotate?: boolean;
|
||||
onClose: () => void;
|
||||
/** The file carries no readable scene: show it as the plain image it is. */
|
||||
onNoScene: () => void;
|
||||
}
|
||||
|
||||
/**
|
||||
* A drawing opened from a memo: the canvas in its read-only mode (pan, zoom, copy), with
|
||||
* Zoom to fit and, for whoever may change the memo, Edit. Edit turns the viewer
|
||||
* into the drawing sheet; Done replaces the drawing's file under the same name, stamps the
|
||||
* memo's update time and returns to viewing the new version. An edit of someone else's
|
||||
* drawing is added to the memo beside it.
|
||||
*/
|
||||
const DrawingViewer = ({ attachment: initialAttachment, memo, canEdit, onClose, onNoScene }: DrawingViewerProps) => {
|
||||
const DrawingViewer = ({ attachment: initialAttachment, memo, canEdit, annotate = false, onClose, onNoScene }: DrawingViewerProps) => {
|
||||
const t = useTranslate();
|
||||
const currentUser = useCurrentUser();
|
||||
const isWide = useMediaQuery("sm");
|
||||
// Small controls on a desktop; a phone keeps the 32px ones for touch.
|
||||
const size = isWide ? "sm" : undefined;
|
||||
const { theme, fontFamily } = useCanvasTheme();
|
||||
const { mutateAsync: updateMemo } = useUpdateMemo(memo.name);
|
||||
const canvasRef = useRef<CanvasHandle>(null);
|
||||
const [attachment, setAttachment] = useState(initialAttachment);
|
||||
const [scene, setScene] = useState<Scene>();
|
||||
const [background, setBackground] = useState<Blob>();
|
||||
const [isEditing, setIsEditing] = useState(false);
|
||||
// An edit saved as a copy whose memo update failed: the user's own, so a retry replaces it
|
||||
// instead of uploading another.
|
||||
const unlinkedCopy = useRef<Attachment>(undefined);
|
||||
// The load runs once per attachment; it reports through the host's committed callbacks.
|
||||
const [forceCopy, setForceCopy] = useState(false);
|
||||
const [submissionPending, setSubmissionPending] = useState(false);
|
||||
const receipt = useRef<Attachment>(undefined);
|
||||
const uploadedScene = useRef<Scene>(undefined);
|
||||
const baseline = useRef<string | undefined>(undefined);
|
||||
const account = useRef(currentUser?.name);
|
||||
const latestAccount = useRef(currentUser?.name);
|
||||
latestAccount.current = currentUser?.name;
|
||||
const checkAccount = () => {
|
||||
if (!currentUser || account.current !== latestAccount.current) throw new DrawingActionError("editor.drawing.unavailable");
|
||||
};
|
||||
const showNoScene = useEffectEvent(onNoScene);
|
||||
const failToOpen = useEffectEvent(() => {
|
||||
showErrorToast(t("editor.drawing.open-failed"));
|
||||
onClose();
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
const controller = new AbortController();
|
||||
fetchDrawingFile(initialAttachment, controller.signal)
|
||||
.then(readDrawing)
|
||||
.then((content) => {
|
||||
if (controller.signal.aborted) return;
|
||||
if (content.scene) setScene(content.scene);
|
||||
else showNoScene();
|
||||
if (content.scene) {
|
||||
setScene(content.scene);
|
||||
baseline.current = sceneContent(content.scene);
|
||||
} else if (annotate) {
|
||||
setBackground(content.background);
|
||||
setIsEditing(true);
|
||||
} else showNoScene();
|
||||
})
|
||||
.catch((error) => {
|
||||
if (controller.signal.aborted) return;
|
||||
@@ -73,94 +65,86 @@ const DrawingViewer = ({ attachment: initialAttachment, memo, canEdit, onClose,
|
||||
failToOpen();
|
||||
});
|
||||
return () => controller.abort();
|
||||
}, [initialAttachment]);
|
||||
}, [initialAttachment, annotate]);
|
||||
|
||||
// Done in the sheet: the edit replaces the drawing's file. A drawing someone else uploaded
|
||||
// stays, since only they or an admin may replace or remove it, and the edit joins the memo
|
||||
// beside it.
|
||||
const saveEdit = async (file: File) => {
|
||||
const replace = canManageAttachment(attachment, currentUser);
|
||||
const replaces = replace ? attachment.name : unlinkedCopy.current?.name;
|
||||
const saved = await uploadService.uploadFile({ file, previewUrl: "", replaces });
|
||||
if (replace) {
|
||||
await updateMemo({ update: { name: memo.name }, updateMask: ["update_time"] });
|
||||
} else {
|
||||
unlinkedCopy.current = saved;
|
||||
// Whole attachments, not names: the optimistic update shows them until the memo reloads.
|
||||
const attachments = memo.attachments.flatMap((item) => (item.name === attachment.name ? [item, saved] : [item]));
|
||||
await updateMemo({ update: { name: memo.name, attachments }, updateMask: ["attachments"] });
|
||||
unlinkedCopy.current = undefined;
|
||||
checkAccount();
|
||||
const current = await memoServiceClient.getMemo({ name: memo.name });
|
||||
checkAccount();
|
||||
const source = current.attachments.find((item) => item.name === attachment.name);
|
||||
if (!canEdit || !canManageMemo(current, currentUser) || !source) throw new DrawingActionError("editor.drawing.unavailable");
|
||||
const replace = !background && !forceCopy && canManageAttachment(source, currentUser);
|
||||
if (replace && !receipt.current) {
|
||||
const original = await readDrawing(await fetchDrawingFile(source));
|
||||
checkAccount();
|
||||
if (!original.scene || sceneContent(original.scene) !== baseline.current) {
|
||||
setForceCopy(true);
|
||||
throw new DrawingActionError("editor.drawing.changed-save-copy");
|
||||
}
|
||||
}
|
||||
let saved = receipt.current;
|
||||
if (!saved) {
|
||||
saved = await uploadService.uploadFile({ file, previewUrl: "", replaces: replace ? source.name : undefined });
|
||||
receipt.current = saved;
|
||||
setSubmissionPending(true);
|
||||
uploadedScene.current = (await readDrawing(file)).scene;
|
||||
}
|
||||
checkAccount();
|
||||
try {
|
||||
if (saved.name === source.name) await updateMemo({ update: { name: current.name }, updateMask: ["update_time"] });
|
||||
else {
|
||||
const fresh = await memoServiceClient.getMemo({ name: memo.name });
|
||||
checkAccount();
|
||||
if (!canManageMemo(fresh, currentUser) || !fresh.attachments.some((item) => item.name === source.name))
|
||||
throw new DrawingActionError("editor.drawing.unavailable");
|
||||
const attachments = fresh.attachments.some((item) => item.name === saved.name)
|
||||
? fresh.attachments
|
||||
: fresh.attachments.flatMap((item) => (item.name === source.name ? [item, saved] : [item]));
|
||||
await updateMemo({ update: { name: fresh.name, attachments }, updateMask: ["attachments"] });
|
||||
}
|
||||
} catch (error) {
|
||||
if (error instanceof DrawingActionError) throw error;
|
||||
throw new DrawingActionError(saved.name === source.name ? "editor.drawing.saved-needs-update" : "editor.drawing.bind-failed");
|
||||
}
|
||||
const content = await readDrawing(file);
|
||||
setAttachment(saved);
|
||||
if (content.scene) setScene(content.scene);
|
||||
if (uploadedScene.current) {
|
||||
setScene(uploadedScene.current);
|
||||
baseline.current = sceneContent(uploadedScene.current);
|
||||
}
|
||||
setBackground(undefined);
|
||||
setSubmissionPending(false);
|
||||
receipt.current = undefined;
|
||||
setIsEditing(false);
|
||||
};
|
||||
|
||||
if (isEditing && scene) {
|
||||
return <DrawingSheet mode="edit" initialScene={scene} onDone={saveEdit} onClose={() => setIsEditing(false)} />;
|
||||
}
|
||||
|
||||
const title = t("editor.insert-menu.drawing");
|
||||
if (account.current !== currentUser?.name) return null;
|
||||
return (
|
||||
<Dialog.Root
|
||||
open
|
||||
onOpenChange={(open) => {
|
||||
if (!open) onClose();
|
||||
<DrawingSheet
|
||||
mode={isEditing ? (background ? "new" : "edit") : "view"}
|
||||
loading={!scene && !background}
|
||||
onEdit={canEdit ? () => setIsEditing(true) : undefined}
|
||||
initialScene={scene}
|
||||
background={background}
|
||||
commitLabel={background || forceCopy || !canManageAttachment(attachment, currentUser) ? "editor.drawing.save-copy" : "common.save"}
|
||||
submissionPending={submissionPending}
|
||||
onDone={saveEdit}
|
||||
onDiscard={() => {
|
||||
let accepted = scene;
|
||||
if (receipt.current?.name === attachment.name && uploadedScene.current) {
|
||||
accepted = uploadedScene.current;
|
||||
setScene(uploadedScene.current);
|
||||
baseline.current = sceneContent(uploadedScene.current);
|
||||
}
|
||||
receipt.current = undefined;
|
||||
setSubmissionPending(false);
|
||||
return accepted;
|
||||
}}
|
||||
>
|
||||
<DrawingDialogPopup label={title}>
|
||||
<div className="relative h-full w-full" style={{ background: theme.paper }}>
|
||||
{scene ? (
|
||||
// No autofocus: a viewer should not draw a focus ring around the page as it opens.
|
||||
<Canvas
|
||||
ref={canvasRef}
|
||||
className="absolute inset-0"
|
||||
readOnly
|
||||
ariaLabel={title}
|
||||
initialScene={scene}
|
||||
theme={theme}
|
||||
fontFamily={fontFamily}
|
||||
/>
|
||||
) : (
|
||||
<div className="absolute inset-0 flex items-center justify-center">
|
||||
<Spinner label={t("editor.blocks.loading")} />
|
||||
</div>
|
||||
)}
|
||||
<FloatingRow edge="top">
|
||||
{/* The caption matches the bar's button text: 13px beside small controls, 14px on a phone.
|
||||
Not a Dialog.Title, whose heading type is 16px; the popup's aria-label names the dialog. */}
|
||||
<FloatingBar className={isWide ? "pr-2" : "pr-3"}>
|
||||
<IconAction size={size} label={t("common.close")} icon={<XIcon />} onClick={onClose} />
|
||||
<span className={cn("truncate text-mu-text", isWide ? "mu-label-sm" : "mu-label")}>{title}</span>
|
||||
</FloatingBar>
|
||||
<FloatingBar className={isWide ? undefined : "gap-3"}>
|
||||
<IconAction
|
||||
size={size}
|
||||
label={t("editor.drawing.zoom-to-fit")}
|
||||
icon={<ScanIcon />}
|
||||
onClick={() => canvasRef.current?.zoomToFit()}
|
||||
/>
|
||||
{canEdit && (
|
||||
// Flat inside the bar: the bar is the one bordered surface.
|
||||
<Button variant="ghost" size={size} icon={<PencilLineIcon />} disabled={!scene} onClick={() => setIsEditing(true)}>
|
||||
{t("common.edit")}
|
||||
</Button>
|
||||
)}
|
||||
</FloatingBar>
|
||||
</FloatingRow>
|
||||
</div>
|
||||
</DrawingDialogPopup>
|
||||
</Dialog.Root>
|
||||
onClose={() => {
|
||||
if (!isEditing || background) onClose();
|
||||
else setIsEditing(false);
|
||||
}}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
/** An icon-only ghost Button named by its Tooltip. */
|
||||
const IconAction = ({ label, icon, size, onClick }: { label: string; icon: ReactElement; size?: "sm"; onClick: () => void }) => (
|
||||
<Tooltip.Root>
|
||||
<Tooltip.Trigger render={<Button variant="ghost" size={size} aria-label={label} icon={icon} onClick={onClick} />} />
|
||||
<Tooltip.Popup>{label}</Tooltip.Popup>
|
||||
</Tooltip.Root>
|
||||
);
|
||||
|
||||
export default DrawingViewer;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import type { Scene } from "@usememos/canvas";
|
||||
import type { Attachment } from "@/types/proto/api/attachment_service_pb";
|
||||
import { fetchAttachmentFile } from "@/utils/attachment";
|
||||
import type { Translations } from "@/utils/i18n";
|
||||
|
||||
/**
|
||||
* A drawing is a PNG attachment with its editable scene embedded. The name is a hint
|
||||
@@ -26,3 +27,17 @@ export const readDrawing = async (file: Blob): Promise<DrawingContent> => {
|
||||
const { scene } = await readScenePng(file);
|
||||
return scene ? { scene } : { background: file };
|
||||
};
|
||||
|
||||
export class DrawingActionError extends Error {
|
||||
constructor(public readonly label: Translations) {
|
||||
super(label);
|
||||
}
|
||||
}
|
||||
|
||||
export const sceneContent = (scene: Scene) =>
|
||||
JSON.stringify({
|
||||
elements: scene.elements,
|
||||
files: scene.files,
|
||||
background: scene.appState.viewBackgroundColor,
|
||||
handDrawn: scene.appState.handDrawn,
|
||||
});
|
||||
|
||||
@@ -61,7 +61,28 @@ The draft's attachments take the saved memo's shape: images, videos and drawings
|
||||
|
||||
### Drawings
|
||||
|
||||
A drawing is a PNG attachment made with [`@usememos/canvas`](https://github.com/usememos/canvas) (pinned to an exact version: it uses CalVer, so a version number does not signal breaking changes). The editable scene sits inside the file in a `zTXt` chunk named `memos-canvas`, and the name ends in `.canvas.png`. Everywhere outside the editor it is a plain image. The + menu's "Drawing" and the attachment row's "Edit drawing" open `components/DrawingSheet`, loaded on first use. It is a dialog that sits 24px inside the window from `md` up and fills the screen below that, with its controls floating on the paper (`DrawingFrame`). The package draws and edits the scene; the controls, strings, paper (`DRAWING_PAPER`, the same in every theme) and discard prompt are memos'. In a memo, a drawing opens in `DrawingViewer`, the same dialog with the canvas read-only, whose Edit saves in place. `useDrawing` owns the session: Done joins the draft through the same `LocalFile` path as a picked image, so the memo's save uploads it. "Edit drawing" reads the original file, never the thumbnail. Done on a file still in the draft swaps it in place. Done on a saved drawing keeps the attachment in the draft and queues the edit as a `LocalFile` with `replaces` set: the row shows the edit, and the save uploads it with `UploadAttachmentSpec.replace_attachment`, so the attachment keeps its name and place (`mergeUploadedAttachments`) while the server swaps the file and drops its thumbnail. Removing the pending row drops the edit. A saved drawing someone else uploaded stays, since only they or an admin may replace or remove it; its edit joins the draft as a new attachment. A file with the suffix but no readable scene opens as the background of a new drawing. The server must store `image/png` uploads unchanged, which `server/fileserver/drawing_png_test.go` checks.
|
||||
The contract and acceptance cases are in
|
||||
[`docs/design/drawing-annotation-and-recovery.md`](../../../../docs/design/drawing-annotation-and-recovery.md).
|
||||
Canvas is pinned to `26.11.3`; its editable PNG remains an ordinary image outside the drawing UI.
|
||||
|
||||
The insert menu starts a drawing. Ordinary local and instance-hosted images offer **Markup**; editable PNGs offer
|
||||
**Edit markup**. Annotation loads the original bytes, opens a locked background with a clean undo baseline, and starts with red
|
||||
ink. Applying it keeps the original and inserts a new `.canvas.png` beside it. Saved image previews provide the same annotation
|
||||
flow, with **Save copy** binding directly to that memo. External images and motion-photo groups are excluded.
|
||||
|
||||
The sheet has one short commit action: **Add** for new work, **Save** for edits, and **Save copy** for direct annotation or a copy
|
||||
required by ownership. The editor's own save uploads pending files. An owned saved drawing uses `LocalFile.replaces`, preserving
|
||||
its attachment name and links. Input is frozen before export until the host accepts or rejects it. Retries retain acknowledged
|
||||
uploads in memory and finish the remaining bind or timestamp update; partial failures show an exception icon and tooltip.
|
||||
|
||||
This first release has no Memos markup-draft UI or persistence. **Close** confirms discarding unsaved changes; it does not retain a
|
||||
recoverable markup. There is no Continue entry, no markup-dependent memo-save blocker, and no permanent More/Download/Discard menu.
|
||||
Normal states add no copy or badges to the canvas. Viewing and editing share one dialog and Canvas instance, retaining the visible content, pan and zoom across mode changes. Both modes keep a ghost X at the top left and the current action at the top right, without bordered action containers or a visible mode heading. A live zoom percentage opens the same four-action zoom menu in both modes (zoom in, zoom out, fit, reset to 100%). The trigger stays at the bottom left, above the phone tools bar and clear of the safe area. Editing adds the tools bar at the top center on desktop and at the bottom on phones. Available phone Undo/Redo actions follow X as quiet ghost icons; unavailable history actions are omitted. Returning to view focuses Edit; discarding restores the accepted scene.
|
||||
|
||||
Canvas `26.11.3` provides checkpoints for a future recovery integration. The current editor's text-only localStorage draft behavior
|
||||
is unchanged and excludes local file bytes. The server preserves editable PNGs unchanged (`server/fileserver/drawing_png_test.go`).
|
||||
Browser regressions live in `tests/browser/`: run `pnpm test:drawings` after `pnpm exec playwright install chromium`. They verify
|
||||
image preparation, original bytes/order, active Chinese text at export, desktop/360px controls, and view/edit content, viewport, focus and discard behavior.
|
||||
|
||||
### Suggestions
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Button, Tooltip } from "@usememos/ui";
|
||||
import { CheckIcon } from "lucide-react";
|
||||
import { CheckIcon, CircleAlertIcon } from "lucide-react";
|
||||
import { type FC, useId } from "react";
|
||||
import { type Location, Visibility } from "@/types/proto/api/memo_service_pb";
|
||||
import { useTranslate } from "@/utils/i18n";
|
||||
@@ -32,6 +32,7 @@ export const EditorToolbar: FC<EditorToolbarProps> = ({
|
||||
const blockedReason = useEditorSelector((s) => validationService.canSave(s).reason);
|
||||
const blockedReasonDetail = useEditorSelector((s) => validationService.canSave(s).detail);
|
||||
const isSaving = useEditorSelector((s) => s.ui.isLoading.saving);
|
||||
const drawingSaveError = useEditorSelector((s) => s.drawingSaveError);
|
||||
const justSaved = useEditorSelector((s) => s.ui.justSaved);
|
||||
const isUploading = useEditorSelector((s) => s.ui.isLoading.uploading);
|
||||
const location = useEditorSelector((s) => s.metadata.location);
|
||||
@@ -87,6 +88,7 @@ export const EditorToolbar: FC<EditorToolbarProps> = ({
|
||||
render={
|
||||
<Button
|
||||
variant="primary"
|
||||
iconEnd={drawingSaveError ? <CircleAlertIcon /> : undefined}
|
||||
onClick={onSave}
|
||||
loading={isSaving}
|
||||
loadingLabel={commitLabel}
|
||||
@@ -98,7 +100,7 @@ export const EditorToolbar: FC<EditorToolbarProps> = ({
|
||||
</Tooltip.Trigger>
|
||||
{/* The save shortcut shows in the tooltip, so the primary action reads as a plain verb. */}
|
||||
<Tooltip.Popup side="top" shortcut={`${primaryModifierGlyph()} Enter`}>
|
||||
{commitLabel}
|
||||
{drawingSaveError ? t(drawingSaveError) : commitLabel}
|
||||
</Tooltip.Popup>
|
||||
</Tooltip.Root>
|
||||
);
|
||||
|
||||
@@ -1,16 +1,6 @@
|
||||
import { Button, Menu, Spinner, Tooltip } from "@usememos/ui";
|
||||
import { uniqBy } from "lodash-es";
|
||||
import {
|
||||
CodeXmlIcon,
|
||||
ImageIcon,
|
||||
LinkIcon,
|
||||
MapPinIcon,
|
||||
Maximize2Icon,
|
||||
MicIcon,
|
||||
PaperclipIcon,
|
||||
PencilLineIcon,
|
||||
PlusIcon,
|
||||
} from "lucide-react";
|
||||
import { CodeXmlIcon, ImageIcon, LinkIcon, MapPinIcon, Maximize2Icon, MicIcon, PaletteIcon, PaperclipIcon, PlusIcon } from "lucide-react";
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import { LinkMemoDialog, LocationDialog } from "@/components/MemoMetadata";
|
||||
import type { MapPoint } from "@/components/map/types";
|
||||
@@ -137,7 +127,7 @@ const InsertMenu = (props: InsertMenuProps) => {
|
||||
{ key: "attachment", label: t("editor.insert-menu.add-attachment"), icon: PaperclipIcon, onClick: handleAttachmentUploadClick },
|
||||
{ key: "inline-image", label: t("editor.insert-menu.insert-image"), icon: ImageIcon, onClick: handleInlineImageUploadClick },
|
||||
...(props.onDrawingClick
|
||||
? [{ key: "drawing", label: t("editor.insert-menu.drawing"), icon: PencilLineIcon, onClick: props.onDrawingClick }]
|
||||
? [{ key: "drawing", label: t("editor.insert-menu.drawing"), icon: PaletteIcon, onClick: props.onDrawingClick }]
|
||||
: []),
|
||||
{ key: "audio", label: t("editor.audio-recorder.trigger"), icon: MicIcon, onClick: props.onAudioRecorderClick },
|
||||
{ key: "link", label: t("editor.insert-menu.link-memo"), icon: LinkIcon, onClick: handleOpenLinkDialog },
|
||||
|
||||
@@ -7,16 +7,14 @@ import { useTranslate } from "@/utils/i18n";
|
||||
import { canManageAttachment } from "@/utils/user";
|
||||
import { useEditorContext } from "../state";
|
||||
import type { DrawingSource, LocalFile } from "../types/attachment";
|
||||
import { effectiveOrder } from "../utils/attachmentOrder";
|
||||
|
||||
/**
|
||||
* Where the finished drawing goes: a new file in the draft, or in place of the one being
|
||||
* edited. A saved drawing the user may not replace (someone else uploaded it) stays, and
|
||||
* the edit is added as a new attachment.
|
||||
*/
|
||||
type DrawingTarget = { kind: "new" } | { kind: "local"; previewUrl: string } | { kind: "attachment"; name: string; canReplace: boolean };
|
||||
type DrawingTarget =
|
||||
| { kind: "new"; after?: string }
|
||||
| { kind: "local"; previewUrl: string }
|
||||
| { kind: "attachment"; name: string; canReplace: boolean };
|
||||
|
||||
export interface DrawingSession {
|
||||
/** A new session is a new sheet, so the canvas reads its first scene again. */
|
||||
id: number;
|
||||
mode: "new" | "edit";
|
||||
target: DrawingTarget;
|
||||
@@ -24,20 +22,12 @@ export interface DrawingSession {
|
||||
background?: Blob;
|
||||
}
|
||||
|
||||
/**
|
||||
* The drawing sheet's session in the editor: a new drawing from the + menu, or "Edit
|
||||
* drawing" on an attachment row. Done joins the draft through the same LocalFile path
|
||||
* as a picked image, so the memo's save uploads it. An edited drawing takes the place
|
||||
* of the one it came from: a local file is swapped in the draft; a saved attachment
|
||||
* stays, and the edit is a local file that replaces its content on save (the
|
||||
* attachment keeps its name, so links to it keep working).
|
||||
*/
|
||||
/** Markup joins the memo's pending files; only the outer save uploads it. */
|
||||
export const useDrawing = (toLocalFile: (file: File) => LocalFile) => {
|
||||
const t = useTranslate();
|
||||
const currentUser = useCurrentUser();
|
||||
const { actions, dispatch, getState } = useEditorContext();
|
||||
const [session, setSession] = useState<DrawingSession>();
|
||||
// The row whose drawing is being downloaded and read.
|
||||
const [opening, setOpening] = useState<string>();
|
||||
const request = useRef<AbortController | undefined>(undefined);
|
||||
const nextId = useRef(0);
|
||||
@@ -45,7 +35,6 @@ export const useDrawing = (toLocalFile: (file: File) => LocalFile) => {
|
||||
useEffect(() => () => request.current?.abort(), []);
|
||||
|
||||
const openNew = useCallback(() => {
|
||||
// A drawing still downloading must not replace the new sheet when it arrives.
|
||||
request.current?.abort();
|
||||
request.current = undefined;
|
||||
setOpening(undefined);
|
||||
@@ -70,8 +59,7 @@ export const useDrawing = (toLocalFile: (file: File) => LocalFile) => {
|
||||
setSession(
|
||||
content.scene
|
||||
? { id: ++nextId.current, mode: "edit", target, scene: content.scene }
|
||||
: // No scene inside: draw on the picture as a new drawing and leave the original alone.
|
||||
{ id: ++nextId.current, mode: "new", target: { kind: "new" }, background: content.background },
|
||||
: { id: ++nextId.current, mode: "new", target: { kind: "new", after: sourceId }, background: content.background },
|
||||
);
|
||||
} catch (error) {
|
||||
if (controller.signal.aborted) return;
|
||||
@@ -86,21 +74,20 @@ export const useDrawing = (toLocalFile: (file: File) => LocalFile) => {
|
||||
);
|
||||
|
||||
const close = useCallback(() => setSession(undefined), []);
|
||||
|
||||
const done = useCallback(
|
||||
(file: File) => {
|
||||
const target = session?.target ?? { kind: "new" };
|
||||
const localFile = toLocalFile(file);
|
||||
const state = getState();
|
||||
let order = [...effectiveOrder(state.attachmentOrder, state.metadata.attachments, state.localFiles)];
|
||||
if (target.kind === "local") {
|
||||
// A file that is itself an edit of a saved drawing stays one.
|
||||
const original = state.localFiles.find((item) => item.previewUrl === target.previewUrl);
|
||||
if (!original) throw new Error("Markup removed from memo");
|
||||
dispatch(
|
||||
actions.setLocalFiles(
|
||||
state.localFiles.map((item) => (item.previewUrl === target.previewUrl ? { ...localFile, replaces: item.replaces } : item)),
|
||||
),
|
||||
actions.setLocalFiles(state.localFiles.map((item) => (item === original ? { ...localFile, replaces: item.replaces } : item))),
|
||||
);
|
||||
order = order.map((key) => (key === original.previewUrl ? localFile.previewUrl : key));
|
||||
} else if (target.kind === "attachment" && target.canReplace) {
|
||||
// The saved drawing keeps its place; its edit uploads over it when the memo is saved.
|
||||
dispatch(
|
||||
actions.setLocalFiles([
|
||||
...state.localFiles.filter((item) => item.replaces !== target.name),
|
||||
@@ -108,10 +95,15 @@ export const useDrawing = (toLocalFile: (file: File) => LocalFile) => {
|
||||
]),
|
||||
);
|
||||
} else {
|
||||
// A new drawing, or an edit of one the user may not replace (someone else uploaded it,
|
||||
// and only they or an admin may remove it): the edit joins the memo beside it.
|
||||
const source = target.kind === "new" ? target.after : target.name;
|
||||
if (source) {
|
||||
const position = order.indexOf(source);
|
||||
if (position < 0) throw new Error("Annotation source removed from memo");
|
||||
order.splice(position + 1, 0, localFile.previewUrl);
|
||||
}
|
||||
dispatch(actions.addLocalFile(localFile));
|
||||
}
|
||||
dispatch(actions.setAttachmentOrder(order));
|
||||
setSession(undefined);
|
||||
},
|
||||
[actions, dispatch, getState, session, toLocalFile],
|
||||
|
||||
@@ -11,7 +11,7 @@ import type { Attachment } from "@/types/proto/api/attachment_service_pb";
|
||||
import type { Visibility } from "@/types/proto/api/memo_service_pb";
|
||||
import { useTranslate } from "@/utils/i18n";
|
||||
import { errorService, memoService, validationService } from "../services";
|
||||
import { DrawingNotSavedError, type MemoSaveOperations, mergeUploadedAttachments } from "../services/memoService";
|
||||
import { DrawingNotSavedError, DrawingSavedError, type MemoSaveOperations, mergeUploadedAttachments } from "../services/memoService";
|
||||
import { useEditorContext } from "../state";
|
||||
import { renameUploadedKeys } from "../utils/attachmentOrder";
|
||||
import { restampDefaultCreateTime } from "../utils/deriveDefaultCreateTime";
|
||||
@@ -115,7 +115,11 @@ export function useMemoSave({
|
||||
memoName,
|
||||
parentMemoName,
|
||||
space: defaultSpace,
|
||||
onFileUploaded: (file, attachment) => uploaded.set(file.previewUrl, attachment),
|
||||
onFileUploaded: (file, attachment) => {
|
||||
uploaded.set(file.previewUrl, attachment);
|
||||
if (file.replaces) dispatch(actions.setDrawingMemoUpdate(true));
|
||||
keepUploadedFiles();
|
||||
},
|
||||
},
|
||||
operations,
|
||||
);
|
||||
@@ -165,7 +169,13 @@ export function useMemoSave({
|
||||
void queryClient.invalidateQueries({ queryKey: attachmentKeys.lists() });
|
||||
void queryClient.invalidateQueries({ queryKey: userKeys.stats() });
|
||||
}
|
||||
if (error instanceof DrawingSavedError) {
|
||||
dispatch(actions.setDrawingSaveError("editor.drawing.saved-needs-update"));
|
||||
showErrorToast(t("editor.drawing.saved-needs-update"));
|
||||
return;
|
||||
}
|
||||
if (error instanceof DrawingNotSavedError) {
|
||||
dispatch(actions.setDrawingSaveError("editor.drawing.saved-without-drawing"));
|
||||
// The rest of the memo is saved; only the drawing waits for another save.
|
||||
console.error(error);
|
||||
showErrorToast(t("editor.drawing.saved-without-drawing"));
|
||||
|
||||
@@ -93,6 +93,7 @@ function buildUpdateMask(
|
||||
}
|
||||
}
|
||||
|
||||
if (state.drawingNeedsMemoUpdate) mask.add("update_time");
|
||||
return { mask, patch };
|
||||
}
|
||||
|
||||
@@ -107,6 +108,13 @@ export class DrawingNotSavedError extends Error {
|
||||
}
|
||||
}
|
||||
|
||||
/** The file replacement landed; only the memo update needs another attempt. */
|
||||
export class DrawingSavedError extends Error {
|
||||
constructor(cause: unknown) {
|
||||
super("Drawing saved; memo update needs retry", { cause });
|
||||
}
|
||||
}
|
||||
|
||||
/** The memo operations a save runs: the memo mutation hooks, so caches follow every save. */
|
||||
export interface MemoSaveOperations {
|
||||
/** The memo as the server has it now, to diff the draft against. */
|
||||
@@ -162,7 +170,11 @@ export const memoService = {
|
||||
// A new drawing is an edit of the memo: stamp it, keeping a custom time the draft sets.
|
||||
// The update returns the memo with its replaced files, which refreshes every cached copy;
|
||||
// it sends no attachment list, so one added elsewhere meanwhile stays.
|
||||
memo = await operations.updateMemo({ name: memo.name, updateTime: patch.updateTime }, ["update_time"]);
|
||||
try {
|
||||
memo = await operations.updateMemo({ name: memo.name, updateTime: patch.updateTime }, ["update_time"]);
|
||||
} catch (error) {
|
||||
throw new DrawingSavedError(error);
|
||||
}
|
||||
}
|
||||
return { memoName: memo.name, hasChanges: true, moved: mask.has("space") };
|
||||
}
|
||||
|
||||
@@ -75,7 +75,9 @@ export const uploadService = {
|
||||
onUploaded?.(localFiles[index], attachments[index]);
|
||||
}
|
||||
};
|
||||
await Promise.all(Array.from({ length: Math.min(MAX_CONCURRENT_UPLOADS, localFiles.length) }, worker));
|
||||
const results = await Promise.allSettled(Array.from({ length: Math.min(MAX_CONCURRENT_UPLOADS, localFiles.length) }, worker));
|
||||
const failed = results.find((entry) => entry.status === "rejected");
|
||||
if (failed?.status === "rejected") throw failed.reason;
|
||||
return attachments;
|
||||
},
|
||||
};
|
||||
|
||||
@@ -71,6 +71,10 @@ export const editorActions = {
|
||||
payload: id,
|
||||
}),
|
||||
|
||||
setDrawingSaveError: (value: EditorState["drawingSaveError"]): EditorAction => ({ type: "SET_DRAWING_SAVE_ERROR", payload: value }),
|
||||
|
||||
setDrawingMemoUpdate: (value: boolean): EditorAction => ({ type: "SET_DRAWING_MEMO_UPDATE", payload: value }),
|
||||
|
||||
reset: (): EditorAction => ({
|
||||
type: "RESET",
|
||||
}),
|
||||
|
||||
@@ -11,6 +11,12 @@ export function editorReducer(state: EditorState, action: EditorAction): EditorS
|
||||
timestamps: action.payload.timestamps,
|
||||
};
|
||||
|
||||
case "SET_DRAWING_SAVE_ERROR":
|
||||
return { ...state, drawingSaveError: action.payload };
|
||||
|
||||
case "SET_DRAWING_MEMO_UPDATE":
|
||||
return { ...state, drawingNeedsMemoUpdate: action.payload };
|
||||
|
||||
case "UPDATE_CONTENT": {
|
||||
if (state.content === action.payload.content) {
|
||||
return state;
|
||||
|
||||
@@ -40,6 +40,8 @@ export interface EditorState {
|
||||
/** Whether an audio recording is in flight; gates save. The recorder's full
|
||||
* state lives in useAudioRecorder — only this shared bit reaches the store. */
|
||||
recorderBusy: boolean;
|
||||
drawingNeedsMemoUpdate?: boolean;
|
||||
drawingSaveError?: "editor.drawing.saved-needs-update" | "editor.drawing.saved-without-drawing";
|
||||
/** Draft-local acceptance history, retained across Undo but cleared on reset. */
|
||||
acceptedSuggestionIds: string[];
|
||||
}
|
||||
@@ -59,6 +61,8 @@ export type EditorAction =
|
||||
| { type: "SET_RECORDER_BUSY"; payload: boolean }
|
||||
| { type: "SET_JUST_SAVED"; payload: boolean }
|
||||
| { type: "ACCEPT_SUGGESTION"; payload: string }
|
||||
| { type: "SET_DRAWING_SAVE_ERROR"; payload: EditorState["drawingSaveError"] }
|
||||
| { type: "SET_DRAWING_MEMO_UPDATE"; payload: boolean }
|
||||
| { type: "RESET" };
|
||||
|
||||
// Module-private template for createInitialState.
|
||||
|
||||
@@ -6,8 +6,8 @@ import {
|
||||
FileTextIcon,
|
||||
GripVerticalIcon,
|
||||
ImagePlusIcon,
|
||||
PaletteIcon,
|
||||
PauseIcon,
|
||||
PencilLineIcon,
|
||||
PlayIcon,
|
||||
XIcon,
|
||||
} from "lucide-react";
|
||||
@@ -173,7 +173,7 @@ const AttachmentTile: FC<{
|
||||
const t = useTranslate();
|
||||
const drawing = item.category === "image" && isDrawingFilename(item.filename);
|
||||
const keyActions: { icon: ReactElement; action: ItemAction }[] = [
|
||||
...(actions.drawing ? [{ icon: <PencilLineIcon />, action: actions.drawing }] : []),
|
||||
...(actions.drawing ? [{ icon: <PaletteIcon />, action: actions.drawing }] : []),
|
||||
...(actions.placement ? [{ icon: <ImagePlusIcon />, action: actions.placement }] : []),
|
||||
...(actions.onRemove ? [{ icon: <XIcon />, action: { label: t("editor.attachments.remove"), onClick: actions.onRemove } }] : []),
|
||||
];
|
||||
@@ -505,7 +505,7 @@ const AttachmentListEditor: FC<AttachmentListEditorProps> = ({
|
||||
|
||||
// A drawing opens from the original file: a saved one is downloaded, so it must live on this server.
|
||||
const drawingSource: DrawingSource | undefined =
|
||||
item.category !== "image" || !isDrawingFilename(item.filename)
|
||||
item.category !== "image"
|
||||
? undefined
|
||||
: item.isLocal
|
||||
? itemLocalFiles[0] && { kind: "local", localFile: itemLocalFiles[0] }
|
||||
@@ -515,7 +515,7 @@ const AttachmentListEditor: FC<AttachmentListEditorProps> = ({
|
||||
const drawing =
|
||||
drawingSource && onEditDrawing
|
||||
? {
|
||||
label: t("editor.drawing.edit"),
|
||||
label: t(isDrawingFilename(item.filename) ? "editor.drawing.edit" : "editor.drawing.annotate"),
|
||||
onClick: () => onEditDrawing(drawingSource),
|
||||
disabled: placementActionsDisabled || Boolean(openingDrawing),
|
||||
busy: openingDrawing !== undefined && item.memberIds.includes(openingDrawing),
|
||||
|
||||
@@ -199,6 +199,7 @@ const MemoView = forwardRef<MemoViewHandle, MemoViewProps>((props, ref) => {
|
||||
onOpenChange={setPreviewOpen}
|
||||
items={previewState.items}
|
||||
initialIndex={previewState.index}
|
||||
drawingContext={{ memo: memoData, canEdit: !readonly }}
|
||||
/>
|
||||
</Suspense>
|
||||
)}
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
import { Button, Dialog } from "@usememos/ui";
|
||||
import { ChevronLeft, ChevronRight, InfoIcon, RotateCcw, X, ZoomIn, ZoomOut } from "lucide-react";
|
||||
import React, { useEffect, useMemo, useRef, useState } from "react";
|
||||
import { ChevronLeft, ChevronRight, InfoIcon, PaletteIcon, RotateCcw, X, ZoomIn, ZoomOut } from "lucide-react";
|
||||
import React, { Suspense, useEffect, useMemo, useRef, useState } from "react";
|
||||
import { DrawingViewer, isDrawingFilename } from "@/components/DrawingSheet";
|
||||
import MediaMetadataDetails from "@/components/MediaMetadataDetails";
|
||||
import MotionPhotoPreview from "@/components/MotionPhotoPreview";
|
||||
import useMediaQuery from "@/hooks/useMediaQuery";
|
||||
import { cn } from "@/lib/utils";
|
||||
import type { Attachment } from "@/types/proto/api/attachment_service_pb";
|
||||
import type { Memo } from "@/types/proto/api/memo_service_pb";
|
||||
import { getAttachmentUrl } from "@/utils/attachment";
|
||||
import { useTranslate } from "@/utils/i18n";
|
||||
import type { PreviewMediaItem } from "@/utils/media-item";
|
||||
|
||||
@@ -14,6 +18,7 @@ interface Props {
|
||||
imgUrls?: string[];
|
||||
items?: PreviewMediaItem[];
|
||||
initialIndex?: number;
|
||||
drawingContext?: { memo: Pick<Memo, "name" | "attachments">; canEdit: boolean };
|
||||
}
|
||||
|
||||
const MIN_ZOOM = 1;
|
||||
@@ -66,11 +71,12 @@ interface SwipeGesture {
|
||||
const distanceBetween = (first: { x: number; y: number }, second: { x: number; y: number }) =>
|
||||
Math.hypot(first.x - second.x, first.y - second.y);
|
||||
|
||||
function PreviewImageDialog({ open, onOpenChange, imgUrls = [], items, initialIndex = 0 }: Props) {
|
||||
function PreviewImageDialog({ open, onOpenChange, imgUrls = [], items, initialIndex = 0, drawingContext }: Props) {
|
||||
const t = useTranslate();
|
||||
const sm = useMediaQuery("sm");
|
||||
const [currentIndex, setCurrentIndex] = useState(initialIndex);
|
||||
const [zoomScale, setZoomScale] = useState(MIN_ZOOM);
|
||||
const [annotation, setAnnotation] = useState<Attachment>();
|
||||
const [showDetails, setShowDetails] = useState(false);
|
||||
const [panOffset, setPanOffset] = useState<PanOffset>(NO_PAN);
|
||||
const [swipeOffset, setSwipeOffset] = useState(0);
|
||||
@@ -96,6 +102,17 @@ function PreviewImageDialog({ open, onOpenChange, imgUrls = [], items, initialIn
|
||||
const itemCount = previewItems.length;
|
||||
const safeIndex = Math.max(0, Math.min(currentIndex, itemCount - 1));
|
||||
const currentItem = previewItems[safeIndex];
|
||||
const annotationSource =
|
||||
drawingContext?.canEdit && currentItem?.kind === "image"
|
||||
? drawingContext.memo.attachments.find(
|
||||
(attachment) =>
|
||||
!attachment.externalLink &&
|
||||
!attachment.motionMedia &&
|
||||
attachment.type.startsWith("image/") &&
|
||||
!isDrawingFilename(attachment.filename) &&
|
||||
(attachment.name === currentItem.id || getAttachmentUrl(attachment) === currentItem.sourceUrl),
|
||||
)
|
||||
: undefined;
|
||||
const hasMultiple = itemCount > 1;
|
||||
const isImagePreview = currentItem?.kind === "image";
|
||||
const canGoPrevious = safeIndex > 0;
|
||||
@@ -113,6 +130,7 @@ function PreviewImageDialog({ open, onOpenChange, imgUrls = [], items, initialIn
|
||||
pinchRef.current = null;
|
||||
swipeRef.current = null;
|
||||
setZoomScale(MIN_ZOOM);
|
||||
setAnnotation(undefined);
|
||||
setPanOffset(NO_PAN);
|
||||
setSwipeOffset(0);
|
||||
setIsInteracting(false);
|
||||
@@ -347,6 +365,11 @@ function PreviewImageDialog({ open, onOpenChange, imgUrls = [], items, initialIn
|
||||
</div>
|
||||
|
||||
<div className="flex shrink-0 items-center gap-1.5" data-theme="dark">
|
||||
{annotationSource && (
|
||||
<Button icon={<PaletteIcon />} onClick={() => setAnnotation(annotationSource)}>
|
||||
{t("editor.drawing.annotate")}
|
||||
</Button>
|
||||
)}
|
||||
<Button
|
||||
onClick={() => setShowDetails((visible) => !visible)}
|
||||
aria-label={showDetails ? t("attachment-details.actions.hide") : t("attachment-details.actions.show")}
|
||||
@@ -504,6 +527,19 @@ function PreviewImageDialog({ open, onOpenChange, imgUrls = [], items, initialIn
|
||||
{showDetails && <MediaMetadataDetails id="attachment-media-details" item={currentItem} onClose={() => setShowDetails(false)} />}
|
||||
</div>
|
||||
</Dialog.Popup>
|
||||
{open && annotation && drawingContext && (
|
||||
<Suspense fallback={null}>
|
||||
<DrawingViewer
|
||||
key={annotation.name}
|
||||
attachment={annotation}
|
||||
memo={drawingContext.memo}
|
||||
canEdit={drawingContext.canEdit}
|
||||
annotate
|
||||
onClose={() => setAnnotation(undefined)}
|
||||
onNoScene={() => setAnnotation(undefined)}
|
||||
/>
|
||||
</Suspense>
|
||||
)}
|
||||
</Dialog.Root>
|
||||
);
|
||||
}
|
||||
|
||||
+10
-5
@@ -168,7 +168,7 @@
|
||||
"link-memo": "مذكرة الارتباط",
|
||||
"image-upload-stopped": "توقف تحميل الصورة {{completed}}/{{total}}",
|
||||
"insert-image": "إدراج الصورة",
|
||||
"drawing": "رسم",
|
||||
"drawing": "تعليق",
|
||||
"keep-as-attachments": "الاحتفاظ بها كمرفقات",
|
||||
"retry-image-upload": "إعادة المحاولة",
|
||||
"uploading-inline-image": "جارٍ التحميل إلى المحتوى",
|
||||
@@ -177,8 +177,7 @@
|
||||
"image-upload-failed": "تعذر رفع بعض الصور. أعد المحاولة أو احتفظ بالملفات المرفوعة كمرفقات."
|
||||
},
|
||||
"drawing": {
|
||||
"new-title": "رسم جديد",
|
||||
"edit": "تعديل الرسم",
|
||||
"edit": "تعديل التعليق",
|
||||
"tools": "الأدوات",
|
||||
"tool-select": "تحديد",
|
||||
"tool-pen": "قلم",
|
||||
@@ -203,8 +202,8 @@
|
||||
"color-violet": "بنفسجي",
|
||||
"undo": "تراجع",
|
||||
"redo": "إعادة",
|
||||
"zoom": "التكبير والتصغير",
|
||||
"zoom-to-fit": "ملاءمة للنافذة",
|
||||
"done": "تم",
|
||||
"discard-title": "تجاهل هذا الرسم؟",
|
||||
"discard-description": "لم تتم إضافته إلى المذكرة بعد.",
|
||||
"discard-edit-title": "تجاهل التغييرات؟",
|
||||
@@ -214,7 +213,13 @@
|
||||
"open-failed": "تعذر فتح الرسم. حاول مرة أخرى.",
|
||||
"export-failed": "تعذر حفظ الرسم. حاول مرة أخرى.",
|
||||
"image-failed": "تعذرت إضافة الصورة إلى الرسم.",
|
||||
"saved-without-drawing": "تم حفظ المذكرة، لكن لم يتم حفظ الرسم. احفظ مرة أخرى لإعادة المحاولة."
|
||||
"saved-without-drawing": "تم حفظ المذكرة، لكن لم يتم حفظ الرسم. احفظ مرة أخرى لإعادة المحاولة.",
|
||||
"annotate": "تعليق",
|
||||
"save-copy": "حفظ نسخة",
|
||||
"unavailable": "الوجهة غير متاحة.",
|
||||
"saved-needs-update": "تم حفظ الرسم. أعد محاولة تحديث الملاحظة.",
|
||||
"changed-save-copy": "تغيّر الأصل. احفظ نسخة.",
|
||||
"bind-failed": "تم رفع الرسم. أعد محاولة إضافته إلى الملاحظة."
|
||||
},
|
||||
"audio-recorder": {
|
||||
"attachment-label": "تسجيل صوتي",
|
||||
|
||||
+10
-5
@@ -287,7 +287,7 @@
|
||||
"image-upload-failed": "Bəzi şəkillər yüklənə bilmədi. Yenidən cəhd edin və ya yüklənmiş faylları qoşma kimi saxlayın.",
|
||||
"image-upload-stopped": "Şəkil yükləməsi dayandırıldı {{completed}}/{{total}}",
|
||||
"insert-image": "Şəkil daxil et",
|
||||
"drawing": "Rəsm",
|
||||
"drawing": "İşarələmə",
|
||||
"keep-as-attachments": "Qoşma kimi saxla",
|
||||
"link-memo": "Qeydə keçid əlavə et",
|
||||
"retry-image-upload": "Yenidən cəhd et",
|
||||
@@ -295,8 +295,7 @@
|
||||
"uploading-images": "Şəkillər yüklənir {{completed}}/{{total}}"
|
||||
},
|
||||
"drawing": {
|
||||
"new-title": "Yeni rəsm",
|
||||
"edit": "Rəsmi redaktə et",
|
||||
"edit": "İşarələməni redaktə et",
|
||||
"tools": "Alətlər",
|
||||
"tool-select": "Seç",
|
||||
"tool-pen": "Qələm",
|
||||
@@ -321,8 +320,8 @@
|
||||
"color-violet": "Bənövşəyi",
|
||||
"undo": "Geri al",
|
||||
"redo": "Təkrarla",
|
||||
"zoom": "Miqyas",
|
||||
"zoom-to-fit": "Pəncərəyə sığdır",
|
||||
"done": "Hazır",
|
||||
"discard-title": "Bu rəsm silinsin?",
|
||||
"discard-description": "Hələ qeydə əlavə edilməyib.",
|
||||
"discard-edit-title": "Dəyişikliklər silinsin?",
|
||||
@@ -332,7 +331,13 @@
|
||||
"open-failed": "Rəsmi açmaq mümkün olmadı. Yenidən cəhd edin.",
|
||||
"export-failed": "Rəsmi saxlamaq mümkün olmadı. Yenidən cəhd edin.",
|
||||
"image-failed": "Şəkli rəsmə əlavə etmək mümkün olmadı.",
|
||||
"saved-without-drawing": "Qeyd yadda saxlanıldı, amma rəsm saxlanılmadı. Yenidən cəhd etmək üçün təkrar yadda saxlayın."
|
||||
"saved-without-drawing": "Qeyd yadda saxlanıldı, amma rəsm saxlanılmadı. Yenidən cəhd etmək üçün təkrar yadda saxlayın.",
|
||||
"annotate": "İşarələmə",
|
||||
"save-copy": "Surəti saxla",
|
||||
"unavailable": "Təyinat əlçatan deyil.",
|
||||
"saved-needs-update": "Rəsm saxlanıldı. Qeydi yeniləməyə yenidən cəhd edin.",
|
||||
"changed-save-copy": "Orijinal dəyişib. Surətini saxlayın.",
|
||||
"bind-failed": "Rəsm yükləndi. Qeydə əlavə etməyə yenidən cəhd edin."
|
||||
},
|
||||
"new-memo": "Yeni qeyd",
|
||||
"no-changes-detected": "Dəyişiklik aşkarlanmadı",
|
||||
|
||||
+10
-5
@@ -207,14 +207,13 @@
|
||||
"image-upload-failed": "Някои изображения не можаха да бъдат качени. Опитайте отново или запазете качените файлове като прикачени файлове.",
|
||||
"image-upload-stopped": "Качването на изображение спря {{completed}}/{{total}}",
|
||||
"insert-image": "Вмъкване на изображение",
|
||||
"drawing": "Рисунка",
|
||||
"drawing": "Маркиране",
|
||||
"keep-as-attachments": "Запазване като прикачени файлове",
|
||||
"uploading-inline-image": "Качване в съдържание",
|
||||
"uploading-images": "Качване на изображения {{completed}}/{{total}}"
|
||||
},
|
||||
"drawing": {
|
||||
"new-title": "Нова рисунка",
|
||||
"edit": "Редактиране на рисунката",
|
||||
"edit": "Редактиране на маркировката",
|
||||
"tools": "Инструменти",
|
||||
"tool-select": "Избор",
|
||||
"tool-pen": "Писалка",
|
||||
@@ -239,8 +238,8 @@
|
||||
"color-violet": "Виолетово",
|
||||
"undo": "Отмяна",
|
||||
"redo": "Повторение",
|
||||
"zoom": "Мащаб",
|
||||
"zoom-to-fit": "Побиране в прозореца",
|
||||
"done": "Готово",
|
||||
"discard-title": "Отхвърляне на тази рисунка?",
|
||||
"discard-description": "Все още не е добавена към бележката.",
|
||||
"discard-edit-title": "Отхвърляне на промените?",
|
||||
@@ -250,7 +249,13 @@
|
||||
"open-failed": "Рисунката не можа да бъде отворена. Опитайте отново.",
|
||||
"export-failed": "Рисунката не можа да бъде запазена. Опитайте отново.",
|
||||
"image-failed": "Изображението не можа да бъде добавено към рисунката.",
|
||||
"saved-without-drawing": "Бележката е запазена, но рисунката не е. Запазете отново, за да опитате пак."
|
||||
"saved-without-drawing": "Бележката е запазена, но рисунката не е. Запазете отново, за да опитате пак.",
|
||||
"annotate": "Маркиране",
|
||||
"save-copy": "Запазване на копие",
|
||||
"unavailable": "Местоназначението не е достъпно.",
|
||||
"saved-needs-update": "Рисунката е запазена. Опитайте отново да обновите бележката.",
|
||||
"changed-save-copy": "Оригиналът е променен. Запазете копие.",
|
||||
"bind-failed": "Рисунката е качена. Опитайте отново да я добавите към бележката."
|
||||
},
|
||||
"no-changes-detected": "Не са открити промени",
|
||||
"save": "Запазване",
|
||||
|
||||
+10
-5
@@ -169,14 +169,13 @@
|
||||
"image-upload-failed": "No s'han pogut carregar algunes imatges. Torneu-ho a intentar o conserveu els fitxers carregats com a fitxers adjunts.",
|
||||
"image-upload-stopped": "La càrrega d'imatges s'ha aturat {{completed}}/{{total}}",
|
||||
"insert-image": "Insereix una imatge",
|
||||
"drawing": "Dibuix",
|
||||
"drawing": "Marcatge",
|
||||
"keep-as-attachments": "Desa com a fitxers adjunts",
|
||||
"uploading-inline-image": "S'està pujant al contingut",
|
||||
"uploading-images": "S'estan pujant imatges {{completed}}/{{total}}"
|
||||
},
|
||||
"drawing": {
|
||||
"new-title": "Dibuix nou",
|
||||
"edit": "Edita el dibuix",
|
||||
"edit": "Edita el marcatge",
|
||||
"tools": "Eines",
|
||||
"tool-select": "Selecciona",
|
||||
"tool-pen": "Llapis",
|
||||
@@ -201,8 +200,8 @@
|
||||
"color-violet": "Violeta",
|
||||
"undo": "Desfés",
|
||||
"redo": "Refés",
|
||||
"zoom": "Zoom",
|
||||
"zoom-to-fit": "Ajusta a la pantalla",
|
||||
"done": "Fet",
|
||||
"discard-title": "Voleu descartar aquest dibuix?",
|
||||
"discard-description": "Encara no s'ha afegit a la nota.",
|
||||
"discard-edit-title": "Voleu descartar els canvis?",
|
||||
@@ -212,7 +211,13 @@
|
||||
"open-failed": "No s'ha pogut obrir el dibuix. Torneu-ho a intentar.",
|
||||
"export-failed": "No s'ha pogut desar el dibuix. Torneu-ho a intentar.",
|
||||
"image-failed": "No s'ha pogut afegir la imatge al dibuix.",
|
||||
"saved-without-drawing": "La nota s'ha desat, però el dibuix no. Torneu a desar per tornar-ho a intentar."
|
||||
"saved-without-drawing": "La nota s'ha desat, però el dibuix no. Torneu a desar per tornar-ho a intentar.",
|
||||
"annotate": "Marcatge",
|
||||
"save-copy": "Desa una còpia",
|
||||
"unavailable": "La destinació no està disponible.",
|
||||
"saved-needs-update": "Dibuix desat. Torna a provar d’actualitzar la nota.",
|
||||
"changed-save-copy": "L’original ha canviat. Desa una còpia.",
|
||||
"bind-failed": "Dibuix pujat. Torna a provar d’afegir-lo a la nota."
|
||||
},
|
||||
"no-changes-detected": "No s'han detectat canvis",
|
||||
"save": "Guarda",
|
||||
|
||||
+10
-5
@@ -169,14 +169,13 @@
|
||||
"image-upload-failed": "Některé obrázky se nepodařilo nahrát. Zkuste to znovu nebo nahrané soubory ponechte jako přílohy.",
|
||||
"image-upload-stopped": "Nahrávání obrázku zastaveno {{completed}}/{{total}}",
|
||||
"insert-image": "Vložit obrázek",
|
||||
"drawing": "Kresba",
|
||||
"drawing": "Anotace",
|
||||
"keep-as-attachments": "Ponechat jako přílohy",
|
||||
"uploading-inline-image": "Nahrávání do obsahu",
|
||||
"uploading-images": "Nahrávání obrázků {{completed}}/{{total}}"
|
||||
},
|
||||
"drawing": {
|
||||
"new-title": "Nová kresba",
|
||||
"edit": "Upravit kresbu",
|
||||
"edit": "Upravit anotaci",
|
||||
"tools": "Nástroje",
|
||||
"tool-select": "Výběr",
|
||||
"tool-pen": "Pero",
|
||||
@@ -201,8 +200,8 @@
|
||||
"color-violet": "Fialová",
|
||||
"undo": "Zpět",
|
||||
"redo": "Znovu",
|
||||
"zoom": "Přiblížení",
|
||||
"zoom-to-fit": "Přizpůsobit oknu",
|
||||
"done": "Hotovo",
|
||||
"discard-title": "Zahodit tuto kresbu?",
|
||||
"discard-description": "Zatím nebyla přidána do poznámky.",
|
||||
"discard-edit-title": "Zahodit změny?",
|
||||
@@ -212,7 +211,13 @@
|
||||
"open-failed": "Kresbu se nepodařilo otevřít. Zkuste to znovu.",
|
||||
"export-failed": "Kresbu se nepodařilo uložit. Zkuste to znovu.",
|
||||
"image-failed": "Obrázek se nepodařilo přidat do kresby.",
|
||||
"saved-without-drawing": "Poznámka je uložena, ale kresba ne. Pro nový pokus uložte znovu."
|
||||
"saved-without-drawing": "Poznámka je uložena, ale kresba ne. Pro nový pokus uložte znovu.",
|
||||
"annotate": "Anotace",
|
||||
"save-copy": "Uložit kopii",
|
||||
"unavailable": "Cíl není dostupný.",
|
||||
"saved-needs-update": "Kresba uložena. Zkuste znovu aktualizovat poznámku.",
|
||||
"changed-save-copy": "Originál se změnil. Uložte kopii.",
|
||||
"bind-failed": "Kresba nahrána. Zkuste ji znovu přidat do poznámky."
|
||||
},
|
||||
"no-changes-detected": "Nebyly zjištěny žádné změny",
|
||||
"save": "Uložit",
|
||||
|
||||
+10
-5
@@ -207,14 +207,13 @@
|
||||
"image-upload-failed": "Nogle billeder kunne ikke uploades. Prøv igen, eller behold de uploadede filer som vedhæftede filer.",
|
||||
"image-upload-stopped": "Billedupload stoppet {{completed}}/{{total}}",
|
||||
"insert-image": "Indsæt billede",
|
||||
"drawing": "Tegning",
|
||||
"drawing": "Markering",
|
||||
"keep-as-attachments": "Behold som vedhæftede filer",
|
||||
"uploading-inline-image": "Uploader til indhold",
|
||||
"uploading-images": "Uploader billeder {{completed}}/{{total}}"
|
||||
},
|
||||
"drawing": {
|
||||
"new-title": "Ny tegning",
|
||||
"edit": "Rediger tegning",
|
||||
"edit": "Rediger markering",
|
||||
"tools": "Værktøjer",
|
||||
"tool-select": "Vælg",
|
||||
"tool-pen": "Pen",
|
||||
@@ -239,8 +238,8 @@
|
||||
"color-violet": "Violet",
|
||||
"undo": "Fortryd",
|
||||
"redo": "Gentag",
|
||||
"zoom": "Zoom",
|
||||
"zoom-to-fit": "Tilpas til vindue",
|
||||
"done": "Færdig",
|
||||
"discard-title": "Kassér denne tegning?",
|
||||
"discard-description": "Den er endnu ikke føjet til notatet.",
|
||||
"discard-edit-title": "Kassér dine ændringer?",
|
||||
@@ -250,7 +249,13 @@
|
||||
"open-failed": "Tegningen kunne ikke åbnes. Prøv igen.",
|
||||
"export-failed": "Tegningen kunne ikke gemmes. Prøv igen.",
|
||||
"image-failed": "Billedet kunne ikke føjes til tegningen.",
|
||||
"saved-without-drawing": "Notatet er gemt, men det er tegningen ikke. Gem igen for at prøve en gang til."
|
||||
"saved-without-drawing": "Notatet er gemt, men det er tegningen ikke. Gem igen for at prøve en gang til.",
|
||||
"annotate": "Markering",
|
||||
"save-copy": "Gem kopi",
|
||||
"unavailable": "Destinationen er ikke tilgængelig.",
|
||||
"saved-needs-update": "Tegning gemt. Prøv at opdatere noten igen.",
|
||||
"changed-save-copy": "Originalen er ændret. Gem en kopi.",
|
||||
"bind-failed": "Tegning uploadet. Prøv at føje den til noten igen."
|
||||
},
|
||||
"no-changes-detected": "Ingen ændringer registreret",
|
||||
"save": "Spare",
|
||||
|
||||
+10
-5
@@ -169,14 +169,13 @@
|
||||
"image-upload-failed": "Einige Bilder konnten nicht hochgeladen werden. Bitte versuchen Sie es erneut oder behalten Sie die hochgeladenen Dateien als Anhänge bei.",
|
||||
"image-upload-stopped": "Bild-Upload gestoppt {{completed}}/{{total}}",
|
||||
"insert-image": "Bild einfügen",
|
||||
"drawing": "Zeichnung",
|
||||
"drawing": "Markieren",
|
||||
"keep-as-attachments": "Als Anhänge beibehalten",
|
||||
"uploading-inline-image": "Inhalt wird hochgeladen",
|
||||
"uploading-images": "Bilder werden hochgeladen {{completed}}/{{total}}"
|
||||
},
|
||||
"drawing": {
|
||||
"new-title": "Neue Zeichnung",
|
||||
"edit": "Zeichnung bearbeiten",
|
||||
"edit": "Markierung bearbeiten",
|
||||
"tools": "Werkzeuge",
|
||||
"tool-select": "Auswählen",
|
||||
"tool-pen": "Stift",
|
||||
@@ -201,8 +200,8 @@
|
||||
"color-violet": "Violett",
|
||||
"undo": "Rückgängig",
|
||||
"redo": "Wiederholen",
|
||||
"zoom": "Zoom",
|
||||
"zoom-to-fit": "Einpassen",
|
||||
"done": "Fertig",
|
||||
"discard-title": "Diese Zeichnung verwerfen?",
|
||||
"discard-description": "Sie wurde der Notiz noch nicht hinzugefügt.",
|
||||
"discard-edit-title": "Änderungen verwerfen?",
|
||||
@@ -212,7 +211,13 @@
|
||||
"open-failed": "Die Zeichnung konnte nicht geöffnet werden. Bitte versuchen Sie es erneut.",
|
||||
"export-failed": "Die Zeichnung konnte nicht gespeichert werden. Bitte versuchen Sie es erneut.",
|
||||
"image-failed": "Das Bild konnte der Zeichnung nicht hinzugefügt werden.",
|
||||
"saved-without-drawing": "Die Notiz ist gespeichert, die Zeichnung jedoch nicht. Speichern Sie erneut, um es noch einmal zu versuchen."
|
||||
"saved-without-drawing": "Die Notiz ist gespeichert, die Zeichnung jedoch nicht. Speichern Sie erneut, um es noch einmal zu versuchen.",
|
||||
"annotate": "Markieren",
|
||||
"save-copy": "Kopie speichern",
|
||||
"unavailable": "Das Ziel ist nicht verfügbar.",
|
||||
"saved-needs-update": "Zeichnung gespeichert. Aktualisierung der Notiz erneut versuchen.",
|
||||
"changed-save-copy": "Das Original wurde geändert. Eine Kopie speichern.",
|
||||
"bind-failed": "Zeichnung hochgeladen. Hinzufügen zur Notiz erneut versuchen."
|
||||
},
|
||||
"no-changes-detected": "Keine Änderungen erkannt",
|
||||
"save": "Speichern",
|
||||
|
||||
+10
-5
@@ -207,14 +207,13 @@
|
||||
"image-upload-failed": "Δεν ήταν δυνατή η μεταφόρτωση ορισμένων εικόνων. Δοκιμάστε ξανά ή διατηρήστε τα μεταφορτωμένα αρχεία ως συνημμένα.",
|
||||
"image-upload-stopped": "Η μεταφόρτωση εικόνας διακόπηκε {{completed}}/{{total}}",
|
||||
"insert-image": "Εισαγωγή εικόνας",
|
||||
"drawing": "Σχέδιο",
|
||||
"drawing": "Σήμανση",
|
||||
"keep-as-attachments": "Διατήρηση ως συνημμένα",
|
||||
"uploading-inline-image": "Μεταφόρτωση σε περιεχόμενο",
|
||||
"uploading-images": "Μεταφόρτωση εικόνων {{completed}}/{{total}}"
|
||||
},
|
||||
"drawing": {
|
||||
"new-title": "Νέο σχέδιο",
|
||||
"edit": "Επεξεργασία σχεδίου",
|
||||
"edit": "Επεξεργασία σήμανσης",
|
||||
"tools": "Εργαλεία",
|
||||
"tool-select": "Επιλογή",
|
||||
"tool-pen": "Στυλό",
|
||||
@@ -239,8 +238,8 @@
|
||||
"color-violet": "Βιολετί",
|
||||
"undo": "Αναίρεση",
|
||||
"redo": "Επανάληψη",
|
||||
"zoom": "Μεγέθυνση",
|
||||
"zoom-to-fit": "Προσαρμογή στο παράθυρο",
|
||||
"done": "Τέλος",
|
||||
"discard-title": "Απόρριψη αυτού του σχεδίου;",
|
||||
"discard-description": "Δεν έχει προστεθεί ακόμη στο σημείωμα.",
|
||||
"discard-edit-title": "Απόρριψη των αλλαγών;",
|
||||
@@ -250,7 +249,13 @@
|
||||
"open-failed": "Δεν ήταν δυνατό το άνοιγμα του σχεδίου. Δοκιμάστε ξανά.",
|
||||
"export-failed": "Δεν ήταν δυνατή η αποθήκευση του σχεδίου. Δοκιμάστε ξανά.",
|
||||
"image-failed": "Δεν ήταν δυνατή η προσθήκη της εικόνας στο σχέδιο.",
|
||||
"saved-without-drawing": "Το σημείωμα αποθηκεύτηκε, αλλά το σχέδιο όχι. Αποθηκεύστε ξανά για νέα προσπάθεια."
|
||||
"saved-without-drawing": "Το σημείωμα αποθηκεύτηκε, αλλά το σχέδιο όχι. Αποθηκεύστε ξανά για νέα προσπάθεια.",
|
||||
"annotate": "Σήμανση",
|
||||
"save-copy": "Αποθήκευση αντιγράφου",
|
||||
"unavailable": "Ο προορισμός δεν είναι διαθέσιμος.",
|
||||
"saved-needs-update": "Το σχέδιο αποθηκεύτηκε. Δοκιμάστε ξανά την ενημέρωση της σημείωσης.",
|
||||
"changed-save-copy": "Το πρωτότυπο άλλαξε. Αποθηκεύστε αντίγραφο.",
|
||||
"bind-failed": "Το σχέδιο μεταφορτώθηκε. Δοκιμάστε ξανά την προσθήκη στη σημείωση."
|
||||
},
|
||||
"no-changes-detected": "Δεν εντοπίστηκαν αλλαγές",
|
||||
"save": "Εκτός",
|
||||
|
||||
@@ -168,15 +168,14 @@
|
||||
"image-upload-failed": "Some images could not be uploaded. Retry or keep the uploaded files as attachments.",
|
||||
"image-upload-stopped": "Image upload stopped {{completed}}/{{total}}",
|
||||
"insert-image": "Insert image",
|
||||
"drawing": "Drawing",
|
||||
"drawing": "Markup",
|
||||
"keep-as-attachments": "Keep as attachments",
|
||||
"retry-image-upload": "Retry",
|
||||
"uploading-inline-image": "Uploading to content",
|
||||
"uploading-images": "Uploading images {{completed}}/{{total}}"
|
||||
},
|
||||
"drawing": {
|
||||
"new-title": "New drawing",
|
||||
"edit": "Edit drawing",
|
||||
"edit": "Edit markup",
|
||||
"tools": "Tools",
|
||||
"tool-select": "Select",
|
||||
"tool-pen": "Pen",
|
||||
@@ -201,8 +200,8 @@
|
||||
"color-violet": "Violet",
|
||||
"undo": "Undo",
|
||||
"redo": "Redo",
|
||||
"zoom": "Zoom",
|
||||
"zoom-to-fit": "Zoom to fit",
|
||||
"done": "Done",
|
||||
"discard-title": "Discard this drawing?",
|
||||
"discard-description": "It hasn't been added to the memo yet.",
|
||||
"discard-edit-title": "Discard your changes?",
|
||||
@@ -212,7 +211,13 @@
|
||||
"open-failed": "Couldn't open the drawing. Try again.",
|
||||
"export-failed": "Couldn't save the drawing. Try again.",
|
||||
"image-failed": "Couldn't add the image to the drawing.",
|
||||
"saved-without-drawing": "The memo is saved, but the drawing isn't. Save again to retry."
|
||||
"saved-without-drawing": "The memo is saved, but the drawing isn't. Save again to retry.",
|
||||
"annotate": "Markup",
|
||||
"save-copy": "Save copy",
|
||||
"unavailable": "The destination is unavailable.",
|
||||
"saved-needs-update": "Drawing saved. Retry the memo update.",
|
||||
"changed-save-copy": "The original changed. Save a copy to keep your drawing.",
|
||||
"bind-failed": "Drawing uploaded. Retry adding it to the memo."
|
||||
},
|
||||
"no-changes-detected": "No changes detected",
|
||||
"save": "Save",
|
||||
|
||||
+10
-5
@@ -287,7 +287,7 @@
|
||||
"image-upload-failed": "Some images could not be uploaded. Retry or keep the uploaded files as attachments.",
|
||||
"image-upload-stopped": "Image upload stopped {{completed}}/{{total}}",
|
||||
"insert-image": "Insert image",
|
||||
"drawing": "Drawing",
|
||||
"drawing": "Markup",
|
||||
"keep-as-attachments": "Keep as attachments",
|
||||
"link-memo": "Link memo",
|
||||
"retry-image-upload": "Retry",
|
||||
@@ -295,8 +295,7 @@
|
||||
"uploading-images": "Uploading images {{completed}}/{{total}}"
|
||||
},
|
||||
"drawing": {
|
||||
"new-title": "New drawing",
|
||||
"edit": "Edit drawing",
|
||||
"edit": "Edit markup",
|
||||
"tools": "Tools",
|
||||
"tool-select": "Select",
|
||||
"tool-pen": "Pen",
|
||||
@@ -321,8 +320,8 @@
|
||||
"color-violet": "Violet",
|
||||
"undo": "Undo",
|
||||
"redo": "Redo",
|
||||
"zoom": "Zoom",
|
||||
"zoom-to-fit": "Zoom to fit",
|
||||
"done": "Done",
|
||||
"discard-title": "Discard this drawing?",
|
||||
"discard-description": "It hasn't been added to the memo yet.",
|
||||
"discard-edit-title": "Discard your changes?",
|
||||
@@ -332,7 +331,13 @@
|
||||
"open-failed": "Couldn't open the drawing. Try again.",
|
||||
"export-failed": "Couldn't save the drawing. Try again.",
|
||||
"image-failed": "Couldn't add the image to the drawing.",
|
||||
"saved-without-drawing": "The memo is saved, but the drawing isn't. Save again to retry."
|
||||
"saved-without-drawing": "The memo is saved, but the drawing isn't. Save again to retry.",
|
||||
"annotate": "Markup",
|
||||
"save-copy": "Save copy",
|
||||
"unavailable": "The destination is unavailable.",
|
||||
"saved-needs-update": "Drawing saved. Retry the memo update.",
|
||||
"changed-save-copy": "The original changed. Save a copy to keep your drawing.",
|
||||
"bind-failed": "Drawing uploaded. Retry adding it to the memo."
|
||||
},
|
||||
"new-memo": "New memo",
|
||||
"no-changes-detected": "No changes detected",
|
||||
|
||||
+10
-5
@@ -169,14 +169,13 @@
|
||||
"image-upload-failed": "No se pudieron cargar algunas imágenes. Inténtalo de nuevo o guarda los archivos cargados como adjuntos.",
|
||||
"image-upload-stopped": "Se detuvo la carga de la imagen {{completed}}/{{total}}",
|
||||
"insert-image": "Insertar imagen",
|
||||
"drawing": "Dibujo",
|
||||
"drawing": "Marcación",
|
||||
"keep-as-attachments": "Guardar como adjuntos",
|
||||
"uploading-inline-image": "Cargando contenido",
|
||||
"uploading-images": "Cargando imágenes {{completed}}/{{total}}"
|
||||
},
|
||||
"drawing": {
|
||||
"new-title": "Nuevo dibujo",
|
||||
"edit": "Editar dibujo",
|
||||
"edit": "Editar marcación",
|
||||
"tools": "Herramientas",
|
||||
"tool-select": "Seleccionar",
|
||||
"tool-pen": "Lápiz",
|
||||
@@ -201,8 +200,8 @@
|
||||
"color-violet": "Violeta",
|
||||
"undo": "Deshacer",
|
||||
"redo": "Rehacer",
|
||||
"zoom": "Zoom",
|
||||
"zoom-to-fit": "Ajustar a la pantalla",
|
||||
"done": "Listo",
|
||||
"discard-title": "¿Descartar este dibujo?",
|
||||
"discard-description": "Todavía no se ha añadido al memo.",
|
||||
"discard-edit-title": "¿Descartar los cambios?",
|
||||
@@ -212,7 +211,13 @@
|
||||
"open-failed": "No se pudo abrir el dibujo. Inténtalo de nuevo.",
|
||||
"export-failed": "No se pudo guardar el dibujo. Inténtalo de nuevo.",
|
||||
"image-failed": "No se pudo añadir la imagen al dibujo.",
|
||||
"saved-without-drawing": "El memo se ha guardado, pero el dibujo no. Guarda de nuevo para reintentarlo."
|
||||
"saved-without-drawing": "El memo se ha guardado, pero el dibujo no. Guarda de nuevo para reintentarlo.",
|
||||
"annotate": "Marcación",
|
||||
"save-copy": "Guardar copia",
|
||||
"unavailable": "El destino no está disponible.",
|
||||
"saved-needs-update": "Dibujo guardado. Reintenta actualizar la nota.",
|
||||
"changed-save-copy": "El original ha cambiado. Guarda una copia.",
|
||||
"bind-failed": "Dibujo subido. Reintenta añadirlo a la nota."
|
||||
},
|
||||
"no-changes-detected": "No se detectaron cambios",
|
||||
"save": "Guardar",
|
||||
|
||||
+10
-5
@@ -207,14 +207,13 @@
|
||||
"image-upload-failed": "Mõnda pilti ei õnnestunud üles laadida. Proovige uuesti või hoidke üleslaaditud failid manusena.",
|
||||
"image-upload-stopped": "Pildi üleslaadimine peatatud {{completed}}/{{total}}",
|
||||
"insert-image": "Lisa pilt",
|
||||
"drawing": "Joonistus",
|
||||
"drawing": "Märgistus",
|
||||
"keep-as-attachments": "Säilita manusena",
|
||||
"uploading-inline-image": "Üleslaadimine sisusse",
|
||||
"uploading-images": "Piltide üleslaadimine {{completed}}/{{total}}"
|
||||
},
|
||||
"drawing": {
|
||||
"new-title": "Uus joonistus",
|
||||
"edit": "Muuda joonistust",
|
||||
"edit": "Muuda märgistust",
|
||||
"tools": "Tööriistad",
|
||||
"tool-select": "Vali",
|
||||
"tool-pen": "Pliiats",
|
||||
@@ -239,8 +238,8 @@
|
||||
"color-violet": "Violetne",
|
||||
"undo": "Võta tagasi",
|
||||
"redo": "Tee uuesti",
|
||||
"zoom": "Suum",
|
||||
"zoom-to-fit": "Sobita aknasse",
|
||||
"done": "Valmis",
|
||||
"discard-title": "Kas loobuda sellest joonistusest?",
|
||||
"discard-description": "Seda pole veel memole lisatud.",
|
||||
"discard-edit-title": "Kas loobuda muudatustest?",
|
||||
@@ -250,7 +249,13 @@
|
||||
"open-failed": "Joonistust ei õnnestunud avada. Proovige uuesti.",
|
||||
"export-failed": "Joonistust ei õnnestunud salvestada. Proovige uuesti.",
|
||||
"image-failed": "Pilti ei õnnestunud joonistusele lisada.",
|
||||
"saved-without-drawing": "Memo on salvestatud, kuid joonistus mitte. Salvestage veel kord, et uuesti proovida."
|
||||
"saved-without-drawing": "Memo on salvestatud, kuid joonistus mitte. Salvestage veel kord, et uuesti proovida.",
|
||||
"annotate": "Märgistus",
|
||||
"save-copy": "Salvesta koopia",
|
||||
"unavailable": "Sihtkoht pole saadaval.",
|
||||
"saved-needs-update": "Joonistus salvestatud. Proovi märget uuesti uuendada.",
|
||||
"changed-save-copy": "Algne fail on muutunud. Salvesta koopia.",
|
||||
"bind-failed": "Joonistus üles laaditud. Proovi seda uuesti märkmesse lisada."
|
||||
},
|
||||
"no-changes-detected": "Muudatusi ei tuvastatud",
|
||||
"save": "Salvesta",
|
||||
|
||||
+10
-5
@@ -168,7 +168,7 @@
|
||||
"link-memo": "پیوند یادداشت",
|
||||
"image-upload-stopped": "آپلود تصویر متوقف شد {{completed}}/{{total}}",
|
||||
"insert-image": "درج تصویر",
|
||||
"drawing": "نقاشی",
|
||||
"drawing": "نشانهگذاری",
|
||||
"keep-as-attachments": "به عنوان پیوست نگه دارید",
|
||||
"retry-image-upload": "دوباره امتحان کنید",
|
||||
"uploading-inline-image": "در حال آپلود به محتوا",
|
||||
@@ -177,8 +177,7 @@
|
||||
"image-upload-failed": "برخی تصاویر بارگذاری نشدند. دوباره تلاش کنید یا فایلهای بارگذاریشده را بهعنوان پیوست نگه دارید."
|
||||
},
|
||||
"drawing": {
|
||||
"new-title": "نقاشی جدید",
|
||||
"edit": "ویرایش نقاشی",
|
||||
"edit": "ویرایش نشانهگذاری",
|
||||
"tools": "ابزارها",
|
||||
"tool-select": "انتخاب",
|
||||
"tool-pen": "قلم",
|
||||
@@ -203,8 +202,8 @@
|
||||
"color-violet": "بنفش",
|
||||
"undo": "واگرد",
|
||||
"redo": "ازنو",
|
||||
"zoom": "بزرگنمایی",
|
||||
"zoom-to-fit": "متناسب با پنجره",
|
||||
"done": "انجام شد",
|
||||
"discard-title": "این نقاشی دور ریخته شود؟",
|
||||
"discard-description": "هنوز به یادداشت افزوده نشده است.",
|
||||
"discard-edit-title": "تغییرات دور ریخته شود؟",
|
||||
@@ -214,7 +213,13 @@
|
||||
"open-failed": "باز کردن نقاشی ممکن نشد. دوباره تلاش کنید.",
|
||||
"export-failed": "ذخیرهٔ نقاشی ممکن نشد. دوباره تلاش کنید.",
|
||||
"image-failed": "افزودن تصویر به نقاشی ممکن نشد.",
|
||||
"saved-without-drawing": "یادداشت ذخیره شد، اما نقاشی ذخیره نشد. برای تلاش مجدد، دوباره ذخیره کنید."
|
||||
"saved-without-drawing": "یادداشت ذخیره شد، اما نقاشی ذخیره نشد. برای تلاش مجدد، دوباره ذخیره کنید.",
|
||||
"annotate": "نشانهگذاری",
|
||||
"save-copy": "ذخیره نسخه",
|
||||
"unavailable": "مقصد در دسترس نیست.",
|
||||
"saved-needs-update": "نقاشی ذخیره شد. بهروزرسانی یادداشت را دوباره امتحان کنید.",
|
||||
"changed-save-copy": "نسخه اصلی تغییر کرده است. یک نسخه ذخیره کنید.",
|
||||
"bind-failed": "نقاشی بارگذاری شد. افزودن به یادداشت را دوباره امتحان کنید."
|
||||
},
|
||||
"audio-recorder": {
|
||||
"attachment-label": "ضبط صدا",
|
||||
|
||||
+10
-5
@@ -207,14 +207,13 @@
|
||||
"image-upload-failed": "Joidenkin kuvien lataaminen epäonnistui. Yritä uudelleen tai säilytä ladatut tiedostot liitteinä.",
|
||||
"image-upload-stopped": "Kuvan lataus pysähtynyt {{completed}}/{{total}}",
|
||||
"insert-image": "Lisää kuva",
|
||||
"drawing": "Piirros",
|
||||
"drawing": "Merkintä",
|
||||
"keep-as-attachments": "Säilytä liitteinä",
|
||||
"uploading-inline-image": "Ladataan sisältöön",
|
||||
"uploading-images": "Kuvien lataus {{completed}}/{{total}}"
|
||||
},
|
||||
"drawing": {
|
||||
"new-title": "Uusi piirros",
|
||||
"edit": "Muokkaa piirrosta",
|
||||
"edit": "Muokkaa merkintää",
|
||||
"tools": "Työkalut",
|
||||
"tool-select": "Valitse",
|
||||
"tool-pen": "Kynä",
|
||||
@@ -239,8 +238,8 @@
|
||||
"color-violet": "Violetti",
|
||||
"undo": "Kumoa",
|
||||
"redo": "Tee uudelleen",
|
||||
"zoom": "Zoomaus",
|
||||
"zoom-to-fit": "Sovita näkymään",
|
||||
"done": "Valmis",
|
||||
"discard-title": "Hylätäänkö tämä piirros?",
|
||||
"discard-description": "Sitä ei ole vielä lisätty muistioon.",
|
||||
"discard-edit-title": "Hylätäänkö muutokset?",
|
||||
@@ -250,7 +249,13 @@
|
||||
"open-failed": "Piirroksen avaaminen epäonnistui. Yritä uudelleen.",
|
||||
"export-failed": "Piirroksen tallentaminen epäonnistui. Yritä uudelleen.",
|
||||
"image-failed": "Kuvan lisääminen piirrokseen epäonnistui.",
|
||||
"saved-without-drawing": "Muistio on tallennettu, mutta piirrosta ei. Tallenna uudelleen yrittääksesi uudestaan."
|
||||
"saved-without-drawing": "Muistio on tallennettu, mutta piirrosta ei. Tallenna uudelleen yrittääksesi uudestaan.",
|
||||
"annotate": "Merkintä",
|
||||
"save-copy": "Tallenna kopio",
|
||||
"unavailable": "Kohde ei ole käytettävissä.",
|
||||
"saved-needs-update": "Piirros tallennettu. Yritä päivittää muistiinpano uudelleen.",
|
||||
"changed-save-copy": "Alkuperäinen on muuttunut. Tallenna kopio.",
|
||||
"bind-failed": "Piirros lähetetty. Yritä lisätä se muistiinpanoon uudelleen."
|
||||
},
|
||||
"no-changes-detected": "Muutoksia ei havaittu",
|
||||
"save": "Tallentaa",
|
||||
|
||||
+10
-5
@@ -169,14 +169,13 @@
|
||||
"image-upload-failed": "Certaines images n'ont pas pu être chargées. Veuillez réessayer ou conserver les fichiers chargés en pièces jointes.",
|
||||
"image-upload-stopped": "Chargement d'image interrompu {{completed}}/{{total}}",
|
||||
"insert-image": "Insérer une image",
|
||||
"drawing": "Dessin",
|
||||
"drawing": "Annotation",
|
||||
"keep-as-attachments": "Conserver en pièces jointes",
|
||||
"uploading-inline-image": "Chargement du contenu",
|
||||
"uploading-images": "Chargement des images {{completed}}/{{total}}"
|
||||
},
|
||||
"drawing": {
|
||||
"new-title": "Nouveau dessin",
|
||||
"edit": "Modifier le dessin",
|
||||
"edit": "Modifier l’annotation",
|
||||
"tools": "Outils",
|
||||
"tool-select": "Sélection",
|
||||
"tool-pen": "Stylo",
|
||||
@@ -201,8 +200,8 @@
|
||||
"color-violet": "Violet",
|
||||
"undo": "Annuler",
|
||||
"redo": "Rétablir",
|
||||
"zoom": "Zoom",
|
||||
"zoom-to-fit": "Ajuster à la fenêtre",
|
||||
"done": "Terminé",
|
||||
"discard-title": "Abandonner ce dessin ?",
|
||||
"discard-description": "Il n'a pas encore été ajouté au mémo.",
|
||||
"discard-edit-title": "Abandonner vos modifications ?",
|
||||
@@ -212,7 +211,13 @@
|
||||
"open-failed": "Impossible d'ouvrir le dessin. Veuillez réessayer.",
|
||||
"export-failed": "Impossible d'enregistrer le dessin. Veuillez réessayer.",
|
||||
"image-failed": "Impossible d'ajouter l'image au dessin.",
|
||||
"saved-without-drawing": "Le mémo est enregistré, mais pas le dessin. Enregistrez à nouveau pour réessayer."
|
||||
"saved-without-drawing": "Le mémo est enregistré, mais pas le dessin. Enregistrez à nouveau pour réessayer.",
|
||||
"annotate": "Annotation",
|
||||
"save-copy": "Enregistrer une copie",
|
||||
"unavailable": "La destination est indisponible.",
|
||||
"saved-needs-update": "Dessin enregistré. Réessayez la mise à jour du mémo.",
|
||||
"changed-save-copy": "L’original a changé. Enregistrez une copie.",
|
||||
"bind-failed": "Dessin téléversé. Réessayez de l’ajouter au mémo."
|
||||
},
|
||||
"no-changes-detected": "Aucun changement détecté",
|
||||
"save": "Enregistrer",
|
||||
|
||||
+10
-5
@@ -169,14 +169,13 @@
|
||||
"image-upload-failed": "Non se puideron cargar algunhas imaxes. Téntao de novo ou garda os ficheiros cargados como anexos.",
|
||||
"image-upload-stopped": "Detívose a subida de imaxes {{completed}}/{{total}}",
|
||||
"insert-image": "Inserir imaxe",
|
||||
"drawing": "Debuxo",
|
||||
"drawing": "Marcado",
|
||||
"keep-as-attachments": "Gardar como anexos",
|
||||
"uploading-inline-image": "Subindo ao contido",
|
||||
"uploading-images": "Subindo imaxes {{completed}}/{{total}}"
|
||||
},
|
||||
"drawing": {
|
||||
"new-title": "Novo debuxo",
|
||||
"edit": "Editar debuxo",
|
||||
"edit": "Editar marcado",
|
||||
"tools": "Ferramentas",
|
||||
"tool-select": "Seleccionar",
|
||||
"tool-pen": "Lapis",
|
||||
@@ -201,8 +200,8 @@
|
||||
"color-violet": "Violeta",
|
||||
"undo": "Desfacer",
|
||||
"redo": "Refacer",
|
||||
"zoom": "Zoom",
|
||||
"zoom-to-fit": "Axustar á pantalla",
|
||||
"done": "Feito",
|
||||
"discard-title": "Descartar este debuxo?",
|
||||
"discard-description": "Aínda non se engadiu á nota.",
|
||||
"discard-edit-title": "Descartar os cambios?",
|
||||
@@ -212,7 +211,13 @@
|
||||
"open-failed": "Non se puido abrir o debuxo. Téntao de novo.",
|
||||
"export-failed": "Non se puido gardar o debuxo. Téntao de novo.",
|
||||
"image-failed": "Non se puido engadir a imaxe ao debuxo.",
|
||||
"saved-without-drawing": "A nota gardouse, pero o debuxo non. Garda de novo para tentalo outra vez."
|
||||
"saved-without-drawing": "A nota gardouse, pero o debuxo non. Garda de novo para tentalo outra vez.",
|
||||
"annotate": "Marcado",
|
||||
"save-copy": "Gardar copia",
|
||||
"unavailable": "O destino non está dispoñible.",
|
||||
"saved-needs-update": "Debuxo gardado. Tenta actualizar a nota de novo.",
|
||||
"changed-save-copy": "O orixinal cambiou. Garda unha copia.",
|
||||
"bind-failed": "Debuxo subido. Tenta engadilo á nota de novo."
|
||||
},
|
||||
"no-changes-detected": "Non se detectaron cambios",
|
||||
"save": "Gardar",
|
||||
|
||||
+10
-5
@@ -253,7 +253,7 @@
|
||||
"image-upload-failed": "לא ניתן להעלות חלק מהתמונות. נסו שוב או השאירו את התמונות שהועלו כקבצים מצורפים.",
|
||||
"image-upload-stopped": "העלאת התמונה נעצרה {{completed}}/{{total}}",
|
||||
"insert-image": "הוסף תמונה",
|
||||
"drawing": "ציור",
|
||||
"drawing": "סימון",
|
||||
"keep-as-attachments": "שמור כקבצים מצורפים",
|
||||
"link-memo": "קשר פתק",
|
||||
"retry-image-upload": "נסה שוב",
|
||||
@@ -261,8 +261,7 @@
|
||||
"uploading-images": "מעלה תמונות {{completed}}/{{total}}"
|
||||
},
|
||||
"drawing": {
|
||||
"new-title": "ציור חדש",
|
||||
"edit": "עריכת ציור",
|
||||
"edit": "עריכת סימון",
|
||||
"tools": "כלים",
|
||||
"tool-select": "בחירה",
|
||||
"tool-pen": "עט",
|
||||
@@ -287,8 +286,8 @@
|
||||
"color-violet": "סגול",
|
||||
"undo": "ביטול פעולה",
|
||||
"redo": "ביצוע חוזר",
|
||||
"zoom": "תקריב",
|
||||
"zoom-to-fit": "התאמה לחלון",
|
||||
"done": "סיום",
|
||||
"discard-title": "למחוק את הציור הזה?",
|
||||
"discard-description": "הוא עדיין לא נוסף לפתק.",
|
||||
"discard-edit-title": "לבטל את השינויים?",
|
||||
@@ -298,7 +297,13 @@
|
||||
"open-failed": "לא ניתן היה לפתוח את הציור. נסו שוב.",
|
||||
"export-failed": "לא ניתן היה לשמור את הציור. נסו שוב.",
|
||||
"image-failed": "לא ניתן היה להוסיף את התמונה לציור.",
|
||||
"saved-without-drawing": "הפתק נשמר, אבל הציור לא. שמרו שוב כדי לנסות מחדש."
|
||||
"saved-without-drawing": "הפתק נשמר, אבל הציור לא. שמרו שוב כדי לנסות מחדש.",
|
||||
"annotate": "סימון",
|
||||
"save-copy": "שמירת עותק",
|
||||
"unavailable": "היעד אינו זמין.",
|
||||
"saved-needs-update": "הציור נשמר. נסו שוב לעדכן את ההערה.",
|
||||
"changed-save-copy": "המקור השתנה. שמרו עותק.",
|
||||
"bind-failed": "הציור הועלה. נסו שוב להוסיף אותו להערה."
|
||||
},
|
||||
"no-changes-detected": "לא זוהו שינויים",
|
||||
"save": "שמור",
|
||||
|
||||
+10
-5
@@ -170,15 +170,14 @@
|
||||
"image-upload-failed": "कुछ इमेज अपलोड नहीं हो सकीं. दोबारा कोशिश करें या अपलोड की गई फ़ाइलों को अटैचमेंट के तौर पर रखें.",
|
||||
"image-upload-stopped": "इमेज अपलोड रुक गया {{completed}}/{{total}}",
|
||||
"insert-image": "इमेज डालें",
|
||||
"drawing": "ड्रॉइंग",
|
||||
"drawing": "मार्कअप",
|
||||
"keep-as-attachments": "अटैचमेंट के तौर पर रखें",
|
||||
"retry-image-upload": "फिर से कोशिश करें",
|
||||
"uploading-inline-image": "कंटेंट में अपलोड हो रहा है",
|
||||
"uploading-images": "इमेज अपलोड हो रही हैं {{completed}}/{{total}}"
|
||||
},
|
||||
"drawing": {
|
||||
"new-title": "नई ड्रॉइंग",
|
||||
"edit": "ड्रॉइंग संपादित करें",
|
||||
"edit": "मार्कअप संपादित करें",
|
||||
"tools": "टूल",
|
||||
"tool-select": "चुनें",
|
||||
"tool-pen": "पेन",
|
||||
@@ -203,8 +202,8 @@
|
||||
"color-violet": "बैंगनी",
|
||||
"undo": "पूर्ववत करें",
|
||||
"redo": "फिर से करें",
|
||||
"zoom": "ज़ूम",
|
||||
"zoom-to-fit": "विंडो में फ़िट करें",
|
||||
"done": "हो गया",
|
||||
"discard-title": "यह ड्रॉइंग हटाएँ?",
|
||||
"discard-description": "इसे अभी तक मेमो में नहीं जोड़ा गया है।",
|
||||
"discard-edit-title": "अपने बदलाव हटाएँ?",
|
||||
@@ -214,7 +213,13 @@
|
||||
"open-failed": "ड्रॉइंग नहीं खुल सकी। फिर से कोशिश करें।",
|
||||
"export-failed": "ड्रॉइंग सहेजी नहीं जा सकी। फिर से कोशिश करें।",
|
||||
"image-failed": "इमेज को ड्रॉइंग में नहीं जोड़ा जा सका।",
|
||||
"saved-without-drawing": "मेमो सहेज लिया गया, लेकिन ड्रॉइंग नहीं। फिर से कोशिश करने के लिए दोबारा सहेजें।"
|
||||
"saved-without-drawing": "मेमो सहेज लिया गया, लेकिन ड्रॉइंग नहीं। फिर से कोशिश करने के लिए दोबारा सहेजें।",
|
||||
"annotate": "मार्कअप",
|
||||
"save-copy": "प्रति सहेजें",
|
||||
"unavailable": "गंतव्य उपलब्ध नहीं है।",
|
||||
"saved-needs-update": "चित्र सहेजा गया। नोट अपडेट करने का फिर प्रयास करें।",
|
||||
"changed-save-copy": "मूल बदल गया है। एक प्रति सहेजें।",
|
||||
"bind-failed": "चित्र अपलोड हो गया। नोट में जोड़ने का फिर प्रयास करें।"
|
||||
},
|
||||
"audio-recorder": {
|
||||
"attachment-label": "ऑडियो रिकॉर्डिंग",
|
||||
|
||||
+10
-5
@@ -169,14 +169,13 @@
|
||||
"image-upload-failed": "Neke slike nije moguće prenijeti. Pokušajte ponovno ili zadržite prenesene datoteke kao privitke.",
|
||||
"image-upload-stopped": "Prijenos slike zaustavljen {{completed}}/{{total}}",
|
||||
"insert-image": "Umetni sliku",
|
||||
"drawing": "Crtež",
|
||||
"drawing": "Označavanje",
|
||||
"keep-as-attachments": "Zadrži kao privitke",
|
||||
"uploading-inline-image": "Prijenos u sadržaj",
|
||||
"uploading-images": "Prijenos slika {{completed}}/{{total}}"
|
||||
},
|
||||
"drawing": {
|
||||
"new-title": "Novi crtež",
|
||||
"edit": "Uredi crtež",
|
||||
"edit": "Uredi oznake",
|
||||
"tools": "Alati",
|
||||
"tool-select": "Odabir",
|
||||
"tool-pen": "Olovka",
|
||||
@@ -201,8 +200,8 @@
|
||||
"color-violet": "Ljubičasta",
|
||||
"undo": "Poništi",
|
||||
"redo": "Ponovi",
|
||||
"zoom": "Zumiranje",
|
||||
"zoom-to-fit": "Prilagodi prozoru",
|
||||
"done": "Gotovo",
|
||||
"discard-title": "Odbaciti ovaj crtež?",
|
||||
"discard-description": "Još nije dodan u memo.",
|
||||
"discard-edit-title": "Odbaciti promjene?",
|
||||
@@ -212,7 +211,13 @@
|
||||
"open-failed": "Crtež nije moguće otvoriti. Pokušajte ponovno.",
|
||||
"export-failed": "Crtež nije moguće spremiti. Pokušajte ponovno.",
|
||||
"image-failed": "Sliku nije moguće dodati u crtež.",
|
||||
"saved-without-drawing": "Memo je spremljen, ali crtež nije. Sačuvajte ponovno za novi pokušaj."
|
||||
"saved-without-drawing": "Memo je spremljen, ali crtež nije. Sačuvajte ponovno za novi pokušaj.",
|
||||
"annotate": "Označavanje",
|
||||
"save-copy": "Spremi kopiju",
|
||||
"unavailable": "Odredište nije dostupno.",
|
||||
"saved-needs-update": "Crtež je spremljen. Pokušajte ponovno ažurirati bilješku.",
|
||||
"changed-save-copy": "Izvornik je promijenjen. Spremite kopiju.",
|
||||
"bind-failed": "Crtež je prenesen. Pokušajte ga ponovno dodati u bilješku."
|
||||
},
|
||||
"no-changes-detected": "Nema promjena",
|
||||
"save": "Sačuvaj",
|
||||
|
||||
+10
-5
@@ -169,14 +169,13 @@
|
||||
"image-upload-failed": "Néhány kép feltöltése sikertelen. Próbálja újra, vagy tartsa meg a feltöltött fájlokat mellékletként.",
|
||||
"image-upload-stopped": "Képfeltöltés leállítva {{completed}}/{{total}}",
|
||||
"insert-image": "Kép beszúrása",
|
||||
"drawing": "Rajz",
|
||||
"drawing": "Jelölés",
|
||||
"keep-as-attachments": "Megtartás mellékletként",
|
||||
"uploading-inline-image": "Feltöltés a tartalomhoz",
|
||||
"uploading-images": "Képek feltöltése {{completed}}/{{total}}"
|
||||
},
|
||||
"drawing": {
|
||||
"new-title": "Új rajz",
|
||||
"edit": "Rajz szerkesztése",
|
||||
"edit": "Jelölés szerkesztése",
|
||||
"tools": "Eszközök",
|
||||
"tool-select": "Kijelölés",
|
||||
"tool-pen": "Toll",
|
||||
@@ -201,8 +200,8 @@
|
||||
"color-violet": "Ibolya",
|
||||
"undo": "Visszavonás",
|
||||
"redo": "Újra",
|
||||
"zoom": "Nagyítás",
|
||||
"zoom-to-fit": "Igazítás az ablakhoz",
|
||||
"done": "Kész",
|
||||
"discard-title": "Elveti ezt a rajzot?",
|
||||
"discard-description": "Még nincs hozzáadva a jegyzethez.",
|
||||
"discard-edit-title": "Elveti a módosításokat?",
|
||||
@@ -212,7 +211,13 @@
|
||||
"open-failed": "Nem sikerült megnyitni a rajzot. Próbálja újra.",
|
||||
"export-failed": "Nem sikerült menteni a rajzot. Próbálja újra.",
|
||||
"image-failed": "Nem sikerült hozzáadni a képet a rajzhoz.",
|
||||
"saved-without-drawing": "A jegyzet mentve, de a rajz nem. Mentse újra az újrapróbálkozáshoz."
|
||||
"saved-without-drawing": "A jegyzet mentve, de a rajz nem. Mentse újra az újrapróbálkozáshoz.",
|
||||
"annotate": "Jelölés",
|
||||
"save-copy": "Másolat mentése",
|
||||
"unavailable": "A cél nem érhető el.",
|
||||
"saved-needs-update": "A rajz mentve. Próbálja újra a jegyzet frissítését.",
|
||||
"changed-save-copy": "Az eredeti megváltozott. Mentsen másolatot.",
|
||||
"bind-failed": "A rajz feltöltve. Próbálja újra hozzáadni a jegyzethez."
|
||||
},
|
||||
"no-changes-detected": "Nincs változás",
|
||||
"save": "Mentés",
|
||||
|
||||
+10
-5
@@ -170,15 +170,14 @@
|
||||
"image-upload-failed": "Beberapa gambar tidak dapat diunggah. Coba lagi atau simpan file yang diunggah sebagai lampiran.",
|
||||
"image-upload-stopped": "Unggahan gambar dihentikan {{completed}}/{{total}}",
|
||||
"insert-image": "Sisipkan gambar",
|
||||
"drawing": "Sketsa",
|
||||
"drawing": "Anotasi",
|
||||
"keep-as-attachments": "Simpan sebagai lampiran",
|
||||
"retry-image-upload": "Coba lagi",
|
||||
"uploading-inline-image": "Mengunggah ke konten",
|
||||
"uploading-images": "Mengunggah gambar {{completed}}/{{total}}"
|
||||
},
|
||||
"drawing": {
|
||||
"new-title": "Sketsa baru",
|
||||
"edit": "Edit sketsa",
|
||||
"edit": "Edit anotasi",
|
||||
"tools": "Alat",
|
||||
"tool-select": "Pilih",
|
||||
"tool-pen": "Pena",
|
||||
@@ -203,8 +202,8 @@
|
||||
"color-violet": "Ungu",
|
||||
"undo": "Urungkan",
|
||||
"redo": "Ulangi",
|
||||
"zoom": "Zoom",
|
||||
"zoom-to-fit": "Paskan ke jendela",
|
||||
"done": "Selesai",
|
||||
"discard-title": "Buang sketsa ini?",
|
||||
"discard-description": "Sketsa belum ditambahkan ke memo.",
|
||||
"discard-edit-title": "Buang perubahan Anda?",
|
||||
@@ -214,7 +213,13 @@
|
||||
"open-failed": "Tidak dapat membuka sketsa. Coba lagi.",
|
||||
"export-failed": "Tidak dapat menyimpan sketsa. Coba lagi.",
|
||||
"image-failed": "Tidak dapat menambahkan gambar ke sketsa.",
|
||||
"saved-without-drawing": "Memo tersimpan, tetapi sketsa belum. Simpan lagi untuk mencoba ulang."
|
||||
"saved-without-drawing": "Memo tersimpan, tetapi sketsa belum. Simpan lagi untuk mencoba ulang.",
|
||||
"annotate": "Anotasi",
|
||||
"save-copy": "Simpan salinan",
|
||||
"unavailable": "Tujuan tidak tersedia.",
|
||||
"saved-needs-update": "Gambar disimpan. Coba perbarui memo lagi.",
|
||||
"changed-save-copy": "Gambar asli berubah. Simpan salinan.",
|
||||
"bind-failed": "Gambar diunggah. Coba tambahkan ke memo lagi."
|
||||
},
|
||||
"audio-recorder": {
|
||||
"attachment-label": "Rekaman audio",
|
||||
|
||||
+10
-5
@@ -168,15 +168,14 @@
|
||||
"add-attachment": "Aggiungi allegato",
|
||||
"image-upload-stopped": "Caricamento immagine interrotto {{completed}}/{{total}}",
|
||||
"insert-image": "Inserisci immagine",
|
||||
"drawing": "Disegno",
|
||||
"drawing": "Annotazione",
|
||||
"keep-as-attachments": "Mantieni come allegati",
|
||||
"uploading-inline-image": "Caricamento nel contenuto",
|
||||
"uploading-images": "Caricamento immagini {{completed}}/{{total}}",
|
||||
"image-upload-failed": "Impossibile caricare alcune immagini. Riprova o mantieni i file caricati come allegati."
|
||||
},
|
||||
"drawing": {
|
||||
"new-title": "Nuovo disegno",
|
||||
"edit": "Modifica disegno",
|
||||
"edit": "Modifica annotazione",
|
||||
"tools": "Strumenti",
|
||||
"tool-select": "Seleziona",
|
||||
"tool-pen": "Penna",
|
||||
@@ -201,8 +200,8 @@
|
||||
"color-violet": "Viola",
|
||||
"undo": "Annulla",
|
||||
"redo": "Ripeti",
|
||||
"zoom": "Zoom",
|
||||
"zoom-to-fit": "Adatta alla finestra",
|
||||
"done": "Fatto",
|
||||
"discard-title": "Eliminare questo disegno?",
|
||||
"discard-description": "Non è ancora stato aggiunto al memo.",
|
||||
"discard-edit-title": "Annullare le modifiche?",
|
||||
@@ -212,7 +211,13 @@
|
||||
"open-failed": "Impossibile aprire il disegno. Riprova.",
|
||||
"export-failed": "Impossibile salvare il disegno. Riprova.",
|
||||
"image-failed": "Impossibile aggiungere l'immagine al disegno.",
|
||||
"saved-without-drawing": "Il memo è stato salvato, ma il disegno no. Salva di nuovo per riprovare."
|
||||
"saved-without-drawing": "Il memo è stato salvato, ma il disegno no. Salva di nuovo per riprovare.",
|
||||
"annotate": "Annotazione",
|
||||
"save-copy": "Salva copia",
|
||||
"unavailable": "Destinazione non disponibile.",
|
||||
"saved-needs-update": "Disegno salvato. Riprova ad aggiornare la nota.",
|
||||
"changed-save-copy": "L’originale è cambiato. Salva una copia.",
|
||||
"bind-failed": "Disegno caricato. Riprova ad aggiungerlo alla nota."
|
||||
},
|
||||
"no-changes-detected": "Nessuna modifica rilevata",
|
||||
"save": "Salva",
|
||||
|
||||
+10
-5
@@ -171,14 +171,13 @@
|
||||
"image-upload-failed": "一部の画像はアップロードできませんでした。再試行するか、アップロード済みのファイルを添付ファイルとして保存してください。",
|
||||
"image-upload-stopped": "画像アップロードが停止しました {{completed}}/{{total}}",
|
||||
"insert-image": "画像を挿入",
|
||||
"drawing": "描画",
|
||||
"drawing": "マークアップ",
|
||||
"keep-as-attachments": "添付ファイルとして保存",
|
||||
"uploading-inline-image": "コンテンツにアップロード中",
|
||||
"uploading-images": "画像 {{completed}}/{{total}} をアップロード中"
|
||||
},
|
||||
"drawing": {
|
||||
"new-title": "新しい描画",
|
||||
"edit": "描画を編集",
|
||||
"edit": "マークアップを編集",
|
||||
"tools": "ツール",
|
||||
"tool-select": "選択",
|
||||
"tool-pen": "ペン",
|
||||
@@ -203,8 +202,8 @@
|
||||
"color-violet": "紫",
|
||||
"undo": "元に戻す",
|
||||
"redo": "やり直す",
|
||||
"zoom": "ズーム",
|
||||
"zoom-to-fit": "全体を表示",
|
||||
"done": "完了",
|
||||
"discard-title": "この描画を破棄しますか?",
|
||||
"discard-description": "まだメモに追加されていません。",
|
||||
"discard-edit-title": "変更を破棄しますか?",
|
||||
@@ -214,7 +213,13 @@
|
||||
"open-failed": "描画を開けませんでした。もう一度お試しください。",
|
||||
"export-failed": "描画を保存できませんでした。もう一度お試しください。",
|
||||
"image-failed": "画像を描画に追加できませんでした。",
|
||||
"saved-without-drawing": "メモは保存されましたが、描画は保存されていません。再試行するには、もう一度保存してください。"
|
||||
"saved-without-drawing": "メモは保存されましたが、描画は保存されていません。再試行するには、もう一度保存してください。",
|
||||
"annotate": "マークアップ",
|
||||
"save-copy": "コピーを保存",
|
||||
"unavailable": "保存先を利用できません。",
|
||||
"saved-needs-update": "描画は保存済みです。メモの更新を再試行してください。",
|
||||
"changed-save-copy": "元の画像が変更されました。コピーを保存してください。",
|
||||
"bind-failed": "描画はアップロード済みです。メモへの追加を再試行してください。"
|
||||
},
|
||||
"audio-recorder": {
|
||||
"attachment-label": "音声録音",
|
||||
|
||||
@@ -169,14 +169,13 @@
|
||||
"image-upload-failed": "ზოგიერთი სურათის ატვირთვა ვერ მოხერხდა. სცადეთ ხელახლა ან შეინახეთ ატვირთული ფაილები დანართებად.",
|
||||
"image-upload-stopped": "სურათის ატვირთვა შეჩერდა {{completed}}/{{total}}",
|
||||
"insert-image": "სურათის ჩასმა",
|
||||
"drawing": "ნახატი",
|
||||
"drawing": "მონიშვნა",
|
||||
"keep-as-attachments": "დანართებად შენახვა",
|
||||
"uploading-inline-image": "კონტენტში ატვირთვა",
|
||||
"uploading-images": "სურათების ატვირთვა {{completed}}/{{total}}"
|
||||
},
|
||||
"drawing": {
|
||||
"new-title": "ახალი ნახატი",
|
||||
"edit": "ნახატის რედაქტირება",
|
||||
"edit": "მონიშვნის რედაქტირება",
|
||||
"tools": "ხელსაწყოები",
|
||||
"tool-select": "მონიშვნა",
|
||||
"tool-pen": "კალამი",
|
||||
@@ -201,8 +200,8 @@
|
||||
"color-violet": "იისფერი",
|
||||
"undo": "გაუქმება",
|
||||
"redo": "გამეორება",
|
||||
"zoom": "მასშტაბი",
|
||||
"zoom-to-fit": "ფანჯარაში მორგება",
|
||||
"done": "მზადაა",
|
||||
"discard-title": "გსურთ ამ ნახატის უარყოფა?",
|
||||
"discard-description": "ის ჯერ არ დამატებულა მემოში.",
|
||||
"discard-edit-title": "გსურთ ცვლილებების უარყოფა?",
|
||||
@@ -212,7 +211,13 @@
|
||||
"open-failed": "ნახატის გახსნა ვერ მოხერხდა. სცადეთ ხელახლა.",
|
||||
"export-failed": "ნახატის შენახვა ვერ მოხერხდა. სცადეთ ხელახლა.",
|
||||
"image-failed": "სურათის ნახატში დამატება ვერ მოხერხდა.",
|
||||
"saved-without-drawing": "მემო შენახულია, ნახატი კი — არა. ხელახლა საცდელად ისევ შეინახეთ."
|
||||
"saved-without-drawing": "მემო შენახულია, ნახატი კი — არა. ხელახლა საცდელად ისევ შეინახეთ.",
|
||||
"annotate": "მონიშვნა",
|
||||
"save-copy": "ასლის შენახვა",
|
||||
"unavailable": "დანიშნულება მიუწვდომელია.",
|
||||
"saved-needs-update": "ნახატი შენახულია. ხელახლა სცადეთ ჩანაწერის განახლება.",
|
||||
"changed-save-copy": "ორიგინალი შეიცვალა. შეინახეთ ასლი.",
|
||||
"bind-failed": "ნახატი ატვირთულია. ხელახლა სცადეთ ჩანაწერში დამატება."
|
||||
},
|
||||
"no-changes-detected": "ცვლილებები არ აღმოჩენილა",
|
||||
"save": "შენახვა",
|
||||
|
||||
+10
-5
@@ -170,15 +170,14 @@
|
||||
"image-upload-failed": "일부 이미지를 업로드할 수 없습니다. 다시 시도하거나 업로드된 파일을 첨부 파일로 유지하세요.",
|
||||
"image-upload-stopped": "이미지 업로드 중지됨 {{completed}}/{{total}}",
|
||||
"insert-image": "이미지 삽입",
|
||||
"drawing": "그리기",
|
||||
"drawing": "마크업",
|
||||
"keep-as-attachments": "첨부 파일로 유지",
|
||||
"retry-image-upload": "다시 시도",
|
||||
"uploading-inline-image": "콘텐츠에 업로드 중",
|
||||
"uploading-images": "이미지 업로드 중 {{completed}}/{{total}}"
|
||||
},
|
||||
"drawing": {
|
||||
"new-title": "새 그림",
|
||||
"edit": "그림 편집",
|
||||
"edit": "마크업 편집",
|
||||
"tools": "도구",
|
||||
"tool-select": "선택",
|
||||
"tool-pen": "펜",
|
||||
@@ -203,8 +202,8 @@
|
||||
"color-violet": "보라색",
|
||||
"undo": "실행 취소",
|
||||
"redo": "다시 실행",
|
||||
"zoom": "확대/축소",
|
||||
"zoom-to-fit": "화면에 맞추기",
|
||||
"done": "완료",
|
||||
"discard-title": "이 그림을 삭제할까요?",
|
||||
"discard-description": "아직 메모에 추가되지 않았습니다.",
|
||||
"discard-edit-title": "변경 사항을 삭제할까요?",
|
||||
@@ -214,7 +213,13 @@
|
||||
"open-failed": "그림을 열 수 없습니다. 다시 시도하세요.",
|
||||
"export-failed": "그림을 저장할 수 없습니다. 다시 시도하세요.",
|
||||
"image-failed": "이미지를 그림에 추가할 수 없습니다.",
|
||||
"saved-without-drawing": "메모는 저장되었지만 그림은 저장되지 않았습니다. 재시도하려면 다시 저장하세요."
|
||||
"saved-without-drawing": "메모는 저장되었지만 그림은 저장되지 않았습니다. 재시도하려면 다시 저장하세요.",
|
||||
"annotate": "마크업",
|
||||
"save-copy": "사본 저장",
|
||||
"unavailable": "저장 위치를 사용할 수 없습니다.",
|
||||
"saved-needs-update": "그림이 저장되었습니다. 메모 업데이트를 다시 시도하세요.",
|
||||
"changed-save-copy": "원본이 변경되었습니다. 사본을 저장하세요.",
|
||||
"bind-failed": "그림이 업로드되었습니다. 메모에 추가를 다시 시도하세요."
|
||||
},
|
||||
"audio-recorder": {
|
||||
"attachment-label": "오디오 녹음",
|
||||
|
||||
+10
-5
@@ -207,14 +207,13 @@
|
||||
"image-upload-failed": "Kai kurių vaizdų nepavyko įkelti. Bandykite dar kartą arba išsaugokite įkeltus failus kaip priedus.",
|
||||
"image-upload-stopped": "Vaizdo įkėlimas sustabdytas {{completed}}/{{total}}",
|
||||
"insert-image": "Įterpti vaizdą",
|
||||
"drawing": "Piešinys",
|
||||
"drawing": "Žymėjimas",
|
||||
"keep-as-attachments": "Išsaugoti kaip priedus",
|
||||
"uploading-inline-image": "Įkeliama į turinį",
|
||||
"uploading-images": "Įkeliami vaizdai {{completed}}/{{total}}"
|
||||
},
|
||||
"drawing": {
|
||||
"new-title": "Naujas piešinys",
|
||||
"edit": "Redaguoti piešinį",
|
||||
"edit": "Redaguoti žymėjimą",
|
||||
"tools": "Įrankiai",
|
||||
"tool-select": "Žymėti",
|
||||
"tool-pen": "Rašiklis",
|
||||
@@ -239,8 +238,8 @@
|
||||
"color-violet": "Violetinė",
|
||||
"undo": "Anuliuoti",
|
||||
"redo": "Grąžinti",
|
||||
"zoom": "Mastelis",
|
||||
"zoom-to-fit": "Talpinti lange",
|
||||
"done": "Atlikta",
|
||||
"discard-title": "Atmesti šį piešinį?",
|
||||
"discard-description": "Jis dar nepridėtas prie atmintinės.",
|
||||
"discard-edit-title": "Atmesti pakeitimus?",
|
||||
@@ -250,7 +249,13 @@
|
||||
"open-failed": "Nepavyko atidaryti piešinio. Bandykite dar kartą.",
|
||||
"export-failed": "Nepavyko išsaugoti piešinio. Bandykite dar kartą.",
|
||||
"image-failed": "Nepavyko pridėti vaizdo prie piešinio.",
|
||||
"saved-without-drawing": "Atmintinė išsaugota, bet piešinys – ne. Išsaugokite dar kartą, kad bandytumėte iš naujo."
|
||||
"saved-without-drawing": "Atmintinė išsaugota, bet piešinys – ne. Išsaugokite dar kartą, kad bandytumėte iš naujo.",
|
||||
"annotate": "Žymėjimas",
|
||||
"save-copy": "Išsaugoti kopiją",
|
||||
"unavailable": "Paskirties vieta nepasiekiama.",
|
||||
"saved-needs-update": "Piešinys išsaugotas. Bandykite dar kartą atnaujinti užrašą.",
|
||||
"changed-save-copy": "Originalas pasikeitė. Išsaugokite kopiją.",
|
||||
"bind-failed": "Piešinys įkeltas. Bandykite dar kartą pridėti prie užrašo."
|
||||
},
|
||||
"no-changes-detected": "Pakeitimų neaptikta",
|
||||
"save": "Išsaugoti",
|
||||
|
||||
+10
-5
@@ -207,14 +207,13 @@
|
||||
"image-upload-failed": "Dažus attēlus nevarēja augšupielādēt. Mēģiniet vēlreiz vai saglabājiet augšupielādētos failus kā pielikumus.",
|
||||
"image-upload-stopped": "Attēla augšupielāde apturēta {{completed}}/{{total}}",
|
||||
"insert-image": "Ievietot attēlu",
|
||||
"drawing": "Zīmējums",
|
||||
"drawing": "Anotācija",
|
||||
"keep-as-attachments": "Saglabāt kā pielikumus",
|
||||
"uploading-inline-image": "Augšupielādē saturu",
|
||||
"uploading-images": "Attēlu augšupielāde {{completed}}/{{total}}"
|
||||
},
|
||||
"drawing": {
|
||||
"new-title": "Jauns zīmējums",
|
||||
"edit": "Rediģēt zīmējumu",
|
||||
"edit": "Rediģēt anotāciju",
|
||||
"tools": "Rīki",
|
||||
"tool-select": "Atlasīt",
|
||||
"tool-pen": "Pildspalva",
|
||||
@@ -239,8 +238,8 @@
|
||||
"color-violet": "Violeta",
|
||||
"undo": "Atsaukt",
|
||||
"redo": "Atcelt atsaukšanu",
|
||||
"zoom": "Tālummaiņa",
|
||||
"zoom-to-fit": "Ietilpināt logā",
|
||||
"done": "Gatavs",
|
||||
"discard-title": "Atmest šo zīmējumu?",
|
||||
"discard-description": "Tas vēl nav pievienots piezīmei.",
|
||||
"discard-edit-title": "Atmest izmaiņas?",
|
||||
@@ -250,7 +249,13 @@
|
||||
"open-failed": "Neizdevās atvērt zīmējumu. Mēģiniet vēlreiz.",
|
||||
"export-failed": "Neizdevās saglabāt zīmējumu. Mēģiniet vēlreiz.",
|
||||
"image-failed": "Neizdevās pievienot attēlu zīmējumam.",
|
||||
"saved-without-drawing": "Piezīme ir saglabāta, bet zīmējums nav. Saglabājiet vēlreiz, lai mēģinātu atkārtoti."
|
||||
"saved-without-drawing": "Piezīme ir saglabāta, bet zīmējums nav. Saglabājiet vēlreiz, lai mēģinātu atkārtoti.",
|
||||
"annotate": "Anotācija",
|
||||
"save-copy": "Saglabāt kopiju",
|
||||
"unavailable": "Galamērķis nav pieejams.",
|
||||
"saved-needs-update": "Zīmējums saglabāts. Mēģiniet vēlreiz atjaunināt piezīmi.",
|
||||
"changed-save-copy": "Oriģināls ir mainījies. Saglabājiet kopiju.",
|
||||
"bind-failed": "Zīmējums augšupielādēts. Mēģiniet vēlreiz pievienot piezīmei."
|
||||
},
|
||||
"no-changes-detected": "Izmaiņas nav konstatētas",
|
||||
"save": "Saglabāt",
|
||||
|
||||
+10
-5
@@ -168,7 +168,7 @@
|
||||
"link-memo": "लिंक मेमो",
|
||||
"image-upload-stopped": "प्रतिमा अपलोड थांबले {{completed}}/{{total}}",
|
||||
"insert-image": "प्रतिमा घाला",
|
||||
"drawing": "रेखाचित्र",
|
||||
"drawing": "मार्कअप",
|
||||
"keep-as-attachments": "संलग्नक म्हणून ठेवा",
|
||||
"retry-image-upload": "पुन्हा प्रयत्न करा",
|
||||
"uploading-inline-image": "सामग्रीवर अपलोड करत आहे",
|
||||
@@ -177,8 +177,7 @@
|
||||
"image-upload-failed": "काही प्रतिमा अपलोड होऊ शकल्या नाहीत. पुन्हा प्रयत्न करा किंवा अपलोड केलेल्या फाइल्स जोडपत्रे म्हणून ठेवा."
|
||||
},
|
||||
"drawing": {
|
||||
"new-title": "नवीन रेखाचित्र",
|
||||
"edit": "रेखाचित्र संपादित करा",
|
||||
"edit": "मार्कअप संपादित करा",
|
||||
"tools": "साधने",
|
||||
"tool-select": "निवडा",
|
||||
"tool-pen": "पेन",
|
||||
@@ -203,8 +202,8 @@
|
||||
"color-violet": "जांभळा",
|
||||
"undo": "पूर्ववत करा",
|
||||
"redo": "पुन्हा करा",
|
||||
"zoom": "झूम",
|
||||
"zoom-to-fit": "विंडोमध्ये बसवा",
|
||||
"done": "झाले",
|
||||
"discard-title": "हे रेखाचित्र टाकून द्यायचे?",
|
||||
"discard-description": "ते अजून मेमोमध्ये जोडलेले नाही.",
|
||||
"discard-edit-title": "तुमचे बदल टाकून द्यायचे?",
|
||||
@@ -214,7 +213,13 @@
|
||||
"open-failed": "रेखाचित्र उघडता आले नाही. पुन्हा प्रयत्न करा.",
|
||||
"export-failed": "रेखाचित्र जतन करता आले नाही. पुन्हा प्रयत्न करा.",
|
||||
"image-failed": "प्रतिमा रेखाचित्रात जोडता आली नाही.",
|
||||
"saved-without-drawing": "मेमो जतन केला, पण रेखाचित्र जतन झाले नाही. पुन्हा प्रयत्नासाठी परत जतन करा."
|
||||
"saved-without-drawing": "मेमो जतन केला, पण रेखाचित्र जतन झाले नाही. पुन्हा प्रयत्नासाठी परत जतन करा.",
|
||||
"annotate": "मार्कअप",
|
||||
"save-copy": "प्रत जतन करा",
|
||||
"unavailable": "गंतव्य उपलब्ध नाही.",
|
||||
"saved-needs-update": "चित्र जतन झाले. नोंद अद्ययावत करण्याचा पुन्हा प्रयत्न करा.",
|
||||
"changed-save-copy": "मूळ बदलले आहे. एक प्रत जतन करा.",
|
||||
"bind-failed": "चित्र अपलोड झाले. नोंदीत जोडण्याचा पुन्हा प्रयत्न करा."
|
||||
},
|
||||
"audio-recorder": {
|
||||
"attachment-label": "ऑडिओ रेकॉर्डिंग",
|
||||
|
||||
+10
-5
@@ -169,14 +169,13 @@
|
||||
"image-upload-failed": "Noen bilder kunne ikke lastes opp. Prøv på nytt eller behold de opplastede filene som vedlegg.",
|
||||
"image-upload-stopped": "Bildeopplasting stoppet {{completed}}/{{total}}",
|
||||
"insert-image": "Sett inn bilde",
|
||||
"drawing": "Tegning",
|
||||
"drawing": "Markering",
|
||||
"keep-as-attachments": "Behold som vedlegg",
|
||||
"uploading-inline-image": "Laster opp til innhold",
|
||||
"uploading-images": "Laster opp bilder {{completed}}/{{total}}"
|
||||
},
|
||||
"drawing": {
|
||||
"new-title": "Ny tegning",
|
||||
"edit": "Rediger tegning",
|
||||
"edit": "Rediger markering",
|
||||
"tools": "Verktøy",
|
||||
"tool-select": "Velg",
|
||||
"tool-pen": "Penn",
|
||||
@@ -201,8 +200,8 @@
|
||||
"color-violet": "Fiolett",
|
||||
"undo": "Angre",
|
||||
"redo": "Gjør om",
|
||||
"zoom": "Zoom",
|
||||
"zoom-to-fit": "Tilpass til vinduet",
|
||||
"done": "Ferdig",
|
||||
"discard-title": "Forkaste denne tegningen?",
|
||||
"discard-description": "Den er ikke lagt til i memoen ennå.",
|
||||
"discard-edit-title": "Forkaste endringene?",
|
||||
@@ -212,7 +211,13 @@
|
||||
"open-failed": "Kunne ikke åpne tegningen. Prøv på nytt.",
|
||||
"export-failed": "Kunne ikke lagre tegningen. Prøv på nytt.",
|
||||
"image-failed": "Kunne ikke legge bildet til i tegningen.",
|
||||
"saved-without-drawing": "Memoen er lagret, men tegningen er ikke det. Lagre på nytt for å prøve igjen."
|
||||
"saved-without-drawing": "Memoen er lagret, men tegningen er ikke det. Lagre på nytt for å prøve igjen.",
|
||||
"annotate": "Markering",
|
||||
"save-copy": "Lagre kopi",
|
||||
"unavailable": "Målet er utilgjengelig.",
|
||||
"saved-needs-update": "Tegningen er lagret. Prøv å oppdatere notatet igjen.",
|
||||
"changed-save-copy": "Originalen er endret. Lagre en kopi.",
|
||||
"bind-failed": "Tegningen er lastet opp. Prøv å legge den til i notatet igjen."
|
||||
},
|
||||
"no-changes-detected": "Ingen endringer oppdaget",
|
||||
"save": "Lagre",
|
||||
|
||||
+10
-5
@@ -169,14 +169,13 @@
|
||||
"image-upload-failed": "Sommige afbeeldingen konden niet worden geüpload. Probeer het opnieuw of bewaar de geüploade bestanden als bijlagen.",
|
||||
"image-upload-stopped": "Afbeelding uploaden gestopt {{completed}}/{{total}}",
|
||||
"insert-image": "Afbeelding invoegen",
|
||||
"drawing": "Tekening",
|
||||
"drawing": "Markering",
|
||||
"keep-as-attachments": "Bewaren als bijlagen",
|
||||
"uploading-inline-image": "Uploaden naar inhoud",
|
||||
"uploading-images": "Afbeeldingen uploaden {{completed}}/{{total}}"
|
||||
},
|
||||
"drawing": {
|
||||
"new-title": "Nieuwe tekening",
|
||||
"edit": "Tekening bewerken",
|
||||
"edit": "Markering bewerken",
|
||||
"tools": "Gereedschap",
|
||||
"tool-select": "Selecteren",
|
||||
"tool-pen": "Pen",
|
||||
@@ -201,8 +200,8 @@
|
||||
"color-violet": "Violet",
|
||||
"undo": "Ongedaan maken",
|
||||
"redo": "Opnieuw",
|
||||
"zoom": "Zoomen",
|
||||
"zoom-to-fit": "Passend maken",
|
||||
"done": "Klaar",
|
||||
"discard-title": "Deze tekening weggooien?",
|
||||
"discard-description": "Hij is nog niet aan de memo toegevoegd.",
|
||||
"discard-edit-title": "Wijzigingen weggooien?",
|
||||
@@ -212,7 +211,13 @@
|
||||
"open-failed": "Kan de tekening niet openen. Probeer het opnieuw.",
|
||||
"export-failed": "Kan de tekening niet opslaan. Probeer het opnieuw.",
|
||||
"image-failed": "Kan de afbeelding niet aan de tekening toevoegen.",
|
||||
"saved-without-drawing": "De memo is opgeslagen, maar de tekening niet. Sla opnieuw op om het nog eens te proberen."
|
||||
"saved-without-drawing": "De memo is opgeslagen, maar de tekening niet. Sla opnieuw op om het nog eens te proberen.",
|
||||
"annotate": "Markering",
|
||||
"save-copy": "Kopie opslaan",
|
||||
"unavailable": "De bestemming is niet beschikbaar.",
|
||||
"saved-needs-update": "Tekening opgeslagen. Probeer de memo opnieuw bij te werken.",
|
||||
"changed-save-copy": "Het origineel is gewijzigd. Sla een kopie op.",
|
||||
"bind-failed": "Tekening geüpload. Probeer deze opnieuw aan de memo toe te voegen."
|
||||
},
|
||||
"no-changes-detected": "Geen wijzigingen gedetecteerd",
|
||||
"save": "Opslaan",
|
||||
|
||||
+10
-5
@@ -276,7 +276,7 @@
|
||||
"image-upload-failed": "Somme bilete kunne diverre ikkje lastast opp. Prøv att, eller hald på dei opplasta filene som vedlegg.",
|
||||
"image-upload-stopped": "Biletopplastinga stogga {{completed}}/{{total}}",
|
||||
"insert-image": "Set inn bilete",
|
||||
"drawing": "Teikning",
|
||||
"drawing": "Markering",
|
||||
"keep-as-attachments": "Hald på som vedlegg",
|
||||
"link-memo": "Knyt til notat",
|
||||
"retry-image-upload": "Prøv att",
|
||||
@@ -284,8 +284,7 @@
|
||||
"uploading-inline-image": "Lastar opp til innhaldet"
|
||||
},
|
||||
"drawing": {
|
||||
"new-title": "Ny teikning",
|
||||
"edit": "Rediger teikning",
|
||||
"edit": "Rediger markering",
|
||||
"tools": "Verktøy",
|
||||
"tool-select": "Vel",
|
||||
"tool-pen": "Penn",
|
||||
@@ -310,8 +309,8 @@
|
||||
"color-violet": "Fiolett",
|
||||
"undo": "Angre",
|
||||
"redo": "Gjer om",
|
||||
"zoom": "Zoom",
|
||||
"zoom-to-fit": "Tilpass til vindauget",
|
||||
"done": "Ferdig",
|
||||
"discard-title": "Forkaste denne teikninga?",
|
||||
"discard-description": "Ho er ikkje lagd til i notatet enno.",
|
||||
"discard-edit-title": "Forkaste endringane?",
|
||||
@@ -321,7 +320,13 @@
|
||||
"open-failed": "Kunne ikkje opne teikninga. Prøv på nytt.",
|
||||
"export-failed": "Kunne ikkje lagre teikninga. Prøv på nytt.",
|
||||
"image-failed": "Kunne ikkje leggje biletet til i teikninga.",
|
||||
"saved-without-drawing": "Notatet er lagra, men teikninga er ikkje det. Lagre på nytt for å prøve igjen."
|
||||
"saved-without-drawing": "Notatet er lagra, men teikninga er ikkje det. Lagre på nytt for å prøve igjen.",
|
||||
"annotate": "Markering",
|
||||
"save-copy": "Lagre kopi",
|
||||
"unavailable": "Målet er utilgjengeleg.",
|
||||
"saved-needs-update": "Teikninga er lagra. Prøv å oppdatere notatet igjen.",
|
||||
"changed-save-copy": "Originalen er endra. Lagre ein kopi.",
|
||||
"bind-failed": "Teikninga er lasta opp. Prøv å leggje henne til i notatet igjen."
|
||||
},
|
||||
"new-memo": "Nytt notat",
|
||||
"no-changes-detected": "Ingen endringar funne",
|
||||
|
||||
+10
-5
@@ -184,14 +184,13 @@
|
||||
"image-upload-failed": "Niektórych obrazów nie udało się przesłać. Spróbuj ponownie lub zachowaj przesłane pliki jako załączniki.",
|
||||
"image-upload-stopped": "Zatrzymano przesyłanie obrazu {{completed}}/{{total}}",
|
||||
"insert-image": "Wstaw obraz",
|
||||
"drawing": "Rysunek",
|
||||
"drawing": "Oznaczanie",
|
||||
"keep-as-attachments": "Zachowaj jako załącznik",
|
||||
"uploading-inline-image": "Przesyłanie do treści",
|
||||
"uploading-images": "Przesyłanie obrazów {{completed}}/{{total}}"
|
||||
},
|
||||
"drawing": {
|
||||
"new-title": "Nowy rysunek",
|
||||
"edit": "Edytuj rysunek",
|
||||
"edit": "Edytuj oznaczenia",
|
||||
"tools": "Narzędzia",
|
||||
"tool-select": "Zaznacz",
|
||||
"tool-pen": "Pióro",
|
||||
@@ -216,8 +215,8 @@
|
||||
"color-violet": "Fioletowy",
|
||||
"undo": "Cofnij",
|
||||
"redo": "Ponów",
|
||||
"zoom": "Powiększenie",
|
||||
"zoom-to-fit": "Dopasuj do ekranu",
|
||||
"done": "Gotowe",
|
||||
"discard-title": "Odrzucić ten rysunek?",
|
||||
"discard-description": "Nie został jeszcze dodany do notatki.",
|
||||
"discard-edit-title": "Odrzucić zmiany?",
|
||||
@@ -227,7 +226,13 @@
|
||||
"open-failed": "Nie udało się otworzyć rysunku. Spróbuj ponownie.",
|
||||
"export-failed": "Nie udało się zapisać rysunku. Spróbuj ponownie.",
|
||||
"image-failed": "Nie udało się dodać obrazu do rysunku.",
|
||||
"saved-without-drawing": "Notatka została zapisana, ale rysunek nie. Zapisz ponownie, aby spróbować jeszcze raz."
|
||||
"saved-without-drawing": "Notatka została zapisana, ale rysunek nie. Zapisz ponownie, aby spróbować jeszcze raz.",
|
||||
"annotate": "Oznaczanie",
|
||||
"save-copy": "Zapisz kopię",
|
||||
"unavailable": "Miejsce docelowe jest niedostępne.",
|
||||
"saved-needs-update": "Rysunek zapisany. Ponów aktualizację notatki.",
|
||||
"changed-save-copy": "Oryginał się zmienił. Zapisz kopię.",
|
||||
"bind-failed": "Rysunek przesłany. Ponów dodawanie do notatki."
|
||||
},
|
||||
"no-changes-detected": "Brak wykrytych zmian",
|
||||
"save": "Zapisz",
|
||||
|
||||
@@ -170,15 +170,14 @@
|
||||
"image-upload-failed": "Algumas imagens não puderam ser carregadas. Tente novamente ou mantenha os arquivos carregados como anexos.",
|
||||
"image-upload-stopped": "Upload de imagem interrompido {{completed}}/{{total}}",
|
||||
"insert-image": "Inserir imagem",
|
||||
"drawing": "Desenho",
|
||||
"drawing": "Marcação",
|
||||
"keep-as-attachments": "Manter como anexos",
|
||||
"retry-image-upload": "Tentar novamente",
|
||||
"uploading-inline-image": "Carregando conteúdo",
|
||||
"uploading-images": "Carregando imagens {{completed}}/{{total}}"
|
||||
},
|
||||
"drawing": {
|
||||
"new-title": "Novo desenho",
|
||||
"edit": "Editar desenho",
|
||||
"edit": "Editar marcação",
|
||||
"tools": "Ferramentas",
|
||||
"tool-select": "Selecionar",
|
||||
"tool-pen": "Caneta",
|
||||
@@ -203,8 +202,8 @@
|
||||
"color-violet": "Violeta",
|
||||
"undo": "Desfazer",
|
||||
"redo": "Refazer",
|
||||
"zoom": "Zoom",
|
||||
"zoom-to-fit": "Ajustar à tela",
|
||||
"done": "Concluído",
|
||||
"discard-title": "Descartar este desenho?",
|
||||
"discard-description": "Ele ainda não foi adicionado ao memo.",
|
||||
"discard-edit-title": "Descartar as alterações?",
|
||||
@@ -214,7 +213,13 @@
|
||||
"open-failed": "Não foi possível abrir o desenho. Tente novamente.",
|
||||
"export-failed": "Não foi possível salvar o desenho. Tente novamente.",
|
||||
"image-failed": "Não foi possível adicionar a imagem ao desenho.",
|
||||
"saved-without-drawing": "O memo foi salvo, mas o desenho não. Salve novamente para tentar de novo."
|
||||
"saved-without-drawing": "O memo foi salvo, mas o desenho não. Salve novamente para tentar de novo.",
|
||||
"annotate": "Marcação",
|
||||
"save-copy": "Salvar cópia",
|
||||
"unavailable": "O destino não está disponível.",
|
||||
"saved-needs-update": "Desenho salvo. Tente atualizar a nota novamente.",
|
||||
"changed-save-copy": "O original mudou. Salve uma cópia.",
|
||||
"bind-failed": "Desenho enviado. Tente adicioná-lo à nota novamente."
|
||||
},
|
||||
"audio-recorder": {
|
||||
"attachment-label": "Gravação de áudio",
|
||||
|
||||
@@ -169,14 +169,13 @@
|
||||
"image-upload-failed": "Algumas imagens não puderam ser carregadas. Tente novamente ou mantenha os ficheiros carregados como anexos.",
|
||||
"image-upload-stopped": "Upload de imagem interrompido {{completed}}/{{total}}",
|
||||
"insert-image": "Inserir imagem",
|
||||
"drawing": "Desenho",
|
||||
"drawing": "Marcação",
|
||||
"keep-as-attachments": "Manter como anexos",
|
||||
"uploading-inline-image": "A carregar conteúdo",
|
||||
"uploading-images": "A carregar imagens {{completed}}/{{total}}"
|
||||
},
|
||||
"drawing": {
|
||||
"new-title": "Novo desenho",
|
||||
"edit": "Editar desenho",
|
||||
"edit": "Editar marcação",
|
||||
"tools": "Ferramentas",
|
||||
"tool-select": "Selecionar",
|
||||
"tool-pen": "Caneta",
|
||||
@@ -201,8 +200,8 @@
|
||||
"color-violet": "Violeta",
|
||||
"undo": "Anular",
|
||||
"redo": "Refazer",
|
||||
"zoom": "Zoom",
|
||||
"zoom-to-fit": "Ajustar ao ecrã",
|
||||
"done": "Concluído",
|
||||
"discard-title": "Descartar este desenho?",
|
||||
"discard-description": "Ainda não foi adicionado ao memo.",
|
||||
"discard-edit-title": "Descartar as alterações?",
|
||||
@@ -212,7 +211,13 @@
|
||||
"open-failed": "Não foi possível abrir o desenho. Tente novamente.",
|
||||
"export-failed": "Não foi possível guardar o desenho. Tente novamente.",
|
||||
"image-failed": "Não foi possível adicionar a imagem ao desenho.",
|
||||
"saved-without-drawing": "O memo foi guardado, mas o desenho não. Guarde novamente para tentar de novo."
|
||||
"saved-without-drawing": "O memo foi guardado, mas o desenho não. Guarde novamente para tentar de novo.",
|
||||
"annotate": "Marcação",
|
||||
"save-copy": "Guardar cópia",
|
||||
"unavailable": "O destino não está disponível.",
|
||||
"saved-needs-update": "Desenho guardado. Tente atualizar a nota novamente.",
|
||||
"changed-save-copy": "O original foi alterado. Guarde uma cópia.",
|
||||
"bind-failed": "Desenho carregado. Tente adicioná-lo à nota novamente."
|
||||
},
|
||||
"no-changes-detected": "Nenhuma alteração detetada",
|
||||
"save": "Guardar",
|
||||
|
||||
+10
-5
@@ -207,14 +207,13 @@
|
||||
"image-upload-failed": "Unele imagini nu au putut fi încărcate. Încercați din nou sau păstrați fișierele încărcate ca atașamente.",
|
||||
"image-upload-stopped": "Încărcarea imaginii a fost oprită {{completed}}/{{total}}",
|
||||
"insert-image": "Inserare imagine",
|
||||
"drawing": "Desen",
|
||||
"drawing": "Adnotare",
|
||||
"keep-as-attachments": "Păstrare ca atașamente",
|
||||
"uploading-inline-image": "Se încarcă în conținut",
|
||||
"uploading-images": "Se încarcă imagini {{completed}}/{{total}}"
|
||||
},
|
||||
"drawing": {
|
||||
"new-title": "Desen nou",
|
||||
"edit": "Editați desenul",
|
||||
"edit": "Editează adnotarea",
|
||||
"tools": "Instrumente",
|
||||
"tool-select": "Selectare",
|
||||
"tool-pen": "Stilou",
|
||||
@@ -239,8 +238,8 @@
|
||||
"color-violet": "Violet",
|
||||
"undo": "Anulare",
|
||||
"redo": "Refacere",
|
||||
"zoom": "Zoom",
|
||||
"zoom-to-fit": "Încadrare în fereastră",
|
||||
"done": "Gata",
|
||||
"discard-title": "Renunțați la acest desen?",
|
||||
"discard-description": "Nu a fost încă adăugat la notă.",
|
||||
"discard-edit-title": "Renunțați la modificări?",
|
||||
@@ -250,7 +249,13 @@
|
||||
"open-failed": "Desenul nu a putut fi deschis. Încercați din nou.",
|
||||
"export-failed": "Desenul nu a putut fi salvat. Încercați din nou.",
|
||||
"image-failed": "Imaginea nu a putut fi adăugată la desen.",
|
||||
"saved-without-drawing": "Nota a fost salvată, dar desenul nu. Salvați din nou pentru a reîncerca."
|
||||
"saved-without-drawing": "Nota a fost salvată, dar desenul nu. Salvați din nou pentru a reîncerca.",
|
||||
"annotate": "Adnotare",
|
||||
"save-copy": "Salvează o copie",
|
||||
"unavailable": "Destinația nu este disponibilă.",
|
||||
"saved-needs-update": "Desen salvat. Reîncearcă actualizarea notiței.",
|
||||
"changed-save-copy": "Originalul s-a schimbat. Salvează o copie.",
|
||||
"bind-failed": "Desen încărcat. Reîncearcă adăugarea la notiță."
|
||||
},
|
||||
"no-changes-detected": "Nu au fost detectate modificări",
|
||||
"save": "Salva",
|
||||
|
||||
+10
-5
@@ -168,15 +168,14 @@
|
||||
"image-upload-failed": "Не удалось загрузить некоторые изображения. Повторите попытку или сохраните загруженные файлы как вложения.",
|
||||
"image-upload-stopped": "Загрузка изображений остановлена: {{completed}}/{{total}}",
|
||||
"insert-image": "Вставить изображение",
|
||||
"drawing": "Рисунок",
|
||||
"drawing": "Разметка",
|
||||
"keep-as-attachments": "Сохранить как вложения",
|
||||
"retry-image-upload": "Повторить",
|
||||
"uploading-inline-image": "Загрузка в содержимое",
|
||||
"uploading-images": "Загрузка изображений: {{completed}}/{{total}}"
|
||||
},
|
||||
"drawing": {
|
||||
"new-title": "Новый рисунок",
|
||||
"edit": "Изменить рисунок",
|
||||
"edit": "Изменить разметку",
|
||||
"tools": "Инструменты",
|
||||
"tool-select": "Выделение",
|
||||
"tool-pen": "Перо",
|
||||
@@ -201,8 +200,8 @@
|
||||
"color-violet": "Фиолетовый",
|
||||
"undo": "Отменить",
|
||||
"redo": "Повторить",
|
||||
"zoom": "Масштаб",
|
||||
"zoom-to-fit": "Вписать в окно",
|
||||
"done": "Готово",
|
||||
"discard-title": "Удалить этот рисунок?",
|
||||
"discard-description": "Он ещё не добавлен в заметку.",
|
||||
"discard-edit-title": "Отменить изменения?",
|
||||
@@ -212,7 +211,13 @@
|
||||
"open-failed": "Не удалось открыть рисунок. Повторите попытку.",
|
||||
"export-failed": "Не удалось сохранить рисунок. Повторите попытку.",
|
||||
"image-failed": "Не удалось добавить изображение в рисунок.",
|
||||
"saved-without-drawing": "Заметка сохранена, а рисунок — нет. Сохраните ещё раз, чтобы повторить попытку."
|
||||
"saved-without-drawing": "Заметка сохранена, а рисунок — нет. Сохраните ещё раз, чтобы повторить попытку.",
|
||||
"annotate": "Разметка",
|
||||
"save-copy": "Сохранить копию",
|
||||
"unavailable": "Место сохранения недоступно.",
|
||||
"saved-needs-update": "Рисунок сохранён. Повторите обновление заметки.",
|
||||
"changed-save-copy": "Оригинал изменился. Сохраните копию.",
|
||||
"bind-failed": "Рисунок загружен. Повторите добавление в заметку."
|
||||
},
|
||||
"no-changes-detected": "Изменений не обнаружено",
|
||||
"save": "Сохранить",
|
||||
|
||||
+10
-5
@@ -207,14 +207,13 @@
|
||||
"image-upload-failed": "Niektoré obrázky sa nepodarilo nahrať. Skúste to znova alebo ponechajte nahrané súbory ako prílohy.",
|
||||
"image-upload-stopped": "Nahrávanie obrázka zastavené {{completed}}/{{total}}",
|
||||
"insert-image": "Vložiť obrázok",
|
||||
"drawing": "Kresba",
|
||||
"drawing": "Anotácia",
|
||||
"keep-as-attachments": "Ponechať ako prílohy",
|
||||
"uploading-inline-image": "Nahrávanie do obsahu",
|
||||
"uploading-images": "Nahrávanie obrázkov {{completed}}/{{total}}"
|
||||
},
|
||||
"drawing": {
|
||||
"new-title": "Nová kresba",
|
||||
"edit": "Upraviť kresbu",
|
||||
"edit": "Upraviť anotáciu",
|
||||
"tools": "Nástroje",
|
||||
"tool-select": "Výber",
|
||||
"tool-pen": "Pero",
|
||||
@@ -239,8 +238,8 @@
|
||||
"color-violet": "Fialová",
|
||||
"undo": "Späť",
|
||||
"redo": "Znova",
|
||||
"zoom": "Priblíženie",
|
||||
"zoom-to-fit": "Prispôsobiť oknu",
|
||||
"done": "Hotovo",
|
||||
"discard-title": "Zahodiť túto kresbu?",
|
||||
"discard-description": "Zatiaľ nebola pridaná do poznámky.",
|
||||
"discard-edit-title": "Zahodiť zmeny?",
|
||||
@@ -250,7 +249,13 @@
|
||||
"open-failed": "Kresbu sa nepodarilo otvoriť. Skúste to znova.",
|
||||
"export-failed": "Kresbu sa nepodarilo uložiť. Skúste to znova.",
|
||||
"image-failed": "Obrázok sa nepodarilo pridať do kresby.",
|
||||
"saved-without-drawing": "Poznámka je uložená, ale kresba nie. Pre nový pokus uložte znova."
|
||||
"saved-without-drawing": "Poznámka je uložená, ale kresba nie. Pre nový pokus uložte znova.",
|
||||
"annotate": "Anotácia",
|
||||
"save-copy": "Uložiť kópiu",
|
||||
"unavailable": "Cieľ nie je dostupný.",
|
||||
"saved-needs-update": "Kresba uložená. Skúste znova aktualizovať poznámku.",
|
||||
"changed-save-copy": "Originál sa zmenil. Uložte kópiu.",
|
||||
"bind-failed": "Kresba nahraná. Skúste ju znova pridať do poznámky."
|
||||
},
|
||||
"no-changes-detected": "Nezistili sa žiadne zmeny",
|
||||
"save": "Uložiť",
|
||||
|
||||
+10
-5
@@ -169,14 +169,13 @@
|
||||
"image-upload-failed": "Nekaterih slik ni bilo mogoče naložiti. Poskusite znova ali pa naložene datoteke shranite kot priloge.",
|
||||
"image-upload-stopped": "Nalaganje slike ustavljeno {{completed}}/{{total}}",
|
||||
"insert-image": "Vstavi sliko",
|
||||
"drawing": "Risba",
|
||||
"drawing": "Označevanje",
|
||||
"keep-as-attachments": "Obdrži kot priloge",
|
||||
"uploading-inline-image": "Nalaganje v vsebino",
|
||||
"uploading-images": "Nalaganje slik {{completed}}/{{total}}"
|
||||
},
|
||||
"drawing": {
|
||||
"new-title": "Nova risba",
|
||||
"edit": "Uredi risbo",
|
||||
"edit": "Uredi oznake",
|
||||
"tools": "Orodja",
|
||||
"tool-select": "Izbor",
|
||||
"tool-pen": "Pero",
|
||||
@@ -201,8 +200,8 @@
|
||||
"color-violet": "Vijolična",
|
||||
"undo": "Razveljavi",
|
||||
"redo": "Uveljavi",
|
||||
"zoom": "Povečava",
|
||||
"zoom-to-fit": "Prilagodi oknu",
|
||||
"done": "Končano",
|
||||
"discard-title": "Zavrzi to risbo?",
|
||||
"discard-description": "Beležki še ni bila dodana.",
|
||||
"discard-edit-title": "Zavrzi spremembe?",
|
||||
@@ -212,7 +211,13 @@
|
||||
"open-failed": "Risbe ni bilo mogoče odpreti. Poskusite znova.",
|
||||
"export-failed": "Risbe ni bilo mogoče shraniti. Poskusite znova.",
|
||||
"image-failed": "Slike ni bilo mogoče dodati risbi.",
|
||||
"saved-without-drawing": "Beležka je shranjena, risba pa ne. Za ponoven poskus znova shranite."
|
||||
"saved-without-drawing": "Beležka je shranjena, risba pa ne. Za ponoven poskus znova shranite.",
|
||||
"annotate": "Označevanje",
|
||||
"save-copy": "Shrani kopijo",
|
||||
"unavailable": "Cilj ni na voljo.",
|
||||
"saved-needs-update": "Risba je shranjena. Poskusite znova posodobiti beležko.",
|
||||
"changed-save-copy": "Izvirnik se je spremenil. Shranite kopijo.",
|
||||
"bind-failed": "Risba je naložena. Poskusite jo znova dodati v beležko."
|
||||
},
|
||||
"no-changes-detected": "Ni zaznanih sprememb",
|
||||
"save": "Shrani",
|
||||
|
||||
+10
-5
@@ -207,14 +207,13 @@
|
||||
"image-upload-failed": "Неке слике нису могле бити отпремљене. Покушајте поново или задржите отпремљене датотеке као прилоге.",
|
||||
"image-upload-stopped": "Отпремање слике је заустављено {{completed}}/{{total}}",
|
||||
"insert-image": "Уметни слику",
|
||||
"drawing": "Цртеж",
|
||||
"drawing": "Означавање",
|
||||
"keep-as-attachments": "Сачувај као прилоге",
|
||||
"uploading-inline-image": "Отпремање у садржај",
|
||||
"uploading-images": "Отпремање слика {{completed}}/{{total}}"
|
||||
},
|
||||
"drawing": {
|
||||
"new-title": "Нови цртеж",
|
||||
"edit": "Уреди цртеж",
|
||||
"edit": "Уреди ознаке",
|
||||
"tools": "Алатке",
|
||||
"tool-select": "Избор",
|
||||
"tool-pen": "Оловка",
|
||||
@@ -239,8 +238,8 @@
|
||||
"color-violet": "Љубичаста",
|
||||
"undo": "Опозови",
|
||||
"redo": "Понови",
|
||||
"zoom": "Зумирање",
|
||||
"zoom-to-fit": "Уклопи у прозор",
|
||||
"done": "Готово",
|
||||
"discard-title": "Одбацити овај цртеж?",
|
||||
"discard-description": "Још није додат у белешку.",
|
||||
"discard-edit-title": "Одбацити измене?",
|
||||
@@ -250,7 +249,13 @@
|
||||
"open-failed": "Цртеж није могуће отворити. Покушајте поново.",
|
||||
"export-failed": "Цртеж није могуће сачувати. Покушајте поново.",
|
||||
"image-failed": "Слику није могуће додати у цртеж.",
|
||||
"saved-without-drawing": "Белешка је сачувана, али цртеж није. Сачувајте поново за нови покушај."
|
||||
"saved-without-drawing": "Белешка је сачувана, али цртеж није. Сачувајте поново за нови покушај.",
|
||||
"annotate": "Означавање",
|
||||
"save-copy": "Сачувај копију",
|
||||
"unavailable": "Одредиште није доступно.",
|
||||
"saved-needs-update": "Цртеж је сачуван. Покушајте поново ажурирање белешке.",
|
||||
"changed-save-copy": "Оригинал је промењен. Сачувајте копију.",
|
||||
"bind-failed": "Цртеж је отпремљен. Покушајте поново додавање у белешку."
|
||||
},
|
||||
"no-changes-detected": "Нису откривене промене",
|
||||
"save": "Сачувај",
|
||||
|
||||
+10
-5
@@ -169,14 +169,13 @@
|
||||
"image-upload-failed": "Vissa bilder kunde inte laddas upp. Försök igen eller behåll de uppladdade filerna som bilagor.",
|
||||
"image-upload-stopped": "Bilduppladdning stoppad {{completed}}/{{total}}",
|
||||
"insert-image": "Infoga bild",
|
||||
"drawing": "Teckning",
|
||||
"drawing": "Markering",
|
||||
"keep-as-attachments": "Behåll som bilagor",
|
||||
"uploading-inline-image": "Uppladdning till innehåll",
|
||||
"uploading-images": "Uppladdning av bilder {{completed}}/{{total}}"
|
||||
},
|
||||
"drawing": {
|
||||
"new-title": "Ny teckning",
|
||||
"edit": "Redigera teckning",
|
||||
"edit": "Redigera markering",
|
||||
"tools": "Verktyg",
|
||||
"tool-select": "Markera",
|
||||
"tool-pen": "Penna",
|
||||
@@ -201,8 +200,8 @@
|
||||
"color-violet": "Violett",
|
||||
"undo": "Ångra",
|
||||
"redo": "Gör om",
|
||||
"zoom": "Zoom",
|
||||
"zoom-to-fit": "Anpassa till fönstret",
|
||||
"done": "Klar",
|
||||
"discard-title": "Vill du slänga teckningen?",
|
||||
"discard-description": "Den har inte lagts till i anteckningen än.",
|
||||
"discard-edit-title": "Vill du slänga ändringarna?",
|
||||
@@ -212,7 +211,13 @@
|
||||
"open-failed": "Det gick inte att öppna teckningen. Försök igen.",
|
||||
"export-failed": "Det gick inte att spara teckningen. Försök igen.",
|
||||
"image-failed": "Det gick inte att lägga till bilden i teckningen.",
|
||||
"saved-without-drawing": "Anteckningen har sparats, men inte teckningen. Spara igen för att försöka på nytt."
|
||||
"saved-without-drawing": "Anteckningen har sparats, men inte teckningen. Spara igen för att försöka på nytt.",
|
||||
"annotate": "Markering",
|
||||
"save-copy": "Spara kopia",
|
||||
"unavailable": "Målet är inte tillgängligt.",
|
||||
"saved-needs-update": "Teckningen är sparad. Försök uppdatera anteckningen igen.",
|
||||
"changed-save-copy": "Originalet har ändrats. Spara en kopia.",
|
||||
"bind-failed": "Teckningen är uppladdad. Försök lägga till den i anteckningen igen."
|
||||
},
|
||||
"no-changes-detected": "Inga ändringar upptäckta",
|
||||
"save": "Spara",
|
||||
|
||||
+10
-5
@@ -170,15 +170,14 @@
|
||||
"image-upload-failed": "ไม่สามารถอัปโหลดรูปภาพบางรูปได้ ลองใหม่อีกครั้งหรือเก็บไฟล์ที่อัปโหลดไว้เป็นไฟล์แนบ",
|
||||
"image-upload-stopped": "การอัปโหลดรูปภาพหยุดลง {{completed}}/{{total}}",
|
||||
"insert-image": "แทรกรูปภาพ",
|
||||
"drawing": "ภาพวาด",
|
||||
"drawing": "ทำเครื่องหมาย",
|
||||
"keep-as-attachments": "เก็บเป็นไฟล์แนบ",
|
||||
"retry-image-upload": "ลองใหม่",
|
||||
"uploading-inline-image": "กำลังอัปโหลดไปยังเนื้อหา",
|
||||
"uploading-images": "กำลังอัปโหลดรูปภาพ {{completed}}/{{total}}"
|
||||
},
|
||||
"drawing": {
|
||||
"new-title": "ภาพวาดใหม่",
|
||||
"edit": "แก้ไขภาพวาด",
|
||||
"edit": "แก้ไขเครื่องหมาย",
|
||||
"tools": "เครื่องมือ",
|
||||
"tool-select": "เลือก",
|
||||
"tool-pen": "ปากกา",
|
||||
@@ -203,8 +202,8 @@
|
||||
"color-violet": "ม่วง",
|
||||
"undo": "เลิกทำ",
|
||||
"redo": "ทำซ้ำ",
|
||||
"zoom": "การซูม",
|
||||
"zoom-to-fit": "ปรับให้พอดีหน้าต่าง",
|
||||
"done": "เสร็จสิ้น",
|
||||
"discard-title": "ทิ้งภาพวาดนี้หรือไม่?",
|
||||
"discard-description": "ยังไม่ได้เพิ่มลงในบันทึก",
|
||||
"discard-edit-title": "ทิ้งการเปลี่ยนแปลงหรือไม่?",
|
||||
@@ -214,7 +213,13 @@
|
||||
"open-failed": "ไม่สามารถเปิดภาพวาดได้ ลองอีกครั้ง",
|
||||
"export-failed": "ไม่สามารถบันทึกภาพวาดได้ ลองอีกครั้ง",
|
||||
"image-failed": "ไม่สามารถเพิ่มรูปภาพลงในภาพวาดได้",
|
||||
"saved-without-drawing": "บันทึกช่วยจำถูกบันทึกแล้ว แต่ภาพวาดยังไม่ได้บันทึก บันทึกอีกครั้งเพื่อลองใหม่"
|
||||
"saved-without-drawing": "บันทึกช่วยจำถูกบันทึกแล้ว แต่ภาพวาดยังไม่ได้บันทึก บันทึกอีกครั้งเพื่อลองใหม่",
|
||||
"annotate": "ทำเครื่องหมาย",
|
||||
"save-copy": "บันทึกสำเนา",
|
||||
"unavailable": "ไม่สามารถใช้ปลายทางได้",
|
||||
"saved-needs-update": "บันทึกภาพวาดแล้ว ลองอัปเดตบันทึกอีกครั้ง",
|
||||
"changed-save-copy": "ต้นฉบับเปลี่ยนไปแล้ว โปรดบันทึกสำเนา",
|
||||
"bind-failed": "อัปโหลดภาพวาดแล้ว ลองเพิ่มในบันทึกอีกครั้ง"
|
||||
},
|
||||
"audio-recorder": {
|
||||
"attachment-label": "การบันทึกเสียง",
|
||||
|
||||
+10
-5
@@ -216,7 +216,7 @@
|
||||
"image-upload-failed": "Bazı görseller yüklenemedi. Yeniden deneyin ya da yüklenen dosyaları ek olarak tutun.",
|
||||
"image-upload-stopped": "Görsel yükleme durdu {{completed}}/{{total}}",
|
||||
"insert-image": "Görsel ekle",
|
||||
"drawing": "Çizim",
|
||||
"drawing": "İşaretleme",
|
||||
"keep-as-attachments": "Ek olarak tut",
|
||||
"link-memo": "Not bağla",
|
||||
"retry-image-upload": "Yeniden dene",
|
||||
@@ -224,8 +224,7 @@
|
||||
"uploading-images": "Görseller yükleniyor {{completed}}/{{total}}"
|
||||
},
|
||||
"drawing": {
|
||||
"new-title": "Yeni çizim",
|
||||
"edit": "Çizimi düzenle",
|
||||
"edit": "İşaretlemeyi düzenle",
|
||||
"tools": "Araçlar",
|
||||
"tool-select": "Seç",
|
||||
"tool-pen": "Kalem",
|
||||
@@ -250,8 +249,8 @@
|
||||
"color-violet": "Mor",
|
||||
"undo": "Geri al",
|
||||
"redo": "Yinele",
|
||||
"zoom": "Yakınlaştırma",
|
||||
"zoom-to-fit": "Pencereye sığdır",
|
||||
"done": "Bitti",
|
||||
"discard-title": "Bu çizim silinsin mi?",
|
||||
"discard-description": "Henüz nota eklenmedi.",
|
||||
"discard-edit-title": "Değişiklikler silinsin mi?",
|
||||
@@ -261,7 +260,13 @@
|
||||
"open-failed": "Çizim açılamadı. Yeniden deneyin.",
|
||||
"export-failed": "Çizim kaydedilemedi. Yeniden deneyin.",
|
||||
"image-failed": "Görsel çizime eklenemedi.",
|
||||
"saved-without-drawing": "Not kaydedildi ancak çizim kaydedilmedi. Yeniden denemek için tekrar kaydedin."
|
||||
"saved-without-drawing": "Not kaydedildi ancak çizim kaydedilmedi. Yeniden denemek için tekrar kaydedin.",
|
||||
"annotate": "İşaretleme",
|
||||
"save-copy": "Kopyayı kaydet",
|
||||
"unavailable": "Hedef kullanılamıyor.",
|
||||
"saved-needs-update": "Çizim kaydedildi. Notu güncellemeyi yeniden deneyin.",
|
||||
"changed-save-copy": "Orijinal değişti. Bir kopya kaydedin.",
|
||||
"bind-failed": "Çizim yüklendi. Nota eklemeyi yeniden deneyin."
|
||||
},
|
||||
"new-memo": "Yeni not",
|
||||
"no-changes-detected": "Değişiklik yok",
|
||||
|
||||
+10
-5
@@ -169,14 +169,13 @@
|
||||
"image-upload-failed": "Не вдалося завантажити деякі зображення. Повторіть спробу або збережіть завантажені файли як вкладення.",
|
||||
"image-upload-stopped": "Завантаження зображення зупинено {{completed}}/{{total}}",
|
||||
"insert-image": "Вставити зображення",
|
||||
"drawing": "Малюнок",
|
||||
"drawing": "Розмітка",
|
||||
"keep-as-attachments": "Зберегти як вкладення",
|
||||
"uploading-inline-image": "Завантаження до контенту",
|
||||
"uploading-images": "Завантаження зображень {{completed}}/{{total}}"
|
||||
},
|
||||
"drawing": {
|
||||
"new-title": "Новий малюнок",
|
||||
"edit": "Редагувати малюнок",
|
||||
"edit": "Редагувати розмітку",
|
||||
"tools": "Інструменти",
|
||||
"tool-select": "Виділення",
|
||||
"tool-pen": "Перо",
|
||||
@@ -201,8 +200,8 @@
|
||||
"color-violet": "Фіолетовий",
|
||||
"undo": "Скасувати",
|
||||
"redo": "Повторити",
|
||||
"zoom": "Масштаб",
|
||||
"zoom-to-fit": "Вмістити у вікно",
|
||||
"done": "Готово",
|
||||
"discard-title": "Відкинути цей малюнок?",
|
||||
"discard-description": "Його ще не додано до нотатки.",
|
||||
"discard-edit-title": "Відкинути зміни?",
|
||||
@@ -212,7 +211,13 @@
|
||||
"open-failed": "Не вдалося відкрити малюнок. Повторіть спробу.",
|
||||
"export-failed": "Не вдалося зберегти малюнок. Повторіть спробу.",
|
||||
"image-failed": "Не вдалося додати зображення до малюнка.",
|
||||
"saved-without-drawing": "Нотатку збережено, а малюнок — ні. Збережіть ще раз, щоб повторити спробу."
|
||||
"saved-without-drawing": "Нотатку збережено, а малюнок — ні. Збережіть ще раз, щоб повторити спробу.",
|
||||
"annotate": "Розмітка",
|
||||
"save-copy": "Зберегти копію",
|
||||
"unavailable": "Місце збереження недоступне.",
|
||||
"saved-needs-update": "Малюнок збережено. Повторіть оновлення нотатки.",
|
||||
"changed-save-copy": "Оригінал змінився. Збережіть копію.",
|
||||
"bind-failed": "Малюнок передано. Повторіть додавання до нотатки."
|
||||
},
|
||||
"no-changes-detected": "Змін не виявлено",
|
||||
"save": "Зберегти",
|
||||
|
||||
+10
-5
@@ -170,15 +170,14 @@
|
||||
"image-upload-failed": "Một số hình ảnh không thể tải lên. Hãy thử lại hoặc giữ các tệp đã tải lên dưới dạng tệp đính kèm.",
|
||||
"image-upload-stopped": "Quá trình tải ảnh dừng lại {{completed}}/{{total}}",
|
||||
"insert-image": "Chèn ảnh",
|
||||
"drawing": "Bản vẽ",
|
||||
"drawing": "Chú thích",
|
||||
"keep-as-attachments": "Giữ nguyên dưới dạng tệp đính kèm",
|
||||
"retry-image-upload": "Thử lại",
|
||||
"uploading-inline-image": "Đang tải nội dung lên",
|
||||
"uploading-images": "Đang tải ảnh {{completed}}/{{total}}"
|
||||
},
|
||||
"drawing": {
|
||||
"new-title": "Bản vẽ mới",
|
||||
"edit": "Chỉnh sửa bản vẽ",
|
||||
"edit": "Sửa chú thích",
|
||||
"tools": "Công cụ",
|
||||
"tool-select": "Chọn",
|
||||
"tool-pen": "Bút",
|
||||
@@ -203,8 +202,8 @@
|
||||
"color-violet": "Tím",
|
||||
"undo": "Hoàn tác",
|
||||
"redo": "Làm lại",
|
||||
"zoom": "Thu phóng",
|
||||
"zoom-to-fit": "Vừa với cửa sổ",
|
||||
"done": "Xong",
|
||||
"discard-title": "Loại bỏ bản vẽ này?",
|
||||
"discard-description": "Bản vẽ chưa được thêm vào ghi chú.",
|
||||
"discard-edit-title": "Loại bỏ các thay đổi?",
|
||||
@@ -214,7 +213,13 @@
|
||||
"open-failed": "Không thể mở bản vẽ. Hãy thử lại.",
|
||||
"export-failed": "Không thể lưu bản vẽ. Hãy thử lại.",
|
||||
"image-failed": "Không thể thêm ảnh vào bản vẽ.",
|
||||
"saved-without-drawing": "Đã lưu ghi chú, nhưng chưa lưu bản vẽ. Hãy lưu lần nữa để thử lại."
|
||||
"saved-without-drawing": "Đã lưu ghi chú, nhưng chưa lưu bản vẽ. Hãy lưu lần nữa để thử lại.",
|
||||
"annotate": "Chú thích",
|
||||
"save-copy": "Lưu bản sao",
|
||||
"unavailable": "Đích lưu không khả dụng.",
|
||||
"saved-needs-update": "Đã lưu bản vẽ. Thử cập nhật ghi chú lần nữa.",
|
||||
"changed-save-copy": "Bản gốc đã thay đổi. Hãy lưu bản sao.",
|
||||
"bind-failed": "Đã tải bản vẽ lên. Thử thêm vào ghi chú lần nữa."
|
||||
},
|
||||
"audio-recorder": {
|
||||
"attachment-label": "Ghi âm",
|
||||
|
||||
@@ -231,7 +231,7 @@
|
||||
"image-upload-failed": "部分图片上传失败,请重试或将已上传文件保留为附件。",
|
||||
"image-upload-stopped": "图片上传已暂停 {{completed}}/{{total}}",
|
||||
"insert-image": "插入图片",
|
||||
"drawing": "绘图",
|
||||
"drawing": "标注",
|
||||
"keep-as-attachments": "保留为附件",
|
||||
"link-memo": "链接备忘录",
|
||||
"retry-image-upload": "重试",
|
||||
@@ -239,8 +239,7 @@
|
||||
"uploading-images": "正在上传图片 {{completed}}/{{total}}"
|
||||
},
|
||||
"drawing": {
|
||||
"new-title": "新建绘图",
|
||||
"edit": "编辑绘图",
|
||||
"edit": "编辑标注",
|
||||
"tools": "工具",
|
||||
"tool-select": "选择",
|
||||
"tool-pen": "画笔",
|
||||
@@ -265,8 +264,8 @@
|
||||
"color-violet": "紫色",
|
||||
"undo": "撤销",
|
||||
"redo": "重做",
|
||||
"zoom": "缩放",
|
||||
"zoom-to-fit": "缩放至适合",
|
||||
"done": "完成",
|
||||
"discard-title": "放弃此绘图?",
|
||||
"discard-description": "它尚未添加到备忘录中。",
|
||||
"discard-edit-title": "放弃所做的更改?",
|
||||
@@ -276,7 +275,13 @@
|
||||
"open-failed": "无法打开绘图,请重试。",
|
||||
"export-failed": "无法保存绘图,请重试。",
|
||||
"image-failed": "无法将图片添加到绘图中。",
|
||||
"saved-without-drawing": "备忘录已保存,但绘图未保存。请再次保存以重试。"
|
||||
"saved-without-drawing": "备忘录已保存,但绘图未保存。请再次保存以重试。",
|
||||
"annotate": "标注",
|
||||
"save-copy": "保存副本",
|
||||
"unavailable": "保存位置不可用。",
|
||||
"saved-needs-update": "绘图已保存。请重试更新笔记。",
|
||||
"changed-save-copy": "原图已更改。请保存副本以保留绘图。",
|
||||
"bind-failed": "绘图已上传。请重试添加到笔记。"
|
||||
},
|
||||
"audio-recorder": {
|
||||
"attachment-label": "录音",
|
||||
|
||||
@@ -261,7 +261,7 @@
|
||||
"image-upload-failed": "部分圖片上傳失敗,請重試或將已上傳檔案保留為附件。",
|
||||
"image-upload-stopped": "圖片上傳已暫停 {{completed}}/{{total}}",
|
||||
"insert-image": "插入圖片",
|
||||
"drawing": "繪圖",
|
||||
"drawing": "標註",
|
||||
"keep-as-attachments": "保留為附件",
|
||||
"link-memo": "連結備忘錄",
|
||||
"retry-image-upload": "重試",
|
||||
@@ -269,8 +269,7 @@
|
||||
"uploading-images": "正在上傳圖片 {{completed}}/{{total}}"
|
||||
},
|
||||
"drawing": {
|
||||
"new-title": "新增繪圖",
|
||||
"edit": "編輯繪圖",
|
||||
"edit": "編輯標註",
|
||||
"tools": "工具",
|
||||
"tool-select": "選取",
|
||||
"tool-pen": "畫筆",
|
||||
@@ -295,8 +294,8 @@
|
||||
"color-violet": "紫色",
|
||||
"undo": "復原",
|
||||
"redo": "重做",
|
||||
"zoom": "縮放",
|
||||
"zoom-to-fit": "縮放至適當大小",
|
||||
"done": "完成",
|
||||
"discard-title": "要捨棄此繪圖嗎?",
|
||||
"discard-description": "它尚未加入備忘錄。",
|
||||
"discard-edit-title": "要捨棄變更嗎?",
|
||||
@@ -306,7 +305,13 @@
|
||||
"open-failed": "無法開啟繪圖,請再試一次。",
|
||||
"export-failed": "無法儲存繪圖,請再試一次。",
|
||||
"image-failed": "無法將圖片加入繪圖。",
|
||||
"saved-without-drawing": "備忘錄已儲存,但繪圖尚未儲存。請再次儲存以重試。"
|
||||
"saved-without-drawing": "備忘錄已儲存,但繪圖尚未儲存。請再次儲存以重試。",
|
||||
"annotate": "標註",
|
||||
"save-copy": "儲存副本",
|
||||
"unavailable": "儲存位置無法使用。",
|
||||
"saved-needs-update": "繪圖已儲存。請重試更新筆記。",
|
||||
"changed-save-copy": "原圖已變更。請儲存副本以保留繪圖。",
|
||||
"bind-failed": "繪圖已上傳。請重試加入筆記。"
|
||||
},
|
||||
"new-memo": "新增備忘錄",
|
||||
"no-changes-detected": "未發現變更",
|
||||
|
||||
@@ -11,6 +11,7 @@ vi.mock("@/connect", () => ({
|
||||
|
||||
import {
|
||||
DrawingNotSavedError,
|
||||
DrawingSavedError,
|
||||
type MemoSaveOperations,
|
||||
memoService,
|
||||
mergeUploadedAttachments,
|
||||
@@ -139,6 +140,30 @@ describe("replacing an attachment's content", () => {
|
||||
expect(result.hasChanges).toBe(true);
|
||||
});
|
||||
|
||||
it("retries only the memo timestamp after the drawing replacement was acknowledged", async () => {
|
||||
mockReplacementUpload();
|
||||
const uploaded = vi.fn();
|
||||
const failed = operations(async () => {
|
||||
throw new Error("offline");
|
||||
});
|
||||
await expect(memoService.save(draft("hello"), { memoName: memo.name, onFileUploaded: uploaded }, failed)).rejects.toBeInstanceOf(
|
||||
DrawingSavedError,
|
||||
);
|
||||
expect(uploaded).toHaveBeenCalledWith(edit, edited);
|
||||
|
||||
const fresh = create(MemoSchema, { ...memo, attachments: [edited] });
|
||||
const retry = { ...operations(async () => fresh), getMemo: vi.fn(async () => fresh) };
|
||||
const state = draft("hello");
|
||||
const result = await memoService.save(
|
||||
{ ...state, localFiles: [], metadata: { ...state.metadata, attachments: [edited] }, drawingNeedsMemoUpdate: true },
|
||||
{ memoName: memo.name },
|
||||
retry,
|
||||
);
|
||||
expect(result.hasChanges).toBe(true);
|
||||
expect(order).toEqual([`upload over ${saved.name}`, "update update_time", "update update_time"]);
|
||||
expect(vi.mocked(retry.updateMemo).mock.calls[0][1]).toEqual(["update_time"]);
|
||||
});
|
||||
|
||||
it("reports a drawing that failed after the rest of the memo saved", async () => {
|
||||
mocks.uploadAttachment.mockRejectedValue(new Error("offline"));
|
||||
const ops = operations(async () => create(MemoSchema, { ...memo, content: "changed" }));
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<!doctype html>
|
||||
<html lang="en" data-theme="light">
|
||||
<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1"></head>
|
||||
<body><div id="root"></div><script type="module" src="/tests/browser/drawing.tsx"></script></body>
|
||||
</html>
|
||||
@@ -0,0 +1,300 @@
|
||||
import { expect, test } from "@playwright/test";
|
||||
import type { TextElement } from "@usememos/canvas";
|
||||
import type {} from "./drawing";
|
||||
|
||||
test("uses the live zoom percentage as the same menu trigger in view and edit", async ({ page }, testInfo) => {
|
||||
await page.goto("/tests/browser/drawing.html");
|
||||
await page.getByRole("button", { name: "View markup", exact: true }).click();
|
||||
const zoom = page.getByRole("button", { name: /^Zoom \d+%$/ });
|
||||
await expect(zoom).toHaveText("100%");
|
||||
const position = await zoom.boundingBox();
|
||||
const choose = async (name: string) => {
|
||||
await zoom.click();
|
||||
await page.getByRole("menuitem", { name, exact: true }).click();
|
||||
await expect(page.getByRole("menu")).toHaveCount(0);
|
||||
};
|
||||
if (testInfo.project.name === "phone") {
|
||||
const surface = await page.getByRole("application").boundingBox();
|
||||
if (!surface) throw new Error("Missing drawing surface");
|
||||
const cdp = await page.context().newCDPSession(page);
|
||||
const x = surface.x + surface.width / 2;
|
||||
const y = surface.y + surface.height / 2;
|
||||
await cdp.send("Input.dispatchTouchEvent", {
|
||||
type: "touchStart",
|
||||
touchPoints: [
|
||||
{ x: x - 20, y, id: 1 },
|
||||
{ x: x + 20, y, id: 2 },
|
||||
],
|
||||
});
|
||||
await cdp.send("Input.dispatchTouchEvent", {
|
||||
type: "touchMove",
|
||||
touchPoints: [
|
||||
{ x: x - 40, y, id: 1 },
|
||||
{ x: x + 40, y, id: 2 },
|
||||
],
|
||||
});
|
||||
await cdp.send("Input.dispatchTouchEvent", { type: "touchEnd", touchPoints: [] });
|
||||
await expect(zoom).toHaveText("200%");
|
||||
await choose("Reset zoom");
|
||||
await expect(zoom).toHaveText("100%");
|
||||
}
|
||||
for (const mode of ["view", "edit"]) {
|
||||
if (mode === "edit") await page.getByRole("button", { name: "Edit", exact: true }).click();
|
||||
expect(await zoom.boundingBox()).toEqual(position);
|
||||
await choose("Zoom in");
|
||||
await expect(zoom).toHaveText("120%");
|
||||
await choose("Zoom out");
|
||||
await expect(zoom).toHaveText("100%");
|
||||
await choose("Zoom out");
|
||||
await expect(zoom).toHaveText("83%");
|
||||
await choose("Zoom to fit");
|
||||
await expect(zoom).toHaveText("100%");
|
||||
await choose("Zoom in");
|
||||
await choose("Reset zoom");
|
||||
await expect(zoom).toHaveText("100%");
|
||||
const surface = await page.getByRole("application").boundingBox();
|
||||
if (!surface) throw new Error("Missing drawing surface");
|
||||
await zoom.click();
|
||||
await expect(page.getByRole("menu")).toBeVisible();
|
||||
await page.mouse.click(surface.x + surface.width / 2, surface.y + surface.height / 2);
|
||||
await expect(page.getByRole("menu")).toHaveCount(0);
|
||||
await zoom.focus();
|
||||
await zoom.press("ArrowDown");
|
||||
await expect(page.getByRole("menuitem")).toHaveCount(4);
|
||||
const menu = await page.getByRole("menu").boundingBox();
|
||||
if (!menu || !position) throw new Error("Missing zoom menu");
|
||||
expect(menu.y + menu.height).toBeLessThanOrEqual(position.y);
|
||||
expect(menu.x).toBeGreaterThanOrEqual(0);
|
||||
expect(menu.x + menu.width).toBeLessThanOrEqual(page.viewportSize()!.width);
|
||||
await expect(page.getByRole("menuitem", { name: "Zoom to fit", exact: true }).locator("svg")).toHaveClass(/lucide-scan-search/);
|
||||
await page.screenshot({ path: testInfo.outputPath(`zoom-menu-${mode}.png`), animations: "disabled" });
|
||||
if (testInfo.project.name === "phone") {
|
||||
const viewport = page.viewportSize()!;
|
||||
const y = Math.max(0, Math.floor(menu.y) - 12);
|
||||
await page.screenshot({
|
||||
path: testInfo.outputPath(`zoom-menu-detail-${mode}.png`),
|
||||
animations: "disabled",
|
||||
clip: { x: 0, y, width: viewport.width, height: viewport.height - y },
|
||||
});
|
||||
}
|
||||
await page.keyboard.press("Escape");
|
||||
await expect(page.getByRole("menu")).toHaveCount(0);
|
||||
await expect(zoom).toBeFocused();
|
||||
await expect(page.getByRole("dialog")).toHaveCount(1);
|
||||
}
|
||||
await page.getByRole("button", { name: "Close", exact: true }).click();
|
||||
await expect(page.getByRole("button", { name: "Edit", exact: true })).toBeVisible();
|
||||
});
|
||||
|
||||
test("opens an existing drawing directly from the composer", async ({ page }) => {
|
||||
await page.goto("/tests/browser/drawing.html");
|
||||
await page.getByRole("button", { name: "Edit saved markup", exact: true }).click();
|
||||
await expect(page.getByRole("button", { name: "Save", exact: true })).toBeEnabled();
|
||||
await expect
|
||||
.poll(() =>
|
||||
page
|
||||
.getByRole("application")
|
||||
.locator("canvas")
|
||||
.first()
|
||||
.evaluate((canvas: HTMLCanvasElement) => {
|
||||
const data = canvas.getContext("2d")!.getImageData(0, 0, canvas.width, canvas.height).data;
|
||||
let dark = 0;
|
||||
for (let i = 0; i < data.length; i += 4) if (data[i + 3] && data[i] + data[i + 1] + data[i + 2] < 300) dark++;
|
||||
return dark;
|
||||
}),
|
||||
)
|
||||
.toBeGreaterThan(0);
|
||||
await page.getByRole("button", { name: "Close", exact: true }).click();
|
||||
await expect(page.getByRole("dialog")).toHaveCount(0);
|
||||
});
|
||||
|
||||
test("keeps the drawing, viewport and focus when switching between view and edit", async ({ page }, testInfo) => {
|
||||
await page.goto("/tests/browser/drawing.html");
|
||||
await page.getByRole("button", { name: "View markup", exact: true }).click();
|
||||
const edit = page.getByRole("button", { name: "Edit", exact: true });
|
||||
await expect(edit).toBeEnabled();
|
||||
const surface = page.getByRole("application");
|
||||
const original = await surface.elementHandle();
|
||||
const pixels = () =>
|
||||
surface
|
||||
.locator("canvas")
|
||||
.first()
|
||||
.evaluate((canvas: HTMLCanvasElement) => {
|
||||
const data = canvas.getContext("2d")!.getImageData(0, 0, canvas.width, canvas.height).data;
|
||||
let count = 0;
|
||||
let position = 0;
|
||||
for (let i = 0; i < data.length; i += 4) {
|
||||
if (data[i + 3] && data[i] + data[i + 1] + data[i + 2] < 300) {
|
||||
count++;
|
||||
position += i;
|
||||
}
|
||||
}
|
||||
return { count, position };
|
||||
});
|
||||
await expect.poll(async () => (await pixels()).count).toBeGreaterThan(0);
|
||||
const fitted = await pixels();
|
||||
const bounds = await surface.boundingBox();
|
||||
if (!bounds) throw new Error("Missing drawing surface");
|
||||
await page.mouse.move(bounds.x + bounds.width / 2, bounds.y + bounds.height / 2);
|
||||
await page.mouse.wheel(12, 20);
|
||||
await page.keyboard.down("Control");
|
||||
await page.mouse.wheel(0, -20);
|
||||
await page.keyboard.up("Control");
|
||||
await expect.poll(pixels).not.toEqual(fitted);
|
||||
const before = await pixels();
|
||||
const closePosition = await page.getByRole("button", { name: "Close", exact: true }).boundingBox();
|
||||
const zoom = page.getByRole("button", { name: /^Zoom \d+%$/ });
|
||||
await expect(zoom).toHaveText("122%");
|
||||
await expect(zoom).toHaveClass(/mu-button-ghost/);
|
||||
await expect(zoom).toHaveAttribute("aria-haspopup", "menu");
|
||||
const fit = async () => {
|
||||
await zoom.click();
|
||||
await page.getByRole("menuitem", { name: "Zoom to fit", exact: true }).click();
|
||||
};
|
||||
const zoomPosition = await zoom.boundingBox();
|
||||
if (!zoomPosition) throw new Error("Missing zoom control");
|
||||
expect(zoomPosition.x - bounds.x).toBeGreaterThanOrEqual(8);
|
||||
expect(zoomPosition.x - bounds.x).toBeLessThan(24);
|
||||
const bottomGap = bounds.y + bounds.height - zoomPosition.y - zoomPosition.height;
|
||||
expect(bottomGap).toBeGreaterThanOrEqual(testInfo.project.name === "phone" ? 60 : 8);
|
||||
expect(bottomGap).toBeLessThan(testInfo.project.name === "phone" ? 80 : 24);
|
||||
await page.screenshot({ path: testInfo.outputPath("markup-view.png") });
|
||||
for (let i = 0; i < 2; i++) {
|
||||
await edit.click();
|
||||
await expect(page.getByRole("button", { name: "Save", exact: true })).toBeEnabled();
|
||||
await expect.poll(pixels).toEqual(before);
|
||||
expect(await surface.evaluate((node, previous) => node === previous, original)).toBe(true);
|
||||
await expect(surface).toBeFocused();
|
||||
expect(await page.getByRole("button", { name: "Close", exact: true }).boundingBox()).toEqual(closePosition);
|
||||
expect(await zoom.boundingBox()).toEqual(zoomPosition);
|
||||
if (testInfo.project.name === "phone") {
|
||||
const tools = await page.getByRole("group", { name: "Tools", exact: true }).boundingBox();
|
||||
if (!tools) throw new Error("Missing tools");
|
||||
expect(tools.y - zoomPosition.y - zoomPosition.height).toBeGreaterThanOrEqual(8);
|
||||
}
|
||||
if (i === 0) await page.screenshot({ path: testInfo.outputPath("markup-edit.png") });
|
||||
await page.getByRole("button", { name: "Close", exact: true }).click();
|
||||
await expect(edit).toBeFocused();
|
||||
await expect.poll(pixels).toEqual(before);
|
||||
await expect(page.getByRole("group", { name: "Tools", exact: true })).toHaveCount(0);
|
||||
}
|
||||
await fit();
|
||||
await expect.poll(pixels).toEqual(fitted);
|
||||
await edit.click();
|
||||
await page.mouse.move(bounds.x + bounds.width / 2, bounds.y + bounds.height / 2);
|
||||
await page.mouse.wheel(12, 20);
|
||||
await expect.poll(pixels).not.toEqual(fitted);
|
||||
await fit();
|
||||
await expect.poll(pixels).toEqual(fitted);
|
||||
await page.getByRole("button", { name: "Rectangle", exact: true }).click();
|
||||
await page.mouse.move(bounds.x + bounds.width * 0.4, bounds.y + bounds.height * 0.6);
|
||||
await page.mouse.down();
|
||||
await page.mouse.move(bounds.x + bounds.width * 0.6, bounds.y + bounds.height * 0.7, { steps: 5 });
|
||||
await page.mouse.up();
|
||||
await expect.poll(pixels).not.toEqual(fitted);
|
||||
await page.getByRole("button", { name: "Close", exact: true }).click();
|
||||
await page.getByRole("button", { name: "Keep drawing", exact: true }).click();
|
||||
await expect(page.getByRole("button", { name: "Save", exact: true })).toBeEnabled();
|
||||
await page.getByRole("button", { name: "Close", exact: true }).click();
|
||||
await page.getByRole("button", { name: "Discard", exact: true }).click();
|
||||
await expect(edit).toBeFocused();
|
||||
await expect.poll(pixels).toEqual(fitted);
|
||||
await page.getByRole("button", { name: "Close", exact: true }).click();
|
||||
await expect(page.getByRole("dialog")).toHaveCount(0);
|
||||
});
|
||||
|
||||
test("annotates beside the original without draft UI", async ({ page }, testInfo) => {
|
||||
const errors: string[] = [];
|
||||
page.on("pageerror", (error) => errors.push(error.message));
|
||||
await page.goto("/tests/browser/drawing.html");
|
||||
await page.getByRole("textbox", { name: "Memo text" }).fill("Memo with markup");
|
||||
const original = await page.evaluate(async () =>
|
||||
Array.from(new Uint8Array(await window.drawingTest.store.getState().localFiles[0].file.arrayBuffer())),
|
||||
);
|
||||
await page.getByRole("button", { name: "Annotate source" }).click();
|
||||
await expect(page.getByRole("button", { name: "Add", exact: true })).toBeEnabled();
|
||||
const initialZoom = Number.parseInt(await page.getByRole("button", { name: /^Zoom \d+%$/ }).innerText(), 10);
|
||||
expect(initialZoom).toBeGreaterThan(0);
|
||||
if (testInfo.project.name === "phone") expect(initialZoom).toBeLessThan(100);
|
||||
if (testInfo.project.name === "phone") await expect(page.getByRole("button", { name: "Undo", exact: true })).toHaveCount(0);
|
||||
else await expect(page.getByRole("button", { name: "Undo", exact: true })).toBeDisabled();
|
||||
await page.getByRole("button", { name: "Arrow", exact: true }).click();
|
||||
const bounds = await page.getByRole("application").boundingBox();
|
||||
if (!bounds) throw new Error("Missing drawing surface");
|
||||
await page.mouse.move(bounds.x + bounds.width * 0.3, bounds.y + bounds.height * 0.4);
|
||||
await page.mouse.down();
|
||||
await page.mouse.move(bounds.x + bounds.width * 0.6, bounds.y + bounds.height * 0.55, { steps: 8 });
|
||||
await page.mouse.up();
|
||||
if (testInfo.project.name === "phone") {
|
||||
const undo = page.getByRole("button", { name: "Undo", exact: true });
|
||||
await expect(undo).toHaveClass(/mu-button-ghost/);
|
||||
expect(await undo.evaluate((button) => button.closest(".border-mu-edge"))).toBeNull();
|
||||
const position = await undo.boundingBox();
|
||||
expect(position?.x).toBeLessThan(120);
|
||||
await undo.click();
|
||||
await expect(undo).toHaveCount(0);
|
||||
await expect(page.getByRole("application")).toBeFocused();
|
||||
await page.getByRole("button", { name: "Redo", exact: true }).click();
|
||||
await expect(page.getByRole("button", { name: "Redo", exact: true })).toHaveCount(0);
|
||||
}
|
||||
await expect(page.getByRole("status")).toHaveCount(0);
|
||||
await expect(page.getByRole("button", { name: "More", exact: true })).toHaveCount(0);
|
||||
if (testInfo.project.name === "phone") await page.screenshot({ path: testInfo.outputPath("markup-phone.png") });
|
||||
await page.getByRole("button", { name: "Add", exact: true }).click();
|
||||
await expect(page.getByRole("dialog")).toHaveCount(0);
|
||||
const result = await page.evaluate(async () => {
|
||||
const { store, readScenePng } = window.drawingTest;
|
||||
const state = store.getState();
|
||||
const file = state.localFiles.find((item) => item.file.name.endsWith(".canvas.png"));
|
||||
if (!file) throw new Error("Missing markup");
|
||||
const { scene } = await readScenePng(file.file);
|
||||
return {
|
||||
text: state.content,
|
||||
count: state.localFiles.length,
|
||||
elements: scene?.elements.length,
|
||||
locked: scene?.elements[0].locked,
|
||||
original: Array.from(new Uint8Array(await state.localFiles[0].file.arrayBuffer())),
|
||||
order: state.attachmentOrder.map((key) => state.localFiles.find((item) => item.previewUrl === key)?.file.name),
|
||||
};
|
||||
});
|
||||
expect(result).toMatchObject({ text: "Memo with markup", count: 3, elements: 2, locked: true, original });
|
||||
expect(result.order).toEqual(["original.png", expect.stringMatching(/\.canvas\.png$/), "other.txt"]);
|
||||
await expect(page.getByText("Continue markup", { exact: true })).toHaveCount(0);
|
||||
expect(errors).toEqual([]);
|
||||
});
|
||||
|
||||
test("includes active Chinese text when adding markup", async ({ page }) => {
|
||||
await page.goto("/tests/browser/drawing.html");
|
||||
await page.getByRole("button", { name: "Annotate source" }).click();
|
||||
await expect(page.getByRole("button", { name: "Add", exact: true })).toBeEnabled();
|
||||
await page.getByRole("button", { name: "Text", exact: true }).click();
|
||||
const bounds = await page.getByRole("application").boundingBox();
|
||||
if (!bounds) throw new Error("Missing drawing surface");
|
||||
await page.mouse.click(bounds.x + bounds.width * 0.4, bounds.y + bounds.height * 0.4);
|
||||
const input = page.getByRole("textbox", { name: "Text", exact: true });
|
||||
const cdp = await page.context().newCDPSession(page);
|
||||
await cdp.send("Input.imeSetComposition", { text: "nihao", selectionStart: 5, selectionEnd: 5 });
|
||||
await expect(input).toBeFocused();
|
||||
await cdp.send("Input.insertText", { text: "你好" });
|
||||
await expect(input).toHaveValue("你好");
|
||||
const overflow = await page
|
||||
.getByRole("dialog")
|
||||
.getByRole("button")
|
||||
.evaluateAll((buttons) =>
|
||||
buttons.some((button) => {
|
||||
const bounds = button.getBoundingClientRect();
|
||||
return bounds.width > 0 && (bounds.x < 0 || bounds.right > innerWidth);
|
||||
}),
|
||||
);
|
||||
expect(overflow).toBe(false);
|
||||
await page.getByRole("button", { name: "Add", exact: true }).click();
|
||||
await expect(page.getByRole("dialog")).toHaveCount(0);
|
||||
expect(
|
||||
await page.evaluate(async () => {
|
||||
const file = window.drawingTest.store.getState().localFiles.find((item) => item.file.name.endsWith(".canvas.png"));
|
||||
if (!file) throw new Error("Missing markup");
|
||||
const { scene } = await window.drawingTest.readScenePng(file.file);
|
||||
return (scene?.elements.find((item) => item.type === "text") as TextElement | undefined)?.text;
|
||||
}),
|
||||
).toBe("你好");
|
||||
});
|
||||
@@ -0,0 +1,160 @@
|
||||
import { create } from "@bufbuild/protobuf";
|
||||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||
import { createScene, insertSceneChunk, readScenePng, type Scene } from "@usememos/canvas";
|
||||
import { Suspense, useEffect, useState } from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import DrawingSheet from "@/components/DrawingSheet/DrawingSheet";
|
||||
import DrawingViewer from "@/components/DrawingSheet/DrawingViewer";
|
||||
import { useBlobUrls } from "@/components/MemoEditor/edit/hooks/useBlobUrls";
|
||||
import { useDrawing } from "@/components/MemoEditor/edit/hooks/useDrawing";
|
||||
import {
|
||||
createInitialState,
|
||||
EditorProvider,
|
||||
type EditorStore,
|
||||
useEditorSelector,
|
||||
useEditorStore,
|
||||
} from "@/components/MemoEditor/edit/state";
|
||||
import { AuthProvider, useAuth } from "@/contexts/AuthContext";
|
||||
import { AttachmentSchema } from "@/types/proto/api/attachment_service_pb";
|
||||
import { MemoSchema } from "@/types/proto/api/memo_service_pb";
|
||||
import { UserSchema } from "@/types/proto/api/user_service_pb";
|
||||
import "@/index.css";
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
drawingTest: {
|
||||
store: EditorStore;
|
||||
readScenePng: typeof readScenePng;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
const image = document.createElement("canvas");
|
||||
image.width = 1000;
|
||||
image.height = 600;
|
||||
const context = image.getContext("2d");
|
||||
if (!context) throw new Error("Canvas unavailable");
|
||||
context.fillStyle = "white";
|
||||
context.fillRect(0, 0, 1000, 600);
|
||||
context.fillStyle = "black";
|
||||
context.font = "30px sans-serif";
|
||||
context.fillText("Original screenshot", 80, 80);
|
||||
context.strokeRect(80, 140, 400, 200);
|
||||
const source = await new Promise<Blob>((resolve, reject) =>
|
||||
image.toBlob((blob) => (blob ? resolve(blob) : reject(new Error("PNG failed")))),
|
||||
);
|
||||
const savedScene: Scene = {
|
||||
...createScene("#fbfaf7"),
|
||||
elements: [
|
||||
{
|
||||
id: "existing-rectangle",
|
||||
type: "rectangle",
|
||||
x: 600,
|
||||
y: 350,
|
||||
width: 240,
|
||||
height: 100,
|
||||
angle: 0,
|
||||
strokeColor: "#1a1a1a",
|
||||
backgroundColor: "transparent",
|
||||
strokeWidth: 2,
|
||||
opacity: 100,
|
||||
roundness: 0,
|
||||
isDeleted: false,
|
||||
groupIds: [],
|
||||
boundElements: [],
|
||||
seed: 1,
|
||||
locked: false,
|
||||
},
|
||||
],
|
||||
};
|
||||
const savedDrawing = new File(
|
||||
[new Uint8Array(await insertSceneChunk(new Uint8Array(await source.arrayBuffer()), savedScene))],
|
||||
"saved.canvas.png",
|
||||
{ type: "image/png" },
|
||||
);
|
||||
const drawingUrl = URL.createObjectURL(savedDrawing);
|
||||
const initial = createInitialState();
|
||||
initial.content = "Fresh editor";
|
||||
initial.localFiles = [
|
||||
{ file: new File([source], "original.png", { type: "image/png" }), previewUrl: URL.createObjectURL(source) },
|
||||
{ file: new File(["other file bytes"], "other.txt"), previewUrl: URL.createObjectURL(new Blob(["other file bytes"])) },
|
||||
];
|
||||
|
||||
function DrawingHost() {
|
||||
const [viewing, setViewing] = useState(false);
|
||||
const store = useEditorStore();
|
||||
const content = useEditorSelector((state) => state.content);
|
||||
const files = useEditorSelector((state) => state.localFiles);
|
||||
const { createBlobUrl } = useBlobUrls();
|
||||
const drawing = useDrawing((file) => ({ file, previewUrl: createBlobUrl(file) }));
|
||||
window.drawingTest = { store, readScenePng };
|
||||
return (
|
||||
<>
|
||||
<textarea
|
||||
aria-label="Memo text"
|
||||
value={content}
|
||||
onChange={(event) => store.dispatch(store.actions.updateContent(event.target.value))}
|
||||
/>
|
||||
<button type="button" onClick={() => void drawing.openExisting({ kind: "local", localFile: files[0] })}>
|
||||
Annotate source
|
||||
</button>
|
||||
<button type="button" onClick={() => setViewing(true)}>
|
||||
View markup
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => void drawing.openExisting({ kind: "local", localFile: { file: savedDrawing, previewUrl: drawingUrl } })}
|
||||
>
|
||||
Edit saved markup
|
||||
</button>
|
||||
{viewing && (
|
||||
<DrawingViewer
|
||||
attachment={create(AttachmentSchema, {
|
||||
name: "attachments/drawing",
|
||||
creator: "users/browser",
|
||||
filename: "fixture.canvas.png",
|
||||
externalLink: drawingUrl,
|
||||
})}
|
||||
memo={create(MemoSchema, { name: "memos/drawing", creator: "users/browser" })}
|
||||
canEdit
|
||||
onClose={() => setViewing(false)}
|
||||
onNoScene={() => {
|
||||
throw new Error("Missing fixture scene");
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{drawing.session && (
|
||||
<Suspense fallback={null}>
|
||||
<DrawingSheet
|
||||
key={drawing.session.id}
|
||||
mode={drawing.session.mode}
|
||||
initialScene={drawing.session.scene}
|
||||
background={drawing.session.background}
|
||||
onDone={drawing.done}
|
||||
onClose={drawing.close}
|
||||
/>
|
||||
</Suspense>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
function App() {
|
||||
const { currentUser, setCurrentUser } = useAuth();
|
||||
useEffect(() => {
|
||||
setCurrentUser(create(UserSchema, { name: "users/browser" }));
|
||||
}, [setCurrentUser]);
|
||||
return currentUser ? (
|
||||
<EditorProvider initialEditorState={initial}>
|
||||
<DrawingHost />
|
||||
</EditorProvider>
|
||||
) : null;
|
||||
}
|
||||
const root = document.getElementById("root");
|
||||
if (!root) throw new Error("Missing test root");
|
||||
createRoot(root).render(
|
||||
<QueryClientProvider client={new QueryClient()}>
|
||||
<AuthProvider>
|
||||
<App />
|
||||
</AuthProvider>
|
||||
</QueryClientProvider>,
|
||||
);
|
||||
@@ -0,0 +1,21 @@
|
||||
import { resolve } from "node:path";
|
||||
import { defineConfig } from "@playwright/test";
|
||||
|
||||
export default defineConfig({
|
||||
testDir: ".",
|
||||
testMatch: "drawing.spec.ts",
|
||||
workers: 1,
|
||||
reporter: "list",
|
||||
outputDir: "../../node_modules/.cache/drawing-browser-results",
|
||||
use: { baseURL: "http://localhost:3074", trace: "retain-on-failure" },
|
||||
projects: [
|
||||
{ name: "desktop", use: { browserName: "chromium", viewport: { width: 1280, height: 900 } } },
|
||||
{ name: "phone", use: { browserName: "chromium", viewport: { width: 360, height: 780 }, isMobile: true, hasTouch: true } },
|
||||
],
|
||||
webServer: {
|
||||
cwd: resolve(__dirname, "../.."),
|
||||
command: "pnpm exec vite --config tests/browser/vite.config.mts",
|
||||
url: "http://localhost:3074/tests/browser/drawing.html",
|
||||
reuseExistingServer: false,
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,7 @@
|
||||
import config from "../../vite.config.mjs";
|
||||
|
||||
export default {
|
||||
...config,
|
||||
cacheDir: "node_modules/.vite-drawing-test",
|
||||
server: { ...config.server, port: 3074, strictPort: true, hmr: false },
|
||||
};
|
||||
@@ -6,16 +6,22 @@ import DrawingSheet from "@/components/DrawingSheet/DrawingSheet";
|
||||
const calls: string[] = [];
|
||||
const handle = {
|
||||
setTool: vi.fn(),
|
||||
setReadOnly: vi.fn((value: boolean) => {
|
||||
if (value) calls.push("freeze");
|
||||
}),
|
||||
getScene: vi.fn(() => ({ type: "memos-canvas", version: 1, elements: [], files: {}, appState: {} })),
|
||||
setScene: vi.fn(),
|
||||
setStyle: vi.fn(),
|
||||
undo: vi.fn(),
|
||||
redo: vi.fn(),
|
||||
canUndo: vi.fn(() => false),
|
||||
canRedo: vi.fn(() => false),
|
||||
zoomToFit: vi.fn(),
|
||||
zoomTo: vi.fn(),
|
||||
getViewport: vi.fn(() => ({ zoom: 1, scrollX: 0, scrollY: 0 })),
|
||||
insertImage: vi.fn(async () => "image1"),
|
||||
markSaved: vi.fn(),
|
||||
isDirty: vi.fn(() => false),
|
||||
commitText: vi.fn(() => calls.push("commitText")),
|
||||
exportPng: vi.fn(async () => {
|
||||
calls.push("exportPng");
|
||||
return new Blob(["png"], { type: "image/png" });
|
||||
@@ -72,7 +78,6 @@ beforeEach(() => {
|
||||
calls.push("exportPng");
|
||||
return new Blob(["png"], { type: "image/png" });
|
||||
});
|
||||
handle.commitText.mockImplementation(() => calls.push("commitText"));
|
||||
});
|
||||
|
||||
describe("DrawingSheet", () => {
|
||||
@@ -80,24 +85,25 @@ describe("DrawingSheet", () => {
|
||||
render(<DrawingSheet mode="new" onDone={vi.fn()} onClose={vi.fn()} />);
|
||||
|
||||
expect(screen.getByRole("dialog")).toHaveClass("w-[calc(100vw-48px)]", "h-[calc(100dvh-48px)]");
|
||||
for (const name of ["common.cancel", "editor.drawing.tool-pen", "editor.drawing.undo", "editor.drawing.done"]) {
|
||||
for (const name of ["common.close", "editor.drawing.tool-pen", "editor.drawing.undo", "common.add"]) {
|
||||
expect(screen.getByRole("button", { name }).closest("[data-theme]")).toHaveAttribute("data-theme", "light");
|
||||
}
|
||||
// One bordered surface per group: the tools share a bar, while Cancel and Done stand alone.
|
||||
// One bordered surface per group: the tools share a bar, while Close and Add stand alone.
|
||||
expect(screen.getByRole("button", { name: "editor.drawing.tool-pen" }).closest(".border-mu-edge")).not.toBeNull();
|
||||
for (const name of ["common.cancel", "editor.drawing.done"]) {
|
||||
for (const name of ["common.close", "common.add", "editor.drawing.zoom 100%"]) {
|
||||
expect(screen.getByRole("button", { name }).closest(".border-mu-edge")).toBeNull();
|
||||
}
|
||||
expect(screen.getByRole("button", { name: "editor.drawing.zoom 100%" })).toHaveTextContent("100%");
|
||||
});
|
||||
|
||||
it("keeps typed text, exports and hands back a named PNG on Done", async () => {
|
||||
it("keeps typed text, exports and hands back a named PNG on Add", async () => {
|
||||
const onDone = vi.fn();
|
||||
render(<DrawingSheet mode="new" onDone={onDone} onClose={vi.fn()} />);
|
||||
|
||||
fireEvent.click(screen.getByRole("button", { name: "editor.drawing.done" }));
|
||||
fireEvent.click(screen.getByRole("button", { name: "common.add" }));
|
||||
|
||||
await waitFor(() => expect(onDone).toHaveBeenCalledTimes(1));
|
||||
expect(calls).toEqual(["commitText", "exportPng"]);
|
||||
expect(calls).toEqual(["freeze", "exportPng"]);
|
||||
const file = onDone.mock.calls[0][0] as File;
|
||||
expect(file.type).toBe("image/png");
|
||||
expect(file.name).toMatch(/^drawing-\d{8}-\d{6}\.canvas\.png$/);
|
||||
@@ -106,19 +112,19 @@ describe("DrawingSheet", () => {
|
||||
it("closes at once when nothing changed, and asks first when the drawing has changes", async () => {
|
||||
const onClose = vi.fn();
|
||||
const { unmount } = render(<DrawingSheet mode="new" onDone={vi.fn()} onClose={onClose} />);
|
||||
fireEvent.click(screen.getByRole("button", { name: "common.cancel" }));
|
||||
fireEvent.click(screen.getByRole("button", { name: "common.close" }));
|
||||
expect(onClose).toHaveBeenCalledTimes(1);
|
||||
unmount();
|
||||
|
||||
onClose.mockClear();
|
||||
handle.isDirty.mockReturnValue(true);
|
||||
render(<DrawingSheet mode="edit" onDone={vi.fn()} onClose={onClose} />);
|
||||
fireEvent.click(screen.getByRole("button", { name: "common.cancel" }));
|
||||
fireEvent.click(screen.getByRole("button", { name: "common.close" }));
|
||||
expect(await screen.findByText("editor.drawing.discard-edit-title")).toBeInTheDocument();
|
||||
expect(onClose).not.toHaveBeenCalled();
|
||||
|
||||
fireEvent.click(screen.getByRole("button", { name: "editor.drawing.discard" }));
|
||||
expect(onClose).toHaveBeenCalledTimes(1);
|
||||
await waitFor(() => expect(onClose).toHaveBeenCalledTimes(1));
|
||||
});
|
||||
|
||||
it("drives the canvas from the toolbar", () => {
|
||||
@@ -128,17 +134,42 @@ describe("DrawingSheet", () => {
|
||||
expect(handle.setTool).toHaveBeenLastCalledWith("rectangle");
|
||||
expect(screen.getByRole("button", { name: "editor.drawing.tool-rectangle" })).toHaveAttribute("aria-pressed", "true");
|
||||
|
||||
fireEvent.click(screen.getByRole("button", { name: "editor.drawing.zoom-to-fit" }));
|
||||
expect(handle.zoomToFit).toHaveBeenCalled();
|
||||
expect(screen.getByRole("button", { name: "editor.drawing.undo" })).toBeDisabled();
|
||||
});
|
||||
|
||||
it("uses the zoom percentage to open zoom actions and updates the readout", async () => {
|
||||
let zoom = 1;
|
||||
handle.getViewport.mockImplementation(() => ({ zoom, scrollX: 0, scrollY: 0 }));
|
||||
handle.zoomTo.mockImplementation((value: number) => {
|
||||
zoom = value;
|
||||
});
|
||||
handle.zoomToFit.mockImplementation(() => {
|
||||
zoom = 0.5;
|
||||
});
|
||||
render(<DrawingSheet mode="new" onDone={vi.fn()} onClose={vi.fn()} />);
|
||||
const trigger = () => screen.getByRole("button", { name: /^editor\.drawing\.zoom \d+%$/ });
|
||||
const choose = async (name: string) => {
|
||||
fireEvent.click(trigger());
|
||||
fireEvent.click(await screen.findByRole("menuitem", { name }));
|
||||
await waitFor(() => expect(screen.queryByRole("menu")).not.toBeInTheDocument());
|
||||
};
|
||||
await choose("map.zoom-in");
|
||||
expect(trigger()).toHaveTextContent("120%");
|
||||
await choose("map.zoom-out");
|
||||
expect(trigger()).toHaveTextContent("100%");
|
||||
await choose("editor.drawing.zoom-to-fit");
|
||||
expect(trigger()).toHaveTextContent("50%");
|
||||
await choose("attachment-preview.reset-zoom");
|
||||
expect(trigger()).toHaveTextContent("100%");
|
||||
expect(handle.markSaved).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("enables Undo as soon as a stroke ends, without waiting for the debounced change", () => {
|
||||
render(<DrawingSheet mode="new" onDone={vi.fn()} onClose={vi.fn()} />);
|
||||
expect(screen.getByRole("button", { name: "editor.drawing.undo" })).toBeDisabled();
|
||||
|
||||
handle.canUndo.mockReturnValue(true);
|
||||
fireEvent.pointerUp(screen.getByRole("img", { name: "editor.drawing.new-title" }));
|
||||
fireEvent.pointerUp(screen.getByRole("img", { name: "editor.insert-menu.drawing" }));
|
||||
|
||||
expect(screen.getByRole("button", { name: "editor.drawing.undo" })).toBeEnabled();
|
||||
});
|
||||
@@ -164,30 +195,30 @@ describe("DrawingSheet", () => {
|
||||
expect(canvasProps.initialScene).toBe(scene);
|
||||
});
|
||||
|
||||
it("holds drawing and Done until the background picture is in", async () => {
|
||||
it("holds drawing and Add until the background picture is in", async () => {
|
||||
let finishInsert: (id: string) => void = () => undefined;
|
||||
handle.insertImage.mockImplementation(() => new Promise((resolve) => (finishInsert = resolve)));
|
||||
const onDone = vi.fn();
|
||||
render(<DrawingSheet mode="new" background={new Blob(["png"], { type: "image/png" })} onDone={onDone} onClose={vi.fn()} />);
|
||||
|
||||
const done = screen.getByRole("button", { name: "editor.drawing.done" });
|
||||
const done = screen.getByRole("button", { name: "editor.blocks.loading" });
|
||||
await waitFor(() => expect(handle.insertImage).toHaveBeenCalled());
|
||||
expect(done).toBeDisabled();
|
||||
expect(done).toHaveAttribute("aria-disabled", "true");
|
||||
expect(screen.getByRole("img").parentElement).toHaveAttribute("aria-busy", "true");
|
||||
|
||||
finishInsert("image1");
|
||||
await waitFor(() => expect(done).toBeEnabled());
|
||||
await waitFor(() => expect(screen.getByRole("button", { name: "common.add" })).not.toHaveAttribute("aria-disabled"));
|
||||
expect(screen.getByRole("img").parentElement).not.toHaveAttribute("aria-busy");
|
||||
});
|
||||
|
||||
it("stays dirty when saving fails, so Cancel still asks before discarding", async () => {
|
||||
it("stays dirty when saving fails, so Close still asks before discarding", async () => {
|
||||
handle.exportPng.mockResolvedValue(new Blob(["png"], { type: "image/png" }));
|
||||
const onDone = vi.fn().mockRejectedValue(new Error("offline"));
|
||||
render(<DrawingSheet mode="new" onDone={onDone} onClose={vi.fn()} />);
|
||||
|
||||
fireEvent.click(await screen.findByRole("button", { name: "editor.drawing.done" }));
|
||||
fireEvent.click(await screen.findByRole("button", { name: "common.add" }));
|
||||
await waitFor(() => expect(onDone).toHaveBeenCalled());
|
||||
await waitFor(() => expect(screen.getByRole("button", { name: "editor.drawing.done" })).toBeEnabled());
|
||||
await waitFor(() => expect(screen.getByRole("button", { name: "common.add" })).toBeEnabled());
|
||||
expect(handle.markSaved).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
@@ -196,6 +227,44 @@ describe("DrawingSheet", () => {
|
||||
render(<DrawingSheet mode="new" background={picture} onDone={vi.fn()} onClose={vi.fn()} />);
|
||||
|
||||
await waitFor(() => expect(handle.insertImage).toHaveBeenCalledWith(picture, { background: true }));
|
||||
await waitFor(() => expect(handle.markSaved).toHaveBeenCalled());
|
||||
await waitFor(() => expect(handle.setScene).toHaveBeenCalledWith(handle.getScene()));
|
||||
expect(handle.markSaved).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe("drawing save boundaries", () => {
|
||||
it("freezes input before export and keeps it frozen while the host save is pending", async () => {
|
||||
let complete: () => void = () => undefined;
|
||||
const onDone = vi.fn(
|
||||
() =>
|
||||
new Promise<void>((resolve) => {
|
||||
complete = resolve;
|
||||
}),
|
||||
);
|
||||
render(<DrawingSheet mode="edit" commitLabel="common.save" onDone={onDone} onClose={vi.fn()} />);
|
||||
fireEvent.click(screen.getByRole("button", { name: "common.save" }));
|
||||
await waitFor(() => expect(onDone).toHaveBeenCalledOnce());
|
||||
expect(handle.setReadOnly).toHaveBeenLastCalledWith(true);
|
||||
expect(handle.markSaved).not.toHaveBeenCalled();
|
||||
expect(screen.getByRole("button", { name: "editor.drawing.tool-pen" })).toBeDisabled();
|
||||
expect(screen.getByRole("button", { name: "common.close" })).toBeDisabled();
|
||||
complete();
|
||||
await waitFor(() => expect(handle.markSaved).toHaveBeenCalledOnce());
|
||||
});
|
||||
|
||||
it("does not turn a failed background import into a blank editable drawing", async () => {
|
||||
handle.insertImage.mockResolvedValue(null as never);
|
||||
render(<DrawingSheet mode="new" background={new Blob(["bad"], { type: "image/png" })} onDone={vi.fn()} onClose={vi.fn()} />);
|
||||
await waitFor(() => expect(screen.getByRole("button", { name: "editor.drawing.image-failed" })).toBeInTheDocument());
|
||||
expect(screen.getByRole("button", { name: "common.add" })).toBeDisabled();
|
||||
expect(screen.getByRole("button", { name: "editor.drawing.tool-pen" })).toBeDisabled();
|
||||
expect(handle.setScene).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("shows only the main action in the normal state", () => {
|
||||
render(<DrawingSheet mode="new" onDone={vi.fn()} onClose={vi.fn()} />);
|
||||
expect(screen.queryByRole("status")).not.toBeInTheDocument();
|
||||
expect(screen.queryByRole("button", { name: "common.more" })).not.toBeInTheDocument();
|
||||
expect(screen.getByRole("button", { name: "common.add" })).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -15,18 +15,24 @@ const mocks = vi.hoisted(() => ({
|
||||
canvasProps: [] as Array<{ readOnly?: boolean; initialScene?: { elements: unknown[] } }>,
|
||||
uploadFile: vi.fn(),
|
||||
updateMemo: vi.fn(),
|
||||
getMemo: vi.fn(),
|
||||
currentUser: undefined as unknown,
|
||||
}));
|
||||
|
||||
const handle = {
|
||||
setTool: vi.fn(),
|
||||
setReadOnly: vi.fn(),
|
||||
getScene: vi.fn(),
|
||||
setScene: vi.fn(),
|
||||
setStyle: vi.fn(),
|
||||
focus: vi.fn(),
|
||||
zoomToFit: vi.fn(),
|
||||
canUndo: () => false,
|
||||
zoomTo: vi.fn(),
|
||||
getViewport: () => ({ zoom: 1, scrollX: 0, scrollY: 0 }),
|
||||
canUndo: vi.fn(() => false),
|
||||
canRedo: () => false,
|
||||
isDirty: () => true,
|
||||
markSaved: vi.fn(),
|
||||
commitText: vi.fn(),
|
||||
insertImage: vi.fn(),
|
||||
exportPng: vi.fn(),
|
||||
};
|
||||
@@ -40,6 +46,7 @@ vi.mock("@usememos/canvas/react", () => ({
|
||||
}));
|
||||
vi.mock("@/components/MemoEditor/edit/services/uploadService", () => ({ uploadService: { uploadFile: mocks.uploadFile } }));
|
||||
vi.mock("@/hooks/useMemoQueries", () => ({ useUpdateMemo: () => ({ mutateAsync: mocks.updateMemo }) }));
|
||||
vi.mock("@/connect", () => ({ memoServiceClient: { getMemo: mocks.getMemo } }));
|
||||
vi.mock("@/hooks/useCurrentUser", () => ({ default: () => mocks.currentUser }));
|
||||
vi.mock("@/utils/i18n", async (importOriginal) => ({
|
||||
...(await importOriginal<typeof import("@/utils/i18n")>()),
|
||||
@@ -83,7 +90,7 @@ const drawing = create(AttachmentSchema, {
|
||||
type: "image/png",
|
||||
});
|
||||
const memo = create(MemoSchema, { name: "memos/m1", creator: author.name, attachments: [drawing] });
|
||||
const withScene = async () => new Uint8Array(await insertSceneChunk(fixturePng, scene));
|
||||
const withScene = async (value = scene) => new Uint8Array(await insertSceneChunk(fixturePng, value));
|
||||
|
||||
/** Edit stays disabled until the drawing's scene has loaded. */
|
||||
const startEditing = async () => {
|
||||
@@ -100,8 +107,11 @@ beforeAll(() => {
|
||||
});
|
||||
|
||||
beforeEach(async () => {
|
||||
handle.canUndo.mockReturnValue(false);
|
||||
mocks.canvasProps.length = 0;
|
||||
mocks.currentUser = author;
|
||||
mocks.getMemo.mockResolvedValue(memo);
|
||||
handle.getScene.mockReturnValue(scene);
|
||||
const bytes = await withScene();
|
||||
vi.stubGlobal(
|
||||
"fetch",
|
||||
@@ -114,12 +124,70 @@ afterEach(() => {
|
||||
});
|
||||
|
||||
describe("DrawingViewer", () => {
|
||||
it("shows the drawing read-only, with Zoom to fit and Edit for the author", async () => {
|
||||
it("returns focus to the canvas when Edit is no longer available", async () => {
|
||||
const props = { attachment: drawing, memo, canEdit: true, onClose: vi.fn(), onNoScene: vi.fn() };
|
||||
const { rerender } = render(<DrawingViewer {...props} />);
|
||||
await startEditing();
|
||||
handle.focus.mockClear();
|
||||
rerender(<DrawingViewer {...props} canEdit={false} />);
|
||||
fireEvent.click(screen.getByRole("button", { name: "common.close" }));
|
||||
fireEvent.click(await screen.findByRole("button", { name: "editor.drawing.discard" }));
|
||||
await waitFor(() => expect(mocks.canvasProps.at(-1)?.readOnly).toBe(true));
|
||||
expect(screen.queryByRole("button", { name: "common.edit" })).not.toBeInTheDocument();
|
||||
expect(handle.focus).toHaveBeenCalledOnce();
|
||||
});
|
||||
|
||||
it("refreshes available history when entering edit on the retained canvas", async () => {
|
||||
render(<DrawingViewer attachment={drawing} memo={memo} canEdit onClose={vi.fn()} onNoScene={vi.fn()} />);
|
||||
handle.canUndo.mockReturnValue(true);
|
||||
await startEditing();
|
||||
expect(screen.getByRole("button", { name: "editor.drawing.undo" })).toBeEnabled();
|
||||
});
|
||||
|
||||
it.each(["replacement", "copy"])("returns to the accepted scene after abandoning a failed %s update", async (kind) => {
|
||||
const source = create(AttachmentSchema, { ...drawing, creator: kind === "replacement" ? author.name : "users/other" });
|
||||
const current = create(MemoSchema, { ...memo, attachments: [source] });
|
||||
const edited = structuredClone(scene);
|
||||
edited.elements[0].x = 30;
|
||||
handle.exportPng.mockResolvedValue(new Blob([await withScene(edited)], { type: "image/png" }));
|
||||
mocks.getMemo.mockResolvedValue(current);
|
||||
mocks.uploadFile.mockResolvedValue(kind === "replacement" ? source : create(AttachmentSchema, { name: "attachments/copy" }));
|
||||
mocks.updateMemo.mockRejectedValueOnce(new Error("offline"));
|
||||
render(<DrawingViewer attachment={source} memo={current} canEdit onClose={vi.fn()} onNoScene={vi.fn()} />);
|
||||
await startEditing();
|
||||
const save = screen.getByRole("button", { name: kind === "replacement" ? "common.save" : "editor.drawing.save-copy" });
|
||||
fireEvent.click(save);
|
||||
await waitFor(() => expect(mocks.updateMemo).toHaveBeenCalledOnce());
|
||||
await waitFor(() => expect(save).toBeEnabled());
|
||||
fireEvent.click(screen.getByRole("button", { name: "common.close" }));
|
||||
fireEvent.click(await screen.findByRole("button", { name: "editor.drawing.discard" }));
|
||||
await waitFor(() => expect(screen.getByRole("button", { name: "common.edit" })).toHaveFocus());
|
||||
expect(handle.setScene).toHaveBeenCalledWith(kind === "replacement" ? edited : scene);
|
||||
expect(mocks.canvasProps.at(-1)?.readOnly).toBe(true);
|
||||
});
|
||||
|
||||
it("keeps the same canvas and restores the accepted drawing when an edit is discarded", async () => {
|
||||
const onClose = vi.fn();
|
||||
render(<DrawingViewer attachment={drawing} memo={memo} canEdit onClose={onClose} onNoScene={vi.fn()} />);
|
||||
await startEditing();
|
||||
const surface = screen.getByRole("img");
|
||||
expect(handle.focus).toHaveBeenCalled();
|
||||
fireEvent.click(screen.getByRole("button", { name: "common.close" }));
|
||||
fireEvent.click(await screen.findByRole("button", { name: "editor.drawing.discard" }));
|
||||
await waitFor(() => expect(screen.getByRole("button", { name: "common.edit" })).toHaveFocus());
|
||||
expect(screen.getByRole("img")).toBe(surface);
|
||||
expect(handle.setScene).toHaveBeenCalledWith(scene);
|
||||
expect(onClose).not.toHaveBeenCalled();
|
||||
fireEvent.click(screen.getByRole("button", { name: "common.close" }));
|
||||
expect(onClose).toHaveBeenCalledOnce();
|
||||
});
|
||||
|
||||
it("shows the drawing read-only, with zoom navigation and Edit for the author", async () => {
|
||||
render(<DrawingViewer attachment={drawing} memo={memo} canEdit onClose={vi.fn()} onNoScene={vi.fn()} />);
|
||||
|
||||
await waitFor(() => expect(mocks.canvasProps.at(-1)?.initialScene?.elements).toHaveLength(1));
|
||||
expect(mocks.canvasProps.at(-1)?.readOnly).toBe(true);
|
||||
expect(screen.getByRole("button", { name: "editor.drawing.zoom-to-fit" })).toBeInTheDocument();
|
||||
expect(screen.getByRole("button", { name: "editor.drawing.zoom 100%" })).toBeInTheDocument();
|
||||
expect(screen.queryByRole("link")).not.toBeInTheDocument();
|
||||
expect(screen.getByRole("button", { name: "common.edit" })).toBeEnabled();
|
||||
});
|
||||
@@ -149,13 +217,15 @@ describe("DrawingViewer", () => {
|
||||
render(<DrawingViewer attachment={drawing} memo={memo} canEdit onClose={vi.fn()} onNoScene={vi.fn()} />);
|
||||
|
||||
await startEditing();
|
||||
fireEvent.click(await screen.findByRole("button", { name: "editor.drawing.done" }));
|
||||
const surface = screen.getByRole("img");
|
||||
fireEvent.click(await screen.findByRole("button", { name: "common.save" }));
|
||||
|
||||
await waitFor(() => expect(mocks.updateMemo).toHaveBeenCalledWith({ update: { name: memo.name }, updateMask: ["update_time"] }));
|
||||
expect(mocks.uploadFile.mock.calls[0][0].replaces).toBe(drawing.name);
|
||||
// Back in the viewer, read-only again.
|
||||
await waitFor(() => expect(screen.getByRole("button", { name: "editor.drawing.zoom-to-fit" })).toBeInTheDocument());
|
||||
await waitFor(() => expect(screen.getByRole("button", { name: "common.edit" })).toHaveFocus());
|
||||
expect(mocks.canvasProps.at(-1)?.readOnly).toBe(true);
|
||||
expect(screen.getByRole("img")).toBe(surface);
|
||||
});
|
||||
|
||||
it("adds an edit of someone else's drawing beside it, and a retry reuses the uploaded copy", async () => {
|
||||
@@ -163,6 +233,7 @@ describe("DrawingViewer", () => {
|
||||
const othersDrawing = create(AttachmentSchema, { ...drawing, creator: "users/other" });
|
||||
const copy = create(AttachmentSchema, { name: "attachments/d2", filename: "drawing-2.canvas.png", type: "image/png" });
|
||||
handle.exportPng.mockResolvedValue(new Blob([await withScene()], { type: "image/png" }));
|
||||
mocks.getMemo.mockResolvedValue(create(MemoSchema, { ...memo, attachments: [othersDrawing] }));
|
||||
mocks.uploadFile.mockResolvedValue(copy);
|
||||
mocks.updateMemo.mockRejectedValueOnce(new Error("offline"));
|
||||
render(
|
||||
@@ -176,7 +247,7 @@ describe("DrawingViewer", () => {
|
||||
);
|
||||
|
||||
await startEditing();
|
||||
const done = await screen.findByRole("button", { name: "editor.drawing.done" });
|
||||
const done = await screen.findByRole("button", { name: "editor.drawing.save-copy" });
|
||||
fireEvent.click(done);
|
||||
await waitFor(() => expect(mocks.updateMemo).toHaveBeenCalledTimes(1));
|
||||
expect(mocks.uploadFile.mock.calls[0][0].replaces).toBeUndefined();
|
||||
@@ -188,12 +259,71 @@ describe("DrawingViewer", () => {
|
||||
[copy.name, copy.filename],
|
||||
]);
|
||||
|
||||
// The memo update failed: the sheet stays open, and Done again replaces the copy it uploaded.
|
||||
// A failed bind keeps the sheet open; retry binds the existing upload.
|
||||
await waitFor(() => expect(done).toBeEnabled());
|
||||
fireEvent.click(done);
|
||||
await waitFor(() => expect(mocks.updateMemo).toHaveBeenCalledTimes(2));
|
||||
expect(mocks.uploadFile.mock.calls[1][0].replaces).toBe(copy.name);
|
||||
await waitFor(() => expect(screen.getByRole("button", { name: "editor.drawing.zoom-to-fit" })).toBeInTheDocument());
|
||||
expect(mocks.uploadFile).toHaveBeenCalledTimes(1);
|
||||
await waitFor(() => expect(screen.getByRole("button", { name: "common.edit" })).toBeInTheDocument());
|
||||
});
|
||||
it("retries only the timestamp after an acknowledged replacement", async () => {
|
||||
handle.exportPng.mockResolvedValue(new Blob([await withScene()], { type: "image/png" }));
|
||||
mocks.uploadFile.mockResolvedValue(drawing);
|
||||
mocks.updateMemo.mockRejectedValueOnce(new Error("timestamp offline"));
|
||||
render(<DrawingViewer attachment={drawing} memo={memo} canEdit onClose={vi.fn()} onNoScene={vi.fn()} />);
|
||||
await startEditing();
|
||||
const save = screen.getByRole("button", { name: "common.save" });
|
||||
fireEvent.click(save);
|
||||
await waitFor(() => expect(mocks.updateMemo).toHaveBeenCalledOnce());
|
||||
await waitFor(() => expect(save).toBeEnabled());
|
||||
expect(handle.markSaved).not.toHaveBeenCalled();
|
||||
expect(screen.getByRole("button", { name: "editor.drawing.saved-needs-update" })).not.toHaveTextContent(
|
||||
"editor.drawing.saved-needs-update",
|
||||
);
|
||||
fireEvent.click(save);
|
||||
await waitFor(() => expect(mocks.updateMemo).toHaveBeenCalledTimes(2));
|
||||
expect(mocks.uploadFile).toHaveBeenCalledOnce();
|
||||
});
|
||||
|
||||
it("annotates a plain image as a copy and binds against current membership", async () => {
|
||||
const source = create(AttachmentSchema, { ...drawing, name: "attachments/photo", filename: "photo.png" });
|
||||
const concurrent = create(AttachmentSchema, { name: "attachments/concurrent", filename: "elsewhere.txt" });
|
||||
const copy = create(AttachmentSchema, { ...drawing, name: "attachments/annotation" });
|
||||
mocks.getMemo.mockResolvedValue(create(MemoSchema, { ...memo, attachments: [source, concurrent] }));
|
||||
mocks.uploadFile.mockResolvedValue(copy);
|
||||
handle.insertImage.mockResolvedValue("background");
|
||||
handle.exportPng.mockResolvedValue(new Blob([await withScene()], { type: "image/png" }));
|
||||
vi.stubGlobal(
|
||||
"fetch",
|
||||
vi.fn(
|
||||
async () =>
|
||||
new Response(
|
||||
Uint8Array.from(atob("iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQIHWP4z8DwHwAFgAI/ScLbtAAAAABJRU5ErkJggg=="), (c) =>
|
||||
c.charCodeAt(0),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
render(
|
||||
<DrawingViewer
|
||||
attachment={source}
|
||||
memo={create(MemoSchema, { ...memo, attachments: [source] })}
|
||||
canEdit
|
||||
annotate
|
||||
onClose={vi.fn()}
|
||||
onNoScene={vi.fn()}
|
||||
/>,
|
||||
);
|
||||
const save = await screen.findByRole("button", { name: "editor.drawing.save-copy" });
|
||||
await waitFor(() => expect(save).toBeEnabled());
|
||||
fireEvent.click(save);
|
||||
await waitFor(() => expect(mocks.updateMemo).toHaveBeenCalledOnce());
|
||||
expect(mocks.uploadFile.mock.calls[0][0].replaces).toBeUndefined();
|
||||
expect(mocks.updateMemo.mock.calls[0][0].update.attachments.map((item: { name: string }) => item.name)).toEqual([
|
||||
source.name,
|
||||
copy.name,
|
||||
concurrent.name,
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
+14
-10
@@ -143,7 +143,7 @@ describe("drawing attachments", () => {
|
||||
expect(isDrawingFilename("photo.png")).toBe(false);
|
||||
});
|
||||
|
||||
it("offers Edit drawing only on drawings this server stores", () => {
|
||||
it("offers Edit markup only on drawings this server stores", () => {
|
||||
const onEditDrawing = vi.fn();
|
||||
const photo = create(AttachmentSchema, { name: "attachments/photo", filename: "photo.png", type: "image/png" });
|
||||
const linked = create(AttachmentSchema, {
|
||||
@@ -155,7 +155,11 @@ describe("drawing attachments", () => {
|
||||
const local = toLocalFile(new File([fixturePng], "drawing-20261106-120000.canvas.png", { type: "image/png" }));
|
||||
render(<AttachmentListEditor attachments={[drawingAttachment, photo, linked]} localFiles={[local]} onEditDrawing={onEditDrawing} />);
|
||||
|
||||
const actions = screen.getAllByRole("button", { name: "Edit drawing" });
|
||||
const markup = screen.getByRole("button", { name: "Markup" });
|
||||
expect(markup.querySelector("svg")).toHaveClass("lucide-palette");
|
||||
fireEvent.click(markup);
|
||||
expect(onEditDrawing).toHaveBeenLastCalledWith({ kind: "attachment", attachment: photo });
|
||||
const actions = screen.getAllByRole("button", { name: "Edit markup" });
|
||||
expect(actions).toHaveLength(2);
|
||||
fireEvent.click(actions[0]);
|
||||
expect(onEditDrawing).toHaveBeenLastCalledWith({ kind: "attachment", attachment: drawingAttachment });
|
||||
@@ -163,14 +167,14 @@ describe("drawing attachments", () => {
|
||||
expect(onEditDrawing).toHaveBeenLastCalledWith({ kind: "local", localFile: local });
|
||||
});
|
||||
|
||||
it("keeps only the glyph of Edit drawing on narrow rows", () => {
|
||||
it("keeps only the glyph of Edit markup on narrow rows", () => {
|
||||
const wide = window.matchMedia;
|
||||
window.matchMedia = (() => ({ matches: false, addEventListener: () => undefined, removeEventListener: () => undefined })) as never;
|
||||
try {
|
||||
const onEditDrawing = vi.fn();
|
||||
render(<AttachmentListEditor attachments={[drawingAttachment]} onEditDrawing={onEditDrawing} />);
|
||||
const action = screen.getByRole("button", { name: "Edit drawing" });
|
||||
expect(action).not.toHaveTextContent("Edit drawing");
|
||||
const action = screen.getByRole("button", { name: "Edit markup" });
|
||||
expect(action).not.toHaveTextContent("Edit markup");
|
||||
fireEvent.click(action);
|
||||
expect(onEditDrawing).toHaveBeenCalledWith({ kind: "attachment", attachment: drawingAttachment });
|
||||
} finally {
|
||||
@@ -178,7 +182,7 @@ describe("drawing attachments", () => {
|
||||
}
|
||||
});
|
||||
|
||||
it("Edit drawing downloads the original file, not the thumbnail", async () => {
|
||||
it("Edit markup downloads the original file, not the thumbnail", async () => {
|
||||
const fetchMock = vi.fn(async () => new Response(fixturePng));
|
||||
vi.stubGlobal("fetch", fetchMock);
|
||||
const { result } = renderDrawing();
|
||||
@@ -214,7 +218,7 @@ describe("drawing attachments", () => {
|
||||
expect(reopened?.elements).toEqual(scene.elements.map((element) => expect.objectContaining(element)));
|
||||
|
||||
const edited = new File([exported], "drawing-20261106-130000.canvas.png", { type: "image/png" });
|
||||
act(() => result.current.drawing.done(edited));
|
||||
await act(() => result.current.drawing.done(edited));
|
||||
|
||||
// The saved drawing keeps its place; the edit waits to upload over it on save.
|
||||
const state = result.current.editor.getState();
|
||||
@@ -226,7 +230,7 @@ describe("drawing attachments", () => {
|
||||
|
||||
// Editing the pending edit again keeps it a replacement of the same attachment.
|
||||
await act(() => result.current.drawing.openExisting({ kind: "local", localFile: state.localFiles[0] }));
|
||||
act(() => result.current.drawing.done(new File([exported], "drawing-20261106-140000.canvas.png", { type: "image/png" })));
|
||||
await act(() => result.current.drawing.done(new File([exported], "drawing-20261106-140000.canvas.png", { type: "image/png" })));
|
||||
expect(result.current.editor.getState().localFiles.map((item) => [item.file.name, item.replaces])).toEqual([
|
||||
["drawing-20261106-140000.canvas.png", drawingAttachment.name],
|
||||
]);
|
||||
@@ -306,7 +310,7 @@ describe("drawing attachments", () => {
|
||||
act(() => result.current.editor.dispatch(result.current.editor.actions.setMetadata({ attachments: [drawingAttachment] })));
|
||||
|
||||
await act(() => result.current.drawing.openExisting({ kind: "attachment", attachment: drawingAttachment }));
|
||||
act(() => result.current.drawing.done(new File([fixturePng], "drawing-2.canvas.png", { type: "image/png" })));
|
||||
await act(() => result.current.drawing.done(new File([fixturePng], "drawing-2.canvas.png", { type: "image/png" })));
|
||||
|
||||
// Only its uploader or an admin may remove it from the memo.
|
||||
const state = result.current.editor.getState();
|
||||
@@ -321,7 +325,7 @@ describe("drawing attachments", () => {
|
||||
act(() => result.current.editor.dispatch(result.current.editor.actions.setLocalFiles([first, plain])));
|
||||
|
||||
await act(() => result.current.drawing.openExisting({ kind: "local", localFile: first }));
|
||||
act(() => result.current.drawing.done(new File([fixturePng], "drawing-3.canvas.png", { type: "image/png" })));
|
||||
await act(() => result.current.drawing.done(new File([fixturePng], "drawing-3.canvas.png", { type: "image/png" })));
|
||||
expect(result.current.editor.getState().localFiles.map((item) => item.file.name)).toEqual([
|
||||
"drawing-3.canvas.png",
|
||||
"drawing-2.canvas.png",
|
||||
|
||||
@@ -4,7 +4,7 @@ import { act, renderHook } from "@testing-library/react";
|
||||
import type { PropsWithChildren } from "react";
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { useMemoSave } from "@/components/MemoEditor/edit/hooks/useMemoSave";
|
||||
import { DrawingNotSavedError, memoService } from "@/components/MemoEditor/edit/services/memoService";
|
||||
import { DrawingNotSavedError, DrawingSavedError, memoService } from "@/components/MemoEditor/edit/services/memoService";
|
||||
import type { EditorState } from "@/components/MemoEditor/edit/state";
|
||||
import { createInitialState } from "@/components/MemoEditor/edit/state/types";
|
||||
import type { LocalFile } from "@/components/MemoEditor/edit/types/attachment";
|
||||
@@ -40,13 +40,20 @@ vi.mock("@/components/MemoEditor/edit/state", () => ({
|
||||
setLocalFiles: (localFiles: LocalFile[]) => ({ type: "set-local-files", localFiles }),
|
||||
setAttachmentOrder: (attachmentOrder: string[]) => ({ type: "set-attachment-order", attachmentOrder }),
|
||||
setTimestamps: () => ({ type: "noop" }),
|
||||
setDrawingMemoUpdate: (drawingNeedsMemoUpdate: boolean) => ({ type: "set-drawing-memo-update", drawingNeedsMemoUpdate }),
|
||||
setDrawingSaveError: (drawingSaveError: EditorState["drawingSaveError"]) => ({ type: "set-drawing-save-error", drawingSaveError }),
|
||||
},
|
||||
dispatch: (action: {
|
||||
type: string;
|
||||
metadata?: Partial<EditorState["metadata"]>;
|
||||
localFiles?: LocalFile[];
|
||||
attachmentOrder?: string[];
|
||||
drawingNeedsMemoUpdate?: boolean;
|
||||
drawingSaveError?: EditorState["drawingSaveError"];
|
||||
}) => {
|
||||
if (action.type === "set-drawing-memo-update")
|
||||
mocks.state = { ...mocks.state, drawingNeedsMemoUpdate: action.drawingNeedsMemoUpdate };
|
||||
if (action.type === "set-drawing-save-error") mocks.state = { ...mocks.state, drawingSaveError: action.drawingSaveError };
|
||||
if (action.type === "set-attachment-order") mocks.state = { ...mocks.state, attachmentOrder: action.attachmentOrder ?? [] };
|
||||
if (action.type === "set-metadata") mocks.state = { ...mocks.state, metadata: { ...mocks.state.metadata, ...action.metadata } };
|
||||
if (action.type === "set-local-files") mocks.state = { ...mocks.state, localFiles: action.localFiles ?? [] };
|
||||
@@ -136,6 +143,33 @@ describe("useMemoSave after a failed save", () => {
|
||||
expect(mocks.state.metadata.attachments).toEqual([]);
|
||||
});
|
||||
|
||||
it("retains an acknowledged drawing and retries the pending memo update without uploading again", async () => {
|
||||
const edit: LocalFile = { ...localFile("drawing.canvas.png"), replaces: "attachments/drawing" };
|
||||
const attachment = create(AttachmentSchema, { name: edit.replaces, filename: edit.file.name });
|
||||
mocks.state = editorState([edit], [attachment]);
|
||||
mocks.save
|
||||
.mockImplementationOnce(
|
||||
async (_state: EditorState, options: { onFileUploaded: (file: LocalFile, attachment: Attachment) => void }) => {
|
||||
options.onFileUploaded(edit, attachment);
|
||||
throw new DrawingSavedError(new Error("offline"));
|
||||
},
|
||||
)
|
||||
.mockRejectedValueOnce(new Error("still offline"));
|
||||
const client = new QueryClient({ defaultOptions: { queries: { retry: false } } });
|
||||
const wrapper = ({ children }: PropsWithChildren) => <QueryClientProvider client={client}>{children}</QueryClientProvider>;
|
||||
const { result } = renderHook(() => useMemoSave({ memoName: "memos/m", discardDraft: vi.fn() }), { wrapper });
|
||||
await act(async () => result.current());
|
||||
expect(mocks.state.localFiles).toEqual([]);
|
||||
expect(mocks.state.drawingNeedsMemoUpdate).toBe(true);
|
||||
expect(mocks.state.drawingSaveError).toBe("editor.drawing.saved-needs-update");
|
||||
expect(showErrorToast).toHaveBeenCalledWith("editor.drawing.saved-needs-update");
|
||||
await act(async () => result.current());
|
||||
const retried = mocks.save.mock.calls[1][0] as EditorState;
|
||||
expect(retried.localFiles).toEqual([]);
|
||||
expect(retried.metadata.attachments).toEqual([attachment]);
|
||||
expect(retried.drawingNeedsMemoUpdate).toBe(true);
|
||||
});
|
||||
|
||||
it("says the memo is saved when only an edited drawing failed, and keeps the edit for a retry", async () => {
|
||||
const edit: LocalFile = { ...localFile("drawing.canvas.png"), replaces: "attachments/drawing" };
|
||||
mocks.state = editorState([edit]);
|
||||
|
||||
@@ -80,6 +80,34 @@ const mockImageCenter = (image: HTMLElement, x: number, y: number) => {
|
||||
} as DOMRect);
|
||||
};
|
||||
|
||||
describe("Markup entry", () => {
|
||||
it.each([
|
||||
{ canEdit: true, external: false, visible: true },
|
||||
{ canEdit: false, external: false, visible: false },
|
||||
{ canEdit: true, external: true, visible: false },
|
||||
])("limits annotation to editable instance images: $canEdit/$external", ({ canEdit, external, visible }) => {
|
||||
const attachment = create(AttachmentSchema, {
|
||||
name: "attachments/source",
|
||||
filename: "source.png",
|
||||
type: "image/png",
|
||||
externalLink: external ? "https://example.com/photo.png" : "",
|
||||
});
|
||||
render(
|
||||
<PreviewImageDialog
|
||||
open
|
||||
onOpenChange={vi.fn()}
|
||||
items={[{ id: attachment.name, kind: "image", sourceUrl: "/source.png", filename: attachment.filename }]}
|
||||
drawingContext={{ memo: { name: "memos/a", attachments: [attachment] }, canEdit }}
|
||||
/>,
|
||||
);
|
||||
const action = screen.queryByRole("button", { name: "Markup" });
|
||||
if (visible) {
|
||||
expect(action).toHaveTextContent("Markup");
|
||||
expect(action?.querySelector("svg")).toHaveClass("lucide-palette");
|
||||
} else expect(action).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
describe("<PreviewImageDialog>", () => {
|
||||
beforeEach(() => {
|
||||
// jsdom ships PointerEvent but not pointer capture: stub the capture methods.
|
||||
|
||||
Reference in New Issue
Block a user