mirror of
https://github.com/outline/outline.git
synced 2026-02-23 12:58:57 -06:00
fix: Incorrect menu position when notice is first item in doc, closes #8539
This commit is contained in:
@@ -89,7 +89,7 @@ function usePosition({
|
||||
? noticeBlock.pos
|
||||
: null;
|
||||
|
||||
if (position) {
|
||||
if (position !== null) {
|
||||
const element = view.nodeDOM(position);
|
||||
const bounds = (element as HTMLElement).getBoundingClientRect();
|
||||
selectionBounds.top = bounds.top;
|
||||
|
||||
@@ -16,10 +16,8 @@ export default function noticeMenuItems(
|
||||
readOnly: boolean | undefined,
|
||||
dictionary: Dictionary
|
||||
): MenuItem[] {
|
||||
const { selection } = state;
|
||||
const { $from } = selection;
|
||||
const node = $from.node(-1);
|
||||
const currentStyle = node.attrs.style as NoticeTypes;
|
||||
const node = state.selection.$from.node(-1);
|
||||
const currentStyle = node?.attrs.style as NoticeTypes;
|
||||
|
||||
const mapping = {
|
||||
[NoticeTypes.Info]: dictionary.infoNotice,
|
||||
|
||||
Reference in New Issue
Block a user