-
-
Notifications
You must be signed in to change notification settings - Fork 562
Separate React package #74
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
Conversation
# Conflicts: # packages/core/src/extensions/DraggableBlocks/DraggableBlocksPlugin.tsx
# Conflicts: # packages/core/src/extensions/DraggableBlocks/DraggableBlocksPlugin.tsx
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Yes, also good way to test the code / ideas yourself
…On Tue, Dec 13, 2022 at 1:48 PM Matthew Lipski ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In examples/editor/src/main.tsx
<#74 (comment)>:
>
-ReactDOM.render(
- <React.StrictMode>
- <App />
- </React.StrictMode>,
- document.getElementById("root")
-);
+mountBlockNoteEditor({
Would it would make sense to have 2 examples, one for vanilla JS and one
for React?
—
Reply to this email directly, view it on GitHub
<#74 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAC2BWM22PPXYHHPOFBPT3DWNBWAPANCNFSM6AAAAAAS5DY2CQ>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
…aration # Conflicts: # packages/core/src/extensions/BubbleMenu/BubbleMenuPlugin.ts
Moved animation delay timeout to bubble menu plugin
packages/core/src/shared/plugins/suggestion/SuggestionPlugin.ts
Outdated
Show resolved
Hide resolved
packages/core/src/shared/plugins/suggestion/SuggestionPlugin.ts
Outdated
Show resolved
Hide resolved
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.
Nice. 1 comment, which I don't think is high prio. I also think we need to put some extra thought on API design (setBlockType). Will discuss on discord
blockMenu: BlockSideMenu; | ||
|
||
hoveredBlock: HTMLElement | undefined; |
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.
I'm not sure how safe this is. We call getBoundingClientRect
at a moment that we're not sure thism element still exists. Consider the following scenario:
- hover element
- click draghandle
- a different plugin, let's say a spellchecker or whatsoever, changes an attribute of the block
- now we click "add"
I think this won't work, as the htmlelement of the block can have changed
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.
I think the safest way to do it would be to save a hoveredBlockId instead and each time we need to get the block HTML element & bounding box for a function we could call:
document.querySelectorAll('[data-id=this.hoveredBlockId]')
This would imo be relatively clean but pretty inefficient.
We could also save the hovered block's bounding box instead which would be nicer and more efficient, but could still cause problems if another extension changes e.g. the block type in the meantime.
Any thoughts on which solution is better?
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.
Maybe the easiest is to stick to the current solution, but use your document.querySelectorAll('[data-id=this.hoveredBlockId]')
idea if hoveredBlockId.isConnected
is false?
* upgrade to react 18 * Maybe fixed React error in build * Added early implementation of bubble menu & editor in separate react package * Moved all hyperlink menus to react package * Major structural overhaul to menu factories * Added suggestions menu factory with new (hopefully final) factory structure * Refactored bubble menu code to use improved factory structure * Changes to bubble menu code and documentation * Changes to bubble menu code and documentation * General improvements, mostly to bubble and hyperlink menus * comments after call * Split bubble menu props into init & update props Moved animation delay timeout to bubble menu plugin * clean up packaging * fix react error * Changed bubble menu plugin view back to use a separate class * Split hyperlink menu props into init & update props * Changed hyperlink menu plugin view to use a separate class * fix gitignore * fix tsconfig * Major cleanup for bubble menu factory code * Major cleanup for hyperlink menu factory code * Minor fixes * Converted suggestion plugin view to use a class * Changed editor example to use React as before * Improved file structure and minor tweaks * Minor refactor * Fixed hyperlink menu behaviour * Separated drag handle UI elements to react package * Separated drag handle UI elements to react package * Minor improvements * fix lint * refactor entrypoints (TypeCellOS#77) * refactor entrypoints * fix packages * fix build * move some more files / remove root.module.css * Fixed hyperlink edit menu bugs * re-add font * Removed bubble menu animation update delay hack * Changed bubble menu placement to be at the start of the selection bounding box * Fixed hyperlink menu naming inconsistencies * Refactored block/drag menu to use one factory and separate view class * Fixed bubble menu sometimes attempting to hide when already hidden * Fixed drag preview styling * Fixed tooltip styling * Removed unnecessary updates from block menu * Vanilla example (TypeCellOS#78) * add vanilla example * add bold toggle * add other factories to vanilla example * add dragging * Updated naming for bubble, block, and hyperlink menus * Fixed drag handle tests * Fixed drag and drop tests * Improved how UI element factories are passed to extensions * Updated suggestions/slash menu naming * Updated slash menu selector for tests * Split factory params into static and dynamic * Minor fix to `BNSetContentType()` * Improved getting & setting block type in formatting toolbar factory API * Minor typing fix * Combined factory `update()` and `show()` functions into single `render()` function * rename props -> staticParams in vanilla example Co-authored-by: yousefed <[email protected]>
This PR separates the React UI components from BlockNote:
BlockNote is currently written for React, though the
core
package should be decoupled from our implementation of the UI so it can be more easily integrated into non-React projects. This PR moves all React-based functionality to a newreact
package, namely the customuseEditor
hook and all menu implementations (bubble menu, suggestions menu, drag handle menu, hyperlink menus). This will also allow users to add their own custom UI to BlockNote.