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

Refactor: clean blockcontainer #1137

Merged
merged 38 commits into from
Oct 17, 2024
Merged

Conversation

YousefED
Copy link
Collaborator

@YousefED YousefED commented Oct 10, 2024

This PR refactors the internal BlockNote Prosemirror / Tiptap commands:

  • all functions extracted to separate files
  • testcases added
  • cleaned the "blockinfo" concept to be more readable and typesafe

removed: insertBlocks nested option. Use updateBlock instead.

Copy link

vercel bot commented Oct 10, 2024

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

Name Status Preview Updated (UTC)
blocknote ✅ Ready (Inspect) Visit Preview Oct 17, 2024 10:31am
blocknote-website ✅ Ready (Inspect) Visit Preview Oct 17, 2024 10:31am

numChildBlocks,
};
}

/**
* Retrieves the position just before the nearest blockContainer node in a
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

TODO Y: before merging review all function docs

@matthewlipski matthewlipski merged commit bb32c03 into main Oct 17, 2024
4 checks passed
YousefED added a commit that referenced this pull request Oct 29, 2024
Refactor: clean blockcontainer (#1137)

* extract updateBlockCommand

* Extracted remaining commands

* extract keyboard shortcuts

* move directory

* remove createblockcommand

* Added merge/split tests

* Updated snapshots

* Added update block tests and unified test setup

* Added test cases for reverting props

* Added additional test cases for changing content type

* remove "nested" insert option

* Split remaining commands & cleaned up

* Added `getNearestBlockContainerPos`

* Refactored `getBlockInfoFromPos`

* Rewrote `splitBlockCommand`

* Added text cursor position tests

* Fixed lint issue

* fix lint

* Fixed `splitBlock` selection

* Small fix

* Added unit tests to check selection setting

* simplify splitblocks

* Fixed selection in `splitBlock` tests

* wip: deprecate getBlockInfoFromPos

* finish cleanup

* Fixed `mergeBlocks` edge cases

* fix build

* clean nodeconversions

* Implemented PR feedback

* Finished review and remaining changes

* Fixed bug in `insertOrUpdateBlock`

* Removed log

* Tiny changes

* Fixed merge/delete behaviour on Backspace

---------

Co-authored-by: matthewlipski <matthewlipski@gmail.com>
Co-authored-by: Matthew Lipski <50169049+matthewlipski@users.noreply.github.com>
YousefED added a commit that referenced this pull request Oct 29, 2024
Refactor: clean blockcontainer (#1137)

* extract updateBlockCommand

* Extracted remaining commands

* extract keyboard shortcuts

* move directory

* remove createblockcommand

* Added merge/split tests

* Updated snapshots

* Added update block tests and unified test setup

* Added test cases for reverting props

* Added additional test cases for changing content type

* remove "nested" insert option

* Split remaining commands & cleaned up

* Added `getNearestBlockContainerPos`

* Refactored `getBlockInfoFromPos`

* Rewrote `splitBlockCommand`

* Added text cursor position tests

* Fixed lint issue

* fix lint

* Fixed `splitBlock` selection

* Small fix

* Added unit tests to check selection setting

* simplify splitblocks

* Fixed selection in `splitBlock` tests

* wip: deprecate getBlockInfoFromPos

* finish cleanup

* Fixed `mergeBlocks` edge cases

* fix build

* clean nodeconversions

* Implemented PR feedback

* Finished review and remaining changes

* Fixed bug in `insertOrUpdateBlock`

* Removed log

* Tiny changes

* Fixed merge/delete behaviour on Backspace

---------

Co-authored-by: matthewlipski <matthewlipski@gmail.com>
Co-authored-by: Matthew Lipski <50169049+matthewlipski@users.noreply.github.com>
@YousefED YousefED mentioned this pull request Nov 5, 2024
2 tasks
YousefED added a commit that referenced this pull request Nov 6, 2024
* extract updateBlockCommand

* Extracted remaining commands

* extract keyboard shortcuts

* move directory

* remove createblockcommand

* Added merge/split tests

* Updated snapshots

* Added update block tests and unified test setup

* Added test cases for reverting props

* Added additional test cases for changing content type

* remove "nested" insert option

* Split remaining commands & cleaned up

* Added `getNearestBlockContainerPos`

* Refactored `getBlockInfoFromPos`

* Rewrote `splitBlockCommand`

* Added text cursor position tests

* Fixed lint issue

* fix lint

* Fixed `splitBlock` selection

* Small fix

* Added unit tests to check selection setting

* simplify splitblocks

* Fixed selection in `splitBlock` tests

* wip: deprecate getBlockInfoFromPos

* finish cleanup

* Fixed `mergeBlocks` edge cases

* fix build

* clean nodeconversions

* update prosemirror-model

* basics wip

* Implemented PR feedback

* basics working

* fix tabs

* Finished review and remaining changes

* separate package

* Fixed bug in `insertOrUpdateBlock`

* Removed log

* update architecture

* fix build

* wip, play with transition style of sidemenu

* show sidemenu for blocks inside columns

* fix sidemenu

* small fixes

* Tiny changes

* Fixed merge/delete behaviour on Backspace

* cherry pick squash commit

Refactor: clean blockcontainer (#1137)

* extract updateBlockCommand

* Extracted remaining commands

* extract keyboard shortcuts

* move directory

* remove createblockcommand

* Added merge/split tests

* Updated snapshots

* Added update block tests and unified test setup

* Added test cases for reverting props

* Added additional test cases for changing content type

* remove "nested" insert option

* Split remaining commands & cleaned up

* Added `getNearestBlockContainerPos`

* Refactored `getBlockInfoFromPos`

* Rewrote `splitBlockCommand`

* Added text cursor position tests

* Fixed lint issue

* fix lint

* Fixed `splitBlock` selection

* Small fix

* Added unit tests to check selection setting

* simplify splitblocks

* Fixed selection in `splitBlock` tests

* wip: deprecate getBlockInfoFromPos

* finish cleanup

* Fixed `mergeBlocks` edge cases

* fix build

* clean nodeconversions

* Implemented PR feedback

* Finished review and remaining changes

* Fixed bug in `insertOrUpdateBlock`

* Removed log

* Tiny changes

* Fixed merge/delete behaviour on Backspace

---------

Co-authored-by: matthewlipski <matthewlipski@gmail.com>
Co-authored-by: Matthew Lipski <50169049+matthewlipski@users.noreply.github.com>

* update prosemirror-model

* basics wip

* basics working

* fix tabs

* separate package

* update architecture

* fix build

* wip, play with transition style of sidemenu

* show sidemenu for blocks inside columns

* fix sidemenu

* small fixes

* cherry pick squash commit

Refactor: clean blockcontainer (#1137)

* extract updateBlockCommand

* Extracted remaining commands

* extract keyboard shortcuts

* move directory

* remove createblockcommand

* Added merge/split tests

* Updated snapshots

* Added update block tests and unified test setup

* Added test cases for reverting props

* Added additional test cases for changing content type

* remove "nested" insert option

* Split remaining commands & cleaned up

* Added `getNearestBlockContainerPos`

* Refactored `getBlockInfoFromPos`

* Rewrote `splitBlockCommand`

* Added text cursor position tests

* Fixed lint issue

* fix lint

* Fixed `splitBlock` selection

* Small fix

* Added unit tests to check selection setting

* simplify splitblocks

* Fixed selection in `splitBlock` tests

* wip: deprecate getBlockInfoFromPos

* finish cleanup

* Fixed `mergeBlocks` edge cases

* fix build

* clean nodeconversions

* Implemented PR feedback

* Finished review and remaining changes

* Fixed bug in `insertOrUpdateBlock`

* Removed log

* Tiny changes

* Fixed merge/delete behaviour on Backspace

---------

Co-authored-by: matthewlipski <matthewlipski@gmail.com>
Co-authored-by: Matthew Lipski <50169049+matthewlipski@users.noreply.github.com>

* fix

* remove blockAtDocStart and clean mergeBlocks a bit further

* implement multi-column backspace

* feat: Multi-column resizing (#1186)

* Added extension for resizing columns

* small resize fixes

* prevent columns from pushing document width

* Implemented PR feedback

* Fixed remaining UX issues

* TODO fixes in column node

* Updated emoji test screenshots

---------

Co-authored-by: yousefed <yousefdardiry@gmail.com>

* Implemented PR feedback

* Implemented PR feedback

* Fixed column list styles and `nestBlock`

* Added column slash menu items

* Added unit tests for multi column

* Added unit tests for node & html conversions

* Updated snapshots

* fix internal serializer for bnBlock types

* remove md from license

* fix trailing node

* fix bug

* switch to createChecked and fix multicolumn tests

* fix external html for multi-column

* fix text/html on clipboard

* improve copy / paste

* remove unused snapshots and skip one test

* fix text cursor

* Fixed internationalization

* remove scrollbar

* fix dictionary as any

* combineByGroup

* clean examples

* Fixed slash menu item cursor positioning

* move package

* Fixed type

* Updated docs

* remove as any

---------

Co-authored-by: matthewlipski <matthewlipski@gmail.com>
Co-authored-by: Matthew Lipski <50169049+matthewlipski@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants