Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
@@ -1,8 +1,8 @@
import { afterEach, beforeEach, describe, expect, it } from "vitest";
import { Block, BlockNoteEditor, PartialBlock } from "../src";
import { Block, BlockNoteEditor, PartialBlock } from "../..";

let editor: BlockNoteEditor;
let ready = false;

function waitForEditor() {
// wait for create event on editor,
// this is necessary because otherwise UniqueId.create hasn't been called yet, and
Expand All @@ -23,11 +23,7 @@ let insert: (placement: "before" | "nested" | "after") => Block[];
beforeEach(() => {
(window as Window & { __TEST_OPTIONS?: {} }).__TEST_OPTIONS = {};

editor = new BlockNoteEditor({
onCreate: () => {
ready = true;
},
});
editor = new BlockNoteEditor();

singleBlock = {
type: "paragraph",
Expand Down Expand Up @@ -78,9 +74,8 @@ beforeEach(() => {
});

afterEach(() => {
ready = false;
editor._tiptapEditor.destroy();
editor = undefined;
editor = undefined as any;

delete (window as Window & { __TEST_OPTIONS?: {} }).__TEST_OPTIONS;
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {Block} from "@blocknote/core";
import {afterEach, beforeEach, describe, expect, it} from "vitest";
import { BlockNoteEditor } from "../src";
import UniqueID from "../src/extensions/UniqueID/UniqueID";
import { afterEach, beforeEach, describe, expect, it } from "vitest";
import { Block, BlockNoteEditor } from "../..";
import UniqueID from "../../extensions/UniqueID/UniqueID";

let editor: BlockNoteEditor;

Expand Down Expand Up @@ -173,15 +172,15 @@ Paragraph
],
},
];
// nestedHTML = `<h1>Heading</h1><p>Paragraph</p><ul><li><p>Bullet List Item</p><ol><li><p>Numbered List Item</p></li></ol></li></ul>`;
// nestedMarkdown = `# Heading
//
// Paragraph
//
// * Bullet List Item
//
// 1. Numbered List Item
// `;
// nestedHTML = `<h1>Heading</h1><p>Paragraph</p><ul><li><p>Bullet List Item</p><ol><li><p>Numbered List Item</p></li></ol></li></ul>`;
// nestedMarkdown = `# Heading
//
// Paragraph
//
// * Bullet List Item
//
// 1. Numbered List Item
// `;

styledBlocks = [
{
Expand Down Expand Up @@ -627,48 +626,48 @@ Paragraph
},
];

// complexHTML = `<h1>Heading 1</h1><h2>Heading 2</h2><h3>Heading 3</h3><p><span data-text-color="purple"><span data-background-color="green">Paragraph</span></span></p><p>P<strong>ara</strong><em>grap</em>h</p><p>P<u>ara</u><s>grap</s>h</p><ul><li><p>Bullet List Item</p></li><li><p>Bullet List Item</p><ul><li><p>Bullet List Item</p><ul><li><p>Bullet List Item</p></li></ul><p>Paragraph</p><ol><li><p>Numbered List Item</p></li><li><p>Numbered List Item</p></li><li><p>Numbered List Item</p><ol><li><p>Numbered List Item</p></li></ol></li></ol><ul><li><p>Bullet List Item</p></li></ul></li><li><p>Bullet List Item</p></li></ul></li><li><p>Bullet List Item</p></li></ul>`;
// complexMarkdown = `# Heading 1
//
// ## Heading 2
//
// ### Heading 3
//
// Paragraph
//
// P**ara***grap*h
//
// P*ara*~~grap~~h
//
// * Bullet List Item
//
// * Bullet List Item
//
// * Bullet List Item
//
// * Bullet List Item
//
// Paragraph
//
// 1. Numbered List Item
//
// 2. Numbered List Item
//
// 3. Numbered List Item
//
// 1. Numbered List Item
//
// * Bullet List Item
//
// * Bullet List Item
//
// * Bullet List Item
// `;
// complexHTML = `<h1>Heading 1</h1><h2>Heading 2</h2><h3>Heading 3</h3><p><span data-text-color="purple"><span data-background-color="green">Paragraph</span></span></p><p>P<strong>ara</strong><em>grap</em>h</p><p>P<u>ara</u><s>grap</s>h</p><ul><li><p>Bullet List Item</p></li><li><p>Bullet List Item</p><ul><li><p>Bullet List Item</p><ul><li><p>Bullet List Item</p></li></ul><p>Paragraph</p><ol><li><p>Numbered List Item</p></li><li><p>Numbered List Item</p></li><li><p>Numbered List Item</p><ol><li><p>Numbered List Item</p></li></ol></li></ol><ul><li><p>Bullet List Item</p></li></ul></li><li><p>Bullet List Item</p></li></ul></li><li><p>Bullet List Item</p></li></ul>`;
// complexMarkdown = `# Heading 1
//
// ## Heading 2
//
// ### Heading 3
//
// Paragraph
//
// P**ara***grap*h
//
// P*ara*~~grap~~h
//
// * Bullet List Item
//
// * Bullet List Item
//
// * Bullet List Item
//
// * Bullet List Item
//
// Paragraph
//
// 1. Numbered List Item
//
// 2. Numbered List Item
//
// 3. Numbered List Item
//
// 1. Numbered List Item
//
// * Bullet List Item
//
// * Bullet List Item
//
// * Bullet List Item
// `;
});

afterEach(() => {
editor._tiptapEditor.destroy()
editor = undefined;
editor._tiptapEditor.destroy();
editor = undefined as any;

delete (window as Window & { __TEST_OPTIONS?: {} }).__TEST_OPTIONS;
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { afterEach, beforeEach, describe, expect, it } from "vitest";
import { BlockNoteEditor, PartialBlock } from "../src";
import {
blockToNode,
nodeToBlock,
} from "../src/api/nodeConversions/nodeConversions";
import UniqueID from "../src/extensions/UniqueID/UniqueID";
import { BlockNoteEditor, PartialBlock } from "../..";
import { blockToNode, nodeToBlock } from "./nodeConversions";

import { Editor } from "@tiptap/core";
import { Node } from "prosemirror-model";
import UniqueID from "../../extensions/UniqueID/UniqueID";

let editor: Editor;

Expand Down Expand Up @@ -120,7 +118,7 @@ beforeEach(() => {

afterEach(() => {
editor.destroy();
editor = undefined;
editor = undefined as any;

delete (window as Window & { __TEST_OPTIONS?: {} }).__TEST_OPTIONS;
});
Expand Down