Commit fcc0f654 authored by Enrique Alcantara's avatar Enrique Alcantara Committed by Enrique Alcántara

Fix regression in code blocks in the Content Editor

Fixes a bug where typing a code block input rule was
creating a frontmatter code block instead.

Changelog: fixed
parent e10e31d5
...@@ -17,4 +17,7 @@ export default CodeBlockHighlight.extend({ ...@@ -17,4 +17,7 @@ export default CodeBlockHighlight.extend({
addNodeView() { addNodeView() {
return new VueNodeViewRenderer(FrontmatterWrapper); return new VueNodeViewRenderer(FrontmatterWrapper);
}, },
addInputRules() {
return [];
},
}); });
import Frontmatter from '~/content_editor/extensions/frontmatter';
import { createTestEditor, createDocBuilder, triggerNodeInputRule } from '../test_utils';
describe('content_editor/extensions/frontmatter', () => {
let tiptapEditor;
let doc;
let p;
beforeEach(() => {
tiptapEditor = createTestEditor({ extensions: [Frontmatter] });
({
builders: { doc, p },
} = createDocBuilder({
tiptapEditor,
names: {
frontmatter: { nodeType: Frontmatter.name },
},
}));
});
it('does not insert a frontmatter block when executing code block input rule', () => {
const expectedDoc = doc(p(''));
const inputRuleText = '``` ';
triggerNodeInputRule({ tiptapEditor, inputRuleText });
expect(tiptapEditor.getJSON()).toEqual(expectedDoc.toJSON());
});
});
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment