shabegom / buttons

Buttons in Obsidian
The Unlicense
455 stars 47 forks source link

In editing mode I don't see the code of the buttons but in reading mode the buttons work perfect #125

Closed wardroef closed 5 months ago

wardroef commented 1 year ago

Hi. I use 29 plugins and Dataview is for me the most important plugin. But the second place goes to Buttons ☺. It is like having a Stream Deck in Obsidian. Thank you for creating this Awesome plugin.

It works almost perfect but I have a strange problem and I think it is a bug.

The Button code only is visible in Editing mode (Live Preview) after scrolling down with the arrow keys to the end op the page. Otherwise I only see
between the buttons but not the code. It looks likes it is collapsed.

In Reading mode the buttons work perfect.

Before scrolling down with the arrow keys image

After scrolling down with the arrow keys

name 00205_KLA_Daylight
type link
action obsidian://open?vault=00205_KLA_Daylight
color white
cvh-obsi commented 1 year ago

same problem with obsidian 0.15 (not with 0.14)

shabegom commented 1 year ago

Is this the same problem as #126?

wardroef commented 1 year ago

Hi

No it is not the same. In my case the buttons works perfect in Reading mode. In source mode I see the code perfect.

But in Live preview I need to scroll down with the arrow keys to see the code. Very strange. Next time when I open the note it is the same problem again.

Ward

From: Sam @.> Sent: Wednesday, 17 August 2022 15:08 To: shabegom/buttons @.> Cc: Ward Roef @.>; Author @.> Subject: Re: [shabegom/buttons] In editing mode I don't see the code of the buttons but in reading mode the buttons work perfect (Issue #125)

Is this the same problem as #126https://github.com/shabegom/buttons/issues/126?

— Reply to this email directly, view it on GitHubhttps://github.com/shabegom/buttons/issues/125#issuecomment-1217988078, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ATANAP2AT3I6MS4OY646NE3VZTP3ZANCNFSM53RYXU7A. You are receiving this because you authored the thread.Message ID: @.**@.>>

TacticalSauce commented 1 year ago

Also having this issue. Very annoying since I rely on Live Preview a lot, and use obsidian mobile where I do not have access to arrow keys.

ghost commented 1 year ago

Same problem. On mobile buttons appears if I backspace lines where button should be then undo it

shabegom commented 1 year ago

I can't reproduce this bug. Will keep trying tho

wardroef commented 1 year ago

Hi Sam

I have tested now in the new 0.16.1 insider build. The problem is the same and the workaround also. It works perfect in Reading view and in Source Mode. The problem only appears in Live preview mode. When I scroll down with the arrow key all the code appears. Before that I can only see the hard return code:
This is an example of a button.

name 01584_ICT_Dell
type link
action obsidian://open?vault=01584_ICT_Dell
color white


Ward From: Sam @.> Sent: Friday, 2 September 2022 02:51 To: shabegom/buttons @.> Cc: Ward Roef @.>; Author @.> Subject: Re: [shabegom/buttons] In editing mode I don't see the code of the buttons but in reading mode the buttons work perfect (Issue #125)

I can't reproduce this bug. Will keep trying tho

— Reply to this email directly, view it on GitHubhttps://github.com/shabegom/buttons/issues/125#issuecomment-1234948334, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ATANAP4S764U4WAQHJ5PUNTV4FFQLANCNFSM53RYXU7A. You are receiving this because you authored the thread.Message ID: @.**@.>>

shabegom commented 1 year ago

@wardroef Could you try seeing if it is a conflict with another plugin or a theme?

Create a test vault and only install buttons. Does the issue still occur?

wardroef commented 1 year ago

Hi Sam

That was a very good idea. I should have thought about myself ☺

I created a new local folder. No sync and no cloud.

I only installed Buttons plugin. I have kept the default theme and all default settings.

I copied my MD file with the buttons.

The problem is the same.

@.***

From: Sam @.> Sent: Friday, 2 September 2022 13:36 To: shabegom/buttons @.> Cc: Ward Roef @.>; Mention @.> Subject: Re: [shabegom/buttons] In editing mode I don't see the code of the buttons but in reading mode the buttons work perfect (Issue #125)

@wardroefhttps://github.com/wardroef Could you try seeing if it is a conflict with another plugin or a theme?

Create a test vault and only install buttons. Does the issue still occur?

— Reply to this email directly, view it on GitHubhttps://github.com/shabegom/buttons/issues/125#issuecomment-1235391099, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ATANAP2UY32I6WXXP274LGLV4HRBPANCNFSM53RYXU7A. You are receiving this because you were mentioned.Message ID: @.**@.>>

daxmonson commented 1 year ago

Also having the same issue. Have tried a test vault with no other plugins. Live preview / arrow on moible makes it hard to use. It's a great plugin, hope this gets sorted.

shabegom commented 1 year ago

I'm still not able to reproduce, so it's hard to know why it isn't working...codeblocks in live preview were built to "just work".

I suspect it is a button indexing problem. Do the buttons have IDs under the codeblock: ^button-myButton?

daxmonson commented 1 year ago

Yep, mine have assigned button IDs underneath.

hbarudin commented 1 year ago

I'm encountering this problem too. Here's an example:

bug

I'm running Obsidian 0.15.9

TacticalSauce commented 1 year ago

That’s exactly the issue I have. I have tested on mobile, desktop, with a fresh vault and no other plugins, block IDs and no block IDs… it persists regardless.

— Aadam Sherazi On Sep 22, 2022 at 12:19 PM -0400, Hannah Barudin @.***>, wrote:

I'm encountering this problem too. Here's an example: I'm running Obsidian 0.15.9 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

Mindweave commented 1 year ago

I have the same issue. As a manual workaround, I would manually select the area where the text of the button would be then click away

Buttons workaround_compressed

My automatic workaround is to automatically refresh the page by using dataview and templater. It selects the entire page then clicks back to where the cursor was initially. Like the gif above but automatically. Just put the codeblock symbols around the below code and add it to a file where it would be visible.

dataviewjs //get editor using templater. Place cursor position at the start and end of the document then remove cursor from the file let intervalToRunInMilliseconds = 500; async function getEditor(){let MarkdownView=app.plugins.plugins['templater-obsidian'].templater.current_functions_object.obsidian.MarkdownView;let activeLeaf=app.workspace.getActiveViewOfType(MarkdownView);if(activeLeaf){let view=activeLeaf;let editor=view.editor;return editor}}function delayTextReturn(textToReturn,delayInMilliseconds){return new Promise((resolve,reject)=>{setTimeout(()=>{resolve(textToReturn)},delayInMilliseconds)})} await delayTextReturn("This waits for a bit before refreshing the page",intervalToRunInMilliseconds);let editor=await getEditor(); let currentCursorPosition = editor.getCursor(); editor.setSelection({line:0,ch:0},{line:editor.lineCount(),ch:editor.lastLine.length});editor.setCursor({line:0,ch:0}); editor.setCursor(currentCursorPosition);

Being a workaround, there are some limitations: It refreshes all other codeblocks so using it on a page with other codeblocks can get performance heavy. Also it will run every time the interval is passed so long as the dataview block is visible on the page (I recommend having it at the top of the page)

It works for my use-case. Hopefully it helps someone else too :)