Skip to content
Snippets Groups Projects
Commit 2349fef4 authored by Christos's avatar Christos
Browse files

Merge branch 'fixes' into 'master'

Fixes

See merge request !177
parents 596d1cdc d15346b2
No related branches found
No related tags found
1 merge request!177Fixes
Showing
with 32 additions and 26 deletions
...@@ -47,7 +47,7 @@ const Editoria = () => ( ...@@ -47,7 +47,7 @@ const Editoria = () => (
// value={`<p class="paragraph">This is the first paragraph</p><p class="paragraph">This is the second paragraph</p><p class="author">This is an author</p>`} // value={`<p class="paragraph">This is the first paragraph</p><p class="paragraph">This is the second paragraph</p><p class="author">This is an author</p>`}
layout={EditoriaLayout} layout={EditoriaLayout}
// debug // debug
onChange={source => console.log(source)} // onChange={source => console.log(source)}
user={user} user={user}
/> />
</Fragment> </Fragment>
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"version": "0.0.20", "version": "0.0.20",
"description": "Wax prosemirror UI components", "description": "Wax prosemirror UI components",
"license": "MIT", "license": "MIT",
"main": "dist/index.js", "main": "index.js",
"files": [ "files": [
"dist" "dist"
], ],
......
...@@ -28,7 +28,7 @@ const Button = ({ view = {}, item }) => { ...@@ -28,7 +28,7 @@ const Button = ({ view = {}, item }) => {
return ( return (
<MenuButton <MenuButton
active={isActive} active={isActive || false}
disabled={isDisabled} disabled={isDisabled}
iconName={icon} iconName={icon}
label={label} label={label}
......
...@@ -112,6 +112,7 @@ export default ({ comment, top, commentId, recalculateTops }) => { ...@@ -112,6 +112,7 @@ export default ({ comment, top, commentId, recalculateTops }) => {
let minPos = comment.pos; let minPos = comment.pos;
allCommentsWithSameId.forEach(singleComment => { allCommentsWithSameId.forEach(singleComment => {
console.log(singleComment.pos);
const markPosition = DocumentHelpers.findMarkPosition( const markPosition = DocumentHelpers.findMarkPosition(
state, state,
singleComment.pos, singleComment.pos,
...@@ -120,9 +121,8 @@ export default ({ comment, top, commentId, recalculateTops }) => { ...@@ -120,9 +121,8 @@ export default ({ comment, top, commentId, recalculateTops }) => {
if (markPosition.from < minPos) minPos = markPosition.from; if (markPosition.from < minPos) minPos = markPosition.from;
if (markPosition.to > maxPos) maxPos = markPosition.to; if (markPosition.to > maxPos) maxPos = markPosition.to;
}); });
// if (allCommentsWithSameId.length > 1);
if (allCommentsWithSameId.length > 1) // maxPos += last(allCommentsWithSameId).node.nodeSize;
maxPos += last(allCommentsWithSameId).node.nodeSize;
dispatch(state.tr.removeMark(minPos, maxPos, commentMark)); dispatch(state.tr.removeMark(minPos, maxPos, commentMark));
activeView.focus(); activeView.focus();
}; };
......
...@@ -9,11 +9,13 @@ import { grid } from '@pubsweet/ui-toolkit'; ...@@ -9,11 +9,13 @@ import { grid } from '@pubsweet/ui-toolkit';
const Wrapper = styled.div` const Wrapper = styled.div`
font-size: 0; font-size: 0;
position: relative; position: relative;
z-index: 2;
`; `;
const DropWrapper = styled.div` const DropWrapper = styled.div`
margin-top: ${grid(1)}; margin-top: ${grid(1)};
position: absolute; position: absolute;
background: white;
`; `;
const Dropdown = props => { const Dropdown = props => {
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"version": "0.0.20", "version": "0.0.20",
"description": "Wax prosemirror core", "description": "Wax prosemirror core",
"license": "MIT", "license": "MIT",
"main": "dist/index.js", "main": "index.js",
"files": [ "files": [
"dist" "dist"
], ],
......
...@@ -52,7 +52,10 @@ export default props => { ...@@ -52,7 +52,10 @@ export default props => {
'main', 'main',
); );
if (debug) applyDevTools(view); if (debug) applyDevTools(view);
if (autoFocus) view.focus(); if (autoFocus)
setTimeout(() => {
view.focus();
});
return () => view.destroy(); return () => view.destroy();
} }
...@@ -61,7 +64,6 @@ export default props => { ...@@ -61,7 +64,6 @@ export default props => {
const dispatchTransaction = transaction => { const dispatchTransaction = transaction => {
const { TrackChange } = props; const { TrackChange } = props;
const tr = const tr =
TrackChange && TrackChange.enabled TrackChange && TrackChange.enabled
? trackedTransaction(transaction, view.state, user) ? trackedTransaction(transaction, view.state, user)
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"version": "0.0.20", "version": "0.0.20",
"description": "Wax prosemirror layouts", "description": "Wax prosemirror layouts",
"license": "MIT", "license": "MIT",
"main": "dist/index.js", "main": "index.js",
"files": [ "files": [
"dist" "dist"
], ],
......
...@@ -36,8 +36,7 @@ export default css` ...@@ -36,8 +36,7 @@ export default css`
} }
.ProseMirror .wax-selection-marker { .ProseMirror .wax-selection-marker {
background-color: ${th('colorPrimary')}; background-color: ${th('colorSelection')};
color: white;
} }
div[contenteditable='false'] { div[contenteditable='false'] {
...@@ -51,8 +50,9 @@ export default css` ...@@ -51,8 +50,9 @@ export default css`
text-align: center; text-align: center;
width: 17px; width: 17px;
height: 17px; height: 17px;
background: black; background: white;
color: white; border-bottom: 2px solid black;
color: black;
cursor: pointer; cursor: pointer;
} }
...@@ -207,7 +207,7 @@ export default css` ...@@ -207,7 +207,7 @@ export default css`
span.insertion { span.insertion {
color: royalblue; color: royalblue;
footnote: { footnote {
background: royalblue; background: royalblue;
} }
} }
...@@ -252,7 +252,7 @@ export default css` ...@@ -252,7 +252,7 @@ export default css`
.active-comment { .active-comment {
background-color: gold; background-color: gold;
color: black; /* color: black; */
} }
} }
`; `;
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"version": "0.0.20", "version": "0.0.20",
"description": "Wax prosemirror plugins", "description": "Wax prosemirror plugins",
"license": "MIT", "license": "MIT",
"main": "dist/index.js", "main": "index.js",
"files": [ "files": [
"dist" "dist"
], ],
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"version": "0.0.20", "version": "0.0.20",
"description": "Wax prosemirror schema", "description": "Wax prosemirror schema",
"license": "MIT", "license": "MIT",
"main": "dist/index.js", "main": "index.js",
"files": [ "files": [
"dist" "dist"
], ],
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"version": "0.0.20", "version": "0.0.20",
"description": "Wax prosemirror services", "description": "Wax prosemirror services",
"license": "MIT", "license": "MIT",
"main": "dist/index.js", "main": "index.js",
"files": [ "files": [
"dist" "dist"
], ],
......
...@@ -2,9 +2,7 @@ ...@@ -2,9 +2,7 @@
/* eslint react/prop-types: 0 */ /* eslint react/prop-types: 0 */
import React from 'react'; import React from 'react';
import { v4 as uuidv4 } from 'uuid';
import { map } from 'lodash'; import { map } from 'lodash';
import { ToolGroupComponent, ToolGroups } from 'wax-prosemirror-components';
const MainMenuBar = ({ items = [], view }) => { const MainMenuBar = ({ items = [], view }) => {
return <>{map(items, item => item.renderTools(view))}</>; return <>{map(items, item => item.renderTools(view))}</>;
......
import React from 'react'; import React from 'react';
import { injectable, inject } from 'inversify'; import { injectable, inject } from 'inversify';
import { BlockLevelTools, Tabs, ToolGroups } from 'wax-prosemirror-components'; import { BlockLevelTools, Tabs, ToolGroups } from 'wax-prosemirror-components';
import ToolGroup from '../../lib/ToolGroup';
import { isEmpty } from 'lodash'; import { isEmpty } from 'lodash';
import styled from 'styled-components'; import styled from 'styled-components';
import { v4 as uuidv4 } from 'uuid';
import ToolGroup from '../../lib/ToolGroup';
const Empty = styled.div` const Empty = styled.div`
background: khaki; background: khaki;
...@@ -49,7 +50,7 @@ class DisplayText extends ToolGroup { ...@@ -49,7 +50,7 @@ class DisplayText extends ToolGroup {
}; };
const tabList = [first, second]; const tabList = [first, second];
return <Tabs tabList={tabList} />; return <Tabs key={uuidv4()} tabList={tabList} />;
} }
} }
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"version": "0.0.20", "version": "0.0.20",
"description": "Wax prosemirror themes", "description": "Wax prosemirror themes",
"license": "MIT", "license": "MIT",
"main": "dist/index.js", "main": "index.js",
"files": [ "files": [
"dist" "dist"
], ],
......
...@@ -20,6 +20,7 @@ const cokoTheme = { ...@@ -20,6 +20,7 @@ const cokoTheme = {
colorTextPlaceholder: '#595959', colorTextPlaceholder: '#595959',
colorWarning: '#ffc107', colorWarning: '#ffc107',
colorBackgroundToolBar: '#D9D9D9', colorBackgroundToolBar: '#D9D9D9',
colorSelection: '#D3D3D3',
/* Text variables */ /* Text variables */
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"version": "0.0.20", "version": "0.0.20",
"description": "Wax prosemirror utilities", "description": "Wax prosemirror utilities",
"license": "MIT", "license": "MIT",
"main": "dist/index.js", "main": "index.js",
"files": [ "files": [
"dist" "dist"
], ],
......
...@@ -33,9 +33,11 @@ const setBlockType = (nodeType, attrs = {}) => { ...@@ -33,9 +33,11 @@ const setBlockType = (nodeType, attrs = {}) => {
const markActive = type => state => { const markActive = type => state => {
const { from, $from, to, empty } = state.selection; const { from, $from, to, empty } = state.selection;
return empty const mark = empty
? type.isInSet(state.storedMarks || $from.marks()) ? type.isInSet(state.storedMarks || $from.marks())
: state.doc.rangeHasMark(from, to, type); : state.doc.rangeHasMark(from, to, type);
if (mark) return true;
return false;
}; };
const blockActive = (nodeType, attrs = {}) => { const blockActive = (nodeType, attrs = {}) => {
......
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