substance / texture

A visual editor for research.
MIT License
1k stars 85 forks source link

Can't include images #991

Open cccaballero opened 6 years ago

cccaballero commented 6 years ago

Hi, there are some cases when I can't include images in the document, throwing the error:

Uncaught TypeError: Cannot read property 'appendChild' of null
    at _sessions.manifest.transaction.tx (PersistedDocumentArchive.js:48)
    at Transaction._recordChange (Transaction.js:75)
    at DocumentSession._recordChange (DocumentSession.js:96)
    at DocumentSession.transaction (DocumentSession.js:47)
    at TextureArchive.createFile (PersistedDocumentArchive.js:42)
    at files.map.file (ArticleAPI.js:447)
    at Array.map (<anonymous>)
    at ArticleAPI._insertFigures (ArticleAPI.js:446)
    at InsertFigureCommand.execute (InsertFigureCommand.js:11)
    at SchemaDrivenCommandManager.executeCommand (CommandManager.js:41)

This is an example of a failing XML:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving DTD v1.0 20120330//EN" "JATS-journalarchiving.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ali="http://www.niso.org/schemas/ali/1.0">
  <front>
    <article-meta>
      <title-group>
        <article-title>The title</article-title>
      </title-group>
      <pub-date date-type="pub" iso-8601-date="2018-10-09">
        <day>09</day>
        <month>10</month>
        <year>2018</year>
      </pub-date>
      <history>
        <date date-type="accepted" iso-8601-date="2018-10-24">
          <day>24</day>
          <month>10</month>
          <year>2018</year>
        </date>
      </history>
      <abstract>
        <p id="_p-1">The abstract</p>
      </abstract>
    </article-meta>
  </front>
  <body id="body">
    <sec id="heading-cc9754d3aa7b73b9b7d1271eac1793ca">
      <title>introduction</title>
      <p id="heading-71f5ac867ac898546f6a36b9230f454a" level="1">this is the intro</p>
      <p id="p-717b022ecaf4ee95d7e02d27e8017c6a" level="1">dfgdfgdfgdfg</p>
    </sec>
  </body>
  <back />
</article>
cccaballero commented 6 years ago

I have tracked the issue and is not related to the XML, it is related to the way the document is loaded, If I use the custom vfs I can include images without issues, but if i load the document from a dar server implementation, the error is present