substance/lens

Name: lens

Owner: Substance

Description: Lens - open science content creation and display

Created: 2015-06-25 22:48:40.0

Updated: 2018-01-17 15:13:18.0

Pushed: 2016-09-09 10:15:03.0

Homepage: http://substance.io/lens

Size: 2336

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

No longer maintained. Use http://github.com/substance/texture instead.

Lens (editable edition)

This is an evolution of eLife Lens, developed by Substance. It comes with a Writer component for web-based authoring and a new Reader component for displaying of scientific content.

Read about the backgrounds of this project:

Important note: This project is at an experimental state. It is also not compatible with JATS/NLM at this stage, as it reads a simplified custom XML format. We will add support for JATS import + export at a later time.

Install dev version

Clone the repository.

t clone https://github.com/substance/lens.git

Navigate to the source directory.

 lens

Install dependencies via npm

m install

Start the dev server

m run start

And navigate to http://localhost:5000

To create a new demo bundle do this:

m run bundle
Usage

To embed Lens Reader:

LensReader = require('lens/LensReader');
LensArticle = require('lens/model/LensArticle');
Component = require('substance/ui/component');
$$ = Component.$$;

doc = LensArticle.fromXml(LENS_XML);

onent.mount($$(LensReader, {
c: doc
document.body);

To embed Lens Writer:

LensWriter = require('lens/LensWriter');
LensArticle = require('lens/model/LensArticle');
Component = require('substance/ui/component');
$$ = Component.$$;

doc = LensArticle.fromXml(LENS_XML);

onent.mount($$(LensWriter, {
c: doc,
UploadFile: function(file, cb) {
console.log('custom file upload handler in action...');
var fileUrl = window.URL.createObjectURL(file);
cb(null, fileUrl);  

Save: function(doc, changes, cb) {
console.log('custom save handler in action...', doc.toXml());
cb(null);

document.body);

Make sure to also include the stylesheets into your app. We provide entry points at styles/lens-writer.sass and styles/lens-reader.sass. Lens requires a module bundler, such as Browserify or Webpack.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.