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
d253f867
Commit
d253f867
authored
4 years ago
by
chris
Browse files
Options
Downloads
Patches
Plain Diff
render lists
parent
f5dc56a7
No related branches found
No related tags found
1 merge request
!201
Ui components
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
wax-prosemirror-components/src/components/specialCharacters/SpecialCharactersComponent.js
+22
-5
22 additions, 5 deletions
...omponents/specialCharacters/SpecialCharactersComponent.js
with
22 additions
and
5 deletions
wax-prosemirror-components/src/components/specialCharacters/SpecialCharactersComponent.js
+
22
−
5
View file @
d253f867
...
@@ -3,7 +3,7 @@ import React, { useRef, useState } from 'react';
...
@@ -3,7 +3,7 @@ import React, { useRef, useState } from 'react';
import
styled
from
'
styled-components
'
;
import
styled
from
'
styled-components
'
;
import
{
grid
}
from
'
@pubsweet/ui-toolkit
'
;
import
{
grid
}
from
'
@pubsweet/ui-toolkit
'
;
import
{
WaxContext
}
from
'
wax-prosemirror-core
'
;
import
{
WaxContext
}
from
'
wax-prosemirror-core
'
;
import
{
each
,
groupBy
,
map
}
from
'
lodash
'
;
import
{
groupBy
}
from
'
lodash
'
;
import
Icon
from
'
../../helpers/Icon
'
;
import
Icon
from
'
../../helpers/Icon
'
;
import
CharactersList
from
'
./CharactersList
'
;
import
CharactersList
from
'
./CharactersList
'
;
...
@@ -37,7 +37,7 @@ const SearchInput = styled.input`
...
@@ -37,7 +37,7 @@ const SearchInput = styled.input`
const
CharactersListComponent
=
styled
.
div
`
const
CharactersListComponent
=
styled
.
div
`
height: 150px;
height: 150px;
overflow-y: sroll;
overflow-y: s
c
roll;
`
;
`
;
const
LastUsedComponent
=
styled
.
div
``
;
const
LastUsedComponent
=
styled
.
div
``
;
...
@@ -45,10 +45,27 @@ const LastUsedComponent = styled.div``;
...
@@ -45,10 +45,27 @@ const LastUsedComponent = styled.div``;
const
SpecialCharactersComponent
=
({
close
})
=>
{
const
SpecialCharactersComponent
=
({
close
})
=>
{
const
searchRef
=
useRef
(
null
);
const
searchRef
=
useRef
(
null
);
const
[
searchValue
,
setSearchValue
]
=
useState
(
''
);
const
[
searchValue
,
setSearchValue
]
=
useState
(
''
);
const
G
roupedCharacters
=
groupBy
(
CharactersList
,
'
group
'
);
const
g
roupedCharacters
=
groupBy
(
CharactersList
,
'
group
'
);
const
onChange
=
()
=>
{
const
onChange
=
()
=>
{
setSearchValue
(
searchRef
.
current
.
value
);
setSearchValue
(
searchRef
.
current
.
value
);
console
.
log
(
GroupedCharacters
);
};
const
renderList
=
()
=>
{
const
lists
=
[];
Object
.
keys
(
groupedCharacters
).
forEach
(
key
=>
{
lists
.
push
(
<
div
key
=
{
key
}
>
{
key
}
<>
{
groupedCharacters
[
key
].
map
((
item
,
index
)
=>
{
return
<
div
>
{
item
.
unicode
}
<
/div>
;
})}
<
/
>
<
/div>
,
);
});
return
<
div
>
{
lists
}
<
/div>
;
};
};
return
(
return
(
...
@@ -60,7 +77,7 @@ const SpecialCharactersComponent = ({ close }) => {
...
@@ -60,7 +77,7 @@ const SpecialCharactersComponent = ({ close }) => {
value
=
{
searchValue
}
value
=
{
searchValue
}
onChange
=
{
onChange
}
onChange
=
{
onChange
}
/
>
/
>
<
CharactersListComponent
>
Characters
List
<
/CharactersListComponent
>
<
CharactersListComponent
>
{
render
List
()}
<
/CharactersListComponent
>
<
LastUsedComponent
>
Characters
Last
Used
<
/LastUsedComponent
>
<
LastUsedComponent
>
Characters
Last
Used
<
/LastUsedComponent
>
<
/Wrapper
>
<
/Wrapper
>
);
);
...
...
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