Skip to content

Commit 6ef5ea1

Browse files
YousefEDmatthewlipski
andauthoredNov 29, 2023
feat: custom styles and custom inline content (#418)
* wip custom styles * fix * fix tests * simplify PartialInlineContent * custom inline content * clean nodeconversions test * streamline tests * update tests * move schema files * add custom style test * inline content + tests * misc * clean imports * fix react tests * add react nodeconversions tests * move tests and add test for ReactStyles * fix react tests * basis of new examples * add react examples * fix bug * misc fixes * wip * clean * small cleanup * add comments * move funcs * fix tests * address PR feedback * fix inline content types * feat: HTML paste handling (#422) * refactor parse * fix parse-divsc * add test case * add extra test (that should be fixed) * readd markdown functions * fix tests * remove unused file * remove comments * add comment * nested list handling * add todos * added comment * use refs for blocks (#424) * use refs for blocks * update react htmlConversion test * Custom inline content and styles commands/copy & paste fixes (#425) * Fixed commands and internal copy/paste for inline content * Fixed internal copy/paste for styles * Small cleanup * fix some tests --------- Co-authored-by: yousefed <yousefdardiry@gmail.com> --------- Co-authored-by: Matthew Lipski <50169049+matthewlipski@users.noreply.github.com> * use processSync --------- Co-authored-by: Matthew Lipski <50169049+matthewlipski@users.noreply.github.com> * fix build --------- Co-authored-by: Matthew Lipski <50169049+matthewlipski@users.noreply.github.com>
1 parent f5b4a0d commit 6ef5ea1

File tree

241 files changed

+9642
-3770
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

241 files changed

+9642
-3770
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
1-
// import logo from './logo.svg'
2-
import { uploadToTmpFilesDotOrg_DEV_ONLY } from "@blocknote/core";
31
import "@blocknote/core/style.css";
42
import { BlockNoteView, useBlockNote } from "@blocknote/react";
5-
import "./App.css";
3+
4+
import { uploadToTmpFilesDotOrg_DEV_ONLY } from "@blocknote/core";
65

76
type WindowWithProseMirror = Window & typeof globalThis & { ProseMirror: any };
87

9-
function App() {
8+
export function App() {
109
const editor = useBlockNote({
11-
onEditorContentChange: (editor) => {
12-
console.log(editor.topLevelBlocks);
13-
},
1410
domAttributes: {
1511
editor: {
1612
class: "editor",
@@ -23,7 +19,7 @@ function App() {
2319
// Give tests a way to get prosemirror instance
2420
(window as WindowWithProseMirror).ProseMirror = editor?._tiptapEditor;
2521

26-
return <BlockNoteView editor={editor} />;
22+
return <BlockNoteView className="root" editor={editor} />;
2723
}
2824

2925
export default App;
+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import "@blocknote/core/style.css";
2+
import { BlockNoteView, useBlockNote } from "@blocknote/react";
3+
4+
import { uploadToTmpFilesDotOrg_DEV_ONLY } from "@blocknote/core";
5+
6+
import YPartyKitProvider from "y-partykit/provider";
7+
import * as Y from "yjs";
8+
9+
const doc = new Y.Doc();
10+
11+
const provider = new YPartyKitProvider(
12+
"blocknote-dev.yousefed.partykit.dev",
13+
// use a unique name as a "room" for your application:
14+
"your-project-name",
15+
doc
16+
);
17+
18+
type WindowWithProseMirror = Window & typeof globalThis & { ProseMirror: any };
19+
20+
export function App() {
21+
const editor = useBlockNote({
22+
domAttributes: {
23+
editor: {
24+
class: "editor",
25+
"data-test": "editor",
26+
},
27+
},
28+
collaboration: {
29+
// The Yjs Provider responsible for transporting updates:
30+
provider,
31+
// Where to store BlockNote data in the Y.Doc:
32+
fragment: doc.getXmlFragment("document-storesss"),
33+
// Information (name and color) for this user:
34+
user: {
35+
name: "My Username",
36+
color: "#ff0000",
37+
},
38+
},
39+
uploadFile: uploadToTmpFilesDotOrg_DEV_ONLY,
40+
});
41+
42+
// Give tests a way to get prosemirror instance
43+
(window as WindowWithProseMirror).ProseMirror = editor?._tiptapEditor;
44+
45+
return <BlockNoteView className="root" editor={editor} />;
46+
}
47+
48+
export default App;

0 commit comments

Comments
 (0)