asamuzaK / withExEditor

View Source, View Selection, and Edit Text with the external editor
Mozilla Public License 2.0
37 stars 3 forks source link

WithExEditor mangles sourceforge bug reports/comments. #150

Closed rtoy closed 3 years ago

rtoy commented 3 years ago

I filed this report sourceforge report https://sourceforge.net/p/forge/site-support/21689/ where entering any text into the edit window and submitting produces a mangled comment.

Works fine in incognito window. Did some experiments and disabled all extensions except withExEditor. Still mangles the message. When I disable withExEditor (and reload firefox), comments are working fine.

Don't know if this is a problem with sourceforge or with withExEditor, but I thought I'd report here as well.

asamuzaK commented 3 years ago

Please explain in more detail.

rtoy commented 3 years ago

Sorry about that! I entered the details on the sourceforge bug, but forgot to do that here.

I'm using Chrome 88.04324.0 (beta) and Firefox 85.0b4 on Linux.

Visit, say, https://sourceforge.net/p/forge/site-support/21689/ and enter a comment. (Need an account, I think.)

Press preview. Everything you type gets replaced by just the first character. I haven't used withExEditor yet in any way, except that it's enabled for both chrome and firefox. withExEditor works on every other site I tried that has an editable box that withExEditor can recognize.

Press preview again to enable writing. The original message is there (usually). Then submit. The actual message is what the preview showed.

But when I use an incognito window, this doesn't happen and the text is correctly submitted to the bug.

I don't know if this ever worked before. It's been a long time since I entered anything in sourceforge, and that was probably long before I started using withExEditor.

asamuzaK commented 3 years ago

I have some more questions.

I'm using Chrome 88.04324.0 (beta) and Firefox 85.0b4 on Linux.

Is this issue happening in both Chrome and Firefox?

Visit, say, https://sourceforge.net/p/forge/site-support/21689/ and enter a comment. (Need an account, I think.)

I don't have a SourceForge account, so I can't check it at this time. Can you provide a screenshot or something?

Press preview again to enable writing. The original message is there (usually). Then submit. The actual message is what the preview showed.

You mean that the actual message is a replaced character, right? For example, suppose your input is:

Foo bar
Baz

But submitted message is

F b
B

But when I use an incognito window, this doesn't happen and the text is correctly submitted to the bug.

What happens if you enabled the extension in incognito window? Firefox:

Chrome:

rtoy commented 3 years ago

Yes, this is happening with both Firefox and Chrome versions I'm using. What I'm seeing is if I enter

This is a comment

the preview shows

T

What actually happens seems to depend on the number of lines and other things I don't understand.

I also just noticed that at the bottom of the input box, there are counters for lines, words, and something else. These aren't getting updated. In an incognito window, these are updated correctly.

Enabling withExEditor for a private window in Firefox shows the same broken behavior. The lines/words aren't being updated, and the preview is messed up.

I'll try to get a video of this soon.

rtoy commented 3 years ago

Here's a video using Firefox. Note that the lines/words never gets updated. This is different from when I use a private window where lines/words is updated and the preview shows what I typed.

https://user-images.githubusercontent.com/663356/103583287-53069a00-4e94-11eb-8163-96e29b6aaed7.mp4

asamuzaK commented 3 years ago

Confirmed

Note: It seems that sourceforge is using Ionaru/easy-markdown-editor: EasyMDE: A simple, beautiful, and embeddable JavaScript Markdown editor. Delightful editing for beginners and experts alike. Features built-in autosaving and spell checking.

EasyMDE Demo

But I don't see any issue when writing text in the demo site.

rtoy commented 3 years ago

You're right. The demos work just fine. I don't know what Sourceforge is doing that makes it not work for me. It seems unlikely they'll do anything since they closed the bug right after I mentioned that an incognito window worked.

rtoy commented 3 years ago

Some additional information. I forgot I had the Edit with Emacs extension on chrome. When I add the same extension for Firefox and try to edit a bug entry, the emacs buffer shows:

<pre class=" CodeMirror-line " role="presentation"><span role="presentation">asd asd asdf asdf as sadf </span></pre>

(The random asdf is stuff that I had already typed into the buffer.)

If enter test inside the <span>, and save it, the area has the text I entered. Bu preview doesn't include the new text. And when I try to edit in the buffer, the new text disappears.

Perhaps this is a hint as to why withExEditor isn't working.

rtoy commented 3 years ago

Some more info. When I inspect the element I see:

<div ... edit_contenteditable="true">
  <pre class=" CodeMirror-line " ...>
    <span role="presentation">asdf asdf</span>
  </pre>
...
</div>

There's a <pre> and <span> for each line. This differs from the EasyMDE Demo where the editable area is just a <textarea>.

So it's not just withExEditor that has a problem. Edit with Emacs is also confused, but at least I can enter things without mangling, but it can't edit the area either.

asamuzaK commented 3 years ago

Some notes

asamuzaK commented 3 years ago

So it's not just withExEditor that has a problem. Edit with Emacs is also confused, but at least I can enter things without mangling, but it can't edit the area either.

I don't know what SourceForge is doing internally, but first of all, I have no idea why it is conflicting with withExEditor. withExEditor adds some event listeners such as keydown and mousedown, but it only does the internal processing and does nothing on the actual web page.

asamuzaK commented 3 years ago

At the moment, the only workaround I can think of is to disable the extension on sourceforge.net. How does this sound?

asamuzaK commented 3 years ago

Try build

rtoy commented 3 years ago

First, thanks so much for looking in to this. I really appreciate it.

Disabling sourceforge.net is acceptable to me. And it works great. If I really need to, I can use Edit with Emacs, but I prefer withExEditor.

I am satisfied with this solution. Feel free to close this issue as fixed.

rtoy commented 3 years ago

Oops. Didn't mean to actually close this (because I said "close" in the comment?), but I'm satisfied with this solution.

asamuzaK commented 3 years ago

I think I found the cause. Reopened. I'll file another PR and a try build later.

asamuzaK commented 3 years ago

Try build

I think that you can now edit on sourceforge.net too.

asamuzaK commented 3 years ago

I have confirmed that the problem has been fixed. I'll merge the PR

rtoy commented 3 years ago

Sorry for not getting a chance to try out your fix sooner.

Thanks so much for fixing this. I can confirm that it works now.