Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
subugoe
emo
TIDO
Commits
5774ce05
Commit
5774ce05
authored
Jun 30, 2021
by
dindigala
Browse files
feat: highlight nested motifs that span over several lines in text panel
parent
8ae5732e
Pipeline
#208132
passed with stages
in 7 minutes and 4 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/components/annotations/annotations.vue
View file @
5774ce05
...
...
@@ -178,21 +178,6 @@ export default {
});
},
methods
:
{
highlightActiveTabContent
(
contentTypes
)
{
this
.
annotations
.
forEach
((
annotation
)
=>
{
const
id
=
this
.
stripAnnotationId
(
annotation
.
target
.
id
);
const
textElement
=
document
.
getElementById
(
id
);
if
(
textElement
!==
null
)
{
if
(
contentTypes
.
includes
(
annotation
.
body
[
'
x-content-type
'
]))
{
textElement
.
classList
.
add
(
'
annotation
'
,
'
annotation-disabled
'
);
}
else
{
textElement
.
classList
.
remove
(
'
annotation
'
);
textElement
.
classList
.
add
(
'
annotation-disabled
'
);
}
}
});
},
activeTab
(
key
,
types
)
{
this
.
currentTab
=
key
;
this
.
selectedAll
=
false
;
...
...
@@ -247,6 +232,48 @@ export default {
return
this
.
config
.
annotations
.
types
.
filter
((
annotation
)
=>
annotation
.
contenttype
===
contentType
)[
0
].
icon
;
},
highlightActiveTabContent
(
contentTypes
)
{
this
.
annotations
.
forEach
((
annotation
)
=>
{
const
id
=
this
.
stripAnnotationId
(
annotation
.
target
.
id
);
const
textElement
=
document
.
getElementById
(
id
);
if
(
textElement
)
{
const
next
=
textElement
.
getAttribute
(
'
data-next
'
);
const
hasContentType
=
contentTypes
.
includes
(
annotation
.
body
[
'
x-content-type
'
]);
if
(
hasContentType
)
{
textElement
.
classList
.
add
(
'
annotation
'
,
'
annotation-disabled
'
);
}
else
{
textElement
.
classList
.
remove
(
'
annotation
'
);
textElement
.
classList
.
add
(
'
annotation-disabled
'
);
}
if
(
next
)
{
this
.
highlightNestedMotifs
(
next
,
hasContentType
?
'
add
'
:
'
remove
'
,
'
add
'
);
}
}
});
},
highlightNestedMotifs
(
id
,
annotationOperation
,
annotationDisabledOperation
)
{
const
element
=
document
.
getElementById
(
id
.
replace
(
/#/g
,
''
));
if
(
!
element
)
{
return
;
}
element
.
classList
[
annotationOperation
](
'
annotation
'
);
element
.
classList
[
annotationDisabledOperation
](
'
annotation-disabled
'
);
const
nextId
=
element
.
getAttribute
(
'
data-next
'
);
if
(
!
nextId
)
{
return
;
}
this
.
highlightNestedMotifs
(
nextId
,
annotationOperation
,
annotationDisabledOperation
);
},
onHighlightAll
()
{
this
.
currentAnnotations
.
forEach
((
annotation
)
=>
this
.
updateToggleState
(
annotation
,
'
remove
'
,
'
add
'
));
...
...
@@ -321,6 +348,26 @@ export default {
document
.
getElementById
(
id
).
classList
[
text
](
'
annotation-disabled
'
);
document
.
getElementById
(
`list
${
id
}
`
).
classList
[
list
](
'
bg-grey-2
'
);
this
.
updateNestedMotifToggle
(
document
.
getElementById
(
id
).
getAttribute
(
'
data-next
'
),
text
);
},
updateNestedMotifToggle
(
id
,
annotationClassOperation
)
{
const
element
=
document
.
getElementById
(
id
.
replace
(
/#/g
,
''
));
if
(
!
element
)
{
return
;
}
element
.
classList
[
annotationClassOperation
](
'
annotation-disabled
'
);
const
nextId
=
element
.
getAttribute
(
'
data-next
'
);
if
(
!
nextId
)
{
return
;
}
this
.
updateNestedMotifToggle
(
nextId
,
annotationClassOperation
);
},
},
};
...
...
src/index.template.html
View file @
5774ce05
...
...
@@ -31,7 +31,7 @@
-->
<script
id=
"tido-config"
type=
"application/json"
>
{
"
entrypoint
"
:
""
,
"
entrypoint
"
:
"
https://ahikar-dev.sub.uni-goettingen.de/api/textapi/ahikar/arabic-karshuni/collection.json
"
,
"
annotations
"
:
{
"
show
"
:
true
,
"
types
"
:
[
...
...
Write
Preview
Supports
Markdown
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!
Cancel
Please
register
or
sign in
to comment