diff --git a/src/extentions/FormatClear.js b/src/extentions/FormatClear.js index 92cbe36..8953d1d 100644 --- a/src/extentions/FormatClear.js +++ b/src/extentions/FormatClear.js @@ -6,9 +6,9 @@ export default class FormatClear extends Extension { return 'formatClear' } - commands () { + commands ({ type }) { return () => (state, dispatch) => { - const tr = clearMarks(state.tr.setSelection(state.selection), state.schema) + const tr = clearMarks(state.tr.setSelection(state.selection), state.schema, type) if (dispatch && tr.docChanged) { dispatch(tr) diff --git a/src/utils/format_clear.js b/src/utils/format_clear.js index f95d63f..0be21dc 100644 --- a/src/utils/format_clear.js +++ b/src/utils/format_clear.js @@ -7,6 +7,7 @@ import { setLineHeight } from './line_height' import { cleanIndent } from './indent' const FORMAT_MARK_NAMES = [ + 'align', 'bold', 'italic', 'underline', @@ -18,7 +19,7 @@ const FORMAT_MARK_NAMES = [ 'indent', ] -export function clearMarks (tr, schema) { +export function clearMarks (tr, schema, type) { const { doc, selection } = tr if (!selection || !doc) { return tr @@ -55,7 +56,7 @@ export function clearMarks (tr, schema) { tr = tr.removeMark(pos, pos + node.nodeSize, mark.type) }) - tr = setAlignment(tr, null) + // setAlignment(type, { textAlign: 'right' }) tr = setLineHeight(tr, null) tr = cleanIndent(tr)