Skip to content

Commit

Permalink
fix: format clear
Browse files Browse the repository at this point in the history
fix
  • Loading branch information
mekery committed Apr 22, 2020
1 parent 30ae775 commit f8b7919
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/extentions/FormatClear.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions src/utils/format_clear.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { setLineHeight } from './line_height'
import { cleanIndent } from './indent'

const FORMAT_MARK_NAMES = [
'align',
'bold',
'italic',
'underline',
Expand All @@ -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
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit f8b7919

Please sign in to comment.