Skip to content

Handle mixed file types in drag & drop operations#247

Merged
schuyler merged 1 commit intomainfrom
claude/review-github-issue-GJPKH
Jan 5, 2026
Merged

Handle mixed file types in drag & drop operations#247
schuyler merged 1 commit intomainfrom
claude/review-github-issue-GJPKH

Conversation

@schuyler
Copy link
Copy Markdown
Owner

@schuyler schuyler commented Jan 3, 2026

Summary

  • Remove unused draggingEntered method (confirmed dead code per testing feedback)
  • Update performDragOperation: to properly handle mixed content when dragging multiple files:
    • Images are inlined as base64 data URLs (existing behavior)
    • TextClipping content is extracted and inserted (new)
    • Other files have their paths inserted (new)

This addresses the edge case where dragging a mix of textClipping and image files would silently discard the textClippings.

Test plan

  • Drag single image → inlines as base64 markdown
  • Drag multiple images → all inlined
  • Drag single textClipping → content inserted
  • Drag multiple textClippings → all content inserted
  • Drag mix of images + textClippings → both handled correctly
  • Drag non-image/non-clipping file → path inserted
  • Regular drag (no Option key) → default behavior (file path)
  • Undo/redo works for all operations
  • Text dragging within editor still works

Related to #245

Remove unused draggingEntered method and update performDragOperation to
properly handle mixed content when dragging multiple files. Images are
inlined as base64 data URLs, textClipping content is extracted and
inserted, and other files have their paths inserted.

Related to #245
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jan 3, 2026

Code Coverage Report

Current Coverage: 51.44%

Coverage Details (Summary)
Name                                                                                                                                   Coverage            
-------------------------------------------------------------------------------------------------------------------------------------- ------------------- 
MASPreferences.bundle                                                                                                                  0.00% (0/0)         
MacDown 3000.app                                                                                                                       57.83% (7252/12540) 
    /Users/runner/work/macdown3000/macdown3000/MacDown/Code/Document/MPAsset.m                                                         93.69% (104/111)    
        -[MPAsset typeName]                                                                                                            100.00% (3/3)       
        -[MPAsset defaultTypeName]                                                                                                     100.00% (3/3)       
        +[MPAsset assetWithURL:andType:]                                                                                               100.00% (3/3)       
        -[MPAsset initWithURL:andType:]                                                                                                87.50% (7/8)        
        -[MPAsset init]                                                                                                                100.00% (3/3)       
        -[MPAsset templateForOption:]                                                                                                  0.00% (0/6)         
        -[MPAsset htmlForOption:]                                                                                                      100.00% (28/28)     
        -[MPStyleSheet defaultTypeName]                                                                                                100.00% (3/3)       
        +[MPStyleSheet CSSWithURL:]                                                                                                    100.00% (3/3)       
        -[MPStyleSheet templateForOption:]                                                                                             100.00% (20/20)     
        -[MPScript defaultTypeName]                                                                                                    100.00% (3/3)       
        +[MPScript javaScriptWithURL:]                                                                                                 100.00% (3/3)       
        -[MPScript templateForOption:]                                                                                                 100.00% (20/20)     
        -[MPEmbeddedScript htmlForOption:]                                                                                             100.00% (5/5)       
    /Users/runner/work/macdown3000/macdown3000/MacDown/Code/Utility/MPMathJaxListener.m                                                0.00% (0/26)        
        -[MPMathJaxListener callbacks]                                                                                                 0.00% (0/5)         
        -[MPMathJaxListener addCallback:forKey:]                                                                                       0.00% (0/3)         
        -[MPMathJaxListener invokeCallbackForKey:]                                                                                     0.00% (0/8)         
        +[MPMathJaxListener isSelectorExcludedFromWebScript:]                                                                          0.00% (0/5)         
        +[MPMathJaxListener isKeyExcludedFromWebScript:]                                                                               0.00% (0/5)         
    /Users/runner/work/macdown3000/macdown3000/Dependency/peg-markdown-highlight/HGMarkdownHighlightingStyle.m                         87.69% (57/65)      
        +[HGMarkdownHighlightingStyle colorFromARGBColor:]                                                                             100.00% (6/6)       
        -[HGMarkdownHighlightingStyle initWithType:attributesToAdd:toRemove:fontTraitsToAdd:]                                          88.89% (8/9)        
        -[HGMarkdownHighlightingStyle initWithStyleAttributes:baseFont:]                                                               86.00% (43/50)      
    /Users/runner/work/macdown3000/macdown3000/MacDown/Code/Extension/hoedown_html_patch.c                                             88.37% (114/129)    
        hoedown_patch_render_blockcode                                                                                                 89.09% (49/55)      
        hoedown_patch_render_listitem                                                                                                  100.00% (46/46)     
        hoedown_patch_render_toc_header                                                                                                67.86% (19/28)      
    /Users/runner/work/macdown3000/macdown3000/MacDown/Code/Application/MPMainController.m                                             42.91% (106/247)    
        MPOpenBundledFile                                                                                                              96.67% (29/30)      
        __MPOpenBundledFile_block_invoke                                                                                               85.71% (6/7)        
        treat                                                                                                                          20.00% (6/30)       
        __treat_block_invoke                                                                                                           0.00% (0/3)         
        -[MPMainController applicationDidFinishLaunching:]                                                                             100.00% (6/6)       
        -[MPMainController openUrlSchemeAppleEvent:withReplyEvent:]                                                                    0.00% (0/45)        
        __59-[MPMainController openUrlSchemeAppleEvent:withReplyEvent:]_block_invoke                                                   0.00% (0/7)         
        -[MPMainController valueForKey:fromQueryItems:]                                                                                0.00% (0/5)         
        -[MPMainController preferences]                                                                                                100.00% (3/3)       
        -[MPMainController preferencesWindowController]                                                                                0.00% (0/18)        
        -[MPMainController showPreferencesWindow:]                                                                                     0.00% (0/2)         
        -[MPMainController showHelp:]                                                                                                  100.00% (3/3)       
        -[MPMainController showContributing:]                                                                                          100.00% (3/3)       
        -[MPMainController init]                                                                                                       90.91% (10/11)      
        -[MPMainController applicationShouldOpenUntitledFile:]                                                                         80.00% (4/5)        
        -[MPMainController applicationDidBecomeActive:]                                                                                100.00% (5/5)       

... (2383 more lines truncated)

📊 **Full coverage report available in workflow artifacts**

@wltb wltb mentioned this pull request Jan 4, 2026
@schuyler schuyler merged commit 84023b1 into main Jan 5, 2026
7 checks passed
schuyler pushed a commit that referenced this pull request Jan 16, 2026
This uses code from #247 and shuffles code out of MPEditorView since it
began to look a bit crowded there.

Tested it, worked fine.
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