Skip to content
Snippets Groups Projects
Commit 9bf3c890 authored by Jure's avatar Jure
Browse files

Merge branch 'add_reviewer_wax' into 'main'

feat: add readonly Wax editor to the reviewer page

See merge request kotahi/kotahi!40
parents fc6e4678 52ea7775
No related branches found
No related tags found
No related merge requests found
...@@ -85,13 +85,11 @@ const ReviewLayout = ({ ...@@ -85,13 +85,11 @@ const ReviewLayout = ({
return ( return (
<Columns> <Columns>
<Manuscript> <Manuscript>
{/* <Manuscript>
<Tabs <Tabs
activeKey={editorSections[editorSections.length - 1].key} activeKey={editorSections[editorSections.length - 1].key}
sections={editorSections} sections={editorSections}
title="Versions" title="Versions"
/> />
</Manuscript> */}
<Tabs <Tabs
activeKey={reviewSections[reviewSections.length - 1].key} activeKey={reviewSections[reviewSections.length - 1].key}
......
...@@ -63,9 +63,6 @@ export const Info = styled.span` ...@@ -63,9 +63,6 @@ export const Info = styled.span`
export const EditorWrapper = styled.div` export const EditorWrapper = styled.div`
.wax-container { .wax-container {
position: relative; position: relative;
.main-editor {
margin: 3% 0 0 0;
}
} }
` `
......
...@@ -3,15 +3,15 @@ import { Wax } from 'wax-prosemirror-core' ...@@ -3,15 +3,15 @@ import { Wax } from 'wax-prosemirror-core'
import EditoriaLayout from './EditoriaLayout' import EditoriaLayout from './EditoriaLayout'
import { config } from './config' import { config } from './config'
const renderImage = file => { // const renderImage = file => {
const reader = new FileReader() // const reader = new FileReader()
return new Promise((resolve, reject) => { // return new Promise((resolve, reject) => {
reader.onload = () => resolve(reader.result) // reader.onload = () => resolve(reader.result)
reader.onerror = () => reject(reader.error) // reader.onerror = () => reject(reader.error)
// Some extra delay to make the asynchronicity visible // // Some extra delay to make the asynchronicity visible
setTimeout(() => reader.readAsDataURL(file), 150) // setTimeout(() => reader.readAsDataURL(file), 150)
}) // })
} // }
const user = { const user = {
userId: '1234', userId: '1234',
...@@ -23,8 +23,8 @@ const Editoria = ({ content, readonly }) => ( ...@@ -23,8 +23,8 @@ const Editoria = ({ content, readonly }) => (
<Wax <Wax
autoFocus autoFocus
config={config} config={config}
fileUpload={file => renderImage(file)} // fileUpload={file => renderImage(file)}
layout={EditoriaLayout} layout={EditoriaLayout(readonly)}
placeholder="Type Something..." placeholder="Type Something..."
readonly={readonly} readonly={readonly}
user={user} user={user}
......
import React from 'react' import React from 'react'
import styled from 'styled-components' import styled, { css } from 'styled-components'
import { InfoArea } from 'wax-prosemirror-components' import { InfoArea } from 'wax-prosemirror-components'
import { componentPlugin } from 'wax-prosemirror-services' import { componentPlugin } from 'wax-prosemirror-services'
import { th, grid } from '@pubsweet/ui-toolkit' import { th, grid } from '@pubsweet/ui-toolkit'
...@@ -15,8 +15,14 @@ const Layout = styled.div` ...@@ -15,8 +15,14 @@ const Layout = styled.div`
display: grid; display: grid;
grid-template-areas: 'menu' 'editor'; grid-template-areas: 'menu' 'editor';
grid-template-rows: 40px 1fr; ${props =>
// flex-direction: column; props.readonly
? css`
grid-template-rows: 0 1fr;
`
: css`
grid-template-rows: 40px 1fr;
`} // flex-direction: column;
// height: 100vh; // height: 100vh;
// width: 100hh; // width: 100hh;
` `
...@@ -70,7 +76,6 @@ const Menu = styled.div` ...@@ -70,7 +76,6 @@ const Menu = styled.div`
export const Container = styled.div` export const Container = styled.div`
background: ${th('colorBackgroundHue')}; background: ${th('colorBackgroundHue')};
padding: ${grid(2)};
` `
// const LeftSideBar = componentPlugin("leftSideBar"); // const LeftSideBar = componentPlugin("leftSideBar");
// const RightSideBar = componentPlugin("rightSideBar"); // const RightSideBar = componentPlugin("rightSideBar");
...@@ -79,15 +84,17 @@ const TopBar = componentPlugin('topBar') ...@@ -79,15 +84,17 @@ const TopBar = componentPlugin('topBar')
// const CommentsArea = componentPlugin("commentsArea"); // const CommentsArea = componentPlugin("commentsArea");
const WaxOverlays = componentPlugin('waxOverlays') const WaxOverlays = componentPlugin('waxOverlays')
const EditoriaLayout = ({ editor }) => ( const EditoriaLayout = readonly => ({ editor }) => (
// const { // const {
// view: { main }, // view: { main },
// } = useContext(WaxContext) // } = useContext(WaxContext)
<Container> <Container>
<Layout> <Layout readonly={readonly}>
<Menu> {!readonly && (
<TopBar /> <Menu>
</Menu> <TopBar />
</Menu>
)}
<Editor className="wax-surface-scroll">{editor}</Editor> <Editor className="wax-surface-scroll">{editor}</Editor>
</Layout> </Layout>
<InfoArea /> <InfoArea />
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment