mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-11-24 11:49:02 +08:00
refactor: use index files for imports to simplify the export flow (#2870)
This commit is contained in:
parent
4014af4c21
commit
fa8c4ca639
50
packages/core/src/commands/index.ts
Normal file
50
packages/core/src/commands/index.ts
Normal file
@ -0,0 +1,50 @@
|
||||
export * from './blur'
|
||||
export * from './clearContent'
|
||||
export * from './clearNodes'
|
||||
export * from './command'
|
||||
export * from './createParagraphNear'
|
||||
export * from './deleteNode'
|
||||
export * from './deleteRange'
|
||||
export * from './deleteSelection'
|
||||
export * from './enter'
|
||||
export * from './exitCode'
|
||||
export * from './extendMarkRange'
|
||||
export * from './first'
|
||||
export * from './focus'
|
||||
export * from './forEach'
|
||||
export * from './insertContent'
|
||||
export * from './insertContentAt'
|
||||
export * from './joinBackward'
|
||||
export * from './joinForward'
|
||||
export * from './keyboardShortcut'
|
||||
export * from './lift'
|
||||
export * from './liftEmptyBlock'
|
||||
export * from './liftListItem'
|
||||
export * from './newlineInCode'
|
||||
export * from './resetAttributes'
|
||||
export * from './scrollIntoView'
|
||||
export * from './selectAll'
|
||||
export * from './selectNodeBackward'
|
||||
export * from './selectNodeForward'
|
||||
export * from './selectParentNode'
|
||||
export * from './selectTextblockEnd'
|
||||
export * from './selectTextblockStart'
|
||||
export * from './setContent'
|
||||
export * from './setMark'
|
||||
export * from './setMeta'
|
||||
export * from './setNode'
|
||||
export * from './setNodeSelection'
|
||||
export * from './setTextSelection'
|
||||
export * from './sinkListItem'
|
||||
export * from './splitBlock'
|
||||
export * from './splitListItem'
|
||||
export * from './toggleList'
|
||||
export * from './toggleMark'
|
||||
export * from './toggleNode'
|
||||
export * from './toggleWrap'
|
||||
export * from './undoInputRule'
|
||||
export * from './unsetAllMarks'
|
||||
export * from './unsetMark'
|
||||
export * from './updateAttributes'
|
||||
export * from './wrapIn'
|
||||
export * from './wrapInList'
|
@ -1,161 +1,14 @@
|
||||
import * as blur from '../commands/blur'
|
||||
import * as clearContent from '../commands/clearContent'
|
||||
import * as clearNodes from '../commands/clearNodes'
|
||||
import * as command from '../commands/command'
|
||||
import * as createParagraphNear from '../commands/createParagraphNear'
|
||||
import * as deleteNode from '../commands/deleteNode'
|
||||
import * as deleteRange from '../commands/deleteRange'
|
||||
import * as deleteSelection from '../commands/deleteSelection'
|
||||
import * as enter from '../commands/enter'
|
||||
import * as exitCode from '../commands/exitCode'
|
||||
import * as extendMarkRange from '../commands/extendMarkRange'
|
||||
import * as first from '../commands/first'
|
||||
import * as focus from '../commands/focus'
|
||||
import * as forEach from '../commands/forEach'
|
||||
import * as insertContent from '../commands/insertContent'
|
||||
import * as insertContentAt from '../commands/insertContentAt'
|
||||
import * as joinBackward from '../commands/joinBackward'
|
||||
import * as joinForward from '../commands/joinForward'
|
||||
import * as keyboardShortcut from '../commands/keyboardShortcut'
|
||||
import * as lift from '../commands/lift'
|
||||
import * as liftEmptyBlock from '../commands/liftEmptyBlock'
|
||||
import * as liftListItem from '../commands/liftListItem'
|
||||
import * as newlineInCode from '../commands/newlineInCode'
|
||||
import * as resetAttributes from '../commands/resetAttributes'
|
||||
import * as scrollIntoView from '../commands/scrollIntoView'
|
||||
import * as selectAll from '../commands/selectAll'
|
||||
import * as selectNodeBackward from '../commands/selectNodeBackward'
|
||||
import * as selectNodeForward from '../commands/selectNodeForward'
|
||||
import * as selectParentNode from '../commands/selectParentNode'
|
||||
import * as selectTextblockEnd from '../commands/selectTextblockEnd'
|
||||
import * as selectTextblockStart from '../commands/selectTextblockStart'
|
||||
import * as setContent from '../commands/setContent'
|
||||
import * as setMark from '../commands/setMark'
|
||||
import * as setMeta from '../commands/setMeta'
|
||||
import * as setNode from '../commands/setNode'
|
||||
import * as setNodeSelection from '../commands/setNodeSelection'
|
||||
import * as setTextSelection from '../commands/setTextSelection'
|
||||
import * as sinkListItem from '../commands/sinkListItem'
|
||||
import * as splitBlock from '../commands/splitBlock'
|
||||
import * as splitListItem from '../commands/splitListItem'
|
||||
import * as toggleList from '../commands/toggleList'
|
||||
import * as toggleMark from '../commands/toggleMark'
|
||||
import * as toggleNode from '../commands/toggleNode'
|
||||
import * as toggleWrap from '../commands/toggleWrap'
|
||||
import * as undoInputRule from '../commands/undoInputRule'
|
||||
import * as unsetAllMarks from '../commands/unsetAllMarks'
|
||||
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 * as commands from '../commands'
|
||||
import { Extension } from '../Extension'
|
||||
|
||||
export { blur }
|
||||
export { clearContent }
|
||||
export { clearNodes }
|
||||
export { command }
|
||||
export { createParagraphNear }
|
||||
export { deleteNode }
|
||||
export { deleteRange }
|
||||
export { deleteSelection }
|
||||
export { enter }
|
||||
export { exitCode }
|
||||
export { extendMarkRange }
|
||||
export { first }
|
||||
export { focus }
|
||||
export { forEach }
|
||||
export { insertContent }
|
||||
export { insertContentAt }
|
||||
export { joinBackward }
|
||||
export { joinForward }
|
||||
export { keyboardShortcut }
|
||||
export { lift }
|
||||
export { liftEmptyBlock }
|
||||
export { liftListItem }
|
||||
export { newlineInCode }
|
||||
export { resetAttributes }
|
||||
export { scrollIntoView }
|
||||
export { selectAll }
|
||||
export { selectNodeBackward }
|
||||
export { selectNodeForward }
|
||||
export { selectParentNode }
|
||||
export { selectTextblockEnd }
|
||||
export { selectTextblockStart }
|
||||
export { setContent }
|
||||
export { setMark }
|
||||
export { setMeta }
|
||||
export { setNode }
|
||||
export { setNodeSelection }
|
||||
export { setTextSelection }
|
||||
export { sinkListItem }
|
||||
export { splitBlock }
|
||||
export { splitListItem }
|
||||
export { toggleList }
|
||||
export { toggleMark }
|
||||
export { toggleNode }
|
||||
export { toggleWrap }
|
||||
export { undoInputRule }
|
||||
export { unsetAllMarks }
|
||||
export { unsetMark }
|
||||
export { updateAttributes }
|
||||
export { wrapIn }
|
||||
export { wrapInList }
|
||||
export * from '../commands'
|
||||
|
||||
export const Commands = Extension.create({
|
||||
name: 'commands',
|
||||
|
||||
addCommands() {
|
||||
return {
|
||||
...blur,
|
||||
...clearContent,
|
||||
...clearNodes,
|
||||
...command,
|
||||
...createParagraphNear,
|
||||
...deleteNode,
|
||||
...deleteRange,
|
||||
...deleteSelection,
|
||||
...enter,
|
||||
...exitCode,
|
||||
...extendMarkRange,
|
||||
...first,
|
||||
...focus,
|
||||
...forEach,
|
||||
...insertContent,
|
||||
...insertContentAt,
|
||||
...joinBackward,
|
||||
...joinForward,
|
||||
...keyboardShortcut,
|
||||
...lift,
|
||||
...liftEmptyBlock,
|
||||
...liftListItem,
|
||||
...newlineInCode,
|
||||
...resetAttributes,
|
||||
...scrollIntoView,
|
||||
...selectAll,
|
||||
...selectNodeBackward,
|
||||
...selectNodeForward,
|
||||
...selectParentNode,
|
||||
...selectTextblockEnd,
|
||||
...selectTextblockStart,
|
||||
...setContent,
|
||||
...setMark,
|
||||
...setMeta,
|
||||
...setNode,
|
||||
...setNodeSelection,
|
||||
...setTextSelection,
|
||||
...sinkListItem,
|
||||
...splitBlock,
|
||||
...splitListItem,
|
||||
...toggleList,
|
||||
...toggleMark,
|
||||
...toggleNode,
|
||||
...toggleWrap,
|
||||
...undoInputRule,
|
||||
...unsetAllMarks,
|
||||
...unsetMark,
|
||||
...updateAttributes,
|
||||
...wrapIn,
|
||||
...wrapInList,
|
||||
...commands,
|
||||
}
|
||||
},
|
||||
})
|
||||
|
33
packages/core/src/helpers/index.ts
Normal file
33
packages/core/src/helpers/index.ts
Normal file
@ -0,0 +1,33 @@
|
||||
export * from './combineTransactionSteps'
|
||||
export * from './defaultBlockAt'
|
||||
export * from './findChildren'
|
||||
export * from './findChildrenInRange'
|
||||
export * from './findParentNode'
|
||||
export * from './findParentNodeClosestToPos'
|
||||
export * from './generateHTML'
|
||||
export * from './generateJSON'
|
||||
export * from './generateText'
|
||||
export * from './getAttributes'
|
||||
export * from './getChangedRanges'
|
||||
export * from './getDebugJSON'
|
||||
export * from './getExtensionField'
|
||||
export * from './getHTMLFromFragment'
|
||||
export * from './getMarkAttributes'
|
||||
export * from './getMarkRange'
|
||||
export * from './getMarksBetween'
|
||||
export * from './getMarkType'
|
||||
export * from './getNodeAttributes'
|
||||
export * from './getNodeType'
|
||||
export * from './getSchema'
|
||||
export * from './getText'
|
||||
export * from './getTextBetween'
|
||||
export * from './getTextContentFromNodes'
|
||||
export * from './getTextSerializersFromSchema'
|
||||
export * from './isActive'
|
||||
export * from './isList'
|
||||
export * from './isMarkActive'
|
||||
export * from './isNodeActive'
|
||||
export * from './isNodeEmpty'
|
||||
export * from './isNodeSelection'
|
||||
export * from './isTextSelection'
|
||||
export * from './posToDOMRect'
|
@ -1,59 +1,18 @@
|
||||
import * as extensions from './extensions'
|
||||
|
||||
export { extensions }
|
||||
export * from './CommandManager'
|
||||
export * from './Editor'
|
||||
export * from './Extension'
|
||||
export * from './helpers/combineTransactionSteps'
|
||||
export * from './helpers/defaultBlockAt'
|
||||
export * from './helpers/findChildren'
|
||||
export * from './helpers/findChildrenInRange'
|
||||
export * from './helpers/findParentNode'
|
||||
export * from './helpers/findParentNodeClosestToPos'
|
||||
export * from './helpers/generateHTML'
|
||||
export * from './helpers/generateJSON'
|
||||
export * from './helpers/generateText'
|
||||
export * from './helpers/getAttributes'
|
||||
export * from './helpers/getChangedRanges'
|
||||
export * from './helpers/getDebugJSON'
|
||||
export * from './helpers/getExtensionField'
|
||||
export * from './helpers/getHTMLFromFragment'
|
||||
export * from './helpers/getMarkAttributes'
|
||||
export * from './helpers/getMarkRange'
|
||||
export * from './helpers/getMarksBetween'
|
||||
export * from './helpers/getMarkType'
|
||||
export * from './helpers/getNodeAttributes'
|
||||
export * from './helpers/getNodeType'
|
||||
export * from './helpers/getSchema'
|
||||
export * from './helpers/getText'
|
||||
export * from './helpers/getTextBetween'
|
||||
export * from './helpers/getTextContentFromNodes'
|
||||
export * from './helpers/getTextSerializersFromSchema'
|
||||
export * from './helpers/isActive'
|
||||
export * from './helpers/isList'
|
||||
export * from './helpers/isMarkActive'
|
||||
export * from './helpers/isNodeActive'
|
||||
export * from './helpers/isNodeEmpty'
|
||||
export * from './helpers/isNodeSelection'
|
||||
export * from './helpers/isTextSelection'
|
||||
export * from './helpers/posToDOMRect'
|
||||
export * as extensions from './extensions'
|
||||
export * from './helpers'
|
||||
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 './inputRules'
|
||||
export * from './Mark'
|
||||
export * from './Node'
|
||||
export * from './NodeView'
|
||||
export * from './PasteRule'
|
||||
export * from './pasteRules/markPasteRule'
|
||||
export * from './pasteRules/textPasteRule'
|
||||
export * from './pasteRules'
|
||||
export * from './Tracker'
|
||||
export * from './types'
|
||||
export * from './utilities/callOrReturn'
|
||||
export * from './utilities/escapeForRegEx'
|
||||
export * from './utilities/mergeAttributes'
|
||||
export * from './utilities'
|
||||
|
||||
// eslint-disable-next-line
|
||||
export interface Commands<ReturnType = any> {}
|
||||
|
5
packages/core/src/inputRules/index.ts
Normal file
5
packages/core/src/inputRules/index.ts
Normal file
@ -0,0 +1,5 @@
|
||||
export * from './markInputRule'
|
||||
export * from './nodeInputRule'
|
||||
export * from './textblockTypeInputRule'
|
||||
export * from './textInputRule'
|
||||
export * from './wrappingInputRule'
|
2
packages/core/src/pasteRules/index.ts
Normal file
2
packages/core/src/pasteRules/index.ts
Normal file
@ -0,0 +1,2 @@
|
||||
export * from './markPasteRule'
|
||||
export * from './textPasteRule'
|
3
packages/core/src/utilities/index.ts
Normal file
3
packages/core/src/utilities/index.ts
Normal file
@ -0,0 +1,3 @@
|
||||
export * from './callOrReturn'
|
||||
export * from './escapeForRegEx'
|
||||
export * from './mergeAttributes'
|
Loading…
Reference in New Issue
Block a user