1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2026-01-03 23:42:28 +03:00

Lexical: Added context toolbar placement, added link toolbar

Also added some basic context toolbar styling
This commit is contained in:
Dan Brown
2024-06-30 19:52:09 +01:00
parent c9a03c5b01
commit b1c489090e
7 changed files with 75 additions and 6 deletions

View File

@@ -16,8 +16,14 @@ export class EditorContextToolbar extends EditorContainerUiElement {
}
attachTo(target: HTMLElement) {
// Todo - attach to target position
console.log('attaching context toolbar to', target);
const targetBounds = target.getBoundingClientRect();
const dom = this.getDOMElement();
const domBounds = dom.getBoundingClientRect();
const targetMid = targetBounds.left + (targetBounds.width / 2);
const targetLeft = targetMid - (domBounds.width / 2);
dom.style.top = (targetBounds.bottom + 6) + 'px';
dom.style.left = targetLeft + 'px';
}
insert(children: EditorUiElement[]) {