mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-17 01:56:27 +08:00
fix(editor): remove rootRect and modify layout
This commit is contained in:
@@ -4,7 +4,7 @@ import {
|
||||
PluginHooks,
|
||||
Virgo,
|
||||
} from '@toeverything/components/editor-core';
|
||||
import { domToRect, Point } from '@toeverything/utils';
|
||||
import { Point } from '@toeverything/utils';
|
||||
import { GroupDirection } from '@toeverything/framework/virgo';
|
||||
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
||||
import { DragItem } from './DragItem';
|
||||
@@ -46,7 +46,7 @@ export const GroupMenu = function ({ editor, hooks }: GroupMenuProps) {
|
||||
setShowMenu(false);
|
||||
}
|
||||
},
|
||||
[setShowMenu]
|
||||
[]
|
||||
);
|
||||
|
||||
const handleRootDragOver = useCallback(
|
||||
@@ -128,8 +128,8 @@ export const GroupMenu = function ({ editor, hooks }: GroupMenuProps) {
|
||||
if (editor.container) {
|
||||
setPosition(
|
||||
new Point(
|
||||
groupBlock.dom.offsetLeft - editor.container.offsetLeft,
|
||||
groupBlock.dom.offsetTop - editor.container.offsetTop
|
||||
groupBlock.dom.offsetLeft,
|
||||
groupBlock.dom.offsetTop
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -22,9 +22,9 @@ export const Line = function ({ direction, editor, groupBlock }: LineProps) {
|
||||
if (groupBlock && groupBlock.dom && editor.container) {
|
||||
setRect(
|
||||
Rect.fromLWTH(
|
||||
groupBlock.dom.offsetLeft - editor.container.offsetLeft,
|
||||
groupBlock.dom.offsetLeft,
|
||||
groupBlock.dom.offsetWidth,
|
||||
groupBlock.dom.offsetTop - editor.container.offsetTop,
|
||||
groupBlock.dom.offsetTop,
|
||||
groupBlock.dom.offsetHeight
|
||||
)
|
||||
);
|
||||
|
||||
@@ -13,7 +13,7 @@ export class GroupMenuPlugin extends BasePlugin {
|
||||
return PLUGIN_NAME;
|
||||
}
|
||||
|
||||
protected override on_render(): void {
|
||||
protected override _onRender(): void {
|
||||
if (this.editor.isWhiteboard) return;
|
||||
this.root = new PluginRenderRoot({
|
||||
name: PLUGIN_NAME,
|
||||
|
||||
Reference in New Issue
Block a user