@@ -10,8 +10,6 @@ import {
1010import { TFile } from "obsidian" ;
1111import type DiscourseGraphPlugin from "~/index" ;
1212
13- const DRAG_ATTR = "data-dg-draggable" ;
14-
1513const buildObsidianUrl = ( vaultName : string , filePath : string ) : string => {
1614 return `obsidian://open?vault=${ encodeURIComponent ( vaultName ) } &file=${ encodeURIComponent ( filePath ) } ` ;
1715} ;
@@ -41,49 +39,6 @@ const setDragData = (
4139 e . dataTransfer ?. setData ( "text/plain" , url ) ;
4240} ;
4341
44- // --- Reading view ---
45-
46- const makeReadingLinkDraggable = (
47- linkEl : HTMLAnchorElement ,
48- plugin : DiscourseGraphPlugin ,
49- ) : void => {
50- if ( linkEl . hasAttribute ( DRAG_ATTR ) ) return ;
51- linkEl . setAttribute ( DRAG_ATTR , "true" ) ;
52- linkEl . draggable = true ;
53-
54- linkEl . addEventListener ( "dragstart" , ( e ) => {
55- const href = linkEl . getAttr ( "data-href" ) ?? linkEl . getAttr ( "href" ) ;
56- if ( ! href ) {
57- e . preventDefault ( ) ;
58- return ;
59- }
60-
61- const file = resolveFileFromLinkText ( href , plugin ) ;
62- if ( ! file ) {
63- e . preventDefault ( ) ;
64- return ;
65- }
66-
67- setDragData ( e , file , plugin ) ;
68- } ) ;
69- } ;
70-
71- /**
72- * Markdown post-processor that makes wikilinks draggable in Reading view.
73- */
74- export const wikilinkDragPostProcessor = (
75- plugin : DiscourseGraphPlugin ,
76- ) : ( ( el : HTMLElement ) => void ) => {
77- return ( el : HTMLElement ) => {
78- const links = el . querySelectorAll < HTMLAnchorElement > (
79- "a.internal-link:not(.internal-embed)" ,
80- ) ;
81- for ( const link of links ) {
82- makeReadingLinkDraggable ( link , plugin ) ;
83- }
84- } ;
85- } ;
86-
8742// --- Live Preview ---
8843
8944/**
0 commit comments