linkeddata / dokieli

:bulb: dokieli is a clientside editor for decentralised article publishing, annotations and social interactions
https://dokie.li/
Other
793 stars 81 forks source link

JavaScript type error when trying to mark as header (H2, H3, H4) #203

Open ldibanyez opened 7 years ago

ldibanyez commented 7 years ago

Document stored in Databox (). When trying to mark as header (any of H2, H3, H4 buttons in the contextual menu) a highlighted excerpt of text, JavaScript type error is thrown. Tested on Firefox 54 and Chrome 59 on Ubuntu 16 64-bit. The errors are slightly differently phrased depending on the developer tool of the browser, but both refer to the same line in do.js:

Chrome:

Uncaught TypeError: Cannot read property 'length' of undefined
    at c.handleClick (do.js:5129)
handleClick @ do.js:5129

Firefox:

TypeError: parentSection.childNodes is undefined[Learn More] do.js:5129:37
    handleClick https://ldibanyez.databox.me/papers/scripts/do.js:5129:37
    bound handleClick self-hosted:913:17

All other buttons (italics, code, etc) work well. I tried the MediumEditor frontpage (http://yabwe.github.io/medium-editor/) and there I can change headers.

csarven commented 5 years ago

Ah.. so I suppose we should look into this 'soon' :)

To be clear, this issue occurs on new documents without any content.

Placing the following HTML inside the primary <article> is a temporary workaround ( from https://gitter.im/linkeddata/dokieli?at=5bff05ddcb32736b29ab2083 ) for this issue:

<h1 property="schema:name">Foo bar baz</h1>
<section id="introduction" rel="schema:hasPart" resource="#introduction">
  <h2 property="schema:name">Introduction</h2>
  <div datatype="rdf:HTML" property="schema:description">
    <p>Hello world!</p> 
  </div>
</section>

We need better handling of the headings in MediumEditor. Related issue is https://github.com/linkeddata/dokieli/issues/271

white-gecko commented 5 years ago

Since this issue is not yet fixed I just add my remarks. Tell me, if this is a new issue.

When I try to make some selected text "h2" I get the following message in the js console of firefox:

TypeError: i.childNodes is undefined[Weitere Informationen]
bootstrap:12
handleClick
bootstrap:12
handleClick self-hosted:977:17 

I'm using firefox 60. This happens when I create a new document with https://dokie.li/new