@tiptap/core 2.0.0-beta.90 → 2.0.0-beta.94
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/CHANGELOG.md +43 -0
- package/dist/packages/core/src/commands/insertContent.d.ts +2 -1
- package/dist/packages/core/src/commands/insertContentAt.d.ts +2 -1
- package/dist/tiptap-core.cjs.js +22 -9
- package/dist/tiptap-core.cjs.js.map +1 -1
- package/dist/tiptap-core.esm.js +22 -9
- package/dist/tiptap-core.esm.js.map +1 -1
- package/dist/tiptap-core.umd.js +22 -9
- package/dist/tiptap-core.umd.js.map +1 -1
- package/package.json +2 -2
- package/src/Editor.ts +20 -6
- package/src/commands/insertContent.ts +4 -3
- package/src/commands/insertContentAt.ts +4 -3
- package/src/pasteRules/markPasteRule.ts +1 -1
package/dist/tiptap-core.umd.js
CHANGED
|
@@ -1392,8 +1392,8 @@
|
|
|
1392
1392
|
forEach: forEach
|
|
1393
1393
|
});
|
|
1394
1394
|
|
|
1395
|
-
const insertContent = value => ({ tr, commands }) => {
|
|
1396
|
-
return commands.insertContentAt({ from: tr.selection.from, to: tr.selection.to }, value);
|
|
1395
|
+
const insertContent = (value, options) => ({ tr, commands }) => {
|
|
1396
|
+
return commands.insertContentAt({ from: tr.selection.from, to: tr.selection.to }, value, options);
|
|
1397
1397
|
};
|
|
1398
1398
|
|
|
1399
1399
|
var insertContent$1 = /*#__PURE__*/Object.freeze({
|
|
@@ -1421,12 +1421,13 @@
|
|
|
1421
1421
|
tr.setSelection(prosemirrorState.Selection.near(tr.doc.resolve(end), bias));
|
|
1422
1422
|
}
|
|
1423
1423
|
|
|
1424
|
-
const insertContentAt = (position, value) => ({ tr, dispatch, editor }) => {
|
|
1424
|
+
const insertContentAt = (position, value, options) => ({ tr, dispatch, editor }) => {
|
|
1425
1425
|
if (dispatch) {
|
|
1426
1426
|
const content = createNodeFromContent(value, editor.schema, {
|
|
1427
1427
|
parseOptions: {
|
|
1428
1428
|
preserveWhitespace: 'full',
|
|
1429
1429
|
},
|
|
1430
|
+
...(options || {}),
|
|
1430
1431
|
});
|
|
1431
1432
|
// don’t dispatch an empty fragment because this can lead to strange errors
|
|
1432
1433
|
if (content.toString() === '<>') {
|
|
@@ -2593,22 +2594,34 @@
|
|
|
2593
2594
|
* @param options A list of options
|
|
2594
2595
|
*/
|
|
2595
2596
|
setOptions(options = {}) {
|
|
2596
|
-
this.options = {
|
|
2597
|
+
this.options = {
|
|
2598
|
+
...this.options,
|
|
2599
|
+
...options,
|
|
2600
|
+
};
|
|
2601
|
+
if (!this.view || !this.state || this.isDestroyed) {
|
|
2602
|
+
return;
|
|
2603
|
+
}
|
|
2604
|
+
if (this.options.editorProps) {
|
|
2605
|
+
this.view.setProps(this.options.editorProps);
|
|
2606
|
+
}
|
|
2607
|
+
this.view.updateState(this.state);
|
|
2597
2608
|
}
|
|
2598
2609
|
/**
|
|
2599
2610
|
* Update editable state of the editor.
|
|
2600
2611
|
*/
|
|
2601
2612
|
setEditable(editable) {
|
|
2602
2613
|
this.setOptions({ editable });
|
|
2603
|
-
if (this.view && this.state && !this.isDestroyed) {
|
|
2604
|
-
this.view.updateState(this.state);
|
|
2605
|
-
}
|
|
2606
2614
|
}
|
|
2607
2615
|
/**
|
|
2608
2616
|
* Returns whether the editor is editable.
|
|
2609
2617
|
*/
|
|
2610
2618
|
get isEditable() {
|
|
2611
|
-
|
|
2619
|
+
// since plugins are applied after creating the view
|
|
2620
|
+
// `editable` is always `true` for one tick.
|
|
2621
|
+
// that’s why we also have to check for `options.editable`
|
|
2622
|
+
return this.options.editable
|
|
2623
|
+
&& this.view
|
|
2624
|
+
&& this.view.editable;
|
|
2612
2625
|
}
|
|
2613
2626
|
/**
|
|
2614
2627
|
* Returns the editor state.
|
|
@@ -3218,7 +3231,7 @@
|
|
|
3218
3231
|
const attrs = getAttributes instanceof Function
|
|
3219
3232
|
? getAttributes(match)
|
|
3220
3233
|
: getAttributes;
|
|
3221
|
-
if (!attrs) {
|
|
3234
|
+
if (!attrs && attrs !== undefined) {
|
|
3222
3235
|
continue;
|
|
3223
3236
|
}
|
|
3224
3237
|
// adding text before markdown to nodes
|