Skip to content

Commit bbc659d

Browse files
committed
feat: improve for drag and drop
1 parent d6dabf7 commit bbc659d

File tree

6 files changed

+37
-43
lines changed

6 files changed

+37
-43
lines changed
Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +0,0 @@
1-
2-
.suggestions-menu {
3-
z-index: 100000;
4-
}

src/ui/block-note-editor/_component/bna-editor.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div class="relative">
1+
<div class="relative py-3">
22
<bna-formatting-toolbar [editor]="editor">
33
<div class="bn-toolbar">
44
<bna-basic-text-style-button
@@ -23,7 +23,7 @@
2323
<bna-drag-handle-menu-btn [editor]="editor" />
2424
</bna-side-menu>
2525

26-
<bna-view [editor]="editor" class="block margin-icons" />
26+
<bna-view [editor]="editor" class="block" />
2727
<bna-suggestions-menu
2828
[editor]="editor"
2929
class="z-index-3"

src/ui/components/bna-side-menu/bna-side-menu.directive.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ export class BnaSideMenuDirective implements OnChanges {
3434
this.renderer2.setStyle(
3535
this.elRef.nativeElement,
3636
'top',
37-
sideMenuState.referencePos.top - position.top + 25 + 'px'
37+
//TODO: change to relative position to view
38+
sideMenuState.referencePos.top - position.top + 35 + 'px'
3839
);
3940
}
4041
// this.toggleVisibility(sideMenuState.show);
Lines changed: 18 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,24 @@
1-
<button
2-
(click)="openDragMenu()"
3-
(dragend)="dragEnd()"
4-
(dragstart)="dragStart($event)"
5-
draggable="true"
6-
type="button"
7-
hlmBtn
8-
variant="ghost"
9-
size="xs"
10-
>
11-
<hlm-icon size="sm" [name]="'lucideGripVertical'" />
12-
</button>
13-
<div class="hidden">asd</div>
1+
<button
2+
(click)="openDragMenu()"
3+
(dragend)="dragEnd()"
4+
(dragstart)="dragStart($event)"
5+
draggable="true"
6+
type="button"
7+
hlmBtn
8+
variant="ghost"
9+
size="xs"
10+
>
11+
<hlm-icon size="sm" [name]="'lucideGripVertical'" />
12+
</button>
13+
1414

1515
<div
1616
id="dropdown"
17-
class="z-10 bg-white divide-y divide-gray-100 rounded-lg shadow w-44 dark:bg-gray-700"
1817
[ngClass]="{ hidden: !dragMenuShown }"
1918
>
20-
<ul
21-
class="py-2 text-sm text-gray-700 dark:text-gray-200"
22-
aria-labelledby="dropdownDefaultButton"
23-
>
24-
<li>
25-
<button
26-
(click)="deleteBlock()"
27-
type="button"
28-
class="block px-4 py-2 hover:bg-gray-100 dark:hover:bg-gray-600 dark:hover:text-white"
29-
>
30-
Delete
31-
</button>
32-
</li>
33-
<li>
34-
<a
35-
href="#"
36-
class="block px-4 py-2 hover:bg-gray-100 dark:hover:bg-gray-600 dark:hover:text-white"
37-
>Settings</a
38-
>
39-
</li>
40-
</ul>
19+
<hlm-menu class="shadow-3xl">
20+
<hlm-menu-group>
21+
<button hlmMenuItem type="button" (click)="deleteBlock()">Delete</button>
22+
</hlm-menu-group>
23+
</hlm-menu>
4124
</div>

src/ui/components/bna-side-menu/default-buttons/drag-handle-menu/bna-drag-handle-menu.component.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,23 @@ import { provideIcons } from '@ng-icons/core';
55
import { lucideGripVertical } from '@ng-icons/lucide';
66
import { HlmButtonDirective } from '@spartan-ng/ui-button-helm';
77
import { HlmIconComponent } from '@spartan-ng/ui-icon-helm';
8+
import {
9+
HlmMenuComponent,
10+
HlmMenuGroupComponent,
11+
HlmMenuItemDirective,
12+
} from '@spartan-ng/ui-menu-helm';
813

914
@Component({
1015
selector: 'bna-drag-handle-menu-btn',
1116
standalone: true,
12-
imports: [CommonModule, HlmButtonDirective, HlmIconComponent],
17+
imports: [
18+
CommonModule,
19+
HlmButtonDirective,
20+
HlmIconComponent,
21+
HlmMenuComponent,
22+
HlmMenuGroupComponent,
23+
HlmMenuItemDirective,
24+
],
1325
templateUrl: './bna-drag-handle-menu.component.html',
1426
styleUrl: './bna-drag-handle-menu.component.css',
1527
providers: [provideIcons({ lucideGripVertical })],

src/ui/components/bna-suggestions-menu/bna-suggestions-menu.directive.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ export class BnaSuggestionsMenuDirective implements OnChanges {
3636
`${
3737
suggestionMenuState.referencePos.top -
3838
position.top +
39+
//TODO: change to relative position to view
40+
20 +
3941
suggestionMenuState.referencePos.height
4042
}px`
4143
);

0 commit comments

Comments
 (0)