mirror of
https://github.com/outline/outline.git
synced 2026-11-28 00:09:58 +03:00
fix: Incorrect menu position when notice is first item in doc, closes #8539
This commit is contained in:
1 parent
17f4dc58f1
commit
4ad58b4ccd
2 files changed
+3
-5
No files matched your search
@@ -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