@tiptap/core 2.0.0-beta.148 → 2.0.0-beta.151
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/packages/core/src/CommandManager.d.ts +1 -1
- package/dist/packages/core/src/Editor.d.ts +4 -2
- package/dist/packages/core/src/EventEmitter.d.ts +1 -1
- package/dist/packages/core/src/ExtensionManager.d.ts +1 -1
- package/dist/packages/core/src/helpers/combineTransactionSteps.d.ts +1 -1
- package/dist/packages/core/src/helpers/createChainableState.d.ts +1 -1
- package/dist/packages/core/src/helpers/createDocument.d.ts +1 -1
- package/dist/packages/core/src/helpers/createNodeFromContent.d.ts +1 -1
- package/dist/packages/core/src/helpers/defaultBlockAt.d.ts +1 -1
- package/dist/packages/core/src/helpers/findChildren.d.ts +1 -1
- package/dist/packages/core/src/helpers/findChildrenInRange.d.ts +1 -1
- package/dist/packages/core/src/helpers/findParentNode.d.ts +1 -1
- package/dist/packages/core/src/helpers/findParentNodeClosestToPos.d.ts +1 -1
- package/dist/packages/core/src/helpers/generateHTML.d.ts +1 -1
- package/dist/packages/core/src/helpers/generateJSON.d.ts +1 -1
- package/dist/packages/core/src/helpers/generateText.d.ts +1 -1
- package/dist/packages/core/src/helpers/getAttributes.d.ts +1 -1
- package/dist/packages/core/src/helpers/getAttributesFromExtensions.d.ts +1 -1
- package/dist/packages/core/src/helpers/getChangedRanges.d.ts +1 -1
- package/dist/packages/core/src/helpers/getDebugJSON.d.ts +1 -1
- package/dist/packages/core/src/helpers/getExtensionField.d.ts +1 -1
- package/dist/packages/core/src/helpers/getHTMLFromFragment.d.ts +1 -1
- package/dist/packages/core/src/helpers/getMarkAttributes.d.ts +1 -1
- package/dist/packages/core/src/helpers/getMarkRange.d.ts +1 -1
- package/dist/packages/core/src/helpers/getMarkType.d.ts +1 -1
- package/dist/packages/core/src/helpers/getMarksBetween.d.ts +1 -1
- package/dist/packages/core/src/helpers/getNodeAttributes.d.ts +1 -1
- package/dist/packages/core/src/helpers/getNodeType.d.ts +1 -1
- package/dist/packages/core/src/helpers/getRenderedAttributes.d.ts +1 -1
- package/dist/packages/core/src/helpers/getSchema.d.ts +1 -1
- package/dist/packages/core/src/helpers/getSchemaByResolvedExtensions.d.ts +1 -1
- package/dist/packages/core/src/helpers/getSchemaTypeByName.d.ts +1 -1
- package/dist/packages/core/src/helpers/getSchemaTypeNameByName.d.ts +1 -1
- package/dist/packages/core/src/helpers/getSplittedAttributes.d.ts +1 -1
- package/dist/packages/core/src/helpers/getText.d.ts +1 -1
- package/dist/packages/core/src/helpers/getTextBetween.d.ts +1 -1
- package/dist/packages/core/src/helpers/getTextSeralizersFromSchema.d.ts +1 -1
- package/dist/packages/core/src/helpers/injectExtensionAttributesToParseRule.d.ts +1 -1
- package/dist/packages/core/src/helpers/isActive.d.ts +1 -1
- package/dist/packages/core/src/helpers/isExtensionRulesEnabled.d.ts +1 -1
- package/dist/packages/core/src/helpers/isList.d.ts +1 -1
- package/dist/packages/core/src/helpers/isMarkActive.d.ts +1 -1
- package/dist/packages/core/src/helpers/isNodeActive.d.ts +1 -1
- package/dist/packages/core/src/helpers/isNodeEmpty.d.ts +1 -1
- package/dist/packages/core/src/helpers/isNodeSelection.d.ts +1 -1
- package/dist/packages/core/src/helpers/isTextSelection.d.ts +1 -1
- package/dist/packages/core/src/helpers/posToDOMRect.d.ts +1 -1
- package/dist/packages/core/src/helpers/resolveFocusPosition.d.ts +1 -1
- package/dist/packages/core/src/helpers/selectionToInsertionEnd.d.ts +1 -1
- package/dist/packages/core/src/helpers/splitExtensions.d.ts +1 -1
- package/dist/packages/core/src/index.d.ts +40 -40
- package/dist/packages/core/src/inputRules/markInputRule.d.ts +1 -1
- package/dist/packages/core/src/inputRules/nodeInputRule.d.ts +1 -1
- package/dist/packages/core/src/inputRules/textInputRule.d.ts +1 -1
- package/dist/packages/core/src/inputRules/textblockTypeInputRule.d.ts +1 -1
- package/dist/packages/core/src/inputRules/wrappingInputRule.d.ts +1 -1
- package/dist/packages/core/src/pasteRules/markPasteRule.d.ts +1 -1
- package/dist/packages/core/src/pasteRules/textPasteRule.d.ts +1 -1
- package/dist/packages/core/src/style.d.ts +1 -2
- package/dist/packages/core/src/utilities/callOrReturn.d.ts +1 -1
- package/dist/packages/core/src/utilities/createStyleTag.d.ts +1 -1
- package/dist/packages/core/src/utilities/deleteProps.d.ts +1 -1
- package/dist/packages/core/src/utilities/elementFromString.d.ts +1 -1
- package/dist/packages/core/src/utilities/findDuplicates.d.ts +1 -1
- package/dist/packages/core/src/utilities/fromString.d.ts +1 -1
- package/dist/packages/core/src/utilities/isClass.d.ts +1 -1
- package/dist/packages/core/src/utilities/isEmptyObject.d.ts +1 -1
- package/dist/packages/core/src/utilities/isFunction.d.ts +1 -1
- package/dist/packages/core/src/utilities/isNumber.d.ts +1 -1
- package/dist/packages/core/src/utilities/isObject.d.ts +1 -1
- package/dist/packages/core/src/utilities/isPlainObject.d.ts +1 -1
- package/dist/packages/core/src/utilities/isRegExp.d.ts +1 -1
- package/dist/packages/core/src/utilities/isiOS.d.ts +1 -1
- package/dist/packages/core/src/utilities/mergeAttributes.d.ts +1 -1
- package/dist/packages/core/src/utilities/mergeDeep.d.ts +1 -1
- package/dist/packages/core/src/utilities/minMax.d.ts +1 -1
- package/dist/packages/core/src/utilities/objectIncludes.d.ts +1 -1
- package/dist/packages/core/src/utilities/removeDuplicates.d.ts +1 -1
- package/dist/tiptap-core.cjs.js +13 -11
- package/dist/tiptap-core.cjs.js.map +1 -1
- package/dist/tiptap-core.esm.js +13 -12
- package/dist/tiptap-core.esm.js.map +1 -1
- package/dist/tiptap-core.umd.js +13 -11
- package/dist/tiptap-core.umd.js.map +1 -1
- package/package.json +2 -2
- package/src/CommandManager.ts +2 -2
- package/src/Editor.ts +18 -14
- package/src/EventEmitter.ts +1 -1
- package/src/Extension.ts +3 -3
- package/src/ExtensionManager.ts +11 -11
- package/src/InputRule.ts +3 -3
- package/src/Mark.ts +3 -3
- package/src/Node.ts +3 -3
- package/src/NodeView.ts +1 -1
- package/src/PasteRule.ts +4 -4
- package/src/commands/deleteNode.ts +1 -1
- package/src/commands/extendMarkRange.ts +2 -2
- package/src/commands/focus.ts +3 -3
- package/src/commands/insertContentAt.ts +2 -2
- package/src/commands/lift.ts +2 -2
- package/src/commands/liftListItem.ts +1 -1
- package/src/commands/resetAttributes.ts +4 -4
- package/src/commands/setContent.ts +1 -1
- package/src/commands/setMark.ts +2 -2
- package/src/commands/setNode.ts +1 -1
- package/src/commands/setNodeSelection.ts +1 -1
- package/src/commands/setTextSelection.ts +1 -1
- package/src/commands/sinkListItem.ts +1 -1
- package/src/commands/splitBlock.ts +1 -1
- package/src/commands/splitListItem.ts +2 -2
- package/src/commands/toggleList.ts +3 -3
- package/src/commands/toggleMark.ts +2 -2
- package/src/commands/toggleNode.ts +2 -2
- package/src/commands/toggleWrap.ts +2 -2
- package/src/commands/unsetAllMarks.ts +4 -8
- package/src/commands/unsetMark.ts +2 -2
- package/src/commands/updateAttributes.ts +3 -3
- package/src/commands/wrapIn.ts +2 -2
- package/src/commands/wrapInList.ts +1 -1
- package/src/extensions/clipboardTextSerializer.ts +5 -3
- package/src/helpers/combineTransactionSteps.ts +1 -1
- package/src/helpers/createChainableState.ts +1 -1
- package/src/helpers/createDocument.ts +2 -2
- package/src/helpers/createNodeFromContent.ts +2 -2
- package/src/helpers/defaultBlockAt.ts +1 -1
- package/src/helpers/findChildren.ts +1 -1
- package/src/helpers/findChildrenInRange.ts +1 -1
- package/src/helpers/findParentNode.ts +2 -2
- package/src/helpers/findParentNodeClosestToPos.ts +1 -1
- package/src/helpers/generateHTML.ts +3 -3
- package/src/helpers/generateJSON.ts +3 -3
- package/src/helpers/generateText.ts +4 -4
- package/src/helpers/getAttributes.ts +4 -4
- package/src/helpers/getAttributesFromExtensions.ts +3 -3
- package/src/helpers/getChangedRanges.ts +2 -2
- package/src/helpers/getDebugJSON.ts +1 -1
- package/src/helpers/getExtensionField.ts +1 -1
- package/src/helpers/getHTMLFromFragment.ts +1 -1
- package/src/helpers/getMarkAttributes.ts +2 -2
- package/src/helpers/getMarkRange.ts +2 -2
- package/src/helpers/getMarkType.ts +1 -1
- package/src/helpers/getMarksBetween.ts +2 -2
- package/src/helpers/getNodeAttributes.ts +2 -2
- package/src/helpers/getNodeType.ts +1 -1
- package/src/helpers/getRenderedAttributes.ts +2 -2
- package/src/helpers/getSchema.ts +3 -3
- package/src/helpers/getSchemaByResolvedExtensions.ts +8 -8
- package/src/helpers/getSchemaTypeByName.ts +1 -1
- package/src/helpers/getSchemaTypeNameByName.ts +1 -1
- package/src/helpers/getSplittedAttributes.ts +1 -1
- package/src/helpers/getText.ts +2 -2
- package/src/helpers/getTextBetween.ts +1 -1
- package/src/helpers/getTextSeralizersFromSchema.ts +1 -1
- package/src/helpers/injectExtensionAttributesToParseRule.ts +3 -3
- package/src/helpers/isActive.ts +4 -4
- package/src/helpers/isExtensionRulesEnabled.ts +1 -1
- package/src/helpers/isList.ts +4 -4
- package/src/helpers/isMarkActive.ts +3 -3
- package/src/helpers/isNodeActive.ts +3 -3
- package/src/helpers/isNodeEmpty.ts +1 -1
- package/src/helpers/isNodeSelection.ts +2 -2
- package/src/helpers/isTextSelection.ts +2 -2
- package/src/helpers/posToDOMRect.ts +2 -2
- package/src/helpers/resolveFocusPosition.ts +2 -2
- package/src/helpers/selectionToInsertionEnd.ts +1 -1
- package/src/helpers/splitExtensions.ts +1 -1
- package/src/index.ts +40 -40
- package/src/inputRules/markInputRule.ts +3 -3
- package/src/inputRules/nodeInputRule.ts +2 -2
- package/src/inputRules/textInputRule.ts +1 -1
- package/src/inputRules/textblockTypeInputRule.ts +2 -2
- package/src/inputRules/wrappingInputRule.ts +2 -2
- package/src/pasteRules/markPasteRule.ts +3 -3
- package/src/pasteRules/textPasteRule.ts +1 -1
- package/src/style.ts +1 -3
- package/src/utilities/callOrReturn.ts +2 -2
- package/src/utilities/createStyleTag.ts +1 -1
- package/src/utilities/deleteProps.ts +1 -1
- package/src/utilities/elementFromString.ts +1 -1
- package/src/utilities/findDuplicates.ts +1 -1
- package/src/utilities/fromString.ts +1 -1
- package/src/utilities/isClass.ts +1 -1
- package/src/utilities/isEmptyObject.ts +1 -1
- package/src/utilities/isFunction.ts +1 -1
- package/src/utilities/isNumber.ts +1 -1
- package/src/utilities/isObject.ts +2 -2
- package/src/utilities/isPlainObject.ts +1 -1
- package/src/utilities/isRegExp.ts +1 -1
- package/src/utilities/isString.ts +1 -1
- package/src/utilities/isiOS.ts +1 -1
- package/src/utilities/mergeAttributes.ts +1 -1
- package/src/utilities/mergeDeep.ts +2 -2
- package/src/utilities/minMax.ts +1 -1
- package/src/utilities/objectIncludes.ts +2 -2
- package/src/utilities/removeDuplicates.ts +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { InputRule, InputRuleFinder } from '../InputRule'
|
|
2
2
|
import { NodeType } from 'prosemirror-model'
|
|
3
3
|
import { ExtendedRegExpMatchArray } from '../types'
|
|
4
|
-
import callOrReturn from '../utilities/callOrReturn'
|
|
4
|
+
import { callOrReturn } from '../utilities/callOrReturn'
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Build an input rule that changes the type of a textblock when the
|
|
@@ -9,7 +9,7 @@ import callOrReturn from '../utilities/callOrReturn'
|
|
|
9
9
|
* probably want the regexp to start with `^`, so that the pattern can
|
|
10
10
|
* only occur at the start of a textblock.
|
|
11
11
|
*/
|
|
12
|
-
export
|
|
12
|
+
export function textblockTypeInputRule(config: {
|
|
13
13
|
find: InputRuleFinder,
|
|
14
14
|
type: NodeType,
|
|
15
15
|
getAttributes?:
|
|
@@ -2,7 +2,7 @@ import { InputRule, InputRuleFinder } from '../InputRule'
|
|
|
2
2
|
import { NodeType, Node as ProseMirrorNode } from 'prosemirror-model'
|
|
3
3
|
import { findWrapping, canJoin } from 'prosemirror-transform'
|
|
4
4
|
import { ExtendedRegExpMatchArray } from '../types'
|
|
5
|
-
import callOrReturn from '../utilities/callOrReturn'
|
|
5
|
+
import { callOrReturn } from '../utilities/callOrReturn'
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Build an input rule for automatically wrapping a textblock when a
|
|
@@ -18,7 +18,7 @@ import callOrReturn from '../utilities/callOrReturn'
|
|
|
18
18
|
* expression match and the node before the wrapped node, and can
|
|
19
19
|
* return a boolean to indicate whether a join should happen.
|
|
20
20
|
*/
|
|
21
|
-
export
|
|
21
|
+
export function wrappingInputRule(config: {
|
|
22
22
|
find: InputRuleFinder,
|
|
23
23
|
type: NodeType,
|
|
24
24
|
getAttributes?:
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { PasteRule, PasteRuleFinder } from '../PasteRule'
|
|
2
2
|
import { MarkType } from 'prosemirror-model'
|
|
3
|
-
import getMarksBetween from '../helpers/getMarksBetween'
|
|
4
|
-
import callOrReturn from '../utilities/callOrReturn'
|
|
3
|
+
import { getMarksBetween } from '../helpers/getMarksBetween'
|
|
4
|
+
import { callOrReturn } from '../utilities/callOrReturn'
|
|
5
5
|
import { ExtendedRegExpMatchArray } from '../types'
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Build an paste rule that adds a mark when the
|
|
9
9
|
* matched text is pasted into it.
|
|
10
10
|
*/
|
|
11
|
-
export
|
|
11
|
+
export function markPasteRule(config: {
|
|
12
12
|
find: PasteRuleFinder,
|
|
13
13
|
type: MarkType,
|
|
14
14
|
getAttributes?:
|
|
@@ -4,7 +4,7 @@ import { PasteRule, PasteRuleFinder } from '../PasteRule'
|
|
|
4
4
|
* Build an paste rule that replaces text when the
|
|
5
5
|
* matched text is pasted into it.
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
7
|
+
export function textPasteRule(config: {
|
|
8
8
|
find: PasteRuleFinder,
|
|
9
9
|
replace: string,
|
|
10
10
|
}) {
|
package/src/style.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MaybeReturnType } from '../types'
|
|
2
|
-
import isFunction from './isFunction'
|
|
2
|
+
import { isFunction } from './isFunction'
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Optionally calls `value` as a function.
|
|
@@ -8,7 +8,7 @@ import isFunction from './isFunction'
|
|
|
8
8
|
* @param context Optional context to bind to function.
|
|
9
9
|
* @param props Optional props to pass to function.
|
|
10
10
|
*/
|
|
11
|
-
export
|
|
11
|
+
export function callOrReturn<T>(value: T, context: any = undefined, ...props: any[]): MaybeReturnType<T> {
|
|
12
12
|
if (isFunction(value)) {
|
|
13
13
|
if (context) {
|
|
14
14
|
return value.bind(context)(...props)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export function createStyleTag(style: string): HTMLStyleElement {
|
|
2
2
|
const tipTapStyleTag = (<HTMLStyleElement>document.querySelector('style[data-tiptap-style]'))
|
|
3
3
|
|
|
4
4
|
if (tipTapStyleTag !== null) {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @param obj Object
|
|
4
4
|
* @param key Key to remove
|
|
5
5
|
*/
|
|
6
|
-
export
|
|
6
|
+
export function deleteProps(obj: Record<string, any>, propOrProps: string | string[]): Record<string, any> {
|
|
7
7
|
const props = typeof propOrProps === 'string'
|
|
8
8
|
? [propOrProps]
|
|
9
9
|
: propOrProps
|
package/src/utilities/isClass.ts
CHANGED
|
@@ -4,7 +4,7 @@ function getType(value: any): string {
|
|
|
4
4
|
return Object.prototype.toString.call(value).slice(8, -1)
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
export
|
|
7
|
+
export function isPlainObject(value: any): value is Record<string, any> {
|
|
8
8
|
if (getType(value) !== 'Object') {
|
|
9
9
|
return false
|
|
10
10
|
}
|
package/src/utilities/isiOS.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import isPlainObject from './isPlainObject'
|
|
1
|
+
import { isPlainObject } from './isPlainObject'
|
|
2
2
|
|
|
3
|
-
export
|
|
3
|
+
export function mergeDeep(target: Record<string, any>, source: Record<string, any>): Record<string, any> {
|
|
4
4
|
const output = { ...target }
|
|
5
5
|
|
|
6
6
|
if (isPlainObject(target) && isPlainObject(source)) {
|
package/src/utilities/minMax.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import isRegExp from './isRegExp'
|
|
1
|
+
import { isRegExp } from './isRegExp'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Check if object1 includes object2
|
|
5
5
|
* @param object1 Object
|
|
6
6
|
* @param object2 Object
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
8
|
+
export function objectIncludes(
|
|
9
9
|
object1: Record<string, any>,
|
|
10
10
|
object2: Record<string, any>,
|
|
11
11
|
options: { strict: boolean } = { strict: true },
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Removes duplicated values within an array.
|
|
3
3
|
* Supports numbers, strings and objects.
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
5
|
+
export function removeDuplicates<T>(array: T[], by = JSON.stringify): T[] {
|
|
6
6
|
const seen: Record<any, any> = {}
|
|
7
7
|
|
|
8
8
|
return array.filter(item => {
|