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
10 changes: 9 additions & 1 deletion packages/core/src/blocks/ListItem/BulletListItem/block.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { getBlockInfoFromSelection } from "../../../api/getBlockInfoFromPos.js";
import { createBlockNoteExtension } from "../../../editor/BlockNoteExtension.js";
import { createBlockConfig, createBlockSpec } from "../../../schema/index.js";
import {
Expand Down Expand Up @@ -103,7 +104,14 @@ export const createBulletListItemBlockSpec = createBlockSpec(
inputRules: [
{
find: new RegExp(`^[-+*]\\s$`),
replace() {
replace({ editor }) {
const blockInfo = getBlockInfoFromSelection(
editor.prosemirrorState,
);

if (blockInfo.blockNoteType === "heading") {
return;
}
return {
type: "bulletListItem",
props: {},
Expand Down
10 changes: 9 additions & 1 deletion packages/core/src/blocks/ListItem/NumberedListItem/block.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { getBlockInfoFromSelection } from "../../../api/getBlockInfoFromPos.js";
import { createBlockNoteExtension } from "../../../editor/BlockNoteExtension.js";
import { createBlockConfig, createBlockSpec } from "../../../schema/index.js";
import {
Expand Down Expand Up @@ -95,7 +96,14 @@ export const createNumberedListItemBlockSpec = createBlockSpec(
inputRules: [
{
find: new RegExp(`^(\\d+)\\.\\s$`),
replace({ match }) {
replace({ match, editor }) {
const blockInfo = getBlockInfoFromSelection(
editor.prosemirrorState,
);

if (blockInfo.blockNoteType === "heading") {
return;
}
const start = parseInt(match[1]);
return {
type: "numberedListItem",
Expand Down
Loading