Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,22 @@ export default function App() {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

// Renders the editor instance, and its contents as HTML below.
// Renders the editor instance and HTML output.
return (
<div className="wrapper">
<div>Input (BlockNote Editor):</div>
<div className="item">
<BlockNoteView editor={editor} onChange={onChange} />
<div className="views">
<div className="view-wrapper">
<div className="view-label">Editor Input</div>
<div className="view">
<BlockNoteView editor={editor} onChange={onChange} />
</div>
</div>
<div>Output (HTML):</div>
<div className="item bordered">
<pre>
<code>{html}</code>
</pre>
<div className="view-wrapper">
<div className="view-label">HTML Output</div>
<div className="view">
<pre>
<code>{html}</code>
</pre>
</div>
</div>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,64 @@
.wrapper {
.views {
container-name: views;
container-type: inline-size;
display: flex;
flex-direction: column;
flex-direction: row;
flex-wrap: wrap;
gap: 8px;
height: 100%;
padding: 8px;
}

.view-wrapper {
display: flex;
flex-direction: column;
height: calc(50% - 4px);
width: 100%;
}

@container views (width > 1024px) {
.view-wrapper {
height: 100%;
width: calc(50% - 4px);
}
}

.view-label {
color: #0090ff;
display: flex;
font-size: 12px;
font-weight: bold;
justify-content: space-between;
margin-inline: 16px;
}

.item {
border-radius: 0.5rem;
.view {
border: solid #0090ff 1px;
border-radius: 16px;
flex: 1;
overflow: hidden;
height: 0;
padding: 8px;
}

.item.bordered {
border: 1px solid gray;
.view .bn-container {
height: 100%;
margin: 0;
max-width: none;
padding: 0;
}

.item pre {
border-radius: 0.5rem;
.view .bn-editor {
height: 100%;
overflow: auto;
padding-block: 1rem;
padding-inline: 54px;
width: 100%;
}

.view pre {
background-color: #0090ff20;
border-radius: 8px;
flex: 1;
height: 100%;
margin: 0;
overflow: auto;
padding: 8px;
white-space: pre-wrap;
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,22 @@ export default function App() {
loadInitialHTML();
}, [editor]);

// Renders a text area for you to write/paste HTML in, and the editor instance
// below, which displays the current HTML as blocks.
// Renders the HTML input and editor instance.
return (
<div className={"wrapper"}>
<div>Input (HTML):</div>
<div className={"item bordered"}>
<code>
<textarea defaultValue={initialHTML} onChange={htmlInputChanged} />
</code>
<div className="views">
<div className="view-wrapper">
<div className="view-label">HTML Input</div>
<div className="view">
<code>
<textarea defaultValue={initialHTML} onChange={htmlInputChanged} />
</code>
</div>
</div>
<div>Output (BlockNote Editor):</div>
<div className={"item"}>
<BlockNoteView editor={editor} editable={false} />
<div className="view-wrapper">
<div className="view-label">Editor Output</div>
<div className="view">
<BlockNoteView editor={editor} editable={false} />
</div>
</div>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,67 @@
.wrapper {
.views {
container-name: views;
container-type: inline-size;
display: flex;
flex-direction: column;
flex-direction: row;
flex-wrap: wrap;
gap: 8px;
height: 100%;
padding: 8px;
}

.item {
border-radius: 0.5rem;
.view-wrapper {
display: flex;
flex-direction: column;
height: calc(50% - 4px);
width: 100%;
}

@container views (width > 1024px) {
.view-wrapper {
height: 100%;
width: calc(50% - 4px);
}
}

.view-label {
color: #0090ff;
display: flex;
font-size: 12px;
font-weight: bold;
justify-content: space-between;
margin-inline: 16px;
}

.view {
border: solid #0090ff 1px;
border-radius: 16px;
flex: 1;
overflow: hidden;
height: 0;
padding: 8px;
}

.view .bn-container {
height: 100%;
margin: 0;
max-width: none;
padding: 0;
}

.item.bordered {
border: 1px solid gray;
.view .bn-editor {
height: 100%;
overflow: auto;
}

.item textarea {
background-color: transparent;
border-radius: 0.5rem;
.view textarea {
background-color: #0090ff20;
border: none;
border-radius: 8px;
flex: 1;
height: 100%;
margin: 0;
overflow: auto;
padding-block: 1rem;
padding-inline: 54px;
padding: 8px;
resize: none;
white-space: pre-wrap;
width: 100%;
}
24 changes: 14 additions & 10 deletions examples/05-interoperability/03-converting-blocks-to-md/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,22 @@ export default function App() {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

// Renders the editor instance, and its contents as Markdown below.
// Renders the editor instance and Markdown output.
return (
<div className={"wrapper"}>
<div>Input (BlockNote Editor):</div>
<div className={"item"}>
<BlockNoteView editor={editor} onChange={onChange} />
<div className="views">
<div className="view-wrapper">
<div className="view-label">Editor Input</div>
<div className="view">
<BlockNoteView editor={editor} onChange={onChange} />
</div>
</div>
<div>Output (Markdown):</div>
<div className={"item bordered"}>
<pre>
<code>{markdown}</code>
</pre>
<div className="view-wrapper">
<div className="view-label">Markdown Output</div>
<div className="view">
<pre>
<code>{markdown}</code>
</pre>
</div>
</div>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,64 @@
.wrapper {
.views {
container-name: views;
container-type: inline-size;
display: flex;
flex-direction: column;
flex-direction: row;
flex-wrap: wrap;
gap: 8px;
height: 100%;
padding: 8px;
}

.view-wrapper {
display: flex;
flex-direction: column;
height: calc(50% - 4px);
width: 100%;
}

@container views (width > 1024px) {
.view-wrapper {
height: 100%;
width: calc(50% - 4px);
}
}

.view-label {
color: #0090ff;
display: flex;
font-size: 12px;
font-weight: bold;
justify-content: space-between;
margin-inline: 16px;
}

.item {
border-radius: 0.5rem;
.view {
border: solid #0090ff 1px;
border-radius: 16px;
flex: 1;
overflow: hidden;
height: 0;
padding: 8px;
}

.item.bordered {
border: 1px solid gray;
.view .bn-container {
height: 100%;
margin: 0;
max-width: none;
padding: 0;
}

.item pre {
border-radius: 0.5rem;
.view .bn-editor {
height: 100%;
overflow: auto;
padding-block: 1rem;
padding-inline: 54px;
width: 100%;
}

.view pre {
background-color: #0090ff20;
border-radius: 8px;
flex: 1;
height: 100%;
margin: 0;
overflow: auto;
padding: 8px;
white-space: pre-wrap;
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,25 @@ export default function App() {
loadInitialHTML();
}, [editor]);

// Renders a text area for you to write/paste Markdown in, and the editor instance
// below, which displays the current Markdown as blocks.
// Renders the Markdown input and editor instance.
return (
<div className={"wrapper"}>
<div>Input (Markdown):</div>
<div className={"item bordered"}>
<code>
<textarea
defaultValue={initialMarkdown}
onChange={markdownInputChanged}
/>
</code>
<div className="views">
<div className="view-wrapper">
<div className="view-label">Markdown Input</div>
<div className="view">
<code>
<textarea
defaultValue={initialMarkdown}
onChange={markdownInputChanged}
/>
</code>
</div>
</div>
<div>Output (BlockNote Editor):</div>
<div className={"item"}>
<BlockNoteView editor={editor} editable={false} />
<div className="view-wrapper">
<div className="view-label">Editor Output</div>
<div className="view">
<BlockNoteView editor={editor} editable={false} />
</div>
</div>
</div>
);
Expand Down
Loading
Loading