Comments (5)
Yes! It's just that the code style button is not included in the formatting toolbar by default, see here how to add it. You can also wrap text in tilde ("`") characters to convert it to code.
from blocknote.
Thankyou for responding. One more question along the lines:
I am looking to implement a custom block, which can contain code, and when rendered, gets a button on the side to quickly copy the code. In this case, the code is expected to be a multi-line code. For rendering the button, i was thinking of doing similar to https://www.blocknotejs.org/examples/ui-components/formatting-toolbar-block-type-items
As per my understanding, in blocknote, each line becomes a separate block. Is there a way to combine a selection of lines into a single block, and yet still maintain the multi-line content inside it? Please let me know in case you have other suggestions to implement it. Thanks in advance.
from blocknote.
You can indeed have line breaks inside blocks, allowing you to have multiple lines in a single block (Shift+Enter is the keyboard shortcut for that). If you want to write code in that block, you'll most likely want to also override the Tab and Enter keyboard shortcuts, see how to do that here.
from blocknote.
Can you help me on:
- how to combine multiple blocks into a single one
- how to extract the string contents from specific blocks and not from entire document.
Sorry, i tried, but i am not getting appropriate examples to achieve the same.
from blocknote.
There is no API functionality to merge multiple blocks, since that's a pretty niche use case. The best you can do is call editor._tiptapEditor.commands.BNMergeBlocks
multiple times but this uses the ProseMirror API.
To get the plain text of a block you have to process its content, which is in the form of InlineContent[]
. It contains styled text and links, so you just need to loop over everything and concat the text of each InlineContent
object to a string.
from blocknote.
Related Issues (20)
- Feedback for “Rendering static documents” HOT 2
- Unexpected format block HOT 8
- Firefox: Trailing Whitespace Removed in Custom Blocks HOT 3
- Side Menu showing when the cursor is outside the editor HOT 5
- Don't automatically create a new empty line when I write something. HOT 1
- Feedback for “Suggestion Menus” (removing items) HOT 3
- Emoji Option in Suggestion Menu does not disappear when emojiPicker prop is false HOT 2
- `@blocknote/react` doesn't work with React 19 RC HOT 2
- Can the checkbox from the CheckList be updated with the Shadcn's version instead of the default HTML one? HOT 2
- Porting immediatelyRender and shouldRerenderOnTransaction from tiptap? HOT 1
- Third party embeds (YouTube, etc)
- Selected Blocks does not reflect changes to select block HOT 2
- BUG/FEAT: Styling Suggestion Menu Controller HOT 1
- FEAT: Support for Adding a Button Link Component in BlockNote HOT 1
- Images can't be resized on touch screen devices
- Image dissappearing (width=0) from image block if BlockNote is not visible (not in viewport) HOT 2
- I am trying to make a markdown sort of editor which loads back the content from the database
- I am trying to make a markdown sort of editor which loads back the content from the database
- Links in custom non-editable blocks open twice
- Inconsistent position of menu for a block close to bottom of the viewport
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from blocknote.