Skip to content

Commit 00db001

Browse files
armanrahman22fnocera
authored andcommitted
Fix header and sidebar scrolling viewport
1 parent fa9ae3b commit 00db001

File tree

6 files changed

+27
-5
lines changed

6 files changed

+27
-5
lines changed

app/app/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@
211211
'rest_framework.permissions.IsAuthenticated',
212212
],
213213
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.LimitOffsetPagination',
214-
'PAGE_SIZE': 5,
214+
'PAGE_SIZE': env.int('DOCCANO_PAGE_SIZE', default=5),
215215
'DEFAULT_FILTER_BACKENDS': ('django_filters.rest_framework.DjangoFilterBackend',),
216216
'SEARCH_PARAM': 'q',
217217
'DEFAULT_RENDERER_CLASSES': (

app/server/static/assets/css/annotation.css

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,17 @@ body {
1212
border-right: 1px solid #DEDEDE;
1313
}
1414

15+
.scrollable {
16+
max-height: 60vh;
17+
overflow-y: auto;
18+
}
19+
20+
.sidebar-scrollable {
21+
max-height: 100vh;
22+
overflow-y: auto;
23+
overflow-x: hidden;
24+
}
25+
1526
.messages {
1627
display: block;
1728
background-color: #fff;

app/server/static/components/annotation.pug

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ div.columns(v-cloak="")
5555
div.main.pt0.pb0.pr20.pl20
5656
span About {{ count }} results
5757

58-
div.main
58+
div.main.sidebar-scrollable
5959
a.item(
6060
v-for="(doc, index) in docs"
6161
v-bind:class="{ active: index == pageNumber }"

app/server/static/components/annotationMixin.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@ export default {
6060
},
6161

6262
methods: {
63+
resetScrollbar() {
64+
const textbox = this.$refs.textbox;
65+
if (textbox) {
66+
textbox.scrollTop = 0;
67+
}
68+
},
69+
6370
async nextPage() {
6471
this.pageNumber += 1;
6572
if (this.pageNumber === this.docs.length) {
@@ -70,6 +77,8 @@ export default {
7077
} else {
7178
this.pageNumber = this.docs.length - 1;
7279
}
80+
} else {
81+
this.resetScrollbar();
7382
}
7483
},
7584

@@ -83,6 +92,8 @@ export default {
8392
} else {
8493
this.pageNumber = 0;
8594
}
95+
} else {
96+
this.resetScrollbar();
8697
}
8798
},
8899

app/server/static/components/document_classification.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ block annotation-area
3333
button.delete.is-small(v-on:click="removeLabel(annotation)")
3434

3535
hr
36-
div.content(v-if="docs[pageNumber]")
37-
span.text {{ docs[pageNumber].text }}
36+
div.content
37+
div.text.scrollable(ref="textbox", v-if="docs[pageNumber]") {{ docs[pageNumber].text }}
3838
</template>
3939

4040
<style scoped>

app/server/static/components/sequence_labeling.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ block annotation-area
2121
kbd {{ shortcutKey(label) | simpleShortcut }}
2222

2323
div.card-content
24-
div.content(v-if="docs[pageNumber] && annotations[pageNumber]")
24+
div.content.scrollable(v-if="docs[pageNumber] && annotations[pageNumber]", ref="textbox")
2525
annotator(
2626
v-bind:labels="labels"
2727
v-bind:entity-positions="annotations[pageNumber]"

0 commit comments

Comments
 (0)