Fixes: Possible to create blocks inside document title
This commit is contained in:
@ -40,6 +40,10 @@ export default function MarkdownShortcuts() {
|
|||||||
const { value } = change;
|
const { value } = change;
|
||||||
if (value.isExpanded) return;
|
if (value.isExpanded) return;
|
||||||
const { startBlock, startOffset } = value;
|
const { startBlock, startOffset } = value;
|
||||||
|
|
||||||
|
// no markdown shortcuts work in headings
|
||||||
|
if (startBlock.type.match(/heading/)) return;
|
||||||
|
|
||||||
const chars = startBlock.text.slice(0, startOffset).trim();
|
const chars = startBlock.text.slice(0, startOffset).trim();
|
||||||
const type = this.getType(chars);
|
const type = this.getType(chars);
|
||||||
|
|
||||||
|
@ -3,12 +3,12 @@ import { Block, Change, Node, Mark } from 'slate';
|
|||||||
|
|
||||||
const schema = {
|
const schema = {
|
||||||
blocks: {
|
blocks: {
|
||||||
heading1: { marks: [''] },
|
heading1: { nodes: [{ kinds: ['text'] }], marks: [''] },
|
||||||
heading2: { marks: [''] },
|
heading2: { nodes: [{ kinds: ['text'] }], marks: [''] },
|
||||||
heading3: { marks: [''] },
|
heading3: { nodes: [{ kinds: ['text'] }], marks: [''] },
|
||||||
heading4: { marks: [''] },
|
heading4: { nodes: [{ kinds: ['text'] }], marks: [''] },
|
||||||
heading5: { marks: [''] },
|
heading5: { nodes: [{ kinds: ['text'] }], marks: [''] },
|
||||||
heading6: { marks: [''] },
|
heading6: { nodes: [{ kinds: ['text'] }], marks: [''] },
|
||||||
'block-quote': { marks: [''] },
|
'block-quote': { marks: [''] },
|
||||||
table: {
|
table: {
|
||||||
nodes: [{ types: ['table-row', 'table-head', 'table-cell'] }],
|
nodes: [{ types: ['table-row', 'table-head', 'table-cell'] }],
|
||||||
|
Reference in New Issue
Block a user