fix togglemark
This commit is contained in:
@@ -44,13 +44,13 @@ export default class CommandManager {
|
|||||||
public createCommands() {
|
public createCommands() {
|
||||||
const { commands, editor } = this
|
const { commands, editor } = this
|
||||||
const { state, view } = editor
|
const { state, view } = editor
|
||||||
|
const { tr } = state
|
||||||
|
const props = this.buildProps(tr)
|
||||||
|
|
||||||
return Object.fromEntries(Object
|
return Object.fromEntries(Object
|
||||||
.entries(commands)
|
.entries(commands)
|
||||||
.map(([name, command]) => {
|
.map(([name, command]) => {
|
||||||
const method = (...args: any) => {
|
const method = (...args: any) => {
|
||||||
const { tr } = state
|
|
||||||
const props = this.buildProps(tr)
|
|
||||||
const callback = command(...args)(props)
|
const callback = command(...args)(props)
|
||||||
|
|
||||||
view.dispatch(tr)
|
view.dispatch(tr)
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ export const unsetMark = (typeOrName: string | MarkType): Command => ({ tr, stat
|
|||||||
|
|
||||||
if (dispatch) {
|
if (dispatch) {
|
||||||
tr.removeMark(from, to, type)
|
tr.removeMark(from, to, type)
|
||||||
|
tr.removeStoredMark(type)
|
||||||
}
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ export default function isMarkActive(
|
|||||||
: null
|
: null
|
||||||
|
|
||||||
if (empty) {
|
if (empty) {
|
||||||
return !!state.selection.$head.marks()
|
return !!(state.storedMarks || state.selection.$from.marks())
|
||||||
.filter(mark => {
|
.filter(mark => {
|
||||||
if (!type) {
|
if (!type) {
|
||||||
return true
|
return true
|
||||||
|
|||||||
Reference in New Issue
Block a user