Skip to content

Commit

Permalink
StylePreview: Add scroll buttons
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
Darshan-upadhyay1110 committed Jan 29, 2025
1 parent 5b86a3d commit a4490ad
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 1 deletion.
29 changes: 28 additions & 1 deletion browser/css/notebookbar.css
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ html[data-theme='dark'] .savemodified.unotoolbutton .unobutton img {
/* Styles preview */

#stylesview {
height: 64px;
height: 66px;
width: 35vw;
overflow: auto;
display: grid;
Expand All @@ -403,6 +403,33 @@ html[data-theme='dark'] .savemodified.unotoolbutton .unobutton img {
background-color: var(--color-stylesview-background);
filter: brightness(var(--brightness-stylesview));
box-sizing: border-box;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}

#stylesview-btn {
border: 1px solid var(--color-stylesview-border);
border-top-right-radius: var(--border-radius);
border-bottom-right-radius: var(--border-radius);
height: 66px;
margin-left: -5px;
box-sizing: border-box;
}

#stylesview-btn.vertical {
gap: 0;
}

#stylesview-btn button img {
width: var(--btn-img-size-m) !important;
height: var(--btn-img-size-m) !important;
box-sizing: border-box;
}

#stylesview-btn button {
width: var(--btn-size-s) !important;
height: var(--btn-size-s) !important;
padding: 0px 0px 4px !important;
}

#stylesview:hover {
Expand Down
31 changes: 31 additions & 0 deletions browser/src/control/Control.NotebookbarWriter.js
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,37 @@ L.Control.NotebookbarWriter = L.Control.Notebookbar.extend({
'entries': [],
'vertical': 'false'
},
{
'id': 'stylesview-btn',
'type': 'container',
'children': [
{
'id': 'scroll-up',
'type': 'customtoolitem',
'text': _('Scroll up'),
'command': 'scrollpreviewup',
'icon': 'lc_scrolltoprevious.svg',
'accessibility': { focusBack: true, combination: 'ZZ', de: 'ZZ' }
},
{
'id': 'scroll-down',
'type': 'customtoolitem',
'text': _('Scroll down'),
'command': 'scrollpreviewdown',
'icon': 'lc_scrolltonext.svg',
'accessibility': { focusBack: true, combination: 'O', de: 'W' }
},
{
'id': 'format-style-dialog',
'type': 'toolitem',
'text': _('Style list'),
'command': '.uno:SidebarDeck.StyleListDeck',
'icon': 'lc_morebutton.svg',
'accessibility': { focusBack: false, combination: 'SD', de: null }
},
],
'vertical': 'true'
},
{ type: 'separator', id: 'home-stylesview-break', orientation: 'vertical' },
{
'type': 'container',
Expand Down
16 changes: 16 additions & 0 deletions browser/src/docdispatcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,22 @@ class Dispatcher {
this.actionsMap['collapsenotebookbar'] = () => {
app.map.uiManager.collapseNotebookbar();
};

this.actionsMap['scrollpreviewup'] = () => {
const stylePreview = document.getElementById('stylesview');
stylePreview.scrollBy({
top: -stylePreview.offsetHeight,
behavior: 'smooth',
}); // Scroll up based on stylepreview height
};

this.actionsMap['scrollpreviewdown'] = () => {
const stylePreview = document.getElementById('stylesview');
stylePreview.scrollBy({
top: stylePreview.offsetHeight,
behavior: 'smooth',
}); // Scroll up based on stylepreview height
};
}

private addExportCommands() {
Expand Down

0 comments on commit a4490ad

Please sign in to comment.