pkp/ots

Stabilize substance editor endpoints upstream

axfelix opened this issue · 10 comments

We have a Substance editor freeze from April 2016 which can be deployed alongside the stack and accessible via URLs of the form http://pkp-xml-demo.lib.sfu.ca/manager/editor/id/12345. We need to make these endpoints work for the upstream Substance framework editor called Texture (https://github.com/substance/texture), and implement sensible behaviour around saving changes to articles edited in Substance, as well as re-posting them to OTS as XML, particular in the context of the OJS3 plugin.

The current build of texture has a single "Save" icon:

substance-save

Re-processing an article through our stack from the XML stage onward isn't very costly -- the only libraries fired after that point in the workflow which take more than a couple seconds are the ePub transformation and Named Entity Recognition. Do we resubmit the article to the stack every time the Save icon is pressed? Would that also dismiss the editor and return to the job status page (or, if accessing the editor via OJS3, the submission status page)? Need to think about this.

substance editor integration required a new XML Store to handle read from server and write on save. (cf https://github.com/kaschioudi/texture/blob/xmlps/examples/XMLPSXMLStore.js)

After XML Store creation, update jats-editor package.js script to load the new XML Store (https://github.com/kaschioudi/texture/blob/9b67abbf5b1060335aba3e33bdff0c2fccee2f04/examples/jats-editor/package.js#L4).

Then execute npm run bundle to generate app.js and app.cs files. These files need to be copied into public/texture folder.

@axfelix : At this stage the editor loads document.xml correctly and updated xml is sent to the server on document save. Thereafter a new job is successfully launched. However, from my tests, the new job doesn't produce new document.xml. I saw that you made some changes back in July changing conversionStage from JOB_CONVERSION_STAGE_XML_MERGE to JOB_CONVERSION_STAGE_BIBTEXREFERENCES. Am I missing something?

I suspect that I accidentally broke the re-submitting a job at the XML stage as some part of these commits:

0dfeb4f
b08f811
8a07c2a

It's probably a small thing, I'll try to look into it soon.

Hm, just tested on master and it seems like resubmitting an XML file as a new job still works -- it doesn't produce a new document.xml because it assumes if you're submitting XML you're already past that stage. it produces HTML, ePub, PDF, and zips them all.

Was I misunderstanding the issue?

yes, everything works fine. However because document.xml is missing the "Revise" link is broken. Meaning no substance editor integration for jobs triggered on save.

Ah, I see. So we need to either rethink that interaction ... or just automatically populate the XML stage with the posted document.

also, I just noticed that images are not being displayed. in the console, you can see error log:
http://domain.com/manager/editor/id/media/image1.png 404 (Not Found)

should this should been look into at this stage?

Yup -- we'll want to address that. Any chance we can figure out some kind of URL rewrite solution so they can be retrieved from the links that substance expects them at?

I will go through the editor's source code to find out why the media path is missing job ids. Urls should be http://domain.com/manager/editor/id/**jobid**/media/image1.png .

Once this is addressed we could add a new route to respond to those requests. However, that also implies that these media files must be available on the server (extracted from html.zip archive) for all submissions.

Closing; working.