refactoring
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
export default function (state, type) {
|
||||
export default function getMarkAttrs(state, type) {
|
||||
const { from, to } = state.selection
|
||||
let marks = []
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export default function ($pos = null, type = null) {
|
||||
export default function getMarkRange($pos = null, type = null) {
|
||||
|
||||
if (!$pos || !type) {
|
||||
return false
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export default function (state, type) {
|
||||
export default function markIsActive(state, type) {
|
||||
const {
|
||||
from,
|
||||
$from,
|
||||
|
||||
@@ -3,7 +3,7 @@ import {
|
||||
findSelectedNodeOfType,
|
||||
} from 'prosemirror-utils'
|
||||
|
||||
export default function (state, type, attrs = {}) {
|
||||
export default function nodeIsActive(state, type, attrs = {}) {
|
||||
const predicate = node => node.type === type
|
||||
const node = findSelectedNodeOfType(type)(state.selection)
|
||||
|| findParentNode(predicate)(state.selection)
|
||||
|
||||
Reference in New Issue
Block a user