Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
subugoe
emo
TIDO
Commits
a9197c7d
Commit
a9197c7d
authored
Jun 25, 2021
by
dindigala
Browse files
feat: annotations to display default order by appearance
parent
5028bffe
Pipeline
#206786
passed with stages
in 2 minutes and 46 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/components/annotations/annotations.vue
View file @
a9197c7d
...
...
@@ -98,7 +98,29 @@ export default {
return
[];
}
return
this
.
configuredAnnotations
.
filter
((
annotationCollection
)
=>
contentType
.
type
.
includes
(
annotationCollection
.
body
[
'
x-content-type
'
]));
const
output
=
this
.
configuredAnnotations
.
filter
((
annotationCollection
)
=>
contentType
.
type
.
includes
(
annotationCollection
.
body
[
'
x-content-type
'
]))
.
map
((
annotation
)
=>
({
...
annotation
,
transformed
:
this
.
stripId
(
annotation
.
strippedId
).
split
(
'
.
'
).
filter
((
x
)
=>
x
),
}))
.
sort
((
a
,
b
)
=>
b
.
transformed
.
length
-
a
.
transformed
.
length
);
if
(
!
output
.
length
)
{
return
[];
}
const
max
=
output
[
0
]?.
transformed
?.
length
||
0
;
return
output
.
map
((
x
)
=>
{
const
diff
=
max
-
x
.
transformed
.
length
;
if
(
diff
>
0
)
{
x
.
transformed
=
[...
x
.
transformed
,
...
new
Array
(
diff
).
fill
(
1
)].
join
(
''
);
}
else
{
x
.
transformed
=
x
.
transformed
.
join
(
''
);
}
return
x
;
}).
sort
((
a
,
b
)
=>
a
.
transformed
-
b
.
transformed
);
},
annotationTabConfig
()
{
return
this
.
config
?.
annotations
?.
tabs
||
{};
...
...
@@ -282,6 +304,10 @@ export default {
return
url
.
split
(
'
/
'
).
pop
();
},
stripId
(
val
)
{
return
val
.
replace
(
/
[^
.0-9
]
/g
,
''
);
},
toggle
(
annotation
)
{
annotation
.
status
=
!
annotation
.
status
;
...
...
src/index.template.html
View file @
a9197c7d
...
...
@@ -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
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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