Commit Graph

22870 Commits

Author SHA1 Message Date
Andrey Antukh c64044d265 🐛 Harden draft-js block-data helpers against nil block
Three related fixes in the vendored draft-js package:

- mergeBlockData: early-return undefined when block is falsy.
  Without this, the first line (block.getData()) throws for callers
  that pass a nil block.

- splitBlockPreservingData: guard the blockMap.get(...) lookup. If
  the start key is stale (e.g. after a Modifier.splitBlock that
  doesn't actually produce the expected key), .get() returns
  undefined and the subsequent .getData() throws. Fall back to an
  empty Immutable Map for the block data.

- updateBlockData: short-circuit (return state unchanged) when
  mergeBlockData returns undefined. Without this, the chain
  newBlock.getData() would throw on the same nil-block case that
  mergeBlockData now guards.

These match the defensive nil-handling pattern used elsewhere in
the frontend (.getData callers) and protect against stale
selection keys in the Draft.js content state.

AI-assisted-by: minimax-m3
2026-07-16 07:57:11 +00:00
Andrey Antukh 6e8c1c0fa8 🐛 Harden get-editor-block-data and get-editor-block-type against nil block
getCurrentBlock from Draft.js can return undefined for an empty
selection (e.g. before any block is created). The previous
implementations called .getData / .getType directly on the result
and threw "Cannot read properties of undefined (reading
'getData')" / "...reading 'getType')".

Wrap both functions in (when (some? block) ...) so they return nil
cleanly. Callers in editor.cljs and text_editor.cljs already handle
nil results (render-block short-circuits via the case on type; the
text-data caller in text_editor.cljs lets nil flow up), so no
upstream change is required.

Add a regression test covering both functions with nil and
js/undefined input.

AI-assisted-by: minimax-m3
2026-07-16 07:57:03 +00:00
Andrey Antukh 2efbae9621 🐛 Harden v3 text editor paste and styles-fn against undefined receivers
Two related fixes for the "Cannot read properties of undefined
(reading 'getData')" family of bugs in the workspace text editor:

- v3_editor.cljs: wrap the paste body in when-let on clipboardData
  so .getData("text/plain") is never called on a nil receiver. The
  existing (when (and text (seq text))) guard already tolerates nil
  text; only the outer .getData call was unprotected.

- editor.cljs: add (and content ...) to the if branch in styles-fn
  so .getText and .getData are never called on a nil content. The
  else branch (legacy.txt/styles-to-attrs) is already the correct
  fallback for missing content.

Add a regression test that mirrors the fixed patterns and verifies
they no longer throw on synthetic events with no clipboardData or
nil content.

AI-assisted-by: minimax-m3
2026-07-16 07:56:49 +00:00
Andrey Antukh b06404bdf7 🐛 Harden paste handler against missing clipboardData in components/forms
Same defensive pattern as the main/ui/forms.cljs paste handler: wrap
the body in when-let so the .getData call is skipped when the
clipboardData property is missing on the paste event. Prevents the
raw "Cannot read properties of undefined (reading 'getData')"
TypeError for programmatic / edge-case paste events.

AI-assisted-by: minimax-m3
2026-07-16 07:56:31 +00:00
Andrey Antukh 0d0401f495 🐛 Harden paste handler against missing clipboardData in forms
When a paste event arrives without a clipboardData property (e.g.
a programmatically dispatched ClipboardEvent in some browsers, or
edge cases like dragging a file with no text content), the previous
implementation called .getData directly on the nil/undefined
clipboardData and threw "Cannot read properties of undefined
(reading 'getData')".

Wrap the body in when-let so the paste logic is skipped entirely
when clipboardData is missing. The existing (string? paste-data)
guard in the inner when already tolerates nil; no other caller
behavior changes.

AI-assisted-by: minimax-m3
2026-07-16 07:56:26 +00:00
Andrey Antukh eefb1883d5 🐛 Harden dnd/get-data against missing dataTransfer
When the sortable hook or any caller passes a synthetic event
without a dataTransfer property (e.g. a dragend fired after a drop
that has already cleared the transfer), the previous implementation
called .getData directly on the nil/undefined result and threw
"Cannot read properties of undefined (reading 'getData')".

Wrap the body in when-let so get-data returns nil cleanly when
dataTransfer is missing. All three current callers
(hooks.cljs:164, viewport/actions.cljs:531 and :562) already treat
the return value as optional via when-let / when, so no caller
breaks.

Add a regression test covering both the missing-dataTransfer case
and a real dataTransfer roundtrip.

AI-assisted-by: minimax-m3
2026-07-16 07:56:22 +00:00
Andrey Antukh a4ff47f0b4 🐛 Fix nil getData crash dropping ZIP without manifest.json
Add nil-guard in read-as-text to raise typed :invalid-entry error instead of calling (.getData nil writer) which produced a raw TypeError.

Made read-zip-manifest public (was defn-) with explicit detection of missing manifest.json, raising typed :invalid-penpot-file validation error. The existing catch path surfaces this hint as a friendly user error instead of the raw TypeError text.

Add regression tests for both paths. 374 users were affected, 704 occurrences across 2.17.0-RC2/RC3/RC4.

Fixes #10709.

AI-assisted-by: minimax-m3
2026-07-15 20:01:04 +00:00
Andrey Antukh b3105e6b82 ⏪ Backport github workflows from develop 2026-07-15 21:01:55 +02:00
Andrey Antukh e498dd2382 📎 Update commiter opencode agent 2026-07-15 21:01:33 +02:00
Andrey Antukh e48f374984 ⬆️ Update opencode on devenv dockerfile 2026-07-15 17:32:16 +02:00
Andrey Antukh 85dbf14344 📎 Add better planner skill and improve testing doc 2026-07-13 11:42:26 +02:00
Andrey Antukh 33e18c72e2 📎 Add minor improvements to opencode setup 2026-07-11 10:12:07 +02:00
Andrey Antukh 1f4b85209e 📚 Simplify the ia asistance note on creating-prs serena workflow 2026-07-10 11:22:44 +02:00
Eva Marco 3708cf31d4 🐛 Fix stroke cap selects (#10631) 2026-07-10 11:05:09 +02:00
Andrey Antukh e73aa9e981 ✨ Add PENPOT_INTERNAL_URI to exporter for separate internal and public URI handling (#10630)
Add PENPOT_INTERNAL_URI environment variable to the exporter. This allows
separating the URI used for internal communication (headless browser to
frontend) from the public URI used for resource references in exported SVGs.

Previously, PENPOT_PUBLIC_URI served both purposes, which caused exported
SVGs to contain broken font URLs when the internal Docker address was used.

Changes:
- Add :internal-uri to exporter config schema with fallback to :public-uri
- Add get-internal-uri helper function
- Use internal-uri for browser navigation in SVG/PDF/bitmap renderers
- Post-process SVG output to replace internal URI with public URI
- Use internal-uri for backend API calls in resource handler
- Log both URIs on startup
- Update docker-compose.yaml to use both variables
- Document the new variable in configuration.md

Closes #10627

AI-assisted-by: mimo-v2.5-pro
2026-07-10 10:41:49 +02:00
Andrey Antukh ad4dae5f28 📚 Add testing principles to serena doc 2026-07-09 19:40:45 +02:00
Andrey Antukh 23a9b4bdd9 🐛 Fix backend util shell tests 2026-07-09 19:34:15 +02:00
Andrey Antukh 3400d6afbb 🐛 Fix too much recursion when clicking shape in comments mode (#10622)
* 🐛 Fix too much recursion when clicking shape in comments mode

Remove `deselect-all` from `handle-interrupt` in comments mode. The
`select-shape` event emits `:interrupt` which the comments stream
watcher routes to `handle-interrupt`. In comments mode, calling
`deselect-all` cleared the selection and emitted a competing
`rt/nav`, creating a synchronous recursion cycle in the potok store
that overflowed the JS call stack.

Fixes #10620

AI-assisted-by: opencode

* 🐛 Add unit tests for comments handle-interrupt

Make `handle-interrupt` public (defn- → defn) and add 4 tests covering
each branch: draft thread, open thread, comments mode, and noop.

AI-assisted-by: opencode
2026-07-09 18:04:05 +02:00
Alonso Torres d6c50cc40b 🐛 Fix problems with plugins api setPluginData (#10632) 2026-07-09 18:00:26 +02:00
Andrey Antukh 64b0bff7bd 📚 Update serena creating-prs workflow documentation 2026-07-09 13:12:41 +02:00
Andrey Antukh 28fd798c52 🐛 Fix crash with degenerate selrect in text pipeline (#10618)
Guard remaining text pipeline locations that accessed :selrect directly
against nil/zero-dimension selrects by using safe-size-rect, which
provides a 4-level fallback chain (selrect -> points -> shape fields ->
empty 0.01x0.01 rect).

Fixes:
- fix-position in viewport_texts_html.cljs: replaced dm/get-prop
  :selrect with ctm/safe-size-rect for both old and new shape
- assoc-position-data in modifiers.cljs: replaced (:selrect ...)
  with ctm/safe-size-rect for delta computation
- change-orientation-modifiers in modifiers.cljc: replaced raw
  :selrect access with safe-size-rect for scale and origin computation

Closes #10617

AI-assisted-by: mimo-v2.5-pro
2026-07-09 11:03:06 +02:00
Andrey Antukh 47a3158602 🐛 Fix component variant panel crash with mismatched property counts (#10616)
Use `get` instead of `nth` to avoid index-out-of-bounds when a selected
component copy has fewer variant properties than the first component in
the selection.

Closes #10615

AI-assisted-by: deepseek-v4-pro
2026-07-09 11:01:08 +02:00
Andrey Antukh 41ebb8e80b 🐛 Fix crash when converting SVG-raw shape to path (#10613)
Guard the content-to-PathData coercion on whether
stp/convert-to-path actually produced a new value, so
SVG-raw shapes (whose :content is a hiccup map) pass through
unchanged instead of crashing.

Closes #10612

AI-assisted-by: deepseek-v4-pro
2026-07-09 11:00:18 +02:00
Andrey Antukh f2460eee29 🐛 Fix Draft.js selection offset DOMException on text editor re-render (#10608)
Clamp selection offset to node length in setDraftEditorSelection to
prevent DOMException when Draft.js SelectionState offset exceeds the
actual DOM text node length. This can happen during spellcheck, IME
composition, or race conditions during React re-renders.

Updates @penpot/draft-js to commit 09a33e0a which includes the fix
in addPointToSelection and addFocusToSelection.

Fixes #10607

AI-assisted-by: mimo-v2.5-pro
2026-07-09 10:59:40 +02:00
Andrey Antukh 8e9df0c515 ✨ Add insert-multi chunked variant to app.db 2026-07-09 09:25:59 +02:00
Andrey Antukh 8fcd8a63b4 ⬆️ Update opencode dependency on devenv 2026-07-09 09:25:19 +02:00
Andrey Antukh 455c7f5cae 📚 Update serena doc related to creating issues 2026-07-09 08:48:00 +02:00
Andrey Antukh b3d1a7aa8b 📚 Add better dev tools doc to serena 2026-07-09 08:33:46 +02:00
Andrey Antukh 10f240ce78 Merge remote-tracking branch 'origin/main' into staging 2.17.0-RC3 2026-07-09 08:13:18 +02:00
Elena Torró 8ac2e8c8a8 🐛 Fix sidebar scroll to shape (#10600) 2026-07-08 20:38:16 +02:00
Andrey Antukh bcf77767b2 📖 Update ai agents documentation 2026-07-08 15:44:18 +02:00
Andrey Antukh 8b734d9844 📎 Add postgresql client tool wrapper for devenv 2026-07-08 14:22:34 +02:00
Elena Torró d656d342fe 🐛 Fix text selrect size (#10566)
* 🐛 Fix text selrect size

* 🐛 Fix blinks on complex files

---------

Co-authored-by: Belén Albeza <belen@hey.com>
2026-07-08 13:56:58 +02:00
alonso.torres 88186eaec1 ⬆️ Release MCP 2.17.0 2026-07-08 12:57:45 +02:00
alonso.torres b153748866 ⬆️ Release plugins 1.5.0 2026-07-08 12:57:45 +02:00
alonso.torres f0cf8dca2a 🐛 Fix the release scripts 2026-07-08 12:57:45 +02:00
Andrey Antukh e61c55e53c 📚 Add no text-wrapping rule to the creating-issue workflow 2026-07-08 12:53:11 +02:00
Andrey Antukh aadae99b91 📎 Add create-issue skill 2026-07-08 12:43:51 +02:00
Andrey Antukh 83ce70d02d 📎 Update version on mcp package.json 2026-07-08 12:07:40 +02:00
Andrey Antukh 1b00ca8cb9 Merge remote-tracking branch 'origin/staging' 2.17.0-RC2 2026-07-08 12:03:49 +02:00
Andrey Antukh fdb5291384 📚 Update changelog 2026-07-08 12:03:02 +02:00
Dominik Jain b9e0421f79 📚 Update and improve devenv documentation
* Fix stale references to `run-devenv-agentic` and `start-devenv`
* Improve clarity in description of workspaces
* Improve section on agentic devenv

Co-authored-by: Michael Panchenko <michael.panchenko@oraios-ai.de>
2026-07-08 11:28:55 +02:00
Dominik Jain 93b5baa9fc 🐛 Relocate MCP run directory out of the npm-managed install directory
For the npm MCP package, adjust the launcher to specifically prepare
the runtime directory: The package contents are copied once per version
to a runtime directory owned by the launcher.

The npm-owned package directory cannot be used. While installing there
worked for older npm/npx version, we have to assume it is read-only.

Fixes #9947
2026-07-08 11:28:17 +02:00
Dominik Jain aee555ff6e 📚 Update API types for MCP server for new release 2026-07-08 11:27:46 +02:00
Andrey Antukh 50a98c35bf 📎 Update creating-commits serena workflow 2026-07-08 10:22:40 +02:00
Andrey Antukh 1d97ae5b46 📎 Simplify create-pr skill 2026-07-08 10:22:40 +02:00
Eva Marco ff0d56a86e 🐛 Fix blur menu width (#10575) 2026-07-08 10:06:23 +02:00
Juan de la Cruz 8b16bb8874 ✨ Add new slides content for 2.17 release (#10577)
* ✨ Add new slides content for 2.17 release

* 📎 Fix linter issues

---------

Co-authored-by: Andrey Antukh <niwi@niwi.nz>
2026-07-08 09:39:38 +02:00
Alonso Torres 7655f854a4 ✨ Improved api test suite (#10533)
* 🐛 Fix plugins api issues

* 🐛 Fix problem with text weight

* 🐛 Fix api problems

* ✨ Updated plugins test suite

* 🐛 Referential integrity tests

* ✨ Add resetOverrides method

* 🐛 Fix plugins components structure poluting
2026-07-07 16:12:12 +02:00
Belén Albeza 0a2570c9eb 🐛 Fix text editor not repainting text if there was not a geometry change (#10553) 2026-07-07 11:18:44 +02:00