Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
wax-prosemirror
Manage
Activity
Members
Labels
Plan
Issues
34
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
2
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
wax
wax-prosemirror
Commits
26bf27a3
Commit
26bf27a3
authored
4 years ago
by
chris
Browse files
Options
Downloads
Patches
Plain Diff
rerender if notes change and delay in order to sync views
parent
b1085674
No related branches found
No related tags found
1 merge request
!190
Find and replace
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
editors/editoria/src/layout/EditoriaLayout.js
+21
-7
21 additions, 7 deletions
editors/editoria/src/layout/EditoriaLayout.js
wax-prosemirror-services/src/NoteService/Editor.js
+1
-1
1 addition, 1 deletion
wax-prosemirror-services/src/NoteService/Editor.js
with
22 additions
and
8 deletions
editors/editoria/src/layout/EditoriaLayout.js
+
21
−
7
View file @
26bf27a3
import
React
,
{
useContext
}
from
'
react
'
;
import
React
,
{
useContext
,
useState
,
useCallback
,
useEffect
}
from
'
react
'
;
import
styled
,
{
css
,
ThemeProvider
}
from
'
styled-components
'
;
import
PanelGroup
from
'
react-panelgroup
'
;
import
{
DocumentHelpers
}
from
'
wax-prosemirror-utilities
'
;
import
{
WaxContext
,
ComponentPlugin
}
from
'
wax-prosemirror-core
'
;
import
{
grid
,
th
}
from
'
@pubsweet/ui-toolkit
'
;
import
{
debounce
}
from
'
lodash
'
;
import
{
cokoTheme
}
from
'
../theme
'
;
import
EditorElements
from
'
./EditorElements
'
;
...
...
@@ -150,7 +150,7 @@ const onResizeEnd = arr => {
notesHeight
=
arr
[
1
].
size
;
};
const
has
Notes
=
main
=>
{
const
get
Notes
=
main
=>
{
const
notes
=
DocumentHelpers
.
findChildrenByType
(
main
.
state
.
doc
,
main
.
state
.
schema
.
nodes
.
footnote
,
...
...
@@ -170,8 +170,22 @@ const EditoriaLayout = ({ editor }) => {
view
:
{
main
},
}
=
useContext
(
WaxContext
);
const
notes
=
main
&&
hasNotes
(
main
);
const
showNotes
=
notes
&&
!!
notes
.
length
&&
notes
.
length
>
0
;
const
notes
=
main
&&
getNotes
(
main
);
const
[
hasNotes
,
setHasNotes
]
=
useState
(
notes
&&
!!
notes
.
length
&&
notes
.
length
>
0
,
);
const
showNotes
=
()
=>
{
setHasNotes
(
notes
&&
!!
notes
.
length
&&
notes
.
length
>
0
);
};
const
delayedShowedNotes
=
useCallback
(
setTimeout
(()
=>
showNotes
(),
100
),
[],
);
useEffect
(()
=>
{},
[
delayedShowedNotes
]);
return
(
<
ThemeProvider
theme
=
{
cokoTheme
}
>
...
...
@@ -190,7 +204,7 @@ const EditoriaLayout = ({ editor }) => {
direction
=
"
column
"
panelWidths
=
{[
{
size
:
surfaceHeight
,
resize
:
'
stretch
'
},
{
size
:
notesHeight
,
resize
:
'
stretch
'
},
{
size
:
notesHeight
,
resize
:
'
resize
'
},
]}
onResizeEnd
=
{
onResizeEnd
}
>
...
...
@@ -201,7 +215,7 @@ const EditoriaLayout = ({ editor }) => {
<
/CommentsContainer
>
<
/WaxSurfaceScroll
>
{
show
Notes
&&
(
{
has
Notes
&&
(
<
NotesAreaContainer
>
<
NotesContainer
id
=
"
notes-container
"
>
<
NotesArea
view
=
{
main
}
/
>
...
...
This diff is collapsed.
Click to expand it.
wax-prosemirror-services/src/NoteService/Editor.js
+
1
−
1
View file @
26bf27a3
...
...
@@ -19,7 +19,7 @@ export default ({ node, view }) => {
const
noteId
=
node
.
attrs
.
id
;
let
noteView
;
let
updateMainView
=
true
;
console
.
log
(
context
);
useEffect
(()
=>
{
noteView
=
new
EditorView
(
{
mount
:
editorRef
.
current
},
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment