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

Editable controls the ability to resize columns and tables #1244

Open
tommerty opened this issue Nov 13, 2024 · 2 comments
Open

Editable controls the ability to resize columns and tables #1244

tommerty opened this issue Nov 13, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@tommerty
Copy link
Contributor

Is your feature request related to a problem? Please describe.
When editable is false, it would be great to have an option/prop to decide should blocks that can be resized like tables and columns the ability to do so. I've not found a meaningful way to control this, and as someone who's using this as a "blog writer" the ability to modify the width is a little strange for end users.

Describe the solution you'd like
When editable is false, users shouldn't be able to resize.

Describe alternatives you've considered
I've made attempts with some CSS that does hide the resize on columns, but if the user happens to click and drag in the right place they can still grab it.

Example CSS:

.bn-container[data-theming-readonly="true"] [data-node-type="column"] {
    box-shadow: none !important; /* Remove resize indicator */
    cursor: default !important; /* Remove resize cursor */
}

Additional context
There is likely a way to do this, but it's not outlined in documentation, hasn't been shared in the GitHub/Discord, or I'm just terrible at searching. I'm still learning the innards of Blocknote and a solution is potentially obvious to most..

Bonus
[ ] I'm a sponsor and would appreciate if you could look into this sooner than later 💖

@tommerty tommerty added the enhancement New feature or request label Nov 13, 2024
@tommerty
Copy link
Contributor Author

Still digging into this, I had the idea of potentially setting a DOM attribute to force the data-width= to be initial, but also seems like you can't target columns based off the documentation: https://www.blocknotejs.org/docs/styling-theming/adding-dom-attributes

@matthewlipski
Copy link
Collaborator

Fix for columns is in #1247, though tables will need to wait. This is because we're using a premade ProseMirror plugin for the column resizing and can't modify the code directly. I implemented a fix here, but it's a bit of a hack so we decided to hold off until we find a better solution.

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
None yet
Development

No branches or pull requests

2 participants