Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Drag and Drop does not work on note re open #489

Open
TomSpoct opened this issue Nov 6, 2023 · 15 comments
Open

[BUG] Drag and Drop does not work on note re open #489

TomSpoct opened this issue Nov 6, 2023 · 15 comments
Labels
bug Something isn't working

Comments

@TomSpoct
Copy link

TomSpoct commented Nov 6, 2023

Describe the bug
I have tested this plugin in a brand new vault with no other community plugin installed using standard theme.
I can create a new bullet list in a new note and within that use drag and drop to move bullets around.
Once the note is closed and reopened drag and drop does not work anymore on same note.
Does not work on old note with bullet lists eigher

To Reproduce
Steps to reproduce the behavior:

  1. Open a new vault with only Outliner installed as community plugin in default theme
  2. Go to 'New Note.'
  3. Click on '.Conte, create a list and move items arnoud with drag and drop...'
  4. Close the Note
  5. Open the note again
  6. Drag and drop no longer works
@TomSpoct TomSpoct added the bug Something isn't working label Nov 6, 2023
@Nefficus
Copy link

Nefficus commented Nov 7, 2023

Issue replicates for me as well

@yongminparks
Copy link

happens to me as well

@TheFermi0n
Copy link

Happens to me as well. I am getting this error in console whenever I try to drag and drop the list items.

Uncaught TypeError: Cannot read properties of null (reading 'left')
    at DragAndDropState.calculateLeftPadding (plugin:obsidian-outliner:1364:56)
    at new DragAndDropState (plugin:obsidian-outliner:1280:14)
    at DragAndDrop.startDragging (plugin:obsidian-outliner:1174:23)
    at DragAndDrop.handleMouseMove (plugin:obsidian-outliner:1091:22)

@wenlzhang
Copy link

Same here

@Nico-de-Vries
Copy link

It also seems related to the actual note. I have a simple outline I can revisit and it keeps working. I have a more complex one with images in the tree that doesn't work.

@Bender716w
Copy link

Bender716w commented Dec 6, 2023

I am also getting this unexpected feature. As described above, the impact seems to apply to specific notes, not program wide. I also note that other functions of outliner are affected in a similar manner, such as my ability to tab not working but I can move the line with the mouse, or in other notes, the mouse doesn't work but I can use tab, but sometimes shift-tab still works.

@Kung-Fu-Grandma
Copy link

Also having this issue

@h0uter
Copy link

h0uter commented Dec 18, 2023

I also have the issue that drag and drop does not work. From my experiments it does not work in notes with YAML frontmatter (as is default for Obsidian). In simple notes without frontmatter drag and drop works as expected.

@Bender716w
Copy link

I also have the issue that drag and drop does not work. From my experiments it does not work in notes with YAML frontmatter (as is default for Obsidian). In simple notes without frontmatter drag and drop works as expected.

I have the issues on notes without any metadata added. Copy and pasting data from a note with the issue to a new note seems to infect the new note but if I type the same data out, there isn't an issue. When I open the note in VS Code, I don't see anything different though so I am not sure if that is just circumstantial or if there is something to it.

@drozd2000
Copy link

drozd2000 commented Dec 18, 2023

I have the same issue. A bullshit workaround: to change in settings "Properties in document" from Visible to Source

@Jaydak54
Copy link

Same issue here.

Replicated console error noted by TheFermi0n during an interaction with new Obsidian properties feature. Workaround from drozd2000 is effective: changing Editor setting for "Properties in Document" from "Visible" to "Source".

Attached short video of replication below. Note that it persists identically when other plugins are disabled. Checked after making this recording and didn't want to re-take the clip when all else was the same.

bug.mp4

@drozd2000
Copy link

drozd2000 commented Jan 30, 2024

Hi guys, I don't know the language and this plugin well enough. So I made this workaround for me:
I changed in ...\Obsidian\MainVault\.obsidian\plugins\obsidian-outliner\main.js
this:

	calculateLeftPadding() {
		this.leftPadding = view.coordsAtPos(0, -1).left;
	}

to this:

	calculateLeftPadding() {		
		const { view } = this;	
		for (let i = 1; i <= view.state.doc.lines; i++) {
			const line = view.state.doc.line(i);
			const a = view.coordsAtPos(line.from, -1);
			if (a !== null) {
				this.leftPadding = a.left;
				return;
        		}
		}
 		this.leftPadding = 0;
	}

Yeah. It looks bad and strange but it works and it is enough for me :-)

@evelant
Copy link

evelant commented Feb 1, 2024

I tried your patch @drozd2000 but unfortunately drag and drop still fails on me. @vslinko are you still interested in maintaining this project? If not maybe I'll maintain a fork.

@vslinko
Copy link
Owner

vslinko commented Feb 1, 2024

@evelant Hi. Unfortunately, right now I can't find enough time and energy to focused maintenance of this project. But I will be glad to merge someone's PR.

@drozd2000
Copy link

drozd2000 commented Feb 4, 2024

I tried your patch @drozd2000 but unfortunately drag and drop still fails on me. @vslinko are you still interested in maintaining this project? If not maybe I'll maintain a fork.

there are more bugs with drag and drop. not only this one

Uncaught TypeError: Cannot read properties of null (reading 'left')
    at DragAndDropState.calculateLeftPadding (plugin:obsidian-outliner:1364:56)
    at new DragAndDropState (plugin:obsidian-outliner:1280:14)
    at DragAndDrop.startDragging (plugin:obsidian-outliner:1174:23)
    at DragAndDrop.handleMouseMove (plugin:obsidian-outliner:1091:22)

You can share your error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests