@tiptap/core 3.3.1 → 3.4.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 +8 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +20 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/Editor.ts +6 -0
- package/src/commands/setMark.ts +6 -2
- package/src/types.ts +20 -0
package/dist/index.cjs
CHANGED
|
@@ -3243,7 +3243,8 @@ function canSetMark(state, tr, newMarkType) {
|
|
|
3243
3243
|
}
|
|
3244
3244
|
if (cursor) {
|
|
3245
3245
|
const currentMarks = (_a = state.storedMarks) != null ? _a : cursor.marks();
|
|
3246
|
-
|
|
3246
|
+
const parentAllowsMarkType = cursor.parent.type.allowsMarkType(newMarkType);
|
|
3247
|
+
return parentAllowsMarkType && (!!newMarkType.isInSet(currentMarks) || !currentMarks.some((mark) => mark.type.excludes(newMarkType)));
|
|
3247
3248
|
}
|
|
3248
3249
|
const { ranges } = selection;
|
|
3249
3250
|
return ranges.some(({ $from, $to }) => {
|
|
@@ -4426,6 +4427,8 @@ var Editor = class extends EventEmitter {
|
|
|
4426
4427
|
emitContentError: false,
|
|
4427
4428
|
onBeforeCreate: () => null,
|
|
4428
4429
|
onCreate: () => null,
|
|
4430
|
+
onMount: () => null,
|
|
4431
|
+
onUnmount: () => null,
|
|
4429
4432
|
onUpdate: () => null,
|
|
4430
4433
|
onSelectionUpdate: () => null,
|
|
4431
4434
|
onTransaction: () => null,
|
|
@@ -4447,6 +4450,8 @@ var Editor = class extends EventEmitter {
|
|
|
4447
4450
|
this.createSchema();
|
|
4448
4451
|
this.on("beforeCreate", this.options.onBeforeCreate);
|
|
4449
4452
|
this.emit("beforeCreate", { editor: this });
|
|
4453
|
+
this.on("mount", this.options.onMount);
|
|
4454
|
+
this.on("unmount", this.options.onUnmount);
|
|
4450
4455
|
this.on("contentError", this.options.onContentError);
|
|
4451
4456
|
this.on("create", this.options.onCreate);
|
|
4452
4457
|
this.on("update", this.options.onUpdate);
|
|
@@ -4479,6 +4484,7 @@ var Editor = class extends EventEmitter {
|
|
|
4479
4484
|
);
|
|
4480
4485
|
}
|
|
4481
4486
|
this.createView(el);
|
|
4487
|
+
this.emit("mount", { editor: this });
|
|
4482
4488
|
window.setTimeout(() => {
|
|
4483
4489
|
if (this.isDestroyed) {
|
|
4484
4490
|
return;
|
|
@@ -4513,6 +4519,7 @@ var Editor = class extends EventEmitter {
|
|
|
4513
4519
|
}
|
|
4514
4520
|
}
|
|
4515
4521
|
this.css = null;
|
|
4522
|
+
this.emit("unmount", { editor: this });
|
|
4516
4523
|
}
|
|
4517
4524
|
/**
|
|
4518
4525
|
* Returns the editor storage.
|