add list of current commands
This commit is contained in:
@@ -71,7 +71,7 @@ export class Editor extends EventEmitter {
|
||||
this.registerCommand('setContent', require('./commands/setContent').default)
|
||||
this.registerCommand('clearContent', require('./commands/clearContent').default)
|
||||
this.registerCommand('removeMarks', require('./commands/removeMarks').default)
|
||||
this.registerCommand('toggleBlockType', require('./commands/toggleBlockType').default)
|
||||
this.registerCommand('toggleNode', require('./commands/toggleNode').default)
|
||||
this.registerCommand('selectAll', require('./commands/selectAll').default)
|
||||
|
||||
if (this.options.injectCSS) {
|
||||
|
||||
@@ -4,7 +4,7 @@ import { Editor } from '../Editor'
|
||||
import nodeIsActive from '../utils/nodeIsActive'
|
||||
import getNodeType from '../utils/getNodeType'
|
||||
|
||||
type ToggleBlockType = (
|
||||
type ToggleNode = (
|
||||
type: string | NodeType,
|
||||
toggleType: string | NodeType,
|
||||
attrs?: {}
|
||||
@@ -12,11 +12,11 @@ type ToggleBlockType = (
|
||||
|
||||
declare module '../Editor' {
|
||||
interface Editor {
|
||||
toggleBlockType: ToggleBlockType,
|
||||
toggleNode: ToggleNode,
|
||||
}
|
||||
}
|
||||
|
||||
export default (next: Function, editor: Editor): ToggleBlockType => (typeOrName, toggleTypeOrName, attrs) => {
|
||||
export default (next: Function, editor: Editor): ToggleNode => (typeOrName, toggleTypeOrName, attrs) => {
|
||||
const { view, state, schema } = editor
|
||||
const type = getNodeType(typeOrName, schema)
|
||||
const toggleType = getNodeType(toggleTypeOrName, schema)
|
||||
@@ -48,7 +48,7 @@ export default class Heading extends Node {
|
||||
commands(): CommandSpec {
|
||||
return {
|
||||
heading: next => attrs => {
|
||||
this.editor.toggleBlockType(this.name, 'paragraph', attrs)
|
||||
this.editor.toggleNode(this.name, 'paragraph', attrs)
|
||||
next()
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user