Skip to content

Convert pinned notes into draft posts - #364

Merged
mmtr merged 2 commits into
trunkfrom
claude/convert-notes-to-posts-c5fb88
Jul 17, 2026
Merged

Convert pinned notes into draft posts#364
mmtr merged 2 commits into
trunkfrom
claude/convert-notes-to-posts-c5fb88

Conversation

@mmtr

@mmtr mmtr commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

Turn a pinned note into a draft post. A "Convert to post" action is available three ways: an inline button on each owned note, dragging the note's pin onto the Posts icon, or dragging it onto the native Posts window. Converting creates a draft from the note's text, removes the note, and opens the draft in the editor. Undo brings the note back and discards the draft.

Only shown to users who can author posts (edit_posts).

Testing

Prerequisites: log in as a user with Desktop Mode enabled who can create posts (Administrator or Editor).

Create a note to work with

  1. Open the Note Pad widget (Add widget → Note Pad, or an existing one).
  2. Type some text with two paragraphs (leave a blank line between them).
  3. Click Pin to desktop. A paper note appears on the wallpaper.

Convert via the inline button

  1. Hover the note. In the top row of the note, next to the color dot and the lock/globe toggle, there is a post icon button.
  2. Click it.
  3. Expect: the note disappears, a toast reads "Note converted to a draft post", and the block editor opens a new draft.
  4. Confirm the draft title is the note's first line and the body is separate paragraphs (one block per blank-line-separated paragraph).
  5. Click Undo on the toast. Expect: the editor window closes and the note returns to the wallpaper. The draft is gone (check Posts → Drafts).

Convert by dragging to the Posts icon (dock layout)

  1. Open OS Settings → Appearance and set the desktop layout to Unified (or any non-Spatial layout with a dock).
  2. Drag the note by its red pushpin onto the Posts icon in the dock.
  3. While hovering the Posts icon, expect the icon to highlight and the drag label to read "Convert to post".
  4. Release. Expect the same result as above (note removed, draft created, editor opens).

Convert by dragging to the Posts icon (Spatial layout)

  1. Open OS Settings → Appearance and set the desktop layout to Spatial. The core menu items now appear as icons on the wallpaper.
  2. Make sure the Posts icon on the wallpaper is not covered by a window (close or move any open windows).
  3. Drag the note by its pushpin onto the Posts wallpaper icon.
  4. Expect the Posts icon to highlight and the label to read "Convert to post"; release to convert.
  5. Drag a note onto the Pages or Media icon instead. Expect it to be rejected ("Can't pin here") — only Posts converts.

Convert via the native Posts window (optional)

  1. Open OS Settings → Features and enable the native Posts window.
  2. Open Posts. Drag a note's pushpin onto the Posts window body.
  3. Expect it to highlight and convert on release.

Capability gate

  1. Log in as a Subscriber (Desktop Mode enabled) or a user who cannot create posts.
  2. Expect: no convert button on notes, and dragging a note onto the Posts icon does nothing.

🤖 Generated with Claude Code

Open WordPress Playground Preview

@mmtr mmtr self-assigned this Jul 17, 2026
Add a "Convert to post" action to pinned notes: an inline button on each
owned note, plus dragging a note's pin onto the Posts icon (dock and
Spatial layouts) and the native Posts window. Converting spawns a draft
post from the note's text (as paragraph blocks), trashes the note, and
opens the draft in the editor. Undo restores the note and discards the
draft.

Adds a files-layer tile-payload seam so features can accept drops on a
shortcut tile the files layer would otherwise reject.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@mmtr
mmtr force-pushed the claude/convert-notes-to-posts-c5fb88 branch from b7cb47d to 5c08427 Compare July 17, 2026 14:34
@mmtr
mmtr requested a review from Copilot July 17, 2026 14:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a “Convert to post” workflow for pinned notes, enabling users with edit_posts to turn an owned note into a draft post (with Undo restoring the note and discarding the spawned draft). This extends the notes feature with a new REST endpoint, UI affordances, and drag-and-drop integration across dock, spatial shortcut tiles, and the native Posts window.

Changes:

  • Introduces POST /desktop-mode/v1/notes/:id/convert (server + client) to spawn a draft post from a note and link it for Undo via restore.
  • Adds UI + drag/drop entry points (inline note button, dock tile, spatial shortcut tile seam, native Posts window body).
  • Adds documentation and both Vitest + PHPUnit coverage for conversion behavior and the new tile-payload seam.

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/vitest/tile-payloads.test.ts Adds unit tests for the new files-layer tile-payload seam registry.
tests/vitest/notes-rest.test.ts Adds REST-client test for convertNote() route + response shape.
tests/vitest/notes-posts-drop-target.test.ts Adds regression coverage for dock slug matching and drop behavior across surfaces.
tests/vitest/notes-convert.test.ts Tests optimistic eviction, editor auto-open, Undo behavior, and rollback on failure.
tests/phpunit/tests/notesRest.php Server-side tests for convert route semantics, permissions, restore/undo, and filter behavior.
src/types.ts Extends DesktopConfig with canCreatePosts capability gate.
src/notes/rest.ts Adds convertNote() REST client and result type.
src/notes/posts-drop-target.ts Implements Posts drop targets (dock, native window, spatial shortcut tile via seam).
src/notes/layer.ts Adds inline “Convert to post” button and layer-level convertNote() entry point.
src/notes/index.ts Boots the Posts drop-target installer and wires canCreatePosts into NotesLayer.
src/notes/convert.ts Implements convert flow orchestration: REST call, editor open, Undo toast.
src/desktop-files/tile-payloads.ts New registry/seam to allow non-folder tiles to opt into accepting foreign payload types.
src/desktop-files/layer.ts Routes non-folder “reject” tile claimant through the new seam for accept/label/drop dispatch.
includes/render/assets.php Exposes canCreatePosts in the shell config payload (edit_posts).
includes/notes/rest.php Registers convert REST route; implements conversion and restore-side draft discard.
docs/javascript-reference.md Documents the new drag/drop surfaces and canCreatePosts gating + convert route.
docs/hooks-reference.md Documents new desktop_mode_notes_convert_post_args filter and desktop_mode_notes_converted action.
docs/examples/README.md Indexes the new conversion customization example.
docs/examples/notes-convert-to-post.md New example showing how to customize conversion via hooks.
assets/css/notes.css Styles the convert button and the Posts drop-target highlight state.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/notes/layer.ts Outdated
Comment thread src/desktop-files/layer.ts
Comment thread src/desktop-files/tile-payloads.ts Outdated
… label

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@mmtr
mmtr merged commit a212618 into trunk Jul 17, 2026
11 checks passed
@mmtr
mmtr deleted the claude/convert-notes-to-posts-c5fb88 branch July 17, 2026 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants