Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #598 from substance/qc-mode
Preparations for QC mode
- Loading branch information
Showing
59 changed files
with
2,351 additions
and
626 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1 @@ | ||
// TODO: add index files for the other folders as well | ||
export * from './src/article/index' | ||
export * from './src/editor/index' | ||
export * from './src/reader/index' | ||
export * from './src/entities/index' | ||
|
||
export { default as Texture } from './src/Texture' | ||
export { default as RichTextInput } from './src/rich-text-input/RichTextInput' | ||
export { default as ArticleLoader } from './src/ArticleLoader' | ||
export { default as PubMetaLoader } from './src/PubMetaLoader' | ||
export { default as TextureArchive } from './src/TextureArchive' | ||
export { default as AppChrome } from './src/AppChrome' | ||
export { default as WebAppChrome } from './src/WebAppChrome' | ||
export { default as DesktopAppChrome } from './src/DesktopAppChrome' | ||
export { default as TextureWebApp } from './src/TextureWebApp' | ||
export { default as TextureDesktopApp } from './src/TextureDesktopApp' | ||
export { default as checkArchive } from './src/util/checkArchive' | ||
export { default as vfsSaveHook } from './src/util/vfsSaveHook' | ||
export * from './src/index' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,42 @@ | ||
import { Component } from 'substance' | ||
import EditorPackage from './editor/EditorPackage' | ||
import TextureArticleAPI from './article/TextureArticleAPI' | ||
import TextureConfigurator from './TextureConfigurator' | ||
import ArticlePackage from './article/ArticlePackage' | ||
|
||
// TODO: needs to be refactored to achieve a consistent structure. | ||
// Currently TextureReader is a modified version of this implementation | ||
// while editor/Editor.js is an AbstractWriter implementation. | ||
// TODO: this should incoporate the 'Project' stuff that we have in Stencila | ||
export default class Texture extends Component { | ||
|
||
constructor(...args) { | ||
constructor (...args) { | ||
super(...args) | ||
const archive = this.props.archive | ||
|
||
this.manuscriptSession = archive.getEditorSession('manuscript') | ||
const doc = this.manuscriptSession.getDocument() | ||
this.pubMetaDbSession = archive.getEditorSession('pub-meta') | ||
this.configurator = this.manuscriptSession.getConfigurator() | ||
this.api = new TextureArticleAPI( | ||
this.manuscriptSession, | ||
this.pubMetaDbSession, | ||
this.configurator.getModelRegistry() | ||
) | ||
|
||
// HACK: we need to expose referenceManager somehow, so it can be used in | ||
// the JATSExporter. We may want to consider including referenceManager in | ||
// TODO: Exporters should use the API instead | ||
doc.referenceManager = this.api.getReferenceManager() | ||
this.config = this._getConfiguration() | ||
} | ||
|
||
getChildContext() { | ||
// ATTENTION: in Stencila we had regressions, because TextureEditorPackage.Editor | ||
// is creating a different childContext which raises the chance for integration issues. | ||
// So try to keep this as minimal as possible and rather change | ||
// Editor.getChildContet() instead | ||
return { | ||
urlResolver: this.props.archive, | ||
api: this.api, | ||
configurator: this.getConfigurator(), | ||
pubMetaDbSession: this.pubMetaDbSession, | ||
referenceManager: this.api.getReferenceManager(), | ||
footnoteManager: this.api.getFootnoteManager(), | ||
figureManager: this.api.getFigureManager(), | ||
tableManager: this.api.getTableManager() | ||
render ($$) { | ||
const archive = this.props.archive | ||
let el = $$('div').addClass('sc-texture') | ||
|
||
// TODO: Texture will support multipled resources in future | ||
const ResourceComponent = this.config.getComponent('article') | ||
const config = this.config.getConfiguration('article') | ||
const articleSession = archive.getEditorSession('manuscript') | ||
const pubMetaDbSession = archive.getEditorSession('pub-meta') | ||
let props = { | ||
articleSession, | ||
pubMetaDbSession, | ||
config | ||
} | ||
} | ||
|
||
render($$) { | ||
let el = $$('div').addClass('sc-texture') | ||
el.append( | ||
$$(EditorPackage.Editor, { | ||
editorSession: this.manuscriptSession, | ||
pubMetaDbSession: this.pubMetaDbSession | ||
}) | ||
$$(ResourceComponent, props) | ||
) | ||
return el | ||
} | ||
|
||
getConfigurator() { | ||
return this.configurator | ||
} | ||
_getConfiguration () { | ||
let config = new TextureConfigurator() | ||
|
||
// TODO: in future we want to make this configurable (plugin framework) | ||
config.import(ArticlePackage) | ||
|
||
return config | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.