ganesshkumar / obsidian-table-editor

An Obsidian plugin to provide an editor for Markdown tables. It can open CSV data and data from Microsoft Excel, Google Sheets, Apple Numbers and LibreOffice Calc as Markdown tables from Obsidian Markdown editor.
MIT License
215 stars 15 forks source link

[Feature Request] New Command: Select Markdown Table #8

Closed FelipeRearden closed 2 years ago

FelipeRearden commented 2 years ago

Is your feature request related to a problem? Please describe. Since the starting point to edit tables is to make a selection of the markdown table in the note, I think would be amazing if we have a new command that selects a table based on the position of the caret cursors.

Describe the solution you'd like If the caret cursor is placed inside a markdown table, hitting the new command will select the entire table !


Thanks for reading this!

Have a great day!!!!

ganesshkumar commented 2 years ago

@FelipeRearden , does this work?

expand to select table

Binding it to the same command. Logic used

if there is a selection
    user selected text is used as input
else
    explore on either side of the cursor for empty line
    all the lines between this will be used as input
FelipeRearden commented 2 years ago

@FelipeRearden , does this work?

Binding it to the same command. Logic used

Forgive for my comment @ganesshkumar , let me share why I think we need to select the table as well.

Following your video, after entering in the md table editor window the next steps for the user are:

This way, if we already have the table selected, I don't need to manually select the table than hit CRTL+V :)

Let me know what you think :)

Have a great day !!!!

ganesshkumar commented 2 years ago

Oh, got it. That can be a separate command πŸ‘

ganesshkumar commented 2 years ago

select table

Does this work?

FelipeRearden commented 2 years ago

Thank you very much @ganesshkumar !!!!!!

Thats exactly what I have in mind !!!!!! πŸ’™ πŸ’™ πŸ’™

ganesshkumar commented 2 years ago

Happy to help :) Thank you for the valuable feature suggestions!

FelipeRearden commented 2 years ago

Happy to help :) Thank you for the valuable feature suggestions!

Thank you very much @ganesshkumar !!!!!!!!!!!!!!!

FelipeRearden commented 2 years ago

I already installed version 0.1.1 and I think I found a bug ....

Take a look at the images ... when selecting a table with the new command, the line before the first row is being selected two

With or without content

51

Fun Fact -> sometimes is working prefect .... :)

52

I was trying to investigate if is something related to the caret cursor position when I am hitting the command ...

But I did not found a pattern to share with you :)

I hope you can reproduce this on your end :pray:

ganesshkumar commented 2 years ago

Damn! Some regression happened. I should add some tests before adding more functionality!

ganesshkumar commented 2 years ago

I checked for the same from my end.

  1. When you put your cursor on the first line of the table (header) and invoke the function, do you see extra selection on top line?
  2. Similarly, when you put your cursor on the last line of the table and invoke the function, do you see extra selection on bottom line?
ganesshkumar commented 2 years ago

@FelipeRearden Can you update it once again? 0.1.2 - I have included some fixes for both the issues. Works for my, let's see if it fixes the issues for you as well.

FelipeRearden commented 2 years ago

@FelipeRearden Can you update it once again? 0.1.2 - I have included some fixes for both the issues. Works for my, let's see if it fixes the issues for you as well.

Sure !!!! I'm here :)

Just to let you know about version 0.1.2 the manifest.json from this release is version 0.1.1. This way I can't see an update button on Obsidian.

image

Just to check with you if I can change manually the manifest.json from the 0.1.2 release and start my test updating manually ?

FelipeRearden commented 2 years ago
  1. When you put your cursor on the first line of the table (header) and invoke the function, do you see extra selection on top line?

Working perfect on version 0.1.2 !!!!! Thank you very much @ganesshkumar for your help !!!!!!

  1. Similarly, when you put your cursor on the last line of the table and invoke the function, do you see extra selection on bottom line?

Working perfect on version 0.1.2 !!!!! Thank you very much @ganesshkumar for your help !!!!!!


Let me just add one little information to see if you want make some changes or not ...

When we have some text in the line AFTER the last line of the table, we have a little issue. Take a look ...

image

If the line is empty 100% clear!

image

I'm pointing this to you because it's very common to use some tag like small after the table to add some explanation about the table like a footnote

For me it's okay on version 0.1.2 but as a tester, I think is my duty to present to you all my findings :)

Thanks for the quick reply :)

FelipeRearden commented 2 years ago

Hello @ganesshkumar !!!!

Sorry to bother you :)

One more information about selecting a table when you have content in the next line of the table ... https://github.com/ganesshkumar/obsidian-table-editor/issues/8#issuecomment-1063282689

The amazing plugin Obsidian Charts has a new feature that letΒ΄s you create Charts from Tables !!!!!

If you look at he documentation, you will see that it uses a table-id in the next line after the table

This way, would be amazing if we avoid this line when selecting a markdown table :pray:


Thanks for reading this and have a great day!!!!!!!!!

ganesshkumar commented 2 years ago

With v0.2.2, this is fixed

FelipeRearden commented 2 years ago

Hello @ganesshkumar !!!!

Thank you very much for the fix πŸ’™

Working perfect on version 0.2.2 Obsidian 0.14.6 and Obsidian Mobile

One ask :)

When you have some time, would you mind taking a look at these two issue πŸ™

Thank you very much and have a great day 🌞

ganesshkumar commented 2 years ago

Sure @FelipeRearden, I have triaged the feature requests. Will implement them soon!