mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-25 18:27:02 -06:00
M4.57: PNG, PDF and text clipboard flavours in and out
Copy and Cut also offer other apps a PNG of the copied objects, a PDF
with On Copy: PDF, and plain text when every copied object is type
(clipboard.flavours; clipboard.exportPng {scale?}, exportPdf,
exportText). Paste outside text editing takes what another app copied:
SVG, then PDF (clipboard.importPdf), then plain text as point text
(clipboard.importText), then a bitmap embedded at the view centre
(clipboard.importImage {dataBase64, mime?, center?}); pasting our own
copy keeps the lossless internal clipboard, and Cmd+V pastes a bitmap
that comes with no text. Services gains system_clipboard
(SystemClipboard: write, holds_ours, read, has): on Windows every
format at once, on macOS and Linux one (the text, else the PNG); the
web keeps SVG text only. With When pasting text: Keep Plain Text, text
the Type tool copied pastes without its formatting.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
a560f74e17
commit
0968e34e7e
@@ -244,8 +244,9 @@ far). `ui.dialog.confirm` records the answer and asks about the next conflict (w
|
||||
the same); the last one runs the paste with `swatchConflict`. `ui.dialog.cancel` pastes nothing.
|
||||
|
||||
Paste placement: through the app, `edit.paste` and `edit.pasteWithoutFormatting` without `center`, `dx` or `dy`
|
||||
paste at the centre of the view. The Paste menu items are enabled while the system clipboard holds SVG, even with
|
||||
nothing copied in the app (looked at up to four times a second; `ui.menu.list` shows it). The Layers panel menu (≡ on
|
||||
paste at the centre of the view. The Paste menu items are enabled while the system clipboard holds something to
|
||||
paste (SVG, PDF, text or a bitmap on the desktop; SVG on the web), even with nothing copied in the app (looked at up
|
||||
to four times a second; `ui.menu.list` shows it). The Layers panel menu (≡ on
|
||||
the dock's tab strip while Layers shows) lists the layer commands and Paste Remembers Layers
|
||||
(`layer.pasteRemembersLayers`, checked when on).
|
||||
|
||||
@@ -276,3 +277,9 @@ Text Import Options: placing a `.txt` file through the app (`file.place` with a
|
||||
dialog, a drop) opens the `textImport` dialog (fields `platform`: `windows`/`mac`, `characterSet`: `unicode`/`ansi`,
|
||||
`removeLineReturns`, `removeParagraphReturns`, `replaceSpaces`, `spaces`). `ui.dialog.confirm` places the file as area
|
||||
type with those options (`file.place {text: {…}}`).
|
||||
|
||||
System clipboard formats: through the desktop app, `edit.copy` and `edit.cut` publish what `clipboard.flavours`
|
||||
lists to the system clipboard, and every Paste command first loads what another app copied (`clipboard.importSvg`,
|
||||
`importPdf`, `importText` or `importImage`, centred in the view); an import error answers the Paste with that error
|
||||
and pastes nothing. Cmd+V also pastes a bitmap or PDF with no text beside it (on the key's release, as egui sends no
|
||||
Paste event for it).
|
||||
|
||||
+30
@@ -976,3 +976,33 @@ in `document.exportPdf`, `document.pdfSettings`, `document.export`/`serialize` w
|
||||
{"name":"run_command","arguments":{"command":"pdf.preset.save","params":{"name":"Web","preset":"Smallest File Size","compatibility":"1.5"}}}
|
||||
{"name":"run_command","arguments":{"command":"document.exportPdf","params":{"preset":"Web","path":"/tmp/web.pdf"}}}
|
||||
```
|
||||
|
||||
## Clipboard formats
|
||||
|
||||
Besides SVG, Copy offers other apps PNG and PDF of the copied objects, and their text when they are all type.
|
||||
`clipboard.flavours` lists what Copy offers for the current clipboard, best first, by the Clipboard Handling
|
||||
preferences: `text/plain` (the text of a type-only copy, else the SVG markup with `copyAsSvg`), `image/svg+xml`
|
||||
(`copyAsSvg`), `application/pdf` (`copyAsPdf`) and `image/png` (always; PDF and PNG need objects with an
|
||||
area). Each one has a query command:
|
||||
`clipboard.exportSvg`, `clipboard.exportText` (null unless every copied object is type), `clipboard.exportPdf`
|
||||
(a one-page PDF, the page the objects' visual bounds) and `clipboard.exportPng {scale?}` (cropped to the objects,
|
||||
transparent around them).
|
||||
|
||||
What other apps copied goes into the clipboard with `clipboard.importSvg`, `clipboard.importPdf {dataBase64, page?,
|
||||
password?}` (the page's objects), `clipboard.importImage {dataBase64, mime?}` (an embedded image at 100% of its
|
||||
physical size) or `clipboard.importText {text}` (point text in the default type style), each centred on `center`
|
||||
(default: the first artboard); then any `edit.paste*` command pastes it. The desktop app does this itself: Copy and
|
||||
Cut publish the formats to the system clipboard, and a Paste outside text editing first reads what another app
|
||||
copied (SVG, then PDF, then text, then a bitmap; SVG markup in text counts as SVG). Pasting what VectorCraft copied
|
||||
keeps the lossless internal clipboard. Windows carries every format both ways; macOS and Linux carry one format
|
||||
(the text, else the PNG) and paste text and bitmaps. On the web only SVG text goes through the system clipboard.
|
||||
|
||||
The `pasteTextFormatting` preference (`keep` or `plain`): with `plain`, text the Type tool copied pastes into type
|
||||
without its formatting, taking the style at the caret.
|
||||
|
||||
```json
|
||||
{"name":"run_command","arguments":{"command":"clipboard.flavours","params":{}}}
|
||||
{"name":"run_command","arguments":{"command":"clipboard.exportPng","params":{"scale":2}}}
|
||||
{"name":"run_command","arguments":{"command":"clipboard.importImage","params":{"dataBase64":"iVBORw0KGgo…","center":[300,200]}}}
|
||||
{"name":"run_command","arguments":{"command":"edit.paste","params":{"center":[300,200]}}}
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user