@tiptap/core 2.4.0 → 2.5.0-beta.0
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 +4 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +4 -3
- package/dist/index.umd.js.map +1 -1
- package/dist/packages/core/src/EventEmitter.d.ts +2 -2
- package/package.json +2 -2
- package/src/EventEmitter.ts +2 -2
- package/src/commands/joinItemBackward.ts +4 -2
- package/src/inputRules/nodeInputRule.ts +3 -1
|
@@ -4,8 +4,8 @@ declare type CallbackFunction<T extends Record<string, any>, EventName extends S
|
|
|
4
4
|
export declare class EventEmitter<T extends Record<string, any>> {
|
|
5
5
|
private callbacks;
|
|
6
6
|
on<EventName extends StringKeyOf<T>>(event: EventName, fn: CallbackFunction<T, EventName>): this;
|
|
7
|
-
|
|
7
|
+
emit<EventName extends StringKeyOf<T>>(event: EventName, ...args: CallbackType<T, EventName>): this;
|
|
8
8
|
off<EventName extends StringKeyOf<T>>(event: EventName, fn?: CallbackFunction<T, EventName>): this;
|
|
9
|
-
|
|
9
|
+
removeAllListeners(): void;
|
|
10
10
|
}
|
|
11
11
|
export {};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tiptap/core",
|
|
3
3
|
"description": "headless rich text editor",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.5.0-beta.0",
|
|
5
5
|
"homepage": "https://tiptap.dev",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"tiptap",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"dist"
|
|
33
33
|
],
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@tiptap/pm": "^2.
|
|
35
|
+
"@tiptap/pm": "^2.5.0-beta.0"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"@tiptap/pm": "^2.0.0"
|
package/src/EventEmitter.ts
CHANGED
|
@@ -22,7 +22,7 @@ export class EventEmitter<T extends Record<string, any>> {
|
|
|
22
22
|
return this
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
public emit<EventName extends StringKeyOf<T>>(event: EventName, ...args: CallbackType<T, EventName>): this {
|
|
26
26
|
const callbacks = this.callbacks[event]
|
|
27
27
|
|
|
28
28
|
if (callbacks) {
|
|
@@ -46,7 +46,7 @@ export class EventEmitter<T extends Record<string, any>> {
|
|
|
46
46
|
return this
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
public removeAllListeners(): void {
|
|
50
50
|
this.callbacks = {}
|
|
51
51
|
}
|
|
52
52
|
}
|
|
@@ -15,7 +15,9 @@ declare module '@tiptap/core' {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
export const joinItemBackward: RawCommands['joinItemBackward'] = () => ({
|
|
18
|
-
|
|
18
|
+
state,
|
|
19
|
+
dispatch,
|
|
20
|
+
tr,
|
|
19
21
|
}) => {
|
|
20
22
|
try {
|
|
21
23
|
const point = joinPoint(state.doc, state.selection.$from.pos, -1)
|
|
@@ -31,7 +33,7 @@ export const joinItemBackward: RawCommands['joinItemBackward'] = () => ({
|
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
return true
|
|
34
|
-
} catch {
|
|
36
|
+
} catch (e) {
|
|
35
37
|
return false
|
|
36
38
|
}
|
|
37
39
|
}
|
|
@@ -58,7 +58,9 @@ export function nodeInputRule(config: {
|
|
|
58
58
|
// insert node from input rule
|
|
59
59
|
tr.replaceWith(matchStart, end, newNode)
|
|
60
60
|
} else if (match[0]) {
|
|
61
|
-
|
|
61
|
+
const insertionStart = config.type.isInline ? start : start - 1
|
|
62
|
+
|
|
63
|
+
tr.insert(insertionStart, config.type.create(attributes)).delete(
|
|
62
64
|
tr.mapping.map(start),
|
|
63
65
|
tr.mapping.map(end),
|
|
64
66
|
)
|