Skip to content

Commit

Permalink
feat: add dropdownPlacement option to menubar
Browse files Browse the repository at this point in the history
  • Loading branch information
sibiraj-s committed May 1, 2021
1 parent 042eeea commit b0f2026
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
20 changes: 19 additions & 1 deletion projects/ngx-editor/src/lib/editor.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,12 @@ $menubar-text-padding: 0 $menu-item-spacing;
.NgxEditor__Dropdown--DropdownMenu {
position: absolute;
left: 0;
top: calc(#{$menubar-height} + 2px);
box-shadow: rgba(60, 64, 67, 0.15) 0px 2px 6px 2px;
border-radius: $border-radius;
background-color: #fff;
z-index: 10;
width: 100%;
top: calc(#{$menubar-height} + 2px);
}

.NgxEditor__Dropdown--Item {
Expand Down Expand Up @@ -218,6 +218,24 @@ $menubar-text-padding: 0 $menu-item-spacing;
}
}

.NgxEditor__MenuBar--Reverse {
.NgxEditor__Dropdown--DropdownMenu {
top: unset;
bottom: calc(#{$menubar-height} + 2px);
}

.NgxEditor__Dropdown--Text {
&::after {
transform: rotate(180deg);
}
}

.NgxEditor__Popup {
top: unset;
bottom: calc(#{$menubar-height} + 2px);
}
}

.NgxEditor__Popup {
$self: &;
position: absolute;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="NgxEditor__MenuBar" [ngClass]="{'NgxEditor--Disabled': disabled}">
<div class="NgxEditor__MenuBar" [ngClass]="{'NgxEditor--Disabled': disabled, 'NgxEditor__MenuBar--Reverse': dropdownPlacement === 'top'}">

<ng-container *ngFor="let toolbarItem of toolbar; let lastToolbarItem = last">
<ng-container *ngFor="let item of toolbarItem; let lastItem = last">
Expand Down
1 change: 1 addition & 0 deletions projects/ngx-editor/src/lib/modules/menu/menu.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export class MenuComponent implements OnInit {
@Input() disabled = false;
@Input() editor: Editor;
@Input() customMenuRef: TemplateRef<any> | null = null;
@Input() dropdownPlacement: 'top' | 'bottom' = 'top';

toggleCommands: any[] = [
'bold', 'italic',
Expand Down

0 comments on commit b0f2026

Please sign in to comment.