Skip to content

Empty list item exception #451

Closed
Closed

Description

@fxha

Description

A list with empty list item text throws an exception.

Steps to reproduce

  1. Create a list with at least one empty list item. E.g:
- a

- 

- 

- d<cursor>
  1. Click on the empty list item in preview mode
  2. Check console error log

Expected behavior: [What you expected to happen]

No exception

Actual behavior: [What actually happened]

Uncaught TypeError: Cannot read property 'parentNode' of undefined
    at findNearestParagraph (domManipulate.js?596c:17)
    at Selection.getCursorRange (selection.js?eaba:771)
    at ContentState.updateState (updateCtrl.js?27d0:296)
    at HTMLDivElement.changeHandler (index.js?64a7:378)

Commit 486eb93

Versions

  • Mark Text: v0.10.25
  • OS: all

Activity

  1. added
    🐛 bug
    🐜 in progress
    on Aug 9, 2018
  2. self-assigned this
    on Aug 9, 2018
  3. added a commit that references this issue on Aug 10, 2018
  4. Jocs commented on Aug 12, 2018

    @Jocs
    Member

    @fxha For some reasons, I only had time on weekends to check the issues and review code. So thank you!

  5. added a commit that references this issue on Aug 12, 2018
  6. added
    🐝 resolved/fixed but not released
    and removed
    🐜 in progress
    on Aug 12, 2018
  7. stefnotch commented on Oct 25, 2018

    @stefnotch
    Contributor

    I can still reproduce this issue.

    Test document:

    ### Scheidung
    
    - Verschuldensscheidung
    
      - Varianten:
    
        - Allein
    
        - Ueberwiegendes
    
        - Gleichteilig
    
      - Siehe Pflichten
    
    - Zerruettungsscheidung
    
      - Krankheit
    
        - z.B. Ehemann wird zum Zombie, Ehemann wird sehr geisteskrank
    
      - Trennung 3/6 Jahre getrennt von einander leben
    
    - 
    
  8. fxha commented on Oct 25, 2018

    @fxha
    ContributorAuthor

    @stefnotch Yes, that's true when switching from source code mode back the span inside li is missing.

    Error message:

    dom.js?956f:26 Uncaught TypeError: Cannot read property 'parentNode' of undefined
        at findNearestParagraph (dom.js?956f:26)
        at Selection.getCursorRange (index.js?d47e:771)
        at ContentState.selectionChange (paragraphCtrl.js?6d3e:20)
        at setTimeout (keyboard.js?a29c:52)
    
  9. reopened this on Oct 25, 2018
  10. removed
    🐝 resolved/fixed but not released
    on Oct 25, 2018
  11. Jocs commented on Oct 25, 2018

    @Jocs
    Member

    @fxha @stefnotch This problem maybe caused by me, I have rewrite the importMarkdown function. I'll fixed asap.

  12. fxha commented on Oct 25, 2018

    @fxha
    ContributorAuthor

    @Jocs You can look at my PR #456. You have to detect a empty list item and add a empty span element.

  13. Jocs commented on Oct 25, 2018

    @Jocs
    Member

    @fxha Ok, Thanks!

  14. added 2 commits that reference this issue on Jun 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

🐛 bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions