Draft
feat: Copy/Move selection to new note via context menu#81
Conversation
- Add `extractToNewNote` callback to `EditorCallbacks`
- Update `useEditorCallbacks` to implement `extractToNewNote` via
`usePromptDialog` and return `{ callbacks, promptDialog }`
- Register selection-aware context menu builder in `RenderedEditor`
(TipTap) and `NativeSourceEditor` (textarea) with proper column
scoping for split mode
- Add `sourceCtxBuilder` slot + `resolveCtxItems` to `NoteEditor` so
both panes are handled in split mode independently
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add ability to extract a selection to a new note
feat: Copy/Move selection to new note via context menu
Aug 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Right-clicking a text selection in the rendered (WYSIWYG) or source editor now offers two actions: Copy to New Note (duplicates selection into a new file) and Move to New Note (removes selection, inserts a
[[wikilink]]back to the new note). Cancelling the name prompt or a creation failure leaves the original note untouched.Changes
packages/editor/src/types.ts— AddedextractToNewNote(content, mode)toEditorCallbacks; returns the new note's path ornullon cancel/failure.apps/web/src/state/use-editor-callbacks.tsx— ImplementsextractToNewNoteviausePromptDialog+api.create; opens the new note in a tab. Return type changed fromEditorCallbacksto{ callbacks, promptDialog }— callers must renderpromptDialog.packages/editor/src/rendered-editor.tsx— AcceptsonRegisterContextMenuprop; registers a builder that surfaces the two extract actions when TipTap has a non-empty selection and the right-click target is within.editor-column--rendered. Selectionfrom/toare captured at menu-open time so the async replace is positionally stable.packages/editor/src/native-source-editor.tsx— Same pattern for the textarea pane: checksselectionStart !== selectionEnd, scopes to.editor-column--split, usessetRangeTextfor the move replacement.apps/web/src/components/note-editor.tsx— Adds a dedicatedsourceCtxBuilderslot (registerSourceCtxBuilder) passed toNativeSourceEditor, plus aresolveCtxItemshelper that probes builders in priority order (customCtxBuilder → sourceCtxBuilder → descriptorCtxBuilder). This keeps split-mode right-clicks in each pane independent without changing the existingCustomContextMenuBuilderAPI.