Sync snapshot (2026-09-09) (#271)
- **New app: GenOffice HTML.** Open, edit and generate .html pages: a source pane with a sandboxed live preview, click-to-select elements with a floating toolbar and style panel, device-size preview, image tools and a present mode. AI generates whole pages from a brief with style directions and offers page-wide Restyle, Theme and Summarize. Export to Word runs locally through the built-in html2docx converter (native, editable OOXML; no print-to-PDF detour). - **AI:** separate BYOK providers for web search, image generation and image/video analysis; new Codex App Server provider; Ask AI quotes the selected text and keeps it highlighted while it runs; custom AI panel text size; blocked requests retry through the Chromium network stack. - **App:** global AutoSave setting shared by every editor; AI panel text size and chat spellcheck toggles (genoffice#249); Czech (cs) UI locale (genoffice#259); Save As defaults to the document's folder; PDF export no longer aborts on CJK file paths on Windows. - **Docs:** Export as HTML; comments and replies edit in place from the comments pane; the caret can leave a trailing table (genoffice#266); spellcheck re-marks text as soon as it is re-enabled; AI edits are character-precise on partial selections; zoom keeps the scroll position; pasting a cell from Sheets takes the destination font. - **Sheets:** Find no longer freezes on wide or streamed grids; Replace searches as you type; cached values of external-workbook formulas are kept instead of #ERROR! (genoffice#235); "number stored as text" is a warning, not an error (genoffice#236); paste repeats into the target range like Excel; filter criteria survive save/reopen; saves retry when Windows locks the file; many Excel-fidelity fixes for column widths, row heights, charts, slicers, number formats and CJK fonts. - **Slides:** PDF export works for large presentations (genoffice#264); EMF/WMF picture fonts and East Asian theme fonts resolve correctly; decks with missing layouts or embedded styles still open; outline-only pie slices render. - **PDF:** highlight and underline geometry aligns with the text; Shift+arrows extend the selection instead of paging. - **Markdown:** Find and replace (Ctrl+F / Ctrl+H) (genoffice#253); mermaid code blocks render as diagrams (genoffice#263); better print quality. - Thanks to community contributors @GoodScholar, @aniruddhaadak80 and @Sun8854, and to @hanyscz, @qgzln, @zyp997, @bisslot, @krakotay and @Ben03151 for the reports. Co-authored-by: GenOffice <merrick-2002@users.noreply.github.com>
This commit is contained in:
co-authored by
GenOffice
parent
fa58fff047
commit
d24c964a3e
@@ -82,6 +82,22 @@ jobs:
|
||||
fi
|
||||
npm run check:theme-colors
|
||||
|
||||
# Added lines only: Han text outside locale tables, review-tool tags,
|
||||
# feedback-ledger ids, sample-corpus ids, internal PR numbers, personal
|
||||
# paths/e-mails, credentials, NUL bytes (tools/check-public-hygiene.mjs).
|
||||
- name: Check public-repo hygiene
|
||||
env:
|
||||
FORMAT_BASE_REF: ${{ github.event.pull_request.base.sha || github.event.before }}
|
||||
run: |
|
||||
if [ "${{ github.event_name }}" = "pull_request" ]; then
|
||||
FORMAT_BASE_REF=$(git rev-parse HEAD^1)
|
||||
fi
|
||||
if [ -f tools/check-public-hygiene.mjs ]; then
|
||||
node tools/check-public-hygiene.mjs
|
||||
else
|
||||
echo "public-hygiene gate not present in this checkout; skipped"
|
||||
fi
|
||||
|
||||
# Keep tracked code comments and contributor-facing documentation
|
||||
# English-only; functional CJK strings and AI prompt examples are allowed.
|
||||
- name: Check comments/docs are English-only
|
||||
|
||||
@@ -16,3 +16,9 @@ scripts/drivers/driver.*.mjs
|
||||
|
||||
# Vendored third-party sources stay byte-identical to upstream.
|
||||
packages/*/src/vendor/
|
||||
|
||||
# LLM prompt text: prettier rewrites *_* markers and list indentation, changing what the model reads.
|
||||
apps/slides/src/renderer/ai/prompts/*.md
|
||||
|
||||
# In-page extractor fragments: concatenated into one function body, kept verbatim.
|
||||
packages/html2docx/src/browser/
|
||||
|
||||
@@ -12,9 +12,9 @@ GenOffice is a free, open-source alternative to Microsoft Office for macOS,
|
||||
Windows, and Linux, built around AI editing as a first-class workflow rather
|
||||
than a bolted-on chat box. It opens and saves the real Microsoft Office
|
||||
formats — Word (`.docx`), Excel (`.xlsx`), PowerPoint (`.pptx`) — and edits
|
||||
PDF and Markdown too: a word processor, spreadsheet, presentation editor,
|
||||
PDF editor, and Markdown editor as six Electron apps sharing one engine
|
||||
layer.
|
||||
PDF, Markdown, and HTML too: a word processor, spreadsheet, presentation
|
||||
editor, PDF editor, Markdown editor, and a design-first AI HTML page builder
|
||||
as seven Electron apps sharing one engine layer.
|
||||
|
||||
[](https://www.youtube.com/watch?v=B2pLdMX95v4)
|
||||
|
||||
@@ -30,8 +30,11 @@ layer.
|
||||
- **Excel-compatible spreadsheets** — in-house engine with a Rust `.xlsx` sidecar, own charts, pivot tables, slicers.
|
||||
- **PowerPoint-compatible presentations** — in-house `.pptx` engine with masters, layouts, smart guides, non-destructive crop.
|
||||
- **Markdown to Word, fully local** — the same OOXML engine, no Pandoc, no cloud.
|
||||
- **HTML to Word, fully local** — Export as Word renders the page in the built-in Chromium, reduces it to a document intent tree (headings, paragraphs, lists, tables, cards, KPI rows, form fields, page backgrounds) and writes native, editable OOXML; only visuals with no Word counterpart (charts, icons, decorated boxes) become pictures. No print-to-PDF detour, no cloud.
|
||||
- **AI-designed HTML pages** — generate landing pages, reports, and posters as single self-contained HTML files, design-first; a _Write content_ mode for plain articles.
|
||||
- **AI that edits documents** — block-level edits with snapshots and diffs, document-aware agents.
|
||||
- **Bring your own key (BYOK)** — run the AI on your own API key: Claude, OpenAI, Gemini, DeepSeek, Kimi, GLM, Qwen, Doubao, MiniMax, Grok, Mistral, OpenRouter, OpenCode Zen/Go, or any OpenAI-compatible endpoint — or sign in with Genspark and skip keys entirely.
|
||||
- **BYOK for search and media too** — web search on your own Serper or Tavily key; image generation, image analysis, and video analysis each on the provider you choose (OpenAI, Gemini, Doubao/Seedream, GLM, Grok, Qwen, MiniMax, or any OpenAI-compatible images endpoint), configured per capability in _AI Media & Search_.
|
||||
- **Agent tools built in** — web/image search, image generation, media analysis.
|
||||
- **Light / dark / system themes.**
|
||||
- **macOS, Windows, Linux.**
|
||||
@@ -43,7 +46,7 @@ layer.
|
||||
| ------------------------------------ | ----------------------------------------------------- | ----------------------------------------------------------------------------------------- |
|
||||
| **macOS** — Apple Silicon (arm64) | macOS 11+ | [Latest `.dmg` (arm64)](https://github.com/genspark-ai/genoffice/releases/latest) |
|
||||
| **macOS** — Intel (x64) | macOS 11+ | [Latest `.dmg` (x64)](https://github.com/genspark-ai/genoffice/releases/latest) |
|
||||
| **Windows** (x64) | Windows 10+ | [Latest `.exe` installer](https://github.com/genspark-ai/genoffice/releases/latest) |
|
||||
| **Windows** (x64, most PCs) | Windows 10+, Intel/AMD | [Latest `-x64.exe` installer](https://github.com/genspark-ai/genoffice/releases/latest) |
|
||||
| **Windows** on Arm (ARM64) | Windows 11 on Arm (Snapdragon X and similar) | [Latest `-arm64.exe` installer](https://github.com/genspark-ai/genoffice/releases/latest) |
|
||||
| **Linux** — Debian / Ubuntu | x86_64, glibc 2.34+ (Ubuntu 22.04 or newer) | [Latest `.deb`](https://github.com/genspark-ai/genoffice/releases/latest) |
|
||||
| **Linux** — Fedora / RHEL / openSUSE | x86_64, glibc 2.34+ (Fedora 35+, RHEL 9+, Leap 15.6+) | [Latest `.rpm`](https://github.com/genspark-ai/genoffice/releases/latest) |
|
||||
@@ -79,14 +82,15 @@ chmod +x GenOffice-<version>.AppImage
|
||||
|
||||
## Apps
|
||||
|
||||
| App | Product | What it is |
|
||||
| --------------- | ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `apps/docs` | **GenOffice Docs** | `.docx` word processor. Byte-preserving round trip: only dirty paragraphs are regenerated (paragraph patch), everything else in the original file is kept byte-for-byte, so opening and saving never breaks layout in Word. Paginated view whose line metrics reproduce the original document's layout, tracked changes, comments, styles, equations, ink. |
|
||||
| `apps/sheets` | **GenOffice Sheets** | `.xlsx` spreadsheet. UI built on the open-source [Univer](https://github.com/dream-num/univer) core (Apache-2.0) with a large layer of in-house extensions; `.xlsx` import/export runs through an in-house Rust sidecar (calamine + IronCalc), charts are rendered in-house (Konva), plus pivot tables, slicers, conditional formatting, and formula tracing. |
|
||||
| `apps/slides` | **GenOffice Slides** | `.pptx` presentations. In-house `.pptx` parse/render/edit engine with masters, charts, cropping, ink, and text shaping (HarfBuzz metrics). |
|
||||
| `apps/pdf` | **GenOffice PDF** | `.pdf` viewer/editor on [pdf.js](https://github.com/mozilla/pdf.js) (Apache-2.0) + [pdf-lib](https://github.com/Hopding/pdf-lib) (MIT): annotations, forms, outlines, stamps, signatures, page operations, and printing support. True text editing — paragraph selection with in-block reflow, alignment restoration, original-font preservation — and content-stream image insert/edit, all rewriting page content streams through [PDFium](https://pdfium.googlesource.com/pdfium/) wasm (BSD-3-Clause) with subset-embedded fonts — no cover-up annotations. Converts PDFs into editable Word, PowerPoint, and Excel files fully locally (`packages/pdf2docx`), with OCR support for scanned pages (system OCR on macOS and Windows). |
|
||||
| `apps/markdown` | **GenOffice Markdown** | `.md` / `.markdown` editor: Tiptap block editor over plain Markdown files — headings, lists, tables, images, code blocks — saved back as plain Markdown, hosted in shell tabs. |
|
||||
| `apps/shell` | **GenOffice** | The suite shell: home screen, tabbed hosting of the five editors, light/dark/system theme, auto-update. |
|
||||
| App | Product | What it is |
|
||||
| --------------- | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `apps/docs` | **GenOffice Docs** | `.docx` word processor. Byte-preserving round trip: only dirty paragraphs are regenerated (paragraph patch), everything else in the original file is kept byte-for-byte, so opening and saving never breaks layout in Word. Paginated view whose line metrics reproduce the original document's layout, tracked changes, comments, styles, equations, ink. |
|
||||
| `apps/sheets` | **GenOffice Sheets** | `.xlsx` spreadsheet. UI built on the open-source [Univer](https://github.com/dream-num/univer) core (Apache-2.0) with a large layer of in-house extensions; `.xlsx` import/export runs through an in-house Rust sidecar (calamine + IronCalc), charts are rendered in-house (Konva), plus pivot tables, slicers, conditional formatting, and formula tracing. |
|
||||
| `apps/slides` | **GenOffice Slides** | `.pptx` presentations. In-house `.pptx` parse/render/edit engine with masters, charts, cropping, ink, and text shaping (HarfBuzz metrics). |
|
||||
| `apps/pdf` | **GenOffice PDF** | `.pdf` viewer/editor on [pdf.js](https://github.com/mozilla/pdf.js) (Apache-2.0) + [pdf-lib](https://github.com/Hopding/pdf-lib) (MIT): annotations, forms, outlines, stamps, signatures, page operations, and printing support. True text editing — paragraph selection with in-block reflow, alignment restoration, original-font preservation — and content-stream image insert/edit, all rewriting page content streams through [PDFium](https://pdfium.googlesource.com/pdfium/) wasm (BSD-3-Clause) with subset-embedded fonts — no cover-up annotations. Converts PDFs into editable Word, PowerPoint, and Excel files fully locally (`packages/pdf2docx`), with OCR support for scanned pages (system OCR on macOS and Windows). |
|
||||
| `apps/html` | **GenOffice HTML** | Single-file `.html` page builder, design-first. A blank page starts from two intents: _Design a page_ (the AI proposes a design brief — hook, palette, typography, section layouts — with alternative style directions to pick from, then writes the page against `--brief-*` design tokens) or _Write content_ (an article, announcement, or guide written straight into a clean page). Live sandboxed preview with an inspector: click to select an element, double-click to edit text, a floating toolbar and style panel for typography, box, color, and image edits, and element-scoped Ask AI; CodeMirror source view kept in sync; desktop / tablet / phone widths; Present in the tab, fullscreen, or a new tab; export to PDF, and to Word as a native editable `.docx` built on-device by `packages/html2docx`. |
|
||||
| `apps/markdown` | **GenOffice Markdown** | `.md` / `.markdown` editor: Tiptap block editor over plain Markdown files — headings, lists, tables, images, code blocks — saved back as plain Markdown, hosted in shell tabs. |
|
||||
| `apps/shell` | **GenOffice** | The suite shell: home screen, tabbed hosting of the six editors, light/dark/system theme, auto-update. |
|
||||
|
||||
Every app embeds the same AI panel: block-granular AI editing with version
|
||||
snapshots and diffs in docs, a tool-calling agent over workbook/slide/PDF
|
||||
@@ -107,7 +111,11 @@ GPT, and Gemini families). Or bring your own key (BYOK) in the AI settings:
|
||||
Claude, OpenAI, Gemini, DeepSeek, Kimi, GLM, Qwen, Doubao, MiniMax, Grok,
|
||||
Mistral, OpenRouter, and OpenCode Zen/Go are built in, plus a custom provider
|
||||
slot for any OpenAI-compatible endpoint (base URL + key), local servers
|
||||
included. A
|
||||
included. Image generation and image/video analysis have their own provider
|
||||
catalog (AI Media & Search settings): OpenAI, Gemini, Doubao/Seedream, GLM
|
||||
CogView, Grok Imagine, Qwen-Image, MiniMax or any OpenAI-compatible images
|
||||
endpoint, each with its own key and assignable per capability; web search can
|
||||
likewise run on your own Serper or Tavily key. A
|
||||
Genspark account also unlocks the Genspark ("gsk") tool endpoints the agents
|
||||
build on — web and image search, image generation and editing,
|
||||
image/audio/video analysis, and audio transcription — all reachable through
|
||||
@@ -124,6 +132,10 @@ All pure TypeScript, no Electron dependency, unit-tested (except the UI kit):
|
||||
- `packages/pdf2docx` — local PDF → DOCX conversion: PDFium character-level
|
||||
extraction, pure-geometry layout analysis, rebuild through `docx-engine`;
|
||||
the same analysis drives the PDF app's PowerPoint and Excel exports.
|
||||
- `packages/html2docx` — local HTML → DOCX conversion: the page is rendered in
|
||||
the app's own Chromium, reduced in-browser to a document intent tree, and
|
||||
written as native OOXML with the `docx` library; only visuals with no Word
|
||||
counterpart are screenshotted. Drives the HTML app's Export as Word.
|
||||
- `packages/file-parse` — text extraction for AI attachments (office formats,
|
||||
text formats).
|
||||
- `packages/agent-core` — the AI agent loop and skill composition shared by
|
||||
@@ -142,7 +154,7 @@ npm install
|
||||
npm run fixtures # generate test .docx fixtures
|
||||
npm test # engine + app unit tests (docs/sheets/slides need no display)
|
||||
npm run typecheck # tsc --noEmit across every workspace
|
||||
npm run dev # all five editors + shell against Vite dev servers
|
||||
npm run dev # all six editors + shell against Vite dev servers
|
||||
npm run dev:docs # a single app (same pattern works per workspace)
|
||||
npm run dist:mac # package macOS dmg (regenerates third-party notices)
|
||||
npm run dist:win # package Windows nsis installer
|
||||
@@ -203,6 +215,28 @@ key (BYOK) for Claude, OpenAI, Gemini, DeepSeek, Kimi, GLM, Qwen, Doubao,
|
||||
MiniMax, Grok, Mistral, OpenRouter, and OpenCode Zen/Go, plus any
|
||||
OpenAI-compatible endpoint — including local model servers.
|
||||
|
||||
**Can I bring my own keys for search, image generation, and media analysis?**
|
||||
Yes. Settings → AI Media & Search takes separate keys per capability: web
|
||||
search on Serper or Tavily, and image generation, image analysis, and video
|
||||
analysis each on OpenAI, Gemini, Doubao/Seedream, GLM, Grok, Qwen, MiniMax, or
|
||||
any OpenAI-compatible images endpoint. Anything left on Genspark keeps using
|
||||
your Genspark sign-in.
|
||||
|
||||
**Can GenOffice design web pages?**
|
||||
Yes. GenOffice HTML is a design-first page builder: describe a landing page,
|
||||
report, or poster, pick a style direction from the proposed design brief, and
|
||||
the AI lays out a single self-contained `.html` file you then refine visually
|
||||
— select an element to restyle it or ask AI about it. Pages present
|
||||
fullscreen and export to PDF and Word.
|
||||
|
||||
**Can GenOffice convert HTML to Word?**
|
||||
Yes — Export as Word in the HTML app produces a native, editable `.docx`
|
||||
entirely on-device. The page is rendered in the built-in Chromium and reduced
|
||||
to real Word structures: headings, paragraphs, lists, tables, cards, KPI rows,
|
||||
form fields, and page backgrounds; only visuals with no Word counterpart
|
||||
(charts, icons, decorated boxes) are embedded as pictures. Nothing is printed
|
||||
to PDF first and nothing is uploaded.
|
||||
|
||||
**Does GenOffice collect any data?**
|
||||
Official packaged builds send limited usage analytics by default, and you can
|
||||
disable reporting at any time under Settings → General. Analytics never sends
|
||||
@@ -230,6 +264,7 @@ GenOffice would not be possible without these open-source projects:
|
||||
document assembly.
|
||||
- [Tiptap](https://tiptap.dev/) / [ProseMirror](https://prosemirror.net/) —
|
||||
the block editors in Docs and Markdown.
|
||||
- [CodeMirror](https://codemirror.net/) (MIT) — the source editor in HTML.
|
||||
- [Konva](https://konvajs.org/) — canvas rendering for Slides and Sheets
|
||||
charts.
|
||||
- [HarfBuzz](https://github.com/harfbuzz/harfbuzz) (wasm) — text-shaping
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
"react-dom": "^19.2.4",
|
||||
"typescript": "^5.9.3",
|
||||
"vite": "^7.3.1",
|
||||
"vitest": "^4.1.0"
|
||||
"vitest": "^4.1.11"
|
||||
},
|
||||
"author": "GenOffice",
|
||||
"build": {
|
||||
|
||||
+232
-38
@@ -32,6 +32,7 @@ import {
|
||||
installNavigationGuard,
|
||||
printHtmlToPdf,
|
||||
safeExternalUrl,
|
||||
saveAsSuggestion,
|
||||
showOpenDialogWithMemory,
|
||||
showSaveDialogWithMemory,
|
||||
toggleDevToolsItem,
|
||||
@@ -56,7 +57,10 @@ import {
|
||||
chatForProvider,
|
||||
defaultAiSettings,
|
||||
activeProvider,
|
||||
cloudToolsEnabled,
|
||||
testMediaProvider,
|
||||
type AiMediaProviderConfig,
|
||||
type AiMediaProviderId,
|
||||
type AiSearchProviderId,
|
||||
resolveAiSettings,
|
||||
maxOutputTokensOf,
|
||||
setAiUserAgent,
|
||||
@@ -73,11 +77,12 @@ import { listCodexModels, shutdownCodexAppServers } from '@genoffice/ai-provider
|
||||
import {
|
||||
ensureGenofficeLogin,
|
||||
gskApiKey,
|
||||
gskGenerateImage,
|
||||
generateImageTool,
|
||||
testSearchProvider,
|
||||
gskLoginInfo,
|
||||
hasGskAuth,
|
||||
webSearch,
|
||||
imageSearch,
|
||||
webSearchTool,
|
||||
imageSearchTool,
|
||||
} from '@genoffice/ai-search'
|
||||
import type {
|
||||
AiDocContent,
|
||||
@@ -150,6 +155,7 @@ const tMain = createI18n({
|
||||
filterSupported: '支持的文件',
|
||||
filterAll: '所有文件',
|
||||
dlgExportPdf: '导出为 PDF',
|
||||
dlgExportHtml: '导出为 HTML',
|
||||
errUnsupportedExt: '暂不支持 .{ext} 类型',
|
||||
errNotFile: '不是文件',
|
||||
errTooLarge: '超过 {mb}MB 上限',
|
||||
@@ -174,6 +180,7 @@ const tMain = createI18n({
|
||||
menuSaveAs: '另存为…',
|
||||
menuPageSetup: '页面设置…',
|
||||
menuExportPdf: '导出为 PDF…',
|
||||
menuExportHtml: '导出为 HTML…',
|
||||
menuPrint: '打印…',
|
||||
menuEdit: '编辑',
|
||||
menuUndo: '撤销',
|
||||
@@ -244,6 +251,7 @@ const tMain = createI18n({
|
||||
filterSupported: 'Supported Files',
|
||||
filterAll: 'All Files',
|
||||
dlgExportPdf: 'Export as PDF',
|
||||
dlgExportHtml: 'Export as HTML',
|
||||
errUnsupportedExt: '.{ext} files are not supported',
|
||||
errNotFile: 'not a file',
|
||||
errTooLarge: 'exceeds the {mb}MB limit',
|
||||
@@ -269,6 +277,7 @@ const tMain = createI18n({
|
||||
menuSaveAs: 'Save As…',
|
||||
menuPageSetup: 'Page Setup…',
|
||||
menuExportPdf: 'Export as PDF…',
|
||||
menuExportHtml: 'Export as HTML…',
|
||||
menuPrint: 'Print…',
|
||||
menuEdit: 'Edit',
|
||||
menuUndo: 'Undo',
|
||||
@@ -338,6 +347,7 @@ const tMain = createI18n({
|
||||
filterSupported: 'サポートされているファイル',
|
||||
filterAll: 'すべてのファイル',
|
||||
dlgExportPdf: 'PDF としてエクスポート',
|
||||
dlgExportHtml: 'HTML としてエクスポート',
|
||||
errUnsupportedExt: '.{ext} 形式には対応していません',
|
||||
errNotFile: 'ファイルではありません',
|
||||
errTooLarge: '{mb}MB の上限を超えています',
|
||||
@@ -364,6 +374,7 @@ const tMain = createI18n({
|
||||
menuSaveAs: '名前を付けて保存…',
|
||||
menuPageSetup: 'ページ設定…',
|
||||
menuExportPdf: 'PDF としてエクスポート…',
|
||||
menuExportHtml: 'HTML としてエクスポート…',
|
||||
menuPrint: '印刷…',
|
||||
menuEdit: '編集',
|
||||
menuUndo: '元に戻す',
|
||||
@@ -434,6 +445,7 @@ const tMain = createI18n({
|
||||
filterSupported: '지원되는 파일',
|
||||
filterAll: '모든 파일',
|
||||
dlgExportPdf: 'PDF로 내보내기',
|
||||
dlgExportHtml: 'HTML로 내보내기',
|
||||
errUnsupportedExt: '.{ext} 형식은 지원되지 않습니다',
|
||||
errNotFile: '파일이 아닙니다',
|
||||
errTooLarge: '{mb}MB 제한을 초과했습니다',
|
||||
@@ -460,6 +472,7 @@ const tMain = createI18n({
|
||||
menuSaveAs: '다른 이름으로 저장…',
|
||||
menuPageSetup: '페이지 설정…',
|
||||
menuExportPdf: 'PDF로 내보내기…',
|
||||
menuExportHtml: 'HTML로 내보내기…',
|
||||
menuPrint: '인쇄…',
|
||||
menuEdit: '편집',
|
||||
menuUndo: '실행 취소',
|
||||
@@ -531,6 +544,7 @@ const tMain = createI18n({
|
||||
filterSupported: 'Fichiers pris en charge',
|
||||
filterAll: 'Tous les fichiers',
|
||||
dlgExportPdf: 'Exporter au format PDF',
|
||||
dlgExportHtml: 'Exporter au format HTML',
|
||||
errUnsupportedExt: 'les fichiers .{ext} ne sont pas pris en charge',
|
||||
errNotFile: "n'est pas un fichier",
|
||||
errTooLarge: 'dépasse la limite de {mb} Mo',
|
||||
@@ -557,6 +571,7 @@ const tMain = createI18n({
|
||||
menuSaveAs: 'Enregistrer sous…',
|
||||
menuPageSetup: 'Mise en page…',
|
||||
menuExportPdf: 'Exporter au format PDF…',
|
||||
menuExportHtml: 'Exporter au format HTML…',
|
||||
menuPrint: 'Imprimer…',
|
||||
menuEdit: 'Édition',
|
||||
menuUndo: 'Annuler',
|
||||
@@ -628,6 +643,7 @@ const tMain = createI18n({
|
||||
filterSupported: 'Unterstützte Dateien',
|
||||
filterAll: 'Alle Dateien',
|
||||
dlgExportPdf: 'Als PDF exportieren',
|
||||
dlgExportHtml: 'Als HTML exportieren',
|
||||
errUnsupportedExt: '.{ext}-Dateien werden nicht unterstützt',
|
||||
errNotFile: 'keine Datei',
|
||||
errTooLarge: 'überschreitet das Limit von {mb} MB',
|
||||
@@ -654,6 +670,7 @@ const tMain = createI18n({
|
||||
menuSaveAs: 'Speichern unter…',
|
||||
menuPageSetup: 'Seite einrichten…',
|
||||
menuExportPdf: 'Als PDF exportieren…',
|
||||
menuExportHtml: 'Als HTML exportieren…',
|
||||
menuPrint: 'Drucken…',
|
||||
menuEdit: 'Bearbeiten',
|
||||
menuUndo: 'Rückgängig',
|
||||
@@ -724,6 +741,7 @@ const tMain = createI18n({
|
||||
filterSupported: 'Archivos compatibles',
|
||||
filterAll: 'Todos los archivos',
|
||||
dlgExportPdf: 'Exportar como PDF',
|
||||
dlgExportHtml: 'Exportar como HTML',
|
||||
errUnsupportedExt: 'los archivos .{ext} no son compatibles',
|
||||
errNotFile: 'no es un archivo',
|
||||
errTooLarge: 'supera el límite de {mb} MB',
|
||||
@@ -751,6 +769,7 @@ const tMain = createI18n({
|
||||
menuSaveAs: 'Guardar como…',
|
||||
menuPageSetup: 'Configurar página…',
|
||||
menuExportPdf: 'Exportar como PDF…',
|
||||
menuExportHtml: 'Exportar como HTML…',
|
||||
menuPrint: 'Imprimir…',
|
||||
menuEdit: 'Edición',
|
||||
menuUndo: 'Deshacer',
|
||||
@@ -820,6 +839,7 @@ const tMain = createI18n({
|
||||
filterSupported: 'ไฟล์ที่รองรับ',
|
||||
filterAll: 'ไฟล์ทั้งหมด',
|
||||
dlgExportPdf: 'ส่งออกเป็น PDF',
|
||||
dlgExportHtml: 'ส่งออกเป็น HTML',
|
||||
errUnsupportedExt: 'ไม่รองรับไฟล์ .{ext}',
|
||||
errNotFile: 'ไม่ใช่ไฟล์',
|
||||
errTooLarge: 'เกินขีดจำกัด {mb}MB',
|
||||
@@ -846,6 +866,7 @@ const tMain = createI18n({
|
||||
menuSaveAs: 'บันทึกเป็น…',
|
||||
menuPageSetup: 'ตั้งค่าหน้ากระดาษ…',
|
||||
menuExportPdf: 'ส่งออกเป็น PDF…',
|
||||
menuExportHtml: 'ส่งออกเป็น HTML…',
|
||||
menuPrint: 'พิมพ์…',
|
||||
menuEdit: 'แก้ไข',
|
||||
menuUndo: 'เลิกทำ',
|
||||
@@ -916,6 +937,7 @@ const tMain = createI18n({
|
||||
filterSupported: 'File yang Didukung',
|
||||
filterAll: 'Semua File',
|
||||
dlgExportPdf: 'Ekspor sebagai PDF',
|
||||
dlgExportHtml: 'Ekspor sebagai HTML',
|
||||
errUnsupportedExt: 'file .{ext} tidak didukung',
|
||||
errNotFile: 'bukan file',
|
||||
errTooLarge: 'melebihi batas {mb}MB',
|
||||
@@ -941,6 +963,7 @@ const tMain = createI18n({
|
||||
menuSaveAs: 'Simpan Sebagai…',
|
||||
menuPageSetup: 'Penyetelan Halaman…',
|
||||
menuExportPdf: 'Ekspor sebagai PDF…',
|
||||
menuExportHtml: 'Ekspor sebagai HTML…',
|
||||
menuPrint: 'Cetak…',
|
||||
menuEdit: 'Edit',
|
||||
menuUndo: 'Urungkan',
|
||||
@@ -1011,6 +1034,7 @@ const tMain = createI18n({
|
||||
filterSupported: 'Поддерживаемые файлы',
|
||||
filterAll: 'Все файлы',
|
||||
dlgExportPdf: 'Экспорт в PDF',
|
||||
dlgExportHtml: 'Экспорт в HTML',
|
||||
errUnsupportedExt: 'файлы .{ext} не поддерживаются',
|
||||
errNotFile: 'не является файлом',
|
||||
errTooLarge: 'превышает лимит {mb} МБ',
|
||||
@@ -1037,6 +1061,7 @@ const tMain = createI18n({
|
||||
menuSaveAs: 'Сохранить как…',
|
||||
menuPageSetup: 'Параметры страницы…',
|
||||
menuExportPdf: 'Экспорт в PDF…',
|
||||
menuExportHtml: 'Экспорт в HTML…',
|
||||
menuPrint: 'Печать…',
|
||||
menuEdit: 'Правка',
|
||||
menuUndo: 'Отменить',
|
||||
@@ -1107,6 +1132,7 @@ const tMain = createI18n({
|
||||
filterSupported: 'الملفات المدعومة',
|
||||
filterAll: 'كل الملفات',
|
||||
dlgExportPdf: 'تصدير بتنسيق PDF',
|
||||
dlgExportHtml: 'تصدير بتنسيق HTML',
|
||||
errUnsupportedExt: 'ملفات .{ext} غير مدعومة',
|
||||
errNotFile: 'ليس ملفًا',
|
||||
errTooLarge: 'يتجاوز الحد {mb}MB',
|
||||
@@ -1133,6 +1159,7 @@ const tMain = createI18n({
|
||||
menuSaveAs: 'حفظ باسم…',
|
||||
menuPageSetup: 'إعداد الصفحة…',
|
||||
menuExportPdf: 'تصدير بتنسيق PDF…',
|
||||
menuExportHtml: 'تصدير بتنسيق HTML…',
|
||||
menuPrint: 'طباعة…',
|
||||
menuEdit: 'تحرير',
|
||||
menuUndo: 'تراجع',
|
||||
@@ -1203,6 +1230,7 @@ const tMain = createI18n({
|
||||
filterSupported: 'Arquivos Compatíveis',
|
||||
filterAll: 'Todos os Arquivos',
|
||||
dlgExportPdf: 'Exportar como PDF',
|
||||
dlgExportHtml: 'Exportar como HTML',
|
||||
errUnsupportedExt: 'arquivos .{ext} não são suportados',
|
||||
errNotFile: 'não é um arquivo',
|
||||
errTooLarge: 'excede o limite de {mb}MB',
|
||||
@@ -1229,6 +1257,7 @@ const tMain = createI18n({
|
||||
menuSaveAs: 'Salvar Como…',
|
||||
menuPageSetup: 'Configurar Página…',
|
||||
menuExportPdf: 'Exportar como PDF…',
|
||||
menuExportHtml: 'Exportar como HTML…',
|
||||
menuPrint: 'Imprimir…',
|
||||
menuEdit: 'Editar',
|
||||
menuUndo: 'Desfazer',
|
||||
@@ -1299,6 +1328,7 @@ const tMain = createI18n({
|
||||
filterSupported: 'File supportati',
|
||||
filterAll: 'Tutti i file',
|
||||
dlgExportPdf: 'Esporta come PDF',
|
||||
dlgExportHtml: 'Esporta come HTML',
|
||||
errUnsupportedExt: 'i file .{ext} non sono supportati',
|
||||
errNotFile: 'non è un file',
|
||||
errTooLarge: 'supera il limite di {mb} MB',
|
||||
@@ -1325,6 +1355,7 @@ const tMain = createI18n({
|
||||
menuSaveAs: 'Salva con nome…',
|
||||
menuPageSetup: 'Imposta pagina…',
|
||||
menuExportPdf: 'Esporta come PDF…',
|
||||
menuExportHtml: 'Esporta come HTML…',
|
||||
menuPrint: 'Stampa…',
|
||||
menuEdit: 'Modifica',
|
||||
menuUndo: 'Annulla',
|
||||
@@ -1395,6 +1426,7 @@ const tMain = createI18n({
|
||||
filterSupported: 'Obsługiwane pliki',
|
||||
filterAll: 'Wszystkie pliki',
|
||||
dlgExportPdf: 'Eksportuj jako PDF',
|
||||
dlgExportHtml: 'Eksportuj jako HTML',
|
||||
errUnsupportedExt: 'pliki .{ext} nie są obsługiwane',
|
||||
errNotFile: 'to nie jest plik',
|
||||
errTooLarge: 'przekracza limit {mb} MB',
|
||||
@@ -1421,6 +1453,7 @@ const tMain = createI18n({
|
||||
menuSaveAs: 'Zapisz jako…',
|
||||
menuPageSetup: 'Ustawienia strony…',
|
||||
menuExportPdf: 'Eksportuj jako PDF…',
|
||||
menuExportHtml: 'Eksportuj jako HTML…',
|
||||
menuPrint: 'Drukuj…',
|
||||
menuEdit: 'Edycja',
|
||||
menuUndo: 'Cofnij',
|
||||
@@ -1466,6 +1499,104 @@ const tMain = createI18n({
|
||||
menuShortcuts: 'Skróty klawiaturowe',
|
||||
menuDocsHelp: 'Pomoc GenOffice Docs',
|
||||
},
|
||||
cs: {
|
||||
dlgOpenDoc: 'Otevřít dokument',
|
||||
filterWord: 'Dokumenty Wordu',
|
||||
dlgSaveAs: 'Uložit jako',
|
||||
closeUnsavedMsg: 'Tento dokument obsahuje neuložené změny.',
|
||||
closeUnsavedDetail: 'Chcete je před zavřením uložit?',
|
||||
closeNoReplyMsg: 'Dokument neodpovídá a může obsahovat neuložené změny.',
|
||||
closeNoReplyDetail: 'Přesto zavřít? Neuložené změny budou ztraceny.',
|
||||
btnCloseAnyway: 'Přesto zavřít',
|
||||
autosaveFoundTitle: 'Nalezena obnovená verze',
|
||||
autosaveFoundBody:
|
||||
'Z poslední relace existují neuložené změny. Obnovit automaticky uloženou verzi?',
|
||||
autosaveRestore: 'Obnovit',
|
||||
autosaveDiscard: 'Zahodit',
|
||||
btnDontSave: 'Neukládat',
|
||||
btnCancel: 'Zrušit',
|
||||
extModifiedMsg: 'Soubor byl změněn jiným programem.',
|
||||
extModifiedDetail: 'Přesto uložit a přepsat změny na disku?',
|
||||
btnOverwrite: 'Přepsat',
|
||||
dlgInsertImage: 'Vložit obrázek',
|
||||
filterImages: 'Obrázky',
|
||||
dlgAddAttachment: 'Přidat přílohy',
|
||||
filterSupported: 'Podporované soubory',
|
||||
filterAll: 'Všechny soubory',
|
||||
dlgExportPdf: 'Exportovat jako PDF',
|
||||
dlgExportHtml: 'Exportovat jako HTML',
|
||||
errUnsupportedExt: 'soubory .{ext} nejsou podporovány',
|
||||
errNotFile: 'není soubor',
|
||||
errTooLarge: 'překračuje limit {mb} MB',
|
||||
errImageTooLarge: 'obrázek překračuje limit 5 MB',
|
||||
errUnreadable: 'nelze přečíst',
|
||||
errFileTooLarge: 'Soubor překračuje limit velikosti',
|
||||
errParseFailed: 'Soubor se nepodařilo zpracovat',
|
||||
errImageNoText:
|
||||
'Obrázkové přílohy neobsahují text; obrázek se odesílá spolu se zprávou uživatele',
|
||||
errNotImage: 'nepodporovaný typ obrázku',
|
||||
errGskNotLoggedIn:
|
||||
'Nejste přihlášeni do Genspark: klikněte níže na „Přihlásit se do Genspark“, přihlaste se a zkuste to znovu',
|
||||
errNoApiKey: 'Pro {provider} není nakonfigurován žádný klíč API',
|
||||
errAiBusy: 'Služba AI je právě zaneprázdněna — zkuste to prosím za chvíli znovu',
|
||||
errNoModel: 'Není nakonfigurován název modelu',
|
||||
menuFile: 'Soubor',
|
||||
menuNewDoc: 'Nový dokument',
|
||||
menuNewWindow: 'Nové okno',
|
||||
menuOpen: 'Otevřít…',
|
||||
menuOpenRecent: 'Otevřít poslední',
|
||||
menuNoRecent: 'Žádné poslední dokumenty',
|
||||
menuClose: 'Zavřít',
|
||||
menuSave: 'Uložit',
|
||||
menuSaveAs: 'Uložit jako…',
|
||||
menuPageSetup: 'Vzhled stránky…',
|
||||
menuExportPdf: 'Exportovat jako PDF…',
|
||||
menuExportHtml: 'Exportovat jako HTML…',
|
||||
menuPrint: 'Tisk…',
|
||||
menuEdit: 'Úpravy',
|
||||
menuUndo: 'Zpět',
|
||||
menuRedo: 'Znovu',
|
||||
menuCut: 'Vyjmout',
|
||||
menuCopy: 'Kopírovat',
|
||||
menuPaste: 'Vložit',
|
||||
menuPasteMatch: 'Vložit a přizpůsobit styl',
|
||||
menuFindReplace: 'Najít a nahradit…',
|
||||
menuSelectAll: 'Vybrat vše',
|
||||
menuView: 'Zobrazení',
|
||||
menuZoomIn: 'Zvětšit',
|
||||
menuZoomOut: 'Zmenšit',
|
||||
menuZoom100: 'Skutečná velikost (100 %)',
|
||||
menuPageWidth: 'Šířka stránky',
|
||||
menuWholePage: 'Celá stránka',
|
||||
menuAiSidebar: 'Boční panel AI',
|
||||
menuDarkMode: 'Tmavý režim',
|
||||
menuFullscreen: 'Přejít na celou obrazovku',
|
||||
menuInsert: 'Vložení',
|
||||
menuInsertTable: 'Tabulka (3×3)',
|
||||
menuInsertImage: 'Obrázek…',
|
||||
menuInsertPageBreak: 'Konec stránky',
|
||||
menuInsertLink: 'Hypertextový odkaz…',
|
||||
menuInsertEquation: 'Rovnice…',
|
||||
menuComment: 'Komentář',
|
||||
menuFormat: 'Formát',
|
||||
menuBold: 'Tučné',
|
||||
menuItalic: 'Kurzíva',
|
||||
menuUnderline: 'Podtržení',
|
||||
menuAlign: 'Zarovnat',
|
||||
menuAlignLeft: 'Zarovnat vlevo',
|
||||
menuAlignCenter: 'Zarovnat na střed',
|
||||
menuAlignRight: 'Zarovnat vpravo',
|
||||
menuAlignJustify: 'Zarovnat do bloku',
|
||||
menuFont: 'Písmo…',
|
||||
menuParagraph: 'Odstavec…',
|
||||
menuTools: 'Nástroje',
|
||||
menuWordCount: 'Počet slov…',
|
||||
menuAiProofread: 'Korektura AI',
|
||||
menuWindow: 'Okno',
|
||||
menuHelp: 'Nápověda',
|
||||
menuShortcuts: 'Klávesové zkratky',
|
||||
menuDocsHelp: 'Nápověda GenOffice Docs',
|
||||
},
|
||||
nl: {
|
||||
dlgOpenDoc: 'Document openen',
|
||||
filterWord: 'Word-documenten',
|
||||
@@ -1491,6 +1622,7 @@ const tMain = createI18n({
|
||||
filterSupported: 'Ondersteunde bestanden',
|
||||
filterAll: 'Alle bestanden',
|
||||
dlgExportPdf: 'Exporteren als PDF',
|
||||
dlgExportHtml: 'Exporteren als HTML',
|
||||
errUnsupportedExt: '.{ext}-bestanden worden niet ondersteund',
|
||||
errNotFile: 'geen bestand',
|
||||
errTooLarge: 'overschrijdt de limiet van {mb} MB',
|
||||
@@ -1517,6 +1649,7 @@ const tMain = createI18n({
|
||||
menuSaveAs: 'Opslaan als…',
|
||||
menuPageSetup: 'Pagina-instelling…',
|
||||
menuExportPdf: 'Exporteren als PDF…',
|
||||
menuExportHtml: 'Exporteren als HTML…',
|
||||
menuPrint: 'Afdrukken…',
|
||||
menuEdit: 'Bewerken',
|
||||
menuUndo: 'Ongedaan maken',
|
||||
@@ -1587,6 +1720,7 @@ const tMain = createI18n({
|
||||
filterSupported: 'Fail yang Disokong',
|
||||
filterAll: 'Semua Fail',
|
||||
dlgExportPdf: 'Eksport sebagai PDF',
|
||||
dlgExportHtml: 'Eksport sebagai HTML',
|
||||
errUnsupportedExt: 'fail .{ext} tidak disokong',
|
||||
errNotFile: 'bukan fail',
|
||||
errTooLarge: 'melebihi had {mb}MB',
|
||||
@@ -1613,6 +1747,7 @@ const tMain = createI18n({
|
||||
menuSaveAs: 'Simpan Sebagai…',
|
||||
menuPageSetup: 'Persediaan Halaman…',
|
||||
menuExportPdf: 'Eksport sebagai PDF…',
|
||||
menuExportHtml: 'Eksport sebagai HTML…',
|
||||
menuPrint: 'Cetak…',
|
||||
menuEdit: 'Edit',
|
||||
menuUndo: 'Buat Asal',
|
||||
@@ -1682,6 +1817,7 @@ const tMain = createI18n({
|
||||
filterSupported: 'קבצים נתמכים',
|
||||
filterAll: 'כל הקבצים',
|
||||
dlgExportPdf: 'ייצוא כ-PDF',
|
||||
dlgExportHtml: 'ייצוא כ-HTML',
|
||||
errUnsupportedExt: 'קובצי .{ext} אינם נתמכים',
|
||||
errNotFile: 'אינו קובץ',
|
||||
errTooLarge: 'חורג מהמגבלה של {mb}MB',
|
||||
@@ -1707,6 +1843,7 @@ const tMain = createI18n({
|
||||
menuSaveAs: 'שמירה בשם…',
|
||||
menuPageSetup: 'הגדרת עמוד…',
|
||||
menuExportPdf: 'ייצוא כ-PDF…',
|
||||
menuExportHtml: 'ייצוא כ-HTML…',
|
||||
menuPrint: 'הדפסה…',
|
||||
menuEdit: 'עריכה',
|
||||
menuUndo: 'בטל',
|
||||
@@ -1777,6 +1914,7 @@ const tMain = createI18n({
|
||||
filterSupported: 'समर्थित फ़ाइलें',
|
||||
filterAll: 'सभी फ़ाइलें',
|
||||
dlgExportPdf: 'PDF के रूप में निर्यात करें',
|
||||
dlgExportHtml: 'HTML के रूप में निर्यात करें',
|
||||
errUnsupportedExt: '.{ext} फ़ाइलें समर्थित नहीं हैं',
|
||||
errNotFile: 'फ़ाइल नहीं है',
|
||||
errTooLarge: '{mb}MB की सीमा से अधिक है',
|
||||
@@ -1803,6 +1941,7 @@ const tMain = createI18n({
|
||||
menuSaveAs: 'इस रूप में सहेजें…',
|
||||
menuPageSetup: 'पृष्ठ सेटअप…',
|
||||
menuExportPdf: 'PDF के रूप में निर्यात करें…',
|
||||
menuExportHtml: 'HTML के रूप में निर्यात करें…',
|
||||
menuPrint: 'प्रिंट करें…',
|
||||
menuEdit: 'संपादन',
|
||||
menuUndo: 'पूर्ववत करें',
|
||||
@@ -1872,6 +2011,7 @@ const tMain = createI18n({
|
||||
filterSupported: '支援的檔案',
|
||||
filterAll: '所有檔案',
|
||||
dlgExportPdf: '匯出為 PDF',
|
||||
dlgExportHtml: '匯出為 HTML',
|
||||
errUnsupportedExt: '暫不支援 .{ext} 類型',
|
||||
errNotFile: '不是檔案',
|
||||
errTooLarge: '超過 {mb}MB 上限',
|
||||
@@ -1896,6 +2036,7 @@ const tMain = createI18n({
|
||||
menuSaveAs: '另存新檔…',
|
||||
menuPageSetup: '版面設定…',
|
||||
menuExportPdf: '匯出為 PDF…',
|
||||
menuExportHtml: '匯出為 HTML…',
|
||||
menuPrint: '列印…',
|
||||
menuEdit: '編輯',
|
||||
menuUndo: '復原',
|
||||
@@ -2612,11 +2753,6 @@ const TWIPS_PER_INCH = 1440
|
||||
|
||||
const SETTINGS_PATH = () => userDataPath('ai-settings.json')
|
||||
|
||||
/** live read: the shell settings pane writes the file; every tool call re-checks */
|
||||
function gskCloudToolsOn(): boolean {
|
||||
return cloudToolsEnabled(readJson<Partial<AiSettings>>(SETTINGS_PATH(), {}))
|
||||
}
|
||||
|
||||
const activeAiStreams = new Map<string, AbortController>()
|
||||
|
||||
/**
|
||||
@@ -2746,10 +2882,10 @@ export function registerAiIpc(): void {
|
||||
// shared search tools (content + images): Serper with DuckDuckGo fallback (same source as slides/sheets)
|
||||
ipcMain.handle('ai:web-search', async (_event, query: string, maxResults?: number) => {
|
||||
try {
|
||||
return await webSearch(
|
||||
return await webSearchTool(
|
||||
SETTINGS_PATH(),
|
||||
String(query),
|
||||
typeof maxResults === 'number' ? maxResults : 6,
|
||||
gskCloudToolsOn(),
|
||||
)
|
||||
} catch (err) {
|
||||
return { results: [], method: 'error', error: String(err) }
|
||||
@@ -2757,10 +2893,10 @@ export function registerAiIpc(): void {
|
||||
})
|
||||
ipcMain.handle('ai:image-search', async (_event, query: string, maxResults?: number) => {
|
||||
try {
|
||||
return await imageSearch(
|
||||
return await imageSearchTool(
|
||||
SETTINGS_PATH(),
|
||||
String(query),
|
||||
typeof maxResults === 'number' ? maxResults : 8,
|
||||
gskCloudToolsOn(),
|
||||
)
|
||||
} catch (err) {
|
||||
return { images: [], method: 'error', error: String(err) }
|
||||
@@ -2796,30 +2932,34 @@ export function registerAiIpc(): void {
|
||||
// registered once a slides view exists, so docs needs its own channel
|
||||
ipcMain.handle(
|
||||
'docs:ai-generate-image',
|
||||
async (_event, op: { prompt?: unknown; aspectRatio?: unknown }) => {
|
||||
if (!hasGskAuth())
|
||||
return {
|
||||
error: 'Genspark account is not logged in on this machine; ask the user to log in first',
|
||||
}
|
||||
if (!gskCloudToolsOn())
|
||||
return {
|
||||
error:
|
||||
'Genspark cloud tools are turned off in Settings (AI Model); enable them to use this tool',
|
||||
}
|
||||
const prompt = String(op?.prompt ?? '').trim()
|
||||
if (!prompt) return { error: 'prompt must not be empty' }
|
||||
try {
|
||||
const r = await gskGenerateImage({
|
||||
prompt,
|
||||
aspectRatio: op?.aspectRatio ? String(op.aspectRatio) : undefined,
|
||||
})
|
||||
return { url: r.url }
|
||||
} catch (err) {
|
||||
return { error: err instanceof Error ? err.message : String(err) }
|
||||
}
|
||||
},
|
||||
(_event, op: { prompt?: unknown; aspectRatio?: unknown }) =>
|
||||
generateImageTool(SETTINGS_PATH(), {
|
||||
prompt: String(op?.prompt ?? ''),
|
||||
aspectRatio: op?.aspectRatio ? String(op.aspectRatio) : undefined,
|
||||
}),
|
||||
)
|
||||
|
||||
ipcMain.handle('ai:search-test', (_event, input: unknown) => {
|
||||
const { provider, apiKey } = (input ?? {}) as { provider?: AiSearchProviderId; apiKey?: string }
|
||||
if (!provider || provider === 'genspark') {
|
||||
return hasGskAuth() ? { ok: true } : { ok: false, error: tm('errGskNotLoggedIn') }
|
||||
}
|
||||
return testSearchProvider(provider, String(apiKey ?? ''))
|
||||
})
|
||||
|
||||
// settings-UI connection test for the media provider (genspark = the gsk login state)
|
||||
ipcMain.handle('ai:media-test', (_event, input: unknown) => {
|
||||
const { provider, config } = (input ?? {}) as {
|
||||
provider?: AiMediaProviderId
|
||||
config?: AiMediaProviderConfig
|
||||
}
|
||||
if (!provider || provider === 'genspark') {
|
||||
return hasGskAuth() ? { ok: true } : { ok: false, error: tm('errGskNotLoggedIn') }
|
||||
}
|
||||
if (!config) return { ok: false, error: 'No media provider configuration' }
|
||||
return testMediaProvider(provider, config)
|
||||
})
|
||||
|
||||
ipcMain.handle('ai:chat', async (_event, request: AiChatRequest) => {
|
||||
const { settings, system, user } = request
|
||||
const provider = settings.provider
|
||||
@@ -2954,6 +3094,7 @@ export function registerProjectIpc(): void {
|
||||
output?: string
|
||||
}>
|
||||
attachments?: Array<{ name: string; path?: string; ext?: string; sizeBytes?: number }>
|
||||
scope?: { label: string; text?: string }
|
||||
},
|
||||
) => {
|
||||
const store = getProjectStore()
|
||||
@@ -2963,6 +3104,8 @@ export function registerProjectIpc(): void {
|
||||
}
|
||||
if (args.tools) msg.tools = args.tools
|
||||
if (args.attachments) msg.attachments = args.attachments
|
||||
if (args.scope) msg.scope = args.scope
|
||||
|
||||
store.appendChatMessage(args.projectId, args.chatId, msg)
|
||||
},
|
||||
)
|
||||
@@ -3267,6 +3410,25 @@ export function registerDocsIpc(): void {
|
||||
}
|
||||
})
|
||||
|
||||
// Blink only respells an editable as a consequence of real (trusted) typing
|
||||
// of a word-committing character inside it: attribute flips, focus cycles,
|
||||
// script selection moves, execCommand edits, fresh DOM nodes, synthetic
|
||||
// clicks/arrow keys — and even a typed zero-width space — all leave existing
|
||||
// typos unmarked (each verified pixel-by-pixel).
|
||||
// Type one trusted space; the RENDERER removes it again by script (a
|
||||
// trusted Backspace would work too, but its deletion re-suppresses the
|
||||
// caret paragraph and that line stays unmarked) with ProseMirror's DOM
|
||||
// observer paused, so the round trip never becomes a transaction.
|
||||
ipcMain.handle('docs:respell-kick', async (event) => {
|
||||
const wc = event.sender
|
||||
if (tornDownWcIds.has(wc.id) || wc.isDestroyed()) return
|
||||
wc.focus()
|
||||
wc.sendInputEvent({ type: 'char', keyCode: ' ' })
|
||||
// resolve only after the input pipeline has delivered the keystroke, so
|
||||
// the caller can scrub the space it produced
|
||||
await new Promise((r) => setTimeout(r, 120))
|
||||
})
|
||||
|
||||
ipcMain.handle(
|
||||
'docs:save-as',
|
||||
async (event, defaultName: string, data: ArrayBuffer, sourcePath?: string | null) => {
|
||||
@@ -3274,7 +3436,10 @@ export function registerDocsIpc(): void {
|
||||
if (tornDownWcIds.has(event.sender.id)) return { ok: false }
|
||||
const result = await saveDialog(event, {
|
||||
title: tm('dlgSaveAs'),
|
||||
defaultPath: defaultName,
|
||||
defaultPath: saveAsSuggestion(
|
||||
typeof sourcePath === 'string' ? sourcePath : null,
|
||||
defaultName,
|
||||
),
|
||||
filters: [{ name: tm('filterWord'), extensions: ['docx'] }],
|
||||
})
|
||||
if (result.canceled || !result.filePath) return { ok: false }
|
||||
@@ -3548,6 +3713,34 @@ export function registerDocsIpc(): void {
|
||||
},
|
||||
)
|
||||
|
||||
ipcMain.handle(
|
||||
'docs:export-html',
|
||||
async (event, defaultName: string, html: string, outPath?: string) => {
|
||||
if (typeof html !== 'string' || !html) return { ok: false, error: 'empty document' }
|
||||
let filePath = outPath ?? null
|
||||
if (filePath && !canPdfWrite(event.sender.id, filePath)) {
|
||||
return { ok: false, error: 'export target is not an authorized path' }
|
||||
}
|
||||
if (!filePath) {
|
||||
const result = await saveDialog(event, {
|
||||
title: tm('dlgExportHtml'),
|
||||
defaultPath: defaultName.replace(/\.docx$/i, '') + '.html',
|
||||
filters: [{ name: 'HTML', extensions: ['html'] }],
|
||||
})
|
||||
if (result.canceled || !result.filePath) return { ok: false }
|
||||
filePath = result.filePath
|
||||
allowPdfWrite(event.sender.id, filePath)
|
||||
}
|
||||
try {
|
||||
writeFileSync(filePath, html, 'utf8')
|
||||
openGeneratedFile(filePath)
|
||||
return { ok: true, path: filePath }
|
||||
} catch (err) {
|
||||
return { ok: false, error: String(err), path: filePath }
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
// mixed paper-size export: the renderer prints group by group per size (other pages hidden via CSS); this produces one group's bytes
|
||||
ipcMain.handle(
|
||||
'docs:print-pdf-buffer',
|
||||
@@ -3714,8 +3907,8 @@ export async function createAiDocument(
|
||||
openGeneratedFile(filePath)
|
||||
return { ok: true, path: filePath }
|
||||
}
|
||||
if (type === 'md') {
|
||||
const filePath = uniquePathIn(defaultSaveDir(), `${title}.md`)
|
||||
if (type === 'md' || type === 'html') {
|
||||
const filePath = uniquePathIn(defaultSaveDir(), `${title}.${type}`)
|
||||
await writeFile(filePath, content, 'utf8')
|
||||
openGeneratedFile(filePath)
|
||||
return { ok: true, path: filePath }
|
||||
@@ -3840,6 +4033,7 @@ export function buildDocsMenu(): void {
|
||||
{ type: 'separator' },
|
||||
{ label: tm('menuPageSetup'), click: () => sendCommand('page-setup') },
|
||||
{ label: tm('menuExportPdf'), click: () => sendCommand('export-pdf') },
|
||||
{ label: tm('menuExportHtml'), click: () => sendCommand('export-html') },
|
||||
{
|
||||
label: tm('menuPrint'),
|
||||
accelerator: 'CmdOrCtrl+P',
|
||||
|
||||
@@ -130,6 +130,14 @@ const tUpd = createI18n({
|
||||
updInstall: 'Uruchom ponownie i zainstaluj',
|
||||
updLater: 'Przypomnij później',
|
||||
},
|
||||
cs: {
|
||||
updTitle: 'Aktualizace softwaru',
|
||||
updHeadline: 'Je k dispozici nová verze',
|
||||
updDesc:
|
||||
'Tato aktualizace obsahuje vylepšení výkonu a opravy chyb. Doporučujeme aktualizovat nyní.',
|
||||
updInstall: 'Restartovat a nainstalovat',
|
||||
updLater: 'Připomenout později',
|
||||
},
|
||||
nl: {
|
||||
updTitle: 'Software-update',
|
||||
updHeadline: 'Er is een nieuwe versie beschikbaar',
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { contextBridge, ipcRenderer, webUtils } from 'electron'
|
||||
import type { IpcRendererEvent } from 'electron'
|
||||
import type { AiPanelPrefs } from '@genoffice/ui'
|
||||
import type {
|
||||
AiChatRequest,
|
||||
AiSettings,
|
||||
@@ -7,6 +8,7 @@ import type {
|
||||
AiStreamRequest,
|
||||
DesktopApi,
|
||||
MenuCommand,
|
||||
AutoSaveDefault,
|
||||
UiTheme,
|
||||
} from '../shared/ipc'
|
||||
import type { ProjectApi } from '@genoffice/project-store'
|
||||
@@ -28,6 +30,18 @@ const api: DesktopApi = {
|
||||
ipcRenderer.on('app:theme-changed', listener)
|
||||
return () => ipcRenderer.removeListener('app:theme-changed', listener)
|
||||
},
|
||||
getAutoSaveDefault: () => ipcRenderer.invoke('app:get-auto-save-default'),
|
||||
onAutoSaveDefaultChanged: (handler) => {
|
||||
const listener = (_event: IpcRendererEvent, value: AutoSaveDefault) => handler(value)
|
||||
ipcRenderer.on('app:auto-save-default-changed', listener)
|
||||
return () => ipcRenderer.removeListener('app:auto-save-default-changed', listener)
|
||||
},
|
||||
getAiPanelPrefs: () => ipcRenderer.invoke('app:get-ai-panel-prefs'),
|
||||
onAiPanelPrefsChanged: (handler) => {
|
||||
const listener = (_event: IpcRendererEvent, prefs: AiPanelPrefs) => handler(prefs)
|
||||
ipcRenderer.on('app:ai-panel-prefs-changed', listener)
|
||||
return () => ipcRenderer.removeListener('app:ai-panel-prefs-changed', listener)
|
||||
},
|
||||
onChromePressed: (handler) => {
|
||||
const listener = () => handler()
|
||||
ipcRenderer.on('app:chrome-pressed', listener)
|
||||
@@ -72,6 +86,7 @@ const api: DesktopApi = {
|
||||
ipcRenderer.on('docs:teardown', listener)
|
||||
return () => ipcRenderer.removeListener('docs:teardown', listener)
|
||||
},
|
||||
respellKick: () => ipcRenderer.invoke('docs:respell-kick'),
|
||||
saveDocxAs: (defaultName: string, data: ArrayBuffer, sourcePath?: string | null) =>
|
||||
ipcRenderer.invoke('docs:save-as', defaultName, data, sourcePath ?? null),
|
||||
saveDocxNew: (defaultName: string, data: ArrayBuffer) =>
|
||||
@@ -95,6 +110,8 @@ const api: DesktopApi = {
|
||||
outPath,
|
||||
scale,
|
||||
),
|
||||
exportHtml: (defaultName: string, html: string, outPath?: string) =>
|
||||
ipcRenderer.invoke('docs:export-html', defaultName, html, outPath),
|
||||
printPdfBuffer: (pageWidthTwips: number, pageHeightTwips: number, scale?: number) =>
|
||||
ipcRenderer.invoke('docs:print-pdf-buffer', pageWidthTwips, pageHeightTwips, scale),
|
||||
saveMergedPdf: (defaultName: string, base64Parts: string[], outPath?: string) =>
|
||||
|
||||
+182
-52
@@ -13,9 +13,10 @@ import { EditorContent, useEditor } from '@tiptap/react'
|
||||
import type { Editor } from '@tiptap/core'
|
||||
import { DOMParser as PmDOMParser, type Mark as PmMark } from '@tiptap/pm/model'
|
||||
import { NodeSelection } from '@tiptap/pm/state'
|
||||
import { Dropdown } from '@genoffice/ui'
|
||||
import { Dropdown, useAutoSavePref } from '@genoffice/ui'
|
||||
import { wordRangeAtCaret } from './editor/comments'
|
||||
import { markdownPasteHtml } from './editor/markdown-paste'
|
||||
import { pasteTextSlice } from './editor/paste-text'
|
||||
import { pasteTextSlice, singleCellPasteText } from './editor/paste-text'
|
||||
import {
|
||||
BLANK_BULLET_NUM_ID,
|
||||
BLANK_ORDERED_NUM_ID,
|
||||
@@ -219,6 +220,7 @@ import {
|
||||
import {
|
||||
applyAiDocContent as applyAiDocContentImpl,
|
||||
exportPdf as exportPdfImpl,
|
||||
exportHtml as exportHtmlImpl,
|
||||
loadFile as loadFileImpl,
|
||||
newFile as newFileImpl,
|
||||
printDoc as printDocImpl,
|
||||
@@ -241,6 +243,7 @@ import {
|
||||
compareWithFile as compareWithFileImpl,
|
||||
deleteComment as deleteCommentImpl,
|
||||
deleteNote as deleteNoteImpl,
|
||||
editComment as editCommentImpl,
|
||||
handleRevision as handleRevisionImpl,
|
||||
removeInks as removeInksImpl,
|
||||
replyToComment as replyToCommentImpl,
|
||||
@@ -780,7 +783,7 @@ export function App() {
|
||||
otherName: string
|
||||
entries: CompareEntry[]
|
||||
} | null>(null)
|
||||
const [autoSave, setAutoSave] = useState(() => localStorage.getItem('aidocs.autoSave') === '1')
|
||||
const [autoSave, setAutoSave] = useAutoSavePref('aidocs.autoSave', window.desktop)
|
||||
// tab closed but this renderer kept alive (shell freeze workaround): go inert
|
||||
const [tornDown, setTornDown] = useState(false)
|
||||
const [aiPreset, setAiPreset] = useState<{
|
||||
@@ -853,6 +856,18 @@ export function App() {
|
||||
const data = event.clipboardData
|
||||
if (!data) return false
|
||||
const html = data.getData('text/html')
|
||||
// a lone unformatted spreadsheet cell is a text paste (the r146 unwrap
|
||||
// turns it into text) and takes the insertion point's formatting like
|
||||
// typing (r172) — the HTML lanes below keep no marks for it and would
|
||||
// land it in the theme font (r176: Sheets cell → Docs pasted as Aptos)
|
||||
if (html) {
|
||||
const cellText = singleCellPasteText(html)
|
||||
if (cellText !== null) {
|
||||
const slice = pasteTextSlice(cellText, view.state.selection.$from, view)
|
||||
view.dispatch(view.state.tr.replaceSelection(slice).scrollIntoView())
|
||||
return true
|
||||
}
|
||||
}
|
||||
// web-copied images (r139): "Copy image" in a browser puts a bitmap +
|
||||
// an <img src="http..."> HTML fragment + often the URL as text/plain
|
||||
// on the clipboard. Detect image-only HTML so the bitmap wins over
|
||||
@@ -1009,10 +1024,8 @@ export function App() {
|
||||
localStorage.setItem('aidocs.showAi', showAi ? '1' : '0')
|
||||
}, [showAi])
|
||||
|
||||
useEffect(() => {
|
||||
localStorage.setItem('aidocs.autoSave', autoSave ? '1' : '0')
|
||||
}, [autoSave])
|
||||
|
||||
const spellcheckWasOn = useRef(spellcheck)
|
||||
const respellKickBusy = useRef(false)
|
||||
useEffect(() => {
|
||||
localStorage.setItem(SPELLCHECK_KEY, spellcheck ? '1' : '0')
|
||||
// setOptions (not a direct DOM write): ProseMirror re-applies editorProps
|
||||
@@ -1026,51 +1039,160 @@ export function App() {
|
||||
},
|
||||
},
|
||||
})
|
||||
// Blink only respells an editable as a consequence of real (trusted)
|
||||
// typing of a word-committing character inside it. The r168 retest ruled
|
||||
// everything else out pixel by pixel: attribute flips, focus cycles (the
|
||||
// first attempt at this fix), script or execCommand edits, fresh DOM
|
||||
// nodes, session spellchecker kicks, synthetic clicks and arrow keys —
|
||||
// even a typed zero-width space — existing typos stay unmarked. So on the
|
||||
// re-enable transition, have the main process type one trusted space at
|
||||
// the caret and remove it again by script (a trusted Backspace would work
|
||||
// too, but its deletion re-suppresses the caret paragraph's markers).
|
||||
// ProseMirror must not see any of it: its DOM observer is paused (no
|
||||
// transaction, no history entry, no dirty flag) and a capture-phase key
|
||||
// shield keeps its keymap and other key handlers out of the round trip —
|
||||
// the same shield also tells us when the keystroke has actually landed.
|
||||
if (spellcheck && !spellcheckWasOn.current) {
|
||||
requestAnimationFrame(() => {
|
||||
const view = editor.view
|
||||
const dom = view.dom
|
||||
if (!dom.isConnected || view.composing || respellKickBusy.current) return
|
||||
respellKickBusy.current = true
|
||||
const sub = getActiveSubEditor()
|
||||
const prev = document.activeElement as HTMLElement | null
|
||||
view.focus() // puts the DOM caret where the state says it is
|
||||
const sel = window.getSelection()
|
||||
// typing over a range would replace it — kick from a caret instead;
|
||||
// view.focus() below restores the real selection from PM state after
|
||||
if (sel && !sel.isCollapsed) sel.collapseToEnd()
|
||||
// the kick inserts exactly one space at the caret; snapshot the caret
|
||||
// text node so the scrub can restore it byte-identically
|
||||
const caretNode = sel?.anchorNode
|
||||
const caretText = caretNode instanceof Text ? caretNode : null
|
||||
const caretData = caretText?.data ?? null
|
||||
let sawKick = false
|
||||
const shield = (e: KeyboardEvent) => {
|
||||
if (e.key === ' ') sawKick = true
|
||||
e.stopPropagation()
|
||||
}
|
||||
document.addEventListener('keydown', shield, true)
|
||||
document.addEventListener('keypress', shield, true)
|
||||
const observer = (
|
||||
view as unknown as { domObserver: { stop: () => void; start: () => void } }
|
||||
).domObserver
|
||||
observer.stop()
|
||||
const scrub = () => {
|
||||
// caret in a text node: remove exactly the one inserted character.
|
||||
// deleteData keeps the node's other spell markers alive — a whole
|
||||
// `data` reassignment would wipe the paragraph's fresh squiggles.
|
||||
if (caretText && caretData !== null && caretText.data !== caretData) {
|
||||
const now = caretText.data
|
||||
if (now.length === caretData.length + 1) {
|
||||
let i = 0
|
||||
while (i < caretData.length && now[i] === caretData[i]) i++
|
||||
caretText.deleteData(i, 1)
|
||||
}
|
||||
if (caretText.data !== caretData) caretText.data = caretData
|
||||
return
|
||||
}
|
||||
// the space landed elsewhere: Blink canonicalizes the insertion point
|
||||
// (end of a link, mark boundary, empty paragraph) into a sibling or
|
||||
// fresh text node — the caret it left sits right after the space
|
||||
if (!sawKick) return
|
||||
const after = window.getSelection()
|
||||
const node = after?.anchorNode
|
||||
if (!(node instanceof Text) || !after || after.anchorOffset === 0) return
|
||||
if (node === caretText) return
|
||||
const ch = node.data[after.anchorOffset - 1]
|
||||
if (ch === ' ' || ch === '\u00a0') node.deleteData(after.anchorOffset - 1, 1)
|
||||
}
|
||||
void window.desktop
|
||||
.respellKick()
|
||||
.catch(() => undefined)
|
||||
.then(async () => {
|
||||
// the IPC can resolve before the input pipeline delivers the
|
||||
// keystroke — wait for the shield to see it (or give up quietly:
|
||||
// a kick that never landed left nothing to scrub)
|
||||
const deadline = Date.now() + 800
|
||||
while (!sawKick && Date.now() < deadline) {
|
||||
await new Promise((r) => setTimeout(r, 30))
|
||||
}
|
||||
scrub()
|
||||
observer.start()
|
||||
document.removeEventListener('keydown', shield, true)
|
||||
document.removeEventListener('keypress', shield, true)
|
||||
respellKickBusy.current = false
|
||||
view.focus() // resync the DOM selection from PM state
|
||||
// ribbon toggle during textbox editing: keep the routing and hand
|
||||
// the keyboard back where it was — typing must not replace the box
|
||||
if (!sub) return
|
||||
setActiveSubEditor(sub)
|
||||
if (prev && prev !== dom) prev.focus({ preventScroll: true })
|
||||
})
|
||||
})
|
||||
}
|
||||
spellcheckWasOn.current = spellcheck
|
||||
}, [editor, spellcheck])
|
||||
|
||||
// Pinch-to-zoom: Chromium delivers trackpad pinch as a wheel event
|
||||
// with ctrlKey set. Also support ⌘+scroll. Must be non-passive to preventDefault.
|
||||
// The cursor-anchored zoom center is stashed for the zoom effect below so a
|
||||
// Ctrl+wheel zoom keeps the content under the cursor in place (issue #238).
|
||||
const zoomCenterRef = useRef<{ x: number; y: number } | null>(null)
|
||||
// The viewport point under the cursor is stashed for the zoom layout effect
|
||||
// below so the content there stays put (public #238); set only when the zoom
|
||||
// actually changes, else a clamped tick would leave a stale anchor behind.
|
||||
const zoomAnchorRef = useRef<{ vx: number; vy: number } | null>(null)
|
||||
useEffect(() => {
|
||||
const onWheel = (e: WheelEvent) => {
|
||||
if (!e.ctrlKey && !e.metaKey) return
|
||||
if (!(e.target as HTMLElement | null)?.closest?.('.editor-scroll')) return
|
||||
e.preventDefault()
|
||||
const container = scrollContainerRef.current
|
||||
if (container) {
|
||||
const rect = container.getBoundingClientRect()
|
||||
zoomCenterRef.current = {
|
||||
x: e.clientX - rect.left + container.scrollLeft,
|
||||
y: e.clientY - rect.top + container.scrollTop,
|
||||
}
|
||||
}
|
||||
setZoom((z) => Math.min(200, Math.max(50, z - e.deltaY * 0.6)))
|
||||
const rect = scrollContainerRef.current?.getBoundingClientRect()
|
||||
const anchor = rect ? { vx: e.clientX - rect.left, vy: e.clientY - rect.top } : null
|
||||
setZoom((z) => {
|
||||
const next = Math.min(200, Math.max(50, z - e.deltaY * 0.6))
|
||||
if (next !== z) zoomAnchorRef.current = anchor
|
||||
return next
|
||||
})
|
||||
}
|
||||
window.addEventListener('wheel', onWheel, { passive: false })
|
||||
return () => window.removeEventListener('wheel', onWheel)
|
||||
}, [])
|
||||
|
||||
// Preserve scroll position when zoom changes (issue #238): rescale the
|
||||
// scroll offsets around the zoom anchor (cursor for wheel zoom, viewport
|
||||
// center for slider/menu/ribbon zoom) so the visible page stays in view.
|
||||
// Keep the document point under the anchor (cursor for wheel zoom, viewport
|
||||
// center otherwise) fixed across a zoom change. Runs after the zoomed layout
|
||||
// is committed, so the page box is read post-zoom and the pre-zoom box is
|
||||
// derived from it: CSS zoom scales the box linearly, the top edge is a fixed
|
||||
// scroller padding, and `.doc-zoom` is margin-auto centered until it overflows.
|
||||
// The pre-zoom scroll offsets come from the last scroll event: a zoom-out can
|
||||
// shrink the overflow and clamp them before this effect gets to read them.
|
||||
const scrollPosRef = useRef({ left: 0, top: 0 })
|
||||
const prevZoomRef = useRef(zoom)
|
||||
useEffect(() => {
|
||||
const container = scrollContainerRef.current
|
||||
if (!container) return
|
||||
useLayoutEffect(() => {
|
||||
const prevZoom = prevZoomRef.current
|
||||
if (prevZoom === zoom) return
|
||||
prevZoomRef.current = zoom
|
||||
const anchor = zoomAnchorRef.current
|
||||
zoomAnchorRef.current = null
|
||||
const container = scrollContainerRef.current
|
||||
const page = container?.querySelector<HTMLElement>('.doc-zoom')
|
||||
if (!container || !page || prevZoom === zoom) return
|
||||
|
||||
const ratio = zoom / prevZoom
|
||||
const anchor = zoomCenterRef.current
|
||||
const centerX = anchor ? anchor.x : container.scrollLeft + container.clientWidth / 2
|
||||
const centerY = anchor ? anchor.y : container.scrollTop + container.clientHeight / 2
|
||||
zoomCenterRef.current = null
|
||||
const vx = anchor ? anchor.vx : container.clientWidth / 2
|
||||
const vy = anchor ? anchor.vy : container.clientHeight / 2
|
||||
const cs = getComputedStyle(container)
|
||||
const padLeft = parseFloat(cs.paddingLeft) || 0
|
||||
const innerWidth = container.clientWidth - padLeft - (parseFloat(cs.paddingRight) || 0)
|
||||
const containerRect = container.getBoundingClientRect()
|
||||
const pageRect = page.getBoundingClientRect()
|
||||
const pageLeft = pageRect.left - containerRect.left + container.scrollLeft
|
||||
const pageTop = pageRect.top - containerRect.top + container.scrollTop
|
||||
const prevPageLeft = padLeft + Math.max(0, (innerWidth - pageRect.width / ratio) / 2)
|
||||
const prev = scrollPosRef.current
|
||||
|
||||
container.scrollLeft = centerX * ratio - container.clientWidth / 2
|
||||
container.scrollTop = centerY * ratio - container.clientHeight / 2
|
||||
const docX = Math.max(0, prev.left + vx - prevPageLeft)
|
||||
const docY = Math.max(0, prev.top + vy - pageTop)
|
||||
container.scrollLeft = pageLeft + docX * ratio - vx
|
||||
container.scrollTop = pageTop + docY * ratio - vy
|
||||
scrollPosRef.current = { left: container.scrollLeft, top: container.scrollTop }
|
||||
}, [zoom])
|
||||
|
||||
// ---- protection enforcement (Review > Protect Document) ----
|
||||
@@ -1726,6 +1848,10 @@ export function App() {
|
||||
(outPath?: string) => exportPdfImpl(fileCtxRef.current, outPath),
|
||||
[],
|
||||
)
|
||||
const exportHtml = useCallback(
|
||||
(outPath?: string) => exportHtmlImpl(fileCtxRef.current, outPath),
|
||||
[],
|
||||
)
|
||||
const printDoc = useCallback(() => printDocImpl(fileCtxRef.current), [])
|
||||
|
||||
// for real-device verification: trigger export directly via CDP (same as __pageDebug)
|
||||
@@ -1852,6 +1978,10 @@ export function App() {
|
||||
(parentId: string, text: string) => replyToCommentImpl(reviewCtxRef.current, parentId, text),
|
||||
[],
|
||||
)
|
||||
const editComment = useCallback(
|
||||
(id: string, text: string) => editCommentImpl(reviewCtxRef.current, id, text),
|
||||
[],
|
||||
)
|
||||
const resolveComment = useCallback(
|
||||
(id: string, done: boolean) => resolveCommentImpl(reviewCtxRef.current, id, done),
|
||||
[],
|
||||
@@ -3690,10 +3820,7 @@ export function App() {
|
||||
) {
|
||||
e.preventDefault()
|
||||
const attrs = { lineSpacing: SPACING_KEYS[e.code], lineRule: null, lineRawTwips: null }
|
||||
const sub = getActiveSubEditor()
|
||||
// textbox schema has only docParagraph — setParaAttrs' heading/list updates would throw
|
||||
if (sub) sub.chain().focus().updateAttributes('docParagraph', attrs).run()
|
||||
else setParaAttrs(editor, attrs)
|
||||
setParaAttrs(getActiveSubEditor() ?? editor, attrs)
|
||||
}
|
||||
// Paragraph styles ⌥⌘0 Normal / ⌥⌘1..3 headings (Ctrl+Shift+N is taken by New Window)
|
||||
const STYLE_KEYS: Record<string, 'p' | 'h1' | 'h2' | 'h3'> = {
|
||||
@@ -3976,6 +4103,9 @@ export function App() {
|
||||
case 'export-pdf':
|
||||
void exportPdf()
|
||||
break
|
||||
case 'export-html':
|
||||
void exportHtml()
|
||||
break
|
||||
case 'print':
|
||||
if (doc) void printDoc()
|
||||
break
|
||||
@@ -3989,6 +4119,7 @@ export function App() {
|
||||
openRecent,
|
||||
save,
|
||||
exportPdf,
|
||||
exportHtml,
|
||||
printDoc,
|
||||
zoomFit,
|
||||
openStats,
|
||||
@@ -4100,8 +4231,9 @@ export function App() {
|
||||
save: () => save(false),
|
||||
getStatus: () => status,
|
||||
exportPdfTo: (path: string) => exportPdf(path),
|
||||
exportHtmlTo: (path: string) => exportHtml(path),
|
||||
}
|
||||
}, [editor, openRecent, save, status, exportPdf])
|
||||
}, [editor, openRecent, save, status, exportPdf, exportHtml])
|
||||
|
||||
// shallow-stable snapshot of every editor read the ribbon displays: caret moves
|
||||
// that change none of it keep the reference, so the memoized Ribbon skips
|
||||
@@ -4543,7 +4675,7 @@ export function App() {
|
||||
showNav={showNav}
|
||||
commentCount={comments.length}
|
||||
openCommentCount={comments.filter((c) => !c.parentId && c.done !== true).length}
|
||||
canComment={!editor.state.selection.empty}
|
||||
canComment={!editor.state.selection.empty || wordRangeAtCaret(editor) !== null}
|
||||
trackChanges={trackChanges}
|
||||
spellcheck={spellcheck}
|
||||
revisionDisplay={revisionDisplay}
|
||||
@@ -4618,7 +4750,16 @@ export function App() {
|
||||
/>
|
||||
)}
|
||||
<div className="editor-area">
|
||||
<main className="editor-scroll" ref={scrollContainerRef}>
|
||||
<main
|
||||
className="editor-scroll"
|
||||
ref={scrollContainerRef}
|
||||
onScroll={(e) => {
|
||||
scrollPosRef.current = {
|
||||
left: e.currentTarget.scrollLeft,
|
||||
top: e.currentTarget.scrollTop,
|
||||
}
|
||||
}}
|
||||
>
|
||||
{doc ? (
|
||||
<div
|
||||
className={docZoomClass}
|
||||
@@ -4632,19 +4773,7 @@ export function App() {
|
||||
editor={editor}
|
||||
onTabStopsChange={(stops) => {
|
||||
if (!editor) return
|
||||
editor
|
||||
.chain()
|
||||
.focus()
|
||||
.updateAttributes('docParagraph', {
|
||||
tabStops: stops ? JSON.stringify(stops) : null,
|
||||
})
|
||||
.updateAttributes('docHeading', {
|
||||
tabStops: stops ? JSON.stringify(stops) : null,
|
||||
})
|
||||
.updateAttributes('docListItem', {
|
||||
tabStops: stops ? JSON.stringify(stops) : null,
|
||||
})
|
||||
.run()
|
||||
setParaAttrs(editor, { tabStops: stops ? JSON.stringify(stops) : null })
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
@@ -4816,6 +4945,7 @@ export function App() {
|
||||
composing={commentComposing}
|
||||
onSubmitNew={submitNewComment}
|
||||
onReply={replyToComment}
|
||||
onEdit={editComment}
|
||||
onResolve={resolveComment}
|
||||
onCancelNew={cancelNewComment}
|
||||
onDelete={deleteComment}
|
||||
|
||||
@@ -2,9 +2,11 @@ import { useEffect, useRef, useState } from 'react'
|
||||
import type { Editor } from '@tiptap/core'
|
||||
import type { Block } from '@genoffice/docx-engine'
|
||||
import { AgentLoop, composeSkills, type AgentImage } from '@genoffice/agent-core'
|
||||
import { imageGenerationAvailable } from '@genoffice/ai-provider/browser'
|
||||
import type { AiSettings, AttachmentAddResult, AttachmentMeta } from '../../shared/ipc'
|
||||
import { ATTACHMENT_IMAGE_EXTS } from '../../shared/ipc'
|
||||
import type { PmNode } from '../editor/convert'
|
||||
import { TABLE_TRAILING_SKIP } from '../editor/extensions'
|
||||
import { countWords, findNumId, type NumIds } from './protocol'
|
||||
import { DOC_NAV_SCHEME, navigateToBlock, parseDocNavHref } from './doc-nav'
|
||||
import { markDocSeen, type AiCommentsAccess, type AiHeaderFooterAccess } from './tools'
|
||||
@@ -17,6 +19,7 @@ import {
|
||||
resolveQueue,
|
||||
type DocsEditQueueItem,
|
||||
} from './edit-queue'
|
||||
import { setInactiveSelectionShown } from '../editor/inactive-selection'
|
||||
import { applyRevisionsBy } from '../editor/revisions'
|
||||
import { DOCS_CONTINUE_INSTRUCTION } from './continuation'
|
||||
import { waitForFullContent } from '../phased-content'
|
||||
@@ -25,7 +28,7 @@ import { createFilesSkill } from './files-skill'
|
||||
import { createElectronTransport } from './transport'
|
||||
import { useI18n, t as tModule, aiLangDirective, type StringKey } from '../i18n/locale'
|
||||
import { Markdown } from '@genoffice/ui'
|
||||
import { AiComposer, AiTypingIndicator } from '@genoffice/ui'
|
||||
import { AiComposer, AiScopeQuote, AiTypingIndicator, type AiScopeQuoteData } from '@genoffice/ui'
|
||||
import { GensparkMark } from '../components/icons'
|
||||
import sendEnterOn from '../assets/send-enter-on.png'
|
||||
import sendEnterOff from '../assets/send-enter-off.png'
|
||||
@@ -82,8 +85,13 @@ interface ChatEntry {
|
||||
snapshot?: PmNode
|
||||
/** attachments consumed from the composer by this user message (read-only echo chips) */
|
||||
attachments?: AttachmentMeta[]
|
||||
/** the selection this user message targeted, frozen at send */
|
||||
scope?: AiScopeQuoteData
|
||||
}
|
||||
|
||||
/** longest selection excerpt echoed on a user bubble */
|
||||
const SCOPE_TEXT_MAX = 200
|
||||
|
||||
/** clickable starter prompts for the empty state (fill the input, do not send) —
|
||||
* blank documents get generation starters, documents with content get edit starters */
|
||||
const DRAFT_STARTER_PROMPTS: StringKey[] = [
|
||||
@@ -423,6 +431,26 @@ export function AiPanel({
|
||||
editorRef.current = editor
|
||||
const settingsRef = useRef(settings)
|
||||
settingsRef.current = settings
|
||||
/** gsk login state for the generate_image gate (refreshed on mount and window focus) */
|
||||
const gskLoggedInRef = useRef(false)
|
||||
useEffect(() => {
|
||||
let alive = true
|
||||
const refresh = () => {
|
||||
// tests render the panel without a preload bridge
|
||||
void window.desktop
|
||||
?.aiGskStatus?.()
|
||||
.then((s) => {
|
||||
if (alive) gskLoggedInRef.current = !!s?.loggedIn
|
||||
})
|
||||
.catch(() => {})
|
||||
}
|
||||
refresh()
|
||||
window.addEventListener('focus', refresh)
|
||||
return () => {
|
||||
alive = false
|
||||
window.removeEventListener('focus', refresh)
|
||||
}
|
||||
}, [])
|
||||
const blocksRef = useRef(blocks)
|
||||
blocksRef.current = blocks
|
||||
const numIdFallbackRef = useRef(numIdFallback)
|
||||
@@ -431,6 +459,8 @@ export function AiPanel({
|
||||
attachmentsRef.current = attachments
|
||||
/** attachments consumed by the most recent send — retry resends the same set */
|
||||
const lastAttachmentsRef = useRef<AttachmentMeta[]>([])
|
||||
/** the scope quote of the last send, so a retry reuses it instead of re-reading the live selection */
|
||||
const lastScopeRef = useRef<AiScopeQuoteData | undefined>(undefined)
|
||||
/** composer attachments plus everything already sent this session (deduped by path) */
|
||||
const availableAttachments = (): AttachmentMeta[] => {
|
||||
const seen = new Set<string>()
|
||||
@@ -508,6 +538,7 @@ export function AiPanel({
|
||||
ext: a.ext ?? '',
|
||||
sizeBytes: a.sizeBytes ?? 0,
|
||||
})),
|
||||
...(m.scope ? { scope: m.scope } : {}),
|
||||
})),
|
||||
)
|
||||
// restore model context: follow-ups after reopening a file continue the previous conversation (only when the loop is idle with no history)
|
||||
@@ -545,6 +576,7 @@ export function AiPanel({
|
||||
output?: string
|
||||
}>,
|
||||
attachments?: AttachmentMeta[],
|
||||
scope?: AiScopeQuoteData,
|
||||
) => {
|
||||
const ids = chatRefIds.current
|
||||
const api = (window as Window & { projectApi?: typeof window.projectApi }).projectApi
|
||||
@@ -566,6 +598,7 @@ export function AiPanel({
|
||||
})),
|
||||
}
|
||||
: {}),
|
||||
...(scope ? { scope } : {}),
|
||||
})
|
||||
.catch(() => {
|
||||
/* silent */
|
||||
@@ -600,6 +633,7 @@ export function AiPanel({
|
||||
() => (trackChangesRef.current ? { author: AI_REVISION_AUTHOR } : undefined),
|
||||
() => commentsAccessRef.current,
|
||||
() => hfAccessRef.current,
|
||||
() => imageGenerationAvailable(settingsRef.current, gskLoggedInRef.current),
|
||||
),
|
||||
createFilesSkill(availableAttachments),
|
||||
]),
|
||||
@@ -754,6 +788,29 @@ export function AiPanel({
|
||||
editor.commands.setTextSelection(editor.state.selection.to)
|
||||
}
|
||||
|
||||
const selectionScopeQuote = (): AiScopeQuoteData | undefined => {
|
||||
const { from, to, empty } = editor.state.selection
|
||||
if (empty) return undefined
|
||||
const text = editor.state.doc.textBetween(from, to, ' ', ' ').replace(/\s+/g, ' ').trim()
|
||||
if (!text) return undefined
|
||||
return {
|
||||
label: t('aiScopeSelection', { words: countWords(text) }),
|
||||
text: text.length > SCOPE_TEXT_MAX ? `${text.slice(0, SCOPE_TEXT_MAX)}…` : text,
|
||||
}
|
||||
}
|
||||
|
||||
// the frozen-range highlight ends with the run, or as soon as the editor is focused again
|
||||
useEffect(() => {
|
||||
if (!busy) setInactiveSelectionShown(editor, false)
|
||||
}, [busy, editor])
|
||||
useEffect(() => {
|
||||
const off = () => setInactiveSelectionShown(editor, false)
|
||||
editor.on('focus', off)
|
||||
return () => {
|
||||
editor.off('focus', off)
|
||||
}
|
||||
}, [editor])
|
||||
|
||||
/** [label](docnav://block/N) links in replies select and scroll to that block */
|
||||
const docNav = {
|
||||
scheme: DOC_NAV_SCHEME,
|
||||
@@ -807,6 +864,8 @@ export function AiPanel({
|
||||
instruction: string,
|
||||
displayInstruction = instruction,
|
||||
attachmentsOverride?: AttachmentMeta[],
|
||||
/** null = a retry that had no scope; undefined = capture the live selection */
|
||||
retryScope?: AiScopeQuoteData | null,
|
||||
) => {
|
||||
const loop = loopRef.current
|
||||
if (!instruction || !loop || loop.busy || pendingSendRef.current) return
|
||||
@@ -823,6 +882,16 @@ export function AiPanel({
|
||||
setAttachments([])
|
||||
}
|
||||
lastAttachmentsRef.current = sentAtts
|
||||
// the queue batch and the continue action carry their own display text: no selection quote
|
||||
const scope =
|
||||
retryScope !== undefined
|
||||
? (retryScope ?? undefined)
|
||||
: displayInstruction === instruction
|
||||
? selectionScopeQuote()
|
||||
: undefined
|
||||
lastScopeRef.current = scope
|
||||
// the popover input / composer own the DOM selection now: keep the targeted range visible until the run ends
|
||||
if (scope) setInactiveSelectionShown(editor, true)
|
||||
instructionRef.current = instruction
|
||||
lastInstructionRef.current = instruction
|
||||
runToolsRef.current = []
|
||||
@@ -834,6 +903,7 @@ export function AiPanel({
|
||||
role: 'user',
|
||||
text: displayInstruction,
|
||||
...(sentAtts.length > 0 ? { attachments: sentAtts } : {}),
|
||||
...(scope ? { scope } : {}),
|
||||
},
|
||||
{ role: 'assistant', text: '', streaming: true },
|
||||
])
|
||||
@@ -843,7 +913,7 @@ export function AiPanel({
|
||||
const generation = currentDocGeneration()
|
||||
const pending = { aborted: false }
|
||||
pendingSendRef.current = pending
|
||||
persistMessage('user', instruction, undefined, sentAtts)
|
||||
persistMessage('user', instruction, undefined, sentAtts, scope)
|
||||
// a rejected image read must not strand the run (busy would stay true forever): degrade to a no-image send
|
||||
void collectImageAttachments(sentAtts)
|
||||
.catch((): AgentImage[] => {
|
||||
@@ -895,7 +965,12 @@ export function AiPanel({
|
||||
}
|
||||
|
||||
const retry = () =>
|
||||
runWith(lastInstructionRef.current, lastInstructionRef.current, lastAttachmentsRef.current)
|
||||
runWith(
|
||||
lastInstructionRef.current,
|
||||
lastInstructionRef.current,
|
||||
lastAttachmentsRef.current,
|
||||
lastScopeRef.current ?? null,
|
||||
)
|
||||
|
||||
const continueRun = () => runWith(DOCS_CONTINUE_INSTRUCTION, t('aiContinue'))
|
||||
|
||||
@@ -983,7 +1058,11 @@ export function AiPanel({
|
||||
}
|
||||
|
||||
const rollback = (entryIdx: number, snapshot: PmNode) => {
|
||||
editor.commands.setContent(snapshot as never)
|
||||
editor
|
||||
.chain()
|
||||
.setMeta(TABLE_TRAILING_SKIP, true)
|
||||
.setContent(snapshot as never)
|
||||
.run()
|
||||
// The document rewound to before this turn, so this and every later
|
||||
// rollback point now describe discarded futures
|
||||
setChat((prev) =>
|
||||
@@ -1103,6 +1182,7 @@ export function AiPanel({
|
||||
<>
|
||||
{historicChat.map((entry, i) => (
|
||||
<div key={`h${i}`} className={`ai-msg ai-msg-${entry.role} ai-msg-historic`}>
|
||||
{entry.role === 'user' && entry.scope && <AiScopeQuote scope={entry.scope} />}
|
||||
{entry.role === 'user' && entry.attachments && entry.attachments.length > 0 && (
|
||||
<SentAttachments atts={entry.attachments} previews={attachmentPreviews} />
|
||||
)}
|
||||
@@ -1169,6 +1249,7 @@ export function AiPanel({
|
||||
key={i}
|
||||
className={`ai-msg ai-msg-${entry.role}${entry.role === 'assistant' && entry.streaming ? ' ai-msg-streaming' : ''}`}
|
||||
>
|
||||
{entry.role === 'user' && entry.scope && <AiScopeQuote scope={entry.scope} />}
|
||||
{entry.role === 'user' && entry.attachments && entry.attachments.length > 0 && (
|
||||
<SentAttachments atts={entry.attachments} previews={attachmentPreviews} />
|
||||
)}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,56 @@
|
||||
import type { Editor } from '@tiptap/core'
|
||||
import type { Node as ProseMirrorNode } from '@tiptap/pm/model'
|
||||
|
||||
/** ProseMirror positions of a top-level child index range */
|
||||
export function blockRangePositions(
|
||||
editor: Editor,
|
||||
startIndex: number,
|
||||
endIndex: number,
|
||||
): { from: number; to: number } {
|
||||
const doc = editor.state.doc
|
||||
let from = 0
|
||||
let to = 0
|
||||
let index = 0
|
||||
doc.forEach((node, offset) => {
|
||||
if (index === startIndex) from = offset
|
||||
if (index === endIndex) to = offset + node.nodeSize
|
||||
index++
|
||||
})
|
||||
return { from, to }
|
||||
}
|
||||
|
||||
// ---- tracked deletions (pending revisions are not current content) ----
|
||||
|
||||
const hasDelMark = (node: ProseMirrorNode) => node.marks.some((m) => m.type.name === 'del')
|
||||
|
||||
/** block text as it reads once pending tracked deletions are applied (textContent minus del runs) */
|
||||
export function liveText(node: ProseMirrorNode): string {
|
||||
if ((node.attrs?.blockRevision as { kind?: string } | null)?.kind === 'del') return ''
|
||||
let out = ''
|
||||
const walk = (child: ProseMirrorNode): void => {
|
||||
if (hasDelMark(child)) return
|
||||
if (child.isText) out += child.text ?? ''
|
||||
else if (child.isLeaf) out += child.type.spec.leafText?.(child) ?? ''
|
||||
else child.forEach(walk)
|
||||
}
|
||||
node.forEach(walk)
|
||||
return out
|
||||
}
|
||||
|
||||
/**
|
||||
* The whole block is a pending deletion revision (struck through in the editor).
|
||||
* Checked structurally, not by text length: atom leaves (inline formulas, ruby)
|
||||
* carry no textContent, so a live formula must still count as live content.
|
||||
*/
|
||||
export function isTrackedDeleted(node: ProseMirrorNode): boolean {
|
||||
if ((node.attrs?.blockRevision as { kind?: string } | null)?.kind === 'del') return true
|
||||
let hasContent = false
|
||||
let hasLive = false
|
||||
node.descendants((child) => {
|
||||
if (child.isText || (child.isInline && child.isLeaf)) {
|
||||
hasContent = true
|
||||
if (!hasDelMark(child)) hasLive = true
|
||||
}
|
||||
})
|
||||
return hasContent && !hasLive
|
||||
}
|
||||
@@ -16,6 +16,9 @@ import {
|
||||
type FrozenSelection,
|
||||
} from './tools'
|
||||
|
||||
const IMAGE_GEN_OFF_NOTE =
|
||||
'\n\nNote: generate_image is currently unavailable (no image provider: signed out of Genspark or cloud tools off, and no media API key in Settings). Do not call or promise it; use image_search for imagery.'
|
||||
|
||||
/**
|
||||
* The docx capability as an AgentSkill: document skeleton context, the five
|
||||
* document tools, and the local executor. Future apps register their own
|
||||
@@ -27,6 +30,8 @@ export function createDocsSkill(
|
||||
getTrack?: () => AiTrack | undefined,
|
||||
getComments?: () => AiCommentsAccess | undefined,
|
||||
getHf?: () => AiHeaderFooterAccess | undefined,
|
||||
/** live predicate (gsk login && cloud-tools toggle, or a BYOK media key); false hides generate_image */
|
||||
imageGenAvailable?: () => boolean,
|
||||
): AgentSkill {
|
||||
// Selection frozen per run: tools act on the range the prompt described,
|
||||
// not on wherever the user's live selection has wandered mid-run. The doc
|
||||
@@ -34,8 +39,17 @@ export function createDocsSkill(
|
||||
let frozen: FrozenSelection | null = null
|
||||
return {
|
||||
id: 'docx',
|
||||
systemPrompt: AGENT_SYSTEM_PROMPT,
|
||||
tools: AGENT_TOOLS,
|
||||
// live: the predicate is re-read before every model request
|
||||
get systemPrompt() {
|
||||
return imageGenAvailable?.() === false
|
||||
? AGENT_SYSTEM_PROMPT + IMAGE_GEN_OFF_NOTE
|
||||
: AGENT_SYSTEM_PROMPT
|
||||
},
|
||||
get tools() {
|
||||
return imageGenAvailable?.() === false
|
||||
? AGENT_TOOLS.filter((t) => t.name !== 'generate_image')
|
||||
: AGENT_TOOLS
|
||||
},
|
||||
buildContext: () => {
|
||||
const editor = getEditor()
|
||||
markDocSeen(editor) // the context the model receives is the freshness baseline for index-addressed writes
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,6 @@
|
||||
import type { Editor } from '@tiptap/core'
|
||||
import type { Node as ProseMirrorNode } from '@tiptap/pm/model'
|
||||
import { TextSelection } from '@tiptap/pm/state'
|
||||
import {
|
||||
TABLE_HEADER_FILL,
|
||||
type Block,
|
||||
@@ -12,6 +13,10 @@ import { equationBlockJson, inlineEquationNodeJson } from '../editor/equation'
|
||||
import { inheritFrom, inheritTableFormatting, sameBlockRole } from './inherit-formatting'
|
||||
import { collectRevisions, TRACK_IGNORE, type RevisionRange } from '../editor/revisions'
|
||||
import { countWords } from '../word-count'
|
||||
import { blockRangePositions, isTrackedDeleted, liveText } from './doc-utils'
|
||||
import { opSignatures } from './ops'
|
||||
|
||||
export { blockRangePositions, isTrackedDeleted, liveText }
|
||||
|
||||
/**
|
||||
* Agent protocol: the model runs a multi-turn tool-use loop — it reads the document skeleton
|
||||
@@ -29,59 +34,53 @@ const PREVIEW_MAX_CHARS = 60
|
||||
const PREVIEW_TIGHT_CHARS = 20
|
||||
|
||||
/**
|
||||
* Guide for the apply_commands tool: format,
|
||||
* structure and batch operations travel as a batchUpdate-style JSON envelope
|
||||
* executed deterministically by commands.ts.
|
||||
* Guide for the apply_ops tool: format, structure and batch operations travel
|
||||
* as a flat op list executed atomically by ops.ts. The signature lines come
|
||||
* from the op registry, so the guide cannot drift from the implementation.
|
||||
*/
|
||||
export const COMMANDS_GUIDE = [
|
||||
"The command format mimics documents.batchUpdate of the Google Docs API: each command is a single-key object; the fields array has the same semantics as Google's FieldMask — only the listed fields are updated, everything not listed is left untouched. Differences from Google: target uses semantic addressing (node type / text containment / block index), colors are 6-digit hex (no #), lengths are in twips, font sizes are in half-points.",
|
||||
export const OPS_GUIDE = [
|
||||
'apply_ops runs a list of ops as ONE atomic transaction: every op is validated first and any invalid op rejects the whole batch (the error quotes the op\'s usage line). Each op is a flat object { op, target?, ...fields }. Fields are patches: a present field is set, null clears it, an absent field is left untouched — never repeat properties the user did not ask to change. Colors are "#RRGGBB", font sizes are points, lengths are twips (1 pt = 20 twips). Pass dryRun: true to validate and see the plan without changing the document.',
|
||||
'',
|
||||
'The commands input is an array of commands executed in order. Command schema (TypeScript):',
|
||||
'Target (all conditions are ANDed; provide at least one):',
|
||||
'```',
|
||||
'interface Target { // all conditions are ANDed; provide at least one',
|
||||
'interface Target {',
|
||||
" nodeType?: 'docHeading' | 'docParagraph' | 'docListItem' | 'image' // image = image block",
|
||||
" headingLevel?: number // only together with nodeType: 'docHeading'",
|
||||
' containsText?: string // block plain text contains this substring',
|
||||
' matchCase?: boolean // defaults to true',
|
||||
' blockIndexes?: number[] // indexes from the "document block list"',
|
||||
" scope?: 'selection' | 'document' // selection = only blocks covered by the current selection",
|
||||
" scope?: 'selection' | 'document' // selection = only blocks covered by the current selection; when part of a block is selected, setFont / setMatchedFont / findReplace act only on the selected characters (paragraph-level ops still apply to the whole block)",
|
||||
'}',
|
||||
"{ updateTextStyle: { target, style: { color?, highlight?, sizeHalfPoints?, font?, bold?, italic?, underline?, strike?, baselineOffset?: 'SUPERSCRIPT'|'SUBSCRIPT'|'NONE', link?: {url}|null }, fields: string[] } } // value null = clear that property; font applies only to its own script's slot (an East Asian font keeps the run's Latin font and vice versa)",
|
||||
"{ updateParagraphStyle: { target, style: { align?: 'left'|'center'|'right'|'justify', lineSpacing?, indentLeft?, indentRight?, indentFirstLine?, spaceBefore?, spaceAfter?, pageBreakBefore?, shadingFill?, borders?: subset of 'tblr'|null }, fields: string[] } } // indentFirstLine positive = first-line indent, negative = hanging; a two-character indent for CJK text ≈ font size in pt × 40 twips",
|
||||
'{ setHeadingLevel: { target, level: 0-6 } } // 0 = demote to body paragraph',
|
||||
"{ replaceAllText: { containsText, replaceText, matchCase?, target? } } // target narrows the scanned blocks (blockIndexes / scope:'selection' / nodeType); omitted = whole document. The replacement keeps the matched text's formatting — the right tool for small in-place fixes (a few words inside a sentence)",
|
||||
'{ updateMatchedTextStyle: { containsText, matchCase?, target?, style, fields } } // character-level styling: applies the run style (same style/fields as updateTextStyle) only to the matched text itself, not the whole block',
|
||||
'{ deleteBlocks: { target } }',
|
||||
'{ moveBlocks: { blockIndexes: number[], afterBlockIndex: number } } // -1 = start of document',
|
||||
'{ createParagraphBullets: { target, bulletPreset? } } // paragraphs to list; BULLET_* prefix = unordered, NUMBERED_* = ordered (default unordered); heading blocks are not converted',
|
||||
'{ deleteParagraphBullets: { target } } // list items back to body paragraphs',
|
||||
"{ updateImageProperties: { target, properties: { widthPx?, heightPx?, align?: 'left'|'center'|'right' }, fields } } // image blocks only; giving one dimension scales proportionally",
|
||||
'{ insertToc: { afterBlockIndex } } // insert a TOC field after that block index (-1 = start of document); entries come from current headings, Word computes page numbers on open; fails if the document has no headings',
|
||||
'```',
|
||||
'Ops:',
|
||||
'```',
|
||||
...opSignatures(),
|
||||
'```',
|
||||
'',
|
||||
'Common recipes:',
|
||||
'- "Make all headings red" → commands: [{"updateTextStyle":{"target":{"nodeType":"docHeading"},"style":{"color":"FF0000"},"fields":["color"]}}]',
|
||||
'- "1.5 line spacing for the whole document" → one updateParagraphStyle each for docParagraph / docHeading / docListItem, style {"lineSpacing":1.5}, fields ["lineSpacing"]',
|
||||
'- "Demote the \'Risk Notice\' level-2 heading to level 3" → commands: [{"setHeadingLevel":{"target":{"nodeType":"docHeading","headingLevel":2,"containsText":"Risk Notice"},"level":3}}]',
|
||||
'- "Delete blocks 3 to 5" → commands: [{"deleteBlocks":{"target":{"blockIndexes":[3,4,5]}}}]',
|
||||
'- "Turn blocks 2 to 4 into a numbered list" → commands: [{"createParagraphBullets":{"target":{"blockIndexes":[2,3,4]},"bulletPreset":"NUMBERED_DECIMAL_ALPHA_ROMAN"}}]',
|
||||
'- "Center all images" → commands: [{"updateImageProperties":{"target":{"nodeType":"image"},"properties":{"align":"center"},"fields":["align"]}}]',
|
||||
'- "In block 5, change 8% to 9%" → commands: [{"replaceAllText":{"containsText":"8%","replaceText":"9%","target":{"blockIndexes":[5]}}}]',
|
||||
'- "Bold every TODO:" → commands: [{"updateMatchedTextStyle":{"containsText":"TODO:","style":{"bold":true},"fields":["bold"]}}]',
|
||||
'- "Two-character first-line indent for the whole document" (11 pt font) → one updateParagraphStyle for docParagraph, style {"indentFirstLine":440}, fields ["indentFirstLine"]',
|
||||
'- "Insert a table of contents at the beginning" → commands: [{"insertToc":{"afterBlockIndex":-1}}]; if the user wants the TOC on its own page, also apply updateParagraphStyle to the first body block after the TOC with style {"pageBreakBefore":true}, fields ["pageBreakBefore"]',
|
||||
'- Cover page recipe: use insert_content to insert one paragraph each for title/subtitle/date at the start of the document, then updateTextStyle to enlarge the title font (e.g. {"sizeHalfPoints":72}, fields ["sizeHalfPoints"]), updateParagraphStyle to center everything and give the title {"spaceBefore":4800}, and finally set {"pageBreakBefore":true} on the first body block after the cover',
|
||||
'- "Make all headings red" → ops: [{"op":"setFont","target":{"nodeType":"docHeading"},"color":"#FF0000"}]',
|
||||
'- "1.5 line spacing for the whole document" → one setParagraphFormat each for docParagraph / docHeading / docListItem with "lineSpacing":1.5',
|
||||
'- "Demote the \'Risk Notice\' level-2 heading to level 3" → ops: [{"op":"setHeadingLevel","target":{"nodeType":"docHeading","headingLevel":2,"containsText":"Risk Notice"},"level":3}]',
|
||||
'- "Delete blocks 3 to 5" → ops: [{"op":"deleteBlocks","target":{"blockIndexes":[3,4,5]}}]',
|
||||
'- "Turn blocks 2 to 4 into a numbered list" → ops: [{"op":"setList","target":{"blockIndexes":[2,3,4]},"kind":"number"}]',
|
||||
'- "Center all images" → ops: [{"op":"setImageProperties","target":{"nodeType":"image"},"align":"center"}]',
|
||||
'- "In block 5, change 8% to 9%" → ops: [{"op":"findReplace","find":"8%","replace":"9%","target":{"blockIndexes":[5]}}]',
|
||||
'- "Bold every TODO:" → ops: [{"op":"setMatchedFont","text":"TODO:","bold":true}]',
|
||||
'- "Make the selected words 14 pt blue" (partial selection) → ops: [{"op":"setFont","target":{"scope":"selection"},"fontSize":14,"color":"#1A73E8"}]',
|
||||
'- "Two-character first-line indent for the whole document" (11 pt font) → one setParagraphFormat for docParagraph with "indentFirstLine":440',
|
||||
'- "Insert a table of contents at the beginning" → ops: [{"op":"insertToc","afterBlockIndex":-1}]; if the user wants the TOC on its own page, also setParagraphFormat the first body block after the TOC with "pageBreakBefore":true',
|
||||
'- Cover page recipe: use insert_content to insert one paragraph each for title/subtitle/date at the start of the document, then setFont to enlarge the title (e.g. "fontSize":36), setParagraphFormat to center everything and give the title "spaceBefore":4800, and finally set "pageBreakBefore":true on the first body block after the cover',
|
||||
'',
|
||||
'Discipline:',
|
||||
'- Read the "document block list" before issuing commands; anything like "paragraph N / a certain section" must be addressed with block indexes from the list — never guess;',
|
||||
'- Put only the properties the user explicitly asked for into fields;',
|
||||
'- Protected blocks such as images cannot be modified with style commands (they are skipped); to change table content, use read_blocks to get the <table> and rewrite it wholesale with replace_blocks (the table keeps its column widths, borders, shading and cell formatting; cells whose text you leave unchanged keep their content untouched).',
|
||||
'- Read the "document block list" before issuing ops; anything like "paragraph N / a certain section" must be addressed with block indexes from the list — never guess;',
|
||||
'- Only give the fields the user explicitly asked to change;',
|
||||
'- Protected blocks such as images cannot be modified with style ops (they are skipped); to change table content, use read_blocks to get the <table> and rewrite it wholesale with replace_blocks (the table keeps its column widths, borders, shading and cell formatting; cells whose text you leave unchanged keep their content untouched).',
|
||||
'',
|
||||
'Known error cases (must avoid):',
|
||||
'BC-1 Putting properties the user did not ask for into fields, wiping existing formatting by mistake;',
|
||||
'BC-1 Giving fields the user did not ask for, wiping existing formatting by mistake;',
|
||||
'BC-2 A "whole document" formatting operation only changed docParagraph and missed docHeading/docListItem;',
|
||||
'BC-3 Addressing by word/character position (no such addressing exists); use block indexes or text containment instead;',
|
||||
'BC-4 Using replaceAllText sentence by sentence for rewrites such as translation/abbreviation; use the replace_blocks tool instead;',
|
||||
'BC-3 Addressing by word/character position (no such addressing exists); use block indexes, text containment or the selection instead;',
|
||||
'BC-4 Using findReplace sentence by sentence for rewrites such as translation/abbreviation; use replace_blocks (or replace_selection for a selected span) instead;',
|
||||
].join('\n')
|
||||
|
||||
const HTML_RULES = [
|
||||
@@ -91,6 +90,7 @@ const HTML_RULES = [
|
||||
'- Use <pre> for code samples (monospace font + shading, line breaks preserved); use <blockquote> for quotations (indent + left bar)',
|
||||
'- Use <formula>LaTeX</formula> for math (produces native Word equations): as a top-level block it becomes its own centered paragraph; placed inside <p>/<li>/<h*> text it is an inline formula flowing with the text, e.g. <p>From <formula>E = mc^2</formula> we know…</p>; supports the common subset of \\frac \\sqrt super/subscripts \\sum \\int \\lim matrix environments Greek letters etc., the align environment is not supported; invalid LaTeX fails the whole call — fix and retry',
|
||||
'- Do not include <html>/<body>, markdown code fences, or explanatory text',
|
||||
"- <sel>…</sel> appears only in the context to mark the user's selection; it is not a tag you may write",
|
||||
'- Organize long content into sections with h2/h3 (unless the user only wants a single paragraph)',
|
||||
'- Keep the same language as the original document / user instruction, unless translation is requested',
|
||||
].join('\n')
|
||||
@@ -112,9 +112,10 @@ export const AGENT_SYSTEM_PROMPT = [
|
||||
'- Every user message carries the latest "document block list" (index|type|content preview; previews may be truncated); after modifications, call get_document_context if you need the latest state;',
|
||||
'- When a list preview is truncated, read the full content with read_blocks before rewriting; never rewrite based on a truncated preview;',
|
||||
'- Content changes: use insert_content for new content, and replace_blocks to rewrite/replace existing blocks (pass a block index range and the new HTML); replaced blocks pass their paragraph and text formatting (font, size, color, indent, spacing, alignment) on to the new blocks automatically, and a rewritten table keeps its widths, borders, shading and cell formatting, so a rewrite never needs follow-up formatting commands;',
|
||||
'- Formatting, structure, and batch operations (color/font size/line spacing/alignment/indent/heading level/find & replace/delete/move/list conversion) go through apply_commands — do not rewrite whole blocks with replace_blocks;',
|
||||
'- Small in-place text fixes (changing a few words inside a sentence) go through apply_commands replaceAllText with a target — do not rewrite the whole block; styling every occurrence of a phrase (e.g. bold each "TODO") uses updateMatchedTextStyle;',
|
||||
'- Formatting, structure, and batch operations (color/font size/line spacing/alignment/indent/heading level/find & replace/delete/move/list conversion) go through apply_ops — do not rewrite whole blocks with replace_blocks;',
|
||||
'- Small in-place text fixes (changing a few words inside a sentence) go through apply_ops findReplace with a target — do not rewrite the whole block; styling every occurrence of a phrase (e.g. bold each "TODO") uses setMatchedFont;',
|
||||
'- When the user has text selected, the message includes the selection block indexes and content; rewrite-style requests apply to the selection by default;',
|
||||
'- When only part of a block is selected, the selected span is delimited by <sel>…</sel> and repeated as "Selected text": "this"/"the selected text" means exactly that span. Restyle it with apply_ops and target {"scope":"selection"} (run-level ops then touch only the selected characters); rewrite it with replace_selection. Never restyle or rewrite the whole block for a partial selection;',
|
||||
'- Web search: use web_search when you need up-to-date information/data/fact checking; search before writing about uncertain facts — do not fabricate;',
|
||||
'- Illustrations: when the user wants pictures, first image_search (English keywords work better) → pick a suitable result → insert_image with its imageUrl; when the user asks to generate/draw a picture, or search cannot match the needed illustration, use generate_image with a detailed English prompt;',
|
||||
'- Tracked deletions (struck-through revision text) are not part of the current content and are hidden from the block list/read_blocks/stats; when a [tracked deletion] tag or a skipped-deletion notice appears, that text is already deleted — never try to delete or rewrite it again (the user accepts/rejects revisions in the Review tab);',
|
||||
@@ -130,7 +131,7 @@ export const AGENT_SYSTEM_PROMPT = [
|
||||
'',
|
||||
'# Template filling',
|
||||
'- When the user asks to fill in a template/form, first scan the document for placeholders: [bracketed labels], {{curly names}}, runs of underscores (____), and protected content-control blocks whose label reads as a field.',
|
||||
"- List every placeholder found (with block indexes). Fill the ones the user's message answers via replaceAllText with a target so the surrounding formatting survives; for the rest, ask for the missing values in one consolidated question — never invent facts to fill a field.",
|
||||
"- List every placeholder found (with block indexes). Fill the ones the user's message answers via findReplace with a target so the surrounding formatting survives; for the rest, ask for the missing values in one consolidated question — never invent facts to fill a field.",
|
||||
"- Dates follow the user's locale; never change text outside the placeholders.",
|
||||
'',
|
||||
'# Headers & footers',
|
||||
@@ -150,8 +151,8 @@ export const AGENT_SYSTEM_PROMPT = [
|
||||
'# HTML fragment rules',
|
||||
HTML_RULES,
|
||||
'',
|
||||
'# apply_commands command guide',
|
||||
COMMANDS_GUIDE,
|
||||
'# apply_ops guide',
|
||||
OPS_GUIDE,
|
||||
].join('\n')
|
||||
|
||||
export { countWords }
|
||||
@@ -164,6 +165,9 @@ export interface SelectionScope {
|
||||
endIndex: number
|
||||
/** true when the user has an actual range selected (not just a caret) */
|
||||
isRange: boolean
|
||||
/** exact ProseMirror positions; run-level commands narrow to them when the range is partial */
|
||||
from?: number
|
||||
to?: number
|
||||
}
|
||||
|
||||
export function getSelectionScope(editor: Editor): SelectionScope {
|
||||
@@ -188,61 +192,31 @@ export function getSelectionScope(editor: Editor): SelectionScope {
|
||||
startIndex = doc.childCount - 1
|
||||
endIndex = doc.childCount - 1
|
||||
}
|
||||
return { startIndex, endIndex, isRange: !empty }
|
||||
}
|
||||
|
||||
/** ProseMirror positions of a top-level child index range */
|
||||
export function blockRangePositions(
|
||||
editor: Editor,
|
||||
startIndex: number,
|
||||
endIndex: number,
|
||||
): { from: number; to: number } {
|
||||
const doc = editor.state.doc
|
||||
let from = 0
|
||||
let to = 0
|
||||
let index = 0
|
||||
doc.forEach((node, offset) => {
|
||||
if (index === startIndex) from = offset
|
||||
if (index === endIndex) to = offset + node.nodeSize
|
||||
index++
|
||||
})
|
||||
return { from, to }
|
||||
}
|
||||
|
||||
// ---- tracked deletions (pending revisions are not current content) ----
|
||||
|
||||
const hasDelMark = (node: ProseMirrorNode) => node.marks.some((m) => m.type.name === 'del')
|
||||
|
||||
/** block text as it reads once pending tracked deletions are applied (textContent minus del runs) */
|
||||
export function liveText(node: ProseMirrorNode): string {
|
||||
if ((node.attrs?.blockRevision as { kind?: string } | null)?.kind === 'del') return ''
|
||||
let out = ''
|
||||
const walk = (child: ProseMirrorNode): void => {
|
||||
if (hasDelMark(child)) return
|
||||
if (child.isText) out += child.text ?? ''
|
||||
else if (child.isLeaf) out += child.type.spec.leafText?.(child) ?? ''
|
||||
else child.forEach(walk)
|
||||
}
|
||||
node.forEach(walk)
|
||||
return out
|
||||
return { startIndex, endIndex, isRange: !empty, from, to }
|
||||
}
|
||||
|
||||
/**
|
||||
* The whole block is a pending deletion revision (struck through in the editor).
|
||||
* Checked structurally, not by text length: atom leaves (inline formulas, ruby)
|
||||
* carry no textContent, so a live formula must still count as live content.
|
||||
* The character-precise part of a range selection, clamped to its block range;
|
||||
* null when the selection covers the blocks whole (or carries no positions).
|
||||
*/
|
||||
export function isTrackedDeleted(node: ProseMirrorNode): boolean {
|
||||
if ((node.attrs?.blockRevision as { kind?: string } | null)?.kind === 'del') return true
|
||||
let hasContent = false
|
||||
let hasLive = false
|
||||
node.descendants((child) => {
|
||||
if (child.isText || (child.isInline && child.isLeaf)) {
|
||||
hasContent = true
|
||||
if (!hasDelMark(child)) hasLive = true
|
||||
}
|
||||
})
|
||||
return hasContent && !hasLive
|
||||
export function partialSelection(
|
||||
editor: Editor,
|
||||
scope: SelectionScope,
|
||||
): { from: number; to: number } | null {
|
||||
if (!scope.isRange || scope.from === undefined || scope.to === undefined) return null
|
||||
const doc = editor.state.doc
|
||||
if (scope.startIndex < 0 || scope.endIndex >= doc.childCount) return null
|
||||
const { from, to } = blockRangePositions(editor, scope.startIndex, scope.endIndex)
|
||||
const first = doc.child(scope.startIndex)
|
||||
const last = doc.child(scope.endIndex)
|
||||
// character precision exists only for top-level text blocks; a range that
|
||||
// starts or ends inside a table / protected block keeps whole-block semantics
|
||||
if (!first.isTextblock || !last.isTextblock) return null
|
||||
if (scope.from <= from + 1 && scope.to >= to - 1) return null
|
||||
return {
|
||||
from: Math.min(Math.max(scope.from, from), to),
|
||||
to: Math.min(Math.max(scope.to, from), to),
|
||||
}
|
||||
}
|
||||
|
||||
// ---- blocks -> restricted HTML ----
|
||||
@@ -251,39 +225,82 @@ function escapeHtml(text: string): string {
|
||||
return text.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>')
|
||||
}
|
||||
|
||||
function inlineToHtml(content: PmNode[] | undefined): string {
|
||||
function wrapInlineText(raw: string, marks: PmMark[]): string {
|
||||
let text = escapeHtml(raw)
|
||||
const has = (type: string) => marks.some((m: PmMark) => m.type === type)
|
||||
if (has('bold')) text = `<strong>${text}</strong>`
|
||||
if (has('italic')) text = `<em>${text}</em>`
|
||||
if (has('underline')) text = `<u>${text}</u>`
|
||||
if (has('strike')) text = `<s>${text}</s>`
|
||||
const link = marks.find((m: PmMark) => m.type === 'link')
|
||||
if (link?.attrs?.href) text = `<a href="${escapeHtml(String(link.attrs.href))}">${text}</a>`
|
||||
return text
|
||||
}
|
||||
|
||||
function inlineAtomToHtml(node: PmNode): string {
|
||||
if (node.type === 'hardBreak') return '<br>'
|
||||
if (node.type === 'docInlineMath') {
|
||||
// editor-created formulas round-trip as LaTeX; parsed-from-docx ones
|
||||
// degrade to the flat token strip (structure lost if the model rewrites)
|
||||
const source = String(node.attrs?.latex ?? '') || String(node.attrs?.text ?? '')
|
||||
return source ? `<formula>${escapeHtml(source)}</formula>` : ''
|
||||
}
|
||||
if (node.type === 'docRuby') return escapeHtml(String(node.attrs?.base ?? ''))
|
||||
return ''
|
||||
}
|
||||
|
||||
/** Character offsets (relative to the block's content start) of the user's selection inside this block */
|
||||
export interface InlineSelection {
|
||||
from: number
|
||||
to: number
|
||||
}
|
||||
|
||||
/**
|
||||
* Inline content as restricted HTML. With `sel`, the selected span is
|
||||
* delimited by <sel>…</sel> (text nodes split at the boundaries). Every inline
|
||||
* node other than text is an atom, so it occupies exactly one position.
|
||||
*/
|
||||
function inlineToHtml(content: PmNode[] | undefined, sel?: InlineSelection): string {
|
||||
if (!content) return ''
|
||||
let html = ''
|
||||
for (const node of content) {
|
||||
// del-marked runs are pending deletions, not current content
|
||||
if ((node.marks ?? []).some((m: PmMark) => m.type === 'del')) continue
|
||||
if (node.type === 'hardBreak') {
|
||||
html += '<br>'
|
||||
continue
|
||||
let pos = 0
|
||||
let open = false
|
||||
let pending = sel && sel.from < sel.to ? sel : null
|
||||
const boundary = (at: number) => {
|
||||
if (!pending) return
|
||||
if (!open && at >= pending.from && at < pending.to) {
|
||||
html += '<sel>'
|
||||
open = true
|
||||
}
|
||||
if (node.type === 'docInlineMath') {
|
||||
// editor-created formulas round-trip as LaTeX; parsed-from-docx ones
|
||||
// degrade to the flat token strip (structure lost if the model rewrites)
|
||||
const source = String(node.attrs?.latex ?? '') || String(node.attrs?.text ?? '')
|
||||
if (source) html += `<formula>${escapeHtml(source)}</formula>`
|
||||
continue
|
||||
if (open && at >= pending.to) {
|
||||
html += '</sel>'
|
||||
open = false
|
||||
pending = null
|
||||
}
|
||||
if (node.type === 'docRuby') {
|
||||
html += escapeHtml(String(node.attrs?.base ?? ''))
|
||||
continue
|
||||
}
|
||||
if (node.type !== 'text' || !node.text) continue
|
||||
let text = escapeHtml(node.text)
|
||||
const marks = node.marks ?? []
|
||||
const has = (type: string) => marks.some((m: PmMark) => m.type === type)
|
||||
if (has('bold')) text = `<strong>${text}</strong>`
|
||||
if (has('italic')) text = `<em>${text}</em>`
|
||||
if (has('underline')) text = `<u>${text}</u>`
|
||||
if (has('strike')) text = `<s>${text}</s>`
|
||||
const link = marks.find((m: PmMark) => m.type === 'link')
|
||||
if (link?.attrs?.href) text = `<a href="${escapeHtml(String(link.attrs.href))}">${text}</a>`
|
||||
html += text
|
||||
}
|
||||
for (const node of content) {
|
||||
// del-marked runs are pending deletions, not current content (but they still occupy positions)
|
||||
const deleted = (node.marks ?? []).some((m: PmMark) => m.type === 'del')
|
||||
if (node.type === 'text') {
|
||||
const text = node.text ?? ''
|
||||
const marks = node.marks ?? []
|
||||
const end = pos + text.length
|
||||
const cuts = [pos]
|
||||
if (pending) for (const c of [pending.from, pending.to]) if (c > pos && c < end) cuts.push(c)
|
||||
cuts.push(end)
|
||||
for (let i = 0; i < cuts.length - 1; i++) {
|
||||
boundary(cuts[i])
|
||||
if (!deleted) html += wrapInlineText(text.slice(cuts[i] - pos, cuts[i + 1] - pos), marks)
|
||||
}
|
||||
pos = end
|
||||
continue
|
||||
}
|
||||
boundary(pos)
|
||||
if (!deleted) html += inlineAtomToHtml(node)
|
||||
pos += 1
|
||||
}
|
||||
boundary(pos)
|
||||
if (open) html += '</sel>'
|
||||
return html
|
||||
}
|
||||
|
||||
@@ -296,6 +313,31 @@ function inlineToPlainText(content: PmNode[] | undefined): string {
|
||||
.join('')
|
||||
}
|
||||
|
||||
/** <pre> body: escaped plain text, the selected span delimited by <sel>…</sel> like the rich blocks */
|
||||
function codeToHtml(content: PmNode[] | undefined, sel?: InlineSelection): string {
|
||||
if (!content) return ''
|
||||
const plain = inlineToPlainText(content)
|
||||
if (!sel || sel.from >= sel.to) return escapeHtml(plain)
|
||||
// deleted runs are dropped from the text but still occupy positions: map positions to text offsets
|
||||
let pos = 0
|
||||
let offset = 0
|
||||
let start = -1
|
||||
let end = -1
|
||||
for (const n of content) {
|
||||
const size = n.type === 'text' ? (n.text ?? '').length : 1
|
||||
const kept = !(n.marks ?? []).some((m: PmMark) => m.type === 'del')
|
||||
const width = kept ? (n.type === 'text' ? size : n.type === 'hardBreak' ? 1 : 0) : 0
|
||||
if (start < 0 && sel.from < pos + size)
|
||||
start = offset + (kept ? Math.max(sel.from - pos, 0) : 0)
|
||||
if (end < 0 && sel.to <= pos + size) end = offset + (kept ? Math.max(sel.to - pos, 0) : 0)
|
||||
pos += size
|
||||
offset += width
|
||||
}
|
||||
if (start < 0) start = plain.length
|
||||
if (end < 0) end = plain.length
|
||||
return `${escapeHtml(plain.slice(0, start))}<sel>${escapeHtml(plain.slice(start, end))}</sel>${escapeHtml(plain.slice(end))}`
|
||||
}
|
||||
|
||||
/** paragraph carries the <pre> preset (see CODE_BLOCK_PRESET) */
|
||||
function isCodeParagraph(node: PmNode): boolean {
|
||||
return (
|
||||
@@ -325,9 +367,15 @@ function tableToHtml(table: TableModel): string {
|
||||
|
||||
/**
|
||||
* Serialize top-level nodes [startIndex, endIndex] into restricted HTML.
|
||||
* Consecutive list items of the same kind are grouped into ul/ol.
|
||||
* Consecutive list items of the same kind are grouped into ul/ol. With `sel`
|
||||
* (absolute positions), the selected characters are delimited by <sel>…</sel>.
|
||||
*/
|
||||
export function serializeRangeToHtml(editor: Editor, startIndex: number, endIndex: number): string {
|
||||
export function serializeRangeToHtml(
|
||||
editor: Editor,
|
||||
startIndex: number,
|
||||
endIndex: number,
|
||||
sel?: { from: number; to: number } | null,
|
||||
): string {
|
||||
const json = editor.getJSON() as PmNode
|
||||
const children = (json.content ?? []).slice(startIndex, endIndex + 1)
|
||||
const parts: string[] = []
|
||||
@@ -339,6 +387,14 @@ export function serializeRangeToHtml(editor: Editor, startIndex: number, endInde
|
||||
parts.push(`<${tag}>${listBuffer.items.join('')}</${tag}>`)
|
||||
listBuffer = null
|
||||
}
|
||||
const inlineSel = (i: number): InlineSelection | undefined => {
|
||||
if (!sel) return undefined
|
||||
const pmNode = editor.state.doc.child(startIndex + i)
|
||||
const start = blockRangePositions(editor, startIndex + i, startIndex + i).from + 1
|
||||
const from = Math.max(sel.from, start) - start
|
||||
const to = Math.min(sel.to, start + pmNode.content.size) - start
|
||||
return from < to ? { from, to } : undefined
|
||||
}
|
||||
|
||||
for (let i = 0; i < children.length; i++) {
|
||||
const node = children[i]
|
||||
@@ -350,22 +406,22 @@ export function serializeRangeToHtml(editor: Editor, startIndex: number, endInde
|
||||
if (node.type === 'docHeading') {
|
||||
flushList()
|
||||
const level = Math.min(Math.max(Number(node.attrs?.level) || 1, 1), 6)
|
||||
parts.push(`<h${level}>${inlineToHtml(node.content)}</h${level}>`)
|
||||
parts.push(`<h${level}>${inlineToHtml(node.content, inlineSel(i))}</h${level}>`)
|
||||
} else if (node.type === 'docListItem') {
|
||||
const kind = (node.attrs?.kind as string) ?? 'bullet'
|
||||
if (!listBuffer || listBuffer.kind !== kind) {
|
||||
flushList()
|
||||
listBuffer = { kind, items: [] }
|
||||
}
|
||||
listBuffer.items.push(`<li>${inlineToHtml(node.content)}</li>`)
|
||||
listBuffer.items.push(`<li>${inlineToHtml(node.content, inlineSel(i))}</li>`)
|
||||
} else if (node.type === 'docParagraph') {
|
||||
flushList()
|
||||
if (isCodeParagraph(node)) {
|
||||
parts.push(`<pre>${escapeHtml(inlineToPlainText(node.content))}</pre>`)
|
||||
parts.push(`<pre>${codeToHtml(node.content, inlineSel(i))}</pre>`)
|
||||
} else if (isQuoteParagraph(node)) {
|
||||
parts.push(`<blockquote>${inlineToHtml(node.content)}</blockquote>`)
|
||||
parts.push(`<blockquote>${inlineToHtml(node.content, inlineSel(i))}</blockquote>`)
|
||||
} else {
|
||||
parts.push(`<p>${inlineToHtml(node.content)}</p>`)
|
||||
parts.push(`<p>${inlineToHtml(node.content, inlineSel(i))}</p>`)
|
||||
}
|
||||
} else if (node.type === 'docTable') {
|
||||
flushList()
|
||||
@@ -520,10 +576,13 @@ export function buildDocumentContext(
|
||||
}
|
||||
|
||||
scope ??= getSelectionScope(editor)
|
||||
const partialNote = partialSelection(editor, scope)
|
||||
? ' (part of the text only — see the <sel> markers in the selected content)'
|
||||
: ''
|
||||
const selLine = scope.isRange
|
||||
? scope.startIndex === scope.endIndex
|
||||
? `Current selection: block ${scope.startIndex}`
|
||||
: `Current selection: blocks ${scope.startIndex}-${scope.endIndex}`
|
||||
? `Current selection: block ${scope.startIndex}${partialNote}`
|
||||
: `Current selection: blocks ${scope.startIndex}-${scope.endIndex}${partialNote}`
|
||||
: `No selection; cursor is in block ${scope.startIndex}`
|
||||
|
||||
// authoritative stats for answer mode (previews above may be clipped)
|
||||
@@ -701,18 +760,33 @@ export function buildDocContext(
|
||||
): string {
|
||||
const isEmptyDoc = isBlankDocument(editor)
|
||||
scope ??= getSelectionScope(editor)
|
||||
const partial = partialSelection(editor, scope)
|
||||
const selectionHtml = scope.isRange
|
||||
? clip(serializeRangeToHtml(editor, scope.startIndex, scope.endIndex), SELECTION_MAX_CHARS)
|
||||
? clip(
|
||||
serializeRangeToHtml(editor, scope.startIndex, scope.endIndex, partial),
|
||||
SELECTION_MAX_CHARS,
|
||||
)
|
||||
: ''
|
||||
const selectedText = partial
|
||||
? editor.state.doc.textBetween(partial.from, partial.to, '\n', ' ')
|
||||
: ''
|
||||
const selectionLines = partial
|
||||
? [
|
||||
`Content selected by the user (blocks ${scope.startIndex}-${scope.endIndex}; ONLY the span inside <sel>…</sel> is selected, the rest of these blocks is shown for context):`,
|
||||
selectionHtml,
|
||||
`Selected text (${selectedText.length} characters): "${clip(selectedText, 1000)}"`,
|
||||
]
|
||||
: [
|
||||
`Content selected by the user (blocks ${scope.startIndex}-${scope.endIndex}):`,
|
||||
selectionHtml,
|
||||
]
|
||||
return [
|
||||
isEmptyDoc
|
||||
? 'The document is currently blank.'
|
||||
: `Document block list:\n${buildDocumentContext(editor, scope, hf)}`,
|
||||
// a blank body can still carry headers/footers (template setup): keep them visible
|
||||
isEmptyDoc && hf ? hfContextLines(hf).join('\n') : '',
|
||||
selectionHtml
|
||||
? `Content selected by the user (blocks ${scope.startIndex}-${scope.endIndex}):\n${selectionHtml}`
|
||||
: '',
|
||||
selectionHtml ? selectionLines.join('\n') : '',
|
||||
comments && comments.length > 0 ? buildCommentsContext(editor, comments) : '',
|
||||
]
|
||||
.filter(Boolean)
|
||||
@@ -1010,6 +1084,30 @@ export function parseHtmlFragment(raw: string, numIds: NumIds): PmNode[] {
|
||||
return out
|
||||
}
|
||||
|
||||
const BLOCK_TAG = /<\/?(h[1-6]|p|div|ul|ol|li|table|thead|tbody|tr|th|td|pre|blockquote)\b/gi
|
||||
|
||||
/**
|
||||
* Parse the replacement for a selected span: plain text or inline HTML, or a
|
||||
* single <p>…</p>. Any other block structure is refused — the selection lives
|
||||
* inside one text block, so a multi-block answer belongs to replace_blocks.
|
||||
*/
|
||||
export function parseInlineFragment(raw: string): PmNode[] {
|
||||
let text = raw.trim()
|
||||
const fence = /```(?:html)?\s*([\s\S]*?)```/.exec(text)
|
||||
if (fence) text = fence[1].trim()
|
||||
const single = /^<p(?:\s[^>]*)?>([\s\S]*)<\/p>$/i.exec(text)
|
||||
if (single) text = single[1]
|
||||
if (BLOCK_TAG.test(text)) {
|
||||
BLOCK_TAG.lastIndex = 0
|
||||
throw new Error(
|
||||
'replace_selection takes inline content for the selected span only; block tags (p/h*/ul/table…) mean a rewrite of whole blocks — use replace_blocks',
|
||||
)
|
||||
}
|
||||
const parsed = new DOMParser().parseFromString(`<p>${text}</p>`, 'text/html')
|
||||
const p = parsed.body.firstElementChild
|
||||
return p ? parseInline(p, []) : []
|
||||
}
|
||||
|
||||
// ---- applying parsed fragments ----
|
||||
|
||||
/** record the AI's content change as tracked revisions under this author */
|
||||
@@ -1184,6 +1282,39 @@ export function replaceBlockRange(
|
||||
return true
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace an inline range inside one text block with the given inline nodes
|
||||
* (the replace_selection tool). The new text becomes the selection so a
|
||||
* follow-up scope:'selection' command targets it. With `track`, the old text
|
||||
* stays struck through (del) and the new text follows with ins marks.
|
||||
*/
|
||||
export function replaceInlineRange(
|
||||
editor: Editor,
|
||||
from: number,
|
||||
to: number,
|
||||
nodes: ProseMirrorNode[],
|
||||
track?: AiTrack,
|
||||
): void {
|
||||
const tr = editor.state.tr
|
||||
const blockPos = tr.doc.resolve(from).before(1)
|
||||
const inserted = nodes.reduce((size, n) => size + n.nodeSize, 0)
|
||||
if (track) {
|
||||
const date = revisionDate()
|
||||
const { ins, del } = editor.schema.marks
|
||||
tr.insert(to, nodes)
|
||||
if (inserted > 0) tr.addMark(to, to + inserted, ins.create({ author: track.author, date }))
|
||||
tr.addMark(from, to, del.create({ author: track.author, date }))
|
||||
tr.setSelection(TextSelection.create(tr.doc, to, to + inserted))
|
||||
tr.setMeta(TRACK_IGNORE, true)
|
||||
} else {
|
||||
tr.replaceWith(from, to, nodes)
|
||||
tr.setSelection(TextSelection.create(tr.doc, from, from + inserted))
|
||||
const block = tr.doc.nodeAt(blockPos)
|
||||
if (block) tr.setNodeMarkup(blockPos, undefined, { ...block.attrs, aiChanged: true })
|
||||
}
|
||||
editor.view.dispatch(tr)
|
||||
}
|
||||
|
||||
/** insert the parsed nodes after the given top-level block index */
|
||||
export function insertBlocksAfter(
|
||||
editor: Editor,
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import type { Editor } from '@tiptap/core'
|
||||
import type { Node as ProseMirrorNode } from '@tiptap/pm/model'
|
||||
import type { Mark, Node as ProseMirrorNode } from '@tiptap/pm/model'
|
||||
import type { ChartDisplay, CommentInfo, NewChart } from '@genoffice/docx-engine'
|
||||
import type { AgentToolCall, AgentToolDef, CreateDocumentType } from '../../shared/ipc'
|
||||
import { t } from '../i18n/locale'
|
||||
import { executeCommands, type Command, type CommandEnvelope } from './commands'
|
||||
import { executeOps, opNames } from './ops'
|
||||
import {
|
||||
blockRangePositions,
|
||||
buildCommentsContext,
|
||||
@@ -13,7 +13,9 @@ import {
|
||||
isBlankDocument,
|
||||
isTrackedDeleted,
|
||||
parseHtmlFragment,
|
||||
parseInlineFragment,
|
||||
replaceBlockRange,
|
||||
replaceInlineRange,
|
||||
serializeRangeToHtml,
|
||||
type AiHfState,
|
||||
type AiTrack,
|
||||
@@ -87,19 +89,41 @@ export const AGENT_TOOLS: AgentToolDef[] = [
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'apply_commands',
|
||||
name: 'replace_selection',
|
||||
description:
|
||||
'Execute formatting/structure/batch commands (batchUpdate style, see the command guide in the system prompt): text style (whole-block or matched-text-only), paragraph format, heading level, find & replace, delete/move blocks, list conversion, image properties, TOC insertion.',
|
||||
"Replace exactly the user's selected text (the <sel>…</sel> span in the context) with new inline content, leaving the rest of the block untouched. For rewording/translating/correcting a selected phrase or sentence inside a paragraph. The new text inherits the selection's formatting unless the fragment styles it. Requires a range selection inside one paragraph/heading/list item; for whole blocks or several blocks use replace_blocks.",
|
||||
inputSchema: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
commands: {
|
||||
type: 'array',
|
||||
description: 'array of commands executed in order; each command is a single-key object',
|
||||
items: { type: 'object' },
|
||||
html: {
|
||||
type: 'string',
|
||||
description:
|
||||
'replacement inline content: plain text or restricted inline HTML (strong em u s a br formula)',
|
||||
},
|
||||
},
|
||||
required: ['commands'],
|
||||
required: ['html'],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'apply_ops',
|
||||
description:
|
||||
`Run a list of formatting/structure ops as one atomic transaction (see the apply_ops guide in the system prompt): ${opNames().join(', ')}. ` +
|
||||
'Each op is a flat { op, target?, ...fields } object; fields are patches (present = set, null = clear, absent = untouched). Any invalid op rejects the whole batch with its usage line.',
|
||||
inputSchema: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
ops: {
|
||||
type: 'array',
|
||||
description:
|
||||
'ops executed in order, e.g. [{"op":"setFont","target":{"nodeType":"docHeading"},"color":"#FF0000"}]',
|
||||
items: { type: 'object' },
|
||||
},
|
||||
dryRun: {
|
||||
type: 'boolean',
|
||||
description: 'validate and return the plan without changing the document',
|
||||
},
|
||||
},
|
||||
required: ['ops'],
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -181,7 +205,7 @@ export const AGENT_TOOLS: AgentToolDef[] = [
|
||||
{
|
||||
name: 'generate_image',
|
||||
description:
|
||||
'Generate an illustration with AI from a text prompt and insert it into the document (at the cursor / end of document). For illustration/diagram-style art that image_search cannot find, or when the user asks to generate/draw a picture. Requires Genspark login with cloud tools enabled.',
|
||||
'Generate an illustration with AI from a text prompt and insert it into the document (at the cursor / end of document). For illustration/diagram-style art that image_search cannot find, or when the user asks to generate/draw a picture.',
|
||||
inputSchema: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
@@ -298,19 +322,20 @@ export const AGENT_TOOLS: AgentToolDef[] = [
|
||||
name: 'create_document',
|
||||
description:
|
||||
'Create a NEW standalone file in the default save folder and open it in a new tab; the current document is not modified. Use when the user asks to put content into a new/separate document instead of this one. ' +
|
||||
"type 'docx' (default) and 'pdf' take the same restricted HTML as insert_content in content; type 'md' takes Markdown source. Images and charts are not supported in the new file's initial content.",
|
||||
"type 'docx' (default) and 'pdf' take the same restricted HTML as insert_content in content; type 'md' takes Markdown source; type 'html' takes a complete standalone HTML page (opens in the HTML editor). Images and charts are not supported in the new file's initial content.",
|
||||
inputSchema: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
type: {
|
||||
type: 'string',
|
||||
enum: ['docx', 'pdf', 'md'],
|
||||
enum: ['docx', 'pdf', 'md', 'html'],
|
||||
description: "target file type (default 'docx')",
|
||||
},
|
||||
title: { type: 'string', description: 'document title, used as the file name' },
|
||||
content: {
|
||||
type: 'string',
|
||||
description: 'full document content: restricted HTML for docx/pdf, Markdown for md',
|
||||
description:
|
||||
'full document content: restricted HTML for docx/pdf, Markdown for md, a complete HTML page for html',
|
||||
},
|
||||
},
|
||||
required: ['title', 'content'],
|
||||
@@ -371,6 +396,9 @@ const fail = (summary: string, output: string): ToolExecution => ({
|
||||
summary,
|
||||
})
|
||||
|
||||
const clipText = (text: string, max: number): string =>
|
||||
text.length > max ? `${text.slice(0, max)}…` : text
|
||||
|
||||
/**
|
||||
* A model that saw gateway-flattened tool results can regurgitate them as the
|
||||
* html argument (raw {"index":…} block dumps, literal </tool_response> tags);
|
||||
@@ -399,6 +427,31 @@ function toolEchoError(html: string): string | null {
|
||||
}
|
||||
}
|
||||
|
||||
/** <sel> only marks the user's selection in the context; a model echoing it would write the marker into the document */
|
||||
function contextMarkerError(html: string): string | null {
|
||||
return /<\/?sel\s*>/i.test(html)
|
||||
? 'html contains <sel>: that marker only delimits the selection in the context and is not document content; retry without it'
|
||||
: null
|
||||
}
|
||||
|
||||
/** the range selection tools act on: the frozen scope when valid, else the live selection; null for a caret */
|
||||
function selectionRange(
|
||||
editor: Editor,
|
||||
scope?: SelectionScope | null,
|
||||
): { from: number; to: number } | null {
|
||||
if (scope) {
|
||||
if (!scope.isRange) return null
|
||||
if (scope.from !== undefined && scope.to !== undefined && scope.from < scope.to)
|
||||
return { from: scope.from, to: scope.to }
|
||||
}
|
||||
const { from, to, empty } = editor.state.selection
|
||||
return empty ? null : { from, to }
|
||||
}
|
||||
|
||||
/** formatting the fragment expresses itself (tags), so it must not also be inherited from the old text */
|
||||
const FRAGMENT_MARK_TYPES = new Set(['bold', 'italic', 'underline', 'strike', 'link'])
|
||||
const REVISION_MARK_TYPES = new Set(['ins', 'del'])
|
||||
|
||||
/** Doc as last seen by the AI pipeline (context build / read / own write); a differing doc means the user edited in between. */
|
||||
const docBaseline = new WeakMap<Editor, ProseMirrorNode>()
|
||||
|
||||
@@ -420,7 +473,8 @@ function editedExternally(editor: Editor): boolean {
|
||||
const INDEX_WRITE_SUMMARIES: Record<string, () => string> = {
|
||||
insert_content: () => t('aiSumInsertContent'),
|
||||
replace_blocks: () => t('aiSumReplaceContent'),
|
||||
apply_commands: () => t('aiSumApplyCommands'),
|
||||
replace_selection: () => t('aiSumReplaceSelection'),
|
||||
apply_ops: () => t('aiSumApplyCommands'),
|
||||
insert_chart: () => t('aiSumInsertChart'),
|
||||
edit_chart: () => t('aiSumEditChart'),
|
||||
}
|
||||
@@ -543,8 +597,8 @@ async function executeAsyncTool(
|
||||
}
|
||||
case 'create_document': {
|
||||
const typeRaw = call.input.type === undefined ? 'docx' : String(call.input.type)
|
||||
if (typeRaw !== 'docx' && typeRaw !== 'pdf' && typeRaw !== 'md')
|
||||
return fail(t('aiSumCreateDocument'), 'type must be one of docx/pdf/md')
|
||||
if (typeRaw !== 'docx' && typeRaw !== 'pdf' && typeRaw !== 'md' && typeRaw !== 'html')
|
||||
return fail(t('aiSumCreateDocument'), 'type must be one of docx/pdf/md/html')
|
||||
const type: CreateDocumentType = typeRaw
|
||||
const title = String(call.input.title ?? '').trim()
|
||||
if (!title) return fail(t('aiSumCreateDocument'), 'title must not be empty')
|
||||
@@ -553,6 +607,8 @@ async function executeAsyncTool(
|
||||
if (type !== 'md') {
|
||||
const echo = toolEchoError(content)
|
||||
if (echo) return fail(t('aiSumCreateDocument'), echo)
|
||||
}
|
||||
if (type === 'docx' || type === 'pdf') {
|
||||
// the new docx tab fills itself after this tool already returned, so
|
||||
// unparseable HTML must be rejected here, where the model can retry
|
||||
try {
|
||||
@@ -743,7 +799,7 @@ function executeSyncTool(
|
||||
|
||||
case 'insert_content': {
|
||||
const html = String(call.input.html ?? '')
|
||||
const echo = toolEchoError(html)
|
||||
const echo = toolEchoError(html) ?? contextMarkerError(html)
|
||||
if (echo) return fail(t('aiSumInsertContent'), echo)
|
||||
let nodes: ReturnType<typeof parseHtmlFragment>
|
||||
try {
|
||||
@@ -781,7 +837,7 @@ function executeSyncTool(
|
||||
const range = validRange(editor, call.input.startBlockIndex, call.input.endBlockIndex)
|
||||
if (!range) return fail(t('aiSumReplaceContent'), rangeError(editor))
|
||||
const html = String(call.input.html ?? '')
|
||||
const echo = toolEchoError(html)
|
||||
const echo = toolEchoError(html) ?? contextMarkerError(html)
|
||||
if (echo) return fail(t('aiSumReplaceContent'), echo)
|
||||
let nodes: ReturnType<typeof parseHtmlFragment>
|
||||
try {
|
||||
@@ -799,6 +855,60 @@ function executeSyncTool(
|
||||
}
|
||||
}
|
||||
|
||||
case 'replace_selection': {
|
||||
const html = String(call.input.html ?? '')
|
||||
const echo = toolEchoError(html) ?? contextMarkerError(html)
|
||||
if (echo) return fail(t('aiSumReplaceSelection'), echo)
|
||||
const range = selectionRange(editor, scope)
|
||||
if (!range) {
|
||||
return fail(
|
||||
t('aiSumReplaceSelection'),
|
||||
'nothing is selected: replace_selection needs a range selection (the <sel>…</sel> span in the context); to rewrite whole blocks use replace_blocks',
|
||||
)
|
||||
}
|
||||
const doc = editor.state.doc
|
||||
const $from = doc.resolve(range.from)
|
||||
const $to = doc.resolve(range.to)
|
||||
if ($from.depth !== 1 || !$from.sameParent($to) || !$from.parent.isTextblock) {
|
||||
return fail(
|
||||
t('aiSumReplaceSelection'),
|
||||
'the selection spans several blocks or sits in protected content (table, image, field); replace_selection only edits text inside one paragraph/heading/list item — use replace_blocks for that range',
|
||||
)
|
||||
}
|
||||
let inline: ReturnType<typeof parseInlineFragment>
|
||||
try {
|
||||
inline = parseInlineFragment(html)
|
||||
} catch (e) {
|
||||
return fail(t('aiSumReplaceSelection'), e instanceof Error ? e.message : String(e))
|
||||
}
|
||||
if (inline.length === 0) {
|
||||
return fail(t('aiSumReplaceSelection'), 'html did not parse into any text')
|
||||
}
|
||||
const schema = editor.schema
|
||||
const fragmentStyled = inline.some((n) => (n.marks ?? []).length > 0)
|
||||
const anchor = $from.parent.childAfter($from.parentOffset).node
|
||||
const inherited = (anchor?.marks ?? []).filter(
|
||||
(m) =>
|
||||
!REVISION_MARK_TYPES.has(m.type.name) &&
|
||||
!(fragmentStyled && FRAGMENT_MARK_TYPES.has(m.type.name)),
|
||||
)
|
||||
const nodes = inline.map((n) => {
|
||||
if (n.type !== 'text') return schema.nodeFromJSON(n)
|
||||
let marks: readonly Mark[] = inherited
|
||||
for (const m of n.marks ?? []) marks = schema.markFromJSON(m).addToSet(marks)
|
||||
return schema.text(n.text ?? '', marks)
|
||||
})
|
||||
const blockIndex = $from.index(0)
|
||||
const oldText = doc.textBetween(range.from, range.to, ' ', ' ')
|
||||
replaceInlineRange(editor, range.from, range.to, nodes, track)
|
||||
const newText = nodes.map((n) => n.textContent).join('')
|
||||
return {
|
||||
output: `Replaced the selected text in block ${blockIndex}: "${clipText(oldText, 200)}" → "${clipText(newText, 200)}". The rest of the block is unchanged; the new text is now selected.`,
|
||||
mutated: true,
|
||||
summary: t('aiSumReplaceSelection'),
|
||||
}
|
||||
}
|
||||
|
||||
case 'insert_chart': {
|
||||
const kind = String(call.input.kind ?? '') as NewChart['kind']
|
||||
if (!['bar', 'line', 'pie'].includes(kind))
|
||||
@@ -1040,15 +1150,22 @@ function executeSyncTool(
|
||||
}
|
||||
}
|
||||
|
||||
case 'apply_commands': {
|
||||
const commands = call.input.commands
|
||||
if (!Array.isArray(commands) || commands.length === 0) {
|
||||
return fail(t('aiSumApplyCommands'), 'commands must be a non-empty array')
|
||||
case 'apply_ops': {
|
||||
const dryRun = call.input.dryRun === true
|
||||
const outcome = executeOps(editor, call.input.ops, {
|
||||
numIds,
|
||||
track,
|
||||
selection: scope,
|
||||
dryRun,
|
||||
})
|
||||
if (!outcome.ok) return fail(t('aiSumApplyCommands'), outcome.error ?? 'op execution failed')
|
||||
if (dryRun) {
|
||||
return {
|
||||
output: `Dry run: ${outcome.plan?.length ?? 0} op(s) valid, nothing applied.\n${(outcome.plan ?? []).join('\n')}`,
|
||||
mutated: false,
|
||||
summary: t('aiSumApplyCommands'),
|
||||
}
|
||||
}
|
||||
const envelope: CommandEnvelope = { commands: commands as Command[] }
|
||||
const outcome = executeCommands(editor, envelope, { numIds, track, selection: scope })
|
||||
if (!outcome.ok)
|
||||
return fail(t('aiSumApplyCommands'), outcome.error ?? 'command execution failed')
|
||||
const changed = outcome.results.reduce((sum, r) => sum + r.changed, 0)
|
||||
const skippedDeleted = outcome.results.reduce((sum, r) => sum + (r.skippedDeleted ?? 0), 0)
|
||||
// explicit model-facing note so it stops retrying deletions of already-deleted text
|
||||
|
||||
@@ -15,6 +15,7 @@ import { NodeSelection } from '@tiptap/pm/state'
|
||||
import { CellSelection } from '@tiptap/pm/tables'
|
||||
import { useI18n, type StringKey } from '../i18n/locale'
|
||||
import { AI_QUEUE_ANCHOR_CLICK, queueAnchorRange } from '../editor/ai-queue-anchors'
|
||||
import { setInactiveSelectionShown } from '../editor/inactive-selection'
|
||||
import {
|
||||
EDIT_INSTRUCTION_MAX,
|
||||
EDIT_QUEUE_MAX,
|
||||
@@ -201,7 +202,8 @@ export function AiAskPopover({
|
||||
const close = useCallback(() => {
|
||||
setOpen(null)
|
||||
setText('')
|
||||
}, [])
|
||||
setInactiveSelectionShown(editor, false)
|
||||
}, [editor])
|
||||
|
||||
/** outside click keeps whatever was typed: a new note lands in the queue, an edit is saved */
|
||||
const commitOrClose = useCallback(() => {
|
||||
@@ -224,11 +226,13 @@ export function AiAskPopover({
|
||||
return () => document.removeEventListener('pointerdown', onPointerDown, true)
|
||||
}, [open, commitOrClose])
|
||||
|
||||
// the input takes the DOM selection with it: keep the targeted range visible while the popover is open
|
||||
const openFromSelection = () => {
|
||||
setText('')
|
||||
setKind(selectionKind(editor))
|
||||
setOpen({ mode: 'new' })
|
||||
setTrigger(null)
|
||||
setInactiveSelectionShown(editor, true)
|
||||
}
|
||||
|
||||
const canSubmit = text.trim().length > 0
|
||||
|
||||
@@ -2,7 +2,7 @@ import { memo, useEffect, useMemo, useRef, useState } from 'react'
|
||||
import type { Node as PmNode } from '@tiptap/pm/model'
|
||||
import type { CommentInfo } from '@genoffice/docx-engine'
|
||||
import { useI18n } from '../i18n/locale'
|
||||
import { IconComment, IconTrash } from './icons'
|
||||
import { IconComment, IconPencil, IconTrash } from './icons'
|
||||
|
||||
function formatDate(iso?: string): string {
|
||||
if (!iso) return ''
|
||||
@@ -52,6 +52,7 @@ export const CommentsPanel = memo(function CommentsPanel({
|
||||
composing,
|
||||
onSubmitNew,
|
||||
onReply,
|
||||
onEdit,
|
||||
onResolve,
|
||||
onCancelNew,
|
||||
onDelete,
|
||||
@@ -65,6 +66,8 @@ export const CommentsPanel = memo(function CommentsPanel({
|
||||
onSubmitNew: (text: string) => void
|
||||
/** Reply to a comment (anchor shares the parent comment's range) */
|
||||
onReply: (parentId: string, text: string) => void
|
||||
/** Replace a comment's or reply's text in place; author, date and anchor stay */
|
||||
onEdit: (id: string, text: string) => void
|
||||
/** Resolve/reopen the whole thread */
|
||||
onResolve: (id: string, done: boolean) => void
|
||||
onCancelNew: () => void
|
||||
@@ -77,6 +80,8 @@ export const CommentsPanel = memo(function CommentsPanel({
|
||||
const draftRef = useRef<HTMLTextAreaElement>(null)
|
||||
const [replyTo, setReplyTo] = useState<string | null>(null)
|
||||
const [replyDraft, setReplyDraft] = useState('')
|
||||
const [editingId, setEditingId] = useState<string | null>(null)
|
||||
const [editDraft, setEditDraft] = useState('')
|
||||
// Word: resolved comments are collapsed/hidden by default
|
||||
const [showResolved, setShowResolved] = useState(false)
|
||||
|
||||
@@ -94,6 +99,38 @@ export const CommentsPanel = memo(function CommentsPanel({
|
||||
setReplyTo(null)
|
||||
}
|
||||
|
||||
const startEdit = (c: CommentInfo) => {
|
||||
// the pencil toggles: a second click cancels instead of resetting the draft
|
||||
if (editingId === c.id) {
|
||||
setEditingId(null)
|
||||
return
|
||||
}
|
||||
setEditingId(c.id)
|
||||
setEditDraft(c.text)
|
||||
setReplyTo(null)
|
||||
}
|
||||
|
||||
const submitEdit = () => {
|
||||
const text = editDraft.trim()
|
||||
if (!text || !editingId) return
|
||||
onEdit(editingId, text)
|
||||
setEditingId(null)
|
||||
}
|
||||
|
||||
/** an open edit belongs to this thread (parent or reply) — commit it before the thread collapses away */
|
||||
const flushEditIn = (threadId: string) => {
|
||||
if (!editingId) return
|
||||
if (editingId !== threadId && !repliesOf(threadId).some((r) => r.id === editingId)) return
|
||||
const text = editDraft.trim()
|
||||
if (text) onEdit(editingId, text)
|
||||
setEditingId(null)
|
||||
}
|
||||
|
||||
/** the edited comment is going away — drop the draft with it */
|
||||
const cancelEditIn = (ids: string[]) => {
|
||||
if (editingId && ids.includes(editingId)) setEditingId(null)
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (composing) draftRef.current?.focus()
|
||||
}, [composing])
|
||||
@@ -108,51 +145,111 @@ export const CommentsPanel = memo(function CommentsPanel({
|
||||
const renderThread = (c: CommentInfo) => {
|
||||
const anchor = anchorTexts.get(c.id) ?? ''
|
||||
const replies = repliesOf(c.id)
|
||||
return (
|
||||
<div key={c.id} className={`comment-thread ${c.done ? 'resolved' : ''}`}>
|
||||
<button
|
||||
className={`comment-card ${activeId === c.id ? 'active' : ''}`}
|
||||
onClick={() => {
|
||||
setActiveId(c.id)
|
||||
jumpTo(c.id)
|
||||
const head = (
|
||||
<div className="comment-card-head">
|
||||
<span className="comment-avatar">{(c.initials || c.author || '?').slice(0, 2)}</span>
|
||||
<span className="comment-author">{c.author || t('appUnknownAuthor')}</span>
|
||||
<span className="comment-date">{formatDate(c.date)}</span>
|
||||
{c.done && <span className="comment-resolved-badge">{t('appResolved')}</span>}
|
||||
<span
|
||||
className="comment-card-edit"
|
||||
data-tip={t('appEditComment')}
|
||||
role="button"
|
||||
aria-label={t('appEditComment')}
|
||||
tabIndex={0}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation()
|
||||
startEdit(c)
|
||||
}}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === 'Enter') {
|
||||
e.stopPropagation()
|
||||
startEdit(c)
|
||||
}
|
||||
}}
|
||||
>
|
||||
<div className="comment-card-head">
|
||||
<span className="comment-avatar">{(c.initials || c.author || '?').slice(0, 2)}</span>
|
||||
<span className="comment-author">{c.author || t('appUnknownAuthor')}</span>
|
||||
<span className="comment-date">{formatDate(c.date)}</span>
|
||||
{c.done && <span className="comment-resolved-badge">{t('appResolved')}</span>}
|
||||
<span
|
||||
className="comment-card-del"
|
||||
data-tip={
|
||||
replies.length > 0 ? t('appDeleteCommentWithReplies') : t('appDeleteComment')
|
||||
}
|
||||
role="button"
|
||||
aria-label={t('appDeleteComment')}
|
||||
tabIndex={0}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation()
|
||||
onDelete(c.id)
|
||||
}}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === 'Enter') {
|
||||
e.stopPropagation()
|
||||
onDelete(c.id)
|
||||
}
|
||||
}}
|
||||
>
|
||||
<IconTrash size={13} />
|
||||
</span>
|
||||
<IconPencil size={13} />
|
||||
</span>
|
||||
<span
|
||||
className="comment-card-del"
|
||||
data-tip={replies.length > 0 ? t('appDeleteCommentWithReplies') : t('appDeleteComment')}
|
||||
role="button"
|
||||
aria-label={t('appDeleteComment')}
|
||||
tabIndex={0}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation()
|
||||
cancelEditIn([c.id, ...replies.map((r) => r.id)])
|
||||
onDelete(c.id)
|
||||
}}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === 'Enter') {
|
||||
e.stopPropagation()
|
||||
cancelEditIn([c.id, ...replies.map((r) => r.id)])
|
||||
onDelete(c.id)
|
||||
}
|
||||
}}
|
||||
>
|
||||
<IconTrash size={13} />
|
||||
</span>
|
||||
</div>
|
||||
)
|
||||
return (
|
||||
<div key={c.id} className={`comment-thread ${c.done ? 'resolved' : ''}`}>
|
||||
{editingId === c.id ? (
|
||||
// editing swaps the clickable card for a plain one: a textarea cannot live inside a button
|
||||
<div className={`comment-card ${activeId === c.id ? 'active' : ''}`}>
|
||||
{head}
|
||||
{anchor && <div className="comment-anchor">“{anchor.slice(0, 60)}”</div>}
|
||||
<div className="comment-reply-compose">
|
||||
<textarea
|
||||
autoFocus
|
||||
value={editDraft}
|
||||
onChange={(e) => setEditDraft(e.target.value)}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === 'Enter' && (e.metaKey || e.ctrlKey)) submitEdit()
|
||||
if (e.key === 'Escape') setEditingId(null)
|
||||
}}
|
||||
/>
|
||||
<div className="comment-compose-actions">
|
||||
<button onClick={() => setEditingId(null)}>{t('appCancel')}</button>
|
||||
<button className="primary" disabled={!editDraft.trim()} onClick={submitEdit}>
|
||||
{t('appSave')}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{anchor && <div className="comment-anchor">“{anchor.slice(0, 60)}”</div>}
|
||||
<div className="comment-text">{c.text}</div>
|
||||
</button>
|
||||
) : (
|
||||
<button
|
||||
className={`comment-card ${activeId === c.id ? 'active' : ''}`}
|
||||
onClick={() => {
|
||||
setActiveId(c.id)
|
||||
jumpTo(c.id)
|
||||
}}
|
||||
>
|
||||
{head}
|
||||
{anchor && <div className="comment-anchor">“{anchor.slice(0, 60)}”</div>}
|
||||
<div className="comment-text">{c.text}</div>
|
||||
</button>
|
||||
)}
|
||||
{replies.map((r) => (
|
||||
<div key={r.id} className="comment-reply">
|
||||
<div className="comment-card-head">
|
||||
<span className="comment-avatar">{(r.initials || r.author || '?').slice(0, 2)}</span>
|
||||
<span className="comment-author">{r.author || t('appUnknownAuthor')}</span>
|
||||
<span className="comment-date">{formatDate(r.date)}</span>
|
||||
<span
|
||||
className="comment-card-edit"
|
||||
data-tip={t('appEditComment')}
|
||||
aria-label={t('appEditComment')}
|
||||
role="button"
|
||||
tabIndex={0}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation()
|
||||
startEdit(r)
|
||||
}}
|
||||
>
|
||||
<IconPencil size={12} />
|
||||
</span>
|
||||
<span
|
||||
className="comment-card-del"
|
||||
data-tip={t('appDeleteReply')}
|
||||
@@ -161,13 +258,34 @@ export const CommentsPanel = memo(function CommentsPanel({
|
||||
tabIndex={0}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation()
|
||||
cancelEditIn([r.id])
|
||||
onDelete(r.id)
|
||||
}}
|
||||
>
|
||||
<IconTrash size={12} />
|
||||
</span>
|
||||
</div>
|
||||
<div className="comment-text">{r.text}</div>
|
||||
{editingId === r.id ? (
|
||||
<div className="comment-reply-compose">
|
||||
<textarea
|
||||
autoFocus
|
||||
value={editDraft}
|
||||
onChange={(e) => setEditDraft(e.target.value)}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === 'Enter' && (e.metaKey || e.ctrlKey)) submitEdit()
|
||||
if (e.key === 'Escape') setEditingId(null)
|
||||
}}
|
||||
/>
|
||||
<div className="comment-compose-actions">
|
||||
<button onClick={() => setEditingId(null)}>{t('appCancel')}</button>
|
||||
<button className="primary" disabled={!editDraft.trim()} onClick={submitEdit}>
|
||||
{t('appSave')}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<div className="comment-text">{r.text}</div>
|
||||
)}
|
||||
</div>
|
||||
))}
|
||||
<div className="comment-thread-actions">
|
||||
@@ -193,7 +311,13 @@ export const CommentsPanel = memo(function CommentsPanel({
|
||||
) : (
|
||||
<>
|
||||
<button onClick={() => setReplyTo(c.id)}>{t('appReply')}</button>
|
||||
<button onClick={() => onResolve(c.id, !c.done)}>
|
||||
<button
|
||||
onClick={() => {
|
||||
// resolving collapses the thread and would unmount an open composer: commit first
|
||||
flushEditIn(c.id)
|
||||
onResolve(c.id, !c.done)
|
||||
}}
|
||||
>
|
||||
{c.done ? t('appReopen') : t('appResolve')}
|
||||
</button>
|
||||
</>
|
||||
|
||||
@@ -23,6 +23,7 @@ import { fontFamiliesFor, isEastAsianFontName } from '../font-list'
|
||||
import { useSystemFontFamilies } from '../system-fonts'
|
||||
import { cssFontFamily } from '../line-metrics'
|
||||
import { setParaAttrs, activeParaAttrs } from './ribbon-tabs'
|
||||
import { wordRangeAtCaret } from '../editor/comments'
|
||||
import { setSelectionAlign } from '../editor/direction'
|
||||
import { IconSparkle } from './icons'
|
||||
import { useModalKeys } from './modal-keys'
|
||||
@@ -85,6 +86,7 @@ export function EditorContextMenu({
|
||||
|
||||
const { from, to } = editor.state.selection
|
||||
const hasSelection = from !== to
|
||||
const canComment = hasSelection || wordRangeAtCaret(editor) !== null
|
||||
const canEdit = editor.isEditable
|
||||
const selectedText = hasSelection ? editor.state.doc.textBetween(from, to, ' ').trim() : ''
|
||||
// Synonyms targets a word / short phrase, not long selections
|
||||
@@ -500,7 +502,7 @@ export function EditorContextMenu({
|
||||
)}
|
||||
<div className="ctx-sep" />
|
||||
{item(t('appHyperlinkMenu'), { key: '⌘K', onClick: run(onLink) })}
|
||||
{item(t('appNewComment'), { disabled: !hasSelection, onClick: run(onNewComment) })}
|
||||
{item(t('appNewComment'), { disabled: !canComment, onClick: run(onNewComment) })}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -76,6 +76,7 @@ import {
|
||||
type ViewMode,
|
||||
insertImageFromDataUrl,
|
||||
applyParagraphStyle,
|
||||
setParaAttrs,
|
||||
} from './ribbon-tabs'
|
||||
import { WRAP_OPTIONS } from './ContextMenu'
|
||||
import { CropDialog, CutoutDialog } from './PictureDialogs'
|
||||
@@ -1376,23 +1377,9 @@ function RibbonInner({
|
||||
else setTextStyle({ fontAscii: name })
|
||||
}
|
||||
|
||||
/** apply paragraph-level attrs to every block type in the selection */
|
||||
/** apply paragraph-level attrs to every paragraph in the selection (textbox sub-editor included) */
|
||||
const setParaAttr = (attrs: Record<string, unknown>) => {
|
||||
if (sub) {
|
||||
// textbox paragraphs only support alignment; other keys are ignored
|
||||
chain().updateAttributes('docParagraph', attrs).run()
|
||||
setDropdown(null)
|
||||
return
|
||||
}
|
||||
let c = chain()
|
||||
.updateAttributes('docParagraph', attrs)
|
||||
.updateAttributes('docHeading', attrs)
|
||||
.updateAttributes('docListItem', attrs)
|
||||
// alignment also applies to selected images (w:jc on the image paragraph)
|
||||
if ('align' in attrs) {
|
||||
c = c.updateAttributes('docProtected', { imageAlign: attrs.align ?? null })
|
||||
}
|
||||
c.run()
|
||||
if (canEdit) setParaAttrs(ed, attrs)
|
||||
setDropdown(null)
|
||||
}
|
||||
|
||||
@@ -2208,6 +2195,42 @@ function RibbonInner({
|
||||
</span>
|
||||
<span>{t('ribbonReplacePicture')}</span>
|
||||
</button>
|
||||
<div className="rb-col">
|
||||
<button
|
||||
className="rb-small"
|
||||
disabled={!canEdit}
|
||||
onClick={() => rotatePicture(90)}
|
||||
>
|
||||
<IconRotateRight size={18} />
|
||||
<span>{t('ribbonRotateRight')}</span>
|
||||
</button>
|
||||
<button
|
||||
className="rb-small"
|
||||
disabled={!canEdit}
|
||||
onClick={() => rotatePicture(-90)}
|
||||
>
|
||||
<IconRotateLeft size={18} />
|
||||
<span>{t('ribbonRotateLeft')}</span>
|
||||
</button>
|
||||
</div>
|
||||
<div className="rb-col">
|
||||
<button
|
||||
className={fs.imageFlipH ? 'rb-small active' : 'rb-small'}
|
||||
disabled={!canEdit}
|
||||
onClick={() => flipPicture('h')}
|
||||
>
|
||||
<IconFlipH size={18} />
|
||||
<span>{t('ribbonFlipH')}</span>
|
||||
</button>
|
||||
<button
|
||||
className={fs.imageFlipV ? 'rb-small active' : 'rb-small'}
|
||||
disabled={!canEdit}
|
||||
onClick={() => flipPicture('v')}
|
||||
>
|
||||
<IconFlipV size={18} />
|
||||
<span>{t('ribbonFlipV')}</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div className="ribbon-group-label">{t('ribbonGroupAdjust')}</div>
|
||||
</div>
|
||||
@@ -2267,44 +2290,6 @@ function RibbonInner({
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
<div className="table-tool-row">
|
||||
<button
|
||||
className="table-tool-button"
|
||||
disabled={!canEdit}
|
||||
data-tip={t('ribbonRotateRight')}
|
||||
aria-label={t('ribbonRotateRight')}
|
||||
onClick={() => rotatePicture(90)}
|
||||
>
|
||||
<IconRotateRight />
|
||||
</button>
|
||||
<button
|
||||
className="table-tool-button"
|
||||
disabled={!canEdit}
|
||||
data-tip={t('ribbonRotateLeft')}
|
||||
aria-label={t('ribbonRotateLeft')}
|
||||
onClick={() => rotatePicture(-90)}
|
||||
>
|
||||
<IconRotateLeft />
|
||||
</button>
|
||||
<button
|
||||
className={fs.imageFlipH ? 'table-tool-button active' : 'table-tool-button'}
|
||||
disabled={!canEdit}
|
||||
data-tip={t('ribbonFlipH')}
|
||||
aria-label={t('ribbonFlipH')}
|
||||
onClick={() => flipPicture('h')}
|
||||
>
|
||||
<IconFlipH />
|
||||
</button>
|
||||
<button
|
||||
className={fs.imageFlipV ? 'table-tool-button active' : 'table-tool-button'}
|
||||
disabled={!canEdit}
|
||||
data-tip={t('ribbonFlipV')}
|
||||
aria-label={t('ribbonFlipV')}
|
||||
onClick={() => flipPicture('v')}
|
||||
>
|
||||
<IconFlipV />
|
||||
</button>
|
||||
</div>
|
||||
<div className="ribbon-group-label">{t('ribbonGroupArrange')}</div>
|
||||
</div>
|
||||
<div className="ribbon-sep" />
|
||||
@@ -3788,8 +3773,10 @@ function RibbonInner({
|
||||
onTitlePg={onTitlePg}
|
||||
evenOddHf={evenOddHf}
|
||||
onEvenOddHf={onEvenOddHf}
|
||||
commentCount={commentCount}
|
||||
onShowComments={onShowComments}
|
||||
canComment={canComment}
|
||||
onNewComment={onNewComment}
|
||||
isProtected={isProtected}
|
||||
commentsAllowed={commentsAllowed}
|
||||
/>
|
||||
) : tab === 'design' ? (
|
||||
<DesignTab
|
||||
|
||||
@@ -458,6 +458,15 @@ export function IconShapes(props: IconProps) {
|
||||
)
|
||||
}
|
||||
|
||||
export function IconSearch(props: IconProps) {
|
||||
return (
|
||||
<Svg {...props}>
|
||||
<circle cx="6.9" cy="6.9" r="4.2" />
|
||||
<path d="M 10 10 13.4 13.4" />
|
||||
</Svg>
|
||||
)
|
||||
}
|
||||
|
||||
export function IconLink(props: IconProps) {
|
||||
return (
|
||||
<Svg {...props}>
|
||||
@@ -1614,6 +1623,15 @@ export function IconWordArt(props: IconProps) {
|
||||
)
|
||||
}
|
||||
|
||||
export function IconPencil(props: IconProps) {
|
||||
return (
|
||||
<Svg {...props}>
|
||||
<path d="M10.9 2.9a1.1 1.1 0 0 1 1.56 0l.64.64a1.1 1.1 0 0 1 0 1.56L6.2 12l-3.1.9.9-3.1 6.9-6.9Z" />
|
||||
<path d="M9.6 4.2l2.2 2.2" />
|
||||
</Svg>
|
||||
)
|
||||
}
|
||||
|
||||
export function IconTrash(props: IconProps) {
|
||||
return (
|
||||
<Svg {...props}>
|
||||
|
||||
@@ -719,8 +719,10 @@ export function InsertTab({
|
||||
onTitlePg,
|
||||
evenOddHf,
|
||||
onEvenOddHf,
|
||||
commentCount,
|
||||
onShowComments,
|
||||
canComment,
|
||||
onNewComment,
|
||||
isProtected,
|
||||
commentsAllowed,
|
||||
}: InsertTabProps) {
|
||||
const { t } = useI18n()
|
||||
const [grid, setGrid] = useState<{ r: number; c: number }>({ r: 0, c: 0 })
|
||||
@@ -1115,15 +1117,15 @@ export function InsertTab({
|
||||
|
||||
<div className="ribbon-group">
|
||||
<div className="ribbon-group-items">
|
||||
{/* Word: Insert → Comment starts a new comment; the pane toggle stays on Review.
|
||||
Deliberately not gated on this tab's hasDoc (= canEdit): under the comments-only
|
||||
restriction the body is read-only yet commenting stays allowed, matching the
|
||||
Review tab's New Comment. Without a document canComment is false anyway. */}
|
||||
<button
|
||||
className="rb-big"
|
||||
disabled={!hasDoc}
|
||||
data-tip={
|
||||
commentCount > 0
|
||||
? t('ribbonViewCommentsTip', { count: commentCount })
|
||||
: t('ribbonViewCommentsNoneTip')
|
||||
}
|
||||
onClick={onShowComments}
|
||||
disabled={!canComment || (isProtected && !commentsAllowed)}
|
||||
data-tip={canComment ? t('ribbonNewCommentTip') : t('ribbonNewCommentSelectTip')}
|
||||
onClick={onNewComment}
|
||||
>
|
||||
<span className="rb-big-icon">
|
||||
<IconComment size={BIG} />
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useRef, useState } from 'react'
|
||||
import type { Editor, JSONContent } from '@tiptap/core'
|
||||
import { TextSelection } from '@tiptap/pm/state'
|
||||
import {
|
||||
SHAPE_GALLERY_GROUPS,
|
||||
useDismissablePopover,
|
||||
@@ -16,6 +17,7 @@ import {
|
||||
type TextboxDisplay,
|
||||
} from '@genoffice/docx-engine'
|
||||
import type { DocsTabInfo } from '../../shared/ipc'
|
||||
import { runUiOps } from '../ai/ops'
|
||||
import { tableModelToPmNode } from '../editor/convert'
|
||||
import { insertPageBreak } from '../editor/page-break'
|
||||
import { isStraightLineKind } from '../editor/shape-svg'
|
||||
@@ -80,7 +82,11 @@ export type SetDropdown = (updater: (prev: string | null) => string | null) => v
|
||||
export const toggleDropdown = (setDropdown: SetDropdown, key: string) =>
|
||||
setDropdown((prev) => (prev === key ? null : key))
|
||||
|
||||
/** apply paragraph-level attrs to every block type in the selection */
|
||||
/**
|
||||
* Apply paragraph-level attrs to every paragraph in the selection (the
|
||||
* setParagraphAttrs op: headings, list items and table-cell paragraphs alike;
|
||||
* `align` also lands on selected images as their w:jc).
|
||||
*/
|
||||
export function setParaAttrs(
|
||||
editor: Editor,
|
||||
attrs: Record<string, unknown>,
|
||||
@@ -89,40 +95,11 @@ export function setParaAttrs(
|
||||
/// to another paragraph (alpha ledger r131 / bugbot).
|
||||
range?: { from: number; to: number },
|
||||
): void {
|
||||
// an explicit spacing value turns Word's "Auto" spacing off (dialog semantics);
|
||||
// a stale auto flag would keep rendering 14pt over the user's value
|
||||
if ('spaceBefore' in attrs && !('spaceBeforeAuto' in attrs)) attrs.spaceBeforeAuto = false
|
||||
if ('spaceAfter' in attrs && !('spaceAfterAuto' in attrs)) attrs.spaceAfterAuto = false
|
||||
if (range) {
|
||||
const paraTypes = new Set(['docParagraph', 'docHeading', 'docListItem'])
|
||||
editor
|
||||
.chain()
|
||||
.command(({ tr, dispatch }) => {
|
||||
const from = Math.min(range.from, tr.doc.content.size)
|
||||
const to = Math.min(range.to, tr.doc.content.size)
|
||||
let changed = false
|
||||
tr.doc.nodesBetween(from, to, (node, pos) => {
|
||||
if (!paraTypes.has(node.type.name)) return true
|
||||
if (dispatch) tr.setNodeMarkup(pos, undefined, { ...node.attrs, ...attrs })
|
||||
changed = true
|
||||
return false
|
||||
})
|
||||
return changed
|
||||
})
|
||||
.run()
|
||||
return
|
||||
}
|
||||
let chain = editor
|
||||
.chain()
|
||||
.focus()
|
||||
.updateAttributes('docParagraph', attrs)
|
||||
.updateAttributes('docHeading', attrs)
|
||||
.updateAttributes('docListItem', attrs)
|
||||
// alignment also applies to selected images (w:jc on the image paragraph)
|
||||
if ('align' in attrs) {
|
||||
chain = chain.updateAttributes('docProtected', { imageAlign: attrs.align ?? null })
|
||||
}
|
||||
chain.run()
|
||||
const size = editor.state.doc.content.size
|
||||
const target = range
|
||||
? { range: { from: Math.min(range.from, size), to: Math.min(range.to, size) } }
|
||||
: { scope: 'selection' as const }
|
||||
runUiOps(editor, [{ op: 'setParagraphAttrs', target, attrs }], { focus: !range })
|
||||
}
|
||||
|
||||
/** direct paragraph formatting dropped by Word's Ctrl+Q (the style's own values then show through) */
|
||||
@@ -254,12 +231,29 @@ export function insertTableAt(editor: Editor, rows: number, cols: number): void
|
||||
editor
|
||||
.chain()
|
||||
.focus()
|
||||
.insertContentAt($from.end(depth), { type: 'docNestedTable', attrs: { model: table } })
|
||||
.insertContentAt($from.end(depth), [
|
||||
{ type: 'docNestedTable', attrs: { model: table } },
|
||||
{ type: 'docParagraph' },
|
||||
])
|
||||
.run()
|
||||
return
|
||||
}
|
||||
}
|
||||
editor.chain().focus().insertContent(tableModelToPmNode(table)).run()
|
||||
const node = tableModelToPmNode(table)
|
||||
// Word: an empty paragraph stays below the new table (insertContent would
|
||||
// swallow it); the caret lands in the first cell either way
|
||||
const block = $from.depth > 0 ? $from.node(1) : null
|
||||
const at = block?.isTextblock && block.content.size === 0 ? $from.before(1) : null
|
||||
const chain = editor.chain().focus()
|
||||
if (at == null) chain.insertContent(node).run()
|
||||
else
|
||||
chain
|
||||
.insertContentAt(at, node)
|
||||
.command(({ tr }) => {
|
||||
tr.setSelection(TextSelection.near(tr.doc.resolve(at + 1)))
|
||||
return true
|
||||
})
|
||||
.run()
|
||||
}
|
||||
|
||||
/** Insert an inline image from a dataURL at the cursor (shared by paste/dialog; size scaled to content width) */
|
||||
@@ -610,8 +604,12 @@ export interface InsertTabProps extends TabProps {
|
||||
onTitlePg: (v: boolean) => void
|
||||
evenOddHf: boolean
|
||||
onEvenOddHf: (v: boolean) => void
|
||||
commentCount: number
|
||||
onShowComments: () => void
|
||||
/** a selection (or a caret in a word) to anchor a new comment on, as in the Review tab */
|
||||
canComment: boolean
|
||||
onNewComment: () => void
|
||||
/** the Review-tab gate pair: commenting survives the comments-only restriction */
|
||||
isProtected: boolean
|
||||
commentsAllowed: boolean
|
||||
}
|
||||
|
||||
/** target languages of Word's Translate dropdown that the AI backend can serve;
|
||||
|
||||
@@ -15,6 +15,52 @@ export function nextCommentId(comments: CommentInfo[]): string {
|
||||
return String(max + 1)
|
||||
}
|
||||
|
||||
const WORD_SEGMENTER: Intl.Segmenter | null =
|
||||
typeof Intl !== 'undefined' && 'Segmenter' in Intl
|
||||
? new Intl.Segmenter(undefined, { granularity: 'word' })
|
||||
: null
|
||||
|
||||
/** the word-like segment containing `off`, or the one ending exactly at it (caret right after a word) */
|
||||
function wordSegmentAt(text: string, off: number): { start: number; end: number } | null {
|
||||
if (WORD_SEGMENTER) {
|
||||
let before: { start: number; end: number } | null = null
|
||||
for (const seg of WORD_SEGMENTER.segment(text)) {
|
||||
const start = seg.index
|
||||
const end = seg.index + seg.segment.length
|
||||
if (start > off) break
|
||||
if (!seg.isWordLike) continue
|
||||
if (off < end) return { start, end }
|
||||
if (end === off) before = { start, end }
|
||||
}
|
||||
return before
|
||||
}
|
||||
const isWordChar = (ch: string) => /[\p{L}\p{N}_]/u.test(ch)
|
||||
let at = off
|
||||
if ((at >= text.length || !isWordChar(text[at]!)) && at > 0 && isWordChar(text[at - 1]!)) at--
|
||||
if (at >= text.length || !isWordChar(text[at]!)) return null
|
||||
let start = at
|
||||
while (start > 0 && isWordChar(text[start - 1]!)) start--
|
||||
let end = at + 1
|
||||
while (end < text.length && isWordChar(text[end]!)) end++
|
||||
return { start, end }
|
||||
}
|
||||
|
||||
/**
|
||||
* The word under a collapsed caret, as Word anchors a new comment when
|
||||
* nothing is selected. Null for a non-empty selection, a caret outside any
|
||||
* word, or a caret in a non-text block.
|
||||
*/
|
||||
export function wordRangeAtCaret(editor: Editor): { from: number; to: number } | null {
|
||||
const { $from, empty } = editor.state.selection
|
||||
if (!empty || !$from.parent.isTextblock) return null
|
||||
// NUL stands in for leaf nodes: never word-like, so offsets stay aligned
|
||||
const text = $from.parent.textBetween(0, $from.parent.content.size, '\0', '\0')
|
||||
const seg = wordSegmentAt(text, $from.parentOffset)
|
||||
if (!seg) return null
|
||||
const start = $from.start()
|
||||
return { from: start + seg.start, to: start + seg.end }
|
||||
}
|
||||
|
||||
/** attach `id` to every text node in the current selection; false when selection is empty */
|
||||
export function addCommentToSelection(editor: Editor, id: string): boolean {
|
||||
const { state } = editor
|
||||
|
||||
@@ -98,7 +98,7 @@ import { CaretMarksMemory, FORMAT_MARKS, firstTextMarksIn, serializeMarks } from
|
||||
import { insertPageBreak } from './page-break'
|
||||
import { ColumnLayoutExtension } from './column-layout'
|
||||
import { TableHandle } from './table-handle'
|
||||
import { TrackChangesExtension } from './revisions'
|
||||
import { TRACK_IGNORE, TrackChangesExtension } from './revisions'
|
||||
import { inlineToRuns, runsToInline, textboxParaSignature, type PmNode as PmJson } from './convert'
|
||||
import { constrainTableWidthAtCell } from './table-sizing'
|
||||
|
||||
@@ -2817,6 +2817,9 @@ export function deleteSelectedWholeTable(
|
||||
return false
|
||||
}
|
||||
|
||||
/** transaction meta: document load/stream paths that must not get a trailing paragraph appended mid-stream */
|
||||
export const TABLE_TRAILING_SKIP = 'tableTrailingSkip'
|
||||
|
||||
export const NativeTableSupport = Extension.create({
|
||||
name: 'nativeTableSupport',
|
||||
extendNodeSchema(extension) {
|
||||
@@ -2871,6 +2874,23 @@ export const NativeTableSupport = Extension.create({
|
||||
}),
|
||||
columnResizing({ View: null, cellMinWidth: 40, lastColumnResizable: true }),
|
||||
tableEditing({ allowTableNodeSelection: true }),
|
||||
// Word never ends a body with a table: without a paragraph below it the
|
||||
// caret can never leave the table (public issue #266)
|
||||
new Plugin({
|
||||
appendTransaction(transactions, oldState, newState) {
|
||||
if (!transactions.some((tr) => tr.docChanged)) return null
|
||||
// undo/redo restore what the user had; appending would also wipe the redo stack
|
||||
if (transactions.some((tr) => tr.getMeta(TABLE_TRAILING_SKIP) || tr.getMeta('history$')))
|
||||
return null
|
||||
if (newState.doc.lastChild?.type.name !== 'docTable') return null
|
||||
// only when this edit made the table last: imported bodies that already
|
||||
// end with a table stay byte-identical on unrelated edits
|
||||
if (oldState.doc.lastChild?.type.name === 'docTable') return null
|
||||
return newState.tr
|
||||
.insert(newState.doc.content.size, newState.schema.nodes.docParagraph.create())
|
||||
.setMeta(TRACK_IGNORE, true)
|
||||
},
|
||||
}),
|
||||
]
|
||||
},
|
||||
})
|
||||
|
||||
@@ -1,72 +1,12 @@
|
||||
import type { Editor } from '@tiptap/core'
|
||||
import { runUiOps } from '../ai/ops'
|
||||
|
||||
/** Word's ribbon indent step: half an inch, in twips */
|
||||
const STEP = 720
|
||||
|
||||
/** paragraph-like blocks that carry indent attributes */
|
||||
const PARA_TYPES = new Set(['docParagraph', 'docHeading', 'docListItem'])
|
||||
|
||||
/**
|
||||
* Word's Ctrl+T / Ctrl+Shift+T: a hanging indent moves the left indent one stop
|
||||
* right while pulling the first line back by the same amount, so continuation
|
||||
* lines sit under the body text. Ctrl+Shift+T walks it back, and only clears the
|
||||
* negative first line once the left indent is home.
|
||||
*/
|
||||
/** Word's Ctrl+T / Ctrl+Shift+T: hanging indent one half-inch stop out or back (see the stepHangingIndent op) */
|
||||
export function stepHangingIndent(editor: Editor, delta: 1 | -1): boolean {
|
||||
return editor
|
||||
.chain()
|
||||
.focus()
|
||||
.command(({ state, tr, dispatch }) => {
|
||||
const { from, to } = state.selection
|
||||
let changed = false
|
||||
state.doc.nodesBetween(from, to, (node, pos) => {
|
||||
if (!PARA_TYPES.has(node.type.name)) return
|
||||
const left = Number(node.attrs.indentLeft) || 0
|
||||
const nextLeft = Math.max(
|
||||
delta > 0 ? Math.floor(left / STEP) * STEP + STEP : Math.ceil(left / STEP) * STEP - STEP,
|
||||
0,
|
||||
)
|
||||
const nextHanging = nextLeft > 0 ? -Math.min(nextLeft, STEP) : 0
|
||||
if (nextLeft === left && nextHanging === (Number(node.attrs.indentFirstLine) || 0)) return
|
||||
tr.setNodeMarkup(pos, undefined, {
|
||||
...node.attrs,
|
||||
indentLeft: nextLeft || null,
|
||||
indentFirstLine: nextHanging || null,
|
||||
})
|
||||
changed = true
|
||||
})
|
||||
if (changed && dispatch) dispatch(tr)
|
||||
return changed
|
||||
})
|
||||
.run()
|
||||
return runUiOps(editor, [{ op: 'stepHangingIndent', target: { scope: 'selection' }, delta }])
|
||||
}
|
||||
|
||||
/** Ribbon increase/decrease indent: list items change level, plain paragraphs and headings snap to the next half-inch stop */
|
||||
/** Ribbon increase/decrease indent: list items change level, paragraphs and headings snap to the next half-inch stop */
|
||||
export function stepParagraphIndent(editor: Editor, delta: 1 | -1): boolean {
|
||||
if (editor.isActive('docListItem')) {
|
||||
const ilvl = Number(editor.getAttributes('docListItem').ilvl) || 0
|
||||
const next = Math.min(Math.max(ilvl + delta, 0), 8)
|
||||
return editor.chain().focus().updateAttributes('docListItem', { ilvl: next }).run()
|
||||
}
|
||||
return editor
|
||||
.chain()
|
||||
.focus()
|
||||
.command(({ state, tr, dispatch }) => {
|
||||
const { from, to } = state.selection
|
||||
let changed = false
|
||||
state.doc.nodesBetween(from, to, (node, pos) => {
|
||||
if (node.type.name !== 'docParagraph' && node.type.name !== 'docHeading') return
|
||||
const cur = Number(node.attrs.indentLeft) || 0
|
||||
const next =
|
||||
delta > 0
|
||||
? Math.floor(cur / STEP) * STEP + STEP
|
||||
: Math.max(Math.ceil(cur / STEP) * STEP - STEP, 0)
|
||||
if (next === cur) return
|
||||
tr.setNodeMarkup(pos, undefined, { ...node.attrs, indentLeft: next || null })
|
||||
changed = true
|
||||
})
|
||||
if (changed && dispatch) dispatch(tr)
|
||||
return changed
|
||||
})
|
||||
.run()
|
||||
return runUiOps(editor, [{ op: 'stepIndent', target: { scope: 'selection' }, delta }])
|
||||
}
|
||||
|
||||
@@ -4,12 +4,55 @@
|
||||
* win, else the marks at the insertion position. ProseMirror's default
|
||||
* clipboardTextParser only reads the position's marks — an emptied paragraph
|
||||
* has none and its pilcrow memory lives in storedMarks (caret-marks.ts), so
|
||||
* pasting after select→Delete fell back to the theme font (alpha ledger r172).
|
||||
* pasting after select→Delete fell back to the theme font.
|
||||
*/
|
||||
import type { ResolvedPos } from '@tiptap/pm/model'
|
||||
import { Fragment, Slice } from '@tiptap/pm/model'
|
||||
import type { EditorView } from '@tiptap/pm/view'
|
||||
|
||||
/**
|
||||
* The text of a paste whose entire payload is one single-cell table carrying
|
||||
* no formatting of its own, or null for everything else. Companion to the
|
||||
* single-cell unwrap: that paste is semantically text, so
|
||||
* it must take the insertion point's formatting like typing — the HTML parse
|
||||
* lane keeps no marks for a bare cell and fell back to the theme font (alpha
|
||||
* ledger r176: a Sheets cell pasted into Docs as the theme font). A cell with
|
||||
* formatting elements of its own (a rich-text cell) keeps the HTML lane; a
|
||||
* style attribute on the td itself is not that — the unwrap never kept it.
|
||||
*/
|
||||
export function singleCellPasteText(html: string): string | null {
|
||||
if (!/<table/i.test(html)) return null
|
||||
try {
|
||||
const doc = new window.DOMParser().parseFromString(html, 'text/html')
|
||||
const body = doc.body
|
||||
const tables = body.querySelectorAll('table')
|
||||
if (tables.length !== 1) return null
|
||||
const table = tables[0]!
|
||||
// same whole-payload guards as the unwrap: prose or media anywhere
|
||||
// outside the table keeps the HTML lane
|
||||
if ((body.textContent ?? '').trim() !== (table.textContent ?? '').trim()) return null
|
||||
if (
|
||||
[...body.querySelectorAll('img,svg,video,hr')].some((element) => !table.contains(element))
|
||||
) {
|
||||
return null
|
||||
}
|
||||
const cells = table.querySelectorAll('td,th')
|
||||
if (cells.length !== 1) return null
|
||||
const cell = cells[0]!
|
||||
// text nodes and explicit line breaks only; any other element is
|
||||
// formatting the HTML lane should keep
|
||||
let text = ''
|
||||
for (const node of cell.childNodes) {
|
||||
if (node.nodeType === 3 /* TEXT_NODE */) text += node.textContent ?? ''
|
||||
else if (node.nodeName === 'BR') text += '\n'
|
||||
else return null
|
||||
}
|
||||
return text.trim() ? text : null
|
||||
} catch {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
export function pasteTextSlice(text: string, $context: ResolvedPos, view: EditorView): Slice {
|
||||
// same precedence as typing (storedMarks ?? marks at caret); an explicit
|
||||
// empty array from a user toggle is respected, like typing would
|
||||
|
||||
@@ -52,6 +52,7 @@ import {
|
||||
import { docStyleCss } from './doc-style-css'
|
||||
import type { CompareEntry } from './editor/compare'
|
||||
import { blocksToPmDoc, pmDocToSavePlan, type PmNode } from './editor/convert'
|
||||
import { TABLE_TRAILING_SKIP } from './editor/extensions'
|
||||
import { TRACK_IGNORE } from './editor/revisions'
|
||||
import {
|
||||
cancelPhasedContent,
|
||||
@@ -78,6 +79,7 @@ import { defaultEastAsiaFontFor } from './font-list'
|
||||
import { hasPrintableHeaderFooter } from './pagination'
|
||||
import { clearPrintZoom, setPrintZoom } from './print-zoom'
|
||||
import { showToast } from './components/toast-bus'
|
||||
import { buildStandaloneHtml } from './html-export'
|
||||
|
||||
/** An export waiting for the pagination preview to mount; resolve settles the caller's exportPdf promise. */
|
||||
export type PendingPdfExport = { outPath?: string; resolve: (ok: boolean) => void }
|
||||
@@ -278,6 +280,7 @@ export function appendStreamedNodes(editor: Editor, nodes: PmNode[]): void {
|
||||
tr.setMeta('addToHistory', false)
|
||||
// forced Track Changes must not record the streamed tail as insertions
|
||||
tr.setMeta(TRACK_IGNORE, true)
|
||||
tr.setMeta(TABLE_TRAILING_SKIP, true)
|
||||
editor.view.dispatch(tr)
|
||||
carryDocSeen(editor, before)
|
||||
}
|
||||
@@ -289,6 +292,7 @@ function phasedHostFor(ctx: FileActionContext): PhasedContentHost {
|
||||
ctx.editor
|
||||
?.chain()
|
||||
.setMeta(TRACK_IGNORE, true)
|
||||
.setMeta(TABLE_TRAILING_SKIP, true)
|
||||
.setContent(doc as never)
|
||||
.run(),
|
||||
appendNodes: (nodes) => {
|
||||
@@ -1248,3 +1252,29 @@ export async function exportPdf(ctx: FileActionContext, outPath?: string): Promi
|
||||
printJobActive = false
|
||||
}
|
||||
}
|
||||
|
||||
/** Resolves true only when an HTML file was written to disk. */
|
||||
export async function exportHtml(ctx: FileActionContext, outPath?: string): Promise<boolean> {
|
||||
const { doc, editor } = ctx
|
||||
if (!doc || !editor) return false
|
||||
await waitForFullContent()
|
||||
ctx.setStatus(t('appExportingHtml'))
|
||||
const root = editor.view.dom as HTMLElement
|
||||
const textWidthPx = Number.parseFloat(
|
||||
getComputedStyle(root).getPropertyValue('--section-content-w'),
|
||||
)
|
||||
const html = buildStandaloneHtml(root, {
|
||||
title: doc.fileName.replace(/\.docx$/i, ''),
|
||||
lang: getLang(),
|
||||
textWidthPx: Number.isFinite(textWidthPx) ? textWidthPx : root.clientWidth,
|
||||
})
|
||||
const result = await window.desktop.exportHtml(doc.fileName, html, outPath)
|
||||
ctx.setStatus(
|
||||
result.ok
|
||||
? t('appExportedHtml', { path: result.path ?? '' })
|
||||
: result.error
|
||||
? t('appExportHtmlFailed', { error: result.error })
|
||||
: t('appExportHtmlCanceled'),
|
||||
)
|
||||
return result.ok
|
||||
}
|
||||
|
||||
@@ -0,0 +1,449 @@
|
||||
/** Standalone HTML export: live editor DOM re-emitted with computed styles inlined, no app CSS needed. */
|
||||
|
||||
const SKIP_CLASSES = new Set([
|
||||
'ProseMirror-widget',
|
||||
'ProseMirror-separator',
|
||||
'ProseMirror-gapcursor',
|
||||
'doc-del',
|
||||
'doc-anchor-origin',
|
||||
'doc-anchor-strut',
|
||||
'doc-image-anchor-marker',
|
||||
'doc-inline-img-anchor',
|
||||
'ai-queue-anchor',
|
||||
'page-gap',
|
||||
'page-gap-cut',
|
||||
'page-gap-table-fill',
|
||||
'page-cut-overlays',
|
||||
'page-break-lead',
|
||||
'page-hf',
|
||||
'doc-sectbreak-label',
|
||||
'doc-protected-sectbreak',
|
||||
'doc-move-handle',
|
||||
'box-resize-handle',
|
||||
])
|
||||
|
||||
const UNWRAP_CLASSES = new Set([
|
||||
'doc-comment',
|
||||
'doc-comment-resolved',
|
||||
'comment-pending',
|
||||
'doc-ins',
|
||||
'has-rpr-change',
|
||||
'doc-inactive-selection',
|
||||
'doc-comment-flash',
|
||||
])
|
||||
|
||||
const KEEP_WIDGET_CLASSES = ['page-float-host']
|
||||
|
||||
const KEEP_ATTRS = ['href', 'src', 'alt', 'title', 'colspan', 'rowspan', 'dir', 'lang', 'target']
|
||||
|
||||
const INHERITED = [
|
||||
'font-family',
|
||||
'font-size',
|
||||
'font-weight',
|
||||
'font-style',
|
||||
'font-variant',
|
||||
'font-feature-settings',
|
||||
'color',
|
||||
'line-height',
|
||||
'letter-spacing',
|
||||
'word-spacing',
|
||||
'text-align',
|
||||
'text-align-last',
|
||||
'text-indent',
|
||||
'text-transform',
|
||||
'text-shadow',
|
||||
'direction',
|
||||
'white-space',
|
||||
'word-break',
|
||||
'overflow-wrap',
|
||||
'line-break',
|
||||
'tab-size',
|
||||
'writing-mode',
|
||||
'list-style-type',
|
||||
'list-style-position',
|
||||
'border-collapse',
|
||||
'border-spacing',
|
||||
'visibility',
|
||||
] as const
|
||||
|
||||
const INITIAL: Record<string, string> = {
|
||||
'font-weight': '400',
|
||||
'font-style': 'normal',
|
||||
'font-variant': 'normal',
|
||||
'font-feature-settings': 'normal',
|
||||
'letter-spacing': 'normal',
|
||||
'word-spacing': '0px',
|
||||
'text-align': 'start',
|
||||
'text-align-last': 'auto',
|
||||
'text-indent': '0px',
|
||||
'text-transform': 'none',
|
||||
'text-shadow': 'none',
|
||||
direction: 'ltr',
|
||||
'white-space': 'normal',
|
||||
'word-break': 'normal',
|
||||
'overflow-wrap': 'normal',
|
||||
'line-break': 'auto',
|
||||
'tab-size': '8',
|
||||
'writing-mode': 'horizontal-tb',
|
||||
'list-style-type': 'disc',
|
||||
'list-style-position': 'outside',
|
||||
'border-collapse': 'separate',
|
||||
'border-spacing': '0px',
|
||||
visibility: 'visible',
|
||||
}
|
||||
|
||||
const BIDI_KEEP = new Set(['bidi-override', 'isolate-override', 'plaintext', 'embed'])
|
||||
|
||||
/** Review / content-control badges drawn by the editor, not document text. */
|
||||
const CHROME_PSEUDO_CONTENT = /attr\(\s*data-(?:ppr-change-label|sdt-alias)\s*\)/
|
||||
|
||||
const INTERNAL_FONTS = /,\s*"(?:[A-Za-z ]+ GO|GenOffice [A-Za-z ]+)"/g
|
||||
|
||||
const SIDES = ['top', 'right', 'bottom', 'left'] as const
|
||||
|
||||
const TAG_DISPLAY: Record<string, string> = {
|
||||
div: 'block',
|
||||
p: 'block',
|
||||
h1: 'block',
|
||||
h2: 'block',
|
||||
h3: 'block',
|
||||
h4: 'block',
|
||||
h5: 'block',
|
||||
h6: 'block',
|
||||
ul: 'block',
|
||||
ol: 'block',
|
||||
li: 'list-item',
|
||||
table: 'table',
|
||||
caption: 'table-caption',
|
||||
colgroup: 'table-column-group',
|
||||
col: 'table-column',
|
||||
thead: 'table-header-group',
|
||||
tbody: 'table-row-group',
|
||||
tfoot: 'table-footer-group',
|
||||
tr: 'table-row',
|
||||
td: 'table-cell',
|
||||
th: 'table-cell',
|
||||
span: 'inline',
|
||||
a: 'inline',
|
||||
img: 'inline',
|
||||
br: 'inline',
|
||||
strong: 'inline',
|
||||
em: 'inline',
|
||||
u: 'inline',
|
||||
s: 'inline',
|
||||
sub: 'inline',
|
||||
sup: 'inline',
|
||||
code: 'inline',
|
||||
ruby: 'ruby',
|
||||
rt: 'ruby-text',
|
||||
math: 'inline',
|
||||
svg: 'inline',
|
||||
}
|
||||
|
||||
const PASSTHROUGH_TAGS = new Set(['svg', 'math'])
|
||||
|
||||
const VOID_TAGS = new Set(['br', 'img', 'hr', 'col'])
|
||||
|
||||
const ESC: Record<string, string> = { '&': '&', '<': '<', '>': '>', '"': '"' }
|
||||
const escHtml = (s: string) => s.replace(/[&<>"]/g, (c) => ESC[c])
|
||||
const escText = (s: string) => s.replace(/[&<>]/g, (c) => ESC[c])
|
||||
|
||||
const isZero = (v: string) => v === '0px' || v === '0' || v === ''
|
||||
const isTransparent = (v: string) => v === 'rgba(0, 0, 0, 0)' || v === 'transparent' || v === ''
|
||||
|
||||
function hasClass(el: Element, set: Set<string> | string[]): boolean {
|
||||
for (const c of el.classList) {
|
||||
if (Array.isArray(set) ? set.includes(c) : set.has(c)) return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
export function resolveContent(content: string, el: Element): string {
|
||||
if (!content || content === 'none' || content === 'normal') return ''
|
||||
let out = ''
|
||||
const re =
|
||||
/"((?:[^"\\]|\\.)*)"|'((?:[^'\\]|\\.)*)'|attr\(\s*([\w-]+)\s*\)|counter\(\s*([\w-]+)[^)]*\)/g
|
||||
let m: RegExpExecArray | null
|
||||
while ((m = re.exec(content))) {
|
||||
if (m[1] !== undefined || m[2] !== undefined) {
|
||||
out += (m[1] ?? m[2]).replace(/\\([0-9a-fA-F]{1,6})\s?/g, (_, hex: string) =>
|
||||
String.fromCodePoint(parseInt(hex, 16)),
|
||||
)
|
||||
} else if (m[3]) {
|
||||
out += el.getAttribute(m[3]) ?? ''
|
||||
} else if (m[4]) {
|
||||
out += String(orderedIndex(el))
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
function orderedIndex(el: Element): number {
|
||||
let n = 1
|
||||
let prev = el.previousElementSibling
|
||||
while (prev && prev.classList.contains('doc-li-ordered')) {
|
||||
n++
|
||||
prev = prev.previousElementSibling
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
function emitTag(el: Element, cs: CSSStyleDeclaration): string {
|
||||
const tag = el.tagName.toLowerCase()
|
||||
if (tag in TAG_DISPLAY) return tag
|
||||
const d = cs.display
|
||||
return d.startsWith('inline') || d === 'contents' ? 'span' : 'div'
|
||||
}
|
||||
|
||||
function borderDecl(cs: CSSStyleDeclaration, side: string): string | null {
|
||||
const w = cs.getPropertyValue(`border-${side}-width`)
|
||||
const st = cs.getPropertyValue(`border-${side}-style`)
|
||||
if (isZero(w) || st === 'none' || st === 'hidden') return null
|
||||
return `border-${side}:${w} ${st} ${cs.getPropertyValue(`border-${side}-color`)}`
|
||||
}
|
||||
|
||||
interface StyleOpts {
|
||||
parent: CSSStyleDeclaration | null
|
||||
tag: string
|
||||
authoredWidth: boolean
|
||||
authoredHeight: boolean
|
||||
skipBorders: boolean
|
||||
positioned: boolean
|
||||
}
|
||||
|
||||
function styleDecls(cs: CSSStyleDeclaration, o: StyleOpts): string[] {
|
||||
const out: string[] = []
|
||||
for (const p of INHERITED) {
|
||||
let v = cs.getPropertyValue(p)
|
||||
if (!v) continue
|
||||
if (o.parent ? o.parent.getPropertyValue(p) === v : INITIAL[p] === v) continue
|
||||
if (p === 'font-family') v = v.replace(INTERNAL_FONTS, '')
|
||||
out.push(`${p}:${v}`)
|
||||
}
|
||||
const bidi = cs.unicodeBidi
|
||||
if (BIDI_KEEP.has(bidi) && o.parent?.unicodeBidi !== bidi) out.push(`unicode-bidi:${bidi}`)
|
||||
const display = cs.display
|
||||
const defaultDisplay = TAG_DISPLAY[o.tag] ?? 'block'
|
||||
if (o.positioned) {
|
||||
if (display !== 'block') out.push('display:block')
|
||||
} else if (display !== defaultDisplay && display !== 'none') {
|
||||
out.push(`display:${display}`)
|
||||
}
|
||||
const margins = SIDES.map((s) => cs.getPropertyValue(`margin-${s}`))
|
||||
if (margins.some((m) => !isZero(m))) out.push(`margin:${margins.join(' ')}`)
|
||||
const pads = SIDES.map((s) => cs.getPropertyValue(`padding-${s}`))
|
||||
if (pads.some((m) => !isZero(m))) out.push(`padding:${pads.join(' ')}`)
|
||||
if (!o.skipBorders) {
|
||||
for (const s of SIDES) {
|
||||
const b = borderDecl(cs, s)
|
||||
if (b) out.push(b)
|
||||
}
|
||||
const radius = cs.borderRadius
|
||||
if (radius && !isZero(radius)) out.push(`border-radius:${radius}`)
|
||||
}
|
||||
if (!isTransparent(cs.backgroundColor)) out.push(`background-color:${cs.backgroundColor}`)
|
||||
if (cs.backgroundImage && cs.backgroundImage !== 'none') {
|
||||
out.push(`background-image:${cs.backgroundImage}`)
|
||||
out.push(`background-size:${cs.backgroundSize}`)
|
||||
out.push(`background-position:${cs.backgroundPosition}`)
|
||||
out.push(`background-repeat:${cs.backgroundRepeat}`)
|
||||
}
|
||||
const deco = cs.textDecorationLine
|
||||
if (deco && deco !== 'none') {
|
||||
out.push(`text-decoration:${deco} ${cs.textDecorationStyle} ${cs.textDecorationColor}`)
|
||||
}
|
||||
if (cs.verticalAlign && cs.verticalAlign !== 'baseline')
|
||||
out.push(`vertical-align:${cs.verticalAlign}`)
|
||||
const sized =
|
||||
o.tag === 'img' ||
|
||||
o.tag === 'svg' ||
|
||||
o.tag === 'table' ||
|
||||
o.tag === 'td' ||
|
||||
o.tag === 'th' ||
|
||||
display === 'inline-block' ||
|
||||
o.positioned
|
||||
if (o.tag !== 'img') {
|
||||
if ((sized || o.authoredWidth) && cs.width && cs.width !== 'auto') out.push(`width:${cs.width}`)
|
||||
if ((o.tag === 'svg' || o.authoredHeight) && cs.height && cs.height !== 'auto') {
|
||||
out.push(`height:${cs.height}`)
|
||||
}
|
||||
}
|
||||
if (cs.minWidth && !isZero(cs.minWidth) && cs.minWidth !== 'auto')
|
||||
out.push(`min-width:${cs.minWidth}`)
|
||||
if (cs.maxWidth && cs.maxWidth !== 'none') out.push(`max-width:${cs.maxWidth}`)
|
||||
if (cs.float && cs.float !== 'none') out.push(`float:${cs.float}`)
|
||||
if (cs.clear && cs.clear !== 'none') out.push(`clear:${cs.clear}`)
|
||||
if (cs.transform && cs.transform !== 'none' && cs.transform !== 'matrix(1, 0, 0, 1, 0, 0)') {
|
||||
out.push(`transform:${cs.transform}`)
|
||||
}
|
||||
if (cs.opacity && cs.opacity !== '1') out.push(`opacity:${cs.opacity}`)
|
||||
if (cs.columnCount && cs.columnCount !== 'auto') {
|
||||
out.push(`column-count:${cs.columnCount}`)
|
||||
out.push(`column-gap:${cs.columnGap}`)
|
||||
}
|
||||
if (cs.breakBefore === 'page' || cs.breakBefore === 'always') out.push('page-break-before:always')
|
||||
if (cs.breakAfter === 'page' || cs.breakAfter === 'always') out.push('page-break-after:always')
|
||||
if (cs.boxSizing === 'border-box' && (sized || o.authoredWidth)) out.push('box-sizing:border-box')
|
||||
return out.map((d) =>
|
||||
d.replace(/(-?\d+\.\d{3,})px/g, (_, n: string) => `${parseFloat(Number(n).toFixed(2))}px`),
|
||||
)
|
||||
}
|
||||
|
||||
export interface HtmlExportOptions {
|
||||
title: string
|
||||
lang?: string
|
||||
textWidthPx?: number
|
||||
}
|
||||
|
||||
const SCREEN_ONLY_CLASSES = ['page-dark', 'show-marks', 'workspace-dark']
|
||||
|
||||
/** Screen-only ancestor classes (dark page, marks) are lifted during the synchronous walk so every theme exports the same file. */
|
||||
export function buildStandaloneHtml(root: HTMLElement, opts: HtmlExportOptions): string {
|
||||
const restore: Array<() => void> = []
|
||||
for (let el: HTMLElement | null = root; el; el = el.parentElement) {
|
||||
for (const c of SCREEN_ONLY_CLASSES) {
|
||||
if (el.classList.contains(c)) {
|
||||
const target = el
|
||||
target.classList.remove(c)
|
||||
restore.push(() => target.classList.add(c))
|
||||
}
|
||||
}
|
||||
}
|
||||
try {
|
||||
return serializeDocument(root, opts)
|
||||
} finally {
|
||||
for (const r of restore) r()
|
||||
}
|
||||
}
|
||||
|
||||
function serializeDocument(root: HTMLElement, opts: HtmlExportOptions): string {
|
||||
const win = root.ownerDocument.defaultView
|
||||
if (!win) return ''
|
||||
const rootCs = win.getComputedStyle(root)
|
||||
const rootDecls = styleDecls(rootCs, {
|
||||
parent: null,
|
||||
tag: 'div',
|
||||
authoredWidth: false,
|
||||
authoredHeight: false,
|
||||
skipBorders: true,
|
||||
positioned: false,
|
||||
}).filter((d) => !/^(margin|padding|width|max-width|min-width|box-sizing|background)/.test(d))
|
||||
const body: string[] = []
|
||||
for (const child of Array.from(root.childNodes)) serializeNode(child, rootCs, win, body)
|
||||
const width =
|
||||
opts.textWidthPx && opts.textWidthPx > 0 ? `${Math.round(opts.textWidthPx)}px` : '8.5in'
|
||||
const lang = opts.lang ? ` lang="${escHtml(opts.lang)}"` : ''
|
||||
const dir = rootCs.direction === 'rtl' ? ' dir="rtl"' : ''
|
||||
return (
|
||||
`<!DOCTYPE html>\n<html${lang}${dir}>\n<head>\n<meta charset="utf-8">\n` +
|
||||
`<meta name="viewport" content="width=device-width, initial-scale=1">\n` +
|
||||
`<title>${escText(opts.title)}</title>\n` +
|
||||
`<style>\nbody{margin:0;background:#fff}\n` +
|
||||
`p,h1,h2,h3,h4,h5,h6,ul,ol,li,table,td,th,div,span{margin:0;padding:0}\n` +
|
||||
`h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}\n` +
|
||||
`ul,ol{list-style:none}\na{color:inherit;text-decoration:inherit}\n` +
|
||||
`sub,sup{font-size:inherit;line-height:inherit;vertical-align:baseline}\n` +
|
||||
`.doc{max-width:${width};margin:0 auto;padding:48px 40px;box-sizing:content-box}\n` +
|
||||
`img{max-width:100%;height:auto}\ntable{border-collapse:collapse;border-spacing:0}\n` +
|
||||
`@media print{.doc{max-width:none;padding:0}}\n</style>\n</head>\n<body>\n` +
|
||||
`<div class="doc" style="${escHtml(rootDecls.join(';'))}">${body.join('')}</div>\n</body>\n</html>\n`
|
||||
)
|
||||
}
|
||||
|
||||
function serializeNode(
|
||||
node: Node,
|
||||
parentCs: CSSStyleDeclaration,
|
||||
win: Window,
|
||||
out: string[],
|
||||
): void {
|
||||
if (node.nodeType === Node.TEXT_NODE) {
|
||||
out.push(escText(node.nodeValue ?? ''))
|
||||
return
|
||||
}
|
||||
if (node.nodeType !== Node.ELEMENT_NODE) return
|
||||
const el = node as HTMLElement
|
||||
if (hasClass(el, SKIP_CLASSES) && !hasClass(el, KEEP_WIDGET_CLASSES)) return
|
||||
const cs = win.getComputedStyle(el)
|
||||
if (cs.display === 'none' || cs.visibility === 'hidden' || cs.opacity === '0') return
|
||||
if (hasClass(el, UNWRAP_CLASSES)) {
|
||||
// diff children against the wrapper so its inherited review styling (e.g. insertion
|
||||
// color) is dropped rather than re-inlined on nested elements
|
||||
for (const child of Array.from(el.childNodes)) serializeNode(child, cs, win, out)
|
||||
return
|
||||
}
|
||||
const rawTag = el.tagName.toLowerCase()
|
||||
if (PASSTHROUGH_TAGS.has(rawTag)) {
|
||||
const clone = el.cloneNode(true) as Element
|
||||
clone.removeAttribute('class')
|
||||
const size = [`width:${cs.width}`, `height:${cs.height}`]
|
||||
if (cs.verticalAlign !== 'baseline') size.push(`vertical-align:${cs.verticalAlign}`)
|
||||
clone.setAttribute('style', size.join(';'))
|
||||
out.push(clone.outerHTML)
|
||||
return
|
||||
}
|
||||
const tag = emitTag(el, cs)
|
||||
const positioned = cs.position === 'absolute' || cs.position === 'fixed'
|
||||
const decls = styleDecls(cs, {
|
||||
parent: parentCs,
|
||||
tag,
|
||||
authoredWidth: !!el.style.width,
|
||||
authoredHeight: !!el.style.height,
|
||||
skipBorders: el.classList.contains('has-ppr-change'),
|
||||
positioned,
|
||||
})
|
||||
if (positioned) {
|
||||
const host = el.offsetParent as HTMLElement | null
|
||||
const side =
|
||||
host && el.offsetLeft + el.offsetWidth / 2 > host.clientWidth / 2 ? 'right' : 'left'
|
||||
decls.push(`float:${side}`, 'margin:4px 8px')
|
||||
}
|
||||
const before = pseudo(el, cs, '::before', win)
|
||||
const after = pseudo(el, cs, '::after', win)
|
||||
const attrs: string[] = []
|
||||
for (const a of KEEP_ATTRS) {
|
||||
const v = el.getAttribute(a)
|
||||
if (v !== null && v !== '') attrs.push(` ${a}="${escHtml(v)}"`)
|
||||
}
|
||||
if (tag === 'a' && !el.getAttribute('href')) attrs.length = 0
|
||||
if (tag === 'img') {
|
||||
const w = Math.round(parseFloat(cs.width))
|
||||
const h = Math.round(parseFloat(cs.height))
|
||||
if (w > 0 && h > 0) attrs.push(` width="${w}" height="${h}"`)
|
||||
// crop windows and diagram fills deliberately overflow their box: keep them unclamped
|
||||
const box = el.parentElement?.clientWidth ?? 0
|
||||
if (box > 0 && w > box + 1) decls.push('max-width:none')
|
||||
}
|
||||
const style = decls.length ? ` style="${escHtml(decls.join(';'))}"` : ''
|
||||
if (VOID_TAGS.has(tag)) {
|
||||
out.push(`<${tag}${attrs.join('')}${style}>`)
|
||||
return
|
||||
}
|
||||
out.push(`<${tag}${attrs.join('')}${style}>`)
|
||||
if (before) out.push(before)
|
||||
for (const child of Array.from(el.childNodes)) serializeNode(child, cs, win, out)
|
||||
if (after) out.push(after)
|
||||
out.push(`</${tag}>`)
|
||||
}
|
||||
|
||||
function pseudo(
|
||||
el: HTMLElement,
|
||||
elCs: CSSStyleDeclaration,
|
||||
which: '::before' | '::after',
|
||||
win: Window,
|
||||
): string {
|
||||
const cs = win.getComputedStyle(el, which)
|
||||
if (!cs || cs.display === 'none' || cs.visibility === 'hidden') return ''
|
||||
if (CHROME_PSEUDO_CONTENT.test(cs.content)) return ''
|
||||
const text = resolveContent(cs.content, el)
|
||||
if (!text) return ''
|
||||
const decls = styleDecls(cs, {
|
||||
parent: elCs,
|
||||
tag: 'span',
|
||||
authoredWidth: false,
|
||||
authoredHeight: false,
|
||||
skipBorders: false,
|
||||
positioned: false,
|
||||
})
|
||||
const style = decls.length ? ` style="${escHtml(decls.join(';'))}"` : ''
|
||||
return `<span${style}>${escText(text)}</span>`
|
||||
}
|
||||
@@ -126,6 +126,7 @@ export const ar = {
|
||||
aiSumCreateDocument: 'إنشاء مستند جديد',
|
||||
aiSumCreatedDocument: 'تم إنشاء {name}',
|
||||
aiSumReplaceContent: 'استبدال المحتوى',
|
||||
aiSumReplaceSelection: 'استبدال النص المحدد',
|
||||
aiSumReplacedBlocks: 'تم استبدال الكتل {start}-{end}',
|
||||
aiSumInsertChart: 'إدراج مخطط',
|
||||
aiSumInsertedChart: 'تم إدراج المخطط «{title}»',
|
||||
|
||||
@@ -0,0 +1,158 @@
|
||||
import type { zh } from './zh'
|
||||
|
||||
export const cs = {
|
||||
aiEmptyDraftTitle: 'Nechte AI napsat návrh tohoto dokumentu za vás',
|
||||
aiEmptyDraftBody1: 'Popište téma a hlavní body nebo vložte referenční materiál;',
|
||||
aiEmptyDraftBody2: 'AI napíše první návrh přímo na stránku.',
|
||||
aiStarterSummarize: 'Shrnout hlavní body tohoto dokumentu',
|
||||
aiStarterPolishAll: 'Vylepšit celý dokument pro profesionálnější tón',
|
||||
aiStarterContinue: 'Pokračovat v psaní tam, kde dokument končí',
|
||||
aiStarterFillTemplate: 'Najít a vyplnit zástupné texty v tomto dokumentu',
|
||||
aiGskLoginBtn: 'Přihlásit se ke Genspark',
|
||||
aiPanelTitle: 'Genspark',
|
||||
aiOpenAssistant: 'Otevřít asistenta AI',
|
||||
aiSummarizeBtn: 'Shrnutí AI',
|
||||
aiSummarizePrompt: 'Shrňte hlavní obsah a klíčové body tohoto dokumentu',
|
||||
aiPolishBtn: 'Vylepšení AI',
|
||||
aiPolishPrompt: 'Vylepšete celý dokument tak, aby byl text jasnější a plynulejší',
|
||||
aiPolishSelectionPrompt: 'Vylepšete vybraný obsah tak, aby byl text jasnější a plynulejší',
|
||||
aiScopeSelection: 'Vybráno: {words} slov',
|
||||
aiScopeSelectionTip:
|
||||
'Požadavky na přepsání se ve výchozím nastavení vztahují na výběr; klepnutím zobrazíte náhled',
|
||||
aiScopeClearTitle: 'Zrušit rozsah výběru',
|
||||
aiAskBtn: 'Zeptat se AI',
|
||||
aiAskTitle: 'Zeptat se AI na výběr',
|
||||
aiAskEditTitle: 'Upravit tuto zařazenou instrukci',
|
||||
aiAskPlaceholder: 'Popište změnu…',
|
||||
aiAskSendNow: 'Odeslat hned',
|
||||
aiAskQueue: 'Přidat do fronty',
|
||||
aiAskUpdate: 'Aktualizovat',
|
||||
aiChipPolish: 'Vylepšit tuto pasáž',
|
||||
aiChipShorten: 'Zestručnit tuto pasáž',
|
||||
aiChipExpand: 'Rozšířit tuto pasáž',
|
||||
aiChipFixGrammar: 'Opravit gramatiku a překlepy',
|
||||
aiChipReplaceImage: 'Nahradit obrázek',
|
||||
aiChipRegenImage: 'Vygenerovat znovu pomocí AI',
|
||||
aiChipImageCaption: 'Přidat titulek',
|
||||
aiChipChartData: 'Aktualizovat data grafu',
|
||||
aiChipChartTitle: 'Změnit název grafu',
|
||||
aiChipTableEdit: 'Upravit řádky/sloupce',
|
||||
aiQueueTitle: 'Zařazené úpravy',
|
||||
aiQueueHint:
|
||||
'Klepnutím na řádek najdete jeho pasáž; odeslání použije všechny úpravy jako jeden požadavek',
|
||||
aiQueueSend: 'Odeslat úpravy ({count})',
|
||||
aiQueueDiscard: 'Zahodit',
|
||||
aiQueueDiscardConfirm: 'Zahodit všechny zařazené úpravy ({count})?',
|
||||
aiQueueRowEdit: 'Upravit',
|
||||
aiQueueOrphan: 'Cílový text byl odstraněn',
|
||||
aiQueueFullNotice: 'Fronta je plná (max. {max})',
|
||||
aiQueueSubmitted: 'Dávka úprav ({count}):',
|
||||
aiSumReadComments: 'Přečteny komentáře',
|
||||
aiSumReadRevisions: 'Přečteny revize',
|
||||
aiSumReplyComment: 'Odpovězeno na komentář',
|
||||
aiSumResolveComment: 'Komentář vyřešen',
|
||||
aiTidyBtn: 'Formátování AI',
|
||||
aiTidyPrompt:
|
||||
'Upravte formátování dokumentu – například opravte úrovně nadpisů, sjednoťte formátování seznamů, odeberte nadbytečné tučné písmo a kurzívu a zajistěte jednotné odsazení odstavců. Upravujte pouze formátování – neměňte žádný textový obsah',
|
||||
aiSwitchModelTitle: 'Přepnout model AI',
|
||||
aiNewChatTitle: 'Nový chat',
|
||||
aiCollapseTitle: 'Sbalit panel',
|
||||
aiHistorySep: '—— Předchozí konverzace ——',
|
||||
aiEmptyTitle: 'Nechte si od AI pomoci s psaním a úpravami',
|
||||
aiEmptyBody1: 'Zadejte pokyn nebo jen položte otázku;',
|
||||
aiEmptyBody2: 'při vybraném textu se příkazy k přepsání vztahují na výběr.',
|
||||
aiStarterWeeklyReport: 'Napište mi týdenní zprávu o projektu',
|
||||
aiStarterLaunchPost: 'Připravte oznámení o uvedení produktu',
|
||||
aiStarterEventOutline: 'Sestavte osnovu plánu akce',
|
||||
aiThinking: 'Přemýšlí',
|
||||
aiWorkedSteps: 'Hotovo · {n} kroků',
|
||||
aiGroupWorking: 'Pracuje…',
|
||||
aiWorking: 'Pracuje',
|
||||
aiErrorPrefix: 'Chyba: {error}',
|
||||
aiCopyReplyTitle: 'Kopírovat odpověď',
|
||||
aiCopied: 'Zkopírováno',
|
||||
aiRegenerateTitle: 'Vygenerovat znovu',
|
||||
aiSnapshotsTitle: 'Snímky',
|
||||
aiRollback: 'Vrátit zpět',
|
||||
aiScopeSelected: 'Vybráno odstavců: {count}',
|
||||
aiScopeEmptyDoc: 'Prázdný dokument',
|
||||
aiScopeCursor: 'Na pozici kurzoru',
|
||||
aiInputPlaceholder: 'Popište úpravu nebo úkol psaní, nebo položte otázku',
|
||||
aiHintIdle: 'Enter odešle',
|
||||
aiHintBusy: 'Esc zastaví',
|
||||
aiHintIdleTitle: 'Enter odešle · Shift+Enter nový řádek',
|
||||
aiSend: 'Odeslat',
|
||||
aiStop: 'Zastavit',
|
||||
aiContinue: 'Pokračovat',
|
||||
aiAttachTitle: 'Připojit místní soubory (nebo je přetáhněte na panel)',
|
||||
aiRemoveAttachmentTitle: 'Odebrat přílohu',
|
||||
aiTrackChanges: 'Sledování změn',
|
||||
aiTrackOnTitle:
|
||||
'Sledování změn zapnuto: úpravy obsahu od AI se označují jako revize (vložení podtržené, odstranění přeškrtnuté); přijměte nebo odmítněte v části Revize',
|
||||
aiTrackOffTitle:
|
||||
'Sledování změn vypnuto: úpravy AI se použijí okamžitě (stále se můžete vrátit pomocí snímků)',
|
||||
aiTurnLimit:
|
||||
'Tento úkol byl pozastaven před dokončením všech kroků. Dokončené úpravy jsou zachovány; vyberte Pokračovat pro dokončení zbývající práce.',
|
||||
aiStopped: '(Zastaveno)',
|
||||
aiNoReply: 'AI nevrátila žádný obsah.',
|
||||
aiTruncatedNote: '(Odpověď byla zkrácena limitem délky a může být neúplná.)',
|
||||
aiImagesSendFailed:
|
||||
'Obrázkové přílohy se nepodařilo načíst; tato zpráva byla odeslána bez obrázků',
|
||||
aiImageReadFail: '{name}: načtení se nezdařilo',
|
||||
aiTooManyImages: 'Nejvýše {max} obrázků na zprávu; ostatní byly ignorovány',
|
||||
aiUnknownError: 'Neznámá chyba',
|
||||
aiTimeoutError:
|
||||
'Časový limit požadavku AI vypršel: síť neodpověděla, běh byl zastaven. Zkontrolujte připojení a zkuste to znovu',
|
||||
aiOverloadedError: 'Služba AI je právě zaneprázdněna – zkuste to prosím za chvíli znovu',
|
||||
aiNetworkError:
|
||||
'Problém se sítí: nepodařilo se připojit ke službě AI. Zkontrolujte připojení a zkuste to znovu',
|
||||
aiCreditsExhausted:
|
||||
'Vaše kredity Genspark byly vyčerpány. Navštivte genspark.ai/pricing pro dobití a zkuste to znovu',
|
||||
aiSumReadAttachment: 'Přečtena příloha',
|
||||
aiSumImageAttachment: 'Obrázková příloha {name}',
|
||||
aiSumRead: 'Přečteno {name}',
|
||||
aiSumReadAttachmentName: 'Přečtena příloha {name}',
|
||||
aiSumWebSearch: 'Hledání na webu',
|
||||
aiSumWebSearchDone: 'Hledáno „{query}“ ({count} výsledků)',
|
||||
aiSumImageSearch: 'Hledání obrázků',
|
||||
aiSumImageSearchDone: 'Hledání obrázků „{query}“ ({count} obrázků)',
|
||||
aiSumInsertImage: 'Vložit obrázek',
|
||||
aiSumInsertWebImage: 'Vložen obrázek z webu',
|
||||
aiSumGenerateImage: 'Vygenerovat obrázek',
|
||||
aiSumInsertedGenImage: 'Vložen obrázek vygenerovaný AI',
|
||||
aiSumUnknownTool: 'Neznámý nástroj',
|
||||
aiSumReadDocContext: 'Přečtena struktura dokumentu',
|
||||
aiSumReadBlocks: 'Přečteny bloky',
|
||||
aiSumReadBlocksRange: 'Přečteny bloky {start}–{end}',
|
||||
aiSumInsertContent: 'Vložit obsah',
|
||||
aiSumInsertedBlocks: 'Vloženo bloků: {count}',
|
||||
aiSumCreateDocument: 'Vytvořit nový dokument',
|
||||
aiSumCreatedDocument: 'Vytvořeno {name}',
|
||||
aiSumReplaceContent: 'Nahradit obsah',
|
||||
aiSumReplaceSelection: 'Nahradit vybraný text',
|
||||
aiSumReplacedBlocks: 'Nahrazeny bloky {start}–{end}',
|
||||
aiSumInsertChart: 'Vložit graf',
|
||||
aiSumInsertedChart: 'Vložen graf „{title}“',
|
||||
aiSumEditChart: 'Upravit graf',
|
||||
aiSumEditedChart: 'Upravena data grafu (blok {index})',
|
||||
aiSumSetHeader: 'Záhlaví aktualizováno',
|
||||
aiSumSetFooter: 'Zápatí aktualizováno',
|
||||
aiSumApplyCommands: 'Použít příkazy formátování',
|
||||
aiCmdNone: 'Žádné odpovídající bloky; dokument nebyl změněn.',
|
||||
aiCmdNoneSkipped:
|
||||
'Žádné upravitelné bloky; dokument nebyl změněn (přeskočeno {count} chráněných bloků – tabulky/obrázky nelze měnit příkazy stylů).',
|
||||
aiCmdTextStyle: 'Aktualizován styl textu u bloků: {count}',
|
||||
aiCmdMatchedStyle: 'Nastylováno shod: {count} v blocích: {blocks}',
|
||||
aiCmdParaStyle: 'Aktualizován formát odstavce u bloků: {count}',
|
||||
aiCmdHeading: 'Upravena úroveň nadpisu u bloků: {count}',
|
||||
aiCmdReplaceAll: '{detail} v blocích: {count}',
|
||||
aiCmdReplacedCount: 'Nahrazeno výskytů: {count}',
|
||||
aiCmdReplaceFallback: 'Text nahrazen',
|
||||
aiCmdDeleted: 'Odstraněno bloků: {count}',
|
||||
aiCmdMoved: 'Přesunuto bloků: {count}',
|
||||
aiCmdToList: 'Převedeno na seznam bloků: {count}',
|
||||
aiCmdToBody: 'Převedeno zpět na běžný text položek seznamu: {count}',
|
||||
aiCmdImages: 'Aktualizováno obrázků: {count}',
|
||||
aiCmdToc: 'Vložen obsah ({count} položek)',
|
||||
aiCmdSkipped: ' (přeskočeno {count} chráněných bloků)',
|
||||
} satisfies Record<keyof typeof zh, string>
|
||||
@@ -132,6 +132,7 @@ export const de = {
|
||||
aiSumCreateDocument: 'Neues Dokument erstellen',
|
||||
aiSumCreatedDocument: '{name} erstellt',
|
||||
aiSumReplaceContent: 'Inhalt ersetzen',
|
||||
aiSumReplaceSelection: 'Markierten Text ersetzen',
|
||||
aiSumReplacedBlocks: 'Blöcke {start}-{end} ersetzt',
|
||||
aiSumInsertChart: 'Diagramm einfügen',
|
||||
aiSumInsertedChart: 'Diagramm „{title}“ eingefügt',
|
||||
|
||||
@@ -127,6 +127,7 @@ export const en = {
|
||||
aiSumCreateDocument: 'Create new document',
|
||||
aiSumCreatedDocument: 'Created {name}',
|
||||
aiSumReplaceContent: 'Replace content',
|
||||
aiSumReplaceSelection: 'Replace selected text',
|
||||
aiSumReplacedBlocks: 'Replaced blocks {start}-{end}',
|
||||
aiSumInsertChart: 'Insert chart',
|
||||
aiSumInsertedChart: 'Inserted chart "{title}"',
|
||||
|
||||
@@ -131,6 +131,7 @@ export const es = {
|
||||
aiSumCreateDocument: 'Crear documento nuevo',
|
||||
aiSumCreatedDocument: '{name} creado',
|
||||
aiSumReplaceContent: 'Reemplazar contenido',
|
||||
aiSumReplaceSelection: 'Reemplazar texto seleccionado',
|
||||
aiSumReplacedBlocks: 'Bloques {start}-{end} reemplazados',
|
||||
aiSumInsertChart: 'Insertar gráfico',
|
||||
aiSumInsertedChart: 'Gráfico «{title}» insertado',
|
||||
|
||||
@@ -130,6 +130,7 @@ export const fr = {
|
||||
aiSumCreateDocument: 'Créer un nouveau document',
|
||||
aiSumCreatedDocument: '{name} créé',
|
||||
aiSumReplaceContent: 'Remplacer le contenu',
|
||||
aiSumReplaceSelection: 'Remplacer le texte sélectionné',
|
||||
aiSumReplacedBlocks: 'Blocs {start}-{end} remplacés',
|
||||
aiSumInsertChart: 'Insérer un graphique',
|
||||
aiSumInsertedChart: 'Graphique « {title} » inséré',
|
||||
|
||||
@@ -123,6 +123,7 @@ export const he = {
|
||||
aiSumCreateDocument: 'יצירת מסמך חדש',
|
||||
aiSumCreatedDocument: '{name} נוצר',
|
||||
aiSumReplaceContent: 'החלפת תוכן',
|
||||
aiSumReplaceSelection: 'החלפת הטקסט שנבחר',
|
||||
aiSumReplacedBlocks: 'הוחלפו בלוקים {start}-{end}',
|
||||
aiSumInsertChart: 'הוספת תרשים',
|
||||
aiSumInsertedChart: 'הוסף תרשים "{title}"',
|
||||
|
||||
@@ -128,6 +128,7 @@ export const hi = {
|
||||
aiSumCreateDocument: 'नया दस्तावेज़ बनाएँ',
|
||||
aiSumCreatedDocument: '{name} बनाया गया',
|
||||
aiSumReplaceContent: 'सामग्री बदलें',
|
||||
aiSumReplaceSelection: 'चयनित पाठ बदलें',
|
||||
aiSumReplacedBlocks: 'ब्लॉक {start}-{end} बदले गए',
|
||||
aiSumInsertChart: 'चार्ट सम्मिलित करें',
|
||||
aiSumInsertedChart: 'चार्ट "{title}" सम्मिलित किया गया',
|
||||
|
||||
@@ -128,6 +128,7 @@ export const id = {
|
||||
aiSumCreateDocument: 'Buat dokumen baru',
|
||||
aiSumCreatedDocument: '{name} dibuat',
|
||||
aiSumReplaceContent: 'Ganti konten',
|
||||
aiSumReplaceSelection: 'Ganti teks yang dipilih',
|
||||
aiSumReplacedBlocks: 'Blok {start}-{end} diganti',
|
||||
aiSumInsertChart: 'Sisipkan bagan',
|
||||
aiSumInsertedChart: 'Bagan "{title}" disisipkan',
|
||||
|
||||
@@ -132,6 +132,7 @@ export const it = {
|
||||
aiSumCreateDocument: 'Crea nuovo documento',
|
||||
aiSumCreatedDocument: '{name} creato',
|
||||
aiSumReplaceContent: 'Sostituisci contenuto',
|
||||
aiSumReplaceSelection: 'Sostituisci testo selezionato',
|
||||
aiSumReplacedBlocks: 'Blocchi {start}-{end} sostituiti',
|
||||
aiSumInsertChart: 'Inserisci grafico',
|
||||
aiSumInsertedChart: 'Grafico "{title}" inserito',
|
||||
|
||||
@@ -128,6 +128,7 @@ export const ja = {
|
||||
aiSumCreateDocument: '新規ドキュメントを作成',
|
||||
aiSumCreatedDocument: '{name} を作成しました',
|
||||
aiSumReplaceContent: 'コンテンツを置換',
|
||||
aiSumReplaceSelection: '選択したテキストを置換',
|
||||
aiSumReplacedBlocks: 'ブロック {start}-{end} を置換',
|
||||
aiSumInsertChart: 'グラフを挿入',
|
||||
aiSumInsertedChart: 'グラフ「{title}」を挿入',
|
||||
|
||||
@@ -126,6 +126,7 @@ export const ko = {
|
||||
aiSumCreateDocument: '새 문서 만들기',
|
||||
aiSumCreatedDocument: '{name} 생성됨',
|
||||
aiSumReplaceContent: '내용 바꾸기',
|
||||
aiSumReplaceSelection: '선택한 텍스트 바꾸기',
|
||||
aiSumReplacedBlocks: '블록 {start}-{end} 바꿈',
|
||||
aiSumInsertChart: '차트 삽입',
|
||||
aiSumInsertedChart: '차트 "{title}" 삽입',
|
||||
|
||||
@@ -128,6 +128,7 @@ export const ms = {
|
||||
aiSumCreateDocument: 'Cipta dokumen baharu',
|
||||
aiSumCreatedDocument: '{name} dicipta',
|
||||
aiSumReplaceContent: 'Ganti kandungan',
|
||||
aiSumReplaceSelection: 'Ganti teks yang dipilih',
|
||||
aiSumReplacedBlocks: 'Blok {start}-{end} diganti',
|
||||
aiSumInsertChart: 'Sisipkan carta',
|
||||
aiSumInsertedChart: 'Carta "{title}" disisipkan',
|
||||
|
||||
@@ -130,6 +130,7 @@ export const nl = {
|
||||
aiSumCreateDocument: 'Nieuw document maken',
|
||||
aiSumCreatedDocument: '{name} aangemaakt',
|
||||
aiSumReplaceContent: 'Inhoud vervangen',
|
||||
aiSumReplaceSelection: 'Geselecteerde tekst vervangen',
|
||||
aiSumReplacedBlocks: 'Blokken {start}-{end} vervangen',
|
||||
aiSumInsertChart: 'Grafiek invoegen',
|
||||
aiSumInsertedChart: 'Grafiek "{title}" ingevoegd',
|
||||
|
||||
@@ -129,6 +129,7 @@ export const pl = {
|
||||
aiSumCreateDocument: 'Utwórz nowy dokument',
|
||||
aiSumCreatedDocument: 'Utworzono {name}',
|
||||
aiSumReplaceContent: 'Zamień treść',
|
||||
aiSumReplaceSelection: 'Zamień zaznaczony tekst',
|
||||
aiSumReplacedBlocks: 'Zamieniono bloki {start}-{end}',
|
||||
aiSumInsertChart: 'Wstaw wykres',
|
||||
aiSumInsertedChart: 'Wstawiono wykres „{title}”',
|
||||
|
||||
@@ -131,6 +131,7 @@ export const pt = {
|
||||
aiSumCreateDocument: 'Criar novo documento',
|
||||
aiSumCreatedDocument: '{name} criado',
|
||||
aiSumReplaceContent: 'Substituir conteúdo',
|
||||
aiSumReplaceSelection: 'Substituir texto selecionado',
|
||||
aiSumReplacedBlocks: 'Blocos {start}-{end} substituídos',
|
||||
aiSumInsertChart: 'Inserir gráfico',
|
||||
aiSumInsertedChart: 'Gráfico "{title}" inserido',
|
||||
|
||||
@@ -129,6 +129,7 @@ export const ru = {
|
||||
aiSumCreateDocument: 'Создание нового документа',
|
||||
aiSumCreatedDocument: 'Создан {name}',
|
||||
aiSumReplaceContent: 'Замена содержимого',
|
||||
aiSumReplaceSelection: 'Заменить выделенный текст',
|
||||
aiSumReplacedBlocks: 'Заменены блоки {start}-{end}',
|
||||
aiSumInsertChart: 'Вставка диаграммы',
|
||||
aiSumInsertedChart: 'Вставлена диаграмма «{title}»',
|
||||
|
||||
@@ -126,6 +126,7 @@ export const th = {
|
||||
aiSumCreateDocument: 'สร้างเอกสารใหม่',
|
||||
aiSumCreatedDocument: 'สร้าง {name} แล้ว',
|
||||
aiSumReplaceContent: 'แทนที่เนื้อหา',
|
||||
aiSumReplaceSelection: 'แทนที่ข้อความที่เลือก',
|
||||
aiSumReplacedBlocks: 'แทนที่บล็อก {start}-{end}',
|
||||
aiSumInsertChart: 'แทรกแผนภูมิ',
|
||||
aiSumInsertedChart: 'แทรกแผนภูมิ "{title}"',
|
||||
|
||||
@@ -121,6 +121,7 @@ export const zhTW = {
|
||||
aiSumCreateDocument: '建立新文件',
|
||||
aiSumCreatedDocument: '已建立 {name}',
|
||||
aiSumReplaceContent: '取代內容',
|
||||
aiSumReplaceSelection: '取代選取文字',
|
||||
aiSumReplacedBlocks: '取代區塊 {start}-{end}',
|
||||
aiSumInsertChart: '插入圖表',
|
||||
aiSumInsertedChart: '插入圖表「{title}」',
|
||||
|
||||
@@ -119,6 +119,7 @@ export const zh = {
|
||||
aiSumCreateDocument: '新建文档',
|
||||
aiSumCreatedDocument: '已创建 {name}',
|
||||
aiSumReplaceContent: '替换内容',
|
||||
aiSumReplaceSelection: '替换选中文字',
|
||||
aiSumReplacedBlocks: '替换块 {start}-{end}',
|
||||
aiSumInsertChart: '插入图表',
|
||||
aiSumInsertedChart: '插入图表「{title}」',
|
||||
|
||||
@@ -74,8 +74,10 @@ export const ar = {
|
||||
appPgNumHintBlank: 'اترك "بدء الترقيم بـ" فارغًا للمتابعة من المقطع السابق',
|
||||
appPgNumAppliesTo: '؛ يسري على المقطع {n}',
|
||||
appExportingPdf: 'جارٍ تصدير PDF…',
|
||||
appExportingHtml: 'جارٍ تصدير HTML…',
|
||||
appExportPdf: 'تصدير PDF',
|
||||
appExportPdfFailed: 'فشل تصدير PDF: {error}',
|
||||
appExportHtmlFailed: 'فشل تصدير HTML: {error}',
|
||||
appPrintGroupFailed: 'فشلت طباعة مجموعة الصفحات',
|
||||
appPrintTitle: 'طباعة',
|
||||
appPrintProgress: 'جارٍ التحضير للطباعة…',
|
||||
@@ -91,14 +93,17 @@ export const ar = {
|
||||
appPrintPrevPage: 'الصفحة السابقة',
|
||||
appPrintNextPage: 'الصفحة التالية',
|
||||
appExportedPdf: 'تم تصدير PDF: {path}',
|
||||
appExportedHtml: 'تم تصدير HTML: {path}',
|
||||
appExportedPdfMixed:
|
||||
'تم تصدير PDF: {path} (أحجام ورق مختلطة، تم دمج {n} من المجموعات حسب الصفحات)',
|
||||
appExportPdfCanceled: 'تم إلغاء تصدير PDF',
|
||||
appExportHtmlCanceled: 'تم إلغاء تصدير HTML',
|
||||
appMixedExportOpening:
|
||||
'أحجام ورق مختلطة: جارٍ فتح معاينة ترقيم الصفحات للتصدير مع الدمج حسب الصفحات…',
|
||||
appSelectTextToComment: 'حدد النص المراد التعليق عليه أولاً',
|
||||
appCommentSelectionLost: 'لم يعد التحديد صالحًا؛ أعد تحديد النص المراد التعليق عليه',
|
||||
appCommentAdded: 'تمت إضافة التعليق؛ سيُكتب في المستند عند الحفظ',
|
||||
appCommentEdited: 'تم تحديث التعليق؛ سيُكتب في المستند عند الحفظ',
|
||||
appCommentAnchorGone: 'لم تعد مرساة التعليق الأصلي موجودة؛ يتعذر الرد',
|
||||
appCommentReplied: 'تمت إضافة الرد؛ سيُكتب في المستند عند الحفظ',
|
||||
appCommentResolvedMsg: 'تم حل التعليق',
|
||||
@@ -109,6 +114,7 @@ export const ar = {
|
||||
appUnknownAuthor: '(كاتب غير معروف)',
|
||||
appResolved: 'تم الحل',
|
||||
appResolvedComments: 'التعليقات المحلولة ({n})',
|
||||
appEditComment: 'تحرير التعليق',
|
||||
appDeleteComment: 'حذف التعليق',
|
||||
appDeleteCommentWithReplies: 'حذف التعليق (مع الردود)',
|
||||
appDeleteReply: 'حذف الرد',
|
||||
|
||||
@@ -0,0 +1,358 @@
|
||||
import type { zh } from './zh'
|
||||
|
||||
export const cs = {
|
||||
appScTitle: 'Klávesové zkratky',
|
||||
appScFilter: 'Hledat zkratky',
|
||||
appScNone: 'Žádné odpovídající zkratky',
|
||||
appScGroupFile: 'Soubor',
|
||||
appScGroupEdit: 'Úpravy',
|
||||
appScGroupText: 'Formátování textu',
|
||||
appScGroupPara: 'Formátování odstavce',
|
||||
appScGroupInsert: 'Vložení',
|
||||
appScGroupReview: 'Revize a nástroje',
|
||||
appScGroupView: 'Zobrazení',
|
||||
appScNewWindow: 'Nové okno',
|
||||
appScSelectAll: 'Vybrat vše',
|
||||
appScAlignLeft: 'Zarovnat vlevo',
|
||||
appScAlignCenter: 'Zarovnat na střed',
|
||||
appScAlignRight: 'Zarovnat vpravo',
|
||||
appScJustify: 'Zarovnat do bloku',
|
||||
appScClearPara: 'Vymazat formátování odstavce',
|
||||
appScHangingIndent: 'Předsazení',
|
||||
appScHangingIndentOff: 'Odebrat předsazení',
|
||||
appScMoveUp: 'Přesunout odstavec výše',
|
||||
appScMoveDown: 'Přesunout odstavec níže',
|
||||
appScColumnBreak: 'Zalomení sloupce',
|
||||
appScLineBreak: 'Zalomení řádku',
|
||||
appScNbsp: 'Pevná mezera',
|
||||
appScNbHyphen: 'Pevná pomlčka',
|
||||
appScGrowFont1: 'Zvětšit písmo o 1 b.',
|
||||
appScShrinkFont1: 'Zmenšit písmo o 1 b.',
|
||||
appScListDemote: 'Snížit úroveň položky seznamu',
|
||||
appScListPromote: 'Zvýšit úroveň položky seznamu',
|
||||
appScProofread: 'Korektura',
|
||||
appClose: 'Zavřít',
|
||||
appCancel: 'Zrušit',
|
||||
appOk: 'OK',
|
||||
appSave: 'Uložit',
|
||||
appUpdate: 'Aktualizovat',
|
||||
appInsert: 'Vložit',
|
||||
appNew: 'Nový',
|
||||
appReady: 'Připraveno',
|
||||
appParagraph: 'Odstavec',
|
||||
appCharacter: 'Znak',
|
||||
appUntitledDocx: 'Bez názvu.docx',
|
||||
appOpenedFile: 'Otevřeno: {name}',
|
||||
appOpenFailed: 'Otevření se nezdařilo: {error}',
|
||||
appFontsMissing: 'Chybějící písma dokumentu: {names} (zobrazena náhradní)',
|
||||
appVerticalTextNotice:
|
||||
'Tento dokument obsahuje svislý text (zatím se zobrazuje vodorovně; ukládání není ovlivněno)',
|
||||
appNewDocCreated: 'Prázdný dokument vytvořen. Popište v panelu AI vlevo, co má vygenerovat.',
|
||||
appNewFailed: 'Dokument se nepodařilo vytvořit: {error}',
|
||||
appSaveFailed: 'Uložení se nezdařilo: {error}',
|
||||
appAutoSavedAt: 'Automaticky uloženo ({time})',
|
||||
appSaved: 'Uloženo',
|
||||
appSectionBreakInserted: 'Konec oddílu vložen ({type})',
|
||||
appSectionBreakPending: 'Konec oddílu vložen; nový oddíl se projeví po uložení',
|
||||
appBreakNextPage: 'Další stránka',
|
||||
appBreakContinuous: 'Průběžný',
|
||||
appBreakEvenPage: 'Sudá stránka',
|
||||
appBreakOddPage: 'Lichá stránka',
|
||||
appSectionSettingsApplied:
|
||||
'Vzhled stránky použit na oddíl {n}; do dokumentu se zapíše při uložení',
|
||||
appNumberingRestarted: 'Číslování začíná znovu',
|
||||
appNumberingContinued: 'Číslování pokračuje',
|
||||
appFieldInserted: 'Vloženo pole {instr}',
|
||||
appNoFieldsToUpdate: 'Žádná pole k aktualizaci',
|
||||
appFieldsUpdated: 'Aktualizováno polí: {n}',
|
||||
appStyleUpdated: 'Styl „{name}“ aktualizován podle výběru; do dokumentu se zapíše při uložení',
|
||||
appStyleCreated: 'Styl „{name}“ vytvořen a použit na výběr',
|
||||
appPgNumFormatSet: 'Formát čísel stránek nastaven',
|
||||
appPageNumFormatTitle: 'Formát čísel stránek',
|
||||
appNumberFormat: 'Formát čísla',
|
||||
appStartAt: 'Začít od',
|
||||
appContinueFromPrev: 'Pokračovat z předchozího oddílu',
|
||||
appPgNumHintBlank: 'Pole „Začít od“ nechte prázdné, chcete-li pokračovat z předchozího oddílu',
|
||||
appPgNumAppliesTo: '; platí pro oddíl {n}',
|
||||
appExportingPdf: 'Exportování PDF…',
|
||||
appExportingHtml: 'Exportování HTML…',
|
||||
appExportPdf: 'Exportovat PDF',
|
||||
appExportPdfFailed: 'Export PDF se nezdařil: {error}',
|
||||
appExportHtmlFailed: 'Export HTML se nezdařil: {error}',
|
||||
appPrintGroupFailed: 'tisk skupiny stránek se nezdařil',
|
||||
appPrintTitle: 'Tisk',
|
||||
appPrintProgress: 'Příprava tisku…',
|
||||
appPrintRange: 'Rozsah',
|
||||
appPrintRangeAll: 'Všechny stránky',
|
||||
appPrintRangeCurrent: 'Aktuální stránka',
|
||||
appPrintRangeCustom: 'Vlastní rozsah',
|
||||
appPrintRangeHint: 'např. 1,3,5-8',
|
||||
appPrintPageCount: 'Stránek: {n}',
|
||||
appPrintNoPages: 'Žádné stránky k tisku',
|
||||
appPrintRendering: 'Generování náhledu…',
|
||||
appPrintFailed: 'Tisk se nezdařil: {error}',
|
||||
appPrintPrevPage: 'Předchozí stránka',
|
||||
appPrintNextPage: 'Další stránka',
|
||||
appExportedPdf: 'PDF exportováno: {path}',
|
||||
appExportedHtml: 'HTML exportováno: {path}',
|
||||
appExportedPdfMixed:
|
||||
'PDF exportováno: {path} (různé velikosti papíru, {n} skupin sloučeno podle stránek)',
|
||||
appExportPdfCanceled: 'Export PDF zrušen',
|
||||
appExportHtmlCanceled: 'Export HTML zrušen',
|
||||
appMixedExportOpening:
|
||||
'Různé velikosti papíru: otevírá se náhled stránkování pro sloučený export stránek…',
|
||||
appSelectTextToComment: 'Nejprve vyberte text, ke kterému chcete přidat komentář',
|
||||
appCommentSelectionLost: 'Výběr již není platný; znovu vyberte text ke komentování',
|
||||
appCommentAdded: 'Komentář přidán; do dokumentu se zapíše při uložení',
|
||||
appCommentEdited: 'Komentář upraven; do dokumentu se zapíše při uložení',
|
||||
appCommentAnchorGone: 'Ukotvení původního komentáře již neexistuje; nelze odpovědět',
|
||||
appCommentReplied: 'Odpověď přidána; do dokumentu se zapíše při uložení',
|
||||
appCommentResolvedMsg: 'Komentář vyřešen',
|
||||
appCommentReopenedMsg: 'Komentář znovu otevřen',
|
||||
appCommentsTitle: 'Komentáře ({n})',
|
||||
appCommentPlaceholder: 'Napište komentář…',
|
||||
appCommentBtn: 'Komentovat',
|
||||
appUnknownAuthor: '(Neznámý autor)',
|
||||
appResolved: 'Vyřešeno',
|
||||
appResolvedComments: 'Vyřešené komentáře ({n})',
|
||||
appEditComment: 'Upravit komentář',
|
||||
appDeleteComment: 'Odstranit komentář',
|
||||
appDeleteCommentWithReplies: 'Odstranit komentář (včetně odpovědí)',
|
||||
appDeleteReply: 'Odstranit odpověď',
|
||||
appReplyPlaceholder: 'Odpovědět…',
|
||||
appReply: 'Odpovědět',
|
||||
appReopen: 'Znovu otevřít',
|
||||
appResolve: 'Vyřešit',
|
||||
appNoComments: 'Tento dokument neobsahuje žádné komentáře',
|
||||
appAllRevisionsAccepted: 'Všechny změny přijaty',
|
||||
appAllRevisionsRejected: 'Všechny změny odmítnuty',
|
||||
appNoRevisionsToHandle: 'Žádné sledované změny ke zpracování',
|
||||
appProtectTitle: 'Zamknout dokument',
|
||||
appProtectSecurity: 'Zabezpečení',
|
||||
appProtectDesc:
|
||||
'Nastavte hesla pro otevření a úpravy, omezení úprav a možnosti ochrany osobních údajů; změny se použijí při uložení dokumentu',
|
||||
appOptional: '(nepovinné)',
|
||||
appOptionalBlank: '(nepovinné)',
|
||||
appProtectOpenPwd: 'Heslo pro otevření tohoto dokumentu',
|
||||
appProtectModifyPwd: 'Heslo pro úpravy tohoto dokumentu',
|
||||
appProtectPwdKeepHint:
|
||||
'Existující heslo se zobrazuje jako tečky: ponechte je beze změny, chcete-li je zachovat, nebo pole vymažte, chcete-li je odebrat',
|
||||
appProtectSectionTitle: 'Zámek',
|
||||
appProtectFor: 'Omezit úpravy',
|
||||
appProtectModeTracked: 'Sledované změny',
|
||||
appProtectModeComments: 'Komentáře',
|
||||
appProtectModeReadOnly: 'Jen pro čtení',
|
||||
appProtectModeForms: 'Formuláře',
|
||||
appProtectUnlockPwd: 'Zadejte heslo zámku, chcete-li ho změnit nebo odebrat',
|
||||
appProtectPrivacy: 'Ochrana osobních údajů',
|
||||
appProtectRemovePersonal: 'Při uložení odebrat z tohoto souboru metadata autora a organizace',
|
||||
appProtectUpdated: 'Nastavení zámku aktualizováno; použije se při uložení dokumentu',
|
||||
appModifyPwdTitle: 'Chráněno proti zápisu',
|
||||
appModifyPwdBody:
|
||||
'Dokument „{name}“ má heslo pro úpravy. Zadejte ho pro úpravy, nebo otevřete jen pro čtení.',
|
||||
appOpenReadOnly: 'Otevřít jen pro čtení',
|
||||
appProtectPwdOptional: 'Heslo zámku',
|
||||
appWrongPassword: 'Nesprávné heslo',
|
||||
appCompareFailed: 'Porovnání se nezdařilo: {error}',
|
||||
appCompareResult: 'Výsledky porovnání',
|
||||
appCompareWithPrefix: 'Porovnáno s ',
|
||||
appCompareStats: ': přidáno {added}, odstraněno {removed}, změněno {changed}',
|
||||
appCompareIdentical: 'Oba dokumenty jsou shodné',
|
||||
appCompareSameRun: '… {n} shodných odstavců …',
|
||||
appEmptyParagraph: '(prázdný odstavec)',
|
||||
appInksCleared: 'Veškerý rukopis odebrán; projeví se po uložení',
|
||||
appWatermarkSet: 'Vodoznak „{text}“ nastaven; do dokumentu se zapíše při uložení',
|
||||
appWatermarkRemoved: 'Vodoznak odebrán; projeví se po uložení',
|
||||
appThemeFontsChanged:
|
||||
'Písma motivu změněna; do dokumentu se zapíší při uložení (styly odkazující na písma motivu se projeví ve Wordu)',
|
||||
appThemeColorsApplied: 'Barvy motivu „{name}“ použity; do dokumentu se zapíší při uložení',
|
||||
appSourceAdded: 'Pramen „{title}“ přidán; odkažte na něj přes Vložit citaci',
|
||||
appTitlePgOn:
|
||||
'„Jiné na první stránce“ zapnuto; přepněte v horní části stránky pro úpravu záhlaví a zápatí první stránky',
|
||||
appTitlePgOff: '„Jiné na první stránce“ vypnuto',
|
||||
appEvenOddOn:
|
||||
'„Různé liché a sudé stránky“ zapnuto; přepněte v horní části stránky pro úpravu záhlaví a zápatí sudých stránek',
|
||||
appEvenOddOff: '„Různé liché a sudé stránky“ vypnuto',
|
||||
appFirstPage: 'První stránka',
|
||||
appOddPage: 'Liché stránky',
|
||||
appEvenPage: 'Sudé stránky',
|
||||
appDefaultPage: 'Výchozí',
|
||||
appDblclickEditHeader: 'Poklepáním upravíte záhlaví',
|
||||
appDblclickEditFooter: 'Poklepáním upravíte zápatí',
|
||||
appHfPageNumHint: ' (# zastupuje automatické číslo stránky)',
|
||||
appDblclickEditFootnote: 'Poklepáním upravíte poznámku pod čarou',
|
||||
appEditFootnote: 'Upravit poznámku pod čarou',
|
||||
appDeleteFootnote: 'Odstranit poznámku pod čarou',
|
||||
appEditEndnote: 'Upravit vysvětlivku',
|
||||
appDeleteEndnote: 'Odstranit vysvětlivku',
|
||||
appInsertFootnote: 'Vložit poznámku pod čarou',
|
||||
appInsertEndnote: 'Vložit vysvětlivku',
|
||||
appFootnotePlaceholder: 'Text poznámky pod čarou…',
|
||||
appEndnotePlaceholder: 'Text vysvětlivky…',
|
||||
appAutoSave: 'Automatické ukládání',
|
||||
appAutoSaveTip: 'Automatické ukládání (každých 30 sekund a při ztrátě fokusu okna)',
|
||||
appSaveShortcutTip: 'Uložit (⌘S)',
|
||||
appUndo: 'Zpět',
|
||||
appRedo: 'Znovu',
|
||||
appStartOpening: 'Otevírání…',
|
||||
appDocPwdTitle: 'Chráněno heslem',
|
||||
appDocPwdBody: 'Dokument „{name}“ je chráněn heslem. Zadejte heslo pro jeho otevření.',
|
||||
appDocPwdLabel: 'Heslo',
|
||||
appDocPwdPlaceholder: 'Zadejte heslo pro otevření',
|
||||
appModifyPwdPlaceholder: 'Zadejte heslo pro úpravy',
|
||||
appPwdShow: 'Zobrazit heslo',
|
||||
appPwdHide: 'Skrýt heslo',
|
||||
appDocPwdWrong: 'Heslo je nesprávné. Zkuste to znovu.',
|
||||
appDocPwdUnsupported:
|
||||
'Tento dokument nelze dešifrovat: jeho šifrovací schéma není podporováno (např. šifrování účtem WPS). Odeberte šifrování v původní aplikaci a zkuste to znovu.',
|
||||
appEncConfirmLabel: 'Potvrdit heslo',
|
||||
appEncMismatch: 'Hesla se neshodují',
|
||||
appRecentDocs: 'Poslední dokumenty',
|
||||
appSplitPaneLabel: 'Rozdělené podokno (náhled jen pro čtení, posouvá se nezávisle)',
|
||||
appRemoveSplit: 'Odebrat rozdělení',
|
||||
appExitReadMode: 'Ukončit režim čtení (Esc)',
|
||||
appExpandAiPanel: 'Rozbalit panel úprav AI',
|
||||
appAiRail: 'AI',
|
||||
appPageOf: 'Stránka {current} z {total}',
|
||||
appWordCountTitle: 'Počet slov',
|
||||
appWordCountN: 'Slov: {n}',
|
||||
appStatPages: 'Stránky',
|
||||
appStatWords: 'Slova',
|
||||
appStatAsianChars: 'Asijské znaky (čínské, japonské, korejské)',
|
||||
appStatNonAsianWords: 'Neasijská slova',
|
||||
appStatCharsNoSpaces: 'Znaky (bez mezer)',
|
||||
appStatCharsWithSpaces: 'Znaky (včetně mezer)',
|
||||
appStatParagraphs: 'Odstavce',
|
||||
appStatLines: 'Řádky',
|
||||
appNavTitle: 'Navigace',
|
||||
appNavNoHeadings: 'Tento dokument neobsahuje žádné nadpisy',
|
||||
appTabTypeTip: 'Typ tabulátoru: {type} (klepnutím přepnete)',
|
||||
appTabStopTitle: 'Tabulátor {type} @ {pos} cm',
|
||||
appTabLeader: ', vodicí znak: {leader}',
|
||||
appTabLeft: 'Vlevo',
|
||||
appTabCenter: 'Na střed',
|
||||
appTabRight: 'Vpravo',
|
||||
appTabDecimal: 'Desetinný',
|
||||
appTabBar: 'Svislá čára',
|
||||
appTabClear: 'Vymazat',
|
||||
appAiSettings: 'Nastavení AI',
|
||||
appGensparkAccount: 'Účet Genspark',
|
||||
appChecking: 'Kontrola…',
|
||||
appLoggedIn: 'Přihlášeno',
|
||||
appLoggedInEmail: 'Přihlášeno: {email}',
|
||||
appNotLoggedIn: 'Nepřihlášeno (funkce AI vyžadují účet Genspark)',
|
||||
appWaitingBrowserLogin: 'Čeká se na přihlášení v prohlížeči…',
|
||||
appLoginGenspark: 'Přihlásit se ke Genspark',
|
||||
appModel: 'Model',
|
||||
appCut: 'Vyjmout',
|
||||
appCopy: 'Kopírovat',
|
||||
appPaste: 'Vložit',
|
||||
appPastePlain: 'Vložit jako prostý text',
|
||||
appFontMenu: 'Písmo…',
|
||||
appParagraphMenu: 'Odstavec…',
|
||||
appUpdateField: 'Aktualizovat pole',
|
||||
appRestartNumbering: 'Začít znovu od 1',
|
||||
appContinueNumbering: 'Pokračovat v číslování',
|
||||
appSynonyms: 'Synonyma',
|
||||
appSynonymsPrompt:
|
||||
'Jaká jsou lepší synonyma nebo blízké výrazy pro „{text}“? Uveďte 3–5 s krátkým vysvětlením rozdílů; dokument neupravujte.',
|
||||
appTranslateSelectionPrompt:
|
||||
'Přeložte aktuálně vybranou pasáž do jazyka {lang}, nahraďte originál překladem a zachovejte formátování: „{text}“',
|
||||
appAiBadgeTip: 'Používá AI',
|
||||
appTranslate: 'Přeložit',
|
||||
appTranslateTo: 'Přeložit do jazyka {lang}',
|
||||
appLangEnglish: 'angličtina',
|
||||
appLangSimplifiedChinese: 'zjednodušená čínština',
|
||||
appLangJapanese: 'japonština',
|
||||
appLangKorean: 'korejština',
|
||||
appLangFrench: 'francouzština',
|
||||
appLangGerman: 'němčina',
|
||||
appLangSpanish: 'španělština',
|
||||
appWrapTextMenu: 'Obtékání textu',
|
||||
appHyperlinkMenu: 'Hypertextový odkaz…',
|
||||
appNewComment: 'Nový komentář',
|
||||
appWrapInline: 'Rovnoběžně s textem',
|
||||
appWrapSquareLeft: 'Obdélník · obrázek vlevo',
|
||||
appWrapSquareRight: 'Obdélník · obrázek vpravo',
|
||||
appWrapTopBottom: 'Nahoře a dole',
|
||||
appWrapBehind: 'Za textem',
|
||||
appWrapFront: 'Před textem',
|
||||
appArrangeMenu: 'Uspořádat',
|
||||
appBringToFront: 'Přenést do popředí',
|
||||
appBringForward: 'Přenést blíž',
|
||||
appSendBackward: 'Přenést dál',
|
||||
appSendToBack: 'Přenést do pozadí',
|
||||
appFontDialogTitle: 'Písmo',
|
||||
appFontFamilyLabel: 'Asijské / latinkové písmo',
|
||||
appDefaultBodyFont: '(Výchozí písmo textu)',
|
||||
appFontStyleLabel: 'Řez písma',
|
||||
appFontSizeLabel: 'Velikost',
|
||||
appFontRegular: 'Obyčejné',
|
||||
appFontItalic: 'Kurzíva',
|
||||
appFontBold: 'Tučné',
|
||||
appFontBoldItalic: 'Tučná kurzíva',
|
||||
appFontColor: 'Barva písma',
|
||||
appUnderline: 'Podtržení',
|
||||
appStrikethrough: 'Přeškrtnutí',
|
||||
appSuperscript: 'Horní index',
|
||||
appSubscript: 'Dolní index',
|
||||
appFontPreviewSample: 'AaBbCcYyZz',
|
||||
appAlignment: 'Zarovnání',
|
||||
appAlignLeft: 'Vlevo',
|
||||
appAlignCenter: 'Na střed',
|
||||
appAlignRight: 'Vpravo',
|
||||
appAlignJustify: 'Do bloku',
|
||||
appLineSpacingLabel: 'Řádkování',
|
||||
appLineSingle: 'Jednoduché',
|
||||
appLine115: '1,15',
|
||||
appLine15: '1,5 řádku',
|
||||
appLineDouble: 'Dvojité',
|
||||
appLine25: '2,5',
|
||||
appLineTriple: '3 řádky',
|
||||
appLineMultiple: '{n}×',
|
||||
appLineAtLeast: 'Nejméně',
|
||||
appLineExactly: 'Přesně',
|
||||
appLineValue: 'Výška',
|
||||
appIndentLeft: 'Odsazení vlevo',
|
||||
appIndentRight: 'Odsazení vpravo',
|
||||
appIndentFirstLine: 'Odsazení prvního řádku',
|
||||
appSpaceBefore: 'Mezera před',
|
||||
appSpaceAfter: 'Mezera za',
|
||||
appInsertEquation: 'Vložit rovnici',
|
||||
appLatexPlaceholder: 'např. x = \\frac{-b \\pm \\sqrt{b^2-4ac}}{2a}',
|
||||
appLatexPreviewHint: 'Zadejte LaTeX a zobrazí se náhled',
|
||||
appPreviewUnavailable: 'Náhled se nepodařilo vygenerovat',
|
||||
appInlineEquationToggle: 'Řádková rovnice (vložena na pozici kurzoru, plyne s textem)',
|
||||
appInsertNewEquation: 'π Vložit novou rovnici (LaTeX)…',
|
||||
appEqCircleArea: 'Obsah kruhu',
|
||||
appEqBinomial: 'Binomická věta',
|
||||
appEqSumExpansion: 'Rozvoj součtu',
|
||||
appEqFourier: 'Fourierova řada',
|
||||
appEqPythagorean: 'Pythagorova věta',
|
||||
appEqQuadratic: 'Vzorec kvadratické rovnice',
|
||||
appEqTaylor: 'Taylorův rozvoj',
|
||||
appEqTrigIdentity: 'Goniometrická identita',
|
||||
appFindPlaceholder: 'Najít',
|
||||
appMatchCase: 'Rozlišovat velikost písmen',
|
||||
appWholeWord: 'Pouze celá slova',
|
||||
appNoResults: 'Žádné výsledky',
|
||||
appPrevMatch: 'Předchozí (Shift+Enter)',
|
||||
appNextMatch: 'Další (Enter)',
|
||||
appCloseEsc: 'Zavřít (Esc)',
|
||||
appReplacePlaceholder: 'Nahradit za',
|
||||
appReplace: 'Nahradit',
|
||||
appReplaceAll: 'Nahradit vše',
|
||||
appPaginationPreview: 'Náhled stránkování',
|
||||
appPvCommented: 'S komentářem',
|
||||
appTotalPagesN: 'Stránek: {n}',
|
||||
appPvHint: 'Snímek jen pro čtení; po úpravách znovu otevřete · Esc zavře',
|
||||
appPvExportTip:
|
||||
'Exportuje stránku po stránce podle náhledu; záhlaví, zápatí a čísla stránek odpovídají tomu, co vidíte',
|
||||
appStylesTitle: 'Styly',
|
||||
appParagraphStyles: 'Styly odstavce',
|
||||
appCharacterStyles: 'Styly znaku',
|
||||
appApplyStyle: 'Použít styl {name}',
|
||||
appUpdateStyleTip: 'Aktualizovat tento styl podle aktuálního výběru (zapíše se do styles.xml)',
|
||||
appNewStyleFromSelection: 'Nový styl z aktuálního výběru',
|
||||
appStyleNamePlaceholder: 'Název stylu',
|
||||
} satisfies Record<keyof typeof zh, string>
|
||||
@@ -78,8 +78,10 @@ export const de = {
|
||||
appPgNumHintBlank: '„Beginnen bei“ leer lassen, um vom vorherigen Abschnitt fortzusetzen',
|
||||
appPgNumAppliesTo: '; gilt für Abschnitt {n}',
|
||||
appExportingPdf: 'PDF wird exportiert…',
|
||||
appExportingHtml: 'HTML wird exportiert…',
|
||||
appExportPdf: 'PDF exportieren',
|
||||
appExportPdfFailed: 'PDF-Export fehlgeschlagen: {error}',
|
||||
appExportHtmlFailed: 'HTML-Export fehlgeschlagen: {error}',
|
||||
appPrintGroupFailed: 'Drucken der Seitengruppe fehlgeschlagen',
|
||||
appPrintTitle: 'Drucken',
|
||||
appPrintProgress: 'Druck wird vorbereitet…',
|
||||
@@ -95,15 +97,18 @@ export const de = {
|
||||
appPrintPrevPage: 'Vorherige Seite',
|
||||
appPrintNextPage: 'Nächste Seite',
|
||||
appExportedPdf: 'PDF exportiert: {path}',
|
||||
appExportedHtml: 'HTML exportiert: {path}',
|
||||
appExportedPdfMixed:
|
||||
'PDF exportiert: {path} (gemischte Papierformate, {n} Gruppen seitenweise zusammengeführt)',
|
||||
appExportPdfCanceled: 'PDF-Export abgebrochen',
|
||||
appExportHtmlCanceled: 'HTML-Export abgebrochen',
|
||||
appMixedExportOpening:
|
||||
'Gemischte Papierformate: Seitenvorschau wird geöffnet, um die Seiten zusammengeführt zu exportieren…',
|
||||
appSelectTextToComment: 'Wählen Sie zuerst den zu kommentierenden Text aus',
|
||||
appCommentSelectionLost:
|
||||
'Die Auswahl ist nicht mehr gültig; wählen Sie den zu kommentierenden Text erneut aus',
|
||||
appCommentAdded: 'Kommentar hinzugefügt; wird beim Speichern in das Dokument geschrieben',
|
||||
appCommentEdited: 'Kommentar aktualisiert; wird beim Speichern in das Dokument geschrieben',
|
||||
appCommentAnchorGone:
|
||||
'Der Anker des ursprünglichen Kommentars existiert nicht mehr; Antworten nicht möglich',
|
||||
appCommentReplied: 'Antwort hinzugefügt; wird beim Speichern in das Dokument geschrieben',
|
||||
@@ -115,6 +120,7 @@ export const de = {
|
||||
appUnknownAuthor: '(Unbekannter Autor)',
|
||||
appResolved: 'Gelöst',
|
||||
appResolvedComments: 'Gelöste Kommentare ({n})',
|
||||
appEditComment: 'Kommentar bearbeiten',
|
||||
appDeleteComment: 'Kommentar löschen',
|
||||
appDeleteCommentWithReplies: 'Kommentar löschen (mit Antworten)',
|
||||
appDeleteReply: 'Antwort löschen',
|
||||
|
||||
@@ -74,8 +74,10 @@ export const en = {
|
||||
appPgNumHintBlank: 'Leave "Start at" blank to continue from the previous section',
|
||||
appPgNumAppliesTo: '; applies to section {n}',
|
||||
appExportingPdf: 'Exporting PDF…',
|
||||
appExportingHtml: 'Exporting HTML…',
|
||||
appExportPdf: 'Export PDF',
|
||||
appExportPdfFailed: 'PDF export failed: {error}',
|
||||
appExportHtmlFailed: 'HTML export failed: {error}',
|
||||
appPrintGroupFailed: 'failed to print page group',
|
||||
appPrintTitle: 'Print',
|
||||
appPrintProgress: 'Preparing to print…',
|
||||
@@ -91,12 +93,15 @@ export const en = {
|
||||
appPrintPrevPage: 'Previous page',
|
||||
appPrintNextPage: 'Next page',
|
||||
appExportedPdf: 'PDF exported: {path}',
|
||||
appExportedHtml: 'HTML exported: {path}',
|
||||
appExportedPdfMixed: 'PDF exported: {path} (mixed paper sizes, {n} groups merged by page)',
|
||||
appExportPdfCanceled: 'PDF export canceled',
|
||||
appExportHtmlCanceled: 'HTML export canceled',
|
||||
appMixedExportOpening: 'Mixed paper sizes: opening pagination preview to export pages merged…',
|
||||
appSelectTextToComment: 'Select the text to comment on first',
|
||||
appCommentSelectionLost: 'The selection is no longer valid; reselect the text to comment on',
|
||||
appCommentAdded: 'Comment added; written to the document on save',
|
||||
appCommentEdited: 'Comment updated; written to the document on save',
|
||||
appCommentAnchorGone: "The original comment's anchor no longer exists; cannot reply",
|
||||
appCommentReplied: 'Reply added; written to the document on save',
|
||||
appCommentResolvedMsg: 'Comment resolved',
|
||||
@@ -107,6 +112,7 @@ export const en = {
|
||||
appUnknownAuthor: '(Unknown author)',
|
||||
appResolved: 'Resolved',
|
||||
appResolvedComments: 'Resolved comments ({n})',
|
||||
appEditComment: 'Edit comment',
|
||||
appDeleteComment: 'Delete comment',
|
||||
appDeleteCommentWithReplies: 'Delete comment (and replies)',
|
||||
appDeleteReply: 'Delete reply',
|
||||
|
||||
@@ -78,8 +78,10 @@ export const es = {
|
||||
appPgNumHintBlank: 'Deje "Iniciar en" en blanco para continuar desde la sección anterior',
|
||||
appPgNumAppliesTo: '; se aplica a la sección {n}',
|
||||
appExportingPdf: 'Exportando PDF…',
|
||||
appExportingHtml: 'Exportando HTML…',
|
||||
appExportPdf: 'Exportar PDF',
|
||||
appExportPdfFailed: 'Error al exportar PDF: {error}',
|
||||
appExportHtmlFailed: 'Error al exportar HTML: {error}',
|
||||
appPrintGroupFailed: 'error al imprimir el grupo de páginas',
|
||||
appPrintTitle: 'Imprimir',
|
||||
appPrintProgress: 'Preparando la impresión…',
|
||||
@@ -95,15 +97,18 @@ export const es = {
|
||||
appPrintPrevPage: 'Página anterior',
|
||||
appPrintNextPage: 'Página siguiente',
|
||||
appExportedPdf: 'PDF exportado: {path}',
|
||||
appExportedHtml: 'HTML exportado: {path}',
|
||||
appExportedPdfMixed:
|
||||
'PDF exportado: {path} (tamaños de papel mixtos, {n} grupos combinados por página)',
|
||||
appExportPdfCanceled: 'Exportación de PDF cancelada',
|
||||
appExportHtmlCanceled: 'Exportación de HTML cancelada',
|
||||
appMixedExportOpening:
|
||||
'Tamaños de papel mixtos: abriendo la vista previa de paginación para exportar las páginas combinadas…',
|
||||
appSelectTextToComment: 'Seleccione primero el texto que desea comentar',
|
||||
appCommentSelectionLost:
|
||||
'La selección ya no es válida; vuelva a seleccionar el texto que desea comentar',
|
||||
appCommentAdded: 'Comentario agregado; se escribirá en el documento al guardar',
|
||||
appCommentEdited: 'Comentario actualizado; se escribirá en el documento al guardar',
|
||||
appCommentAnchorGone: 'El anclaje del comentario original ya no existe; no se puede responder',
|
||||
appCommentReplied: 'Respuesta agregada; se escribirá en el documento al guardar',
|
||||
appCommentResolvedMsg: 'Comentario resuelto',
|
||||
@@ -114,6 +119,7 @@ export const es = {
|
||||
appUnknownAuthor: '(Autor desconocido)',
|
||||
appResolved: 'Resuelto',
|
||||
appResolvedComments: 'Comentarios resueltos ({n})',
|
||||
appEditComment: 'Editar comentario',
|
||||
appDeleteComment: 'Eliminar comentario',
|
||||
appDeleteCommentWithReplies: 'Eliminar comentario (con respuestas)',
|
||||
appDeleteReply: 'Eliminar respuesta',
|
||||
|
||||
@@ -78,8 +78,10 @@ export const fr = {
|
||||
'Laissez « À partir de » vide pour continuer à partir de la section précédente',
|
||||
appPgNumAppliesTo: " ; s'applique à la section {n}",
|
||||
appExportingPdf: 'Exportation du PDF…',
|
||||
appExportingHtml: 'Exportation du HTML…',
|
||||
appExportPdf: 'Exporter en PDF',
|
||||
appExportPdfFailed: "Échec de l'exportation PDF : {error}",
|
||||
appExportHtmlFailed: "Échec de l'exportation HTML : {error}",
|
||||
appPrintGroupFailed: "échec de l'impression du groupe de pages",
|
||||
appPrintTitle: 'Imprimer',
|
||||
appPrintProgress: 'Préparation de l’impression…',
|
||||
@@ -95,15 +97,18 @@ export const fr = {
|
||||
appPrintPrevPage: 'Page précédente',
|
||||
appPrintNextPage: 'Page suivante',
|
||||
appExportedPdf: 'PDF exporté : {path}',
|
||||
appExportedHtml: 'HTML exporté : {path}',
|
||||
appExportedPdfMixed:
|
||||
'PDF exporté : {path} (formats de papier mixtes, {n} groupes fusionnés par page)',
|
||||
appExportPdfCanceled: 'Exportation PDF annulée',
|
||||
appExportHtmlCanceled: 'Exportation HTML annulée',
|
||||
appMixedExportOpening:
|
||||
"Formats de papier mixtes : ouverture de l'aperçu de pagination pour exporter les pages fusionnées…",
|
||||
appSelectTextToComment: "Sélectionnez d'abord le texte à commenter",
|
||||
appCommentSelectionLost:
|
||||
"La sélection n'est plus valide ; sélectionnez à nouveau le texte à commenter",
|
||||
appCommentAdded: "Commentaire ajouté ; écrit dans le document à l'enregistrement",
|
||||
appCommentEdited: "Commentaire modifié ; écrit dans le document à l'enregistrement",
|
||||
appCommentAnchorGone: "L'ancre du commentaire d'origine n'existe plus ; impossible de répondre",
|
||||
appCommentReplied: "Réponse ajoutée ; écrite dans le document à l'enregistrement",
|
||||
appCommentResolvedMsg: 'Commentaire résolu',
|
||||
@@ -114,6 +119,7 @@ export const fr = {
|
||||
appUnknownAuthor: '(Auteur inconnu)',
|
||||
appResolved: 'Résolu',
|
||||
appResolvedComments: 'Commentaires résolus ({n})',
|
||||
appEditComment: 'Modifier le commentaire',
|
||||
appDeleteComment: 'Supprimer le commentaire',
|
||||
appDeleteCommentWithReplies: 'Supprimer le commentaire (et les réponses)',
|
||||
appDeleteReply: 'Supprimer la réponse',
|
||||
|
||||
@@ -73,8 +73,10 @@ export const he = {
|
||||
appPgNumHintBlank: 'השאירו את "התחל ב" ריק כדי להמשיך מהמקטע הקודם',
|
||||
appPgNumAppliesTo: '; חל על מקטע {n}',
|
||||
appExportingPdf: 'מייצא PDF…',
|
||||
appExportingHtml: 'מייצא HTML…',
|
||||
appExportPdf: 'ייצוא PDF',
|
||||
appExportPdfFailed: 'ייצוא PDF נכשל: {error}',
|
||||
appExportHtmlFailed: 'ייצוא HTML נכשל: {error}',
|
||||
appPrintGroupFailed: 'הדפסת קבוצת העמודים נכשלה',
|
||||
appPrintTitle: 'הדפסה',
|
||||
appPrintProgress: 'מתכונן להדפסה…',
|
||||
@@ -90,13 +92,16 @@ export const he = {
|
||||
appPrintPrevPage: 'העמוד הקודם',
|
||||
appPrintNextPage: 'העמוד הבא',
|
||||
appExportedPdf: 'PDF יוצא: {path}',
|
||||
appExportedHtml: 'HTML יוצא: {path}',
|
||||
appExportedPdfMixed: 'PDF יוצא: {path} (גודלי נייר מעורבים, {n} קבוצות אוחדו לפי עמודים)',
|
||||
appExportPdfCanceled: 'ייצוא ה-PDF בוטל',
|
||||
appExportHtmlCanceled: 'ייצוא ה-HTML בוטל',
|
||||
appMixedExportOpening:
|
||||
'גודלי נייר מעורבים: נפתחת תצוגה מקדימה של עימוד לייצוא עם איחוד לפי עמודים…',
|
||||
appSelectTextToComment: 'תחילה סמנו את הטקסט שעליו תרצו להעיר',
|
||||
appCommentSelectionLost: 'הסימון אינו תקף עוד; סמנו שוב את הטקסט להערה',
|
||||
appCommentAdded: 'ההערה נוספה; תיכתב למסמך בעת השמירה',
|
||||
appCommentEdited: 'ההערה עודכנה; תיכתב למסמך בעת השמירה',
|
||||
appCommentAnchorGone: 'העוגן של ההערה המקורית כבר לא קיים; לא ניתן להשיב',
|
||||
appCommentReplied: 'התשובה נוספה; תיכתב למסמך בעת השמירה',
|
||||
appCommentResolvedMsg: 'ההערה נפתרה',
|
||||
@@ -107,6 +112,7 @@ export const he = {
|
||||
appUnknownAuthor: '(מחבר לא ידוע)',
|
||||
appResolved: 'נפתרה',
|
||||
appResolvedComments: 'הערות שנפתרו ({n})',
|
||||
appEditComment: 'עריכת הערה',
|
||||
appDeleteComment: 'מחיקת הערה',
|
||||
appDeleteCommentWithReplies: 'מחיקת הערה (כולל תשובות)',
|
||||
appDeleteReply: 'מחיקת תשובה',
|
||||
|
||||
@@ -75,8 +75,10 @@ export const hi = {
|
||||
appPgNumHintBlank: 'पिछले अनुभाग से जारी रखने के लिए "यहाँ से शुरू करें" खाली छोड़ें',
|
||||
appPgNumAppliesTo: '; अनुभाग {n} पर लागू',
|
||||
appExportingPdf: 'PDF निर्यात हो रहा है…',
|
||||
appExportingHtml: 'HTML निर्यात हो रहा है…',
|
||||
appExportPdf: 'PDF निर्यात करें',
|
||||
appExportPdfFailed: 'PDF निर्यात विफल: {error}',
|
||||
appExportHtmlFailed: 'HTML निर्यात विफल: {error}',
|
||||
appPrintGroupFailed: 'पृष्ठ समूह प्रिंट करने में विफल',
|
||||
appPrintTitle: 'प्रिंट करें',
|
||||
appPrintProgress: 'मुद्रण की तैयारी हो रही है…',
|
||||
@@ -92,14 +94,17 @@ export const hi = {
|
||||
appPrintPrevPage: 'पिछला पृष्ठ',
|
||||
appPrintNextPage: 'अगला पृष्ठ',
|
||||
appExportedPdf: 'PDF निर्यात किया गया: {path}',
|
||||
appExportedHtml: 'HTML निर्यात किया गया: {path}',
|
||||
appExportedPdfMixed:
|
||||
'PDF निर्यात किया गया: {path} (मिश्रित कागज़ आकार, {n} समूह पृष्ठ अनुसार मर्ज किए गए)',
|
||||
appExportPdfCanceled: 'PDF निर्यात रद्द किया गया',
|
||||
appExportHtmlCanceled: 'HTML निर्यात रद्द किया गया',
|
||||
appMixedExportOpening:
|
||||
'मिश्रित कागज़ आकार: पृष्ठ अनुसार मर्ज करके निर्यात के लिए पृष्ठांकन पूर्वावलोकन खोला जा रहा है…',
|
||||
appSelectTextToComment: 'पहले वह टेक्स्ट चुनें जिस पर टिप्पणी करनी है',
|
||||
appCommentSelectionLost: 'चयन अब मान्य नहीं है; टिप्पणी के लिए टेक्स्ट फिर से चुनें',
|
||||
appCommentAdded: 'टिप्पणी जोड़ी गई; सहेजने पर दस्तावेज़ में लिखी जाएगी',
|
||||
appCommentEdited: 'टिप्पणी अपडेट की गई; सहेजने पर दस्तावेज़ में लिखी जाएगी',
|
||||
appCommentAnchorGone: 'मूल टिप्पणी का एंकर अब मौजूद नहीं है; जवाब नहीं दिया जा सकता',
|
||||
appCommentReplied: 'जवाब जोड़ा गया; सहेजने पर दस्तावेज़ में लिखा जाएगा',
|
||||
appCommentResolvedMsg: 'टिप्पणी हल की गई',
|
||||
@@ -110,6 +115,7 @@ export const hi = {
|
||||
appUnknownAuthor: '(अज्ञात लेखक)',
|
||||
appResolved: 'हल हो गया',
|
||||
appResolvedComments: 'हल की गई टिप्पणियाँ ({n})',
|
||||
appEditComment: 'टिप्पणी संपादित करें',
|
||||
appDeleteComment: 'टिप्पणी हटाएँ',
|
||||
appDeleteCommentWithReplies: 'टिप्पणी हटाएँ (जवाबों सहित)',
|
||||
appDeleteReply: 'जवाब हटाएँ',
|
||||
|
||||
@@ -77,8 +77,10 @@ export const id = {
|
||||
appPgNumHintBlank: 'Biarkan "Mulai dari" kosong untuk melanjutkan dari bagian sebelumnya',
|
||||
appPgNumAppliesTo: '; berlaku untuk bagian {n}',
|
||||
appExportingPdf: 'Mengekspor PDF…',
|
||||
appExportingHtml: 'Mengekspor HTML…',
|
||||
appExportPdf: 'Ekspor PDF',
|
||||
appExportPdfFailed: 'Gagal mengekspor PDF: {error}',
|
||||
appExportHtmlFailed: 'Gagal mengekspor HTML: {error}',
|
||||
appPrintGroupFailed: 'gagal mencetak grup halaman',
|
||||
appPrintTitle: 'Cetak',
|
||||
appPrintProgress: 'Menyiapkan pencetakan…',
|
||||
@@ -94,14 +96,17 @@ export const id = {
|
||||
appPrintPrevPage: 'Halaman sebelumnya',
|
||||
appPrintNextPage: 'Halaman berikutnya',
|
||||
appExportedPdf: 'PDF diekspor: {path}',
|
||||
appExportedHtml: 'HTML diekspor: {path}',
|
||||
appExportedPdfMixed:
|
||||
'PDF diekspor: {path} (ukuran kertas campuran, {n} grup digabungkan per halaman)',
|
||||
appExportPdfCanceled: 'Ekspor PDF dibatalkan',
|
||||
appExportHtmlCanceled: 'Ekspor HTML dibatalkan',
|
||||
appMixedExportOpening:
|
||||
'Ukuran kertas campuran: membuka pratinjau paginasi untuk mengekspor halaman yang digabungkan…',
|
||||
appSelectTextToComment: 'Pilih teks yang ingin dikomentari terlebih dahulu',
|
||||
appCommentSelectionLost: 'Pilihan tidak lagi valid; pilih kembali teks yang ingin dikomentari',
|
||||
appCommentAdded: 'Komentar ditambahkan; ditulis ke dokumen saat disimpan',
|
||||
appCommentEdited: 'Komentar diperbarui; ditulis ke dokumen saat disimpan',
|
||||
appCommentAnchorGone: 'Jangkar komentar asli sudah tidak ada; tidak dapat membalas',
|
||||
appCommentReplied: 'Balasan ditambahkan; ditulis ke dokumen saat disimpan',
|
||||
appCommentResolvedMsg: 'Komentar diselesaikan',
|
||||
@@ -112,6 +117,7 @@ export const id = {
|
||||
appUnknownAuthor: '(Penulis tidak dikenal)',
|
||||
appResolved: 'Selesai',
|
||||
appResolvedComments: 'Komentar yang diselesaikan ({n})',
|
||||
appEditComment: 'Edit komentar',
|
||||
appDeleteComment: 'Hapus komentar',
|
||||
appDeleteCommentWithReplies: 'Hapus komentar (beserta balasan)',
|
||||
appDeleteReply: 'Hapus balasan',
|
||||
|
||||
@@ -77,8 +77,10 @@ export const it = {
|
||||
appPgNumHintBlank: 'Lascia vuoto "Comincia da" per continuare dalla sezione precedente',
|
||||
appPgNumAppliesTo: '; si applica alla sezione {n}',
|
||||
appExportingPdf: 'Esportazione PDF in corso…',
|
||||
appExportingHtml: 'Esportazione HTML in corso…',
|
||||
appExportPdf: 'Esporta PDF',
|
||||
appExportPdfFailed: 'Esportazione PDF non riuscita: {error}',
|
||||
appExportHtmlFailed: 'Esportazione HTML non riuscita: {error}',
|
||||
appPrintGroupFailed: 'stampa del gruppo di pagine non riuscita',
|
||||
appPrintTitle: 'Stampa',
|
||||
appPrintProgress: 'Preparazione della stampa…',
|
||||
@@ -94,13 +96,16 @@ export const it = {
|
||||
appPrintPrevPage: 'Pagina precedente',
|
||||
appPrintNextPage: 'Pagina successiva',
|
||||
appExportedPdf: 'PDF esportato: {path}',
|
||||
appExportedHtml: 'HTML esportato: {path}',
|
||||
appExportedPdfMixed: 'PDF esportato: {path} (formati carta misti, {n} gruppi uniti per pagina)',
|
||||
appExportPdfCanceled: 'Esportazione PDF annullata',
|
||||
appExportHtmlCanceled: 'Esportazione HTML annullata',
|
||||
appMixedExportOpening:
|
||||
"Formati carta misti: apertura dell'anteprima di impaginazione per esportare unendo per pagina…",
|
||||
appSelectTextToComment: 'Seleziona prima il testo da commentare',
|
||||
appCommentSelectionLost: 'La selezione non è più valida; riseleziona il testo da commentare',
|
||||
appCommentAdded: 'Commento aggiunto; scritto nel documento al salvataggio',
|
||||
appCommentEdited: 'Commento aggiornato; scritto nel documento al salvataggio',
|
||||
appCommentAnchorGone:
|
||||
"L'ancoraggio del commento originale non esiste più; impossibile rispondere",
|
||||
appCommentReplied: 'Risposta aggiunta; scritta nel documento al salvataggio',
|
||||
@@ -112,6 +117,7 @@ export const it = {
|
||||
appUnknownAuthor: '(Autore sconosciuto)',
|
||||
appResolved: 'Risolto',
|
||||
appResolvedComments: 'Commenti risolti ({n})',
|
||||
appEditComment: 'Modifica commento',
|
||||
appDeleteComment: 'Elimina commento',
|
||||
appDeleteCommentWithReplies: 'Elimina commento (e risposte)',
|
||||
appDeleteReply: 'Elimina risposta',
|
||||
|
||||
@@ -82,8 +82,10 @@ export const ja = {
|
||||
appPgNumAppliesTo: '。セクション {n} に適用',
|
||||
// Export PDF
|
||||
appExportingPdf: 'PDF をエクスポートしています…',
|
||||
appExportingHtml: 'HTML をエクスポートしています…',
|
||||
appExportPdf: 'PDF のエクスポート',
|
||||
appExportPdfFailed: 'PDF のエクスポートに失敗しました: {error}',
|
||||
appExportHtmlFailed: 'HTML のエクスポートに失敗しました: {error}',
|
||||
appPrintGroupFailed: 'ページ グループの印刷に失敗しました',
|
||||
appPrintTitle: '印刷',
|
||||
appPrintProgress: '印刷を準備しています…',
|
||||
@@ -99,9 +101,11 @@ export const ja = {
|
||||
appPrintPrevPage: '前のページ',
|
||||
appPrintNextPage: '次のページ',
|
||||
appExportedPdf: 'PDF をエクスポートしました: {path}',
|
||||
appExportedHtml: 'HTML をエクスポートしました: {path}',
|
||||
appExportedPdfMixed:
|
||||
'PDF をエクスポートしました: {path}(用紙サイズ混在、{n} グループをページ順に結合)',
|
||||
appExportPdfCanceled: 'PDF のエクスポートをキャンセルしました',
|
||||
appExportHtmlCanceled: 'HTML のエクスポートをキャンセルしました',
|
||||
appMixedExportOpening:
|
||||
'用紙サイズが混在する文書:ページ プレビューを開き、ページごとに結合してエクスポートしています…',
|
||||
// Comments
|
||||
@@ -109,6 +113,7 @@ export const ja = {
|
||||
appCommentSelectionLost:
|
||||
'選択範囲が無効になりました。コメントを付けるテキストをもう一度選択してください',
|
||||
appCommentAdded: 'コメントを追加しました。保存時に文書へ書き込まれます',
|
||||
appCommentEdited: 'コメントを更新しました。保存時に文書へ書き込まれます',
|
||||
appCommentAnchorGone: '元のコメントのアンカーが存在しないため、返信できません',
|
||||
appCommentReplied: 'コメントに返信しました。保存時に文書へ書き込まれます',
|
||||
appCommentResolvedMsg: 'コメントを解決済みにしました',
|
||||
@@ -119,6 +124,7 @@ export const ja = {
|
||||
appUnknownAuthor: '(作成者不明)',
|
||||
appResolved: '解決済み',
|
||||
appResolvedComments: '解決済みのコメント ({n})',
|
||||
appEditComment: 'コメントの編集',
|
||||
appDeleteComment: 'コメントの削除',
|
||||
appDeleteCommentWithReplies: 'コメントの削除(返信を含む)',
|
||||
appDeleteReply: '返信の削除',
|
||||
|
||||
@@ -83,8 +83,10 @@ export const ko = {
|
||||
appPgNumAppliesTo: '; {n}구역에 적용',
|
||||
// Export PDF
|
||||
appExportingPdf: 'PDF 내보내는 중…',
|
||||
appExportingHtml: 'HTML 내보내는 중…',
|
||||
appExportPdf: 'PDF 내보내기',
|
||||
appExportPdfFailed: 'PDF 내보내기 실패: {error}',
|
||||
appExportHtmlFailed: 'HTML 내보내기 실패: {error}',
|
||||
appPrintGroupFailed: '페이지 그룹 인쇄 실패',
|
||||
appPrintTitle: '인쇄',
|
||||
appPrintProgress: '인쇄 준비 중…',
|
||||
@@ -100,9 +102,11 @@ export const ko = {
|
||||
appPrintPrevPage: '이전 페이지',
|
||||
appPrintNextPage: '다음 페이지',
|
||||
appExportedPdf: 'PDF를 내보냈습니다: {path}',
|
||||
appExportedHtml: 'HTML를 내보냈습니다: {path}',
|
||||
appExportedPdfMixed:
|
||||
'PDF를 내보냈습니다: {path}(용지 크기 혼합, {n}개 그룹을 페이지 순서로 병합)',
|
||||
appExportPdfCanceled: 'PDF 내보내기를 취소했습니다',
|
||||
appExportHtmlCanceled: 'HTML 내보내기를 취소했습니다',
|
||||
appMixedExportOpening:
|
||||
'용지 크기가 혼합된 문서: 페이지 미리 보기를 열어 페이지별로 병합하여 내보내는 중…',
|
||||
// Comments
|
||||
@@ -110,6 +114,7 @@ export const ko = {
|
||||
appCommentSelectionLost:
|
||||
'선택 영역이 더 이상 유효하지 않습니다. 메모를 추가할 텍스트를 다시 선택하세요',
|
||||
appCommentAdded: '메모를 추가했습니다. 저장 시 문서에 기록됩니다',
|
||||
appCommentEdited: '메모를 수정했습니다. 저장 시 문서에 기록됩니다',
|
||||
appCommentAnchorGone: '원래 메모의 앵커가 더 이상 존재하지 않아 회신할 수 없습니다',
|
||||
appCommentReplied: '메모에 회신했습니다. 저장 시 문서에 기록됩니다',
|
||||
appCommentResolvedMsg: '메모를 해결했습니다',
|
||||
@@ -120,6 +125,7 @@ export const ko = {
|
||||
appUnknownAuthor: '(작성자 알 수 없음)',
|
||||
appResolved: '해결됨',
|
||||
appResolvedComments: '해결된 메모 ({n})',
|
||||
appEditComment: '메모 편집',
|
||||
appDeleteComment: '메모 삭제',
|
||||
appDeleteCommentWithReplies: '메모 삭제(회신 포함)',
|
||||
appDeleteReply: '회신 삭제',
|
||||
|
||||
@@ -78,8 +78,10 @@ export const ms = {
|
||||
appPgNumHintBlank: 'Biarkan "Mula pada" kosong untuk meneruskan dari seksyen sebelumnya',
|
||||
appPgNumAppliesTo: '; digunakan pada seksyen {n}',
|
||||
appExportingPdf: 'Mengeksport PDF…',
|
||||
appExportingHtml: 'Mengeksport HTML…',
|
||||
appExportPdf: 'Eksport PDF',
|
||||
appExportPdfFailed: 'Eksport PDF gagal: {error}',
|
||||
appExportHtmlFailed: 'Eksport HTML gagal: {error}',
|
||||
appPrintGroupFailed: 'gagal mencetak kumpulan halaman',
|
||||
appPrintTitle: 'Cetak',
|
||||
appPrintProgress: 'Bersedia untuk mencetak…',
|
||||
@@ -95,14 +97,17 @@ export const ms = {
|
||||
appPrintPrevPage: 'Halaman sebelumnya',
|
||||
appPrintNextPage: 'Halaman seterusnya',
|
||||
appExportedPdf: 'PDF dieksport: {path}',
|
||||
appExportedHtml: 'HTML dieksport: {path}',
|
||||
appExportedPdfMixed:
|
||||
'PDF dieksport: {path} (saiz kertas bercampur, {n} kumpulan digabungkan mengikut halaman)',
|
||||
appExportPdfCanceled: 'Eksport PDF dibatalkan',
|
||||
appExportHtmlCanceled: 'Eksport HTML dibatalkan',
|
||||
appMixedExportOpening:
|
||||
'Saiz kertas bercampur: membuka pratonton penomboran halaman untuk eksport dengan gabungan mengikut halaman…',
|
||||
appSelectTextToComment: 'Pilih dahulu teks yang hendak dikomen',
|
||||
appCommentSelectionLost: 'Pilihan tidak lagi sah; pilih semula teks yang hendak dikomen',
|
||||
appCommentAdded: 'Komen ditambah; ditulis ke dokumen semasa disimpan',
|
||||
appCommentEdited: 'Komen dikemas kini; ditulis ke dokumen semasa disimpan',
|
||||
appCommentAnchorGone: 'Penambat komen asal sudah tiada; tidak dapat membalas',
|
||||
appCommentReplied: 'Balasan ditambah; ditulis ke dokumen semasa disimpan',
|
||||
appCommentResolvedMsg: 'Komen diselesaikan',
|
||||
@@ -113,6 +118,7 @@ export const ms = {
|
||||
appUnknownAuthor: '(Pengarang tidak dikenali)',
|
||||
appResolved: 'Diselesaikan',
|
||||
appResolvedComments: 'Komen yang diselesaikan ({n})',
|
||||
appEditComment: 'Edit komen',
|
||||
appDeleteComment: 'Padam komen',
|
||||
appDeleteCommentWithReplies: 'Padam komen (dengan balasan)',
|
||||
appDeleteReply: 'Padam balasan',
|
||||
|
||||
@@ -78,8 +78,10 @@ export const nl = {
|
||||
appPgNumHintBlank: 'Laat "Beginnen bij" leeg om door te gaan vanaf de vorige sectie',
|
||||
appPgNumAppliesTo: '; geldt voor sectie {n}',
|
||||
appExportingPdf: 'PDF exporteren…',
|
||||
appExportingHtml: 'HTML exporteren…',
|
||||
appExportPdf: 'PDF exporteren',
|
||||
appExportPdfFailed: 'PDF-export mislukt: {error}',
|
||||
appExportHtmlFailed: 'HTML-export mislukt: {error}',
|
||||
appPrintGroupFailed: 'afdrukken van paginagroep mislukt',
|
||||
appPrintTitle: 'Afdrukken',
|
||||
appPrintProgress: 'Afdrukken voorbereiden…',
|
||||
@@ -95,15 +97,18 @@ export const nl = {
|
||||
appPrintPrevPage: 'Vorige pagina',
|
||||
appPrintNextPage: 'Volgende pagina',
|
||||
appExportedPdf: 'PDF geëxporteerd: {path}',
|
||||
appExportedHtml: 'HTML geëxporteerd: {path}',
|
||||
appExportedPdfMixed:
|
||||
'PDF geëxporteerd: {path} (gemengde papierformaten, {n} groepen per pagina samengevoegd)',
|
||||
appExportPdfCanceled: 'PDF-export geannuleerd',
|
||||
appExportHtmlCanceled: 'HTML-export geannuleerd',
|
||||
appMixedExportOpening:
|
||||
'Gemengde papierformaten: pagineringsvoorbeeld wordt geopend om per pagina samengevoegd te exporteren…',
|
||||
appSelectTextToComment: 'Selecteer eerst de tekst waarop je een opmerking wilt plaatsen',
|
||||
appCommentSelectionLost:
|
||||
'De selectie is niet meer geldig; selecteer de tekst voor de opmerking opnieuw',
|
||||
appCommentAdded: 'Opmerking toegevoegd; wordt bij het opslaan naar het document geschreven',
|
||||
appCommentEdited: 'Opmerking bijgewerkt; wordt bij het opslaan naar het document geschreven',
|
||||
appCommentAnchorGone:
|
||||
'Het anker van de oorspronkelijke opmerking bestaat niet meer; reageren is niet mogelijk',
|
||||
appCommentReplied: 'Antwoord toegevoegd; wordt bij het opslaan naar het document geschreven',
|
||||
@@ -115,6 +120,7 @@ export const nl = {
|
||||
appUnknownAuthor: '(Onbekende auteur)',
|
||||
appResolved: 'Opgelost',
|
||||
appResolvedComments: 'Opgeloste opmerkingen ({n})',
|
||||
appEditComment: 'Opmerking bewerken',
|
||||
appDeleteComment: 'Opmerking verwijderen',
|
||||
appDeleteCommentWithReplies: 'Opmerking verwijderen (inclusief antwoorden)',
|
||||
appDeleteReply: 'Antwoord verwijderen',
|
||||
|
||||
@@ -76,8 +76,10 @@ export const pl = {
|
||||
appPgNumHintBlank: 'Pozostaw „Rozpocznij od” puste, aby kontynuować od poprzedniej sekcji',
|
||||
appPgNumAppliesTo: '; dotyczy sekcji {n}',
|
||||
appExportingPdf: 'Eksportowanie PDF…',
|
||||
appExportingHtml: 'Eksportowanie HTML…',
|
||||
appExportPdf: 'Eksportuj PDF',
|
||||
appExportPdfFailed: 'Eksport PDF nie powiódł się: {error}',
|
||||
appExportHtmlFailed: 'Eksport HTML nie powiódł się: {error}',
|
||||
appPrintGroupFailed: 'nie udało się wydrukować grupy stron',
|
||||
appPrintTitle: 'Drukuj',
|
||||
appPrintProgress: 'Przygotowywanie do drukowania…',
|
||||
@@ -93,15 +95,18 @@ export const pl = {
|
||||
appPrintPrevPage: 'Poprzednia strona',
|
||||
appPrintNextPage: 'Następna strona',
|
||||
appExportedPdf: 'Wyeksportowano PDF: {path}',
|
||||
appExportedHtml: 'Wyeksportowano HTML: {path}',
|
||||
appExportedPdfMixed:
|
||||
'Wyeksportowano PDF: {path} (mieszane rozmiary papieru, {n} grup scalono według stron)',
|
||||
appExportPdfCanceled: 'Anulowano eksport PDF',
|
||||
appExportHtmlCanceled: 'Anulowano eksport HTML',
|
||||
appMixedExportOpening:
|
||||
'Mieszane rozmiary papieru: otwieranie podglądu podziału na strony w celu eksportu ze scaleniem według stron…',
|
||||
appSelectTextToComment: 'Najpierw zaznacz tekst do skomentowania',
|
||||
appCommentSelectionLost:
|
||||
'Zaznaczenie jest już nieaktualne; zaznacz ponownie tekst do skomentowania',
|
||||
appCommentAdded: 'Dodano komentarz; zostanie zapisany w dokumencie przy zapisie',
|
||||
appCommentEdited: 'Zaktualizowano komentarz; zostanie zapisany w dokumencie przy zapisie',
|
||||
appCommentAnchorGone:
|
||||
'Zakotwiczenie pierwotnego komentarza już nie istnieje; nie można odpowiedzieć',
|
||||
appCommentReplied: 'Dodano odpowiedź; zostanie zapisana w dokumencie przy zapisie',
|
||||
@@ -113,6 +118,7 @@ export const pl = {
|
||||
appUnknownAuthor: '(Nieznany autor)',
|
||||
appResolved: 'Rozwiązano',
|
||||
appResolvedComments: 'Rozwiązane komentarze ({n})',
|
||||
appEditComment: 'Edytuj komentarz',
|
||||
appDeleteComment: 'Usuń komentarz',
|
||||
appDeleteCommentWithReplies: 'Usuń komentarz (wraz z odpowiedziami)',
|
||||
appDeleteReply: 'Usuń odpowiedź',
|
||||
|
||||
@@ -76,8 +76,10 @@ export const pt = {
|
||||
appPgNumHintBlank: 'Deixe "Iniciar em" em branco para continuar da seção anterior',
|
||||
appPgNumAppliesTo: '; aplica-se à seção {n}',
|
||||
appExportingPdf: 'Exportando PDF…',
|
||||
appExportingHtml: 'Exportando HTML…',
|
||||
appExportPdf: 'Exportar PDF',
|
||||
appExportPdfFailed: 'Falha ao exportar PDF: {error}',
|
||||
appExportHtmlFailed: 'Falha ao exportar HTML: {error}',
|
||||
appPrintGroupFailed: 'falha ao imprimir o grupo de páginas',
|
||||
appPrintTitle: 'Imprimir',
|
||||
appPrintProgress: 'Preparando para imprimir…',
|
||||
@@ -93,14 +95,17 @@ export const pt = {
|
||||
appPrintPrevPage: 'Página anterior',
|
||||
appPrintNextPage: 'Próxima página',
|
||||
appExportedPdf: 'PDF exportado: {path}',
|
||||
appExportedHtml: 'HTML exportado: {path}',
|
||||
appExportedPdfMixed:
|
||||
'PDF exportado: {path} (tamanhos de papel mistos, {n} grupos mesclados por página)',
|
||||
appExportPdfCanceled: 'Exportação de PDF cancelada',
|
||||
appExportHtmlCanceled: 'Exportação de HTML cancelada',
|
||||
appMixedExportOpening:
|
||||
'Tamanhos de papel mistos: abrindo a visualização de paginação para exportar mesclando por página…',
|
||||
appSelectTextToComment: 'Selecione primeiro o texto a comentar',
|
||||
appCommentSelectionLost: 'A seleção não é mais válida; selecione novamente o texto a comentar',
|
||||
appCommentAdded: 'Comentário adicionado; gravado no documento ao salvar',
|
||||
appCommentEdited: 'Comentário atualizado; gravado no documento ao salvar',
|
||||
appCommentAnchorGone: 'A âncora do comentário original não existe mais; não é possível responder',
|
||||
appCommentReplied: 'Resposta adicionada; gravada no documento ao salvar',
|
||||
appCommentResolvedMsg: 'Comentário resolvido',
|
||||
@@ -111,6 +116,7 @@ export const pt = {
|
||||
appUnknownAuthor: '(Autor desconhecido)',
|
||||
appResolved: 'Resolvido',
|
||||
appResolvedComments: 'Comentários resolvidos ({n})',
|
||||
appEditComment: 'Editar comentário',
|
||||
appDeleteComment: 'Excluir comentário',
|
||||
appDeleteCommentWithReplies: 'Excluir comentário (e respostas)',
|
||||
appDeleteReply: 'Excluir resposta',
|
||||
|
||||
@@ -77,8 +77,10 @@ export const ru = {
|
||||
'Оставьте поле «Начать с» пустым, чтобы продолжить нумерацию предыдущего раздела',
|
||||
appPgNumAppliesTo: '; применяется к разделу {n}',
|
||||
appExportingPdf: 'Экспорт PDF…',
|
||||
appExportingHtml: 'Экспорт HTML…',
|
||||
appExportPdf: 'Экспорт в PDF',
|
||||
appExportPdfFailed: 'Не удалось экспортировать PDF: {error}',
|
||||
appExportHtmlFailed: 'Не удалось экспортировать HTML: {error}',
|
||||
appPrintGroupFailed: 'не удалось напечатать группу страниц',
|
||||
appPrintTitle: 'Печать',
|
||||
appPrintProgress: 'Подготовка к печати…',
|
||||
@@ -94,14 +96,17 @@ export const ru = {
|
||||
appPrintPrevPage: 'Предыдущая страница',
|
||||
appPrintNextPage: 'Следующая страница',
|
||||
appExportedPdf: 'PDF экспортирован: {path}',
|
||||
appExportedHtml: 'HTML экспортирован: {path}',
|
||||
appExportedPdfMixed:
|
||||
'PDF экспортирован: {path} (смешанные форматы бумаги, {n} групп объединено по страницам)',
|
||||
appExportPdfCanceled: 'Экспорт PDF отменен',
|
||||
appExportHtmlCanceled: 'Экспорт HTML отменен',
|
||||
appMixedExportOpening:
|
||||
'Смешанные форматы бумаги: открывается предварительный просмотр страниц для постраничного объединения при экспорте…',
|
||||
appSelectTextToComment: 'Сначала выделите текст для примечания',
|
||||
appCommentSelectionLost: 'Выделение больше недействительно; выделите текст для примечания заново',
|
||||
appCommentAdded: 'Примечание добавлено; будет записано в документ при сохранении',
|
||||
appCommentEdited: 'Примечание изменено; будет записано в документ при сохранении',
|
||||
appCommentAnchorGone: 'Привязка исходного примечания больше не существует; ответить невозможно',
|
||||
appCommentReplied: 'Ответ добавлен; будет записан в документ при сохранении',
|
||||
appCommentResolvedMsg: 'Примечание помечено как решенное',
|
||||
@@ -112,6 +117,7 @@ export const ru = {
|
||||
appUnknownAuthor: '(Неизвестный автор)',
|
||||
appResolved: 'Решено',
|
||||
appResolvedComments: 'Решенные примечания ({n})',
|
||||
appEditComment: 'Изменить примечание',
|
||||
appDeleteComment: 'Удалить примечание',
|
||||
appDeleteCommentWithReplies: 'Удалить примечание (с ответами)',
|
||||
appDeleteReply: 'Удалить ответ',
|
||||
|
||||
@@ -75,8 +75,10 @@ export const th = {
|
||||
appPgNumHintBlank: 'เว้นว่าง "เริ่มที่" เพื่อใส่หมายเลขต่อจากส่วนก่อนหน้า',
|
||||
appPgNumAppliesTo: ' มีผลกับส่วนที่ {n}',
|
||||
appExportingPdf: 'กำลังส่งออก PDF…',
|
||||
appExportingHtml: 'กำลังส่งออก HTML…',
|
||||
appExportPdf: 'ส่งออก PDF',
|
||||
appExportPdfFailed: 'ส่งออก PDF ไม่สำเร็จ: {error}',
|
||||
appExportHtmlFailed: 'ส่งออก HTML ไม่สำเร็จ: {error}',
|
||||
appPrintGroupFailed: 'พิมพ์กลุ่มหน้าไม่สำเร็จ',
|
||||
appPrintTitle: 'พิมพ์',
|
||||
appPrintProgress: 'กำลังเตรียมพิมพ์…',
|
||||
@@ -92,14 +94,17 @@ export const th = {
|
||||
appPrintPrevPage: 'หน้าก่อนหน้า',
|
||||
appPrintNextPage: 'หน้าถัดไป',
|
||||
appExportedPdf: 'ส่งออก PDF แล้ว: {path}',
|
||||
appExportedHtml: 'ส่งออก HTML แล้ว: {path}',
|
||||
appExportedPdfMixed: 'ส่งออก PDF แล้ว: {path} (ขนาดกระดาษผสม รวม {n} กลุ่มตามลำดับหน้า)',
|
||||
appExportPdfCanceled: 'ยกเลิกการส่งออก PDF แล้ว',
|
||||
appExportHtmlCanceled: 'ยกเลิกการส่งออก HTML แล้ว',
|
||||
appMixedExportOpening:
|
||||
'เอกสารมีขนาดกระดาษผสม: กำลังเปิดตัวอย่างการแบ่งหน้าเพื่อส่งออกแบบรวมทีละหน้า…',
|
||||
appSelectTextToComment: 'เลือกข้อความที่ต้องการใส่ข้อคิดเห็นก่อน',
|
||||
appCommentSelectionLost:
|
||||
'ส่วนที่เลือกไม่ถูกต้องแล้ว โปรดเลือกข้อความที่ต้องการใส่ข้อคิดเห็นอีกครั้ง',
|
||||
appCommentAdded: 'เพิ่มข้อคิดเห็นแล้ว จะเขียนลงในเอกสารเมื่อบันทึก',
|
||||
appCommentEdited: 'อัปเดตข้อคิดเห็นแล้ว จะเขียนลงในเอกสารเมื่อบันทึก',
|
||||
appCommentAnchorGone: 'จุดยึดของข้อคิดเห็นเดิมไม่มีอยู่แล้ว ไม่สามารถตอบกลับได้',
|
||||
appCommentReplied: 'ตอบกลับข้อคิดเห็นแล้ว จะเขียนลงในเอกสารเมื่อบันทึก',
|
||||
appCommentResolvedMsg: 'แก้ไขข้อคิดเห็นแล้ว',
|
||||
@@ -110,6 +115,7 @@ export const th = {
|
||||
appUnknownAuthor: '(ไม่ทราบผู้เขียน)',
|
||||
appResolved: 'แก้ไขแล้ว',
|
||||
appResolvedComments: 'ข้อคิดเห็นที่แก้ไขแล้ว ({n})',
|
||||
appEditComment: 'แก้ไขข้อคิดเห็น',
|
||||
appDeleteComment: 'ลบข้อคิดเห็น',
|
||||
appDeleteCommentWithReplies: 'ลบข้อคิดเห็น (รวมการตอบกลับ)',
|
||||
appDeleteReply: 'ลบการตอบกลับ',
|
||||
|
||||
@@ -73,8 +73,10 @@ export const zhTW = {
|
||||
appPgNumHintBlank: '起始頁碼留空 = 接續前一節',
|
||||
appPgNumAppliesTo: ';作用於第 {n} 節',
|
||||
appExportingPdf: '正在匯出 PDF…',
|
||||
appExportingHtml: '正在匯出 HTML…',
|
||||
appExportPdf: '匯出 PDF',
|
||||
appExportPdfFailed: '匯出 PDF 失敗: {error}',
|
||||
appExportHtmlFailed: '匯出 HTML 失敗: {error}',
|
||||
appPrintGroupFailed: '列印分組失敗',
|
||||
appPrintTitle: '列印',
|
||||
appPrintProgress: '正在準備列印…',
|
||||
@@ -90,12 +92,15 @@ export const zhTW = {
|
||||
appPrintPrevPage: '上一頁',
|
||||
appPrintNextPage: '下一頁',
|
||||
appExportedPdf: '已匯出 PDF: {path}',
|
||||
appExportedHtml: '已匯出 HTML: {path}',
|
||||
appExportedPdfMixed: '已匯出 PDF: {path}(混合紙張,{n} 組已按頁合併)',
|
||||
appExportPdfCanceled: '已取消匯出 PDF',
|
||||
appExportHtmlCanceled: '已取消匯出 HTML',
|
||||
appMixedExportOpening: '混合紙張文件:正在開啟分頁預覽並按頁合併匯出…',
|
||||
appSelectTextToComment: '請先選取要加註解的文字',
|
||||
appCommentSelectionLost: '選取範圍已失效,請重新選取要加註解的文字',
|
||||
appCommentAdded: '已新增註解,儲存後寫入文件',
|
||||
appCommentEdited: '已更新註解,儲存後寫入文件',
|
||||
appCommentAnchorGone: '原註解的錨點已不存在,無法回覆',
|
||||
appCommentReplied: '已回覆註解,儲存後寫入文件',
|
||||
appCommentResolvedMsg: '註解已解決',
|
||||
@@ -106,6 +111,7 @@ export const zhTW = {
|
||||
appUnknownAuthor: '(未知作者)',
|
||||
appResolved: '已解決',
|
||||
appResolvedComments: '已解決的註解 ({n})',
|
||||
appEditComment: '編輯註解',
|
||||
appDeleteComment: '刪除註解',
|
||||
appDeleteCommentWithReplies: '刪除註解(含回覆)',
|
||||
appDeleteReply: '刪除回覆',
|
||||
|
||||
@@ -79,8 +79,10 @@ export const zh = {
|
||||
appPgNumAppliesTo: ';作用于第 {n} 节',
|
||||
// Export PDF
|
||||
appExportingPdf: '正在导出 PDF…',
|
||||
appExportingHtml: '正在导出 HTML…',
|
||||
appExportPdf: '导出 PDF',
|
||||
appExportPdfFailed: '导出 PDF 失败: {error}',
|
||||
appExportHtmlFailed: '导出 HTML 失败: {error}',
|
||||
appPrintGroupFailed: '打印分组失败',
|
||||
appPrintTitle: '打印',
|
||||
appPrintProgress: '正在准备打印…',
|
||||
@@ -96,13 +98,16 @@ export const zh = {
|
||||
appPrintPrevPage: '上一页',
|
||||
appPrintNextPage: '下一页',
|
||||
appExportedPdf: '已导出 PDF: {path}',
|
||||
appExportedHtml: '已导出 HTML: {path}',
|
||||
appExportedPdfMixed: '已导出 PDF: {path}(混合纸张,{n} 组已按页合并)',
|
||||
appExportPdfCanceled: '已取消导出 PDF',
|
||||
appExportHtmlCanceled: '已取消导出 HTML',
|
||||
appMixedExportOpening: '混合纸张文档:正在打开分页预览并按页合并导出…',
|
||||
// Comments
|
||||
appSelectTextToComment: '先选中要批注的文字',
|
||||
appCommentSelectionLost: '选区已失效,请重新选中要批注的文字',
|
||||
appCommentAdded: '已添加批注,保存后写入文档',
|
||||
appCommentEdited: '批注已更新,保存后写入文档',
|
||||
appCommentAnchorGone: '原批注的锚点已不存在,无法回复',
|
||||
appCommentReplied: '已回复批注,保存后写入文档',
|
||||
appCommentResolvedMsg: '批注已解决',
|
||||
@@ -113,6 +118,7 @@ export const zh = {
|
||||
appUnknownAuthor: '(未知作者)',
|
||||
appResolved: '已解决',
|
||||
appResolvedComments: '已解决的批注 ({n})',
|
||||
appEditComment: '编辑批注',
|
||||
appDeleteComment: '删除批注',
|
||||
appDeleteCommentWithReplies: '删除批注(含回复)',
|
||||
appDeleteReply: '删除回复',
|
||||
|
||||
@@ -33,6 +33,7 @@ const AI_LANG_DIRECTIVES: Record<Lang, string> = {
|
||||
pt: '\n\nResponda no mesmo idioma da mensagem do usuário; se não for possível determiná-lo, responda em português.',
|
||||
it: "\n\nRispondi nella stessa lingua del messaggio dell'utente; se non può essere determinata, rispondi in italiano.",
|
||||
pl: '\n\nOdpowiadaj w tym samym języku, co wiadomość użytkownika; jeśli nie da się go ustalić, odpowiadaj po polsku.',
|
||||
cs: '\n\nOdpovídej ve stejném jazyce jako zpráva uživatele; pokud ho nelze určit, odpovídej česky.',
|
||||
nl: '\n\nAntwoord in dezelfde taal als het bericht van de gebruiker; als die niet te bepalen is, antwoord dan in het Nederlands.',
|
||||
ms: '\n\nBalas dalam bahasa yang sama dengan mesej pengguna; jika tidak dapat ditentukan, balas dalam bahasa Melayu.',
|
||||
he: '\n\nהשב באותה שפה של הודעת המשתמש; אם לא ניתן לקבוע אותה, השב בעברית.',
|
||||
@@ -61,6 +62,7 @@ export const DATE_LOCALES: Record<Lang, string> = {
|
||||
pt: 'pt-BR',
|
||||
it: 'it-IT',
|
||||
pl: 'pl-PL',
|
||||
cs: 'cs-CZ',
|
||||
nl: 'nl-NL',
|
||||
ms: 'ms-MY',
|
||||
he: 'he-IL',
|
||||
|
||||
@@ -0,0 +1,709 @@
|
||||
import type { zh } from './zh'
|
||||
|
||||
export const cs = {
|
||||
ribbonAiCreditNote: 'Používá AI a spotřebovává kredity',
|
||||
ribbonAiRewriteConfirm:
|
||||
'Tato akce volá asistenta AI: spotřebovává kredity a může přepsat celý obsah. Pokračovat? (Znovu se už nezeptáme.)',
|
||||
ribbonTabFile: 'Soubor',
|
||||
ribbonTabHome: 'Domů',
|
||||
ribbonTabInsert: 'Vložení',
|
||||
ribbonTabDraw: 'Kreslení',
|
||||
ribbonTabDesign: 'Návrh',
|
||||
ribbonTabLayout: 'Rozložení',
|
||||
ribbonTabReferences: 'Odkazy',
|
||||
ribbonTabReview: 'Revize',
|
||||
ribbonCollapse: 'Sbalit pás karet',
|
||||
ribbonPin: 'Připnout pás karet',
|
||||
ribbonTabView: 'Zobrazení',
|
||||
ribbonTabTableDesign: 'Návrh tabulky',
|
||||
ribbonTabTableLayout: 'Rozložení tabulky',
|
||||
ribbonTabPictureFormat: 'Formát obrázku',
|
||||
ribbonTabShapeFormat: 'Formát obrazce',
|
||||
ribbonGroupShapeStyles: 'Styly obrazců',
|
||||
ribbonShapeFill: 'Výplň obrazce',
|
||||
ribbonShapeFillTip: 'Vyplnit vybraný obrazec barvou',
|
||||
ribbonShapeOutline: 'Obrys obrazce',
|
||||
ribbonShapeOutlineTip: 'Vybrat barvu obrysu vybraného obrazce',
|
||||
ribbonNoFill: 'Bez výplně',
|
||||
ribbonNoOutline: 'Bez obrysu',
|
||||
ribbonRemoveBg: 'Odstranit pozadí',
|
||||
ribbonRemoveBgTip: 'Odstranit pozadí: výřez podle tolerance barev (nahradí se průhledným PNG)',
|
||||
ribbonCrop: 'Oříznout',
|
||||
ribbonRotateRight: 'Otočit doprava o 90°',
|
||||
ribbonRotateLeft: 'Otočit doleva o 90°',
|
||||
ribbonFlipH: 'Překlopit vodorovně',
|
||||
ribbonFlipV: 'Překlopit svisle',
|
||||
ribbonCropTip: 'Oříznout obrázek (tažením úchytů, Enter potvrdí)',
|
||||
ribbonCropHint:
|
||||
'Tažením úchytů nebo posunem rámečku zvolte oblast, která zůstane; Enter použije, Esc zruší',
|
||||
ribbonReplacePicture: 'Nahradit obrázek',
|
||||
ribbonReplacePictureTip: 'Nahradit obrázek se zachováním aktuální velikosti a obtékání',
|
||||
ribbonResetSize: 'Obnovit velikost',
|
||||
ribbonResetSizeTip: 'Obnovit původní velikost obrázku',
|
||||
ribbonPicHeight: 'Výška',
|
||||
ribbonPicWidth: 'Šířka',
|
||||
ribbonGroupAdjust: 'Upravit',
|
||||
ribbonGroupSize: 'Velikost',
|
||||
ribbonApply: 'Použít',
|
||||
ribbonProcessing: 'Zpracování…',
|
||||
ribbonLoading: 'Načítání…',
|
||||
ribbonImageLoadFail: 'Obrázek se nepodařilo načíst',
|
||||
ribbonImageProcessFail: 'Zpracování obrázku se nezdařilo',
|
||||
ribbonCutoutTolerance: 'Tolerance',
|
||||
ribbonCutoutHint:
|
||||
'Barvy pozadí se vzorkují z okrajů obrázku; vyšší tolerance odstraní více podobných barev. V tomto náhledu je odstraněno přibližně {pct} % pixelů.',
|
||||
ribbonOk: 'OK',
|
||||
ribbonCancel: 'Zrušit',
|
||||
ribbonClose: 'Zavřít',
|
||||
ribbonAdd: 'Přidat',
|
||||
ribbonInsert: 'Vložit',
|
||||
ribbonNone: 'Žádné',
|
||||
ribbonDefault: 'Výchozí',
|
||||
ribbonAuto: 'Auto',
|
||||
ribbonAutomatic: 'Automaticky',
|
||||
ribbonCm: 'cm',
|
||||
ribbonNotSupportedSuffix: '{label} (zatím není podporováno)',
|
||||
ribbonOpen: 'Otevřít…',
|
||||
ribbonSave: 'Uložit',
|
||||
ribbonSaveAs: 'Uložit jako…',
|
||||
ribbonPaste: 'Vložit',
|
||||
ribbonCutTip: 'Vyjmout (⌘X)',
|
||||
ribbonCopyTip: 'Kopírovat (⌘C)',
|
||||
ribbonPainterTip: 'Kopírovat formát: klikněte sem a poté vyberte text, který chcete formátovat',
|
||||
ribbonPainterActiveTip:
|
||||
'Kopírování formátu je zapnuto: vyberte cílový text (dalším kliknutím zrušíte)',
|
||||
ribbonGroupClipboard: 'Schránka',
|
||||
ribbonFontFamilyTip: 'Písmo',
|
||||
ribbonFontsCommon: 'Běžná písma',
|
||||
ribbonFontsSystem: 'Systémová písma',
|
||||
ribbonFontBody: 'DengXian (základní text)',
|
||||
ribbonFontBodyNamed: '{font} (základní text)',
|
||||
ribbonFontSizeTip: 'Velikost písma',
|
||||
ribbonGrowFont: 'Zvětšit písmo',
|
||||
ribbonShrinkFont: 'Zmenšit písmo',
|
||||
ribbonChangeCase: 'Změnit velikost písmen',
|
||||
ribbonCaseSentence: 'První písmeno věty velké',
|
||||
ribbonCaseLower: 'malá písmena',
|
||||
ribbonCaseUpper: 'VELKÁ PÍSMENA',
|
||||
ribbonCaseTitle: 'Každé Slovo Velkým Písmenem',
|
||||
ribbonClearFormatting: 'Vymazat veškeré formátování',
|
||||
ribbonBoldTip: 'Tučné (⌘B)',
|
||||
ribbonItalicTip: 'Kurzíva (⌘I)',
|
||||
ribbonUnderlineTip: 'Podtržení (⌘U)',
|
||||
ribbonStrikethrough: 'Přeškrtnuté',
|
||||
ribbonSubscript: 'Dolní index',
|
||||
ribbonSuperscript: 'Horní index',
|
||||
ribbonTextHighlightColor: 'Barva zvýraznění textu',
|
||||
ribbonHighlightColors: 'Barvy zvýraznění',
|
||||
ribbonNoColor: 'Bez barvy',
|
||||
ribbonFontColor: 'Barva písma',
|
||||
ribbonThemeColorsSection: 'Barvy motivu',
|
||||
ribbonThemeColorShadeTip: 'Barva motivu {r}-{c}',
|
||||
ribbonStandardColors: 'Standardní barvy',
|
||||
ribbonMoreColors: 'Další barvy…',
|
||||
ribbonGroupFont: 'Písmo',
|
||||
ribbonBullets: 'Odrážky',
|
||||
ribbonNumbering: 'Číslování',
|
||||
ribbonDecreaseIndent: 'Zmenšit odsazení',
|
||||
ribbonIncreaseIndent: 'Zvětšit odsazení',
|
||||
ribbonSort: 'Seřadit',
|
||||
ribbonShowMarks: 'Zobrazit/skrýt formátovací značky',
|
||||
ribbonAlignLeftTip: 'Zarovnat vlevo (⌘L)',
|
||||
ribbonAlignCenterTip: 'Zarovnat na střed (⌘E)',
|
||||
ribbonAlignRightTip: 'Zarovnat vpravo (⌘R)',
|
||||
ribbonJustifyTip: 'Zarovnat do bloku (⌘J)',
|
||||
ribbonDirLtrTip: 'Směr textu zleva doprava',
|
||||
ribbonDirRtlTip: 'Směr textu zprava doleva',
|
||||
ribbonLineSpacing: 'Řádkování',
|
||||
ribbonLineSpacingOptions: 'Možnosti řádkování…',
|
||||
ribbonParagraphShading: 'Stínování odstavce',
|
||||
ribbonNoShading: 'Bez stínování',
|
||||
ribbonParagraphBorders: 'Ohraničení odstavce',
|
||||
ribbonBorderBottom: 'Dolní ohraničení',
|
||||
ribbonBorderTop: 'Horní ohraničení',
|
||||
ribbonBorderLeft: 'Levé ohraničení',
|
||||
ribbonBorderRight: 'Pravé ohraničení',
|
||||
ribbonBorderBox: 'Všechna ohraničení (rámeček)',
|
||||
ribbonNoBorders: 'Bez ohraničení',
|
||||
ribbonGroupParagraph: 'Odstavec',
|
||||
ribbonStyleNormal: 'Normální',
|
||||
ribbonStyleHeading1: 'Nadpis 1',
|
||||
ribbonStyleHeading2: 'Nadpis 2',
|
||||
ribbonStyleHeading3: 'Nadpis 3',
|
||||
ribbonStyleEmphasis: 'Zdůraznění',
|
||||
ribbonStyleIntenseEmphasis: 'Výrazné zdůraznění',
|
||||
ribbonStylePreview: 'AaBb',
|
||||
ribbonStylePaneTip:
|
||||
'Podokno stylů: procházení všech stylů, vytvoření nebo aktualizace stylu z výběru',
|
||||
ribbonMoreStyles: 'Další styly',
|
||||
ribbonGroupStyles: 'Styly',
|
||||
ribbonAiAssistant: 'Genspark',
|
||||
ribbonAiAssistantTip: 'Otevřít asistenta AI',
|
||||
ribbonRemoveTableStyleTip: 'Odebrat styl tabulky',
|
||||
ribbonNoStyle: 'Bez stylu',
|
||||
ribbonApplyTableStyleTip: 'Použít styl tabulky {name}',
|
||||
ribbonGroupTableStyles: 'Styly tabulky',
|
||||
ribbonCellShadingTip: 'Stínování buňky #{hex}',
|
||||
ribbonGroupShading: 'Stínování',
|
||||
ribbonAllBorders: 'Všechna ohraničení',
|
||||
ribbonAllBordersTip: 'Přidat ohraničení na všechny strany vybraných buněk',
|
||||
ribbonOuterBorders: 'Vnější ohraničení',
|
||||
ribbonOuterBordersTip: 'Ohraničení pouze na vnějším okraji výběru',
|
||||
ribbonInnerBorders: 'Vnitřní ohraničení',
|
||||
ribbonInnerBordersTip: 'Ohraničení pouze uvnitř výběru',
|
||||
ribbonTableInsideHBorders: 'Vnitřní vodorovné',
|
||||
ribbonTableInsideHBordersTip: 'Vnitřní vodorovné ohraničení celé tabulky',
|
||||
ribbonTableInsideVBorders: 'Vnitřní svislé',
|
||||
ribbonTableInsideVBordersTip: 'Vnitřní svislé ohraničení celé tabulky',
|
||||
ribbonClearBordersTip: 'Odebrat ohraničení vybraných buněk',
|
||||
ribbonBorderColor: 'Barva ohraničení',
|
||||
ribbonBorderWidth: 'Tloušťka ohraničení',
|
||||
ribbonPtValue: '{n} b.',
|
||||
ribbonGroupBorders: 'Ohraničení',
|
||||
ribbonDeleteTable: 'Odstranit tabulku',
|
||||
ribbonGroupDelete: 'Odstranit',
|
||||
ribbonInsertAbove: 'Vložit nad',
|
||||
ribbonInsertBelow: 'Vložit pod',
|
||||
ribbonInsertLeft: 'Vložit vlevo',
|
||||
ribbonInsertRight: 'Vložit vpravo',
|
||||
ribbonGroupRowsCols: 'Řádky a sloupce',
|
||||
ribbonMergeCells: 'Sloučit buňky',
|
||||
ribbonSplitCells: 'Rozdělit buňky',
|
||||
ribbonGroupMerge: 'Sloučit',
|
||||
ribbonDeleteRow: 'Odstranit řádek',
|
||||
ribbonDeleteColumn: 'Odstranit sloupec',
|
||||
ribbonGroupRowColOps: 'Odstranit řádky a sloupce',
|
||||
ribbonAlignTop: 'Zarovnat nahoru',
|
||||
ribbonAlignMiddle: 'Zarovnat svisle na střed',
|
||||
ribbonAlignBottom: 'Zarovnat dolů',
|
||||
ribbonGroupAlignment: 'Zarovnání',
|
||||
ribbonRowHeight: 'Výška řádku',
|
||||
ribbonColumnWidth: 'Šířka sloupce',
|
||||
ribbonGroupCellSize: 'Velikost buňky',
|
||||
ribbonCoverPage: 'Titulní strana',
|
||||
ribbonCoverPageTip: 'Vložit titulní stranu (integrovaná galerie)',
|
||||
ribbonInsertCoverTip: 'Vložit titulní stranu „{name}“',
|
||||
ribbonBlankPage: 'Prázdná stránka',
|
||||
ribbonBlankPageTip: 'Vložit prázdnou stránku',
|
||||
ribbonPageBreak: 'Konec stránky',
|
||||
ribbonPageBreakTip: 'Začít další odstavec na nové stránce (⌘↩)',
|
||||
ribbonGroupPages: 'Stránky',
|
||||
ribbonTable: 'Tabulka',
|
||||
ribbonTableTip: 'Vložit tabulku',
|
||||
ribbonTableSize: 'Tabulka {r}×{c}',
|
||||
ribbonTablePickSize: 'Zvolte velikost tabulky',
|
||||
ribbonTableInsertDialog: 'Vložit tabulku…',
|
||||
ribbonTableColsLabel: 'Počet sloupců',
|
||||
ribbonTableRowsLabel: 'Počet řádků',
|
||||
ribbonTableHandleTip: 'Vybrat tabulku; tažením ji přesunete',
|
||||
ribbonTableDeleteMenu: 'Odstranit',
|
||||
ribbonSelectRow: 'Vybrat řádek',
|
||||
ribbonSelectColumn: 'Vybrat sloupec',
|
||||
ribbonSelectTable: 'Vybrat tabulku',
|
||||
ribbonGroupTableAlign: 'Zarovnání tabulky',
|
||||
ribbonGroupTables: 'Tabulky',
|
||||
ribbonPicture: 'Obrázek',
|
||||
ribbonPictureTip: 'Vložit obrázek',
|
||||
ribbonPictureLabel: 'Obrázek ({name})',
|
||||
ribbonChart: 'Graf',
|
||||
ribbonChartTip: 'Vložit graf (sloupcový/spojnicový/výsečový)',
|
||||
ribbonShapes: 'Obrazce',
|
||||
ribbonShapesTip: 'Vložit obrazec',
|
||||
ribbonShapeLabel: 'Obrazec ({name})',
|
||||
ribbonGroupIllustrations: 'Ilustrace',
|
||||
ribbonTextBox: 'Textové pole',
|
||||
ribbonTextBoxTip: 'Vložit textové pole',
|
||||
ribbonWordArt: 'WordArt',
|
||||
ribbonWordArtTip: 'Vložit WordArt',
|
||||
ribbonWordArtLabel: 'WordArt ({name})',
|
||||
ribbonWordArtDefaultText: 'Sem zadejte text',
|
||||
ribbonWordArtPreviewChar: 'A',
|
||||
ribbonWordArtPresetBlue: 'Výplň: modrá',
|
||||
ribbonWordArtPresetGold: 'Výplň: zlatá',
|
||||
ribbonWordArtPresetRed: 'Výplň: tmavě červená',
|
||||
ribbonWordArtPresetPurple: 'Výplň: fialová',
|
||||
ribbonWordArtPresetGreenItalic: 'Výplň: zelená; kurzíva',
|
||||
ribbonWordArtPresetWhiteOrange: 'Výplň: bílá; obrys: oranžový',
|
||||
ribbonWordArtPresetWhiteRed: 'Výplň: bílá; obrys: tmavě červený',
|
||||
ribbonWordArtPresetGoldBrown: 'Výplň: zlatá; obrys: hnědý',
|
||||
ribbonWordArtPresetSkyNavy: 'Výplň: světle modrá; obrys: námořnická modř',
|
||||
ribbonWordArtPresetNavyWhite: 'Výplň: námořnická modř; obrys: bílý',
|
||||
ribbonWordArtPresetBlackGold: 'Výplň: černá; obrys: zlatý',
|
||||
ribbonWordArtPresetSilverDark: 'Výplň: stříbrná; obrys: tmavě šedý',
|
||||
ribbonDropCap: 'Iniciála',
|
||||
ribbonDropCapNoneDesc: 'Odebrat iniciálu',
|
||||
ribbonDropCapDropped: 'V textu',
|
||||
ribbonDropCapDroppedDesc: 'Iniciála uvnitř textu',
|
||||
ribbonDropCapMargin: 'Na okraji',
|
||||
ribbonDropCapMarginDesc: 'Iniciála na okraji stránky',
|
||||
ribbonField: 'Pole',
|
||||
ribbonFieldTip: 'Vložit pole: datum/čas/stránka/název souboru (F9 aktualizuje)',
|
||||
ribbonFieldDate: 'Datum',
|
||||
ribbonFieldTime: 'Čas',
|
||||
ribbonFieldPage: 'Číslo stránky (aktuální stránka)',
|
||||
ribbonFieldNumPages: 'Celkem stránek',
|
||||
ribbonFieldFileName: 'Název souboru',
|
||||
ribbonGroupText: 'Text',
|
||||
ribbonLink: 'Odkaz',
|
||||
ribbonLinkTip: 'Vložit hypertextový odkaz (⌘K)',
|
||||
ribbonBookmark: 'Záložka',
|
||||
ribbonBookmarkTip: 'Záložka: označit místo pro přechod nebo křížový odkaz',
|
||||
ribbonCrossRef: 'Křížový odkaz',
|
||||
ribbonCrossRefTip: 'Křížový odkaz: vložit odkaz na záložku',
|
||||
ribbonGroupLinks: 'Odkazy',
|
||||
ribbonComment: 'Komentář',
|
||||
ribbonViewCommentsTip: 'Zobrazit komentáře ({count})',
|
||||
ribbonViewCommentsNoneTip: 'Zobrazit komentáře (nový vytvoříte na kartě Revize)',
|
||||
ribbonGroupComments: 'Komentáře',
|
||||
ribbonHeader: 'Záhlaví',
|
||||
ribbonHeaderTip: 'Upravit záhlaví',
|
||||
ribbonFooter: 'Zápatí',
|
||||
ribbonFooterTip: 'Upravit zápatí',
|
||||
ribbonHfPlaceholder: 'Zadejte text {label}',
|
||||
ribbonPageNumber: 'Číslo stránky',
|
||||
ribbonPnTopLeft: 'Nahoře vlevo',
|
||||
ribbonPnTopCenter: 'Nahoře uprostřed',
|
||||
ribbonPnTopRight: 'Nahoře vpravo',
|
||||
ribbonPnBottomLeft: 'Dole vlevo',
|
||||
ribbonPnBottomCenter: 'Dole uprostřed',
|
||||
ribbonPnBottomRight: 'Dole vpravo',
|
||||
ribbonPnFormat: 'Formát čísel stránek…',
|
||||
ribbonPnRemove: 'Odebrat čísla stránek',
|
||||
ribbonDiffFirstPage: 'Jiné na první stránce',
|
||||
ribbonDiffFirstPageTip: 'Použít na první stránce samostatné záhlaví a zápatí',
|
||||
ribbonDiffOddEven: 'Různé liché a sudé stránky',
|
||||
ribbonDiffOddEvenTip: 'Použít různá záhlaví a zápatí na lichých a sudých stránkách',
|
||||
ribbonGroupHeaderFooter: 'Záhlaví a zápatí',
|
||||
ribbonSymbol: 'Symbol',
|
||||
ribbonSymbolTip: 'Vložit symbol',
|
||||
ribbonEquation: 'Rovnice',
|
||||
ribbonEquationTip: 'Vložit rovnici',
|
||||
ribbonGroupSymbols: 'Symboly',
|
||||
ribbonBookmarkNamePh: 'Název záložky',
|
||||
ribbonBookmarkNameInvalid:
|
||||
'Název záložky musí začínat písmenem a nesmí obsahovat mezery ani interpunkci',
|
||||
ribbonBookmarkExists: 'Záložka s tímto názvem již existuje',
|
||||
ribbonBookmarkNoCursor: 'Nejprve umístěte kurzor do odstavce v těle dokumentu',
|
||||
ribbonBookmarkEmpty: 'V tomto dokumentu zatím nejsou žádné záložky',
|
||||
ribbonBookmarkDeleteTip: 'Odstranit záložku',
|
||||
ribbonCrossRefEmpty:
|
||||
'Zatím žádné záložky. Pomocí „Vložení → Záložka“ označte místo, na které chcete odkazovat.',
|
||||
ribbonChartInsertTitle: 'Vložit graf',
|
||||
ribbonChartTitlePh: 'Název grafu',
|
||||
ribbonChartBar: 'Sloupcový',
|
||||
ribbonChartLine: 'Spojnicový',
|
||||
ribbonChartPie: 'Výsečový',
|
||||
ribbonCategoryN: 'Kategorie {n}',
|
||||
ribbonSeriesN: 'Řada {n}',
|
||||
ribbonChartAddCategory: '+ Kategorie',
|
||||
ribbonChartAddSeries: '+ Řada',
|
||||
ribbonLinkInsertTitle: 'Vložit hypertextový odkaz',
|
||||
ribbonLinkEditTitle: 'Upravit hypertextový odkaz',
|
||||
ribbonLinkRemove: 'Odebrat odkaz',
|
||||
ribbonLinkText: 'Zobrazený text',
|
||||
ribbonLinkTextPh: 'Text odkazu (ponechte prázdné pro zobrazení adresy)',
|
||||
ribbonLinkAddress: 'Adresa',
|
||||
ribbonShapeRect: 'Obdélník',
|
||||
ribbonShapeRoundRect: 'Zaoblený obdélník',
|
||||
ribbonShapeEllipse: 'Ovál',
|
||||
ribbonShapeTriangle: 'Trojúhelník',
|
||||
ribbonShapeRtTriangle: 'Pravoúhlý trojúhelník',
|
||||
ribbonShapeDiamond: 'Kosočtverec',
|
||||
ribbonShapeParallelogram: 'Rovnoběžník',
|
||||
ribbonShapePentagon: 'Pětiúhelník',
|
||||
ribbonShapeHexagon: 'Šestiúhelník',
|
||||
ribbonShapeStar5: 'Pěticípá hvězda',
|
||||
ribbonShapeRightArrow: 'Šipka doprava',
|
||||
ribbonShapeLeftRightArrow: 'Šipka doleva a doprava',
|
||||
ribbonShapeGroupRects: 'Obdélníky',
|
||||
ribbonShapeGroupLines: 'Čáry',
|
||||
ribbonShapeLine: 'Čára',
|
||||
ribbonShapeLineArrow: 'Čára se šipkou',
|
||||
ribbonShapeLineArrowDouble: 'Čára s oboustrannou šipkou',
|
||||
ribbonShapeLineBent: 'Lomená spojnice',
|
||||
ribbonShapeLineCurved: 'Zakřivená spojnice',
|
||||
ribbonShapeGroupBasic: 'Základní obrazce',
|
||||
ribbonShapeGroupArrows: 'Šipky',
|
||||
ribbonShapeGroupStars: 'Hvězdy',
|
||||
ribbonShapeGroupFlowchart: 'Vývojový diagram',
|
||||
ribbonShapeGroupCallouts: 'Popisky',
|
||||
ribbonShapeSnip1Rect: 'Obdélník s jedním zkoseným rohem',
|
||||
ribbonShapeSnip2SameRect: 'Obdélník se zkosenými rohy na jedné straně',
|
||||
ribbonShapeSnip2DiagRect: 'Obdélník se zkosenými protilehlými rohy',
|
||||
ribbonShapeSnipRoundRect: 'Obdélník s jedním zkoseným a jedním zaobleným rohem',
|
||||
ribbonShapeRound1Rect: 'Obdélník s jedním zaobleným rohem',
|
||||
ribbonShapeRound2SameRect: 'Obdélník se zaoblenými rohy na jedné straně',
|
||||
ribbonShapeRound2DiagRect: 'Obdélník se zaoblenými protilehlými rohy',
|
||||
ribbonShapeTrapezoid: 'Lichoběžník',
|
||||
ribbonShapeOctagon: 'Osmiúhelník',
|
||||
ribbonShapePlus: 'Kříž',
|
||||
ribbonShapeMathPlus: 'Znaménko plus',
|
||||
ribbonShapeLeftBrace: 'Levá složená závorka',
|
||||
ribbonShapeRightBrace: 'Pravá složená závorka',
|
||||
ribbonShapeBlockArc: 'Blokový oblouk',
|
||||
ribbonShapePie: 'Výseč',
|
||||
ribbonShapeChord: 'Kruhová úseč',
|
||||
ribbonShapeTeardrop: 'Kapka',
|
||||
ribbonShapeFrame: 'Rámeček',
|
||||
ribbonShapeHalfFrame: 'Poloviční rámeček',
|
||||
ribbonShapeCorner: 'Tvar L',
|
||||
ribbonShapeDiagStripe: 'Diagonální pruh',
|
||||
ribbonShapeDonut: 'Prstenec',
|
||||
ribbonShapeNoSmoking: 'Symbol zákazu',
|
||||
ribbonShapeFoldedCorner: 'Ohnutý roh',
|
||||
ribbonShapeBevel: 'Zkosení',
|
||||
ribbonShapeCube: 'Krychle',
|
||||
ribbonShapeCan: 'Válec',
|
||||
ribbonShapeLightningBolt: 'Blesk',
|
||||
ribbonShapeHeart: 'Srdce',
|
||||
ribbonShapeSun: 'Slunce',
|
||||
ribbonShapeMoon: 'Měsíc',
|
||||
ribbonShapeCloud: 'Mrak',
|
||||
ribbonShapeArc: 'Oblouk',
|
||||
ribbonShapePlaque: 'Plaketa',
|
||||
ribbonShapeSmileyFace: 'Smajlík',
|
||||
ribbonShapeLeftBracket: 'Levá hranatá závorka',
|
||||
ribbonShapeRightBracket: 'Pravá hranatá závorka',
|
||||
ribbonShapeLeftArrow: 'Šipka doleva',
|
||||
ribbonShapeUpArrow: 'Šipka nahoru',
|
||||
ribbonShapeDownArrow: 'Šipka dolů',
|
||||
ribbonShapeUpDownArrow: 'Šipka nahoru a dolů',
|
||||
ribbonShapeChevron: 'Krokev',
|
||||
ribbonShapeHomePlate: 'Pětiúhelníková šipka',
|
||||
ribbonShapeNotchedRightArrow: 'Vykrojená šipka doprava',
|
||||
ribbonShapeStar4: 'Hvězda: 4 cípy',
|
||||
ribbonShapeStar6: 'Hvězda: 6 cípů',
|
||||
ribbonShapeStar8: 'Hvězda: 8 cípů',
|
||||
ribbonShapeFlowDecision: 'Vývojový diagram: rozhodnutí',
|
||||
ribbonShapeFlowTerminator: 'Vývojový diagram: ukončení',
|
||||
ribbonShapeWedgeRectCallout: 'Obdélníkový popisek',
|
||||
ribbonShapeWedgeRoundRectCallout: 'Zaoblený obdélníkový popisek',
|
||||
ribbonShapeWedgeEllipseCallout: 'Ovální popisek',
|
||||
ribbonShapeQuadArrow: 'Čtyřsměrná šipka',
|
||||
ribbonShapeBentArrow: 'Zahnutá šipka',
|
||||
ribbonShapeUturnArrow: 'Šipka s otočkou',
|
||||
ribbonShapeCurvedRightArrow: 'Zakřivená šipka doprava',
|
||||
ribbonShapeStripedRightArrow: 'Pruhovaná šipka doprava',
|
||||
ribbonShapeStar7: 'Hvězda: 7 cípů',
|
||||
ribbonShapeStar10: 'Hvězda: 10 cípů',
|
||||
ribbonShapeStar12: 'Hvězda: 12 cípů',
|
||||
ribbonShapeStar16: 'Hvězda: 16 cípů',
|
||||
ribbonShapeStar24: 'Hvězda: 24 cípů',
|
||||
ribbonShapeStar32: 'Hvězda: 32 cípů',
|
||||
ribbonShapeIrregularSeal1: 'Exploze 1',
|
||||
ribbonShapeIrregularSeal2: 'Exploze 2',
|
||||
ribbonShapeRibbon: 'Stuha dolů',
|
||||
ribbonShapeRibbon2: 'Stuha nahoru',
|
||||
ribbonShapeWave: 'Vlna',
|
||||
ribbonShapeDoubleWave: 'Dvojitá vlna',
|
||||
ribbonShapeFlowProcess: 'Vývojový diagram: proces',
|
||||
ribbonShapeFlowAlternateProcess: 'Vývojový diagram: alternativní proces',
|
||||
ribbonShapeFlowPredefinedProcess: 'Vývojový diagram: předdefinovaný proces',
|
||||
ribbonShapeFlowInternalStorage: 'Vývojový diagram: interní úložiště',
|
||||
ribbonShapeFlowDocument: 'Vývojový diagram: dokument',
|
||||
ribbonShapeFlowMultidocument: 'Vývojový diagram: více dokumentů',
|
||||
ribbonShapeFlowPreparation: 'Vývojový diagram: příprava',
|
||||
ribbonShapeFlowManualInput: 'Vývojový diagram: ruční vstup',
|
||||
ribbonShapeFlowManualOperation: 'Vývojový diagram: ruční operace',
|
||||
ribbonShapeFlowConnector: 'Vývojový diagram: spojka',
|
||||
ribbonShapeFlowOffpageConnector: 'Vývojový diagram: spojka mimo stránku',
|
||||
ribbonShapeFlowMagneticDisk: 'Vývojový diagram: magnetický disk',
|
||||
ribbonShapeFlowMagneticDrum: 'Vývojový diagram: úložiště s přímým přístupem',
|
||||
ribbonShapeFlowDisplay: 'Vývojový diagram: zobrazení',
|
||||
ribbonShapeFlowDelay: 'Vývojový diagram: zpoždění',
|
||||
ribbonShapeFlowOr: 'Vývojový diagram: nebo',
|
||||
ribbonShapeFlowCollate: 'Vývojový diagram: porovnání',
|
||||
ribbonShapeFlowSort: 'Vývojový diagram: řazení',
|
||||
ribbonShapeFlowExtract: 'Vývojový diagram: extrakce',
|
||||
ribbonShapeFlowMerge: 'Vývojový diagram: sloučení',
|
||||
ribbonShapeFlowSummingJunction: 'Vývojový diagram: součtový uzel',
|
||||
ribbonShapeFlowPunchedTape: 'Vývojový diagram: děrná páska',
|
||||
ribbonShapeCloudCallout: 'Popisek ve tvaru mraku',
|
||||
ribbonThemes: 'Motivy',
|
||||
ribbonThemesTip: 'Změnit motiv dokumentu (písma + barvy); po uložení se použije i ve Wordu',
|
||||
ribbonFonts: 'Písma',
|
||||
ribbonThemeFontsTip: 'Změnit písma motivu (dvojice nadpis + základní text)',
|
||||
ribbonColors: 'Barvy',
|
||||
ribbonThemeColorsTip: 'Změnit barevné schéma motivu',
|
||||
ribbonGroupDocFormatting: 'Formátování dokumentu',
|
||||
ribbonPageColor: 'Barva stránky',
|
||||
ribbonPageColorTip: 'Zvolit barvu stránky',
|
||||
ribbonWatermark: 'Vodoznak',
|
||||
ribbonWatermarkTip: 'Přidat zesvětlený text za obsah stránky',
|
||||
ribbonWatermarkCustom: 'Vlastní textový vodoznak…',
|
||||
ribbonWatermarkCustomTitle: 'Vlastní textový vodoznak',
|
||||
ribbonWatermarkPh: 'Text vodoznaku, např. INTERNÍ',
|
||||
ribbonWatermarkRemove: 'Odebrat vodoznak',
|
||||
ribbonWatermarkConfidential: 'DŮVĚRNÉ',
|
||||
ribbonWatermarkNoCopy: 'NEKOPÍROVAT',
|
||||
ribbonWatermarkDraft: 'NÁVRH',
|
||||
ribbonWatermarkSample: 'UKÁZKA',
|
||||
ribbonPageBorders: 'Ohraničení stránky',
|
||||
ribbonPageBordersTip: 'Přidat ohraničení kolem stránky',
|
||||
ribbonPageBorderBox: 'Rámeček (jednoduchá čára)',
|
||||
ribbonGroupPageBackground: 'Pozadí stránky',
|
||||
ribbonThemeOffice: 'Office',
|
||||
ribbonThemeFacet: 'Faseta',
|
||||
ribbonThemeIon: 'Ion',
|
||||
ribbonThemeRetrospect: 'Retrospektiva',
|
||||
ribbonThemeFontOffice: 'Office (DengXian)',
|
||||
ribbonThemeFontSongti: 'SimSun',
|
||||
ribbonThemeFontYahei: 'Microsoft YaHei',
|
||||
ribbonThemeFontKaiti: 'KaiTi',
|
||||
ribbonThemeFontTimes: 'Times New Roman',
|
||||
ribbonThemeFontArial: 'Arial',
|
||||
ribbonPaletteGrayscale: 'Stupně šedi',
|
||||
ribbonPaletteRedViolet: 'Červenofialová',
|
||||
ribbonColorWhite: 'Bílá',
|
||||
ribbonColorBlack: 'Černá',
|
||||
ribbonColorLightGray: 'Světle šedá',
|
||||
ribbonColorDarkGray: 'Tmavě šedá',
|
||||
ribbonColorBlueGray: 'Tmavá modrošedá',
|
||||
ribbonColorBlue: 'Modrá',
|
||||
ribbonColorSkyBlue: 'Blankytně modrá',
|
||||
ribbonColorLightBlue: 'Světle modrá',
|
||||
ribbonColorDarkBlue: 'Tmavě modrá',
|
||||
ribbonColorOrange: 'Oranžová',
|
||||
ribbonColorGreen: 'Zelená',
|
||||
ribbonColorLightGreen: 'Světle zelená',
|
||||
ribbonColorLightGreenAlt: 'Světle zelená',
|
||||
ribbonColorPurple: 'Fialová',
|
||||
ribbonColorLightPurple: 'Světle fialová',
|
||||
ribbonColorDarkRed: 'Tmavě červená',
|
||||
ribbonColorRed: 'Červená',
|
||||
ribbonColorYellow: 'Žlutá',
|
||||
ribbonColorLightYellow: 'Světle žlutá',
|
||||
ribbonColorBeige: 'Béžová',
|
||||
ribbonMargins: 'Okraje',
|
||||
ribbonMarginNormal: 'Normální',
|
||||
ribbonMarginNormalDesc: '2,54 cm na všech stranách',
|
||||
ribbonMarginNarrow: 'Úzké',
|
||||
ribbonMarginNarrowDesc: '1,27 cm na všech stranách',
|
||||
ribbonMarginModerate: 'Střední',
|
||||
ribbonMarginModerateDesc: '2,54 nahoře/dole, 1,91 cm vlevo/vpravo',
|
||||
ribbonMarginWide: 'Široké',
|
||||
ribbonMarginWideDesc: '2,54 nahoře/dole, 5,08 cm vlevo/vpravo',
|
||||
ribbonMarginLastCustom: 'Poslední vlastní nastavení',
|
||||
ribbonMarginCustom: 'Vlastní okraje…',
|
||||
ribbonMarginDialogTitle: 'Vlastní okraje stránky',
|
||||
ribbonMarginTop: 'Nahoře',
|
||||
ribbonMarginBottom: 'Dole',
|
||||
ribbonMarginLeft: 'Vlevo',
|
||||
ribbonMarginRight: 'Vpravo',
|
||||
ribbonMarginTooLarge: 'Okraje jsou pro stránku příliš velké',
|
||||
ribbonOrientation: 'Orientace',
|
||||
ribbonPortrait: 'Na výšku',
|
||||
ribbonLandscape: 'Na šířku',
|
||||
ribbonPaperSize: 'Velikost',
|
||||
ribbonColumns: 'Sloupce',
|
||||
ribbonOneColumn: 'Jeden',
|
||||
ribbonTwoColumns: 'Dva',
|
||||
ribbonThreeColumns: 'Tři',
|
||||
ribbonSectionBreak: 'Konce oddílů',
|
||||
ribbonSectionBreakTip:
|
||||
'Vložit konec oddílu; obsah před ním si zachová aktuální vzhled stránky oddílu',
|
||||
ribbonBreakNextPage: 'Další stránka',
|
||||
ribbonBreakNextPageDesc: 'Začít nový oddíl na další stránce',
|
||||
ribbonBreakContinuous: 'Průběžný',
|
||||
ribbonBreakContinuousDesc: 'Začít nový oddíl na stejné stránce',
|
||||
ribbonBreakEvenPage: 'Sudá stránka',
|
||||
ribbonBreakEvenPageDesc: 'Začít nový oddíl na další sudé stránce',
|
||||
ribbonBreakOddPage: 'Lichá stránka',
|
||||
ribbonBreakOddPageDesc: 'Začít nový oddíl na další liché stránce',
|
||||
ribbonGroupPageSetup: 'Vzhled stránky',
|
||||
ribbonGroupPageSetupSection: 'Vzhled stránky (oddíl {n})',
|
||||
ribbonIndentLeft: 'Odsazení vlevo',
|
||||
ribbonIndentRight: 'Odsazení vpravo',
|
||||
ribbonSpaceBefore: 'Mezera před',
|
||||
ribbonSpaceAfter: 'Mezera za',
|
||||
ribbonGroupParagraphSelected: 'Odstavec (výběr)',
|
||||
ribbonPosition: 'Pozice',
|
||||
ribbonWrapText: 'Obtékání textu',
|
||||
ribbonGroupArrange: 'Uspořádat',
|
||||
ribbonToc: 'Obsah',
|
||||
ribbonTocTip: 'Přidat obsah',
|
||||
ribbonTocUpdate: 'Aktualizovat tabulku',
|
||||
ribbonTocUpdateTip: 'Aktualizovat obsah podle aktuálních nadpisů',
|
||||
ribbonTocNoHeadings: 'V dokumentu nejsou žádné nadpisy (Nadpis 1–6), obsah nelze vytvořit.',
|
||||
ribbonTocNotFound:
|
||||
'Nebylo nalezeno žádné pole obsahu k aktualizaci; nejprve ho vložte tlačítkem „Obsah“.',
|
||||
ribbonTocFieldLabel: 'Pole obsahu',
|
||||
ribbonIndexFieldLabel: 'Pole rejstříku',
|
||||
ribbonFootnote: 'Vložit poznámku pod čarou',
|
||||
ribbonFootnoteTip: 'Přidat poznámku pod čarou na konec stránky',
|
||||
ribbonEndnote: 'Vložit vysvětlivku',
|
||||
ribbonEndnoteTip: 'Přidat vysvětlivku na konec dokumentu',
|
||||
ribbonGroupFootnotes: 'Poznámky pod čarou',
|
||||
ribbonCitation: 'Vložit citaci',
|
||||
ribbonCitationTip: 'Citovat existující zdroj nebo přidat nový',
|
||||
ribbonAddNewSource: 'Přidat nový zdroj…',
|
||||
ribbonNoSources: 'Zatím žádné zdroje. Vytvořte ho přes „Vložit citaci → Přidat nový zdroj“.',
|
||||
ribbonBibliography: 'Bibliografie',
|
||||
ribbonBibliographyTip: 'Vložit bibliografii',
|
||||
ribbonBibliographyHeading: 'Literatura',
|
||||
ribbonCaption: 'Titulek',
|
||||
ribbonCaptionTip: 'Přidat číslovaný titulek k obrázku, tabulce nebo rovnici',
|
||||
ribbonCaptionInsertTitle: 'Vložit titulek',
|
||||
ribbonCaptionLabel: 'Popisek',
|
||||
ribbonCaptionFigure: 'Obrázek',
|
||||
ribbonCaptionTable: 'Tabulka',
|
||||
ribbonCaptionEquation: 'Rovnice',
|
||||
ribbonCaptionPh: 'Text zobrazený za {label} {n} (nepovinné)',
|
||||
ribbonIndex: 'Rejstřík',
|
||||
ribbonIndexTip: 'Označit položky rejstříku a vložit rejstřík',
|
||||
ribbonMarkEntry: 'Označit položku (XE)',
|
||||
ribbonInsertIndex: 'Vložit rejstřík',
|
||||
ribbonNoIndexEntries:
|
||||
'V dokumentu nejsou žádné položky rejstříku. Nejprve vyberte text a použijte „Označit položku“.',
|
||||
ribbonMarkEntryTitle: 'Označit položku rejstříku',
|
||||
ribbonMarkEntryPh: 'Text hlavní položky',
|
||||
ribbonGroupCitationsIndex: 'Citace a rejstřík',
|
||||
ribbonSourceCreateTitle: 'Vytvořit zdroj',
|
||||
ribbonSourceType: 'Typ zdroje',
|
||||
ribbonSourceBook: 'Kniha',
|
||||
ribbonSourceJournal: 'Článek v časopise',
|
||||
ribbonSourceWebsite: 'Web',
|
||||
ribbonSourceReport: 'Zpráva',
|
||||
ribbonSourceMisc: 'Jiné',
|
||||
ribbonSourceAuthor: 'Autor',
|
||||
ribbonSourceAuthorPh: 'Příjmení, Jméno (např. Novák, Jan)',
|
||||
ribbonSourceTitle: 'Název',
|
||||
ribbonSourceTitlePh: 'Název knihy / článku',
|
||||
ribbonSourceYear: 'Rok',
|
||||
ribbonSourceJournalName: 'Název časopisu',
|
||||
ribbonSourceSiteName: 'Název webu',
|
||||
ribbonSourcePublisher: 'Vydavatel',
|
||||
ribbonEditorBtn: 'Editor',
|
||||
ribbonEditorTip: 'AI zkontroluje pravopis, gramatiku a interpunkci',
|
||||
ribbonEditorPrompt:
|
||||
'Zkorigujte celý dokument: opravte překlepy, interpunkci a gramatické chyby a zachovejte původní význam i strukturu odstavců.',
|
||||
ribbonGroupProofing: 'Kontrola pravopisu',
|
||||
ribbonSpellcheckBtn: 'Pravopis',
|
||||
ribbonSpellcheckTip: 'Kontrolovat pravopis při psaní — možné chyby se podtrhnou červeně',
|
||||
ribbonTranslate: 'Přeložit',
|
||||
ribbonTranslateTip: 'AI přeloží dokument',
|
||||
ribbonTranslatePrompt:
|
||||
'Přeložte celý dokument do jazyka {lang} a zachovejte strukturu odstavců i úrovně nadpisů.',
|
||||
ribbonTranslateSelectionPrompt:
|
||||
'Přeložte vybraný obsah do jazyka {lang} a zachovejte strukturu odstavců.',
|
||||
ribbonEditorSelectionPrompt:
|
||||
'Zkorigujte vybraný obsah: opravte překlepy, interpunkci a gramatické chyby a zachovejte původní význam i strukturu odstavců.',
|
||||
ribbonTranslateTo: 'Přeložit do jazyka {lang}',
|
||||
ribbonLangEnglish: 'angličtina',
|
||||
ribbonLangSimplifiedChinese: 'zjednodušená čínština',
|
||||
ribbonLangJapanese: 'japonština',
|
||||
ribbonLangKorean: 'korejština',
|
||||
ribbonLangFrench: 'francouzština',
|
||||
ribbonLangGerman: 'němčina',
|
||||
ribbonLangSpanish: 'španělština',
|
||||
ribbonGroupLanguage: 'Jazyk',
|
||||
ribbonNewComment: 'Nový komentář',
|
||||
ribbonNewCommentTip: 'Přidat komentář k výběru',
|
||||
ribbonNewCommentSelectTip: 'Nejprve vyberte text, který chcete komentovat',
|
||||
ribbonShowComments: 'Zobrazit komentáře',
|
||||
ribbonAiComments: 'Vyřešit komentáře pomocí AI',
|
||||
ribbonAiRevisions: 'Souhrn revizí od AI',
|
||||
ribbonAiRevisionsTip:
|
||||
'AI přečte {count} čekajících revizí, shrne změny po oddílech a upozorní na rizika',
|
||||
ribbonAiRevisionsPrompt:
|
||||
'Shrňte všechny čekající sledované revize v dokumentu: začněte celkovou statistikou (počet vložení/odstranění, autoři, časové rozmezí), poté popište změny oddíl po oddílu (uvádějte indexy bloků) a na závěr uveďte seznam možných rizik (např. odstraněné povinnosti nebo podmínky, změněná čísla/data/částky). Pouze shrňte — dokument neupravujte a žádnou revizi nepřijímejte ani neodmítejte.',
|
||||
ribbonAiCommentsTip:
|
||||
'AI projde {count} nevyřešených komentářů: u každého provede úpravu, odpoví, co se změnilo, a poté ho vyřeší',
|
||||
ribbonAiCommentsPrompt:
|
||||
'Vyřiďte všechny nevyřešené komentáře v dokumentu: u každého proveďte požadovanou změnu, odpovězte popisem toho, co se změnilo, a poté ho vyřešte; pokud je komentář otázkou nebo je nejednoznačný, odpovězte bez úpravy dokumentu.',
|
||||
ribbonShowCommentsTip: 'Zobrazit komentáře ({count})',
|
||||
ribbonTrackChanges: 'Sledování změn',
|
||||
ribbonTrackChangesTip:
|
||||
'Sledování změn: od této chvíle zaznamenávat všechny úpravy (vložení podtržené, odstranění přeškrtnuté)',
|
||||
ribbonRevDisplay: 'Značky',
|
||||
ribbonRevDisplayTip: 'Zvolit způsob zobrazení sledovaných změn',
|
||||
ribbonRevDisplayAll: 'Všechny značky',
|
||||
ribbonRevDisplayNone: 'Bez značek',
|
||||
ribbonRevDisplayOriginal: 'Původní',
|
||||
ribbonMultilevel: 'Víceúrovňový seznam',
|
||||
ribbonMultilevelTip: 'Víceúrovňový seznam: zvolit nebo definovat formát víceúrovňového číslování',
|
||||
ribbonDefineNewList: 'Definovat nový víceúrovňový seznam',
|
||||
ribbonBulletLibTitle: 'Knihovna odrážek',
|
||||
ribbonNumberLibTitle: 'Knihovna číslování',
|
||||
ribbonListNone: 'Žádné',
|
||||
ribbonDefineNewBullet: 'Definovat novou odrážku',
|
||||
ribbonDefineNewNumber: 'Definovat nový formát čísla',
|
||||
ribbonListLevel: 'Úroveň',
|
||||
ribbonListNumStyle: 'Styl číslování',
|
||||
ribbonListFormatText: 'Formát čísla',
|
||||
ribbonListIndentCm: 'Odsazení (cm)',
|
||||
ribbonListPreviewCol: 'Náhled',
|
||||
ribbonAccept: 'Přijmout',
|
||||
ribbonAcceptTip: 'Přijmout změny (celkem {count})',
|
||||
ribbonAcceptOne: 'Přijmout tuto změnu',
|
||||
ribbonAcceptAll: 'Přijmout všechny změny',
|
||||
ribbonReject: 'Odmítnout',
|
||||
ribbonRejectTip: 'Odmítnout změny (celkem {count})',
|
||||
ribbonRejectOne: 'Odmítnout tuto změnu',
|
||||
ribbonRejectAll: 'Odmítnout všechny změny',
|
||||
ribbonPrevChange: 'Předchozí',
|
||||
ribbonPrevChangeTip: 'Přejít na předchozí změnu',
|
||||
ribbonNextChange: 'Další',
|
||||
ribbonNextChangeTip: 'Přejít na další změnu',
|
||||
ribbonGroupTracking: 'Sledování',
|
||||
ribbonCompare: 'Porovnat',
|
||||
ribbonCompareTip: 'Porovnat: vybrat jiný dokument a porovnat rozdíly po odstavcích',
|
||||
ribbonProtectDoc: 'Zamknout dokument',
|
||||
ribbonProtectDocTip: 'Zamknout dokument: hesla pro otevření/úpravy, omezení úprav a soukromí',
|
||||
ribbonGroupProtect: 'Zámek',
|
||||
ribbonPrintLayout: 'Rozložení při tisku',
|
||||
ribbonPrintLayoutTip: 'Rozložení při tisku: zobrazit dokument ve velikosti stránky',
|
||||
ribbonWebLayout: 'Rozložení webové stránky',
|
||||
ribbonWebLayoutTip: 'Rozložení webové stránky: vyplnit šířku okna bez konců stránek',
|
||||
ribbonOutlineView: 'Osnova',
|
||||
ribbonOutlineViewTip:
|
||||
'Zobrazení osnovy: zobrazit pouze hierarchii nadpisů; nadpisy zůstávají upravitelné',
|
||||
ribbonReadMode: 'Režim čtení',
|
||||
ribbonReadModeTip: 'Režim čtení: skrýt pás karet pro soustředěné čtení, ukončíte klávesou Esc',
|
||||
ribbonPagePreview: 'Náhled stránky',
|
||||
ribbonPagePreviewTip:
|
||||
'Náhled stránky: stránkování ve skutečné velikosti stránky se záhlavím, zápatím a číslem každé stránky (jen pro čtení)',
|
||||
ribbonGroupViews: 'Zobrazení',
|
||||
ribbonZoomOut: 'Oddálit',
|
||||
ribbonZoomIn: 'Přiblížit',
|
||||
ribbonZoom100Tip: 'Lupa 100 %',
|
||||
ribbonPageWidth: 'Šířka stránky',
|
||||
ribbonPageWidthTip: 'Přiblížit tak, aby šířka stránky odpovídala šířce okna',
|
||||
ribbonWholePage: 'Jedna stránka',
|
||||
ribbonWholePageTip: 'Přiblížit tak, aby se do okna vešla celá stránka',
|
||||
ribbonGroupZoom: 'Lupa',
|
||||
ribbonAiPanel: 'Panel AI',
|
||||
ribbonAiPanelTip: 'Zobrazit/skrýt panel AI',
|
||||
ribbonDarkMode: 'Tmavý režim',
|
||||
ribbonDarkModeTip: 'Zobrazit oblast úprav v tmavých barvách beze změny dokumentu',
|
||||
ribbonGroupShow: 'Zobrazit',
|
||||
ribbonGroupAppearance: 'Vzhled',
|
||||
ribbonRuler: 'Pravítko',
|
||||
ribbonRulerTip: 'Zobrazit/skrýt pravítko',
|
||||
ribbonGridlines: 'Mřížka',
|
||||
ribbonGridlinesTip: 'Zobrazit/skrýt mřížku stránky (jen pro zarovnání, nikdy se netiskne)',
|
||||
ribbonNavPane: 'Navigační podokno',
|
||||
ribbonNavPaneTip: 'Zobrazit/skrýt navigační podokno (osnova nadpisů)',
|
||||
ribbonNewTab: 'Nová karta',
|
||||
ribbonNewTabTip: 'Nová karta: otevřít aktuální dokument na nové kartě',
|
||||
ribbonSplit: 'Rozdělit',
|
||||
ribbonSplitTip: 'Rozdělit editor na dvě nezávisle posouvatelná podokna',
|
||||
ribbonSwitchTabs: 'Přepnout karty',
|
||||
ribbonSwitchTabsTip: 'Přepnout na jinou kartu',
|
||||
ribbonGroupWindow: 'Okno',
|
||||
ribbonSelect: 'Vybrat',
|
||||
ribbonSelectTip: 'Vybrat: ukončit kreslení a vrátit se k úpravám textu',
|
||||
ribbonPen: 'Pero',
|
||||
ribbonPenTip: 'Pero: kreslit do dokumentu (uloží se jako rukopis plovoucí nad textem)',
|
||||
ribbonHighlighter: 'Zvýrazňovač',
|
||||
ribbonHighlighterTip: 'Zvýrazňovač: průsvitné tlusté tahy',
|
||||
ribbonEraser: 'Guma',
|
||||
ribbonEraserTip: 'Guma: kliknutím nebo přejetím po tahu odstraníte celý tah',
|
||||
ribbonGroupDrawingTools: 'Nástroje kreslení',
|
||||
ribbonPixels: '{w} px',
|
||||
ribbonPenStyle: 'Styl pera',
|
||||
ribbonHighlighterStyle: 'Styl zvýrazňovače',
|
||||
ribbonClearAll: 'Vymazat vše',
|
||||
ribbonClearAllTip: 'Odstranit veškerý rukopis z dokumentu',
|
||||
ribbonGroupClear: 'Vymazat',
|
||||
} satisfies Record<keyof typeof zh, string>
|
||||
@@ -13,6 +13,7 @@ import { ar } from './ai/ar'
|
||||
import { pt } from './ai/pt'
|
||||
import { it } from './ai/it'
|
||||
import { pl } from './ai/pl'
|
||||
import { cs } from './ai/cs'
|
||||
import { nl } from './ai/nl'
|
||||
import { ms } from './ai/ms'
|
||||
import { he } from './ai/he'
|
||||
@@ -35,6 +36,7 @@ export const aiStrings = defineStrings({
|
||||
pt,
|
||||
it,
|
||||
pl,
|
||||
cs,
|
||||
nl,
|
||||
ms,
|
||||
he,
|
||||
|
||||
@@ -13,6 +13,7 @@ import { ar } from './app/ar'
|
||||
import { pt } from './app/pt'
|
||||
import { it } from './app/it'
|
||||
import { pl } from './app/pl'
|
||||
import { cs } from './app/cs'
|
||||
import { nl } from './app/nl'
|
||||
import { ms } from './app/ms'
|
||||
import { he } from './app/he'
|
||||
@@ -35,6 +36,7 @@ export const appStrings = defineStrings({
|
||||
pt,
|
||||
it,
|
||||
pl,
|
||||
cs,
|
||||
nl,
|
||||
ms,
|
||||
he,
|
||||
|
||||
@@ -800,6 +800,63 @@ export const editorStrings = defineStrings({
|
||||
editorCoverFacet: 'Faseta',
|
||||
editorCoverAnnual: 'Raport roczny',
|
||||
},
|
||||
cs: {
|
||||
editorFootnote: 'Poznámka pod čarou',
|
||||
editorEndnote: 'Vysvětlivka',
|
||||
editorIndexEntry: 'Položka rejstříku: {term}',
|
||||
editorEquation: 'Rovnice',
|
||||
editorEquationEditHint: 'Rovnice (upravíte poklepáním): {latex}',
|
||||
editorEditFormulaLatex: 'Upravit rovnici (LaTeX)',
|
||||
editorEdit: 'Upravit',
|
||||
editorMoveTextbox: 'Přesunout textové pole',
|
||||
editorMoveImage: 'Přesunout obrázek',
|
||||
editorMoveTable: 'Přesunout tabulku',
|
||||
editorMoveEquation: 'Přesunout rovnici',
|
||||
editorMoveChart: 'Přesunout graf',
|
||||
editorSectionBreak: 'Konec oddílu',
|
||||
editorFormatRevision: 'Revize formátování',
|
||||
editorRevDeleted: 'Odstraněno',
|
||||
editorRevFormatted: 'Formátováno',
|
||||
editorRevFont: 'Písmo',
|
||||
editorRevBold: 'Tučné',
|
||||
editorRevNotBold: 'Ne tučné',
|
||||
editorRevItalic: 'Kurzíva',
|
||||
editorRevNotItalic: 'Ne kurzíva',
|
||||
editorRevHighlight: 'Zvýraznění',
|
||||
editorProtectedContent: 'Chráněný obsah',
|
||||
editorOleExcel: 'List Excelu (vložený)',
|
||||
editorOleWord: 'Dokument Wordu (vložený)',
|
||||
editorOlePpt: 'Prezentace PowerPointu (vložená)',
|
||||
editorOlePdf: 'Dokument PDF (vložený)',
|
||||
editorOleGeneric: 'Vložený objekt',
|
||||
editorPageBreak: 'Konec stránky',
|
||||
editorJumpHintMac: '⌘+kliknutí přejde na nadpis',
|
||||
editorJumpHintWin: 'Ctrl+kliknutí přejde na nadpis',
|
||||
editorChartSeries: 'Řada {num}',
|
||||
editorInsertedBy: 'Vloženo: {author}',
|
||||
editorDeletedBy: 'Odstraněno: {author}',
|
||||
editorCrossReference: 'Křížový odkaz: {name}',
|
||||
editorFormatChangeBy: 'Formátováno: {author}',
|
||||
editorUnknownAuthor: 'Neznámý autor',
|
||||
editorFieldHint: 'Pole: {instr} (F9 aktualizuje)',
|
||||
editorContentControl: 'Ovládací prvek obsahu',
|
||||
editorDefaultAuthor: 'Uživatel',
|
||||
editorCoverTitle: 'Název dokumentu',
|
||||
editorCoverSubtitle: 'Podtitul dokumentu',
|
||||
editorCoverAuthor: 'Autor',
|
||||
editorCoverClassic: 'Klasická',
|
||||
editorCoverBanded: 'Pruhovaná',
|
||||
editorCoverBoxed: 'Rámovaná',
|
||||
editorCoverSideline: 'Boční linka',
|
||||
editorCoverModern: 'Moderní',
|
||||
editorCoverElegant: 'Elegantní',
|
||||
editorCoverMinimal: 'Minimalistická',
|
||||
editorCoverDark: 'Tmavý blok',
|
||||
editorCoverAccent: 'Akcent',
|
||||
editorCoverBadge: 'Odznak',
|
||||
editorCoverFacet: 'Faseta',
|
||||
editorCoverAnnual: 'Výroční zpráva',
|
||||
},
|
||||
nl: {
|
||||
editorFootnote: 'Voetnoot',
|
||||
editorEndnote: 'Eindnoot',
|
||||
|
||||
@@ -13,6 +13,7 @@ import { ar } from './ribbon/ar'
|
||||
import { pt } from './ribbon/pt'
|
||||
import { it } from './ribbon/it'
|
||||
import { pl } from './ribbon/pl'
|
||||
import { cs } from './ribbon/cs'
|
||||
import { nl } from './ribbon/nl'
|
||||
import { ms } from './ribbon/ms'
|
||||
import { he } from './ribbon/he'
|
||||
@@ -35,6 +36,7 @@ export const ribbonStrings = defineStrings({
|
||||
pt,
|
||||
it,
|
||||
pl,
|
||||
cs,
|
||||
nl,
|
||||
ms,
|
||||
he,
|
||||
|
||||
@@ -46,6 +46,7 @@ export const tableStrings = defineStrings({
|
||||
pt: en,
|
||||
it: en,
|
||||
pl: en,
|
||||
cs: en,
|
||||
nl: en,
|
||||
ms: en,
|
||||
he: en,
|
||||
|
||||
@@ -103,6 +103,13 @@ export const strings = {
|
||||
...editorStrings.pl,
|
||||
...aiStrings.pl,
|
||||
},
|
||||
cs: {
|
||||
...appStrings.cs,
|
||||
...ribbonStrings.cs,
|
||||
...tableStrings.cs,
|
||||
...editorStrings.cs,
|
||||
...aiStrings.cs,
|
||||
},
|
||||
nl: {
|
||||
...appStrings.nl,
|
||||
...ribbonStrings.nl,
|
||||
|
||||
@@ -9,9 +9,11 @@ import '@genoffice/ui/color-picker.css'
|
||||
import '@genoffice/ui/dropdown.css'
|
||||
import '@genoffice/ui/ribbon-collapse.css'
|
||||
import '@genoffice/ui/markdown.css'
|
||||
import '@genoffice/ui/ai-panel-prefs.css'
|
||||
import '@genoffice/ui/ai-scope-quote.css'
|
||||
import './styles.css'
|
||||
import './fonts/fonts.css'
|
||||
import { installScreenTips } from '@genoffice/ui'
|
||||
import { applyAiPanelPrefs, installScreenTips } from '@genoffice/ui'
|
||||
|
||||
installScreenTips()
|
||||
|
||||
@@ -37,6 +39,11 @@ async function bootstrap(): Promise<void> {
|
||||
document.documentElement.lang = htmlLang(lang)
|
||||
applyTheme(theme)
|
||||
window.desktop?.onThemeChanged(applyTheme)
|
||||
void window.desktop
|
||||
?.getAiPanelPrefs?.()
|
||||
.then(applyAiPanelPrefs)
|
||||
.catch(() => {})
|
||||
window.desktop?.onAiPanelPrefsChanged?.(applyAiPanelPrefs)
|
||||
createRoot(document.getElementById('root')!).render(
|
||||
<LocaleProvider initial={lang}>
|
||||
<App />
|
||||
|
||||
@@ -786,6 +786,9 @@ export function computeSectionedSlicesF2(
|
||||
else if (anchorBlock.tableRows?.length) {
|
||||
const head = anchorBlock.tableRows[0]
|
||||
anchorNeedH = head.height + (head.notesPx ?? 0)
|
||||
// the head row's notes open the page's footnote area: the table will
|
||||
// charge that separator strip, so the chain must demand it too
|
||||
if (head.notesPx && !pageNoteSepPx) anchorNeedH += FOOTNOTE_SEPARATOR_H
|
||||
} else if (anchorBlock.oversizeLineH !== undefined) {
|
||||
// an oversized anchor clips to whatever remains below the chain, so it
|
||||
// demands the rest of a fresh column: the chain pushes and the pair
|
||||
@@ -810,6 +813,10 @@ export function computeSectionedSlicesF2(
|
||||
// empty page (no solution; avoids infinite loops).
|
||||
if (!fits(chainPlusAnchorH) && !colEmpty() && chainPlusAnchorH <= freshColH()) {
|
||||
advance(block.top, curSection)
|
||||
} else if (!fits(chainH) && !colEmpty()) {
|
||||
// no page can hold chain + anchor demand: the constraint is dropped,
|
||||
// but the chain blocks still place whole (a heading must not be cut)
|
||||
advance(block.top, curSection)
|
||||
}
|
||||
// place chain head through chain tail (the keepNext blocks)
|
||||
for (let k = bi; k <= effectiveChainEnd; k++) place(blocks[k].height)
|
||||
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
addReplyToCommentRange,
|
||||
nextCommentId,
|
||||
removeCommentFromDoc,
|
||||
wordRangeAtCaret,
|
||||
} from './editor/comments'
|
||||
import { blockTexts, compareParagraphs, type CompareEntry } from './editor/compare'
|
||||
import { pendingCommentPluginKey } from './editor/extensions'
|
||||
@@ -122,11 +123,18 @@ export function cancelNewComment(ctx: ReviewContext): void {
|
||||
|
||||
/** New comment: open the pane with the composer; the mark is applied on submit */
|
||||
export function startNewComment(ctx: ReviewContext): void {
|
||||
if (!ctx.editor || ctx.editor.state.selection.empty) {
|
||||
ctx.setStatus(t('appSelectTextToComment'))
|
||||
return
|
||||
const editor = ctx.editor
|
||||
if (!editor) return
|
||||
if (editor.state.selection.empty) {
|
||||
// Word anchors on the word under a collapsed caret rather than refusing
|
||||
const word = wordRangeAtCaret(editor)
|
||||
if (!word) {
|
||||
ctx.setStatus(t('appSelectTextToComment'))
|
||||
return
|
||||
}
|
||||
editor.commands.setTextSelection(word)
|
||||
}
|
||||
const { from, to } = ctx.editor.state.selection
|
||||
const { from, to } = editor.state.selection
|
||||
setPendingCommentRange(ctx, { from, to })
|
||||
ctx.setShowComments(true)
|
||||
ctx.setCommentComposing(true)
|
||||
@@ -170,6 +178,14 @@ export function replyToComment(
|
||||
return true
|
||||
}
|
||||
|
||||
/** Word: comment text edits in place; the author, date and anchor stay */
|
||||
export function editComment(ctx: ReviewContext, id: string, text: string): void {
|
||||
ctx.setComments((prev) => prev.map((c) => (c.id === id ? { ...c, text } : c)))
|
||||
ctx.setCommentsDirty(true)
|
||||
ctx.dirtyRef.current = true
|
||||
ctx.setStatus(t('appCommentEdited'))
|
||||
}
|
||||
|
||||
/** Resolve/reopen: the whole thread (parent + replies) gets done set together */
|
||||
export function resolveComment(ctx: ReviewContext, id: string, done: boolean): void {
|
||||
ctx.setComments((prev) =>
|
||||
|
||||
@@ -2235,12 +2235,14 @@ th.cell-rev-del {
|
||||
width: var(--col-w, auto);
|
||||
}
|
||||
|
||||
/* floating-anchor wrappers force width:100%, which beats the section-width
|
||||
decoration above: their stray in-flow line then wraps at the full canvas
|
||||
width on the canvas but at the section width in preview clones, drifting
|
||||
every boundary below (prod100r4/049 split a line across two pages) */
|
||||
/* floating-anchor wrappers and side-wrap carriers force width:100%, which
|
||||
beats the section-width decoration above: their stray in-flow lines then
|
||||
wrap at the full canvas width on the canvas but at the section width in
|
||||
preview clones, drifting every boundary below (one corpus file split a line
|
||||
across two pages, another sliced a heading) */
|
||||
.doc-page .doc-col-block.doc-protected-floating,
|
||||
.doc-page .doc-col-block.doc-img-float {
|
||||
.doc-page .doc-col-block.doc-img-float,
|
||||
.doc-page .doc-col-block.doc-protected-wrapside {
|
||||
width: var(--col-w, 100%);
|
||||
max-width: var(--col-w, 100%);
|
||||
}
|
||||
@@ -2893,7 +2895,8 @@ th.cell-rev-del {
|
||||
color: var(--docs-on-accent);
|
||||
}
|
||||
|
||||
.comment-card-del {
|
||||
.comment-card-del,
|
||||
.comment-card-edit {
|
||||
margin-left: auto;
|
||||
border: none;
|
||||
background: none;
|
||||
@@ -2907,11 +2910,21 @@ th.cell-rev-del {
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
/* the pencil sits directly before the trash; only the first icon pushes to the right edge */
|
||||
.comment-card-edit + .comment-card-del {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.comment-card-del:hover {
|
||||
background: var(--hover);
|
||||
color: var(--danger);
|
||||
}
|
||||
|
||||
.comment-card-edit:hover {
|
||||
background: var(--hover);
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
/* comments: in-text highlight + right-side pane */
|
||||
.doc-comment {
|
||||
background: var(--docs-paper-comment-bg);
|
||||
@@ -8885,7 +8898,7 @@ body.docs-crop-active
|
||||
/* header/footer measuring probe (hf-dom.ts): a body-level .doc-page box.
|
||||
Chromium print fragmentation counts it as content after the last visible
|
||||
sheet, materializing that sheet's forced break-after into a trailing blank
|
||||
page in every grouped mixed-paper export (prod100r4/68 p6). */
|
||||
page in every grouped mixed-paper export. */
|
||||
#hf-strip-probe {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@ import type {
|
||||
GenSparkAccountStatus,
|
||||
} from '@genoffice/ai-provider'
|
||||
import type { FaceVerticalMetrics } from '@genoffice/font-metrics'
|
||||
import type { AiPanelPrefs } from '@genoffice/ui'
|
||||
|
||||
export type { FaceVerticalMetrics }
|
||||
|
||||
@@ -151,20 +152,27 @@ export type MenuCommand =
|
||||
| 'find'
|
||||
| 'print'
|
||||
| 'export-pdf'
|
||||
| 'export-html'
|
||||
| 'word-count'
|
||||
| 'ai-proofread'
|
||||
| 'shortcuts'
|
||||
|
||||
export type UiTheme = 'light' | 'dark' | 'system'
|
||||
|
||||
/** shell-wide AutoSave default; updatedAt is 0 until the user has ever set it */
|
||||
export interface AutoSaveDefault {
|
||||
on: boolean
|
||||
updatedAt: number
|
||||
}
|
||||
|
||||
/** target file type of the AI create_document tool */
|
||||
export type CreateDocumentType = 'docx' | 'pdf' | 'md'
|
||||
export type CreateDocumentType = 'docx' | 'pdf' | 'md' | 'html'
|
||||
|
||||
export interface CreateDocumentRequest {
|
||||
type: CreateDocumentType
|
||||
/** file name stem (sanitized main-side) */
|
||||
title: string
|
||||
/** docx/pdf: restricted HTML; md: Markdown source */
|
||||
/** docx/pdf: restricted HTML; md: Markdown source; html: a complete HTML document */
|
||||
content: string
|
||||
}
|
||||
|
||||
@@ -194,6 +202,12 @@ export interface DesktopApi {
|
||||
getTheme(): Promise<UiTheme>
|
||||
/** theme switched from the shell home page */
|
||||
onThemeChanged(handler: (theme: UiTheme) => void): () => void
|
||||
/** shell-wide AutoSave default (see useAutoSavePref) */
|
||||
getAutoSaveDefault(): Promise<AutoSaveDefault>
|
||||
onAutoSaveDefaultChanged(handler: (value: AutoSaveDefault) => void): () => void
|
||||
/** AI panel text size + chat-input spellcheck (Settings → General in the shell) */
|
||||
getAiPanelPrefs(): Promise<AiPanelPrefs>
|
||||
onAiPanelPrefsChanged(handler: (prefs: AiPanelPrefs) => void): () => void
|
||||
/** press on the shell chrome (tab strip is a sibling WebContentsView whose
|
||||
* clicks produce no DOM event here) — dismiss open popovers */
|
||||
onChromePressed(handler: () => void): () => void
|
||||
@@ -238,6 +252,11 @@ export interface DesktopApi {
|
||||
writeRecoveryCopy(path: string, data: ArrayBuffer): Promise<{ ok: boolean }>
|
||||
/** tab closed but webContents kept alive (shell freeze workaround) — stop background timers */
|
||||
onTeardown(handler: () => void): () => void
|
||||
/** one trusted space keystroke into this webContents — the only thing that
|
||||
* makes Blink respell existing text after the spellcheck attribute turns
|
||||
* back on (r168); the caller pauses the PM DOM observer and removes the
|
||||
* space again by script */
|
||||
respellKick(): Promise<void>
|
||||
/** sourcePath: the document's current path — Save As uses its desired next-save
|
||||
* password and commits that state to the chosen path only after success */
|
||||
saveDocxAs(
|
||||
@@ -268,6 +287,11 @@ export interface DesktopApi {
|
||||
outPath?: string,
|
||||
scale?: number,
|
||||
): Promise<{ ok: boolean; path?: string; error?: string }>
|
||||
exportHtml(
|
||||
defaultName: string,
|
||||
html: string,
|
||||
outPath?: string,
|
||||
): Promise<{ ok: boolean; path?: string; error?: string }>
|
||||
/** Mixed paper-size export: produce a set of PDF bytes (base64) at given sizes per the current print layout */
|
||||
printPdfBuffer(
|
||||
pageWidthTwips: number,
|
||||
|
||||
@@ -132,7 +132,7 @@ describe('word-count stats (answer-style requests)', () => {
|
||||
})
|
||||
|
||||
describe('changing heading colors (formatting-command requests)', () => {
|
||||
it('after the model calls apply_commands, all headings turn red with the aiChanged highlight', async () => {
|
||||
it('after the model calls apply_ops, all headings turn red with the aiChanged highlight', async () => {
|
||||
const editor = createEditor(fixture())
|
||||
let final = ''
|
||||
const loop = makeLoop(
|
||||
@@ -141,17 +141,9 @@ describe('changing heading colors (formatting-command requests)', () => {
|
||||
(cb) => {
|
||||
cb.onToolCall({
|
||||
id: 't1',
|
||||
name: 'apply_commands',
|
||||
name: 'apply_ops',
|
||||
input: {
|
||||
commands: [
|
||||
{
|
||||
updateTextStyle: {
|
||||
target: { nodeType: 'docHeading' },
|
||||
style: { color: 'FF0000' },
|
||||
fields: ['color'],
|
||||
},
|
||||
},
|
||||
],
|
||||
ops: [{ op: 'setFont', target: { nodeType: 'docHeading' }, color: 'FF0000' }],
|
||||
},
|
||||
})
|
||||
cb.onDone()
|
||||
@@ -195,8 +187,8 @@ describe('changing heading colors (formatting-command requests)', () => {
|
||||
(cb) => {
|
||||
cb.onToolCall({
|
||||
id: 't1',
|
||||
name: 'apply_commands',
|
||||
input: { commands: [{ updateTextStyle: { style: {}, fields: [] } }] },
|
||||
name: 'apply_ops',
|
||||
input: { ops: [{ op: 'setFont' }] },
|
||||
})
|
||||
cb.onDone()
|
||||
},
|
||||
@@ -359,8 +351,8 @@ describe('external-edit guard (document freshness baseline)', () => {
|
||||
editor,
|
||||
{
|
||||
id: 'w',
|
||||
name: 'apply_commands',
|
||||
input: { commands: [{ deleteBlocks: { target: { blockIndexes: [3] } } }] },
|
||||
name: 'apply_ops',
|
||||
input: { ops: [{ op: 'deleteBlocks', target: { blockIndexes: [3] } }] },
|
||||
},
|
||||
NUM_IDS,
|
||||
)
|
||||
@@ -578,15 +570,13 @@ describe('selection scope freezing', () => {
|
||||
editor.commands.setTextSelection(block3Pos + 2)
|
||||
const exec = await skill.executeTool({
|
||||
id: 't',
|
||||
name: 'apply_commands',
|
||||
name: 'apply_ops',
|
||||
input: {
|
||||
commands: [
|
||||
ops: [
|
||||
{
|
||||
updateParagraphStyle: {
|
||||
target: { nodeType: 'docParagraph', scope: 'selection' },
|
||||
style: { align: 'right' },
|
||||
fields: ['align'],
|
||||
},
|
||||
op: 'setParagraphFormat',
|
||||
target: { nodeType: 'docParagraph', scope: 'selection' },
|
||||
align: 'right',
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -616,15 +606,13 @@ describe('selection scope freezing', () => {
|
||||
expect(insert.isError).toBeFalsy()
|
||||
const exec = await skill.executeTool({
|
||||
id: 't',
|
||||
name: 'apply_commands',
|
||||
name: 'apply_ops',
|
||||
input: {
|
||||
commands: [
|
||||
ops: [
|
||||
{
|
||||
updateParagraphStyle: {
|
||||
target: { nodeType: 'docParagraph', scope: 'selection' },
|
||||
style: { align: 'right' },
|
||||
fields: ['align'],
|
||||
},
|
||||
op: 'setParagraphFormat',
|
||||
target: { nodeType: 'docParagraph', scope: 'selection' },
|
||||
align: 'right',
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -635,3 +623,268 @@ describe('selection scope freezing', () => {
|
||||
expect(editor.state.doc.child(2).attrs.align).toBe('right')
|
||||
})
|
||||
})
|
||||
|
||||
describe('partial selection: context markers and replace_selection', () => {
|
||||
// block 1 'GenSpark is an AI office suite.' starts at pos 20, content at 21; 'AI office' = offsets 15..24
|
||||
const SEL = { from: 36, to: 45 }
|
||||
|
||||
it('the context marks the selected span with <sel> and repeats it as "Selected text"', () => {
|
||||
const editor = createEditor(fixture())
|
||||
editor.commands.setTextSelection(SEL)
|
||||
const context = buildDocContext(editor)
|
||||
expect(context).toContain('<p>GenSpark is an <sel>AI office</sel> suite.</p>')
|
||||
expect(context).toContain('Selected text (9 characters): "AI office"')
|
||||
expect(context).toContain('Current selection: block 1 (part of the text only')
|
||||
})
|
||||
|
||||
it('a selection covering whole blocks carries no markers', () => {
|
||||
const editor = createEditor(fixture())
|
||||
editor.commands.setTextSelection({
|
||||
from: 21,
|
||||
to: 21 + 'GenSpark is an AI office suite.'.length,
|
||||
})
|
||||
const context = buildDocContext(editor)
|
||||
expect(context).toContain('<p>GenSpark is an AI office suite.</p>')
|
||||
expect(context).not.toContain('<sel>')
|
||||
expect(context).not.toContain('Selected text (')
|
||||
})
|
||||
|
||||
it('markers split a styled run and span across blocks per block', () => {
|
||||
const editor = createEditor([
|
||||
{
|
||||
type: 'docParagraph',
|
||||
attrs: { docxIndex: null },
|
||||
content: [
|
||||
text('Revenue grew '),
|
||||
{ type: 'text', text: '8% year', marks: [{ type: 'bold' }] },
|
||||
],
|
||||
},
|
||||
para('Costs fell.'),
|
||||
])
|
||||
// select from 'grew' (offset 8 of block 0) through 'Costs' (offsets 0..5 of block 1)
|
||||
const block0Size = editor.state.doc.child(0).nodeSize
|
||||
editor.commands.setTextSelection({ from: 1 + 8, to: block0Size + 1 + 5 })
|
||||
const context = buildDocContext(editor)
|
||||
expect(context).toContain('<p>Revenue <sel>grew <strong>8% year</strong></sel></p>')
|
||||
expect(context).toContain('<p><sel>Costs</sel> fell.</p>')
|
||||
expect(context).toContain('Selected text (18 characters): "grew 8% year\nCosts"')
|
||||
})
|
||||
|
||||
it('replace_selection replaces exactly the frozen span, even after the live selection moved', async () => {
|
||||
const editor = createEditor(fixture())
|
||||
const skill = createDocsSkill(
|
||||
() => editor,
|
||||
() => NUM_IDS,
|
||||
)
|
||||
editor.commands.setTextSelection(SEL)
|
||||
skill.buildContext!()
|
||||
editor.commands.setTextSelection(editor.state.doc.content.size - 3)
|
||||
const exec = await skill.executeTool({
|
||||
id: 'r',
|
||||
name: 'replace_selection',
|
||||
input: { html: 'AI-native productivity' },
|
||||
})
|
||||
expect(exec.isError).toBeFalsy()
|
||||
expect(exec.mutated).toBe(true)
|
||||
expect(editor.state.doc.child(1).textContent).toBe(
|
||||
'GenSpark is an AI-native productivity suite.',
|
||||
)
|
||||
expect(editor.state.doc.child(1).attrs.aiChanged).toBe(true)
|
||||
expect(editor.state.doc.child(3).textContent).toBe('This document is for reference only.')
|
||||
// the new text is selected so a follow-up scope:'selection' command targets it
|
||||
expect(editor.state.selection.from).toBe(SEL.from)
|
||||
expect(editor.state.selection.to).toBe(SEL.from + 'AI-native productivity'.length)
|
||||
})
|
||||
|
||||
it('replace_selection inherits the formatting of the replaced text unless the fragment styles it', async () => {
|
||||
const styled = () => [
|
||||
{
|
||||
type: 'docParagraph',
|
||||
attrs: { docxIndex: null },
|
||||
content: [
|
||||
text('Revenue grew '),
|
||||
{
|
||||
type: 'text',
|
||||
text: '8%',
|
||||
marks: [{ type: 'bold' }, { type: 'docTextStyle', attrs: { color: 'FF0000' } }],
|
||||
},
|
||||
text(' year over year.'),
|
||||
],
|
||||
},
|
||||
]
|
||||
const plain = createEditor(styled())
|
||||
plain.commands.setTextSelection({ from: 14, to: 16 })
|
||||
await executeTool(plain, { id: 'a', name: 'replace_selection', input: { html: '9%' } }, NUM_IDS)
|
||||
const p1 = plain.state.doc.child(0)
|
||||
expect(p1.textContent).toBe('Revenue grew 9% year over year.')
|
||||
expect(p1.child(1).text).toBe('9%')
|
||||
expect(
|
||||
p1
|
||||
.child(1)
|
||||
.marks.map((m) => m.type.name)
|
||||
.sort(),
|
||||
).toEqual(['bold', 'docTextStyle'])
|
||||
expect(p1.child(1).marks.find((m) => m.type.name === 'docTextStyle')?.attrs).toMatchObject({
|
||||
color: 'FF0000',
|
||||
})
|
||||
|
||||
const fragment = createEditor(styled())
|
||||
fragment.commands.setTextSelection({ from: 14, to: 16 })
|
||||
await executeTool(
|
||||
fragment,
|
||||
{ id: 'b', name: 'replace_selection', input: { html: '<em>9%</em>' } },
|
||||
NUM_IDS,
|
||||
)
|
||||
const p2 = fragment.state.doc.child(0)
|
||||
// the fragment's own formatting replaces the inherited bold; run-level style (color) is kept
|
||||
expect(
|
||||
p2
|
||||
.child(1)
|
||||
.marks.map((m) => m.type.name)
|
||||
.sort(),
|
||||
).toEqual(['docTextStyle', 'italic'])
|
||||
})
|
||||
|
||||
it('replace_selection in tracking mode keeps the old text struck through and inserts the new text as ins', async () => {
|
||||
const editor = createEditor(fixture())
|
||||
editor.commands.setTextSelection(SEL)
|
||||
const exec = await executeTool(
|
||||
editor,
|
||||
{ id: 't', name: 'replace_selection', input: { html: 'AI-native' } },
|
||||
NUM_IDS,
|
||||
{ author: 'AI Assistant' },
|
||||
)
|
||||
expect(exec.isError).toBeFalsy()
|
||||
const runs: Array<[string, string[]]> = []
|
||||
editor.state.doc.child(1).forEach((child) => {
|
||||
runs.push([child.text ?? '', child.marks.map((m) => m.type.name).sort()])
|
||||
})
|
||||
expect(runs).toEqual([
|
||||
['GenSpark is an ', []],
|
||||
['AI office', ['del']],
|
||||
['AI-native', ['ins']],
|
||||
[' suite.', []],
|
||||
])
|
||||
expect(editor.state.doc.child(1).attrs.aiChanged).toBe(false)
|
||||
})
|
||||
|
||||
it('replace_selection refuses a caret, a multi-block range, block HTML and the <sel> marker', async () => {
|
||||
const editor = createEditor(fixture())
|
||||
editor.commands.setTextSelection(30)
|
||||
const caret = await executeTool(
|
||||
editor,
|
||||
{ id: '1', name: 'replace_selection', input: { html: 'x' } },
|
||||
NUM_IDS,
|
||||
)
|
||||
expect(caret.isError).toBe(true)
|
||||
expect(caret.output).toContain('needs a range selection')
|
||||
|
||||
editor.commands.setTextSelection({ from: 36, to: editor.state.doc.content.size - 3 })
|
||||
const multi = await executeTool(
|
||||
editor,
|
||||
{ id: '2', name: 'replace_selection', input: { html: 'x' } },
|
||||
NUM_IDS,
|
||||
)
|
||||
expect(multi.isError).toBe(true)
|
||||
expect(multi.output).toContain('replace_blocks')
|
||||
|
||||
editor.commands.setTextSelection(SEL)
|
||||
const block = await executeTool(
|
||||
editor,
|
||||
{ id: '3', name: 'replace_selection', input: { html: '<p>a</p><p>b</p>' } },
|
||||
NUM_IDS,
|
||||
)
|
||||
expect(block.isError).toBe(true)
|
||||
expect(block.output).toContain('replace_blocks')
|
||||
|
||||
const marker = await executeTool(
|
||||
editor,
|
||||
{ id: '4', name: 'replace_selection', input: { html: '<sel>AI</sel>' } },
|
||||
NUM_IDS,
|
||||
)
|
||||
expect(marker.isError).toBe(true)
|
||||
expect(marker.output).toContain('<sel>')
|
||||
|
||||
const echoed = await executeTool(
|
||||
editor,
|
||||
{ id: '5', name: 'insert_content', input: { html: '<p>see <sel>this</sel></p>' } },
|
||||
NUM_IDS,
|
||||
)
|
||||
expect(echoed.isError).toBe(true)
|
||||
expect(editor.state.doc.child(1).textContent).toBe('GenSpark is an AI office suite.')
|
||||
})
|
||||
|
||||
it('a single <p> wrapper and plain text are both accepted as inline replacements', async () => {
|
||||
const editor = createEditor(fixture())
|
||||
editor.commands.setTextSelection(SEL)
|
||||
const exec = await executeTool(
|
||||
editor,
|
||||
{
|
||||
id: 'p',
|
||||
name: 'replace_selection',
|
||||
input: { html: '<p>an <strong>AI</strong> office</p>' },
|
||||
},
|
||||
NUM_IDS,
|
||||
)
|
||||
expect(exec.isError).toBeFalsy()
|
||||
const block = editor.state.doc.child(1)
|
||||
expect(block.textContent).toBe('GenSpark is an an AI office suite.')
|
||||
// the unstyled lead-in merges with the preceding run; the bold slice stays its own node
|
||||
expect(block.child(1).text).toBe('AI')
|
||||
expect(block.child(1).marks.some((m) => m.type.name === 'bold')).toBe(true)
|
||||
})
|
||||
})
|
||||
|
||||
describe('partial selection: table cells and code blocks', () => {
|
||||
it('a range inside a table cell keeps whole-block semantics (no markers, no partial note)', async () => {
|
||||
const editor = createEditor([
|
||||
heading('Chapter 1 Overview', 1),
|
||||
{
|
||||
type: 'docTable',
|
||||
attrs: { docxIndex: null },
|
||||
content: [
|
||||
{
|
||||
type: 'docTableRow',
|
||||
content: [
|
||||
{
|
||||
type: 'docTableCell',
|
||||
content: [
|
||||
{ type: 'docParagraph', attrs: { docxIndex: null }, content: [text('City GDP')] },
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
])
|
||||
// cell paragraph content starts at 20 (table) + 1 (row) + 1 (cell) + 1 (paragraph) + 1
|
||||
editor.commands.setTextSelection({ from: 25, to: 28 })
|
||||
expect(editor.state.doc.textBetween(25, 28)).toBe('ity')
|
||||
const context = buildDocContext(editor)
|
||||
expect(context).toContain('Current selection: block 1\n')
|
||||
expect(context).not.toContain('<sel>')
|
||||
expect(context).not.toContain('Selected text (')
|
||||
const exec = await executeTool(
|
||||
editor,
|
||||
{ id: 'c', name: 'replace_selection', input: { html: 'x' } },
|
||||
NUM_IDS,
|
||||
)
|
||||
expect(exec.isError).toBe(true)
|
||||
expect(exec.output).toContain('replace_blocks')
|
||||
})
|
||||
|
||||
it('a code block marks the selected span inside its <pre>', () => {
|
||||
const editor = createEditor([
|
||||
{
|
||||
type: 'docParagraph',
|
||||
attrs: { docxIndex: null, shadingFill: 'F2F2F2', borders: 'tblr' },
|
||||
content: [text('const a = 1;'), { type: 'hardBreak' }, text('const b = <2>;')],
|
||||
},
|
||||
])
|
||||
// 'b = <2>' = offsets 19..26 (the hard break occupies one position)
|
||||
editor.commands.setTextSelection({ from: 1 + 19, to: 1 + 26 })
|
||||
const context = buildDocContext(editor)
|
||||
expect(context).toContain('<pre>const a = 1;\nconst <sel>b = <2></sel>;</pre>')
|
||||
expect(context).toContain('Selected text (7 characters): "b = <2>"')
|
||||
})
|
||||
})
|
||||
|
||||
@@ -199,8 +199,8 @@ describe('edit tools vs tracked deletions', () => {
|
||||
editor,
|
||||
{
|
||||
id: 't',
|
||||
name: 'apply_commands',
|
||||
input: { commands: [{ deleteBlocks: { target: { blockIndexes: [1, 3] } } }] },
|
||||
name: 'apply_ops',
|
||||
input: { ops: [{ op: 'deleteBlocks', target: { blockIndexes: [1, 3] } }] },
|
||||
},
|
||||
NUM_IDS,
|
||||
)
|
||||
@@ -215,8 +215,8 @@ describe('edit tools vs tracked deletions', () => {
|
||||
editor,
|
||||
{
|
||||
id: 't',
|
||||
name: 'apply_commands',
|
||||
input: { commands: [{ deleteBlocks: { target: { containsText: 'Old reference' } } }] },
|
||||
name: 'apply_ops',
|
||||
input: { ops: [{ op: 'deleteBlocks', target: { containsText: 'Old reference' } }] },
|
||||
},
|
||||
NUM_IDS,
|
||||
)
|
||||
@@ -230,9 +230,9 @@ describe('edit tools vs tracked deletions', () => {
|
||||
editor,
|
||||
{
|
||||
id: 't',
|
||||
name: 'apply_commands',
|
||||
name: 'apply_ops',
|
||||
input: {
|
||||
commands: [{ replaceAllText: { containsText: 'Old reference 74.', replaceText: '[9]' } }],
|
||||
ops: [{ op: 'findReplace', find: 'Old reference 74.', replace: '[9]' }],
|
||||
},
|
||||
},
|
||||
NUM_IDS,
|
||||
@@ -248,8 +248,8 @@ describe('edit tools vs tracked deletions', () => {
|
||||
editor,
|
||||
{
|
||||
id: 't',
|
||||
name: 'apply_commands',
|
||||
input: { commands: [{ deleteBlocks: { target: { containsText: 'Keep this' } } }] },
|
||||
name: 'apply_ops',
|
||||
input: { ops: [{ op: 'deleteBlocks', target: { containsText: 'Keep this' } }] },
|
||||
},
|
||||
NUM_IDS,
|
||||
)
|
||||
|
||||
@@ -227,8 +227,8 @@ describe('insertToc command', () => {
|
||||
editor,
|
||||
{
|
||||
id: 't2',
|
||||
name: 'apply_commands',
|
||||
input: { commands: [{ insertToc: { afterBlockIndex: -1 } }] },
|
||||
name: 'apply_ops',
|
||||
input: { ops: [{ op: 'insertToc', afterBlockIndex: -1 }] },
|
||||
},
|
||||
NUM_IDS,
|
||||
)
|
||||
@@ -282,8 +282,8 @@ describe('insertToc command', () => {
|
||||
editor,
|
||||
{
|
||||
id: 't2',
|
||||
name: 'apply_commands',
|
||||
input: { commands: [{ insertToc: { afterBlockIndex: -1 } }] },
|
||||
name: 'apply_ops',
|
||||
input: { ops: [{ op: 'insertToc', afterBlockIndex: -1 }] },
|
||||
},
|
||||
NUM_IDS,
|
||||
)
|
||||
|
||||
@@ -215,23 +215,15 @@ describe('AI edits merged into the revision model', () => {
|
||||
editor.destroy()
|
||||
})
|
||||
|
||||
it('apply_commands format changes in tracking mode record rPrChange; reject restores the old format', async () => {
|
||||
it('apply_ops format changes in tracking mode record rPrChange; reject restores the old format', async () => {
|
||||
const { editor } = await createEditor(true)
|
||||
const exec = await executeTool(
|
||||
editor,
|
||||
{
|
||||
id: 't',
|
||||
name: 'apply_commands',
|
||||
name: 'apply_ops',
|
||||
input: {
|
||||
commands: [
|
||||
{
|
||||
updateTextStyle: {
|
||||
target: { blockIndexes: [0] },
|
||||
style: { bold: true, color: 'FF0000' },
|
||||
fields: ['bold', 'color'],
|
||||
},
|
||||
},
|
||||
],
|
||||
ops: [{ op: 'setFont', target: { blockIndexes: [0] }, bold: true, color: 'FF0000' }],
|
||||
},
|
||||
},
|
||||
NUM_IDS,
|
||||
@@ -253,23 +245,15 @@ describe('AI edits merged into the revision model', () => {
|
||||
editor.destroy()
|
||||
})
|
||||
|
||||
it('apply_commands paragraph changes in tracking mode record pPrChange; reject restores alignment', async () => {
|
||||
it('apply_ops paragraph changes in tracking mode record pPrChange; reject restores alignment', async () => {
|
||||
const { editor } = await createEditor(true)
|
||||
await executeTool(
|
||||
editor,
|
||||
{
|
||||
id: 't',
|
||||
name: 'apply_commands',
|
||||
name: 'apply_ops',
|
||||
input: {
|
||||
commands: [
|
||||
{
|
||||
updateParagraphStyle: {
|
||||
target: { blockIndexes: [0] },
|
||||
style: { align: 'center' },
|
||||
fields: ['align'],
|
||||
},
|
||||
},
|
||||
],
|
||||
ops: [{ op: 'setParagraphFormat', target: { blockIndexes: [0] }, align: 'center' }],
|
||||
},
|
||||
},
|
||||
NUM_IDS,
|
||||
|
||||
@@ -51,17 +51,9 @@ async function setFirstLine(editor: Editor, indentFirstLine: number | null) {
|
||||
editor,
|
||||
{
|
||||
id: 't',
|
||||
name: 'apply_commands',
|
||||
name: 'apply_ops',
|
||||
input: {
|
||||
commands: [
|
||||
{
|
||||
updateParagraphStyle: {
|
||||
target: { blockIndexes: [0, 1] },
|
||||
style: { indentFirstLine },
|
||||
fields: ['indentFirstLine'],
|
||||
},
|
||||
},
|
||||
],
|
||||
ops: [{ op: 'setParagraphFormat', target: { blockIndexes: [0, 1] }, indentFirstLine }],
|
||||
},
|
||||
},
|
||||
NUM_IDS,
|
||||
@@ -118,17 +110,9 @@ describe('character-unit indents: saving an indent edit', () => {
|
||||
editor,
|
||||
{
|
||||
id: 't',
|
||||
name: 'apply_commands',
|
||||
name: 'apply_ops',
|
||||
input: {
|
||||
commands: [
|
||||
{
|
||||
updateParagraphStyle: {
|
||||
target: { blockIndexes: [1] },
|
||||
style: { align: 'center' },
|
||||
fields: ['align'],
|
||||
},
|
||||
},
|
||||
],
|
||||
ops: [{ op: 'setParagraphFormat', target: { blockIndexes: [1] }, align: 'center' }],
|
||||
},
|
||||
},
|
||||
NUM_IDS,
|
||||
|
||||
@@ -13,15 +13,14 @@ import { describe, expect, it } from 'vitest'
|
||||
const css = readFileSync(join(__dirname, '../src/renderer/styles.css'), 'utf8')
|
||||
|
||||
describe('doc-col-block width on floating wrappers', () => {
|
||||
it.each(['.doc-col-block.doc-protected-floating', '.doc-col-block.doc-img-float'])(
|
||||
'%s honors the section-width decoration',
|
||||
(sel) => {
|
||||
const m = css.match(
|
||||
new RegExp(`\\.doc-page ${sel.replace(/[.]/g, '\\$&')}[^{]*\\{([^}]*)\\}`),
|
||||
)
|
||||
expect(m, `rule for ${sel}`).toBeTruthy()
|
||||
expect(m![1]).toContain('width: var(--col-w, 100%)')
|
||||
expect(m![1]).toContain('max-width: var(--col-w, 100%)')
|
||||
},
|
||||
)
|
||||
it.each([
|
||||
'.doc-col-block.doc-protected-floating',
|
||||
'.doc-col-block.doc-img-float',
|
||||
'.doc-col-block.doc-protected-wrapside',
|
||||
])('%s honors the section-width decoration', (sel) => {
|
||||
const m = css.match(new RegExp(`\\.doc-page ${sel.replace(/[.]/g, '\\$&')}[^{]*\\{([^}]*)\\}`))
|
||||
expect(m, `rule for ${sel}`).toBeTruthy()
|
||||
expect(m![1]).toContain('width: var(--col-w, 100%)')
|
||||
expect(m![1]).toContain('max-width: var(--col-w, 100%)')
|
||||
})
|
||||
})
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,215 @@
|
||||
import { describe, expect, it, vi } from 'vitest'
|
||||
import { act, createElement } from 'react'
|
||||
import { createRoot, type Root } from 'react-dom/client'
|
||||
import { Editor } from '@tiptap/core'
|
||||
import type { CommentInfo } from '@genoffice/docx-engine'
|
||||
import { editorExtensions } from '../src/renderer/editor/extensions'
|
||||
import { LocaleProvider, setModuleLang } from '../src/renderer/i18n/locale'
|
||||
import { CommentsPanel } from '../src/renderer/components/CommentsPanel'
|
||||
import { editComment, type ReviewContext } from '../src/renderer/review-actions'
|
||||
|
||||
// ---- editComment (review action) ----
|
||||
|
||||
function makeCtx(comments: CommentInfo[]): {
|
||||
ctx: ReviewContext
|
||||
state: { comments: CommentInfo[]; commentsDirty: boolean; dirty: boolean; status: string }
|
||||
} {
|
||||
const state = { comments, commentsDirty: false, dirty: false, status: '' }
|
||||
const ctx = {
|
||||
editor: null,
|
||||
doc: null,
|
||||
dirtyRef: {
|
||||
get current() {
|
||||
return state.dirty
|
||||
},
|
||||
set current(v: boolean) {
|
||||
state.dirty = v
|
||||
},
|
||||
},
|
||||
setStatus: (s: string) => {
|
||||
state.status = s
|
||||
},
|
||||
setComments: (updater: unknown) => {
|
||||
state.comments = (updater as (prev: CommentInfo[]) => CommentInfo[])(state.comments)
|
||||
},
|
||||
setCommentsDirty: (v: boolean) => {
|
||||
state.commentsDirty = v
|
||||
},
|
||||
} as unknown as ReviewContext
|
||||
return { ctx, state }
|
||||
}
|
||||
|
||||
// LocaleProvider subscribes to the shell's language switch on mount
|
||||
Object.assign(window, { desktop: { onLanguageChanged: () => () => undefined } })
|
||||
|
||||
setModuleLang('en')
|
||||
|
||||
describe('editComment', () => {
|
||||
const comments = (): CommentInfo[] => [
|
||||
{ id: '1', author: 'Alice', date: '2026-01-01T00:00:00Z', text: 'first' },
|
||||
{ id: '2', author: 'Bob', date: '2026-01-02T00:00:00Z', text: 'reply', parentId: '1' },
|
||||
]
|
||||
|
||||
it('replaces only the text, keeping author, date and thread structure', () => {
|
||||
const { ctx, state } = makeCtx(comments())
|
||||
editComment(ctx, '1', 'rewritten')
|
||||
expect(state.comments[0]).toEqual({
|
||||
id: '1',
|
||||
author: 'Alice',
|
||||
date: '2026-01-01T00:00:00Z',
|
||||
text: 'rewritten',
|
||||
})
|
||||
expect(state.comments[1]).toEqual(comments()[1])
|
||||
expect(state.commentsDirty).toBe(true)
|
||||
expect(state.dirty).toBe(true)
|
||||
expect(state.status).not.toBe('')
|
||||
})
|
||||
|
||||
it('edits a reply without touching its parent', () => {
|
||||
const { ctx, state } = makeCtx(comments())
|
||||
editComment(ctx, '2', 'better reply')
|
||||
expect(state.comments[0]).toEqual(comments()[0])
|
||||
expect(state.comments[1]).toMatchObject({ id: '2', parentId: '1', text: 'better reply' })
|
||||
})
|
||||
})
|
||||
|
||||
// ---- CommentsPanel edit flow ----
|
||||
|
||||
function makeEditor(): Editor {
|
||||
return new Editor({
|
||||
element: document.createElement('div'),
|
||||
extensions: editorExtensions,
|
||||
content: {
|
||||
type: 'doc',
|
||||
content: [{ type: 'docParagraph', content: [{ type: 'text', text: 'hello' }] }],
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
function mount(element: React.ReactElement): { root: Root; container: HTMLElement } {
|
||||
const container = document.createElement('div')
|
||||
document.body.appendChild(container)
|
||||
const root = createRoot(container)
|
||||
act(() => root.render(createElement(LocaleProvider, { initial: 'en', children: element })))
|
||||
return { root, container }
|
||||
}
|
||||
|
||||
const noop = () => {}
|
||||
|
||||
describe('CommentsPanel editing', () => {
|
||||
it('opens a prefilled composer from the pencil and submits the new text', () => {
|
||||
const editor = makeEditor()
|
||||
const onEdit = vi.fn()
|
||||
const { root, container } = mount(
|
||||
createElement(CommentsPanel, {
|
||||
comments: [{ id: 'c1', author: 'A', text: 'old text', done: false }] as CommentInfo[],
|
||||
docNode: editor.state.doc,
|
||||
composing: false,
|
||||
onSubmitNew: noop,
|
||||
onReply: noop,
|
||||
onEdit,
|
||||
onResolve: noop,
|
||||
onCancelNew: noop,
|
||||
onDelete: noop,
|
||||
onClose: noop,
|
||||
}),
|
||||
)
|
||||
|
||||
const pencil = container.querySelector<HTMLElement>('.comment-card-edit')!
|
||||
act(() => pencil.click())
|
||||
|
||||
const textarea = container.querySelector<HTMLTextAreaElement>(
|
||||
'.comment-reply-compose textarea',
|
||||
)!
|
||||
expect(textarea.value).toBe('old text')
|
||||
|
||||
act(() => {
|
||||
const setter = Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype, 'value')!.set!
|
||||
setter.call(textarea, 'new text')
|
||||
textarea.dispatchEvent(new Event('input', { bubbles: true }))
|
||||
})
|
||||
const save = [...container.querySelectorAll<HTMLButtonElement>('button.primary')].find(
|
||||
(b) => !b.disabled,
|
||||
)!
|
||||
act(() => save.click())
|
||||
|
||||
expect(onEdit).toHaveBeenCalledWith('c1', 'new text')
|
||||
// the composer closes back to the plain card
|
||||
expect(container.querySelector('.comment-reply-compose')).toBeNull()
|
||||
|
||||
act(() => root.unmount())
|
||||
container.remove()
|
||||
editor.destroy()
|
||||
})
|
||||
|
||||
const mountOne = (handlers: {
|
||||
onEdit?: (id: string, text: string) => void
|
||||
onResolve?: (id: string, done: boolean) => void
|
||||
}) => {
|
||||
const editor = makeEditor()
|
||||
const mounted = mount(
|
||||
createElement(CommentsPanel, {
|
||||
comments: [{ id: 'c1', author: 'A', text: 'old text', done: false }] as CommentInfo[],
|
||||
docNode: editor.state.doc,
|
||||
composing: false,
|
||||
onSubmitNew: noop,
|
||||
onReply: noop,
|
||||
onEdit: handlers.onEdit ?? noop,
|
||||
onResolve: handlers.onResolve ?? noop,
|
||||
onCancelNew: noop,
|
||||
onDelete: noop,
|
||||
onClose: noop,
|
||||
}),
|
||||
)
|
||||
return { editor, ...mounted }
|
||||
}
|
||||
|
||||
const typeInto = (textarea: HTMLTextAreaElement, value: string) => {
|
||||
const setter = Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype, 'value')!.set!
|
||||
setter.call(textarea, value)
|
||||
textarea.dispatchEvent(new Event('input', { bubbles: true }))
|
||||
}
|
||||
|
||||
it('second pencil click cancels the edit instead of resetting the draft', () => {
|
||||
const onEdit = vi.fn()
|
||||
const { editor, root, container } = mountOne({ onEdit })
|
||||
const pencil = () => container.querySelector<HTMLElement>('.comment-card-edit')!
|
||||
act(() => pencil().click())
|
||||
const textarea = container.querySelector<HTMLTextAreaElement>(
|
||||
'.comment-reply-compose textarea',
|
||||
)!
|
||||
act(() => typeInto(textarea, 'half-typed'))
|
||||
|
||||
act(() => pencil().click())
|
||||
// the composer is gone, nothing was submitted
|
||||
expect(container.querySelector('.comment-reply-compose')).toBeNull()
|
||||
expect(onEdit).not.toHaveBeenCalled()
|
||||
|
||||
act(() => root.unmount())
|
||||
container.remove()
|
||||
editor.destroy()
|
||||
})
|
||||
|
||||
it('resolving a thread mid-edit commits the draft instead of dropping it', () => {
|
||||
const onEdit = vi.fn()
|
||||
const onResolve = vi.fn()
|
||||
const { editor, root, container } = mountOne({ onEdit, onResolve })
|
||||
act(() => container.querySelector<HTMLElement>('.comment-card-edit')!.click())
|
||||
const textarea = container.querySelector<HTMLTextAreaElement>(
|
||||
'.comment-reply-compose textarea',
|
||||
)!
|
||||
act(() => typeInto(textarea, 'typed but not saved'))
|
||||
|
||||
const resolveBtn = [...container.querySelectorAll<HTMLButtonElement>('button')].find(
|
||||
(b) => b.textContent === 'Resolve',
|
||||
)!
|
||||
act(() => resolveBtn.click())
|
||||
|
||||
expect(onEdit).toHaveBeenCalledWith('c1', 'typed but not saved')
|
||||
expect(onResolve).toHaveBeenCalledWith('c1', true)
|
||||
|
||||
act(() => root.unmount())
|
||||
container.remove()
|
||||
editor.destroy()
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,100 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { Editor } from '@tiptap/core'
|
||||
import { TextSelection } from '@tiptap/pm/state'
|
||||
import { editorExtensions } from '../src/renderer/editor/extensions'
|
||||
import { wordRangeAtCaret } from '../src/renderer/editor/comments'
|
||||
|
||||
interface JsonNode {
|
||||
type: string
|
||||
attrs?: Record<string, unknown>
|
||||
content?: JsonNode[]
|
||||
text?: string
|
||||
}
|
||||
|
||||
const text = (t: string): JsonNode => ({ type: 'text', text: t })
|
||||
const para = (...content: JsonNode[]): JsonNode => ({
|
||||
type: 'docParagraph',
|
||||
attrs: { docxIndex: null },
|
||||
content,
|
||||
})
|
||||
|
||||
function createEditor(content: JsonNode[]): Editor {
|
||||
return new Editor({
|
||||
element: document.createElement('div'),
|
||||
extensions: editorExtensions,
|
||||
content: { type: 'doc', content },
|
||||
})
|
||||
}
|
||||
|
||||
/** put a collapsed caret at doc position `pos` */
|
||||
function setCaret(editor: Editor, pos: number): void {
|
||||
const tr = editor.state.tr.setSelection(TextSelection.create(editor.state.doc, pos))
|
||||
editor.view.dispatch(tr)
|
||||
}
|
||||
|
||||
const textAt = (editor: Editor, range: { from: number; to: number }): string =>
|
||||
editor.state.doc.textBetween(range.from, range.to)
|
||||
|
||||
describe('wordRangeAtCaret', () => {
|
||||
// "alpha beta gamma": paragraph content starts at doc position 1
|
||||
const editor = () => createEditor([para(text('alpha beta gamma'))])
|
||||
|
||||
it('picks the word around a caret inside it', () => {
|
||||
const ed = editor()
|
||||
setCaret(ed, 9) // between "be|ta"
|
||||
const range = wordRangeAtCaret(ed)
|
||||
expect(range && textAt(ed, range)).toBe('beta')
|
||||
ed.destroy()
|
||||
})
|
||||
|
||||
it('picks the word the caret sits at the start of', () => {
|
||||
const ed = editor()
|
||||
setCaret(ed, 7) // "|beta"
|
||||
const range = wordRangeAtCaret(ed)
|
||||
expect(range && textAt(ed, range)).toBe('beta')
|
||||
ed.destroy()
|
||||
})
|
||||
|
||||
it('picks the word just before a caret at its end', () => {
|
||||
const ed = editor()
|
||||
setCaret(ed, 6) // "alpha|"
|
||||
const range = wordRangeAtCaret(ed)
|
||||
expect(range && textAt(ed, range)).toBe('alpha')
|
||||
ed.destroy()
|
||||
})
|
||||
|
||||
it('returns null with the caret in an empty paragraph', () => {
|
||||
const ed = createEditor([{ type: 'docParagraph', attrs: { docxIndex: null } }])
|
||||
setCaret(ed, 1)
|
||||
expect(wordRangeAtCaret(ed)).toBeNull()
|
||||
ed.destroy()
|
||||
})
|
||||
|
||||
it('returns null for a non-empty selection', () => {
|
||||
const ed = editor()
|
||||
const tr = ed.state.tr.setSelection(TextSelection.create(ed.state.doc, 1, 6))
|
||||
ed.view.dispatch(tr)
|
||||
expect(wordRangeAtCaret(ed)).toBeNull()
|
||||
ed.destroy()
|
||||
})
|
||||
|
||||
it('finds a word in CJK text', () => {
|
||||
const ed = createEditor([para(text('\u8fd9\u662f\u4e00\u4e2a\u6d4b\u8bd5'))])
|
||||
setCaret(ed, 4)
|
||||
const range = wordRangeAtCaret(ed)
|
||||
expect(range).not.toBeNull()
|
||||
// the segmenter's exact CJK word boundaries may vary; the caret must sit inside the range
|
||||
expect(range!.from).toBeLessThanOrEqual(4)
|
||||
expect(range!.to).toBeGreaterThanOrEqual(4)
|
||||
expect(range!.to).toBeGreaterThan(range!.from)
|
||||
ed.destroy()
|
||||
})
|
||||
|
||||
it('anchors on the preceding word after trailing punctuation is skipped over', () => {
|
||||
const ed = createEditor([para(text('done. next'))])
|
||||
setCaret(ed, 5) // "done|."
|
||||
const range = wordRangeAtCaret(ed)
|
||||
expect(range && textAt(ed, range)).toBe('done')
|
||||
ed.destroy()
|
||||
})
|
||||
})
|
||||
@@ -5,6 +5,7 @@ import { act } from 'react'
|
||||
import { Editor } from '@tiptap/core'
|
||||
import { TextSelection } from '@tiptap/pm/state'
|
||||
import { editorExtensions } from '../src/renderer/editor/extensions'
|
||||
import { LocaleProvider, setModuleLang } from '../src/renderer/i18n/locale'
|
||||
import {
|
||||
EditorContextMenu,
|
||||
FontDialog,
|
||||
@@ -45,7 +46,7 @@ function render(element: React.ReactElement): { container: HTMLElement; unmount:
|
||||
const container = document.createElement('div')
|
||||
document.body.appendChild(container)
|
||||
const root = createRoot(container)
|
||||
act(() => root.render(element))
|
||||
act(() => root.render(createElement(LocaleProvider, { initial: 'en', children: element })))
|
||||
return {
|
||||
container,
|
||||
unmount: () => {
|
||||
@@ -71,6 +72,11 @@ function menuProps(editor: Editor, overrides: Record<string, unknown> = {}) {
|
||||
}
|
||||
}
|
||||
|
||||
// LocaleProvider subscribes to the shell's language switch on mount
|
||||
Object.assign(window, { desktop: { onLanguageChanged: () => () => undefined } })
|
||||
|
||||
setModuleLang('en')
|
||||
|
||||
describe('EditorContextMenu', () => {
|
||||
it('disables selection-dependent items when nothing is selected', () => {
|
||||
const editor = createEditor()
|
||||
@@ -79,12 +85,31 @@ describe('EditorContextMenu', () => {
|
||||
[...container.querySelectorAll<HTMLButtonElement>('.ctx-item')].find(
|
||||
(b) => b.querySelector('.ctx-label')?.textContent === label,
|
||||
)!
|
||||
expect(byLabel('剪切').disabled).toBe(true)
|
||||
expect(byLabel('复制').disabled).toBe(true)
|
||||
expect(byLabel('粘贴').disabled).toBe(false)
|
||||
expect(byLabel('字体…').disabled).toBe(false)
|
||||
expect(byLabel('段落…').disabled).toBe(false)
|
||||
expect(byLabel('新建批注').disabled).toBe(true)
|
||||
expect(byLabel('Cut').disabled).toBe(true)
|
||||
expect(byLabel('Copy').disabled).toBe(true)
|
||||
expect(byLabel('Paste').disabled).toBe(false)
|
||||
expect(byLabel('Font…').disabled).toBe(false)
|
||||
expect(byLabel('Paragraph…').disabled).toBe(false)
|
||||
// Word anchors a comment on the word under a collapsed caret, so this stays live
|
||||
expect(byLabel('New Comment').disabled).toBe(false)
|
||||
unmount()
|
||||
editor.destroy()
|
||||
})
|
||||
|
||||
it('disables New Comment when the caret has no word to anchor on', () => {
|
||||
const editor = new Editor({
|
||||
element: document.createElement('div'),
|
||||
extensions: editorExtensions,
|
||||
content: {
|
||||
type: 'doc',
|
||||
content: [{ type: 'docParagraph', attrs: { docxIndex: 0 } }],
|
||||
},
|
||||
})
|
||||
const { container, unmount } = render(createElement(EditorContextMenu, menuProps(editor)))
|
||||
const item = [...container.querySelectorAll<HTMLButtonElement>('.ctx-item')].find(
|
||||
(b) => b.querySelector('.ctx-label')?.textContent === 'New Comment',
|
||||
)!
|
||||
expect(item.disabled).toBe(true)
|
||||
unmount()
|
||||
editor.destroy()
|
||||
})
|
||||
@@ -102,12 +127,12 @@ describe('EditorContextMenu', () => {
|
||||
[...container.querySelectorAll<HTMLButtonElement>('.ctx-item')].find(
|
||||
(b) => b.querySelector('.ctx-label')?.textContent === label,
|
||||
)!
|
||||
expect(byLabel('剪切').disabled).toBe(false)
|
||||
expect(byLabel('新建批注').disabled).toBe(false)
|
||||
act(() => byLabel('新建批注').click())
|
||||
expect(byLabel('Cut').disabled).toBe(false)
|
||||
expect(byLabel('New Comment').disabled).toBe(false)
|
||||
act(() => byLabel('New Comment').click())
|
||||
expect(onNewComment).toHaveBeenCalledOnce()
|
||||
expect(onClose).toHaveBeenCalled()
|
||||
act(() => byLabel('字体…').click())
|
||||
act(() => byLabel('Font…').click())
|
||||
expect(onFontDialog).toHaveBeenCalledOnce()
|
||||
unmount()
|
||||
editor.destroy()
|
||||
@@ -121,7 +146,7 @@ describe('EditorContextMenu', () => {
|
||||
createElement(EditorContextMenu, menuProps(editor, { onAiPreset })),
|
||||
)
|
||||
const synonym = [...container.querySelectorAll<HTMLButtonElement>('.ctx-item')].find(
|
||||
(b) => b.querySelector('.ctx-label')?.textContent === '同义词',
|
||||
(b) => b.querySelector('.ctx-label')?.textContent === 'Synonyms',
|
||||
)!
|
||||
expect(synonym.disabled).toBe(false)
|
||||
act(() => synonym.click())
|
||||
@@ -138,8 +163,8 @@ describe('EditorContextMenu', () => {
|
||||
const badged = [...container.querySelectorAll<HTMLButtonElement>('.ctx-item')]
|
||||
.filter((b) => b.querySelector('.copilot-badge'))
|
||||
.map((b) => b.querySelector('.ctx-label')?.textContent)
|
||||
expect(badged).toContain('同义词')
|
||||
expect(badged).toContain('翻译')
|
||||
expect(badged).toContain('Synonyms')
|
||||
expect(badged).toContain('Translate')
|
||||
unmount()
|
||||
editor.destroy()
|
||||
})
|
||||
@@ -153,7 +178,7 @@ describe('FontDialog', () => {
|
||||
const dds = container.querySelectorAll<HTMLButtonElement>('.gs-dd-btn')
|
||||
// Font style → bold
|
||||
pickDropdown(container, dds[1]!, 'bold')
|
||||
const ok = [...container.querySelectorAll('button')].find((b) => b.textContent === '确定')!
|
||||
const ok = [...container.querySelectorAll('button')].find((b) => b.textContent === 'OK')!
|
||||
act(() => ok.click())
|
||||
expect(editor.isActive('bold')).toBe(true)
|
||||
expect(editor.getAttributes('docTextStyle').sizeHalfPoints).toBe(22)
|
||||
@@ -168,7 +193,7 @@ describe('ParagraphDialog', () => {
|
||||
select(editor, 2, 2)
|
||||
const { container, unmount } = render(createElement(ParagraphDialog, { editor, onClose: noop }))
|
||||
pickDropdown(container, container.querySelector<HTMLButtonElement>('.gs-dd-btn')!, 'center')
|
||||
const ok = [...container.querySelectorAll('button')].find((b) => b.textContent === '确定')!
|
||||
const ok = [...container.querySelectorAll('button')].find((b) => b.textContent === 'OK')!
|
||||
act(() => ok.click())
|
||||
expect(editor.getAttributes('docParagraph').align).toBe('center')
|
||||
unmount()
|
||||
@@ -182,7 +207,7 @@ describe('ParagraphDialog', () => {
|
||||
const alignDd = container.querySelector<HTMLButtonElement>('.gs-dd-btn')!
|
||||
expect(alignDd.dataset.value).toBe('right')
|
||||
pickDropdown(container, alignDd, 'left')
|
||||
const ok = [...container.querySelectorAll('button')].find((b) => b.textContent === '确定')!
|
||||
const ok = [...container.querySelectorAll('button')].find((b) => b.textContent === 'OK')!
|
||||
act(() => ok.click())
|
||||
// visual left is the start side in LTR → stored as null
|
||||
expect(editor.getAttributes('docParagraph').align).toBeNull()
|
||||
@@ -198,7 +223,7 @@ describe('ParagraphDialog', () => {
|
||||
// unset align in an RTL paragraph renders right, so the dialog shows Right
|
||||
expect(alignDd.dataset.value).toBe('right')
|
||||
pickDropdown(container, alignDd, 'left')
|
||||
const ok = [...container.querySelectorAll('button')].find((b) => b.textContent === '确定')!
|
||||
const ok = [...container.querySelectorAll('button')].find((b) => b.textContent === 'OK')!
|
||||
act(() => ok.click())
|
||||
// visual left is the end side in RTL → stored explicitly
|
||||
expect(editor.getAttributes('docParagraph').align).toBe('left')
|
||||
@@ -213,7 +238,7 @@ describe('ParagraphDialog', () => {
|
||||
const alignDd = container.querySelector<HTMLButtonElement>('.gs-dd-btn')!
|
||||
expect(alignDd.dataset.value).toBe('left')
|
||||
pickDropdown(container, alignDd, 'right')
|
||||
const ok = [...container.querySelectorAll('button')].find((b) => b.textContent === '确定')!
|
||||
const ok = [...container.querySelectorAll('button')].find((b) => b.textContent === 'OK')!
|
||||
act(() => ok.click())
|
||||
expect(editor.getAttributes('docParagraph').align).toBeNull()
|
||||
unmount()
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
/**
|
||||
* Standalone HTML export: editing chrome is dropped, review wrappers are
|
||||
* flattened to their accepted text, authored attributes survive, and the
|
||||
* output carries no app class names (jsdom resolves inline styles only, so
|
||||
* the cascade itself is exercised on the real app).
|
||||
*/
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { buildStandaloneHtml, resolveContent } from '../src/renderer/html-export'
|
||||
|
||||
function mount(html: string): HTMLElement {
|
||||
const root = document.createElement('div')
|
||||
root.className = 'doc-page ProseMirror'
|
||||
root.innerHTML = html
|
||||
document.body.appendChild(root)
|
||||
return root
|
||||
}
|
||||
|
||||
describe('buildStandaloneHtml', () => {
|
||||
it('drops widgets and tracked deletions, unwraps comments and insertions', () => {
|
||||
const root = mount(
|
||||
'<p class="doc-p">Hello <span class="doc-comment">noted</span> ' +
|
||||
'<span class="doc-ins">added</span><span class="doc-del">gone</span>' +
|
||||
'<span class="ProseMirror-widget">⚑</span></p>' +
|
||||
'<div class="page-gap">page 2</div>',
|
||||
)
|
||||
const out = buildStandaloneHtml(root, { title: 'T' })
|
||||
expect(out).toContain('<p>Hello noted added</p>')
|
||||
expect(out).not.toContain('gone')
|
||||
expect(out).not.toContain('⚑')
|
||||
expect(out).not.toContain('page 2')
|
||||
expect(out).not.toMatch(/class="doc-/)
|
||||
})
|
||||
|
||||
it('keeps links, images, table spans and inline widths', () => {
|
||||
const root = mount(
|
||||
'<p><a href="https://x.test" class="doc-link">x</a>' +
|
||||
'<img src="data:image/png;base64,AAAA" alt="pic" style="width:120px;height:40px"></p>' +
|
||||
'<table class="doc-table"><tbody><tr><td colspan="2" style="width:200px">c</td></tr></tbody></table>',
|
||||
)
|
||||
const out = buildStandaloneHtml(root, { title: 'T', textWidthPx: 600 })
|
||||
expect(out).toMatch(/<a href="https:\/\/x.test"[^>]*>x<\/a>/)
|
||||
expect(out).toMatch(/<img src="data:image\/png;base64,AAAA" alt="pic" width="120" height="40"/)
|
||||
expect(out).toMatch(/<td colspan="2" style="[^"]*width:200px/)
|
||||
expect(out).toContain('max-width:600px')
|
||||
expect(out).toMatch(/^<!DOCTYPE html>/)
|
||||
})
|
||||
|
||||
it('escapes text and restores lifted screen-only classes', () => {
|
||||
const wrap = document.createElement('div')
|
||||
wrap.className = 'workspace page-dark'
|
||||
document.body.appendChild(wrap)
|
||||
const root = document.createElement('div')
|
||||
root.innerHTML = '<p>a < b & "c"</p>'
|
||||
wrap.appendChild(root)
|
||||
const out = buildStandaloneHtml(root, { title: 'A & B' })
|
||||
expect(out).toContain('<p>a < b & "c"</p>')
|
||||
expect(out).toContain('<title>A & B</title>')
|
||||
expect(wrap.classList.contains('page-dark')).toBe(true)
|
||||
})
|
||||
})
|
||||
|
||||
describe('resolveContent', () => {
|
||||
it('resolves strings, escapes, attr() and the ordered counter', () => {
|
||||
const el = document.createElement('p')
|
||||
el.setAttribute('data-marker', '(a)')
|
||||
expect(resolveContent('attr(data-marker) "\\00a0"', el)).toBe('(a) ')
|
||||
expect(resolveContent('"•"', el)).toBe('•')
|
||||
expect(resolveContent('none', el)).toBe('')
|
||||
const list = document.createElement('div')
|
||||
for (let i = 0; i < 3; i++) {
|
||||
const li = document.createElement('p')
|
||||
li.className = 'doc-li doc-li-ordered'
|
||||
list.appendChild(li)
|
||||
}
|
||||
expect(resolveContent('counter(doc-ol) "."', list.children[2])).toBe('3.')
|
||||
})
|
||||
})
|
||||
@@ -11,7 +11,7 @@ import { parseDocx, saveDocx, type HeaderFooter } from '@genoffice/docx-engine'
|
||||
import JSZip from 'jszip'
|
||||
import { buildDocx } from '../../../packages/docx-engine/tests/helpers/build-docx'
|
||||
import { blocksToPmDoc, pmDocToSavePlan } from '../src/renderer/editor/convert'
|
||||
import { executeCommands } from '../src/renderer/ai/commands'
|
||||
import { executeOps } from '../src/renderer/ai/ops'
|
||||
import { readFileSync } from 'node:fs'
|
||||
import { join } from 'node:path'
|
||||
import type { ParsedDocFull, StyleInfo } from '@genoffice/docx-engine'
|
||||
@@ -327,11 +327,9 @@ describe('VML horizontal rule sharing a text paragraph', () => {
|
||||
expect(await saveDocx(parsed, noop.saveBlocks)).toBe(bytes)
|
||||
|
||||
// an identity replace leaves the paragraph untouched (still 'original')
|
||||
const same = executeCommands(editor, {
|
||||
commands: [
|
||||
{ replaceAllText: { containsText: 'Séquence', replaceText: 'Séquence', matchCase: true } },
|
||||
],
|
||||
} as never)
|
||||
const same = executeOps(editor, [
|
||||
{ op: 'findReplace', find: 'Séquence', replace: 'Séquence', matchCase: true },
|
||||
] as never)
|
||||
expect(same.ok).toBe(true)
|
||||
expect(
|
||||
pmDocToSavePlan(editor.state.doc.toJSON() as never, parsed.blocks).saveBlocks.map(
|
||||
@@ -340,11 +338,9 @@ describe('VML horizontal rule sharing a text paragraph', () => {
|
||||
).toEqual(['original', 'original'])
|
||||
|
||||
// a real edit rebuilds the paragraph: text run rPr verbatim, rule runs whole
|
||||
const edit = executeCommands(editor, {
|
||||
commands: [
|
||||
{ replaceAllText: { containsText: 'Séquence', replaceText: 'Chapitre', matchCase: true } },
|
||||
],
|
||||
} as never)
|
||||
const edit = executeOps(editor, [
|
||||
{ op: 'findReplace', find: 'Séquence', replace: 'Chapitre', matchCase: true },
|
||||
] as never)
|
||||
expect(edit.ok).toBe(true)
|
||||
const plan = pmDocToSavePlan(editor.state.doc.toJSON() as never, parsed.blocks)
|
||||
expect(plan.saveBlocks.map((b) => b.kind)).toEqual(['generated', 'original'])
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
// Insert → Comment must start a new comment (not just toggle the pane), and it
|
||||
// follows the Review-tab gate: live under the comments-only restriction, dead
|
||||
// when a protection forbids commenting or there is nothing to anchor on.
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import { act, createElement } from 'react'
|
||||
import { createRoot, type Root } from 'react-dom/client'
|
||||
import { Editor } from '@tiptap/core'
|
||||
import { editorExtensions } from '../src/renderer/editor/extensions'
|
||||
import { computeFormatState } from '../src/renderer/components/ribbon-format-state'
|
||||
import { Ribbon } from '../src/renderer/components/Ribbon'
|
||||
import { t } from '../src/renderer/i18n/locale'
|
||||
import { ribbonProps } from './helpers/ribbon-props'
|
||||
|
||||
function makeEditor(): Editor {
|
||||
return new Editor({
|
||||
element: document.createElement('div'),
|
||||
extensions: editorExtensions,
|
||||
content: {
|
||||
type: 'doc',
|
||||
content: [{ type: 'docParagraph', content: [{ type: 'text', text: 'hello world' }] }],
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
describe('Insert → Comment', () => {
|
||||
let editor: Editor
|
||||
let root: Root
|
||||
let container: HTMLElement
|
||||
const onNewComment = vi.fn()
|
||||
|
||||
beforeEach(() => {
|
||||
editor = makeEditor()
|
||||
container = document.createElement('div')
|
||||
document.body.appendChild(container)
|
||||
root = createRoot(container)
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
act(() => root.unmount())
|
||||
container.remove()
|
||||
editor.destroy()
|
||||
onNewComment.mockClear()
|
||||
})
|
||||
|
||||
function renderInsertTab(overrides: Record<string, unknown>) {
|
||||
act(() =>
|
||||
root.render(
|
||||
createElement(Ribbon, {
|
||||
...ribbonProps(editor, computeFormatState(editor)),
|
||||
onNewComment,
|
||||
...overrides,
|
||||
}),
|
||||
),
|
||||
)
|
||||
const insertTab = [...container.querySelectorAll<HTMLButtonElement>('.ribbon-tab')].find(
|
||||
(b) => b.textContent === t('ribbonTabInsert'),
|
||||
)!
|
||||
act(() => insertTab.click())
|
||||
return [...container.querySelectorAll<HTMLButtonElement>('button.rb-big')].find(
|
||||
(b) => b.textContent === t('ribbonComment'),
|
||||
)!
|
||||
}
|
||||
|
||||
it('starts a new comment when an anchor is available', () => {
|
||||
const btn = renderInsertTab({ canComment: true })
|
||||
expect(btn.disabled).toBe(false)
|
||||
act(() => btn.click())
|
||||
expect(onNewComment).toHaveBeenCalledTimes(1)
|
||||
})
|
||||
|
||||
it('is disabled with nothing to anchor on', () => {
|
||||
const btn = renderInsertTab({ canComment: false })
|
||||
expect(btn.disabled).toBe(true)
|
||||
})
|
||||
|
||||
it('stays live under the comments-only restriction', () => {
|
||||
const btn = renderInsertTab({ canComment: true, isProtected: true, commentsAllowed: true })
|
||||
expect(btn.disabled).toBe(false)
|
||||
})
|
||||
|
||||
it('is disabled when a protection forbids commenting', () => {
|
||||
const btn = renderInsertTab({ canComment: true, isProtected: true, commentsAllowed: false })
|
||||
expect(btn.disabled).toBe(true)
|
||||
})
|
||||
})
|
||||
@@ -3,7 +3,7 @@ import { parseDocx, saveDocx } from '@genoffice/docx-engine'
|
||||
import JSZip from 'jszip'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { buildDocx } from '../../../packages/docx-engine/tests/helpers/build-docx'
|
||||
import { executeCommands } from '../src/renderer/ai/commands'
|
||||
import { executeOps } from '../src/renderer/ai/ops'
|
||||
import { blocksToPmDoc, pmDocToSavePlan, type PmNode } from '../src/renderer/editor/convert'
|
||||
import { editorExtensions } from '../src/renderer/editor/extensions'
|
||||
|
||||
@@ -70,9 +70,7 @@ describe('invisible characters survive saving', () => {
|
||||
|
||||
it('round-trips NBSP/ZWSP/NNBSP and hyphen elements through a regenerated paragraph', async () => {
|
||||
const { parsed, editor, host } = await openDoc(BODY_PARA)
|
||||
const outcome = executeCommands(editor, {
|
||||
commands: [{ replaceAllText: { containsText: INVISIBLE, replaceText: INVISIBLE } }],
|
||||
})
|
||||
const outcome = executeOps(editor, [{ op: 'findReplace', find: INVISIBLE, replace: INVISIBLE }])
|
||||
expect(outcome.ok).toBe(true)
|
||||
expect(outcome.results[0]).toMatchObject({ matched: 1 })
|
||||
const plan = pmDocToSavePlan(editor.getJSON() as PmNode, parsed.blocks)
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Editor } from '@tiptap/core'
|
||||
import { NodeSelection, TextSelection } from '@tiptap/pm/state'
|
||||
import { parseDocx, saveDocx } from '@genoffice/docx-engine'
|
||||
import { buildDocx } from '../../../packages/docx-engine/tests/helpers/build-docx'
|
||||
import { executeCommands } from '../src/renderer/ai/commands'
|
||||
import { executeOps } from '../src/renderer/ai/ops'
|
||||
import { blocksToPmDoc, pmDocToSavePlan, type PmNode } from '../src/renderer/editor/convert'
|
||||
import { editorExtensions } from '../src/renderer/editor/extensions'
|
||||
|
||||
@@ -112,15 +112,14 @@ describe('object move and text modes', () => {
|
||||
content: blocksToPmDoc(parsed.blocks) as never,
|
||||
})
|
||||
|
||||
const result = executeCommands(editor, {
|
||||
commands: [{ moveBlocks: { blockIndexes: [1], afterBlockIndex: 3 } }],
|
||||
})
|
||||
const result = executeOps(editor, [{ op: 'moveBlocks', blockIndexes: [1], afterBlockIndex: 3 }])
|
||||
expect(result.ok).toBe(true)
|
||||
const plan = pmDocToSavePlan(editor.getJSON() as PmNode, parsed.blocks)
|
||||
const reparsed = await parseDocx(await saveDocx(parsed, plan.saveBlocks))
|
||||
const visibleTypes = reparsed.blocks.filter((block) => !block.hidden).map((block) => block.type)
|
||||
|
||||
expect(visibleTypes).toEqual(['paragraph', 'paragraph', 'passthrough', 'table'])
|
||||
// a table moved to the end gets Word's mandatory trailing paragraph
|
||||
expect(visibleTypes).toEqual(['paragraph', 'paragraph', 'passthrough', 'table', 'paragraph'])
|
||||
expect(reparsed.blocks[2].textboxes?.[0].paras[0].runs[0].text).toBe('Selectable textbox text')
|
||||
editor.destroy()
|
||||
})
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1230,6 +1230,40 @@ describe('computeSectionedSlicesF2 — line-level pagination', () => {
|
||||
expect(slices[1].start).toBe(120) // heading pushed together with the body
|
||||
})
|
||||
|
||||
it('keepNext heading whose anchor row cannot share any page still moves whole', () => {
|
||||
// the chain + anchor demand exceeds a fresh page (a table head row taller
|
||||
// than the page), so the keepNext constraint is dropped; the heading must
|
||||
// then place like any block instead of being cut by the page bottom
|
||||
const before = block(0, 180)
|
||||
const heading = lineBlock(180, [30], { keepNext: true, keepLines: true })
|
||||
const table = block(210, 400, {
|
||||
tableRows: [
|
||||
{ height: 250, contentBottom: 0 },
|
||||
{ height: 150, contentBottom: 0 },
|
||||
],
|
||||
})
|
||||
const slices = computeSectionedSlicesF2([before, heading, table], geoms1, 610)
|
||||
expect(slices[1].start).toBe(180)
|
||||
})
|
||||
|
||||
it('keepNext heading demands the footnote separator its table anchor will open', () => {
|
||||
// heading (30) + head row (20) + its notes (30) fit the 200px page by 10px,
|
||||
// but the row's notes also open the 16px separator strip; the heading must
|
||||
// move with the table instead of staying orphaned at the page bottom
|
||||
const before = block(0, 110)
|
||||
const heading = lineBlock(110, [30], { keepNext: true, keepLines: true })
|
||||
const table = block(140, 130, {
|
||||
footnoteExtraPx: 30,
|
||||
tableRows: [
|
||||
{ height: 20, contentBottom: 0, notesPx: 30 },
|
||||
{ height: 80, contentBottom: 0 },
|
||||
],
|
||||
})
|
||||
const slices = computeSectionedSlicesF2([before, heading, table], geoms1, 270)
|
||||
expect(slices.length).toBe(2)
|
||||
expect(slices[1].start).toBe(110)
|
||||
})
|
||||
|
||||
it('keepLines without keepNext stays at the page bottom (no chain push)', () => {
|
||||
const before = block(0, 120)
|
||||
const kl = lineBlock(120, [60], { keepLines: true })
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
/**
|
||||
* A copy of one unformatted spreadsheet cell (Sheets/Excel put a 1x1 table on
|
||||
* the clipboard) pastes as text with the insertion point's formatting, like
|
||||
* typing — not as unmarked text that falls back to the theme font (alpha
|
||||
* ledger r176: cell copied in AI Sheets pasted into AI Docs showed the Aptos
|
||||
* theme font instead of the destination's Calibri).
|
||||
*/
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { Editor } from '@tiptap/core'
|
||||
import { TextSelection } from '@tiptap/pm/state'
|
||||
import { editorExtensions } from '../src/renderer/editor/extensions'
|
||||
import { pasteTextSlice, singleCellPasteText } from '../src/renderer/editor/paste-text'
|
||||
|
||||
// jsdom has no ClipboardEvent; the paste path only needs an Event shell
|
||||
class FakeClipboardEvent extends Event {
|
||||
clipboardData = null
|
||||
}
|
||||
;(globalThis as Record<string, unknown>).ClipboardEvent = FakeClipboardEvent
|
||||
|
||||
const CALIBRI = { font: 'Calibri', fontAscii: 'Calibri', sizeHalfPoints: 24 }
|
||||
|
||||
/** the shape Univer's USMToHtmlService writes for one unformatted cell */
|
||||
const UNIVER_SINGLE_CELL =
|
||||
'<google-sheets-html-origin><table data-copy-id="x" xmlns="http://www.w3.org/1999/xhtml" ' +
|
||||
'cellspacing="0" cellpadding="0" dir="ltr" ' +
|
||||
'style="table-layout:fixed;font-size:10pt;font-family:Arial;width:0px;border-collapse:collapse;border:none">' +
|
||||
'<colgroup><col width="72" /></colgroup>' +
|
||||
'<tbody><tr style="height:19px;"><td style="vertical-align:bottom;">Budget 2026</td></tr></tbody>' +
|
||||
'</table></google-sheets-html-origin>'
|
||||
|
||||
describe('singleCellPasteText', () => {
|
||||
it('extracts the text of a lone unformatted cell (Univer clipboard shape)', () => {
|
||||
expect(singleCellPasteText(UNIVER_SINGLE_CELL)).toBe('Budget 2026')
|
||||
})
|
||||
|
||||
it('turns in-cell explicit line breaks into newlines', () => {
|
||||
expect(singleCellPasteText('<table><tr><td>a<br>b</td></tr></table>')).toBe('a\nb')
|
||||
})
|
||||
|
||||
it('keeps the HTML lane for multi-cell tables', () => {
|
||||
expect(singleCellPasteText('<table><tr><td>a</td><td>b</td></tr></table>')).toBeNull()
|
||||
})
|
||||
|
||||
it('keeps the HTML lane when prose accompanies the table', () => {
|
||||
expect(singleCellPasteText('<p>intro</p><table><tr><td>a</td></tr></table>')).toBeNull()
|
||||
})
|
||||
|
||||
it('keeps the HTML lane for a rich-text cell (formatting elements inside)', () => {
|
||||
expect(
|
||||
singleCellPasteText(
|
||||
'<table><tr><td><span style="font-weight:bold;">a</span></td></tr></table>',
|
||||
),
|
||||
).toBeNull()
|
||||
})
|
||||
|
||||
it('keeps the HTML lane for images and empty cells', () => {
|
||||
expect(
|
||||
singleCellPasteText('<table><tr><td><img src="http://x/y.png"></td></tr></table>'),
|
||||
).toBeNull()
|
||||
expect(singleCellPasteText('<table><tr><td> </td></tr></table>')).toBeNull()
|
||||
expect(singleCellPasteText('no tables here')).toBeNull()
|
||||
})
|
||||
})
|
||||
|
||||
describe('single-cell paste takes the insertion point font', () => {
|
||||
function makeEditor() {
|
||||
return new Editor({
|
||||
element: document.createElement('div'),
|
||||
extensions: editorExtensions,
|
||||
content: {
|
||||
type: 'doc',
|
||||
content: [
|
||||
{
|
||||
type: 'docParagraph',
|
||||
content: [
|
||||
{
|
||||
type: 'text',
|
||||
text: 'Report ',
|
||||
marks: [{ type: 'docTextStyle', attrs: CALIBRI }],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
it('lands the cell text with the caret marks via pasteTextSlice', () => {
|
||||
const editor = makeEditor()
|
||||
const { state } = editor.view
|
||||
// caret at the end of the Calibri run
|
||||
editor.view.dispatch(
|
||||
state.tr.setSelection(TextSelection.create(state.doc, 1 + 'Report '.length)),
|
||||
)
|
||||
const cellText = singleCellPasteText(UNIVER_SINGLE_CELL)
|
||||
expect(cellText).toBe('Budget 2026')
|
||||
const slice = pasteTextSlice(cellText!, editor.view.state.selection.$from, editor.view)
|
||||
editor.view.dispatch(editor.view.state.tr.replaceSelection(slice))
|
||||
const para = editor.state.doc.child(0)
|
||||
expect(para.textContent).toBe('Report Budget 2026')
|
||||
const last = para.child(para.childCount - 1)
|
||||
expect(last.marks.find((m) => m.type.name === 'docTextStyle')?.attrs).toMatchObject({
|
||||
font: 'Calibri',
|
||||
})
|
||||
editor.destroy()
|
||||
})
|
||||
})
|
||||
@@ -63,17 +63,9 @@ describe('rawPPr passthrough', () => {
|
||||
editor,
|
||||
{
|
||||
id: 't',
|
||||
name: 'apply_commands',
|
||||
name: 'apply_ops',
|
||||
input: {
|
||||
commands: [
|
||||
{
|
||||
updateParagraphStyle: {
|
||||
target: { blockIndexes: [0] },
|
||||
style: { align: 'center' },
|
||||
fields: ['align'],
|
||||
},
|
||||
},
|
||||
],
|
||||
ops: [{ op: 'setParagraphFormat', target: { blockIndexes: [0] }, align: 'center' }],
|
||||
},
|
||||
},
|
||||
NUM_IDS,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user