add precommit hook for linting and automatic eslint fixes + update eslint packages (#2862)

* chore: add precommit hook for eslint fixes, fix linting issues
* chore: add eslint import sort plugin
This commit is contained in:
Dominik
2022-06-08 14:10:25 +02:00
committed by GitHub
parent 39f5e4c31e
commit 8c6751f0c6
394 changed files with 1328 additions and 1042 deletions

View File

@@ -1,12 +1,13 @@
import { EditorState, Transaction } from 'prosemirror-state'
import { Editor } from './Editor'
import { createChainableState } from './helpers/createChainableState'
import {
SingleCommands,
ChainedCommands,
CanCommands,
AnyCommands,
CanCommands,
ChainedCommands,
CommandProps,
SingleCommands,
} from './types'
export class CommandManager {

View File

@@ -1,3 +1,4 @@
import { MarkType, NodeType, Schema } from 'prosemirror-model'
import {
EditorState,
Plugin,
@@ -5,31 +6,31 @@ import {
Transaction,
} from 'prosemirror-state'
import { EditorView } from 'prosemirror-view'
import { Schema, MarkType, NodeType } from 'prosemirror-model'
import { getAttributes } from './helpers/getAttributes'
import { isActive } from './helpers/isActive'
import { CommandManager } from './CommandManager'
import { EventEmitter } from './EventEmitter'
import { ExtensionManager } from './ExtensionManager'
import * as extensions from './extensions'
import { createDocument } from './helpers/createDocument'
import { getAttributes } from './helpers/getAttributes'
import { getHTMLFromFragment } from './helpers/getHTMLFromFragment'
import { getText } from './helpers/getText'
import { getTextSerializersFromSchema } from './helpers/getTextSerializersFromSchema'
import { isActive } from './helpers/isActive'
import { isNodeEmpty } from './helpers/isNodeEmpty'
import { resolveFocusPosition } from './helpers/resolveFocusPosition'
import { getTextSerializersFromSchema } from './helpers/getTextSerializersFromSchema'
import { createStyleTag } from './utilities/createStyleTag'
import { isFunction } from './utilities/isFunction'
import { CommandManager } from './CommandManager'
import { ExtensionManager } from './ExtensionManager'
import { EventEmitter } from './EventEmitter'
import { style } from './style'
import {
EditorOptions,
CanCommands,
ChainedCommands,
EditorEvents,
EditorOptions,
JSONContent,
SingleCommands,
TextSerializer,
EditorEvents,
} from './types'
import * as extensions from './extensions'
import { style } from './style'
import { createStyleTag } from './utilities/createStyleTag'
import { isFunction } from './utilities/isFunction'
export { extensions }

View File

@@ -1,21 +1,22 @@
import { Plugin, Transaction } from 'prosemirror-state'
import { InputRule } from './InputRule'
import { PasteRule } from './PasteRule'
import { ExtensionConfig } from '.'
import { Editor } from './Editor'
import { Node } from './Node'
import { Mark } from './Mark'
import { mergeDeep } from './utilities/mergeDeep'
import { callOrReturn } from './utilities/callOrReturn'
import { getExtensionField } from './helpers/getExtensionField'
import { InputRule } from './InputRule'
import { Mark } from './Mark'
import { Node } from './Node'
import { PasteRule } from './PasteRule'
import {
AnyConfig,
Extensions,
GlobalAttributes,
RawCommands,
ParentConfig,
KeyboardShortcutCommand,
ParentConfig,
RawCommands,
} from './types'
import { ExtensionConfig } from '.'
import { callOrReturn } from './utilities/callOrReturn'
import { mergeDeep } from './utilities/mergeDeep'
declare module '@tiptap/core' {
interface ExtensionConfig<Options = any, Storage = any> {

View File

@@ -1,22 +1,23 @@
import { keymap } from 'prosemirror-keymap'
import { Schema, Node as ProsemirrorNode } from 'prosemirror-model'
import { inputRulesPlugin } from './InputRule'
import { pasteRulesPlugin } from './PasteRule'
import { EditorView, Decoration } from 'prosemirror-view'
import { Node as ProsemirrorNode, Schema } from 'prosemirror-model'
import { Plugin } from 'prosemirror-state'
import { Decoration, EditorView } from 'prosemirror-view'
import { NodeConfig } from '.'
import { Editor } from './Editor'
import { Extensions, RawCommands, AnyConfig } from './types'
import { getAttributesFromExtensions } from './helpers/getAttributesFromExtensions'
import { getExtensionField } from './helpers/getExtensionField'
import { getNodeType } from './helpers/getNodeType'
import { getRenderedAttributes } from './helpers/getRenderedAttributes'
import { getSchemaByResolvedExtensions } from './helpers/getSchemaByResolvedExtensions'
import { getSchemaTypeByName } from './helpers/getSchemaTypeByName'
import { getNodeType } from './helpers/getNodeType'
import { splitExtensions } from './helpers/splitExtensions'
import { getAttributesFromExtensions } from './helpers/getAttributesFromExtensions'
import { getRenderedAttributes } from './helpers/getRenderedAttributes'
import { isExtensionRulesEnabled } from './helpers/isExtensionRulesEnabled'
import { splitExtensions } from './helpers/splitExtensions'
import { inputRulesPlugin } from './InputRule'
import { pasteRulesPlugin } from './PasteRule'
import { AnyConfig, Extensions, RawCommands } from './types'
import { callOrReturn } from './utilities/callOrReturn'
import { findDuplicates } from './utilities/findDuplicates'
import { NodeConfig } from '.'
export class ExtensionManager {

View File

@@ -1,27 +1,28 @@
import {
DOMOutputSpec,
MarkSpec,
Mark as ProseMirrorMark,
MarkSpec,
MarkType,
} from 'prosemirror-model'
import { Plugin, Transaction } from 'prosemirror-state'
import { InputRule } from './InputRule'
import { PasteRule } from './PasteRule'
import { mergeDeep } from './utilities/mergeDeep'
import { callOrReturn } from './utilities/callOrReturn'
import { getExtensionField } from './helpers/getExtensionField'
import {
AnyConfig,
Extensions,
Attributes,
RawCommands,
GlobalAttributes,
ParentConfig,
KeyboardShortcutCommand,
} from './types'
import { Node } from './Node'
import { MarkConfig } from '.'
import { Editor } from './Editor'
import { getExtensionField } from './helpers/getExtensionField'
import { InputRule } from './InputRule'
import { Node } from './Node'
import { PasteRule } from './PasteRule'
import {
AnyConfig,
Attributes,
Extensions,
GlobalAttributes,
KeyboardShortcutCommand,
ParentConfig,
RawCommands,
} from './types'
import { callOrReturn } from './utilities/callOrReturn'
import { mergeDeep } from './utilities/mergeDeep'
declare module '@tiptap/core' {
export interface MarkConfig<Options = any, Storage = any> {

View File

@@ -1,27 +1,28 @@
import {
DOMOutputSpec,
NodeSpec,
Node as ProseMirrorNode,
NodeSpec,
NodeType,
} from 'prosemirror-model'
import { Plugin, Transaction } from 'prosemirror-state'
import { InputRule } from './InputRule'
import { PasteRule } from './PasteRule'
import { mergeDeep } from './utilities/mergeDeep'
import { callOrReturn } from './utilities/callOrReturn'
import { getExtensionField } from './helpers/getExtensionField'
import {
AnyConfig,
Extensions,
Attributes,
NodeViewRenderer,
GlobalAttributes,
RawCommands,
ParentConfig,
KeyboardShortcutCommand,
} from './types'
import { NodeConfig } from '.'
import { Editor } from './Editor'
import { getExtensionField } from './helpers/getExtensionField'
import { InputRule } from './InputRule'
import { PasteRule } from './PasteRule'
import {
AnyConfig,
Attributes,
Extensions,
GlobalAttributes,
KeyboardShortcutCommand,
NodeViewRenderer,
ParentConfig,
RawCommands,
} from './types'
import { callOrReturn } from './utilities/callOrReturn'
import { mergeDeep } from './utilities/mergeDeep'
declare module '@tiptap/core' {
interface NodeConfig<Options = any, Storage = any> {

View File

@@ -1,10 +1,11 @@
import { Decoration, NodeView as ProseMirrorNodeView } from 'prosemirror-view'
import { NodeSelection } from 'prosemirror-state'
import { Node as ProseMirrorNode } from 'prosemirror-model'
import { NodeSelection } from 'prosemirror-state'
import { Decoration, NodeView as ProseMirrorNodeView } from 'prosemirror-view'
import { Editor as CoreEditor } from './Editor'
import { Node } from './Node'
import { NodeViewRendererOptions, NodeViewRendererProps } from './types'
import { isiOS } from './utilities/isiOS'
import { NodeViewRendererProps, NodeViewRendererOptions } from './types'
export class NodeView<
Component,

View File

@@ -1,16 +1,17 @@
import { EditorState, Plugin } from 'prosemirror-state'
import { Editor } from './Editor'
import { CommandManager } from './CommandManager'
import { Editor } from './Editor'
import { createChainableState } from './helpers/createChainableState'
import { isRegExp } from './utilities/isRegExp'
import { isNumber } from './utilities/isNumber'
import {
Range,
ExtendedRegExpMatchArray,
SingleCommands,
ChainedCommands,
CanCommands,
ChainedCommands,
ExtendedRegExpMatchArray,
Range,
SingleCommands,
} from './types'
import { isNumber } from './utilities/isNumber'
import { isRegExp } from './utilities/isRegExp'
export type PasteRuleMatch = {
index: number,

View File

@@ -1,4 +1,5 @@
import { liftTarget } from 'prosemirror-transform'
import { RawCommands } from '../types'
declare module '@tiptap/core' {

View File

@@ -1,4 +1,5 @@
import { createParagraphNear as originalCreateParagraphNear } from 'prosemirror-commands'
import { RawCommands } from '../types'
declare module '@tiptap/core' {

View File

@@ -1,4 +1,5 @@
import { NodeType } from 'prosemirror-model'
import { getNodeType } from '../helpers/getNodeType'
import { RawCommands } from '../types'

View File

@@ -1,4 +1,4 @@
import { RawCommands, Range } from '../types'
import { Range, RawCommands } from '../types'
declare module '@tiptap/core' {
interface Commands<ReturnType> {

View File

@@ -1,4 +1,5 @@
import { deleteSelection as originalDeleteSelection } from 'prosemirror-commands'
import { RawCommands } from '../types'
declare module '@tiptap/core' {

View File

@@ -1,4 +1,5 @@
import { exitCode as originalExitCode } from 'prosemirror-commands'
import { RawCommands } from '../types'
declare module '@tiptap/core' {

View File

@@ -1,8 +1,9 @@
import { TextSelection } from 'prosemirror-state'
import { MarkType } from 'prosemirror-model'
import { RawCommands } from '../types'
import { getMarkType } from '../helpers/getMarkType'
import { TextSelection } from 'prosemirror-state'
import { getMarkRange } from '../helpers/getMarkRange'
import { getMarkType } from '../helpers/getMarkType'
import { RawCommands } from '../types'
declare module '@tiptap/core' {
interface Commands<ReturnType> {

View File

@@ -1,7 +1,7 @@
import { RawCommands, FocusPosition } from '../types'
import { isTextSelection } from '../helpers/isTextSelection'
import { isiOS } from '../utilities/isiOS'
import { resolveFocusPosition } from '../helpers/resolveFocusPosition'
import { FocusPosition, RawCommands } from '../types'
import { isiOS } from '../utilities/isiOS'
declare module '@tiptap/core' {
interface Commands<ReturnType> {
@@ -19,7 +19,7 @@ declare module '@tiptap/core' {
}
}
export const focus: RawCommands['focus'] = (position = null, options) => ({
export const focus: RawCommands['focus'] = (position = null, options = {}) => ({
editor,
view,
tr,

View File

@@ -1,5 +1,6 @@
import { ParseOptions } from 'prosemirror-model'
import { RawCommands, Content } from '../types'
import { Content, RawCommands } from '../types'
declare module '@tiptap/core' {
interface Commands<ReturnType> {

View File

@@ -1,10 +1,11 @@
import { Fragment, Node as ProseMirrorNode, ParseOptions } from 'prosemirror-model'
import { createNodeFromContent } from '../helpers/createNodeFromContent'
import { selectionToInsertionEnd } from '../helpers/selectionToInsertionEnd'
import {
RawCommands,
Content,
Range,
RawCommands,
} from '../types'
declare module '@tiptap/core' {

View File

@@ -1,4 +1,5 @@
import { joinBackward as originalJoinBackward } from 'prosemirror-commands'
import { RawCommands } from '../types'
declare module '@tiptap/core' {

View File

@@ -1,4 +1,5 @@
import { joinForward as originalJoinForward } from 'prosemirror-commands'
import { RawCommands } from '../types'
declare module '@tiptap/core' {

View File

@@ -1,8 +1,9 @@
import { lift as originalLift } from 'prosemirror-commands'
import { NodeType } from 'prosemirror-model'
import { RawCommands } from '../types'
import { isNodeActive } from '../helpers/isNodeActive'
import { getNodeType } from '../helpers/getNodeType'
import { isNodeActive } from '../helpers/isNodeActive'
import { RawCommands } from '../types'
declare module '@tiptap/core' {
interface Commands<ReturnType> {

View File

@@ -1,4 +1,5 @@
import { liftEmptyBlock as originalLiftEmptyBlock } from 'prosemirror-commands'
import { RawCommands } from '../types'
declare module '@tiptap/core' {

View File

@@ -1,7 +1,8 @@
import { liftListItem as originalLiftListItem } from 'prosemirror-schema-list'
import { NodeType } from 'prosemirror-model'
import { RawCommands } from '../types'
import { liftListItem as originalLiftListItem } from 'prosemirror-schema-list'
import { getNodeType } from '../helpers/getNodeType'
import { RawCommands } from '../types'
declare module '@tiptap/core' {
interface Commands<ReturnType> {

View File

@@ -1,4 +1,5 @@
import { newlineInCode as originalNewlineInCode } from 'prosemirror-commands'
import { RawCommands } from '../types'
declare module '@tiptap/core' {

View File

@@ -1,9 +1,10 @@
import { NodeType, MarkType } from 'prosemirror-model'
import { getNodeType } from '../helpers/getNodeType'
import { MarkType, NodeType } from 'prosemirror-model'
import { getMarkType } from '../helpers/getMarkType'
import { getNodeType } from '../helpers/getNodeType'
import { getSchemaTypeNameByName } from '../helpers/getSchemaTypeNameByName'
import { deleteProps } from '../utilities/deleteProps'
import { RawCommands } from '../types'
import { deleteProps } from '../utilities/deleteProps'
declare module '@tiptap/core' {
interface Commands<ReturnType> {

View File

@@ -1,4 +1,5 @@
import { selectNodeBackward as originalSelectNodeBackward } from 'prosemirror-commands'
import { RawCommands } from '../types'
declare module '@tiptap/core' {

View File

@@ -1,4 +1,5 @@
import { selectNodeForward as originalSelectNodeForward } from 'prosemirror-commands'
import { RawCommands } from '../types'
declare module '@tiptap/core' {

View File

@@ -1,4 +1,5 @@
import { selectParentNode as originalSelectParentNode } from 'prosemirror-commands'
import { RawCommands } from '../types'
declare module '@tiptap/core' {

View File

@@ -1,6 +1,7 @@
// @ts-ignore
// TODO: add types to @types/prosemirror-commands
import { selectTextblockEnd as originalSelectTextblockEnd } from 'prosemirror-commands'
import { RawCommands } from '../types'
declare module '@tiptap/core' {

View File

@@ -1,6 +1,7 @@
// @ts-ignore
// TODO: add types to @types/prosemirror-commands
import { selectTextblockStart as originalSelectTextblockStart } from 'prosemirror-commands'
import { RawCommands } from '../types'
declare module '@tiptap/core' {

View File

@@ -1,7 +1,8 @@
import { TextSelection } from 'prosemirror-state'
import { ParseOptions } from 'prosemirror-model'
import { TextSelection } from 'prosemirror-state'
import { createDocument } from '../helpers/createDocument'
import { RawCommands, Content } from '../types'
import { Content, RawCommands } from '../types'
declare module '@tiptap/core' {
interface Commands<ReturnType> {

View File

@@ -1,7 +1,8 @@
import { MarkType } from 'prosemirror-model'
import { RawCommands } from '../types'
import { getMarkType } from '../helpers/getMarkType'
import { getMarkAttributes } from '../helpers/getMarkAttributes'
import { getMarkType } from '../helpers/getMarkType'
import { RawCommands } from '../types'
declare module '@tiptap/core' {
interface Commands<ReturnType> {

View File

@@ -1,7 +1,8 @@
import { NodeType } from 'prosemirror-model'
import { setBlockType } from 'prosemirror-commands'
import { RawCommands } from '../types'
import { NodeType } from 'prosemirror-model'
import { getNodeType } from '../helpers/getNodeType'
import { RawCommands } from '../types'
declare module '@tiptap/core' {
interface Commands<ReturnType> {

View File

@@ -1,6 +1,7 @@
import { Selection, NodeSelection } from 'prosemirror-state'
import { minMax } from '../utilities/minMax'
import { NodeSelection, Selection } from 'prosemirror-state'
import { RawCommands } from '../types'
import { minMax } from '../utilities/minMax'
declare module '@tiptap/core' {
interface Commands<ReturnType> {

View File

@@ -1,6 +1,7 @@
import { TextSelection } from 'prosemirror-state'
import { Range, RawCommands } from '../types'
import { minMax } from '../utilities/minMax'
import { RawCommands, Range } from '../types'
declare module '@tiptap/core' {
interface Commands<ReturnType> {

View File

@@ -1,7 +1,8 @@
import { sinkListItem as originalSinkListItem } from 'prosemirror-schema-list'
import { NodeType } from 'prosemirror-model'
import { RawCommands } from '../types'
import { sinkListItem as originalSinkListItem } from 'prosemirror-schema-list'
import { getNodeType } from '../helpers/getNodeType'
import { RawCommands } from '../types'
declare module '@tiptap/core' {
interface Commands<ReturnType> {

View File

@@ -1,8 +1,9 @@
import { canSplit } from 'prosemirror-transform'
import { ContentMatch } from 'prosemirror-model'
import { EditorState, NodeSelection, TextSelection } from 'prosemirror-state'
import { RawCommands } from '../types'
import { canSplit } from 'prosemirror-transform'
import { getSplittedAttributes } from '../helpers/getSplittedAttributes'
import { RawCommands } from '../types'
function defaultBlockAt(match: ContentMatch) {
for (let i = 0; i < match.edgeCount; i += 1) {

View File

@@ -1,14 +1,15 @@
import {
NodeType,
Node as ProseMirrorNode,
Fragment,
Node as ProseMirrorNode,
NodeType,
Slice,
} from 'prosemirror-model'
import { canSplit } from 'prosemirror-transform'
import { TextSelection } from 'prosemirror-state'
import { RawCommands } from '../types'
import { canSplit } from 'prosemirror-transform'
import { getNodeType } from '../helpers/getNodeType'
import { getSplittedAttributes } from '../helpers/getSplittedAttributes'
import { RawCommands } from '../types'
declare module '@tiptap/core' {
interface Commands<ReturnType> {

View File

@@ -1,10 +1,11 @@
import { NodeType } from 'prosemirror-model'
import { Transaction } from 'prosemirror-state'
import { canJoin } from 'prosemirror-transform'
import { RawCommands } from '../types'
import { getNodeType } from '../helpers/getNodeType'
import { findParentNode } from '../helpers/findParentNode'
import { getNodeType } from '../helpers/getNodeType'
import { isList } from '../helpers/isList'
import { RawCommands } from '../types'
const joinListBackwards = (tr: Transaction, listType: NodeType): boolean => {
const list = findParentNode(node => node.type === listType)(tr.selection)

View File

@@ -1,7 +1,8 @@
import { MarkType } from 'prosemirror-model'
import { RawCommands } from '../types'
import { getMarkType } from '../helpers/getMarkType'
import { isMarkActive } from '../helpers/isMarkActive'
import { RawCommands } from '../types'
declare module '@tiptap/core' {
interface Commands<ReturnType> {

View File

@@ -1,7 +1,8 @@
import { NodeType } from 'prosemirror-model'
import { RawCommands } from '../types'
import { isNodeActive } from '../helpers/isNodeActive'
import { getNodeType } from '../helpers/getNodeType'
import { isNodeActive } from '../helpers/isNodeActive'
import { RawCommands } from '../types'
declare module '@tiptap/core' {
interface Commands<ReturnType> {

View File

@@ -1,7 +1,8 @@
import { NodeType } from 'prosemirror-model'
import { RawCommands } from '../types'
import { isNodeActive } from '../helpers/isNodeActive'
import { getNodeType } from '../helpers/getNodeType'
import { isNodeActive } from '../helpers/isNodeActive'
import { RawCommands } from '../types'
declare module '@tiptap/core' {
interface Commands<ReturnType> {

View File

@@ -1,7 +1,8 @@
import { MarkType } from 'prosemirror-model'
import { RawCommands } from '../types'
import { getMarkType } from '../helpers/getMarkType'
import { getMarkRange } from '../helpers/getMarkRange'
import { getMarkType } from '../helpers/getMarkType'
import { RawCommands } from '../types'
declare module '@tiptap/core' {
interface Commands<ReturnType> {

View File

@@ -1,6 +1,7 @@
import { NodeType, MarkType } from 'prosemirror-model'
import { getNodeType } from '../helpers/getNodeType'
import { MarkType, NodeType } from 'prosemirror-model'
import { getMarkType } from '../helpers/getMarkType'
import { getNodeType } from '../helpers/getNodeType'
import { getSchemaTypeNameByName } from '../helpers/getSchemaTypeNameByName'
import { RawCommands } from '../types'

View File

@@ -1,7 +1,8 @@
import { wrapIn as originalWrapIn } from 'prosemirror-commands'
import { NodeType } from 'prosemirror-model'
import { RawCommands } from '../types'
import { getNodeType } from '../helpers/getNodeType'
import { RawCommands } from '../types'
declare module '@tiptap/core' {
interface Commands<ReturnType> {

View File

@@ -1,7 +1,8 @@
import { wrapInList as originalWrapInList } from 'prosemirror-schema-list'
import { NodeType } from 'prosemirror-model'
import { RawCommands } from '../types'
import { wrapInList as originalWrapInList } from 'prosemirror-schema-list'
import { getNodeType } from '../helpers/getNodeType'
import { RawCommands } from '../types'
declare module '@tiptap/core' {
interface Commands<ReturnType> {

View File

@@ -1,4 +1,5 @@
import { Plugin, PluginKey } from 'prosemirror-state'
import { Extension } from '../Extension'
import { getTextBetween } from '../helpers/getTextBetween'
import { getTextSerializersFromSchema } from '../helpers/getTextSerializersFromSchema'

View File

@@ -1,4 +1,3 @@
import { Extension } from '../Extension'
import * as blur from '../commands/blur'
import * as clearContent from '../commands/clearContent'
import * as clearNodes from '../commands/clearNodes'
@@ -49,6 +48,7 @@ import * as unsetMark from '../commands/unsetMark'
import * as updateAttributes from '../commands/updateAttributes'
import * as wrapIn from '../commands/wrapIn'
import * as wrapInList from '../commands/wrapInList'
import { Extension } from '../Extension'
export { blur }
export { clearContent }

View File

@@ -1,4 +1,5 @@
import { Plugin, PluginKey } from 'prosemirror-state'
import { Extension } from '../Extension'
export const Editable = Extension.create({

View File

@@ -1,4 +1,5 @@
import { Plugin, PluginKey } from 'prosemirror-state'
import { Extension } from '../Extension'
export const FocusEvents = Extension.create({

View File

@@ -1,9 +1,10 @@
import { Plugin, PluginKey, Selection } from 'prosemirror-state'
import { CommandManager } from '../CommandManager'
import { Extension } from '../Extension'
import { createChainableState } from '../helpers/createChainableState'
import { isiOS } from '../utilities/isiOS'
import { isMacOS } from '../utilities/isMacOS'
import { CommandManager } from '../CommandManager'
import { Extension } from '../Extension'
export const Keymap = Extension.create({
name: 'keymap',

View File

@@ -1,4 +1,5 @@
import { Plugin, PluginKey } from 'prosemirror-state'
import { Extension } from '../Extension'
export const Tabindex = Extension.create({

View File

@@ -1,4 +1,5 @@
import { Schema, Node as ProseMirrorNode, ParseOptions } from 'prosemirror-model'
import { Node as ProseMirrorNode, ParseOptions, Schema } from 'prosemirror-model'
import { Content } from '../types'
import { createNodeFromContent } from './createNodeFromContent'

View File

@@ -1,12 +1,13 @@
import {
Schema,
DOMParser,
Node as ProseMirrorNode,
Fragment,
Node as ProseMirrorNode,
ParseOptions,
Schema,
} from 'prosemirror-model'
import { elementFromString } from '../utilities/elementFromString'
import { Content } from '../types'
import { elementFromString } from '../utilities/elementFromString'
export type CreateNodeFromContentOptions = {
slice?: boolean,

View File

@@ -1,5 +1,6 @@
import { Node as ProseMirrorNode } from 'prosemirror-model'
import { Predicate, NodeWithPos } from '../types'
import { NodeWithPos, Predicate } from '../types'
export function findChildren(node: ProseMirrorNode, predicate: Predicate): NodeWithPos[] {
const nodesWithPos: NodeWithPos[] = []

View File

@@ -1,5 +1,6 @@
import { Node as ProseMirrorNode } from 'prosemirror-model'
import { Predicate, Range, NodeWithPos } from '../types'
import { NodeWithPos, Predicate, Range } from '../types'
/**
* Same as `findChildren` but searches only within a `range`.

View File

@@ -1,6 +1,7 @@
import { Selection } from 'prosemirror-state'
import { findParentNodeClosestToPos } from './findParentNodeClosestToPos'
import { Predicate } from '../types'
import { findParentNodeClosestToPos } from './findParentNodeClosestToPos'
export function findParentNode(predicate: Predicate) {
return (selection: Selection) => findParentNodeClosestToPos(selection.$from, predicate)

View File

@@ -1,4 +1,5 @@
import { ResolvedPos, Node as ProseMirrorNode } from 'prosemirror-model'
import { Node as ProseMirrorNode, ResolvedPos } from 'prosemirror-model'
import { Predicate } from '../types'
export function findParentNodeClosestToPos($pos: ResolvedPos, predicate: Predicate): ({

View File

@@ -1,7 +1,8 @@
import { Node } from 'prosemirror-model'
import { getSchema } from './getSchema'
import { getHTMLFromFragment } from './getHTMLFromFragment'
import { Extensions, JSONContent } from '../types'
import { getHTMLFromFragment } from './getHTMLFromFragment'
import { getSchema } from './getSchema'
export function generateHTML(doc: JSONContent, extensions: Extensions): string {
const schema = getSchema(extensions)

View File

@@ -1,7 +1,8 @@
import { DOMParser } from 'prosemirror-model'
import { getSchema } from './getSchema'
import { elementFromString } from '../utilities/elementFromString'
import { Extensions } from '../types'
import { elementFromString } from '../utilities/elementFromString'
import { getSchema } from './getSchema'
export function generateJSON(html: string, extensions: Extensions): Record<string, any> {
const schema = getSchema(extensions)

View File

@@ -1,8 +1,9 @@
import { Node } from 'prosemirror-model'
import { getSchema } from './getSchema'
import { Extensions, JSONContent, TextSerializer } from '../types'
import { getTextSerializersFromSchema } from './getTextSerializersFromSchema'
import { getSchema } from './getSchema'
import { getText } from './getText'
import { getTextSerializersFromSchema } from './getTextSerializersFromSchema'
export function generateText(
doc: JSONContent,

View File

@@ -1,8 +1,9 @@
import { MarkType, NodeType } from 'prosemirror-model'
import { EditorState } from 'prosemirror-state'
import { getSchemaTypeNameByName } from './getSchemaTypeNameByName'
import { getNodeAttributes } from './getNodeAttributes'
import { getMarkAttributes } from './getMarkAttributes'
import { getNodeAttributes } from './getNodeAttributes'
import { getSchemaTypeNameByName } from './getSchemaTypeNameByName'
export function getAttributes(
state: EditorState,

View File

@@ -1,14 +1,14 @@
import { splitExtensions } from './splitExtensions'
import { getExtensionField } from './getExtensionField'
import { MarkConfig, NodeConfig } from '..'
import {
AnyConfig,
Attribute,
Attributes,
ExtensionAttribute,
Extensions,
GlobalAttributes,
Attributes,
Attribute,
ExtensionAttribute,
AnyConfig,
} from '../types'
import { NodeConfig, MarkConfig } from '..'
import { getExtensionField } from './getExtensionField'
import { splitExtensions } from './splitExtensions'
/**
* Get a list of all extension attributes defined in `addAttribute` and `addGlobalAttribute`.

View File

@@ -1,4 +1,5 @@
import { Transform, Step } from 'prosemirror-transform'
import { Step, Transform } from 'prosemirror-transform'
import { Range } from '../types'
import { removeDuplicates } from '../utilities/removeDuplicates'

View File

@@ -1,4 +1,5 @@
import { Node as ProseMirrorNode } from 'prosemirror-model'
import { JSONContent } from '../types'
interface DebugJSONContent extends JSONContent {

View File

@@ -1,4 +1,4 @@
import { AnyExtension, RemoveThis, MaybeThisParameterType } from '../types'
import { AnyExtension, MaybeThisParameterType, RemoveThis } from '../types'
export function getExtensionField<T = any>(
extension: AnyExtension,

View File

@@ -1,4 +1,4 @@
import { DOMSerializer, Schema, Fragment } from 'prosemirror-model'
import { DOMSerializer, Fragment, Schema } from 'prosemirror-model'
export function getHTMLFromFragment(fragment: Fragment, schema: Schema): string {
const documentFragment = DOMSerializer

View File

@@ -1,5 +1,6 @@
import { EditorState } from 'prosemirror-state'
import { Mark, MarkType } from 'prosemirror-model'
import { EditorState } from 'prosemirror-state'
import { getMarkType } from './getMarkType'
export function getMarkAttributes(state: EditorState, typeOrName: string | MarkType): Record<string, any> {

View File

@@ -1,6 +1,7 @@
import { Mark as ProseMirrorMark, MarkType, ResolvedPos } from 'prosemirror-model'
import { objectIncludes } from '../utilities/objectIncludes'
import { Range } from '../types'
import { objectIncludes } from '../utilities/objectIncludes'
function findMarkInSet(
marks: ProseMirrorMark[],

View File

@@ -1,4 +1,5 @@
import { Node as ProseMirrorNode } from 'prosemirror-model'
import { MarkRange } from '../types'
import { getMarkRange } from './getMarkRange'

View File

@@ -1,5 +1,6 @@
import { EditorState } from 'prosemirror-state'
import { Node, NodeType } from 'prosemirror-model'
import { EditorState } from 'prosemirror-state'
import { getNodeType } from './getNodeType'
export function getNodeAttributes(state: EditorState, typeOrName: string | NodeType): Record<string, any> {

View File

@@ -1,4 +1,5 @@
import { Node, Mark } from 'prosemirror-model'
import { Mark, Node } from 'prosemirror-model'
import { ExtensionAttribute } from '../types'
import { mergeAttributes } from '../utilities/mergeAttributes'

View File

@@ -1,7 +1,8 @@
import { Schema } from 'prosemirror-model'
import { getSchemaByResolvedExtensions } from './getSchemaByResolvedExtensions'
import { ExtensionManager } from '../ExtensionManager'
import { Extensions } from '../types'
import { getSchemaByResolvedExtensions } from './getSchemaByResolvedExtensions'
export function getSchema(extensions: Extensions): Schema {
const resolvedExtensions = ExtensionManager.resolve(extensions)

View File

@@ -1,13 +1,14 @@
import { NodeSpec, MarkSpec, Schema } from 'prosemirror-model'
import { MarkSpec, NodeSpec, Schema } from 'prosemirror-model'
import { MarkConfig, NodeConfig } from '..'
import { AnyConfig, Extensions } from '../types'
import { NodeConfig, MarkConfig } from '..'
import { splitExtensions } from './splitExtensions'
import { getAttributesFromExtensions } from './getAttributesFromExtensions'
import { getRenderedAttributes } from './getRenderedAttributes'
import { isEmptyObject } from '../utilities/isEmptyObject'
import { injectExtensionAttributesToParseRule } from './injectExtensionAttributesToParseRule'
import { callOrReturn } from '../utilities/callOrReturn'
import { isEmptyObject } from '../utilities/isEmptyObject'
import { getAttributesFromExtensions } from './getAttributesFromExtensions'
import { getExtensionField } from './getExtensionField'
import { getRenderedAttributes } from './getRenderedAttributes'
import { injectExtensionAttributesToParseRule } from './injectExtensionAttributesToParseRule'
import { splitExtensions } from './splitExtensions'
function cleanUpSchemaItem<T>(data: T) {
return Object.fromEntries(Object.entries(data).filter(([key, value]) => {

View File

@@ -1,5 +1,6 @@
import { TextSerializer } from '../types'
import { Node as ProseMirrorNode } from 'prosemirror-model'
import { TextSerializer } from '../types'
import { getTextBetween } from './getTextBetween'
export function getText(

View File

@@ -1,6 +1,7 @@
import { Range, TextSerializer } from '../types'
import { Node as ProseMirrorNode } from 'prosemirror-model'
import { Range, TextSerializer } from '../types'
export function getTextBetween(
startNode: ProseMirrorNode,
range: Range,
@@ -34,7 +35,7 @@ export function getTextBetween(
range,
})
} else if (node.isText) {
text += node?.text?.slice(Math.max(from, pos) - pos, to - pos)
text += node?.text?.slice(Math.max(from, pos) - pos, to - pos) // eslint-disable-line
separated = false
} else if (node.isBlock && !separated) {
text += blockSeparator

View File

@@ -1,4 +1,5 @@
import { Schema } from 'prosemirror-model'
import { TextSerializer } from '../types'
export function getTextSerializersFromSchema(schema: Schema): Record<string, TextSerializer> {

View File

@@ -1,4 +1,5 @@
import { ParseRule } from 'prosemirror-model'
import { ExtensionAttribute } from '../types'
import { fromString } from '../utilities/fromString'

View File

@@ -1,7 +1,8 @@
import { EditorState } from 'prosemirror-state'
import { isNodeActive } from './isNodeActive'
import { isMarkActive } from './isMarkActive'
import { getSchemaTypeNameByName } from './getSchemaTypeNameByName'
import { isMarkActive } from './isMarkActive'
import { isNodeActive } from './isNodeActive'
export function isActive(state: EditorState, name: string | null, attributes: Record<string, any> = {}): boolean {
if (!name) {

View File

@@ -1,8 +1,8 @@
import { Extensions } from '../types'
import { NodeConfig } from '..'
import { splitExtensions } from './splitExtensions'
import { callOrReturn } from '../utilities/callOrReturn'
import { getExtensionField } from '../helpers/getExtensionField'
import { Extensions } from '../types'
import { callOrReturn } from '../utilities/callOrReturn'
import { splitExtensions } from './splitExtensions'
export function isList(name: string, extensions: Extensions): boolean {
const { nodeExtensions } = splitExtensions(extensions)

View File

@@ -1,8 +1,9 @@
import { EditorState } from 'prosemirror-state'
import { MarkType } from 'prosemirror-model'
import { EditorState } from 'prosemirror-state'
import { MarkRange } from '../types'
import { objectIncludes } from '../utilities/objectIncludes'
import { getMarkType } from './getMarkType'
import { MarkRange } from '../types'
export function isMarkActive(
state: EditorState,

View File

@@ -1,8 +1,9 @@
import { EditorState } from 'prosemirror-state'
import { NodeType } from 'prosemirror-model'
import { EditorState } from 'prosemirror-state'
import { NodeRange } from '../types'
import { objectIncludes } from '../utilities/objectIncludes'
import { getNodeType } from './getNodeType'
import { NodeRange } from '../types'
export function isNodeActive(
state: EditorState,

View File

@@ -1,4 +1,5 @@
import { NodeSelection } from 'prosemirror-state'
import { isObject } from '../utilities/isObject'
export function isNodeSelection(value: unknown): value is NodeSelection {

View File

@@ -1,4 +1,5 @@
import { TextSelection } from 'prosemirror-state'
import { isObject } from '../utilities/isObject'
export function isTextSelection(value: unknown): value is TextSelection {

View File

@@ -1,4 +1,5 @@
import { EditorView } from 'prosemirror-view'
import { minMax } from '../utilities/minMax'
export function posToDOMRect(view: EditorView, from: number, to: number): DOMRect {

View File

@@ -1,5 +1,6 @@
import { Node as ProseMirrorNode } from 'prosemirror-model'
import { Selection, TextSelection } from 'prosemirror-state'
import { FocusPosition } from '../types'
import { minMax } from '../utilities/minMax'

View File

@@ -1,5 +1,5 @@
import { Selection, Transaction } from 'prosemirror-state'
import { ReplaceStep, ReplaceAroundStep } from 'prosemirror-transform'
import { ReplaceAroundStep, ReplaceStep } from 'prosemirror-transform'
// source: https://github.com/ProseMirror/prosemirror-state/blob/master/src/selection.js#L466
export function selectionToInsertionEnd(tr: Transaction, startLen: number, bias: number) {

View File

@@ -1,7 +1,7 @@
import { Extensions } from '../types'
import { Extension } from '../Extension'
import { Node } from '../Node'
import { Mark } from '../Mark'
import { Node } from '../Node'
import { Extensions } from '../types'
export function splitExtensions(extensions: Extensions) {
const baseExtensions = extensions.filter(extension => extension.type === 'extension') as Extension[]

View File

@@ -1,29 +1,9 @@
import * as extensions from './extensions'
export { extensions }
export * from './CommandManager'
export * from './Editor'
export * from './Extension'
export * from './Node'
export * from './Mark'
export * from './NodeView'
export * from './Tracker'
export * from './InputRule'
export * from './PasteRule'
export * from './CommandManager'
export * from './types'
export * from './inputRules/nodeInputRule'
export * from './inputRules/markInputRule'
export * from './inputRules/textblockTypeInputRule'
export * from './inputRules/textInputRule'
export * from './inputRules/wrappingInputRule'
export * from './pasteRules/markPasteRule'
export * from './pasteRules/textPasteRule'
export * from './utilities/callOrReturn'
export * from './utilities/escapeForRegEx'
export * from './utilities/mergeAttributes'
export * from './helpers/combineTransactionSteps'
export * from './helpers/defaultBlockAt'
export * from './helpers/findChildren'
@@ -57,6 +37,23 @@ export * from './helpers/isNodeEmpty'
export * from './helpers/isNodeSelection'
export * from './helpers/isTextSelection'
export * from './helpers/posToDOMRect'
export * from './InputRule'
export * from './inputRules/markInputRule'
export * from './inputRules/nodeInputRule'
export * from './inputRules/textblockTypeInputRule'
export * from './inputRules/textInputRule'
export * from './inputRules/wrappingInputRule'
export * from './Mark'
export * from './Node'
export * from './NodeView'
export * from './PasteRule'
export * from './pasteRules/markPasteRule'
export * from './pasteRules/textPasteRule'
export * from './Tracker'
export * from './types'
export * from './utilities/callOrReturn'
export * from './utilities/escapeForRegEx'
export * from './utilities/mergeAttributes'
// eslint-disable-next-line
export interface Commands<ReturnType = any> {}

View File

@@ -1,8 +1,9 @@
import { InputRule, InputRuleFinder } from '../InputRule'
import { MarkType } from 'prosemirror-model'
import { getMarksBetween } from '../helpers/getMarksBetween'
import { callOrReturn } from '../utilities/callOrReturn'
import { InputRule, InputRuleFinder } from '../InputRule'
import { ExtendedRegExpMatchArray } from '../types'
import { callOrReturn } from '../utilities/callOrReturn'
/**
* Build an input rule that adds a mark when the

View File

@@ -1,4 +1,5 @@
import { NodeType } from 'prosemirror-model'
import { InputRule, InputRuleFinder } from '../InputRule'
import { ExtendedRegExpMatchArray } from '../types'
import { callOrReturn } from '../utilities/callOrReturn'

View File

@@ -1,5 +1,6 @@
import { InputRule, InputRuleFinder } from '../InputRule'
import { NodeType } from 'prosemirror-model'
import { InputRule, InputRuleFinder } from '../InputRule'
import { ExtendedRegExpMatchArray } from '../types'
import { callOrReturn } from '../utilities/callOrReturn'

View File

@@ -1,6 +1,7 @@
import { Node as ProseMirrorNode, NodeType } from 'prosemirror-model'
import { canJoin, findWrapping } from 'prosemirror-transform'
import { InputRule, InputRuleFinder } from '../InputRule'
import { NodeType, Node as ProseMirrorNode } from 'prosemirror-model'
import { findWrapping, canJoin } from 'prosemirror-transform'
import { ExtendedRegExpMatchArray } from '../types'
import { callOrReturn } from '../utilities/callOrReturn'

View File

@@ -1,8 +1,9 @@
import { PasteRule, PasteRuleFinder } from '../PasteRule'
import { MarkType } from 'prosemirror-model'
import { getMarksBetween } from '../helpers/getMarksBetween'
import { callOrReturn } from '../utilities/callOrReturn'
import { PasteRule, PasteRuleFinder } from '../PasteRule'
import { ExtendedRegExpMatchArray } from '../types'
import { callOrReturn } from '../utilities/callOrReturn'
/**
* Build an paste rule that adds a mark when the

View File

@@ -1,25 +1,26 @@
import {
Node as ProseMirrorNode,
Mark as ProseMirrorMark,
Node as ProseMirrorNode,
ParseOptions,
} from 'prosemirror-model'
import {
EditorView,
Decoration,
NodeView,
EditorProps,
} from 'prosemirror-view'
import { EditorState, Transaction } from 'prosemirror-state'
import { Extension } from './Extension'
import { Node } from './Node'
import { Mark } from './Mark'
import { Editor } from './Editor'
import {
Decoration,
EditorProps,
EditorView,
NodeView,
} from 'prosemirror-view'
import {
Commands,
ExtensionConfig,
NodeConfig,
MarkConfig,
NodeConfig,
} from '.'
import { Editor } from './Editor'
import { Extension } from './Extension'
import { Mark } from './Mark'
import { Node } from './Node'
export type AnyConfig = ExtensionConfig | NodeConfig | MarkConfig
export type AnyExtension = Extension | Node | Mark

View File

@@ -1,4 +1,4 @@
import { Node, mergeAttributes, wrappingInputRule } from '@tiptap/core'
import { mergeAttributes, Node, wrappingInputRule } from '@tiptap/core'
export interface BlockquoteOptions {
HTMLAttributes: Record<string, any>,

View File

@@ -1,8 +1,8 @@
import {
Editor,
posToDOMRect,
isTextSelection,
isNodeSelection,
isTextSelection,
posToDOMRect,
} from '@tiptap/core'
import { EditorState, Plugin, PluginKey } from 'prosemirror-state'
import { EditorView } from 'prosemirror-view'

View File

@@ -1,4 +1,5 @@
import { Extension } from '@tiptap/core'
import { BubbleMenuPlugin, BubbleMenuPluginProps } from './bubble-menu-plugin'
export type BubbleMenuOptions = Omit<BubbleMenuPluginProps, 'editor' | 'element'> & {

View File

@@ -1,4 +1,4 @@
import { Node, mergeAttributes, wrappingInputRule } from '@tiptap/core'
import { mergeAttributes, Node, wrappingInputRule } from '@tiptap/core'
export interface BulletListOptions {
itemTypeName: string,

View File

@@ -1,6 +1,6 @@
import { Extension } from '@tiptap/core'
import { Plugin, PluginKey } from 'prosemirror-state'
import { Node as ProseMirrorNode } from 'prosemirror-model'
import { Plugin, PluginKey } from 'prosemirror-state'
export interface CharacterCountOptions {
/**

Some files were not shown because too many files have changed in this diff Show More