Skip to content

Commit a4490ad

Browse files
StylePreview: Add scroll buttons
- added scroll up and down btn for stylepreview in notebookbar - added 'more' button option which is a toggle button opens the stylist Signed-off-by: Darshan-upadhyay1110 <[email protected]> Change-Id: I230ddefe3cb68dad3ba46b12eaabb12e99bad6db
1 parent 5b86a3d commit a4490ad

File tree

3 files changed

+75
-1
lines changed

3 files changed

+75
-1
lines changed

browser/css/notebookbar.css

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ html[data-theme='dark'] .savemodified.unotoolbutton .unobutton img {
387387
/* Styles preview */
388388

389389
#stylesview {
390-
height: 64px;
390+
height: 66px;
391391
width: 35vw;
392392
overflow: auto;
393393
display: grid;
@@ -403,6 +403,33 @@ html[data-theme='dark'] .savemodified.unotoolbutton .unobutton img {
403403
background-color: var(--color-stylesview-background);
404404
filter: brightness(var(--brightness-stylesview));
405405
box-sizing: border-box;
406+
border-top-right-radius: 0;
407+
border-bottom-right-radius: 0;
408+
}
409+
410+
#stylesview-btn {
411+
border: 1px solid var(--color-stylesview-border);
412+
border-top-right-radius: var(--border-radius);
413+
border-bottom-right-radius: var(--border-radius);
414+
height: 66px;
415+
margin-left: -5px;
416+
box-sizing: border-box;
417+
}
418+
419+
#stylesview-btn.vertical {
420+
gap: 0;
421+
}
422+
423+
#stylesview-btn button img {
424+
width: var(--btn-img-size-m) !important;
425+
height: var(--btn-img-size-m) !important;
426+
box-sizing: border-box;
427+
}
428+
429+
#stylesview-btn button {
430+
width: var(--btn-size-s) !important;
431+
height: var(--btn-size-s) !important;
432+
padding: 0px 0px 4px !important;
406433
}
407434

408435
#stylesview:hover {

browser/src/control/Control.NotebookbarWriter.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -832,6 +832,37 @@ L.Control.NotebookbarWriter = L.Control.Notebookbar.extend({
832832
'entries': [],
833833
'vertical': 'false'
834834
},
835+
{
836+
'id': 'stylesview-btn',
837+
'type': 'container',
838+
'children': [
839+
{
840+
'id': 'scroll-up',
841+
'type': 'customtoolitem',
842+
'text': _('Scroll up'),
843+
'command': 'scrollpreviewup',
844+
'icon': 'lc_scrolltoprevious.svg',
845+
'accessibility': { focusBack: true, combination: 'ZZ', de: 'ZZ' }
846+
},
847+
{
848+
'id': 'scroll-down',
849+
'type': 'customtoolitem',
850+
'text': _('Scroll down'),
851+
'command': 'scrollpreviewdown',
852+
'icon': 'lc_scrolltonext.svg',
853+
'accessibility': { focusBack: true, combination: 'O', de: 'W' }
854+
},
855+
{
856+
'id': 'format-style-dialog',
857+
'type': 'toolitem',
858+
'text': _('Style list'),
859+
'command': '.uno:SidebarDeck.StyleListDeck',
860+
'icon': 'lc_morebutton.svg',
861+
'accessibility': { focusBack: false, combination: 'SD', de: null }
862+
},
863+
],
864+
'vertical': 'true'
865+
},
835866
{ type: 'separator', id: 'home-stylesview-break', orientation: 'vertical' },
836867
{
837868
'type': 'container',

browser/src/docdispatcher.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,22 @@ class Dispatcher {
312312
this.actionsMap['collapsenotebookbar'] = () => {
313313
app.map.uiManager.collapseNotebookbar();
314314
};
315+
316+
this.actionsMap['scrollpreviewup'] = () => {
317+
const stylePreview = document.getElementById('stylesview');
318+
stylePreview.scrollBy({
319+
top: -stylePreview.offsetHeight,
320+
behavior: 'smooth',
321+
}); // Scroll up based on stylepreview height
322+
};
323+
324+
this.actionsMap['scrollpreviewdown'] = () => {
325+
const stylePreview = document.getElementById('stylesview');
326+
stylePreview.scrollBy({
327+
top: stylePreview.offsetHeight,
328+
behavior: 'smooth',
329+
}); // Scroll up based on stylepreview height
330+
};
315331
}
316332

317333
private addExportCommands() {

0 commit comments

Comments
 (0)