Is there a way to preview comments?

post by Jan Christian Refsgaard (jan-christian-refsgaard) · 2021-05-10T09:26:32.706Z · LW · GW · No comments

This is a question post.

Contents

  Answers
    5 gjm
None
No comments

Is there a way to preview your comments?

I often find myself using latex in my comments and thus need to check off site that it renders before posting.

Answers

answer by gjm · 2021-05-10T10:22:52.432Z · LW(p) · GW(p)

In your profile settings there's a checkbox that switches between WYSIWYG and Markdown, and another that switches between two different WYSIWYG comment editors, one older and one newer. I am using the "new" WYSIWYG one, and it shows LaTeX just fine while composing. Obviously the pure-Markdown comment editor doesn't do that. I don't remember what the "old" WYSIWYG editor does.

However, the "new" WYSIWYG editor has annoying bugs (or perhaps interactions with quirks of my browser setup?) which mean that every now and then it will decide that hitting the space bar means it should throw away the most recently typed equation and everything after it in the paragraph, or move my cursor back to the start of the comment and make every letter I type a new paragraph. (I think both are the result of mishandling some internal error condition.)

I put up with these bugs because otherwise it behaves nicely and I hope that some day the bugs will be fixed; the new WYSIWYG comment editor is still kinda-new-ish. Your tolerance for bugs may differ from mine.

comment by habryka (habryka4) · 2021-05-10T17:12:16.842Z · LW(p) · GW(p)

However, the "new" WYSIWYG editor has annoying bugs (or perhaps interactions with quirks of my browser setup?) which mean that every now and then it will decide that hitting the space bar means it should throw away the most recently typed equation and everything after it in the paragraph, or move my cursor back to the start of the comment and make every letter I type a new paragraph. (I think both are the result of mishandling some internal error condition.)

I think these bugs should be fixed now, but if you still run into them, please let me know! I thought we had fixed these ~2-3 months ago.

Replies from: gjm
comment by gjm · 2021-05-10T17:50:55.059Z · LW(p) · GW(p)

I have definitely encountered them in the last week or two.

I just did the following test. After the line above, I entered [asterisk] [space] (so I'm now in a bullet point), some text, then ctrl-4 to enter the LaTeX editor, entered some mathematics, hit enter to get out of the LaTeX editor, and pressed the space bar.

At that point, in the console I got this:

JavaScript error: https://www.lesswrong.com/js/bundle.js?hash=76bd6cfc5754522a5be764349f9bfc9d497abf9fe5ca29ce4eb640ef47e1976f, line 139: CKEditorError: H is null
Read more: https://ckeditor.com/docs/ckeditor5/latest/framework/guides/support/error-codes.html#error-H is null

That's the console window in which I started my browser, not the browser's Javascript console. In the Javascript console I got "Editor crashed", then Uncaught CKEditorError: H is null // Read more: ..." and a kinda-traceback, then "Editor was restarted". But apparently once restarted it's a bit confused about its internal state. Here's the kinda-traceback:

init liststyleediting.js:215
fire emittermixin.js:209
_convertItem upcastdispatcher.js:249
convert upcastdispatcher.js:207
toModel datacontroller.js:414
_runPendingChanges model.js:830
change model.js:175
toModel datacontroller.js:413
_handleContainerChildrenMutations injecttypingmutationshandling.js:109
handle injecttypingmutationshandling.js:64
init injecttypingmutationshandling.js:22
fire emittermixin.js:209
_onMutations mutationobserver.js:249
o ckeditorerror.js:61
rethrowUnexpectedError ckeditorerror.js:117
fire emittermixin.js:244
_convertItem upcastdispatcher.js:249
convert upcastdispatcher.js:207
toModel datacontroller.js:414
_runPendingChanges model.js:830
change model.js:175
toModel datacontroller.js:413
_handleContainerChildrenMutations injecttypingmutationshandling.js:109
handle injecttypingmutationshandling.js:64
init injecttypingmutationshandling.js:22
fire emittermixin.js:209
_onMutations mutationobserver.js:249
_onMutations self-hosted:1173

(It's actually presented in table form, function names on the left, filenames and line numbers on the right.)

I get these all the time.

Replies from: habryka4
comment by habryka (habryka4) · 2021-05-10T18:32:28.019Z · LW(p) · GW(p)

Oh, interesting. That is a totally different bug from what I had encountered previously. Will look into it. Somehow I've never run into this.

Replies from: gjm
comment by gjm · 2021-05-10T23:49:56.068Z · LW(p) · GW(p)

So the trouble seems to be in liststyleediting.js, function upcastListItemStyle, which has a line

const listStyle = listParent.getStyle( 'list-style-type' ) || DEFAULT_LIST_TYPE

and at this point listParent is null. (It's called H after minification.) This is a list that isn't inside another list, so maybe it's correct that listParent is null (in which case the code should say something more like listParent && listParent.getStyle(...) || ... or, to be more modern about it, listParent?.getStyle?.(...) || ...); or maybe listParent is meant to be the whole paragraph or the whole comment or something, in which case the bug is in whatever made listParent be null.

(I don't know whether you are in a position to change the code -- I think you're using someone else's editor component -- so maybe this is no help. It might also be no help by being wrong :-).)

comment by Jan Christian Refsgaard (jan-christian-refsgaard) · 2021-05-10T10:52:29.767Z · LW(p) · GW(p)

Nice Thanks, now My only issue is this: I would prefer pure markdown for writing posts and the new WYSIWYG for commenting. But after playing with it it seems that it remember your settings for posts, so you can switch back before clicking create post, and then you are golden :). Thanks a lot

No comments

Comments sorted by top scores.