@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/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,49 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [2.0.0-beta.94](https://github.com/ueberdosis/tiptap/compare/@tiptap/core@2.0.0-beta.93...@tiptap/core@2.0.0-beta.94) (2021-08-09)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* add CreateNodeFromContentOptions to insertContent ([#1678](https://github.com/ueberdosis/tiptap/issues/1678)) ([aabdfd6](https://github.com/ueberdosis/tiptap/commit/aabdfd6f7de65e62a57bd237eb775256b413abea))
|
|
12
|
+
* fix isEditable check on initialization ([f6f8cf9](https://github.com/ueberdosis/tiptap/commit/f6f8cf9f9366adbea30600a34619bdd4e6d3a4e4))
|
|
13
|
+
* fix updating editorProps via setOptions ([#1540](https://github.com/ueberdosis/tiptap/issues/1540)), fix [#1518](https://github.com/ueberdosis/tiptap/issues/1518) ([e6f67ca](https://github.com/ueberdosis/tiptap/commit/e6f67caef37d3fb73adadfb64060541a0b791924))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
# [2.0.0-beta.93](https://github.com/ueberdosis/tiptap/compare/@tiptap/core@2.0.0-beta.92...@tiptap/core@2.0.0-beta.93) (2021-07-30)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
|
|
24
|
+
* revert async focus, fix [#1658](https://github.com/ueberdosis/tiptap/issues/1658) ([c9869c8](https://github.com/ueberdosis/tiptap/commit/c9869c8d3021510366a46e840a66e8c06a6586ed))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
# [2.0.0-beta.92](https://github.com/ueberdosis/tiptap/compare/@tiptap/core@2.0.0-beta.91...@tiptap/core@2.0.0-beta.92) (2021-07-28)
|
|
31
|
+
|
|
32
|
+
**Note:** Version bump only for package @tiptap/core
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
# [2.0.0-beta.91](https://github.com/ueberdosis/tiptap/compare/@tiptap/core@2.0.0-beta.90...@tiptap/core@2.0.0-beta.91) (2021-07-28)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
### Bug Fixes
|
|
42
|
+
|
|
43
|
+
* fix a bug in markPasteRule ([c2ccf68](https://github.com/ueberdosis/tiptap/commit/c2ccf68e8b4c869f707f3b1fdf51474e7f64b6f3))
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
6
49
|
# [2.0.0-beta.90](https://github.com/ueberdosis/tiptap/compare/@tiptap/core@2.0.0-beta.89...@tiptap/core@2.0.0-beta.90) (2021-07-28)
|
|
7
50
|
|
|
8
51
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CreateNodeFromContentOptions } from '../helpers/createNodeFromContent';
|
|
1
2
|
import { RawCommands, Content } from '../types';
|
|
2
3
|
declare module '@tiptap/core' {
|
|
3
4
|
interface Commands<ReturnType> {
|
|
@@ -5,7 +6,7 @@ declare module '@tiptap/core' {
|
|
|
5
6
|
/**
|
|
6
7
|
* Insert a node or string of HTML at the current position.
|
|
7
8
|
*/
|
|
8
|
-
insertContent: (value: Content) => ReturnType;
|
|
9
|
+
insertContent: (value: Content, options?: CreateNodeFromContentOptions) => ReturnType;
|
|
9
10
|
};
|
|
10
11
|
}
|
|
11
12
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CreateNodeFromContentOptions } from '../helpers/createNodeFromContent';
|
|
1
2
|
import { RawCommands, Content, Range } from '../types';
|
|
2
3
|
declare module '@tiptap/core' {
|
|
3
4
|
interface Commands<ReturnType> {
|
|
@@ -5,7 +6,7 @@ declare module '@tiptap/core' {
|
|
|
5
6
|
/**
|
|
6
7
|
* Insert a node or string of HTML at a specific position.
|
|
7
8
|
*/
|
|
8
|
-
insertContentAt: (position: number | Range, value: Content) => ReturnType;
|
|
9
|
+
insertContentAt: (position: number | Range, value: Content, options?: CreateNodeFromContentOptions) => ReturnType;
|
|
9
10
|
};
|
|
10
11
|
}
|
|
11
12
|
}
|
package/dist/tiptap-core.cjs.js
CHANGED
|
@@ -1399,8 +1399,8 @@ var forEach$1 = /*#__PURE__*/Object.freeze({
|
|
|
1399
1399
|
forEach: forEach
|
|
1400
1400
|
});
|
|
1401
1401
|
|
|
1402
|
-
const insertContent = value => ({ tr, commands }) => {
|
|
1403
|
-
return commands.insertContentAt({ from: tr.selection.from, to: tr.selection.to }, value);
|
|
1402
|
+
const insertContent = (value, options) => ({ tr, commands }) => {
|
|
1403
|
+
return commands.insertContentAt({ from: tr.selection.from, to: tr.selection.to }, value, options);
|
|
1404
1404
|
};
|
|
1405
1405
|
|
|
1406
1406
|
var insertContent$1 = /*#__PURE__*/Object.freeze({
|
|
@@ -1428,12 +1428,13 @@ function selectionToInsertionEnd(tr, startLen, bias) {
|
|
|
1428
1428
|
tr.setSelection(prosemirrorState.Selection.near(tr.doc.resolve(end), bias));
|
|
1429
1429
|
}
|
|
1430
1430
|
|
|
1431
|
-
const insertContentAt = (position, value) => ({ tr, dispatch, editor }) => {
|
|
1431
|
+
const insertContentAt = (position, value, options) => ({ tr, dispatch, editor }) => {
|
|
1432
1432
|
if (dispatch) {
|
|
1433
1433
|
const content = createNodeFromContent(value, editor.schema, {
|
|
1434
1434
|
parseOptions: {
|
|
1435
1435
|
preserveWhitespace: 'full',
|
|
1436
1436
|
},
|
|
1437
|
+
...(options || {}),
|
|
1437
1438
|
});
|
|
1438
1439
|
// don’t dispatch an empty fragment because this can lead to strange errors
|
|
1439
1440
|
if (content.toString() === '<>') {
|
|
@@ -2600,22 +2601,34 @@ class Editor extends EventEmitter {
|
|
|
2600
2601
|
* @param options A list of options
|
|
2601
2602
|
*/
|
|
2602
2603
|
setOptions(options = {}) {
|
|
2603
|
-
this.options = {
|
|
2604
|
+
this.options = {
|
|
2605
|
+
...this.options,
|
|
2606
|
+
...options,
|
|
2607
|
+
};
|
|
2608
|
+
if (!this.view || !this.state || this.isDestroyed) {
|
|
2609
|
+
return;
|
|
2610
|
+
}
|
|
2611
|
+
if (this.options.editorProps) {
|
|
2612
|
+
this.view.setProps(this.options.editorProps);
|
|
2613
|
+
}
|
|
2614
|
+
this.view.updateState(this.state);
|
|
2604
2615
|
}
|
|
2605
2616
|
/**
|
|
2606
2617
|
* Update editable state of the editor.
|
|
2607
2618
|
*/
|
|
2608
2619
|
setEditable(editable) {
|
|
2609
2620
|
this.setOptions({ editable });
|
|
2610
|
-
if (this.view && this.state && !this.isDestroyed) {
|
|
2611
|
-
this.view.updateState(this.state);
|
|
2612
|
-
}
|
|
2613
2621
|
}
|
|
2614
2622
|
/**
|
|
2615
2623
|
* Returns whether the editor is editable.
|
|
2616
2624
|
*/
|
|
2617
2625
|
get isEditable() {
|
|
2618
|
-
|
|
2626
|
+
// since plugins are applied after creating the view
|
|
2627
|
+
// `editable` is always `true` for one tick.
|
|
2628
|
+
// that’s why we also have to check for `options.editable`
|
|
2629
|
+
return this.options.editable
|
|
2630
|
+
&& this.view
|
|
2631
|
+
&& this.view.editable;
|
|
2619
2632
|
}
|
|
2620
2633
|
/**
|
|
2621
2634
|
* Returns the editor state.
|
|
@@ -3225,7 +3238,7 @@ function markPasteRule (regexp, type, getAttributes) {
|
|
|
3225
3238
|
const attrs = getAttributes instanceof Function
|
|
3226
3239
|
? getAttributes(match)
|
|
3227
3240
|
: getAttributes;
|
|
3228
|
-
if (!attrs) {
|
|
3241
|
+
if (!attrs && attrs !== undefined) {
|
|
3229
3242
|
continue;
|
|
3230
3243
|
}
|
|
3231
3244
|
// adding text before markdown to nodes
|