@tiptap/extension-gapcursor 3.0.0-next.0 → 3.0.0-next.1
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/index.cjs +53 -32
- package/dist/index.cjs.map +1 -1
- package/dist/{packages/extension-gapcursor/src/gapcursor.d.ts → index.d.cts} +5 -2
- package/dist/index.d.ts +25 -0
- package/dist/index.js +32 -29
- package/dist/index.js.map +1 -1
- package/package.json +8 -10
- package/dist/index.umd.js +0 -39
- package/dist/index.umd.js.map +0 -1
- package/dist/packages/core/src/CommandManager.d.ts +0 -20
- package/dist/packages/core/src/Editor.d.ts +0 -159
- package/dist/packages/core/src/EventEmitter.d.ts +0 -11
- package/dist/packages/core/src/Extension.d.ts +0 -343
- package/dist/packages/core/src/ExtensionManager.d.ts +0 -55
- package/dist/packages/core/src/InputRule.d.ts +0 -42
- package/dist/packages/core/src/Mark.d.ts +0 -451
- package/dist/packages/core/src/Node.d.ts +0 -611
- package/dist/packages/core/src/NodePos.d.ts +0 -44
- package/dist/packages/core/src/NodeView.d.ts +0 -31
- package/dist/packages/core/src/PasteRule.d.ts +0 -50
- package/dist/packages/core/src/Tracker.d.ts +0 -11
- package/dist/packages/core/src/commands/blur.d.ts +0 -13
- package/dist/packages/core/src/commands/clearContent.d.ts +0 -14
- package/dist/packages/core/src/commands/clearNodes.d.ts +0 -13
- package/dist/packages/core/src/commands/command.d.ts +0 -18
- package/dist/packages/core/src/commands/createParagraphNear.d.ts +0 -13
- package/dist/packages/core/src/commands/cut.d.ts +0 -20
- package/dist/packages/core/src/commands/deleteCurrentNode.d.ts +0 -13
- package/dist/packages/core/src/commands/deleteNode.d.ts +0 -15
- package/dist/packages/core/src/commands/deleteRange.d.ts +0 -14
- package/dist/packages/core/src/commands/deleteSelection.d.ts +0 -13
- package/dist/packages/core/src/commands/enter.d.ts +0 -13
- package/dist/packages/core/src/commands/exitCode.d.ts +0 -13
- package/dist/packages/core/src/commands/extendMarkRange.d.ts +0 -25
- package/dist/packages/core/src/commands/first.d.ts +0 -14
- package/dist/packages/core/src/commands/focus.d.ts +0 -27
- package/dist/packages/core/src/commands/forEach.d.ts +0 -14
- package/dist/packages/core/src/commands/index.d.ts +0 -55
- package/dist/packages/core/src/commands/insertContent.d.ts +0 -34
- package/dist/packages/core/src/commands/insertContentAt.d.ts +0 -47
- package/dist/packages/core/src/commands/join.d.ts +0 -41
- package/dist/packages/core/src/commands/joinItemBackward.d.ts +0 -13
- package/dist/packages/core/src/commands/joinItemForward.d.ts +0 -13
- package/dist/packages/core/src/commands/joinTextblockBackward.d.ts +0 -12
- package/dist/packages/core/src/commands/joinTextblockForward.d.ts +0 -12
- package/dist/packages/core/src/commands/keyboardShortcut.d.ts +0 -14
- package/dist/packages/core/src/commands/lift.d.ts +0 -17
- package/dist/packages/core/src/commands/liftEmptyBlock.d.ts +0 -13
- package/dist/packages/core/src/commands/liftListItem.d.ts +0 -15
- package/dist/packages/core/src/commands/newlineInCode.d.ts +0 -13
- package/dist/packages/core/src/commands/resetAttributes.d.ts +0 -16
- package/dist/packages/core/src/commands/scrollIntoView.d.ts +0 -13
- package/dist/packages/core/src/commands/selectAll.d.ts +0 -13
- package/dist/packages/core/src/commands/selectNodeBackward.d.ts +0 -13
- package/dist/packages/core/src/commands/selectNodeForward.d.ts +0 -13
- package/dist/packages/core/src/commands/selectParentNode.d.ts +0 -13
- package/dist/packages/core/src/commands/selectTextblockEnd.d.ts +0 -13
- package/dist/packages/core/src/commands/selectTextblockStart.d.ts +0 -13
- package/dist/packages/core/src/commands/setContent.d.ts +0 -40
- package/dist/packages/core/src/commands/setMark.d.ts +0 -15
- package/dist/packages/core/src/commands/setMeta.d.ts +0 -15
- package/dist/packages/core/src/commands/setNode.d.ts +0 -16
- package/dist/packages/core/src/commands/setNodeSelection.d.ts +0 -14
- package/dist/packages/core/src/commands/setTextSelection.d.ts +0 -14
- package/dist/packages/core/src/commands/sinkListItem.d.ts +0 -15
- package/dist/packages/core/src/commands/splitBlock.d.ts +0 -17
- package/dist/packages/core/src/commands/splitListItem.d.ts +0 -15
- package/dist/packages/core/src/commands/toggleList.d.ts +0 -18
- package/dist/packages/core/src/commands/toggleMark.d.ts +0 -30
- package/dist/packages/core/src/commands/toggleNode.d.ts +0 -17
- package/dist/packages/core/src/commands/toggleWrap.d.ts +0 -16
- package/dist/packages/core/src/commands/undoInputRule.d.ts +0 -13
- package/dist/packages/core/src/commands/unsetAllMarks.d.ts +0 -13
- package/dist/packages/core/src/commands/unsetMark.d.ts +0 -25
- package/dist/packages/core/src/commands/updateAttributes.d.ts +0 -24
- package/dist/packages/core/src/commands/wrapIn.d.ts +0 -16
- package/dist/packages/core/src/commands/wrapInList.d.ts +0 -16
- package/dist/packages/core/src/extensions/clipboardTextSerializer.d.ts +0 -5
- package/dist/packages/core/src/extensions/commands.d.ts +0 -3
- package/dist/packages/core/src/extensions/editable.d.ts +0 -2
- package/dist/packages/core/src/extensions/focusEvents.d.ts +0 -2
- package/dist/packages/core/src/extensions/index.d.ts +0 -6
- package/dist/packages/core/src/extensions/keymap.d.ts +0 -2
- package/dist/packages/core/src/extensions/tabindex.d.ts +0 -2
- package/dist/packages/core/src/helpers/combineTransactionSteps.d.ts +0 -10
- package/dist/packages/core/src/helpers/createChainableState.d.ts +0 -10
- package/dist/packages/core/src/helpers/createDocument.d.ts +0 -12
- package/dist/packages/core/src/helpers/createNodeFromContent.d.ts +0 -15
- package/dist/packages/core/src/helpers/defaultBlockAt.d.ts +0 -7
- package/dist/packages/core/src/helpers/findChildren.d.ts +0 -9
- package/dist/packages/core/src/helpers/findChildrenInRange.d.ts +0 -10
- package/dist/packages/core/src/helpers/findParentNode.d.ts +0 -16
- package/dist/packages/core/src/helpers/findParentNodeClosestToPos.d.ts +0 -17
- package/dist/packages/core/src/helpers/generateHTML.d.ts +0 -8
- package/dist/packages/core/src/helpers/generateJSON.d.ts +0 -8
- package/dist/packages/core/src/helpers/generateText.d.ts +0 -12
- package/dist/packages/core/src/helpers/getAttributes.d.ts +0 -9
- package/dist/packages/core/src/helpers/getAttributesFromExtensions.d.ts +0 -6
- package/dist/packages/core/src/helpers/getChangedRanges.d.ts +0 -11
- package/dist/packages/core/src/helpers/getDebugJSON.d.ts +0 -8
- package/dist/packages/core/src/helpers/getExtensionField.d.ts +0 -9
- package/dist/packages/core/src/helpers/getHTMLFromFragment.d.ts +0 -2
- package/dist/packages/core/src/helpers/getMarkAttributes.d.ts +0 -3
- package/dist/packages/core/src/helpers/getMarkRange.d.ts +0 -3
- package/dist/packages/core/src/helpers/getMarkType.d.ts +0 -2
- package/dist/packages/core/src/helpers/getMarksBetween.d.ts +0 -3
- package/dist/packages/core/src/helpers/getNodeAtPosition.d.ts +0 -11
- package/dist/packages/core/src/helpers/getNodeAttributes.d.ts +0 -3
- package/dist/packages/core/src/helpers/getNodeType.d.ts +0 -2
- package/dist/packages/core/src/helpers/getRenderedAttributes.d.ts +0 -3
- package/dist/packages/core/src/helpers/getSchema.d.ts +0 -4
- package/dist/packages/core/src/helpers/getSchemaByResolvedExtensions.d.ts +0 -10
- package/dist/packages/core/src/helpers/getSchemaTypeByName.d.ts +0 -8
- package/dist/packages/core/src/helpers/getSchemaTypeNameByName.d.ts +0 -8
- package/dist/packages/core/src/helpers/getSplittedAttributes.d.ts +0 -9
- package/dist/packages/core/src/helpers/getText.d.ts +0 -15
- package/dist/packages/core/src/helpers/getTextBetween.d.ts +0 -14
- package/dist/packages/core/src/helpers/getTextContentFromNodes.d.ts +0 -8
- package/dist/packages/core/src/helpers/getTextSerializersFromSchema.d.ts +0 -8
- package/dist/packages/core/src/helpers/index.d.ts +0 -50
- package/dist/packages/core/src/helpers/injectExtensionAttributesToParseRule.d.ts +0 -9
- package/dist/packages/core/src/helpers/isActive.d.ts +0 -2
- package/dist/packages/core/src/helpers/isAtEndOfNode.d.ts +0 -2
- package/dist/packages/core/src/helpers/isAtStartOfNode.d.ts +0 -2
- package/dist/packages/core/src/helpers/isExtensionRulesEnabled.d.ts +0 -2
- package/dist/packages/core/src/helpers/isList.d.ts +0 -2
- package/dist/packages/core/src/helpers/isMarkActive.d.ts +0 -3
- package/dist/packages/core/src/helpers/isNodeActive.d.ts +0 -3
- package/dist/packages/core/src/helpers/isNodeEmpty.d.ts +0 -8
- package/dist/packages/core/src/helpers/isNodeSelection.d.ts +0 -2
- package/dist/packages/core/src/helpers/isTextSelection.d.ts +0 -2
- package/dist/packages/core/src/helpers/posToDOMRect.d.ts +0 -2
- package/dist/packages/core/src/helpers/resolveFocusPosition.d.ts +0 -4
- package/dist/packages/core/src/helpers/selectionToInsertionEnd.d.ts +0 -2
- package/dist/packages/core/src/helpers/splitExtensions.d.ts +0 -9
- package/dist/packages/core/src/index.d.ts +0 -24
- package/dist/packages/core/src/inputRules/index.d.ts +0 -5
- package/dist/packages/core/src/inputRules/markInputRule.d.ts +0 -13
- package/dist/packages/core/src/inputRules/nodeInputRule.d.ts +0 -23
- package/dist/packages/core/src/inputRules/textInputRule.d.ts +0 -10
- package/dist/packages/core/src/inputRules/textblockTypeInputRule.d.ts +0 -15
- package/dist/packages/core/src/inputRules/wrappingInputRule.d.ts +0 -28
- package/dist/packages/core/src/pasteRules/index.d.ts +0 -3
- package/dist/packages/core/src/pasteRules/markPasteRule.d.ts +0 -13
- package/dist/packages/core/src/pasteRules/nodePasteRule.d.ts +0 -13
- package/dist/packages/core/src/pasteRules/textPasteRule.d.ts +0 -10
- package/dist/packages/core/src/style.d.ts +0 -1
- package/dist/packages/core/src/types.d.ts +0 -253
- package/dist/packages/core/src/utilities/callOrReturn.d.ts +0 -9
- package/dist/packages/core/src/utilities/createStyleTag.d.ts +0 -1
- package/dist/packages/core/src/utilities/deleteProps.d.ts +0 -6
- package/dist/packages/core/src/utilities/elementFromString.d.ts +0 -1
- package/dist/packages/core/src/utilities/escapeForRegEx.d.ts +0 -1
- package/dist/packages/core/src/utilities/findDuplicates.d.ts +0 -1
- package/dist/packages/core/src/utilities/fromString.d.ts +0 -1
- package/dist/packages/core/src/utilities/index.d.ts +0 -20
- package/dist/packages/core/src/utilities/isAndroid.d.ts +0 -1
- package/dist/packages/core/src/utilities/isEmptyObject.d.ts +0 -1
- package/dist/packages/core/src/utilities/isFunction.d.ts +0 -1
- package/dist/packages/core/src/utilities/isMacOS.d.ts +0 -1
- package/dist/packages/core/src/utilities/isNumber.d.ts +0 -1
- package/dist/packages/core/src/utilities/isPlainObject.d.ts +0 -1
- package/dist/packages/core/src/utilities/isRegExp.d.ts +0 -1
- package/dist/packages/core/src/utilities/isString.d.ts +0 -1
- package/dist/packages/core/src/utilities/isiOS.d.ts +0 -1
- package/dist/packages/core/src/utilities/mergeAttributes.d.ts +0 -1
- package/dist/packages/core/src/utilities/mergeDeep.d.ts +0 -1
- package/dist/packages/core/src/utilities/minMax.d.ts +0 -1
- package/dist/packages/core/src/utilities/objectIncludes.d.ts +0 -8
- package/dist/packages/core/src/utilities/removeDuplicates.d.ts +0 -8
- package/dist/packages/extension-gapcursor/src/index.d.ts +0 -3
package/dist/index.cjs
CHANGED
|
@@ -1,36 +1,57 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
2
19
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var src_exports = {};
|
|
22
|
+
__export(src_exports, {
|
|
23
|
+
Gapcursor: () => Gapcursor,
|
|
24
|
+
default: () => src_default
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(src_exports);
|
|
7
27
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
allowGapCursor: (_a = core.callOrReturn(core.getExtensionField(extension, 'allowGapCursor', context))) !== null && _a !== void 0 ? _a : null,
|
|
30
|
-
};
|
|
31
|
-
},
|
|
28
|
+
// src/gapcursor.ts
|
|
29
|
+
var import_core = require("@tiptap/core");
|
|
30
|
+
var import_gapcursor = require("@tiptap/pm/gapcursor");
|
|
31
|
+
var Gapcursor = import_core.Extension.create({
|
|
32
|
+
name: "gapCursor",
|
|
33
|
+
addProseMirrorPlugins() {
|
|
34
|
+
return [
|
|
35
|
+
(0, import_gapcursor.gapCursor)()
|
|
36
|
+
];
|
|
37
|
+
},
|
|
38
|
+
extendNodeSchema(extension) {
|
|
39
|
+
var _a;
|
|
40
|
+
const context = {
|
|
41
|
+
name: extension.name,
|
|
42
|
+
options: extension.options,
|
|
43
|
+
storage: extension.storage
|
|
44
|
+
};
|
|
45
|
+
return {
|
|
46
|
+
allowGapCursor: (_a = (0, import_core.callOrReturn)((0, import_core.getExtensionField)(extension, "allowGapCursor", context))) != null ? _a : null
|
|
47
|
+
};
|
|
48
|
+
}
|
|
32
49
|
});
|
|
33
50
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
51
|
+
// src/index.ts
|
|
52
|
+
var src_default = Gapcursor;
|
|
53
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
54
|
+
0 && (module.exports = {
|
|
55
|
+
Gapcursor
|
|
56
|
+
});
|
|
57
|
+
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/gapcursor.ts"],"sourcesContent":["import { Gapcursor } from './gapcursor.js'\n\nexport * from './gapcursor.js'\n\nexport default Gapcursor\n","import {\n callOrReturn,\n Extension,\n getExtensionField,\n ParentConfig,\n} from '@tiptap/core'\nimport { gapCursor } from '@tiptap/pm/gapcursor'\n\ndeclare module '@tiptap/core' {\n interface NodeConfig<Options, Storage> {\n /**\n * A function to determine whether the gap cursor is allowed at the current position. Must return `true` or `false`.\n * @default null\n */\n allowGapCursor?:\n | boolean\n | null\n | ((this: {\n name: string,\n options: Options,\n storage: Storage,\n parent: ParentConfig<NodeConfig<Options>>['allowGapCursor'],\n }) => boolean | null),\n }\n}\n\n/**\n * This extension allows you to add a gap cursor to your editor.\n * A gap cursor is a cursor that appears when you click on a place\n * where no content is present, for example inbetween nodes.\n * @see https://tiptap.dev/api/extensions/gapcursor\n */\nexport const Gapcursor = Extension.create({\n name: 'gapCursor',\n\n addProseMirrorPlugins() {\n return [\n gapCursor(),\n ]\n },\n\n extendNodeSchema(extension) {\n const context = {\n name: extension.name,\n options: extension.options,\n storage: extension.storage,\n }\n\n return {\n allowGapCursor: callOrReturn(getExtensionField(extension, 'allowGapCursor', context)) ?? null,\n }\n },\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,kBAKO;AACP,uBAA0B;AA0BnB,IAAM,YAAY,sBAAU,OAAO;AAAA,EACxC,MAAM;AAAA,EAEN,wBAAwB;AACtB,WAAO;AAAA,UACL,4BAAU;AAAA,IACZ;AAAA,EACF;AAAA,EAEA,iBAAiB,WAAW;AAzC9B;AA0CI,UAAM,UAAU;AAAA,MACd,MAAM,UAAU;AAAA,MAChB,SAAS,UAAU;AAAA,MACnB,SAAS,UAAU;AAAA,IACrB;AAEA,WAAO;AAAA,MACL,iBAAgB,uCAAa,+BAAkB,WAAW,kBAAkB,OAAO,CAAC,MAApE,YAAyE;AAAA,IAC3F;AAAA,EACF;AACF,CAAC;;;ADhDD,IAAO,cAAQ;","names":[]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ParentConfig, Extension } from '@tiptap/core';
|
|
2
|
+
|
|
2
3
|
declare module '@tiptap/core' {
|
|
3
4
|
interface NodeConfig<Options, Storage> {
|
|
4
5
|
/**
|
|
@@ -19,4 +20,6 @@ declare module '@tiptap/core' {
|
|
|
19
20
|
* where no content is present, for example inbetween nodes.
|
|
20
21
|
* @see https://tiptap.dev/api/extensions/gapcursor
|
|
21
22
|
*/
|
|
22
|
-
|
|
23
|
+
declare const Gapcursor: Extension<any, any>;
|
|
24
|
+
|
|
25
|
+
export { Gapcursor, Gapcursor as default };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ParentConfig, Extension } from '@tiptap/core';
|
|
2
|
+
|
|
3
|
+
declare module '@tiptap/core' {
|
|
4
|
+
interface NodeConfig<Options, Storage> {
|
|
5
|
+
/**
|
|
6
|
+
* A function to determine whether the gap cursor is allowed at the current position. Must return `true` or `false`.
|
|
7
|
+
* @default null
|
|
8
|
+
*/
|
|
9
|
+
allowGapCursor?: boolean | null | ((this: {
|
|
10
|
+
name: string;
|
|
11
|
+
options: Options;
|
|
12
|
+
storage: Storage;
|
|
13
|
+
parent: ParentConfig<NodeConfig<Options>>['allowGapCursor'];
|
|
14
|
+
}) => boolean | null);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* This extension allows you to add a gap cursor to your editor.
|
|
19
|
+
* A gap cursor is a cursor that appears when you click on a place
|
|
20
|
+
* where no content is present, for example inbetween nodes.
|
|
21
|
+
* @see https://tiptap.dev/api/extensions/gapcursor
|
|
22
|
+
*/
|
|
23
|
+
declare const Gapcursor: Extension<any, any>;
|
|
24
|
+
|
|
25
|
+
export { Gapcursor, Gapcursor as default };
|
package/dist/index.js
CHANGED
|
@@ -1,31 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
};
|
|
27
|
-
},
|
|
1
|
+
// src/gapcursor.ts
|
|
2
|
+
import {
|
|
3
|
+
callOrReturn,
|
|
4
|
+
Extension,
|
|
5
|
+
getExtensionField
|
|
6
|
+
} from "@tiptap/core";
|
|
7
|
+
import { gapCursor } from "@tiptap/pm/gapcursor";
|
|
8
|
+
var Gapcursor = Extension.create({
|
|
9
|
+
name: "gapCursor",
|
|
10
|
+
addProseMirrorPlugins() {
|
|
11
|
+
return [
|
|
12
|
+
gapCursor()
|
|
13
|
+
];
|
|
14
|
+
},
|
|
15
|
+
extendNodeSchema(extension) {
|
|
16
|
+
var _a;
|
|
17
|
+
const context = {
|
|
18
|
+
name: extension.name,
|
|
19
|
+
options: extension.options,
|
|
20
|
+
storage: extension.storage
|
|
21
|
+
};
|
|
22
|
+
return {
|
|
23
|
+
allowGapCursor: (_a = callOrReturn(getExtensionField(extension, "allowGapCursor", context))) != null ? _a : null
|
|
24
|
+
};
|
|
25
|
+
}
|
|
28
26
|
});
|
|
29
27
|
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
// src/index.ts
|
|
29
|
+
var src_default = Gapcursor;
|
|
30
|
+
export {
|
|
31
|
+
Gapcursor,
|
|
32
|
+
src_default as default
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../src/gapcursor.ts","../src/index.ts"],"sourcesContent":["import {\n callOrReturn,\n Extension,\n getExtensionField,\n ParentConfig,\n} from '@tiptap/core'\nimport { gapCursor } from '@tiptap/pm/gapcursor'\n\ndeclare module '@tiptap/core' {\n interface NodeConfig<Options, Storage> {\n /**\n * A function to determine whether the gap cursor is allowed at the current position. Must return `true` or `false`.\n * @default null\n */\n allowGapCursor?:\n | boolean\n | null\n | ((this: {\n name: string,\n options: Options,\n storage: Storage,\n parent: ParentConfig<NodeConfig<Options>>['allowGapCursor'],\n }) => boolean | null),\n }\n}\n\n/**\n * This extension allows you to add a gap cursor to your editor.\n * A gap cursor is a cursor that appears when you click on a place\n * where no content is present, for example inbetween nodes.\n * @see https://tiptap.dev/api/extensions/gapcursor\n */\nexport const Gapcursor = Extension.create({\n name: 'gapCursor',\n\n addProseMirrorPlugins() {\n return [\n gapCursor(),\n ]\n },\n\n extendNodeSchema(extension) {\n const context = {\n name: extension.name,\n options: extension.options,\n storage: extension.storage,\n }\n\n return {\n allowGapCursor: callOrReturn(getExtensionField(extension, 'allowGapCursor', context)) ?? null,\n }\n },\n})\n","import { Gapcursor } from './gapcursor.js'\n\nexport * from './gapcursor.js'\n\nexport default Gapcursor\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,iBAAiB;AA0BnB,IAAM,YAAY,UAAU,OAAO;AAAA,EACxC,MAAM;AAAA,EAEN,wBAAwB;AACtB,WAAO;AAAA,MACL,UAAU;AAAA,IACZ;AAAA,EACF;AAAA,EAEA,iBAAiB,WAAW;AAzC9B;AA0CI,UAAM,UAAU;AAAA,MACd,MAAM,UAAU;AAAA,MAChB,SAAS,UAAU;AAAA,MACnB,SAAS,UAAU;AAAA,IACrB;AAEA,WAAO;AAAA,MACL,iBAAgB,kBAAa,kBAAkB,WAAW,kBAAkB,OAAO,CAAC,MAApE,YAAyE;AAAA,IAC3F;AAAA,EACF;AACF,CAAC;;;AChDD,IAAO,cAAQ;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tiptap/extension-gapcursor",
|
|
3
3
|
"description": "gapcursor extension for tiptap",
|
|
4
|
-
"version": "3.0.0-next.
|
|
4
|
+
"version": "3.0.0-next.1",
|
|
5
5
|
"homepage": "https://tiptap.dev",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"tiptap",
|
|
@@ -15,26 +15,25 @@
|
|
|
15
15
|
"type": "module",
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
18
|
-
"types": "./dist/
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
19
|
"import": "./dist/index.js",
|
|
20
20
|
"require": "./dist/index.cjs"
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
23
|
"main": "dist/index.cjs",
|
|
24
24
|
"module": "dist/index.js",
|
|
25
|
-
"
|
|
26
|
-
"types": "dist/packages/extension-gapcursor/src/index.d.ts",
|
|
25
|
+
"types": "dist/index.d.ts",
|
|
27
26
|
"files": [
|
|
28
27
|
"src",
|
|
29
28
|
"dist"
|
|
30
29
|
],
|
|
31
30
|
"devDependencies": {
|
|
32
|
-
"@tiptap/core": "^3.0.0-next.
|
|
33
|
-
"@tiptap/pm": "^3.0.0-next.
|
|
31
|
+
"@tiptap/core": "^3.0.0-next.1",
|
|
32
|
+
"@tiptap/pm": "^3.0.0-next.1"
|
|
34
33
|
},
|
|
35
34
|
"peerDependencies": {
|
|
36
|
-
"@tiptap/core": "^3.0.0-next.
|
|
37
|
-
"@tiptap/pm": "^3.0.0-next.
|
|
35
|
+
"@tiptap/core": "^3.0.0-next.1",
|
|
36
|
+
"@tiptap/pm": "^3.0.0-next.1"
|
|
38
37
|
},
|
|
39
38
|
"repository": {
|
|
40
39
|
"type": "git",
|
|
@@ -42,7 +41,6 @@
|
|
|
42
41
|
"directory": "packages/extension-gapcursor"
|
|
43
42
|
},
|
|
44
43
|
"scripts": {
|
|
45
|
-
"
|
|
46
|
-
"build": "npm run clean && rollup -c"
|
|
44
|
+
"build": "tsup"
|
|
47
45
|
}
|
|
48
46
|
}
|
package/dist/index.umd.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@tiptap/core'), require('@tiptap/pm/gapcursor')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', '@tiptap/core', '@tiptap/pm/gapcursor'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@tiptap/extension-gapcursor"] = {}, global.core, global.gapcursor));
|
|
5
|
-
})(this, (function (exports, core, gapcursor) { 'use strict';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* This extension allows you to add a gap cursor to your editor.
|
|
9
|
-
* A gap cursor is a cursor that appears when you click on a place
|
|
10
|
-
* where no content is present, for example inbetween nodes.
|
|
11
|
-
* @see https://tiptap.dev/api/extensions/gapcursor
|
|
12
|
-
*/
|
|
13
|
-
const Gapcursor = core.Extension.create({
|
|
14
|
-
name: 'gapCursor',
|
|
15
|
-
addProseMirrorPlugins() {
|
|
16
|
-
return [
|
|
17
|
-
gapcursor.gapCursor(),
|
|
18
|
-
];
|
|
19
|
-
},
|
|
20
|
-
extendNodeSchema(extension) {
|
|
21
|
-
var _a;
|
|
22
|
-
const context = {
|
|
23
|
-
name: extension.name,
|
|
24
|
-
options: extension.options,
|
|
25
|
-
storage: extension.storage,
|
|
26
|
-
};
|
|
27
|
-
return {
|
|
28
|
-
allowGapCursor: (_a = core.callOrReturn(core.getExtensionField(extension, 'allowGapCursor', context))) !== null && _a !== void 0 ? _a : null,
|
|
29
|
-
};
|
|
30
|
-
},
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
exports.Gapcursor = Gapcursor;
|
|
34
|
-
exports.default = Gapcursor;
|
|
35
|
-
|
|
36
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
37
|
-
|
|
38
|
-
}));
|
|
39
|
-
//# sourceMappingURL=index.umd.js.map
|
package/dist/index.umd.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.umd.js","sources":["../src/gapcursor.ts"],"sourcesContent":["import {\n callOrReturn,\n Extension,\n getExtensionField,\n ParentConfig,\n} from '@tiptap/core'\nimport { gapCursor } from '@tiptap/pm/gapcursor'\n\ndeclare module '@tiptap/core' {\n interface NodeConfig<Options, Storage> {\n /**\n * A function to determine whether the gap cursor is allowed at the current position. Must return `true` or `false`.\n * @default null\n */\n allowGapCursor?:\n | boolean\n | null\n | ((this: {\n name: string,\n options: Options,\n storage: Storage,\n parent: ParentConfig<NodeConfig<Options>>['allowGapCursor'],\n }) => boolean | null),\n }\n}\n\n/**\n * This extension allows you to add a gap cursor to your editor.\n * A gap cursor is a cursor that appears when you click on a place\n * where no content is present, for example inbetween nodes.\n * @see https://tiptap.dev/api/extensions/gapcursor\n */\nexport const Gapcursor = Extension.create({\n name: 'gapCursor',\n\n addProseMirrorPlugins() {\n return [\n gapCursor(),\n ]\n },\n\n extendNodeSchema(extension) {\n const context = {\n name: extension.name,\n options: extension.options,\n storage: extension.storage,\n }\n\n return {\n allowGapCursor: callOrReturn(getExtensionField(extension, 'allowGapCursor', context)) ?? null,\n }\n },\n})\n"],"names":["Extension","gapCursor","callOrReturn","getExtensionField"],"mappings":";;;;;;EA0BA;;;;;EAKG;AACU,QAAA,SAAS,GAAGA,cAAS,CAAC,MAAM,CAAC;EACxC,IAAA,IAAI,EAAE,WAAW;MAEjB,qBAAqB,GAAA;UACnB,OAAO;EACL,YAAAC,mBAAS,EAAE;WACZ,CAAA;OACF;EAED,IAAA,gBAAgB,CAAC,SAAS,EAAA;;EACxB,QAAA,MAAM,OAAO,GAAG;cACd,IAAI,EAAE,SAAS,CAAC,IAAI;cACpB,OAAO,EAAE,SAAS,CAAC,OAAO;cAC1B,OAAO,EAAE,SAAS,CAAC,OAAO;WAC3B,CAAA;UAED,OAAO;EACL,YAAA,cAAc,EAAE,CAAA,EAAA,GAAAC,iBAAY,CAACC,sBAAiB,CAAC,SAAS,EAAE,gBAAgB,EAAE,OAAO,CAAC,CAAC,mCAAI,IAAI;WAC9F,CAAA;OACF;EACF,CAAA;;;;;;;;;;;"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { EditorState, Transaction } from '@tiptap/pm/state';
|
|
2
|
-
import { Editor } from './Editor.js';
|
|
3
|
-
import { AnyCommands, CanCommands, ChainedCommands, CommandProps, SingleCommands } from './types.js';
|
|
4
|
-
export declare class CommandManager {
|
|
5
|
-
editor: Editor;
|
|
6
|
-
rawCommands: AnyCommands;
|
|
7
|
-
customState?: EditorState;
|
|
8
|
-
constructor(props: {
|
|
9
|
-
editor: Editor;
|
|
10
|
-
state?: EditorState;
|
|
11
|
-
});
|
|
12
|
-
get hasCustomState(): boolean;
|
|
13
|
-
get state(): EditorState;
|
|
14
|
-
get commands(): SingleCommands;
|
|
15
|
-
get chain(): () => ChainedCommands;
|
|
16
|
-
get can(): () => CanCommands;
|
|
17
|
-
createChain(startTr?: Transaction, shouldDispatch?: boolean): ChainedCommands;
|
|
18
|
-
createCan(startTr?: Transaction): CanCommands;
|
|
19
|
-
buildProps(tr: Transaction, shouldDispatch?: boolean): CommandProps;
|
|
20
|
-
}
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
import { MarkType, NodeType, Schema } from '@tiptap/pm/model';
|
|
2
|
-
import { EditorState, Plugin, PluginKey, Transaction } from '@tiptap/pm/state';
|
|
3
|
-
import { EditorView } from '@tiptap/pm/view';
|
|
4
|
-
import { EventEmitter } from './EventEmitter.js';
|
|
5
|
-
import { ExtensionManager } from './ExtensionManager.js';
|
|
6
|
-
import { NodePos } from './NodePos.js';
|
|
7
|
-
import { CanCommands, ChainedCommands, EditorEvents, EditorOptions, JSONContent, SingleCommands, TextSerializer } from './types.js';
|
|
8
|
-
export * as extensions from './extensions/index.js';
|
|
9
|
-
export interface TiptapEditorHTMLElement extends HTMLElement {
|
|
10
|
-
editor?: Editor;
|
|
11
|
-
}
|
|
12
|
-
export declare class Editor extends EventEmitter<EditorEvents> {
|
|
13
|
-
private commandManager;
|
|
14
|
-
extensionManager: ExtensionManager;
|
|
15
|
-
private css;
|
|
16
|
-
schema: Schema;
|
|
17
|
-
view: EditorView;
|
|
18
|
-
isFocused: boolean;
|
|
19
|
-
extensionStorage: Record<string, any>;
|
|
20
|
-
options: EditorOptions;
|
|
21
|
-
constructor(options?: Partial<EditorOptions>);
|
|
22
|
-
/**
|
|
23
|
-
* Returns the editor storage.
|
|
24
|
-
*/
|
|
25
|
-
get storage(): Record<string, any>;
|
|
26
|
-
/**
|
|
27
|
-
* An object of all registered commands.
|
|
28
|
-
*/
|
|
29
|
-
get commands(): SingleCommands;
|
|
30
|
-
/**
|
|
31
|
-
* Create a command chain to call multiple commands at once.
|
|
32
|
-
*/
|
|
33
|
-
chain(): ChainedCommands;
|
|
34
|
-
/**
|
|
35
|
-
* Check if a command or a command chain can be executed. Without executing it.
|
|
36
|
-
*/
|
|
37
|
-
can(): CanCommands;
|
|
38
|
-
/**
|
|
39
|
-
* Inject CSS styles.
|
|
40
|
-
*/
|
|
41
|
-
private injectCSS;
|
|
42
|
-
/**
|
|
43
|
-
* Update editor options.
|
|
44
|
-
*
|
|
45
|
-
* @param options A list of options
|
|
46
|
-
*/
|
|
47
|
-
setOptions(options?: Partial<EditorOptions>): void;
|
|
48
|
-
/**
|
|
49
|
-
* Update editable state of the editor.
|
|
50
|
-
*/
|
|
51
|
-
setEditable(editable: boolean, emitUpdate?: boolean): void;
|
|
52
|
-
/**
|
|
53
|
-
* Returns whether the editor is editable.
|
|
54
|
-
*/
|
|
55
|
-
get isEditable(): boolean;
|
|
56
|
-
/**
|
|
57
|
-
* Returns the editor state.
|
|
58
|
-
*/
|
|
59
|
-
get state(): EditorState;
|
|
60
|
-
/**
|
|
61
|
-
* Register a ProseMirror plugin.
|
|
62
|
-
*
|
|
63
|
-
* @param plugin A ProseMirror plugin
|
|
64
|
-
* @param handlePlugins Control how to merge the plugin into the existing plugins.
|
|
65
|
-
*/
|
|
66
|
-
registerPlugin(plugin: Plugin, handlePlugins?: (newPlugin: Plugin, plugins: Plugin[]) => Plugin[]): void;
|
|
67
|
-
/**
|
|
68
|
-
* Unregister a ProseMirror plugin.
|
|
69
|
-
*
|
|
70
|
-
* @param nameOrPluginKey The plugins name
|
|
71
|
-
*/
|
|
72
|
-
unregisterPlugin(nameOrPluginKey: string | PluginKey): void;
|
|
73
|
-
/**
|
|
74
|
-
* Creates an extension manager.
|
|
75
|
-
*/
|
|
76
|
-
private createExtensionManager;
|
|
77
|
-
/**
|
|
78
|
-
* Creates an command manager.
|
|
79
|
-
*/
|
|
80
|
-
private createCommandManager;
|
|
81
|
-
/**
|
|
82
|
-
* Creates a ProseMirror schema.
|
|
83
|
-
*/
|
|
84
|
-
private createSchema;
|
|
85
|
-
/**
|
|
86
|
-
* Creates a ProseMirror view.
|
|
87
|
-
*/
|
|
88
|
-
private createView;
|
|
89
|
-
/**
|
|
90
|
-
* Creates all node views.
|
|
91
|
-
*/
|
|
92
|
-
createNodeViews(): void;
|
|
93
|
-
/**
|
|
94
|
-
* Prepend class name to element.
|
|
95
|
-
*/
|
|
96
|
-
prependClass(): void;
|
|
97
|
-
isCapturingTransaction: boolean;
|
|
98
|
-
private capturedTransaction;
|
|
99
|
-
captureTransaction(fn: Function): Transaction | null;
|
|
100
|
-
/**
|
|
101
|
-
* The callback over which to send transactions (state updates) produced by the view.
|
|
102
|
-
*
|
|
103
|
-
* @param transaction An editor state transaction
|
|
104
|
-
*/
|
|
105
|
-
private dispatchTransaction;
|
|
106
|
-
/**
|
|
107
|
-
* Get attributes of the currently selected node or mark.
|
|
108
|
-
*/
|
|
109
|
-
getAttributes(nameOrType: string | NodeType | MarkType): Record<string, any>;
|
|
110
|
-
/**
|
|
111
|
-
* Returns if the currently selected node or mark is active.
|
|
112
|
-
*
|
|
113
|
-
* @param name Name of the node or mark
|
|
114
|
-
* @param attributes Attributes of the node or mark
|
|
115
|
-
*/
|
|
116
|
-
isActive(name: string, attributes?: {}): boolean;
|
|
117
|
-
isActive(attributes: {}): boolean;
|
|
118
|
-
/**
|
|
119
|
-
* Get the document as JSON.
|
|
120
|
-
*/
|
|
121
|
-
getJSON(): JSONContent;
|
|
122
|
-
/**
|
|
123
|
-
* Get the document as HTML.
|
|
124
|
-
*/
|
|
125
|
-
getHTML(): string;
|
|
126
|
-
/**
|
|
127
|
-
* Get the document as text.
|
|
128
|
-
*/
|
|
129
|
-
getText(options?: {
|
|
130
|
-
blockSeparator?: string;
|
|
131
|
-
textSerializers?: Record<string, TextSerializer>;
|
|
132
|
-
}): string;
|
|
133
|
-
/**
|
|
134
|
-
* Check if there is no content.
|
|
135
|
-
*/
|
|
136
|
-
get isEmpty(): boolean;
|
|
137
|
-
/**
|
|
138
|
-
* Get the number of characters for the current document.
|
|
139
|
-
*
|
|
140
|
-
* @deprecated
|
|
141
|
-
*/
|
|
142
|
-
getCharacterCount(): number;
|
|
143
|
-
/**
|
|
144
|
-
* Destroy the editor.
|
|
145
|
-
*/
|
|
146
|
-
destroy(): void;
|
|
147
|
-
/**
|
|
148
|
-
* Check if the editor is already destroyed.
|
|
149
|
-
*/
|
|
150
|
-
get isDestroyed(): boolean;
|
|
151
|
-
$node(selector: string, attributes?: {
|
|
152
|
-
[key: string]: any;
|
|
153
|
-
}): NodePos | null;
|
|
154
|
-
$nodes(selector: string, attributes?: {
|
|
155
|
-
[key: string]: any;
|
|
156
|
-
}): NodePos[] | null;
|
|
157
|
-
$pos(pos: number): NodePos;
|
|
158
|
-
get $doc(): NodePos;
|
|
159
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
type StringKeyOf<T> = Extract<keyof T, string>;
|
|
2
|
-
type CallbackType<T extends Record<string, any>, EventName extends StringKeyOf<T>> = T[EventName] extends any[] ? T[EventName] : [T[EventName]];
|
|
3
|
-
type CallbackFunction<T extends Record<string, any>, EventName extends StringKeyOf<T>> = (...props: CallbackType<T, EventName>) => any;
|
|
4
|
-
export declare class EventEmitter<T extends Record<string, any>> {
|
|
5
|
-
private callbacks;
|
|
6
|
-
on<EventName extends StringKeyOf<T>>(event: EventName, fn: CallbackFunction<T, EventName>): this;
|
|
7
|
-
emit<EventName extends StringKeyOf<T>>(event: EventName, ...args: CallbackType<T, EventName>): this;
|
|
8
|
-
off<EventName extends StringKeyOf<T>>(event: EventName, fn?: CallbackFunction<T, EventName>): this;
|
|
9
|
-
removeAllListeners(): void;
|
|
10
|
-
}
|
|
11
|
-
export {};
|