import { Component, Output, EventEmitter, Input, signal } from '@angular/core';
import { CommonModule } from '@angular/common';
export interface InlineToolbarAction {
type: 'use-ai' | 'checkbox-list' | 'numbered-list' | 'bullet-list' | 'table' | 'image' | 'file' | 'new-page' | 'heading-2' | 'more' | 'drag' | 'menu';
}
@Component({
selector: 'app-block-inline-toolbar',
standalone: true,
imports: [CommonModule],
template: `
@if (showDragHandle) {
@if (showDragTooltip()) {
Drag to move
Click to open menu
}
}
1" class="border-l border-gray-600 mx-2 h-4">
`,
styles: [`
:host {
display: block;
}
button {
user-select: none;
-webkit-user-select: none;
}
button:active {
transform: scale(0.95);
}
`]
})
export class BlockInlineToolbarComponent {
@Input() placeholder = "Start writing or type '/', '@'";
@Input() isFocused = signal(false);
@Input() isHovered = signal(false);
// New: whether the current line is empty. When true, icons are shown and placeholder is visible.
@Input() isEmpty = signal(true);
// New: whether to show the drag handle (default true, false in columns)
@Input() showDragHandle = true;
// New: list of actions to render; when undefined, render all
@Input() actions: InlineToolbarAction['type'][] | undefined;
@Output() action = new EventEmitter();
showDragTooltip = signal(false);
onAction(type: InlineToolbarAction['type']): void {
this.action.emit(type);
}
}