Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Mirador annotations
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Loïs Poujade
Mirador annotations
Commits
5c399437
Commit
5c399437
authored
May 14, 2020
by
Jack Reed
Browse files
Options
Downloads
Patches
Plain Diff
Add some basic styling around the anno creation form
parent
de826455
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/AnnotationCreation.js
+63
-24
63 additions, 24 deletions
src/AnnotationCreation.js
src/TextEditor.js
+28
-7
28 additions, 7 deletions
src/TextEditor.js
with
91 additions
and
31 deletions
src/AnnotationCreation.js
+
63
−
24
View file @
5c399437
import
React
,
{
Component
}
from
'
react
'
;
import
PropTypes
from
'
prop-types
'
;
import
Button
from
'
@material-ui/core/Button
'
;
import
Typography
from
'
@material-ui/core/Typography
'
;
import
Paper
from
'
@material-ui/core/Paper
'
;
import
Grid
from
'
@material-ui/core/Grid
'
;
import
ToggleButton
from
'
@material-ui/lab/ToggleButton
'
;
import
ToggleButtonGroup
from
'
@material-ui/lab/ToggleButtonGroup
'
;
import
RectangleIcon
from
'
@material-ui/icons/CheckBoxOutlineBlank
'
;
import
CircleIcon
from
'
@material-ui/icons/RadioButtonUnchecked
'
;
import
PolygonIcon
from
'
@material-ui/icons/Timeline
'
;
import
{
v4
as
uuid
}
from
'
uuid
'
;
import
{
withStyles
}
from
'
@material-ui/core/styles
'
;
import
AnnotationDrawing
from
'
./AnnotationDrawing
'
;
import
TextEditor
from
'
./TextEditor
'
;
import
WebAnnotation
from
'
./WebAnnotation
'
;
...
...
@@ -71,10 +75,10 @@ class AnnotationCreation extends Component {
/** */
render
()
{
const
{
parentactions
,
windowId
}
=
this
.
props
;
const
{
classes
,
parentactions
,
windowId
}
=
this
.
props
;
const
{
activeTool
}
=
this
.
state
;
return
(
<
div
>
<
Paper
className
=
{
classes
.
root
}
>
{
activeTool
&&
(
<
AnnotationDrawing
activeTool
=
{
activeTool
}
...
...
@@ -83,6 +87,13 @@ class AnnotationCreation extends Component {
/
>
)}
<
form
onSubmit
=
{
this
.
submitForm
}
>
<
Grid
container
>
<
Grid
item
xs
=
{
12
}
>
<
Typography
variant
=
"
overline
"
>
Target
<
/Typography
>
<
/Grid
>
<
Grid
item
xs
=
{
12
}
>
<
ToggleButtonGroup
value
=
{
activeTool
}
exclusive
...
...
@@ -100,9 +111,27 @@ class AnnotationCreation extends Component {
<
PolygonIcon
/>
<
/ToggleButton
>
<
/ToggleButtonGroup
>
<
/Grid
>
<
/Grid
>
<
Grid
container
>
<
Grid
item
xs
=
{
12
}
>
<
Typography
variant
=
"
overline
"
>
Style
<
/Typography
>
<
/Grid
>
<
/Grid
>
<
Grid
container
>
<
Grid
item
xs
=
{
12
}
>
<
Typography
variant
=
"
overline
"
>
Content
<
/Typography
>
<
/Grid
>
<
Grid
item
xs
=
{
12
}
>
<
TextEditor
updateAnnotationBody
=
{
this
.
updateBody
}
/
>
<
/Grid
>
<
/Grid
>
<
Button
onClick
=
{
parentactions
.
closeCompanionWindow
}
>
Cancel
<
/Button
>
...
...
@@ -110,15 +139,25 @@ class AnnotationCreation extends Component {
Save
<
/Button
>
<
/form
>
<
/
div
>
<
/
Paper
>
);
}
}
/** */
const
styles
=
(
theme
)
=>
({
root
:
{
padding
:
theme
.
spacing
(
1
),
},
});
AnnotationCreation
.
propTypes
=
{
canvases
:
PropTypes
.
arrayOf
(
PropTypes
.
shape
({
id
:
PropTypes
.
string
,
index
:
PropTypes
.
number
}),
),
classes
:
PropTypes
.
shape
({
root
:
PropTypes
.
string
,
}).
isRequired
,
config
:
PropTypes
.
shape
({
annotation
:
PropTypes
.
shape
({
adapter
:
PropTypes
.
func
,
...
...
@@ -137,4 +176,4 @@ AnnotationCreation.defaultProps = {
};
export
default
AnnotationCreation
;
export
default
withStyles
(
styles
)(
AnnotationCreation
)
;
This diff is collapsed.
Click to expand it.
src/TextEditor.js
+
28
−
7
View file @
5c399437
...
...
@@ -5,6 +5,7 @@ import ToggleButton from '@material-ui/lab/ToggleButton';
import
ToggleButtonGroup
from
'
@material-ui/lab/ToggleButtonGroup
'
;
import
BoldIcon
from
'
@material-ui/icons/FormatBold
'
;
import
ItalicIcon
from
'
@material-ui/icons/FormatItalic
'
;
import
{
withStyles
}
from
'
@material-ui/core/styles
'
;
import
{
stateToHTML
}
from
'
draft-js-export-html
'
;
/** */
...
...
@@ -22,7 +23,6 @@ class TextEditor extends Component {
onChange
(
editorState
)
{
const
{
updateAnnotationBody
}
=
this
.
props
;
this
.
setState
({
editorState
});
console
.
log
(
this
.
props
);
if
(
updateAnnotationBody
)
{
const
options
=
{
inlineStyles
:
{
...
...
@@ -52,6 +52,7 @@ class TextEditor extends Component {
/** */
render
()
{
const
{
classes
}
=
this
.
props
;
const
{
editorState
}
=
this
.
state
;
const
currentStyle
=
editorState
.
getCurrentInlineStyle
();
return
(
...
...
@@ -73,17 +74,37 @@ class TextEditor extends Component {
<
ItalicIcon
/>
<
/ToggleButton
>
<
/ToggleButtonGroup
>
<
div
className
=
{
classes
.
editorRoot
}
>
<
Editor
editorState
=
{
editorState
}
handleKeyCommand
=
{
this
.
handleKeyCommand
}
onChange
=
{
this
.
onChange
}
/
>
<
/div
>
<
/div
>
);
}
}
/** */
const
styles
=
(
theme
)
=>
({
editorRoot
:
{
borderColor
:
theme
.
palette
.
type
===
'
light
'
?
'
rgba(0, 0, 0, 0.23)
'
:
'
rgba(255, 255, 255, 0.23)
'
,
borderRadius
:
theme
.
shape
.
borderRadius
,
borderStyle
:
'
solid
'
,
borderWidth
:
1
,
fontFamily
:
theme
.
typography
.
fontFamily
,
marginBottom
:
theme
.
spacing
(
1
),
marginTop
:
theme
.
spacing
(
1
),
minHeight
:
theme
.
typography
.
fontSize
*
6
,
padding
:
theme
.
spacing
(
1
),
},
});
TextEditor
.
propTypes
=
{
classes
:
PropTypes
.
shape
({
editorRoot
:
PropTypes
.
string
,
}).
isRequired
,
updateAnnotationBody
:
PropTypes
.
func
,
};
...
...
@@ -91,4 +112,4 @@ TextEditor.defaultProps = {
updateAnnotationBody
:
()
=>
{},
};
export
default
TextEditor
;
export
default
withStyles
(
styles
)(
TextEditor
)
;
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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
sign in
to comment