Skip to content
Open
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
3 changes: 0 additions & 3 deletions packages/core/src/blocks/Quote/block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ export const createQuoteBlockConfig = createBlockConfig(
export const createQuoteBlockSpec = createBlockSpec(
createQuoteBlockConfig,
{
meta: {
isolating: false,
},
parse(element) {
if (element.tagName === "BLOCKQUOTE") {
const { backgroundColor, textColor } = parseDefaultProps(element);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[
{
"children": [],
"content": [
{
"styles": {},
"text": "Paragraph",
"type": "text",
},
],
"id": "1",
"props": {
"backgroundColor": "default",
"textColor": "default",
},
"type": "quote",
},
]
22 changes: 21 additions & 1 deletion tests/src/unit/core/clipboard/paste/pasteTestInstances.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ import {
testPasteHTML,
testPasteMarkdown,
} from "../../../shared/clipboard/paste/pasteTestExecutors.js";
import { getPosOfTextNode } from "../../../shared/testUtil.js";
import {
getPosInEmptyBlockContentNode,
getPosOfTextNode,
} from "../../../shared/testUtil.js";
import { TestInstance } from "../../../types.js";

export const pasteTestInstancesHTML: TestInstance<
Expand Down Expand Up @@ -137,6 +140,23 @@ export const pasteTestInstancesHTML: TestInstance<
},
executeTest: testPasteHTML,
},
{
testCase: {
name: "pasteEmptyQuote",
content: `<p>Paragraph</p>`,
document: [
{
type: "quote",
},
],
getPasteSelection: (doc) => {
const startPos = getPosInEmptyBlockContentNode(doc, "quote");

return TextSelection.create(doc, startPos);
},
},
executeTest: testPasteHTML,
},
];

export const pasteTestInstancesMarkdown: TestInstance<
Expand Down
3 changes: 0 additions & 3 deletions tests/src/unit/core/schema/__snapshots__/blocks.json
Original file line number Diff line number Diff line change
Expand Up @@ -434,9 +434,6 @@
[Function],
],
"implementation": {
"meta": {
"isolating": false,
},
"node": null,
"parse": [Function],
"render": [Function],
Expand Down
26 changes: 26 additions & 0 deletions tests/src/unit/shared/testUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,32 @@ export const getPosOfTextNode = (
return ret;
};

// Helper function to get the position inside an empty block content node with
// the given type.
export const getPosInEmptyBlockContentNode = (
doc: Node,
blockContentType: string,
) => {
let ret: number | undefined = undefined;

doc.descendants((node, pos) => {
if (node.type.name === blockContentType && node.childCount === 0) {
ret = pos + 1;
return false;
}

return ret === undefined;
});

if (ret === undefined) {
throw new Error(
`Block content node with type "${blockContentType}" not found.`,
);
}

return ret;
};

// Helper function to get the position of a table cell node with given text
// content. Returns the position just before the node.
export const getPosOfTableCellNode = (doc: Node, textContent: string) => {
Expand Down
Loading