-
Notifications
You must be signed in to change notification settings - Fork 32
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
base: test
Are you sure you want to change the base?
Conversation
@Debbl is attempting to deploy a commit to the OpenBuild Team on Vercel. A member of the Team first needs to authorize it. |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
||
const getDragHandlePos = (editor: EditorInstance) => { | ||
const { left, top } = refs.reference.current!.getBoundingClientRect(); | ||
const posAtCoords = editor.view.posAtCoords({ left: left + 50, top: top + 1 }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这 50
和 1
的含义是什么?最好通过语义化变量命名或注释(英文)说明下
@@ -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", |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
用 open
和 setOpen
即可,「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 }) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
用 PropsWithChildren
会更好
closed #160
eslint-plugin-unused-imports
更新一下版本,不清楚什么原因和 typescript-eslint 一起还是有问题insertNewBlockBelow
和deleteBlock
方法,先通过getDragHandlePos
找到 dragHandle 所在的 pos 再进行操作,之前只是对 selection 的操作,有时候会有问题,dragHanle 的 selection 的位置不一致