Commit 9f7dbbcc authored by Alexandros Georgantas's avatar Alexandros Georgantas

Initial Commit

parents
# Editoria
## 1.3.0
#### Wax
* Search / find and replace
* Notes pane is hidden if there are no notes in the document
* Note callouts work with track changes
* Track changes previous / next navigation
* Copy / cut and paste works with track changes
* Indicator for how many items exist in a collapsed comment discussion
* Performance improvements
* Find and Replace a single match and undo throws an Error
* Undo / Redo Notes on certain Occasions throws an Error
* Opening an Empty Chapter Save is Enabled and modal is triggered if you try to go back without any change in the Editor
* if Track Changes is on, user cannot remove an image
* Remove additions on cut operation in track changes if done from the same user
* With track Changes on if you accept a deleted note and undo throws an error
* With track Changes on if you delete a whole paragraph and undo throws an error
* Navigate Through Notes with left and right arrow
* Toggle on /off Native Spell Checker
* Full screen mode
* Track Spaces
* Image Captions
* Change note icon in the toolbar
* Add keyboard shortcuts for accept & reject track changes
* Small Caps
#### Maintenance
* Switch to using yarn instead of npm by default
* React 16
* Upgrade to latest pubsweet client
* Clean up component prop types and refs
* Switch to Postgres
* Docker container for the DB provided via yarn start:services
## 1.2.0
* Upgrade to latest Pubsweet server, client, and components
* Introduce password reset
#### Book Builder
* Preview exported book in Vivliostyle Viewer
* Chapters keep track of their own numbering (independently from parts) in the Body
* Renaming of fragments has been removed in favour of using the title tag in Wax
* Drag and drop fixes
#### Wax Editor
* Can now style multiple blocks/paragraphs at once, including lists
* Keyboard shortcuts
* Turn track changes on/off => ctrl/cmd+y
* Hide / show tracked changes => ctrl/cmd+shift+y
* Comments => ctrl/cmd+m
* Save => ctrl/cmd+s
* New Title style (which will also rename the fragment in the book builder)
* New Subtitle style
* New Bibliography Entry style
* Revamped track changes UI: Tools are now in the toolbar instead of inline, and line height in the document has been reduced
* Surface doesn't lose focus any more unless the user clicks outside of Wax
* Paragraph indentation
## 1.1.4
#### Wax Editor
* Fix for unsaved changes warning
## 1.1.3
* New design for the book builder, the dashboard and the theme
#### Dashboard
* Renamed 'remove' button to 'delete' for consistency with the book builder
* Double clicking on a book will take you to the book builder for that book, instead of opening the renaming interface
* The position of 'Edit' and 'Rename' actions have been swapped ('Edit' now comes first)
* Books now appear in alphabetical order
#### Book Builder
* Fixed issue with fragments disappearing when uploading multiple files
* Renamed 'Front Matter' and 'Back Matter' to 'Frontmatter' and 'Backmatter'
#### Wax Editor
* Introduce layouts
* Accept configuration options (`layout` and `lockWhenEditing`)
* It is now broken down into separate modules for better separation of concerns
* Pubsweet integration
* React integration
* Core
* Diacritics work within notes
### Editoria 1.0, July 2017
Editoria was started as a collaboration between UCP and Coko, initial funding came from the Mellon Foundation.
Those involved in conceptualising, designing, and building Editoria (including the Wax Editor) from 0 to 1.0 include:
* Erich van Rijn
* Catherine Mitchell
* Kate Warne
* Cindy Fulton
* Lisa Schiff
* Justin Gonder
* Juliana Froggatt
* Adam Hyde
* Kristen Ratan
* Yannis Barlas
* Christos Kokosias
* Julien Taquet
* Alex Theg
* Alexandros Georgantas
* Giannis Kopanas
MIT License
Copyright (c) 2017 The Regents of the University of California
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
\ No newline at end of file
# Editoria
This is the Editoria Book Sprints monorepo.
It consists of the main Editoria application, as well as the different [Pubsweet](https://gitlab.coko.foundation/pubsweet) components and helper libraries that the app is made of.
This application is being developed by the [Coko Foundation](https://coko.foundation/), for the [University of California Press](http://www.ucpress.edu/).
For more information, visit the project's [website](https://editoria.pub/) or our [chat channel](https://mattermost.coko.foundation/coko/channels/editoria).
For the editor that Editoria uses, see its related project [Wax](https://gitlab.coko.foundation/wax/wax).
## Roadmap
The current features on our list are the following:
|Module |Description |In progress |Done |Issue|
|:---- |--- |:---: |:---: |:---:|
|**Current**|
|Editor |Copy Paste within the editor fix |✔ | | |
|Editor |Upgrade to latest Substance |✔ | | wax/wax#188|
|System |E2E Tests | | |#95, #96|
|BookBuilder |Create RFC for the chapters' reordering | | | #145 |
|Export |Notes at the end of the book | | | #78|
|System |Authsome mode for Book Sprints | ✔ | | #146|
|**Previous**|
|System | Edit Lock | |✔ | #117|
|System |Use docker containers for deployments | |✔ |#89|
|System |Logger | |✔ |#106|
|System |Env variables | |✔ |#104|
|System |Fix polling problem | |✔ |#132|
|Book builder |Redesign component state tool | |✔ |#55|
|Book builder |Drag and Drop perfomance issue | |✔ |#131|
|Book builder |Export EPUB | |✔ |#79|
|Book builder |Filenames for single uploads | |✔ |#112|
|Editor |Code Block | |✔ | wax/wax#174|
|Editor |Add ornament style | |✔ | wax/wax#178|
|Export |Fix links | |✔ | #100|
|Export |Fix image captions | |✔ | #113|
## Get up and running
Get your copy of the repository.
```sh
git clone https://gitlab.coko.foundation/editoria/editoria.git
cd editoria
```
Make sure you use you use `node >= 8.3`.
### nvm
To determine which version of Node you are running type `node -v`.
If the version is not 8.3 or greater you will need to use nvm to prescribe a specific node version. Installation of nvm is covered here https://github.com/creationix/nvm#installation
Once nvm is installed use the command `nvm install 8.3`
For further information on how to use nvm see https://www.sitepoint.com/quick-tip-multiple-versions-node-nvm/
### Install yarn
```sh
npm install -g yarn
```
You should also have `yarn 1.3.2` or higher installed (out-of-date versions may cause installation errors).
### Install Docker and docker-compose
Instalation instructions can be found:
* https://docs.docker.com/install/
* https://docs.docker.com/compose/install/
Prefer latest stable version of docker (18.x.x) and docker-compose (1.2x.x)
### Install Dependencies
Install all dependencies and navigate to the editoria app folder.
```sh
yarn
cd packages/editoria-app
```
Create a `config/local-development.json` file.
Edit that to enter your database secret, as well as to connect to [INK](https://gitlab.coko.foundation/INK/ink-api).
In this file, add the following:
```json
{
"pubsweet-server": {
"secret": "<your-secret-here>"
},
"pubsweet-component-ink-backend": {
"inkEndpoint": "< your-ink-api-endpoint >",
"email": "< your-ink-email >",
"password": "< your-ink-password >",
"recipes": {
"editoria-typescript": "< editoria-typescript-recipe-id >"
}
}
}
```
We recommend using a demo instance of INK hosted by Coko in your initial Editoria setup. Please contact the team on https://mattermost.coko.foundation/coko/channels/editoria in order to get the required credentials and information.
If you do want to run your own instance of [INK](https://gitlab.coko.foundation/INK/ink-api), be sure that:
* the `<your-ink-api-endpoint>` in `local-development.json` ends with a trailing slash
* if INK is running as a service on a port, ensure it is on port `3000`
* If INK and Editoria are on the same server, Editoria should be set to run on another port than `3000`, AND the `postgres` docker component for INK should run on a different port (`4321` instead of `5432`for instance).
Again, if you need to test editoria, asking for the credentials will be the fastest way to be set up.
Create environment files for each profile of the application under `editoria-app/config`.
eg. `editoria-app/config/development.env`
Within your environment files, export the variables you want:
```sh
export PUBSWEET_SECRET='' (*) (**)
export POSTGRES_USER='' (*) (***) (used by both docker-compose.yml and pubsweet server)
export POSTGRES_PASSWORD='' (*) (***) (by from both docker-compose.yml and pubsweet server)
export POSTGRES_HOST='' (-)
export POSTGRES_DB='' (*) (***) (used by both docker-compose.yml and pubsweet server)
export POSTGRES_PORT='' (*) (***) (used by both docker-compose.yml and pubsweet server)
export SERVER_PORT='' (**)
export INK_ENDPOINT='' (*) (**)
export INK_USERNAME='' (*) (**)
export INK_PASSWORD='' (*) (**)
export INK_EDITORIA_TYPESCRIPT='' (*) (**)
export MAILER_USER='' (*) (**)
export MAILER_PASSWORD='' (*) (**)
export MAILER_SENDER='' (*) (**)
export MAILER_HOSTNAME='' (*) (**)
export PASSWORD_RESET_URL='' (*) (**)
export PASSWORD_RESET_SENDER='' (*) (**)
export NODE_ENV='' (**)
```
(*)Required for the application to be functional
(-) Optional
(**) This key-value pairs could be either declared as env variables or either in the corresponding config file e.g. `local-development.json`, `development.json`, etc
(***) These fields should by any means exist in the env source file for the correct initialization of the docker container which holds the database of the application
Import the environment variables into the current shell session:
```sh
source <your-env-file>
```
Get the database docker container up and running:
```sh
yarn start:services
```
Create a database and enter credentials for an admin user account (a postgres db should already be up and running):
```sh
yarn resetdb
```
Follow the prompts to enter user credentials and complete the database setup.
_**Note**: If you want to use a non-default database, see [Pubsweet development setup](https://gitlab.coko.foundation/pubsweet/pubsweet/wikis/Development:%20setup#setup-2)._
You're good to go. Open a separate terminal in the same folder and run the app with:
```sh
yarn server
```
Clean your docker cache and containers before the first time you run the application (under editoria-app) or if changes occur in either env variables, docker-compose.yml, local-development, local-production, etc.:
```sh
docker-compose down
docker-compose rm -fv
rm -rf data
```
## Developer info
see also the [Pubsweet wiki](https://gitlab.coko.foundation/pubsweet/pubsweet/wikis/home) for developer notes.
## FAQ
### I'm getting user errors running `yarn start:services` or `yarn server`
It's crucial to use the same user when installing Editoria and running the Editoria database services. These commands are:
* Running `yarn` from Editoria's root directory. This installs Editoria and its dependencies
* Running `yarn start:server` for the first time sets up a database to use with Editoria. This configures a database that expects that the same user that is running this command has also run `yarn` from Editoria's root directory.
If you see user errors running `yarn start:services` or `yarn server`, your best bet is to clear the existing data and start the install anew, as the same user.
First, delete all the Docker data:
```
docker-compose down
docker-compose rm -fv
rm -rf data
```
Then, follow the steps for a clean install.
### When running `yarn start:services`, I get a `Bind for 0.0.0.0:5432 failed: port is already allocated` error
Something (probably postgres) is already running on the port that the Docker database services try to use (5432). Solution for Ubuntu:
1. `lsof -i tcp:5432`: lists the processes running on port 5432
2. `kill -9 {PID}`: kills (gracelessly) the process. Get the PID from the output of the above step.
This should free up the port so the Docker database services can run on it.
### I've made changes on my `<profile>.env` file, how can these changes be applied?
To be sure that your changes in `<profile>.env` are registered, you need to reset your docker containers and source `<your-env-file>`. To do so, you can follow these steps:
* Kill any running instances of Editoria app
* On editoria-app root folder perform:
```
docker-compose down
docker-compose rm -fv
```
`docker-compose down` will unmount the docker container
`docker-compose rm -fv` will remove the container and it's anonymous volumes.
`rm -rf data` will delete the content from your database
* Now you could run `source <your-env-file>` and start again the services and server
### Which are the absolute required key-value pairs for an env file?
* POSTGRES_USER
* POSTGRES_PASSWORD
* POSTGRES_DB
* POSTGRES_PORT
These values are needed in order the docker container which hosts the PostrgesDB of the application to be initialised correctly.
### I am facing issues when trying to boot-up the application which are related to INK API
Ink is the process manager developped by Coko. Editoria uses Ink mainly to convert Microsoft Word .docx into proper HTML to be used in Editoria (among other things).
Since it has been one of the requirements from the begginning, running Editoria means that you need to have access to an instance of INK before runnning it, thus the appropriate configuration should be in place in order for Editoria to start properly.
INK's configuration could either be placed in:
* `local.development.json`
* `development.json`
* `<profile>.env`
Please contact the team on https://mattermost.coko.foundation/coko/channels/editoria in order to get the required credentials
### How can I access the epub file?
EPUB files are created and stored in the `uploads` directory (`editoria/packages/editoria-app/uploads`) every time the book is exported with the "EXPORT BOOK" button on the top right of the book. Be sure to sort by created date to ensure you're getting the most recent file.
### Does the HTML out of Editoria support accessibility including the use of Alt tags?
We are working with Benetech to fully understand and plan for accessibility. This development is on our development roadmap.
### Does Editoria support multiple languages?
Yes. Editoria supports any language supported by the user’s browser. Editoria also supports special characters. This said, language support is an area that needs thorough testing for the many edge cases and rare cases that exist. This is an ideal opportunity for a community member to show leadership and help organize and optimize.
### Does Editoria include an asset manager for images and multimedia files that may need to be inserted into text?
This is on our development roadmap.
### Can Editoria integrate with other tools and services?
Yes. Editoria’s architecture is all API-orientated and can be easily extended for third party service integration. For more information, visit https://editoria.pub
### Can notes be moved to backmatter (rather than footnotes)?
At this moment no, but it is on the Editoria roadmap. Options will include same page, back of book, or margin notes.
### What’s the cost to use Editoria?
Using the code to create an instance of Editoria truly is free. Our hope is that organizations that find it useful, will contribute the customizations and additional development code back so that others can use it. We also hope that adopters will help organize and attend community gatherings and participate in discussion and problem solving with the community.
### Does Editoria generate and export EPUB3?
Yes, currently however it is not available via the user interface. This is on our development roadmap.
### Can Editoria export BITS XML (or other) for chapter files and books?
It can. The first conversion is from .docx to HTML, and from there, it’s up to presses to decide what to do with the highly structured, source HTML.
### Can I use Editoria for journals workflow?
It’s possible, but would not be ideal. Coko has developed an open-source tool that is optimized for journals workflow, called xPub. xPub, like Editoria, is modular, so that organizations can develop their own non-hardcoded workflows, mixing and matching modules that other organizations have developed and shared, or create and integrate their own. More at https://coko.foundation/use-cases/
\ No newline at end of file
{
"lerna": "2.4.0",
"packages": [
"packages/*"
],
"version": "independent"
}
{
"author": "Coko Foundation",
"description": "Monorepo grouping all the different parts of the Editoria project for the case of Book Sprints",
"devDependencies": {
"babel-eslint": "^8.0.3",
"babel-preset-es2015": "^6.24.1",
"eslint": "^4.13.1",
"eslint-config-pubsweet": "^0.0.6",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-jest": "^21.4.2",
"eslint-plugin-jsx-a11y": "^6.0.2",
"eslint-plugin-node": "^5.2.1",
"eslint-plugin-prettier": "^2.3.1",
"eslint-plugin-promise": "^3.6.0",
"eslint-plugin-react": "^7.4.0",
"eslint-plugin-standard": "^3.0.1",
"lerna": "^2.5.1",
"lint-staged": "^6.0.0",
"prettier": "^1.8.2",
"stylelint": "^8.2.0",
"stylelint-config-prettier": "^2.0.0",
"stylelint-config-pubsweet": "^0.0.3"
},
"license": "MIT",
"name": "editoria-booksprints-monorepo",
"private": true,
"repository": {
"type": "git",
"url": "git@gitlab.coko.foundation:editoria/booksprints.git"
},
"scripts": {
"bootstrap": "lerna bootstrap",
"clean": "lerna clean",
"publish": "lerna publish",
"updated": "lerna updated",
"test": "lerna run test"
},
"version": "0.0.0",
"dependencies": {
"babel-preset-stage-0": "^6.24.1"
},
"workspaces": [
"packages/*"
]
}
MIT License
Copyright (c) 2017 University of California Press
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
module.exports = {
frontend: {
components: [
() => require('./src/BookBuilder')
]
}
}
\ No newline at end of file
{
"name": "pubsweet-component-bookbuilder",
"version": "1.1.0",
"description": "",
"main": "index.js",
"scripts": {
"styleguide": "styleguidist server",
"styleguide:build": "styleguidist build",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"pubsweet-component",
"pubsweet-client"
],
"author": "",
"license": "ISC",
"dependencies": {
"axios": "^0.17.1",
"classnames": "^2.2.5",
"config": "^1.27.0",
"editoria-common": "^0.1.1",
"font-awesome": "4.7.0",
"lodash": "4.17.4",
"pubsweet-client": "^2.5.5",
"react": "^16.2.0",
"react-bootstrap": "0.32.1",
"react-dnd": "2.5.4",
"react-dnd-html5-backend": "2.5.4",
"react-dom": "^16.2.0",
"react-redux": "5.0.4",
"react-router-bootstrap": "0.24.4",
"react-router-dom": "4.2.2",
"redux": "3.7.2"
},
"devDependencies": {
"babel-core": "^6.26.0",
"babel-loader": "^7.1.2",
"babel-preset-env": "^1.6.0",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-2": "^6.24.1",
"enzyme": "^2.9.1",
"enzyme-to-json": "^1.5.1",
"file-loader": "^0.11.2",
"identity-obj-proxy": "^3.0.0",
"jest": "^20.0.4",
"node-sass": "^4.5.3",
"prop-types": "^15.5.10",
"react-addons-test-utils": "^15.6.0",
"react-styleguidist": "^6.0.24",
"react-test-renderer": "^15.6.1",
"sass-loader": "^6.0.6",
"sinon": "^2.3.6",
"sinon-as-promised": "^4.0.3",
"webpack": "^2.7.0",
"webpack-node-externals": "^1.6.0"
}
}
import React from 'react'
import PropTypes from 'prop-types'
import styles from './styles/bookBuilder.local.scss'
export default class AddButton extends React.Component {
constructor(props) {
super(props)
this._addGroup = this._addGroup.bind(this)
}
_addGroup() {
const { add, group } = this.props
add(group)
}
render() {
const { group } = this.props
return (
<button className={styles.sectionBtn} onClick={this._addGroup}>
<i className={styles.addBtnIcon} />
{`add ${group}`}
</button>
)
}
}
AddButton.propTypes = {
add: PropTypes.func.isRequired,
group: PropTypes.string.isRequired,
}
import _ from 'lodash'
import React from 'react'
import PropTypes from 'prop-types'
import { bindActionCreators } from 'redux'
import Authorize from 'pubsweet-client/src/helpers/Authorize'
import { connect } from 'react-redux'
// TODO -- clean up this import
import Actions from 'pubsweet-client/src/actions'
import Division from './Division'
import FileUploader from './FileUploader/FileUploader'
import DownloadEpub from './DownloadEpub/DownloadEpub'
import VivliostyleExporter from './ExportToVivliostyle/VivliostyleExporter'
import TeamManagerModal from './TeamManager/TeamManagerModal'
import styles from './styles/bookBuilder.local.scss'
// TODO -- this doesn't work if imported in the css files. why?
import './styles/fontAwesome.scss'
export class BookBuilder extends React.Component {
constructor(props) {
super(props)
this.toggleTeamManager = this.toggleTeamManager.bind(this)
// this.getRoles = this.getRoles.bind(this)
// this.isProductionEditor = this.isProductionEditor.bind(this)
// this.setProductionEditor = this.setProductionEditor.bind(this)
this.updateUploadStatus = this.updateUploadStatus.bind(this)
this.toggleModal = this.toggleModal.bind(this)
this.renderDivison = this.renderDivison.bind(this)
this.renderProductionEditors = this.renderProductionEditors.bind(this)
this.state = {
outerContainer: {},
showModal: false,
showTeamManager: false,
uploading: {},
}
}
componentWillMount() {
const {