rename some methods
This commit is contained in:
@@ -10,8 +10,8 @@ import magicMethods from './utils/magicMethods'
|
||||
import elementFromString from './utils/elementFromString'
|
||||
import nodeIsActive from './utils/nodeIsActive'
|
||||
import markIsActive from './utils/markIsActive'
|
||||
import getNodeAttrs from './utils/getNodeAttrs'
|
||||
import getMarkAttrs from './utils/getMarkAttrs'
|
||||
import getNodeAttributes from './utils/getNodeAttributes'
|
||||
import getMarkAttributes from './utils/getMarkAttributes'
|
||||
import removeElement from './utils/removeElement'
|
||||
import getSchemaTypeNameByName from './utils/getSchemaTypeNameByName'
|
||||
import getHTMLFromFragment from './utils/getHTMLFromFragment'
|
||||
@@ -333,8 +333,8 @@ export class Editor extends EventEmitter {
|
||||
*
|
||||
* @param name Name of the node
|
||||
*/
|
||||
public getNodeAttrs(name: string) {
|
||||
return getNodeAttrs(this.state, this.schema.nodes[name])
|
||||
public getNodeAttributes(name: string) {
|
||||
return getNodeAttributes(this.state, this.schema.nodes[name])
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -342,8 +342,8 @@ export class Editor extends EventEmitter {
|
||||
*
|
||||
* @param name Name of the mark
|
||||
*/
|
||||
public getMarkAttrs(name: string) {
|
||||
return getMarkAttrs(this.state, this.schema.marks[name])
|
||||
public getMarkAttributes(name: string) {
|
||||
return getMarkAttributes(this.state, this.schema.marks[name])
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { MarkType } from 'prosemirror-model'
|
||||
import { Command } from '../types'
|
||||
import getMarkType from '../utils/getMarkType'
|
||||
import getMarkAttrs from '../utils/getMarkAttrs'
|
||||
import getMarkAttributes from '../utils/getMarkAttributes'
|
||||
|
||||
export default (typeOrName: string | MarkType, attributes: {}): Command => ({ tr, state, dispatch }) => {
|
||||
const { selection } = tr
|
||||
const { from, to, empty } = selection
|
||||
const type = getMarkType(typeOrName, state.schema)
|
||||
const oldAttributes = getMarkAttrs(state, type)
|
||||
const oldAttributes = getMarkAttributes(state, type)
|
||||
const newAttributes = {
|
||||
...oldAttributes,
|
||||
...attributes,
|
||||
|
||||
@@ -11,7 +11,7 @@ export { default as markPasteRule } from './pasteRules/markPasteRule'
|
||||
export { default as getSchema } from './utils/getSchema'
|
||||
export { default as generateHTML } from './utils/generateHTML'
|
||||
export { default as getHTMLFromFragment } from './utils/getHTMLFromFragment'
|
||||
export { default as getMarkAttrs } from './utils/getMarkAttrs'
|
||||
export { default as getMarkAttributes } from './utils/getMarkAttributes'
|
||||
export { default as mergeAttributes } from './utils/mergeAttributes'
|
||||
|
||||
export interface AllExtensions {}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { EditorState } from 'prosemirror-state'
|
||||
import { Mark, MarkType } from 'prosemirror-model'
|
||||
|
||||
export default function getMarkAttrs(state: EditorState, type: MarkType) {
|
||||
export default function getMarkAttributes(state: EditorState, type: MarkType) {
|
||||
const { from, to, empty } = state.selection
|
||||
let marks: Mark[] = []
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { EditorState } from 'prosemirror-state'
|
||||
import { Node, NodeType } from 'prosemirror-model'
|
||||
|
||||
export default function getNodeAttrs(state: EditorState, type: NodeType) {
|
||||
export default function getNodeAttributes(state: EditorState, type: NodeType) {
|
||||
const { from, to } = state.selection
|
||||
let nodes: Node[] = []
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { EditorState } from 'prosemirror-state'
|
||||
import { MarkType } from 'prosemirror-model'
|
||||
import getMarkAttrs from './getMarkAttrs'
|
||||
import getMarkAttributes from './getMarkAttributes'
|
||||
import { AnyObject } from '../types'
|
||||
import isEmptyObject from './isEmptyObject'
|
||||
|
||||
@@ -9,7 +9,7 @@ export default function markHasAttributes(state: EditorState, type: MarkType, at
|
||||
return true
|
||||
}
|
||||
|
||||
const originalAttrs = getMarkAttrs(state, type)
|
||||
const originalAttrs = getMarkAttributes(state, type)
|
||||
|
||||
return !!Object
|
||||
.keys(attributes)
|
||||
|
||||
Reference in New Issue
Block a user