The screenshot shows checklist items on mobile with a cursor stuck on a blank line between items - pressing Enter creates a paragraph gap instead of a seamless new checklist item. The issue is the <p><br></p> being inserted after each checklist item and the Enter handler creating gaps.
Now let me also check where the checklist is inserted (the initial insertHTML call):
I can see both problems:
<p><br></p> which creates a blank gap after the first checklist item<div> as a sibling, but there may be stray <p> elements left between items from the initial insertAlso, the cursor detection for checklistItem may not work when the cursor is inside the <p> between checklist items, which means pressing Enter there creates another default paragraph instead of a checklist item.
Now fix the Enter key handler so the new checklist item is placed directly after without any stray <p> gaps, and also skip any <p><br></p> elements between checklist items:
Now close the old handler properly - it was using a single function but now it's split. Let me fix the ending:
I've completely rewritten the checklist keyboard handling. Enter inside a checklist item now creates a seamless new item directly below without any blank <p> gaps in between -- it also cleans up stray paragraphs left over from earlier. Enter on an empty item breaks out of the checklist. Enter on a line between checklist items converts that line into a new checklist item. Backspace on an empty item removes it and moves the cursor back. The initial checklist insert now uses DOM manipulation instead of insertHTML so no trailing <p><br></p> is added, and the cursor is placed inside the text span using requestAnimationFrame for reliable mobile focusing.
I pulled the latest changes from v0/hendrabangun-eb13f56f in apple-notes.
You can send messages while the preview loads