jonathanyeung / mark-sharp

Mark Sharp WYSIWYG Markdown Editor for VS Code
18 stars 0 forks source link

Marksharp - Markshrap editor throws error when editing in Marksharp and switch to raw markdown #11

Open jeffsnff opened 1 month ago

jeffsnff commented 1 month ago

Describe the bug When using the WYSIWYG Marksharp editor and switch between that and the raw Markdown file, fonts styles will undo themselves and move them somewhere else in the document, words will have added letters or missing letters and won't save the edits when editing it in Marksharp.

To Reproduce Steps to reproduce the behavior:

  1. Open a Markdown file
  2. Open file in with Mark Sharp
  3. Start to make edits to the document
  4. Switch back and forth between Mark Sharp document and raw markdown file

Expected behavior Marksharp WYSIWYG looks exactly like the raw markdown, saves the font styles where they should be

Actual behavior Marksharp WYSIWYG will remove some font styles, start misspelling words and if edited again, will revert back to the way it was misspelled or misspell another word.

Screenshots Here is a screen shot I took today on my mac once I saw your comment in my email. You will see my process. I would write a sentence then switch to the raw markdown I wasn't running into any issues with the sentences so I switched to numbered list. Every time I wrote a list item I switched to the raw markdown. That is when Number 5 happened. Then this error appeared. If you check the markdown, 5 does NOT appear twice. When you go back to Marksharp, the double 5 disappears.

Screenshot 2024-05-29 at 05 43 52

Platform (please complete the following information):

Error Logs Theses error logs came from the Windows machine Webview Error: Cannot read properties of undefined (reading 'indexOf') Source: Mark Sharp

Webview Error: insertAfter: list node is not parent of list item node Source: Mark Sharp More Notes from comment

jonathanyeung commented 1 month ago

Hi @jeffsnff - I think there are likely multiple issues that you've mentioned here, but the most critical one (and what may be exacerbating the other ones) is the text garble issue when switching between Mark Sharp and the VS Code editor. I believe I have a fix for this in versions >=1.2.3, which I've just released - can you give it a try and let me know if this problem has been resolved for you?

There are a few other error logs you've mentioned which I think are secondary issues:

I haven't been able to consistently reproduce these yet, but if the main issue with text skew has been resolved with 1.2.3, then we can track the list item problem in a new issue. Thanks for the feedback!

jonathanyeung commented 1 month ago

A quick update - in 1.2.5, I have an attempted fix for the list issue as well (Webview Error: insertAfter: list node is not parent of list item node Source: Mark Sharp).

jeffsnff commented 1 month ago

I have not been able to do test this yet. I will test it today at work and report back any findings.

jeffsnff commented 1 month ago

Hey Jonathan,

I still ran into an error, here is a screen shot of it. This was on a Windows, AMD Thinkpad, extension ( I believe I didn't see any "Update extension" option and VS Code is update to day

Marksharp bug
jonathanyeung commented 1 month ago

Hi Jeff,

Sorry to hear that you're still experiencing issues, I know it must be frustrating. I really do want to get down to the bottom of this issue though...

If you have time (and I know this is a big ask, so no worries if you can't) - can you take a video while reproducing the issue? Maybe start a new document that doesn't contain any sensitive info in the black boxes. (See update below)

If you can't do that, a few questions that may help me reproduce the error on my end:

  1. fonts styles will undo themselves and move them somewhere else in the document, words will have added letters or missing letters

    Is this still happening? Or are errors limited to just lists now?

  2. For the content in the first red box, can you paste what the raw markdown is for that section? (i.e., what text is written in the VS Code editor)
  3. What was the last action that triggered the 'WebviewError' popup? Was it pressing Enter on the last list item to create a new list?

Appreciate the patience and the help 🙏🏼

jonathanyeung commented 1 month ago

Quick Update: I'm able to repro a list issue now:

  1. on M# side, type '- '. Do NOT add text to the list item, keep it empty.
  2. Switch to VS Code
  3. Switch back to M#
  4. Type something
  5. Press Enter (you should see double dots now, which is wrong)
  6. Press Enter again - you should see the 'Webview Error' popup.

The issue reproduces when switching to Mark Sharp with an empty bullet list item, and then adding further entries to the list. I'll push a fix for this tomorrow - I can't guarantee it'll fix all list issues though, but we can peel the onion 😅.

Can you still let me know about Question 1 from my previous post?

jeffsnff commented 1 month ago

I’m replying from my email, so let’s see if this works.Yes I can do that tomorrow for you. Worse case, I’ll see this email again in the morning on Saturday and I can repo it on my Mac ( I had the same issue there ).I got you man. I’m a QA Engineer. I understand how these things feel.On Jun 6, 2024, at 11:25 AM, jonathanyeung @.***> wrote: Quick Update: I'm able to repro a list issue now:

on M# side, type '- '. Do NOT add text to the list item, keep it empty. Switch to VS Code Switch back to M# Type something Press Enter (you should see double dots now, which is wrong) Press Enter again - you should see the 'Webview Error' popup.

The issue reproduces when switching to Mark Sharp with an empty bullet list item, and then adding further entries to the list. I'll push a fix for this tomorrow - I can't guarantee it'll fix all list issues though, but we can peel the onion 😅. Can you still let me know about Question 1 from my previous post?

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

jeffsnff commented 1 month ago

I’m replying from my email, so let’s see if this works.Yes I can do that tomorrow for you. Worse case, I’ll see this email again in the morning on Saturday and I can repo it on my Mac ( I had the same issue there ).I got you man. I’m a QA Engineer. I understand how these things feel.On Jun 6, 2024, at 11:25 AM, jonathanyeung @.> wrote: Quick Update: I'm able to repro a list issue now: on M# side, type '- '. Do NOT add text to the list item, keep it empty. Switch to VS Code Switch back to M# Type something Press Enter (you should see double dots now, which is wrong) Press Enter again - you should see the 'Webview Error' popup. The issue reproduces when switching to Mark Sharp with an empty bullet list item, and then adding further entries to the list. I'll push a fix for this tomorrow - I can't guarantee it'll fix all list issues though, but we can peel the onion 😅. Can you still let me know about Question 1 from my previous post? —Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.>

Oh that was just UGLY. Never doing that again :)

jeffsnff commented 4 weeks ago

Hi Jeff,

Sorry to hear that you're still experiencing issues, I know it must be frustrating. I really do want to get down to the bottom of this issue though...

~If you have time (and I know this is a big ask, so no worries if you can't) - can you take a video while reproducing the issue? Maybe start a new document that doesn't contain any sensitive info in the black boxes.~ (See update below)

If you can't do that, a few questions that may help me reproduce the error on my end:

1. > fonts styles will undo themselves and move them somewhere else in the document, words will have added letters or missing letters

   Is this still happening? Or are errors limited to just lists now?

2. For the content in the first red box, can you paste what the raw markdown is for that section? (i.e., what text is written in the VS Code editor)

3. What was the last action that triggered the 'WebviewError' popup? Was it pressing Enter on the last list item to create a new list?

Appreciate the patience and the help 🙏🏼

  1. It seems like the font style is sticking which is great.

  2. It seems to trigger when I am writing a list ( bulleted or numbered ) it will duplicate the next list item when you switch from M# to MD and back to M#.

  3. Unless you can tell me where the error log gets produced to, no I can not do this. It will just be [object object] if I copy it.

It seems like it keeps some ghost characters in it. I ended up deleting a big block of text in MarkSharp but when I go to the Markdown file ( either switching tabs or closing out MarkSharp ) there is still text there that wasn't deleted.

I do have a question. Am I using this wrong? It works for reading my notes easily enough. That is fantastic. However, I am trying to use this more as a word document and it might not be its intended purposes. I am essentially trying to replace Microsoft Word, OneNote, or any note taking app since I code and debug in VS Code.

jeffsnff commented 4 weeks ago

I recorded a file, but it is too big to put here. Is there an email address I can use to send the video file to you?

jonathanyeung commented 4 weeks ago

Could you please send it to support@marksharp.co?

Am I using this wrong? It works for reading my notes easily enough. That is fantastic. However, I am trying to use this more as a word document and it might not be its intended purposes. I am essentially trying to replace Microsoft Word, OneNote, or any note taking app since I code and debug in VS Code.

You are not using this wrong at all, it's issues with the app that you're encountering. Your intended use case is exactly mine as well - I use a combo of Mark Sharp and VS Code to replace OneNote; it's one of the motivations for me building this extension.

Thanks!

jeffsnff commented 4 weeks ago

Okay, thank you.

jonathanyeung commented 3 weeks ago

Hi @jeffsnff - thanks a lot for taking the time to record the video, it was very insightful.

I've just released version 1.2.6 that I hope will fix some of the issues. From the video, I noticed 3 problems:

  1. The list problem where switching to M# with an empty list item, and then hitting enter causes the double bullet problem + subsequent webview error. As mentioned earlier in this thread, I was able to repro this issue; this should be fixed in 1.2.6.
  2. When you switched back to the editor, the Now a list\n 1. became Now a lis\n t1., which broke the first list item. I believe this is caused by a combination of settings you have in VS Code - AutoSave, and also trimTrailingWhitespace on save. Do you have these set in your VS Code? Essentially, what's happening is that in the previous line, a save happened when the final character on the line was a space. The save removed the space in the document, so additional text that you wrote in M# got offset by 1 character. I've implemented a fix in 1.2.6 that should fix this issue - no need to alter your settings.
  3. The Shift+Enter created an unexpected gap. I'm not sure what caused this and I've been unable to repro on my side. Nevertheless, I did add one small change to maybe fix this, and this may also be affected by the same issue in the above bullet point 2. It's possible this is fixed in 1.2.6, but probably unlikely given I couldn't repro it.

When you get a chance, can you try 1.2.6 and see if these issues are fixed? I'm especially curious if the Shift+Enter problem is still happening. If you have any other insights on the issue that might be helpful, let me know. I'll continue to look into it. Thanks!

jeffsnff commented 3 weeks ago

I think all this has been fixed. 1 & 2 I do have the setting turned on for Auto Save. I don't know about the trimTrailingWhitespace but either way, I am able to switch between Mark# ( love this ) and Markdown files easily and nothing seems to be happening.

3 When I press shift+enter now, I do not see any big gaps in the Markdown file anymore which is nice and I appreciate you fixing this.

I want to keep an eye on this because currently I am on my Mac, but I did notice an issue earlier this past week where it didn't save some edits I made on my work laptop.

jonathanyeung commented 3 weeks ago

Great to hear! Thanks so much for testing it out and for the detailed bug information.

I'll keep this open for now until you confirm that things are working on your PC as well. If you encounter further issues, please let me know!

jeffsnff commented 4 days ago

I think this has been fixed. I been using it last few weeks at work and at home. Creating tables, and general note taking work great. I really do enjoy the product. Thank you for this.