refactoring

This commit is contained in:
Philipp Kühn
2019-07-23 18:30:00 +02:00
parent 282647d33d
commit f13e767518
4 changed files with 4 additions and 4 deletions

View File

@@ -1,4 +1,4 @@
export default function (state, type) { export default function getMarkAttrs(state, type) {
const { from, to } = state.selection const { from, to } = state.selection
let marks = [] let marks = []

View File

@@ -1,4 +1,4 @@
export default function ($pos = null, type = null) { export default function getMarkRange($pos = null, type = null) {
if (!$pos || !type) { if (!$pos || !type) {
return false return false

View File

@@ -1,4 +1,4 @@
export default function (state, type) { export default function markIsActive(state, type) {
const { const {
from, from,
$from, $from,

View File

@@ -3,7 +3,7 @@ import {
findSelectedNodeOfType, findSelectedNodeOfType,
} from 'prosemirror-utils' } from 'prosemirror-utils'
export default function (state, type, attrs = {}) { export default function nodeIsActive(state, type, attrs = {}) {
const predicate = node => node.type === type const predicate = node => node.type === type
const node = findSelectedNodeOfType(type)(state.selection) const node = findSelectedNodeOfType(type)(state.selection)
|| findParentNode(predicate)(state.selection) || findParentNode(predicate)(state.selection)