fix: Add ability to convert between checklist and other types of list
This commit is contained in:
@@ -7,7 +7,6 @@ import {
|
||||
TextSelection,
|
||||
NodeSelection,
|
||||
EditorState,
|
||||
Transaction,
|
||||
} from "prosemirror-state";
|
||||
import * as React from "react";
|
||||
import ImageZoom from "react-medium-image-zoom";
|
||||
@@ -16,7 +15,7 @@ import getDataTransferFiles from "../../utils/getDataTransferFiles";
|
||||
import insertFiles, { Options } from "../commands/insertFiles";
|
||||
import { MarkdownSerializerState } from "../lib/markdown/serializer";
|
||||
import uploadPlaceholderPlugin from "../lib/uploadPlaceholder";
|
||||
import { ComponentProps } from "../types";
|
||||
import { ComponentProps, Dispatch } from "../types";
|
||||
import Node from "./Node";
|
||||
|
||||
/**
|
||||
@@ -366,17 +365,11 @@ export default class Image extends Node {
|
||||
|
||||
return true;
|
||||
},
|
||||
deleteImage: () => (
|
||||
state: EditorState,
|
||||
dispatch: (tr: Transaction) => void
|
||||
) => {
|
||||
deleteImage: () => (state: EditorState, dispatch: Dispatch) => {
|
||||
dispatch(state.tr.deleteSelection());
|
||||
return true;
|
||||
},
|
||||
alignRight: () => (
|
||||
state: EditorState,
|
||||
dispatch: (tr: Transaction) => void
|
||||
) => {
|
||||
alignRight: () => (state: EditorState, dispatch: Dispatch) => {
|
||||
if (!(state.selection instanceof NodeSelection)) {
|
||||
return false;
|
||||
}
|
||||
@@ -389,10 +382,7 @@ export default class Image extends Node {
|
||||
dispatch(state.tr.setNodeMarkup(selection.from, undefined, attrs));
|
||||
return true;
|
||||
},
|
||||
alignLeft: () => (
|
||||
state: EditorState,
|
||||
dispatch: (tr: Transaction) => void
|
||||
) => {
|
||||
alignLeft: () => (state: EditorState, dispatch: Dispatch) => {
|
||||
if (!(state.selection instanceof NodeSelection)) {
|
||||
return false;
|
||||
}
|
||||
@@ -436,10 +426,7 @@ export default class Image extends Node {
|
||||
inputElement.click();
|
||||
return true;
|
||||
},
|
||||
alignCenter: () => (
|
||||
state: EditorState,
|
||||
dispatch: (tr: Transaction) => void
|
||||
) => {
|
||||
alignCenter: () => (state: EditorState, dispatch: Dispatch) => {
|
||||
if (!(state.selection instanceof NodeSelection)) {
|
||||
return false;
|
||||
}
|
||||
@@ -450,7 +437,7 @@ export default class Image extends Node {
|
||||
},
|
||||
createImage: (attrs: Record<string, any>) => (
|
||||
state: EditorState,
|
||||
dispatch: (tr: Transaction) => void
|
||||
dispatch: Dispatch
|
||||
) => {
|
||||
const { selection } = state;
|
||||
const position =
|
||||
|
||||
Reference in New Issue
Block a user