Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
IIIF
Mirador
Mirador annotations
Commits
4fa60e2c
Commit
4fa60e2c
authored
4 years ago
by
Lutz Helm
Browse files
Options
Downloads
Patches
Plain Diff
Fix code style problems
parent
ccef1c36
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/SingleCanvasDialog.js
+25
-9
25 additions, 9 deletions
src/SingleCanvasDialog.js
src/plugins/miradorAnnotationPlugin.js
+19
-9
19 additions, 9 deletions
src/plugins/miradorAnnotationPlugin.js
with
44 additions
and
18 deletions
src/SingleCanvasDialog.js
+
25
−
9
View file @
4fa60e2c
...
@@ -8,23 +8,38 @@ import DialogTitle from '@material-ui/core/DialogTitle';
...
@@ -8,23 +8,38 @@ import DialogTitle from '@material-ui/core/DialogTitle';
import
Typography
from
'
@material-ui/core/Typography
'
;
import
Typography
from
'
@material-ui/core/Typography
'
;
import
PropTypes
from
'
prop-types
'
;
import
PropTypes
from
'
prop-types
'
;
/**
* Dialog to enforce single view for annotation creation / editing
*/
export
class
SingleCanvasDialog
extends
Component
{
export
class
SingleCanvasDialog
extends
Component
{
/** */
constructor
(
props
)
{
constructor
(
props
)
{
super
(
props
);
super
(
props
);
this
.
confirm
=
this
.
confirm
.
bind
(
this
);
this
.
confirm
=
this
.
confirm
.
bind
(
this
);
}
}
/** */
confirm
()
{
confirm
()
{
this
.
props
.
switchToSingleCanvasView
();
const
{
this
.
props
.
openCreateAnnotationCompanionWindow
();
handleClose
,
this
.
props
.
handleClose
();
openCreateAnnotationCompanionWindow
,
switchToSingleCanvasView
,
}
=
this
.
props
;
switchToSingleCanvasView
();
openCreateAnnotationCompanionWindow
();
handleClose
();
}
}
/** */
render
()
{
render
()
{
const
{
handleClose
,
open
,
}
=
this
.
props
;
return
(
return
(
<
Dialog
<
Dialog
onClose
=
{
this
.
props
.
hideDialog
}
onClose
=
{
handleClose
}
open
=
{
this
.
props
.
open
}
open
=
{
open
}
>
>
<
DialogTitle
disableTypography
>
<
DialogTitle
disableTypography
>
<
Typography
variant
=
"
h2
"
>
<
Typography
variant
=
"
h2
"
>
...
@@ -33,13 +48,14 @@ export class SingleCanvasDialog extends Component {
...
@@ -33,13 +48,14 @@ export class SingleCanvasDialog extends Component {
<
/DialogTitle
>
<
/DialogTitle
>
<
DialogContent
>
<
DialogContent
>
<
DialogContentText
variant
=
"
body2
"
color
=
"
inherit
"
>
<
DialogContentText
variant
=
"
body2
"
color
=
"
inherit
"
>
Annotations
can
only
be
edited
in
single
canvas
view
type
.
Switch
view
type
to
single
view
now
?
Annotations
can
only
be
edited
in
single
canvas
view
type
.
Switch
view
type
to
single
view
now
?
<
/DialogContentText
>
<
/DialogContentText
>
<
DialogActions
>
<
DialogActions
>
<
Button
onClick
=
{
this
.
confirm
}
variant
=
"
contained
"
>
<
Button
onClick
=
{
this
.
confirm
}
variant
=
"
contained
"
>
Switch
and
start
annotating
Switch
and
start
annotating
<
/Button
>
<
/Button
>
<
Button
onClick
=
{
this
.
props
.
handleClose
}
variant
=
"
contained
"
>
<
Button
onClick
=
{
handleClose
}
variant
=
"
contained
"
>
Cancel
Cancel
<
/Button
>
<
/Button
>
<
/DialogActions
>
<
/DialogActions
>
...
@@ -54,8 +70,8 @@ SingleCanvasDialog.propTypes = {
...
@@ -54,8 +70,8 @@ SingleCanvasDialog.propTypes = {
open
:
PropTypes
.
bool
,
open
:
PropTypes
.
bool
,
openCreateAnnotationCompanionWindow
:
PropTypes
.
func
.
isRequired
,
openCreateAnnotationCompanionWindow
:
PropTypes
.
func
.
isRequired
,
switchToSingleCanvasView
:
PropTypes
.
func
.
isRequired
,
switchToSingleCanvasView
:
PropTypes
.
func
.
isRequired
,
}
}
;
SingleCanvasDialog
.
defaultProps
=
{
SingleCanvasDialog
.
defaultProps
=
{
open
:
false
,
open
:
false
,
}
}
;
This diff is collapsed.
Click to expand it.
src/plugins/miradorAnnotationPlugin.js
+
19
−
9
View file @
4fa60e2c
...
@@ -6,7 +6,6 @@ import AddBoxIcon from '@material-ui/icons/AddBox';
...
@@ -6,7 +6,6 @@ import AddBoxIcon from '@material-ui/icons/AddBox';
import
{
MiradorMenuButton
}
from
'
mirador/dist/es/src/components/MiradorMenuButton
'
;
import
{
MiradorMenuButton
}
from
'
mirador/dist/es/src/components/MiradorMenuButton
'
;
import
{
SingleCanvasDialog
}
from
'
../SingleCanvasDialog
'
;
import
{
SingleCanvasDialog
}
from
'
../SingleCanvasDialog
'
;
/** */
/** */
class
MiradorAnnotation
extends
Component
{
class
MiradorAnnotation
extends
Component
{
/** */
/** */
...
@@ -30,15 +29,23 @@ class MiradorAnnotation extends Component {
...
@@ -30,15 +29,23 @@ class MiradorAnnotation extends Component {
});
});
}
}
/** */
toggleSingleCanvasDialogOpen
()
{
toggleSingleCanvasDialogOpen
()
{
const
{
singleCanvasDialogOpen
}
=
this
.
state
;
this
.
setState
({
this
.
setState
({
singleCanvasDialogOpen
:
!
this
.
state
.
singleCanvasDialogOpen
,
singleCanvasDialogOpen
:
!
singleCanvasDialogOpen
,
});
});
}
}
/** */
/** */
render
()
{
render
()
{
const
{
TargetComponent
,
targetProps
}
=
this
.
props
;
const
{
switchToSingleCanvasView
,
TargetComponent
,
targetProps
,
windowViewType
,
}
=
this
.
props
;
const
{
singleCanvasDialogOpen
}
=
this
.
state
;
return
(
return
(
<
div
>
<
div
>
<
TargetComponent
<
TargetComponent
...
@@ -46,18 +53,18 @@ class MiradorAnnotation extends Component {
...
@@ -46,18 +53,18 @@ class MiradorAnnotation extends Component {
/
>
/
>
<
MiradorMenuButton
<
MiradorMenuButton
aria
-
label
=
"
Create new annotation
"
aria
-
label
=
"
Create new annotation
"
onClick
=
{
this
.
props
.
windowViewType
===
'
single
'
?
this
.
openCreateAnnotationCompanionWindow
:
this
.
toggleSingleCanvasDialogOpen
}
onClick
=
{
windowViewType
===
'
single
'
?
this
.
openCreateAnnotationCompanionWindow
:
this
.
toggleSingleCanvasDialogOpen
}
size
=
"
small
"
size
=
"
small
"
>
>
<
AddBoxIcon
/>
<
AddBoxIcon
/>
<
/MiradorMenuButton
>
<
/MiradorMenuButton
>
{
{
this
.
state
.
singleCanvasDialogOpen
&&
(
singleCanvasDialogOpen
&&
(
<
SingleCanvasDialog
<
SingleCanvasDialog
open
=
{
this
.
state
.
singleCanvasDialogOpen
}
open
=
{
singleCanvasDialogOpen
}
handleClose
=
{
this
.
toggleSingleCanvasDialogOpen
}
handleClose
=
{
this
.
toggleSingleCanvasDialogOpen
}
openCreateAnnotationCompanionWindow
=
{
this
.
openCreateAnnotationCompanionWindow
}
openCreateAnnotationCompanionWindow
=
{
this
.
openCreateAnnotationCompanionWindow
}
switchToSingleCanvasView
=
{
this
.
props
.
switchToSingleCanvasView
}
switchToSingleCanvasView
=
{
switchToSingleCanvasView
}
/
>
/
>
)
)
}
}
...
@@ -68,11 +75,13 @@ class MiradorAnnotation extends Component {
...
@@ -68,11 +75,13 @@ class MiradorAnnotation extends Component {
MiradorAnnotation
.
propTypes
=
{
MiradorAnnotation
.
propTypes
=
{
addCompanionWindow
:
PropTypes
.
func
.
isRequired
,
addCompanionWindow
:
PropTypes
.
func
.
isRequired
,
switchToSingleCanvasView
:
PropTypes
.
func
.
isRequired
,
TargetComponent
:
PropTypes
.
oneOfType
([
TargetComponent
:
PropTypes
.
oneOfType
([
PropTypes
.
func
,
PropTypes
.
func
,
PropTypes
.
node
,
PropTypes
.
node
,
]).
isRequired
,
]).
isRequired
,
targetProps
:
PropTypes
.
object
.
isRequired
,
// eslint-disable-line react/forbid-prop-types
targetProps
:
PropTypes
.
object
.
isRequired
,
// eslint-disable-line react/forbid-prop-types
windowViewType
:
PropTypes
.
string
.
isRequired
,
};
};
/** */
/** */
...
@@ -81,10 +90,11 @@ const mapDispatchToProps = (dispatch, props) => ({
...
@@ -81,10 +90,11 @@ const mapDispatchToProps = (dispatch, props) => ({
actions
.
addCompanionWindow
(
props
.
targetProps
.
windowId
,
{
content
,
...
additionalProps
}),
actions
.
addCompanionWindow
(
props
.
targetProps
.
windowId
,
{
content
,
...
additionalProps
}),
),
),
switchToSingleCanvasView
:
()
=>
dispatch
(
switchToSingleCanvasView
:
()
=>
dispatch
(
actions
.
setWindowViewType
(
props
.
targetProps
.
windowId
,
'
single
'
)
actions
.
setWindowViewType
(
props
.
targetProps
.
windowId
,
'
single
'
)
,
)
)
,
});
});
/** */
const
mapStateToProps
=
(
state
,
props
)
=>
({
const
mapStateToProps
=
(
state
,
props
)
=>
({
windowViewType
:
getWindowViewType
(
state
,
{
windowId
:
props
.
targetProps
.
windowId
}),
windowViewType
:
getWindowViewType
(
state
,
{
windowId
:
props
.
targetProps
.
windowId
}),
});
});
...
...
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
register
or
sign in
to comment