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
|
const { from, to } = state.selection
|
||||||
let marks = []
|
let marks = []
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
export default function (state, type) {
|
export default function markIsActive(state, type) {
|
||||||
const {
|
const {
|
||||||
from,
|
from,
|
||||||
$from,
|
$from,
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user