Skip to content

ENG-1507: Drag and drop files from wikilinks#960

Open
trangdoan982 wants to merge 9 commits intomainfrom
eng-1507-ability-to-drag-and-drop-files-from-wikilink
Open

ENG-1507: Drag and drop files from wikilinks#960
trangdoan982 wants to merge 9 commits intomainfrom
eng-1507-ability-to-drag-and-drop-files-from-wikilink

Conversation

@trangdoan982
Copy link
Copy Markdown
Member

@trangdoan982 trangdoan982 commented Apr 13, 2026

https://www.loom.com/share/a321b01e4eee4d40a5fff3554bc88cb5

https://www.loom.com/share/4466009d58cd47a89dade0a908165a7a

Summary

  • Adds drag-and-drop support for wikilinks onto tldraw canvases to create discourse node shapes
  • Reading view: Makes <a class="internal-link"> elements natively draggable via markdown post-processor
  • Live Preview: Uses CM6 mark decorations to add draggable="true" + data-dg-link-path to wikilink spans, with a domEventHandlers({ dragstart }) handler to set obsidian:// drag data
  • Supports both wikilinks ([[...]]) and markdown links ([text](path.md))
    🤖 Generated with Claude Code

Open with Devin

trangdoan982 and others added 2 commits April 13, 2026 16:44
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@linear-code
Copy link
Copy Markdown

linear-code bot commented Apr 13, 2026

@supabase
Copy link
Copy Markdown

supabase bot commented Apr 13, 2026

This pull request has been ignored for the connected project zytfjzqyijgagqxrzbmz because there are no changes detected in packages/database/supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

devin-ai-integration[bot]

This comment was marked as resolved.

graphite-app[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

graphite-app[bot]

This comment was marked as resolved.

trangdoan982 and others added 2 commits April 13, 2026 14:57
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
@trangdoan982 trangdoan982 requested a review from mdroidian April 13, 2026 21:58
@trangdoan982
Copy link
Copy Markdown
Member Author

@jsmorabito let me know what you think of this widget approach to allow for wikilink drag. there was techincal difficulty with regular drag action for wikilink as explained in the Loom

@mdroidian mdroidian requested a review from jsmorabito April 14, 2026 02:21
@jsmorabito
Copy link
Copy Markdown
Collaborator

This is a fine solution for now, but I think we'll want to revisit it again in the future when we're polishing to make this more seamless and ill take a note down as a reminder for that.

One question: can we detect when a tldraw canvas file is open and only show the drag handle icons when one is? That would make this less intrusive to the user experience

Copy link
Copy Markdown
Collaborator

@jsmorabito jsmorabito left a comment

Choose a reason for hiding this comment

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

@trangdoan982
Copy link
Copy Markdown
Member Author

@jsmorabito https://www.loom.com/share/1803050e2d714737a6aa11ba83f1fb0e

here's the test showing the feature you requested

@trangdoan982 trangdoan982 requested a review from jsmorabito April 15, 2026 17:44
Copy link
Copy Markdown
Collaborator

@jsmorabito jsmorabito left a comment

Choose a reason for hiding this comment

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

Perfect! Thank you Trang 🙏

const refreshMarkdownEditors = (): void => {
this.app.workspace.iterateAllLeaves((leaf) => {
if (leaf.view instanceof MarkdownView) {
const cm = (leaf.view.editor as unknown as { cm: EditorView }).cm;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could avoid assertions with an explicit type check:

type EditorWithCm = { cm: EditorView };
const hasCodeMirrorView = (editor: unknown): editor is EditorWithCm => {
  if (!editor || typeof editor !== "object") return false;
  return "cm" in editor;
};
// ...
if (leaf.view instanceof MarkdownView && hasCodeMirrorView(leaf.view.editor)) {
  leaf.view.editor.cm.dispatch({});
}

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.

3 participants