Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: dragHandle menu #163

Open
wants to merge 2 commits into
base: test
Choose a base branch
from
Open

Conversation

Debbl
Copy link
Contributor

@Debbl Debbl commented Mar 12, 2025

closed #160

Copy link

vercel bot commented Mar 12, 2025

@Debbl is attempting to deploy a commit to the OpenBuild Team on Vercel.

A member of the Team first needs to authorize it.

@ourai ourai self-requested a review March 12, 2025 13:16
@ourai ourai self-assigned this Mar 12, 2025
@ourai ourai added the enhancement New feature or request label Mar 12, 2025
@ourai ourai added this to the 2025W11 milestone Mar 12, 2025
Copy link

vercel bot commented Mar 13, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
openbuild-frontend ✅ Ready (Inspect) Visit Preview Mar 13, 2025 2:47am


const getDragHandlePos = (editor: EditorInstance) => {
const { left, top } = refs.reference.current!.getBoundingClientRect();
const posAtCoords = editor.view.posAtCoords({ left: left + 50, top: top + 1 });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

501 的含义是什么?最好通过语义化变量命名或注释(英文)说明下

@@ -35,6 +35,7 @@
"@bytemd/react": "^1.21.0",
"@ethersproject/address": "^5.7.0",
"@ethersproject/units": "^5.7.0",
"@floating-ui/react": "^0.27.5",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

固定版本号

function DragHandle() {
const { editor } = useEditor();

const [isOpen, setIsOpen] = useState(false);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

opensetOpen 即可,「is-」开头一般会是用在返回布尔值的函数命名:https://ntks.ourai.ws/guides/javascript-coding-style/

import type { EditorInstance} from 'novel';
import type { ReactNode } from 'react';

function Item({ children, onClick }: { children: ReactNode; onClick: () => void }) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PropsWithChildren 会更好

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

块编辑器 drag handle 支持点击出现下拉菜单
2 participants