Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Style-preview: Add scroll buttons #11039

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering why this needed to be changed?

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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use margin-inline-start instead?

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;
Comment on lines +424 to +425
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The icons need white space to breath around them. Can we use -s instead?

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
29 changes: 29 additions & 0 deletions browser/src/control/Control.NotebookbarWriter.js
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,35 @@ 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',
},
{
'id': 'scroll-down',
'type': 'customtoolitem',
'text': _('Scroll down'),
'command': 'scrollpreviewdown',
'icon': 'lc_scrolltonext.svg',
},
{
'id': 'format-style-list-dialog',
'type': 'toolitem',
'text': _('Style list'),
'command': '.uno:SidebarDeck.StyleListDeck',
'icon': 'lc_morebutton.svg',
'accessibility': { focusBack: true, 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