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
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
cd9140d3
Commit
cd9140d3
authored
1 year ago
by
Antoine Roy
Browse files
Options
Downloads
Patches
Plain Diff
add close annotation pannel function to plugin's context and start implementing some logic
parent
0a33481c
No related branches found
No related tags found
No related merge requests found
Pipeline
#1795
failed
1 year ago
Stage: test
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/CanvasListItem.js
+26
-2
26 additions, 2 deletions
src/CanvasListItem.js
src/plugins/canvasAnnotationsPlugin.js
+8
-1
8 additions, 1 deletion
src/plugins/canvasAnnotationsPlugin.js
with
34 additions
and
3 deletions
src/CanvasListItem.js
+
26
−
2
View file @
cd9140d3
...
@@ -6,6 +6,7 @@ import ToggleButton from '@mui/material/ToggleButton';
...
@@ -6,6 +6,7 @@ import ToggleButton from '@mui/material/ToggleButton';
import
ToggleButtonGroup
from
'
@mui/material/ToggleButtonGroup
'
;
import
ToggleButtonGroup
from
'
@mui/material/ToggleButtonGroup
'
;
import
flatten
from
'
lodash/flatten
'
;
import
flatten
from
'
lodash/flatten
'
;
import
AnnotationActionsContext
from
'
./AnnotationActionsContext
'
;
import
AnnotationActionsContext
from
'
./AnnotationActionsContext
'
;
import
*
as
actions
from
"
mirador/dist/es/src/state/actions
"
;
/** */
/** */
class
CanvasListItem
extends
Component
{
class
CanvasListItem
extends
Component
{
...
@@ -15,6 +16,9 @@ class CanvasListItem extends Component {
...
@@ -15,6 +16,9 @@ class CanvasListItem extends Component {
this
.
state
=
{
this
.
state
=
{
isHovering
:
false
,
isHovering
:
false
,
isEditAnnotationPanelOpen
:
false
,
id
:
""
,
payload
:{}
};
};
this
.
handleMouseHover
=
this
.
handleMouseHover
.
bind
(
this
);
this
.
handleMouseHover
=
this
.
handleMouseHover
.
bind
(
this
);
...
@@ -37,7 +41,7 @@ class CanvasListItem extends Component {
...
@@ -37,7 +41,7 @@ class CanvasListItem extends Component {
/** */
/** */
handleEdit
()
{
handleEdit
()
{
const
{
const
{
addCompanionWindow
,
canvases
,
annotationsOnCanvases
,
addCompanionWindow
,
canvases
,
annotationsOnCanvases
,
closeCompanionWindow
}
=
this
.
context
;
}
=
this
.
context
;
const
{
annotationid
}
=
this
.
props
;
const
{
annotationid
}
=
this
.
props
;
let
annotation
;
let
annotation
;
...
@@ -51,10 +55,28 @@ class CanvasListItem extends Component {
...
@@ -51,10 +55,28 @@ class CanvasListItem extends Component {
}
}
return
(
annotation
);
return
(
annotation
);
});
});
addCompanionWindow
(
'
annotationCreation
'
,
{
console
.
log
(
'
closeCompanionWindow
'
,
closeCompanionWindow
)
console
.
log
(
'
this props
'
,
this
.
props
)
console
.
log
(
'
this context
'
,
this
.
context
)
if
(
!
this
.
state
.
isEditAnnotationPanelOpen
){
const
myAnnotationPannel
=
addCompanionWindow
(
'
annotationCreation
'
,
{
annotationid
,
annotationid
,
position
:
'
right
'
,
position
:
'
right
'
,
});
});
this
.
setState
({
isEditAnnotationPanelOpen
:
true
})
this
.
setState
({
id
:
myAnnotationPannel
.
id
})
this
.
setState
({
payload
:
myAnnotationPannel
.
payload
})
}
else
{
closeCompanionWindow
(
this
.
state
.
id
)
this
.
setState
({
creationAnnotationIsOpen
:
false
})
const
myAnnotationPannel
=
addCompanionWindow
(
'
annotationCreation
'
,
{
annotationid
,
position
:
'
right
'
,
});
this
.
setState
({
isEditAnnotationPanelOpen
:
true
})
this
.
setState
({
id
:
myAnnotationPannel
.
id
})
this
.
setState
({
payload
:
myAnnotationPannel
.
payload
})
}
}
}
/** */
/** */
...
@@ -137,8 +159,10 @@ CanvasListItem.propTypes = {
...
@@ -137,8 +159,10 @@ CanvasListItem.propTypes = {
PropTypes
.
func
,
PropTypes
.
func
,
PropTypes
.
node
,
PropTypes
.
node
,
]).
isRequired
,
]).
isRequired
,
closeCompanionWindow
:
PropTypes
.
func
.
isRequired
,
};
};
CanvasListItem
.
contextType
=
AnnotationActionsContext
;
CanvasListItem
.
contextType
=
AnnotationActionsContext
;
export
default
forwardRef
((
props
,
ref
)
=>
<
CanvasListItem
{...
props
}
containerRef
=
{
ref
}
/>
)
;
export
default
forwardRef
((
props
,
ref
)
=>
<
CanvasListItem
{...
props
}
containerRef
=
{
ref
}
/>
)
;
This diff is collapsed.
Click to expand it.
src/plugins/canvasAnnotationsPlugin.js
+
8
−
1
View file @
cd9140d3
...
@@ -30,7 +30,7 @@ class CanvasAnnotationsWrapper extends Component {
...
@@ -30,7 +30,7 @@ class CanvasAnnotationsWrapper extends Component {
render
()
{
render
()
{
const
{
const
{
addCompanionWindow
,
annotationsOnCanvases
,
canvases
,
config
,
receiveAnnotation
,
addCompanionWindow
,
annotationsOnCanvases
,
canvases
,
config
,
receiveAnnotation
,
switchToSingleCanvasView
,
TargetComponent
,
targetProps
,
windowViewType
,
containerRef
,
switchToSingleCanvasView
,
TargetComponent
,
targetProps
,
windowViewType
,
containerRef
,
closeCompanionWindow
}
=
this
.
props
;
}
=
this
.
props
;
const
{
singleCanvasDialogOpen
}
=
this
.
state
;
const
{
singleCanvasDialogOpen
}
=
this
.
state
;
...
@@ -51,6 +51,7 @@ class CanvasAnnotationsWrapper extends Component {
...
@@ -51,6 +51,7 @@ class CanvasAnnotationsWrapper extends Component {
toggleSingleCanvasDialogOpen
:
this
.
toggleSingleCanvasDialogOpen
,
toggleSingleCanvasDialogOpen
:
this
.
toggleSingleCanvasDialogOpen
,
windowId
:
targetProps
.
windowId
,
windowId
:
targetProps
.
windowId
,
windowViewType
,
windowViewType
,
closeCompanionWindow
}}
}}
>
>
<
TargetComponent
<
TargetComponent
...
@@ -92,6 +93,8 @@ CanvasAnnotationsWrapper.propTypes = {
...
@@ -92,6 +93,8 @@ CanvasAnnotationsWrapper.propTypes = {
]).
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
,
windowViewType
:
PropTypes
.
string
.
isRequired
,
closeCompanionWindow
:
PropTypes
.
func
.
isRequired
,
};
};
CanvasAnnotationsWrapper
.
defaultProps
=
{
CanvasAnnotationsWrapper
.
defaultProps
=
{
...
@@ -117,6 +120,7 @@ function mapStateToProps(state, { targetProps: { windowId } }) {
...
@@ -117,6 +120,7 @@ function mapStateToProps(state, { targetProps: { windowId } }) {
config
:
state
.
config
,
config
:
state
.
config
,
windowViewType
:
getWindowViewType
(
state
,
{
windowId
}),
windowViewType
:
getWindowViewType
(
state
,
{
windowId
}),
};
};
}
}
/** */
/** */
...
@@ -130,6 +134,9 @@ const mapDispatchToProps = (dispatch, props) => ({
...
@@ -130,6 +134,9 @@ const mapDispatchToProps = (dispatch, props) => ({
switchToSingleCanvasView
:
()
=>
dispatch
(
switchToSingleCanvasView
:
()
=>
dispatch
(
actions
.
setWindowViewType
(
props
.
targetProps
.
windowId
,
'
single
'
),
actions
.
setWindowViewType
(
props
.
targetProps
.
windowId
,
'
single
'
),
),
),
closeCompanionWindow
:
(
id
)
=>
dispatch
(
actions
.
removeCompanionWindow
(
props
.
targetProps
.
windowId
,
id
),
)
});
});
export
default
{
export
default
{
...
...
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