@blocknote/core 0.49.0 → 0.51.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/blocknote.cjs +1 -1
- package/dist/blocknote.js +4 -4
- package/dist/{blocks-CSfJen16.js → blocks-D0lMxErU.js} +612 -568
- package/dist/blocks-D0lMxErU.js.map +1 -0
- package/dist/blocks-KyMOxPT3.cjs +11 -0
- package/dist/blocks-KyMOxPT3.cjs.map +1 -0
- package/dist/blocks.cjs +1 -1
- package/dist/blocks.js +2 -2
- package/dist/comments.cjs +1 -1
- package/dist/comments.cjs.map +1 -1
- package/dist/comments.js +17 -14
- package/dist/comments.js.map +1 -1
- package/dist/{en-QsSI16s5.js → en-B9hMApn4.js} +4 -2
- package/dist/en-B9hMApn4.js.map +1 -0
- package/dist/{en-C4ykW581.cjs → en-Cj5r8sW_.cjs} +2 -2
- package/dist/en-Cj5r8sW_.cjs.map +1 -0
- package/dist/{extensions-C3nguvVr.js → extensions-CQFfm5f5.js} +621 -353
- package/dist/extensions-CQFfm5f5.js.map +1 -0
- package/dist/extensions-Cuw3zOdC.cjs +52 -0
- package/dist/extensions-Cuw3zOdC.cjs.map +1 -0
- package/dist/extensions.cjs +1 -1
- package/dist/extensions.js +3 -3
- package/dist/locales.cjs +1 -1
- package/dist/locales.cjs.map +1 -1
- package/dist/locales.js +68 -24
- package/dist/locales.js.map +1 -1
- package/dist/{src-DQfz4zLM.js → src-DK_8q1j5.js} +1135 -625
- package/dist/src-DK_8q1j5.js.map +1 -0
- package/dist/src-_83jmA7A.cjs +21 -0
- package/dist/src-_83jmA7A.cjs.map +1 -0
- package/dist/style.css +1 -1
- package/dist/webpack-stats.json +1 -1
- package/dist/yjs.cjs +1 -1
- package/dist/yjs.js +8 -8
- package/package.json +1 -13
- package/src/api/blockManipulation/commands/insertBlocks/__snapshots__/insertBlocks.test.ts.snap +7 -7
- package/src/api/blockManipulation/commands/insertBlocks/insertBlocks.ts +5 -3
- package/src/api/blockManipulation/commands/mergeBlocks/__snapshots__/mergeBlocks.test.ts.snap +5 -5
- package/src/api/blockManipulation/commands/moveBlocks/__snapshots__/moveBlocks.test.ts.snap +2550 -291
- package/src/api/blockManipulation/commands/moveBlocks/moveBlocks.test.ts +83 -2
- package/src/api/blockManipulation/commands/moveBlocks/moveBlocks.ts +103 -42
- package/src/api/blockManipulation/commands/nestBlock/__snapshots__/nestBlock.test.ts.snap +0 -143
- package/src/api/blockManipulation/commands/replaceBlocks/__snapshots__/replaceBlocks.test.ts.snap +12 -12
- package/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.ts +5 -3
- package/src/api/blockManipulation/commands/splitBlock/__snapshots__/splitBlock.test.ts.snap +6 -6
- package/src/api/blockManipulation/commands/updateBlock/__snapshots__/updateBlock.test.ts.snap +22 -22
- package/src/api/blockManipulation/commands/updateBlock/updateBlock.ts +12 -8
- package/src/api/blockManipulation/setupTestEnv.ts +1 -1
- package/src/api/clipboard/fromClipboard/handleVSCodePaste.ts +2 -6
- package/src/api/clipboard/fromClipboard/pasteExtension.ts +7 -2
- package/src/api/clipboard/toClipboard/copyExtension.ts +21 -16
- package/src/api/exporters/markdown/htmlToMarkdown.ts +813 -0
- package/src/api/exporters/markdown/markdownExporter.ts +2 -21
- package/src/api/nodeConversions/blockToNode.ts +3 -2
- package/src/api/parsers/html/util/__snapshots__/nestedLists.test.ts.snap +122 -107
- package/src/api/parsers/html/util/nestedLists.test.ts +1 -12
- package/src/api/parsers/markdown/markdownToHtml.ts +1194 -0
- package/src/api/parsers/markdown/parseMarkdown.ts +2 -101
- package/src/blocks/Audio/block.ts +1 -4
- package/src/blocks/Code/block.test.ts +258 -0
- package/src/blocks/File/block.ts +1 -4
- package/src/blocks/File/helpers/render/createFileBlockWrapper.ts +7 -2
- package/src/blocks/Image/block.ts +9 -6
- package/src/blocks/ListItem/BulletListItem/block.ts +7 -4
- package/src/blocks/ListItem/NumberedListItem/IndexingPlugin.ts +3 -4
- package/src/blocks/Table/TableExtension.ts +38 -9
- package/src/blocks/Video/block.ts +4 -5
- package/src/blocks/Video/parseVideoElement.ts +2 -1
- package/src/blocks/defaultBlocks.ts +34 -1
- package/src/comments/extension.ts +30 -11
- package/src/editor/Block.css +22 -18
- package/src/editor/BlockNoteEditor.test.ts +10 -4
- package/src/editor/BlockNoteEditor.ts +30 -13
- package/src/editor/managers/BlockManager.ts +10 -6
- package/src/editor/managers/ExtensionManager/extensions.ts +8 -9
- package/src/editor/managers/ExtensionManager/index.ts +80 -25
- package/src/editor/performance.test.ts +2 -2
- package/src/editor/transformPasted.test.ts +295 -0
- package/src/editor/transformPasted.ts +77 -0
- package/src/extensions/Collaboration/__snapshots__/fork-yjs-snap-editor-forked.json +1 -12
- package/src/extensions/Collaboration/__snapshots__/fork-yjs-snap-editor.json +0 -11
- package/src/extensions/Collaboration/__snapshots__/fork-yjs-snap-forked.html +1 -1
- package/src/extensions/Collaboration/__snapshots__/fork-yjs-snap.html +1 -1
- package/src/extensions/SideMenu/SideMenu.ts +2 -2
- package/src/extensions/SideMenu/dragging.ts +7 -10
- package/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts +21 -0
- package/src/extensions/TableHandles/TableHandles.ts +2 -0
- package/src/extensions/TrailingNode/TrailingNode.ts +124 -65
- package/src/extensions/tiptap-extensions/Link/index.ts +1 -1
- package/src/extensions/tiptap-extensions/Link/link.ts +49 -18
- package/src/i18n/locales/ar.ts +3 -1
- package/src/i18n/locales/de.ts +3 -1
- package/src/i18n/locales/en.ts +3 -1
- package/src/i18n/locales/es.ts +3 -1
- package/src/i18n/locales/fa.ts +3 -1
- package/src/i18n/locales/fr.ts +4 -2
- package/src/i18n/locales/he.ts +3 -1
- package/src/i18n/locales/hr.ts +3 -1
- package/src/i18n/locales/is.ts +3 -1
- package/src/i18n/locales/it.ts +3 -1
- package/src/i18n/locales/ja.ts +3 -1
- package/src/i18n/locales/ko.ts +3 -1
- package/src/i18n/locales/nl.ts +3 -1
- package/src/i18n/locales/no.ts +3 -1
- package/src/i18n/locales/pl.ts +3 -1
- package/src/i18n/locales/pt.ts +3 -1
- package/src/i18n/locales/ru.ts +3 -1
- package/src/i18n/locales/sk.ts +3 -1
- package/src/i18n/locales/uk.ts +3 -1
- package/src/i18n/locales/uz.ts +3 -1
- package/src/i18n/locales/vi.ts +3 -1
- package/src/i18n/locales/zh-tw.ts +3 -1
- package/src/i18n/locales/zh.ts +3 -1
- package/types/src/api/blockManipulation/commands/moveBlocks/moveBlocks.d.ts +13 -2
- package/types/src/api/clipboard/fromClipboard/handleVSCodePaste.d.ts +1 -1
- package/types/src/api/exporters/markdown/htmlToMarkdown.d.ts +11 -0
- package/types/src/api/parsers/markdown/markdownToHtml.d.ts +5 -0
- package/types/src/blocks/Code/block.test.d.ts +1 -0
- package/types/src/blocks/Video/block.d.ts +2 -0
- package/types/src/blocks/Video/parseVideoElement.d.ts +1 -0
- package/types/src/comments/extension.d.ts +2 -1
- package/types/src/editor/BlockNoteEditor.d.ts +20 -6
- package/types/src/editor/managers/BlockManager.d.ts +8 -4
- package/types/src/editor/transformPasted.test.d.ts +1 -0
- package/types/src/extensions/TrailingNode/TrailingNode.d.ts +8 -3
- package/types/src/extensions/tiptap-extensions/Link/index.d.ts +1 -1
- package/types/src/extensions/tiptap-extensions/Link/link.d.ts +12 -0
- package/types/src/i18n/locales/en.d.ts +2 -0
- package/types/src/i18n/locales/fa.d.ts +2 -0
- package/types/src/i18n/locales/sk.d.ts +2 -0
- package/dist/blocks-CSfJen16.js.map +0 -1
- package/dist/blocks-_lpGWKOa.cjs +0 -11
- package/dist/blocks-_lpGWKOa.cjs.map +0 -1
- package/dist/en-C4ykW581.cjs.map +0 -1
- package/dist/en-QsSI16s5.js.map +0 -1
- package/dist/extensions-BfYaEv6F.cjs +0 -2
- package/dist/extensions-BfYaEv6F.cjs.map +0 -1
- package/dist/extensions-C3nguvVr.js.map +0 -1
- package/dist/src-ChTwrMcE.cjs +0 -5
- package/dist/src-ChTwrMcE.cjs.map +0 -1
- package/dist/src-DQfz4zLM.js.map +0 -1
- package/src/api/exporters/markdown/util/addSpacesToCheckboxesRehypePlugin.ts +0 -42
- package/src/api/exporters/markdown/util/convertVideoToMarkdownRehypePlugin.ts +0 -19
- package/src/api/exporters/markdown/util/removeUnderlinesRehypePlugin.ts +0 -39
- package/types/src/api/exporters/markdown/util/addSpacesToCheckboxesRehypePlugin.d.ts +0 -7
- package/types/src/api/exporters/markdown/util/convertVideoToMarkdownRehypePlugin.d.ts +0 -2
- package/types/src/api/exporters/markdown/util/removeUnderlinesRehypePlugin.d.ts +0 -6
|
@@ -1,76 +1,135 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { Node as PMNode } from "prosemirror-model";
|
|
2
|
+
import { Plugin, PluginKey, type Transaction } from "prosemirror-state";
|
|
3
|
+
import { Decoration, DecorationSet } from "prosemirror-view";
|
|
4
|
+
import {
|
|
5
|
+
createExtension,
|
|
6
|
+
ExtensionOptions,
|
|
7
|
+
} from "../../editor/BlockNoteExtension.js";
|
|
3
8
|
|
|
4
|
-
|
|
9
|
+
const PLUGIN_KEY = new PluginKey<DecorationSet>("trailingNode");
|
|
5
10
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
// Skip the widget when the editor isn't editable, or when the document already
|
|
12
|
+
// ends with an empty paragraph block (since the user can just type into it).
|
|
13
|
+
function shouldShowTrailingWidget(doc: PMNode, isEditable: boolean): boolean {
|
|
14
|
+
if (!isEditable) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
12
17
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export const TrailingNodeExtension = createExtension(() => {
|
|
17
|
-
return {
|
|
18
|
-
key: "trailingNode",
|
|
19
|
-
prosemirrorPlugins: [
|
|
20
|
-
new Plugin({
|
|
21
|
-
key: plugin,
|
|
22
|
-
appendTransaction: (_, __, state) => {
|
|
23
|
-
const { doc, tr, schema } = state;
|
|
24
|
-
const shouldInsertNodeAtEnd = plugin.getState(state);
|
|
25
|
-
const endPosition = doc.content.size - 2;
|
|
26
|
-
const type = schema.nodes["blockContainer"];
|
|
27
|
-
const contentType = schema.nodes["paragraph"];
|
|
28
|
-
if (!shouldInsertNodeAtEnd) {
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return tr.insert(
|
|
33
|
-
endPosition,
|
|
34
|
-
type.create(undefined, contentType.create()),
|
|
35
|
-
);
|
|
36
|
-
},
|
|
37
|
-
state: {
|
|
38
|
-
init: (_, _state) => {
|
|
39
|
-
// (maybe fix): use same logic as apply() here
|
|
40
|
-
// so it works when initializing
|
|
41
|
-
},
|
|
42
|
-
apply: (tr, value) => {
|
|
43
|
-
if (!tr.docChanged) {
|
|
44
|
-
return value;
|
|
45
|
-
}
|
|
18
|
+
const rootGroup = doc.lastChild;
|
|
19
|
+
const lastBlock = rootGroup?.lastChild;
|
|
20
|
+
const lastContent = lastBlock?.firstChild;
|
|
46
21
|
|
|
47
|
-
|
|
22
|
+
return !(
|
|
23
|
+
lastBlock?.type.name === "blockContainer" &&
|
|
24
|
+
lastContent?.type.name === "paragraph" &&
|
|
25
|
+
lastContent.content.size === 0
|
|
26
|
+
);
|
|
27
|
+
}
|
|
48
28
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Renders a fake trailing block as a widget decoration after the last block of
|
|
31
|
+
* the document. Clicking it inserts a real trailing block and moves the
|
|
32
|
+
* selection into it. This way the trailing block is not part of the document
|
|
33
|
+
* content, so it doesn't appear when the editor is read-only or when the
|
|
34
|
+
* content is exported.
|
|
35
|
+
*/
|
|
36
|
+
export const TrailingNodeExtension = createExtension(
|
|
37
|
+
({ editor }: ExtensionOptions) => {
|
|
38
|
+
function createTrailingWidget(pos: number): Decoration {
|
|
39
|
+
return Decoration.widget(
|
|
40
|
+
pos,
|
|
41
|
+
() => {
|
|
42
|
+
const el = document.createElement("div");
|
|
43
|
+
el.className = "bn-trailing-block";
|
|
44
|
+
el.contentEditable = "false";
|
|
45
|
+
el.addEventListener("mousedown", (event) => {
|
|
46
|
+
// Stop ProseMirror from trying to place the selection somewhere
|
|
47
|
+
// based on this click.
|
|
48
|
+
event.preventDefault();
|
|
52
49
|
|
|
53
|
-
|
|
50
|
+
editor.transact((tr) => {
|
|
51
|
+
const [insertedBlock] = editor.insertBlocks(
|
|
52
|
+
[{ type: "paragraph" }],
|
|
53
|
+
editor.document[editor.document.length - 1],
|
|
54
|
+
"after",
|
|
55
|
+
);
|
|
56
|
+
editor.setTextCursorPosition(insertedBlock, "start");
|
|
57
|
+
tr.scrollIntoView();
|
|
58
|
+
});
|
|
54
59
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
60
|
+
editor.prosemirrorView?.focus();
|
|
61
|
+
});
|
|
62
|
+
return el;
|
|
63
|
+
},
|
|
64
|
+
{ side: 1 },
|
|
65
|
+
);
|
|
66
|
+
}
|
|
58
67
|
|
|
59
|
-
|
|
68
|
+
// Maps the existing DecorationSet through the transaction, then
|
|
69
|
+
// incrementally adds or removes the widget only if the show/hide state
|
|
70
|
+
// crossed over. The underlying Decoration (and its rendered DOM) stays
|
|
71
|
+
// reference-stable across transactions.
|
|
72
|
+
function nextDecorationSet(
|
|
73
|
+
tr: Transaction,
|
|
74
|
+
oldSet: DecorationSet,
|
|
75
|
+
isEditable: boolean,
|
|
76
|
+
): DecorationSet {
|
|
77
|
+
const mapped = oldSet.map(tr.mapping, tr.doc);
|
|
78
|
+
const existing = mapped.find();
|
|
79
|
+
const wasShowing = existing.length > 0;
|
|
80
|
+
const shouldShow = shouldShowTrailingWidget(tr.doc, isEditable);
|
|
60
81
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
82
|
+
if (wasShowing === shouldShow) {
|
|
83
|
+
return mapped;
|
|
84
|
+
}
|
|
85
|
+
if (wasShowing) {
|
|
86
|
+
return mapped.remove(existing);
|
|
87
|
+
}
|
|
88
|
+
return mapped.add(tr.doc, [
|
|
89
|
+
createTrailingWidget(tr.doc.content.size - 1),
|
|
90
|
+
]);
|
|
91
|
+
}
|
|
64
92
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
93
|
+
return {
|
|
94
|
+
key: "trailingNode",
|
|
95
|
+
prosemirrorPlugins: [
|
|
96
|
+
new Plugin<DecorationSet>({
|
|
97
|
+
key: PLUGIN_KEY,
|
|
98
|
+
state: {
|
|
99
|
+
init: (_, state) =>
|
|
100
|
+
nextDecorationSet(
|
|
101
|
+
state.tr,
|
|
102
|
+
DecorationSet.empty,
|
|
103
|
+
editor.isEditable,
|
|
104
|
+
),
|
|
105
|
+
apply: (tr, oldSet) => {
|
|
106
|
+
if (!tr.docChanged && !tr.getMeta(PLUGIN_KEY)) {
|
|
107
|
+
return oldSet;
|
|
108
|
+
}
|
|
109
|
+
return nextDecorationSet(tr, oldSet, editor.isEditable);
|
|
110
|
+
},
|
|
71
111
|
},
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
112
|
+
// Editable changes don't dispatch a transaction on their own, so the
|
|
113
|
+
// plugin state can't re-evaluate on its own. Watch for the change
|
|
114
|
+
// and dispatch a no-op transaction tagged with this plugin's key so
|
|
115
|
+
// `apply` re-runs and adds or removes the widget.
|
|
116
|
+
view(view) {
|
|
117
|
+
let lastEditable = view.editable;
|
|
118
|
+
return {
|
|
119
|
+
update(view) {
|
|
120
|
+
if (view.editable === lastEditable) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
lastEditable = view.editable;
|
|
124
|
+
view.dispatch(view.state.tr.setMeta(PLUGIN_KEY, true));
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
},
|
|
128
|
+
props: {
|
|
129
|
+
decorations: (state) => PLUGIN_KEY.getState(state),
|
|
130
|
+
},
|
|
131
|
+
}),
|
|
132
|
+
],
|
|
133
|
+
} as const;
|
|
134
|
+
},
|
|
135
|
+
);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Link } from "./link.js";
|
|
1
|
+
export { Link, LinkExtension } from "./link.js";
|
|
2
2
|
export { isAllowedUri } from "./link.js";
|
|
@@ -2,6 +2,7 @@ import type { PasteRuleMatch } from "@tiptap/core";
|
|
|
2
2
|
import { Mark, markPasteRule, mergeAttributes } from "@tiptap/core";
|
|
3
3
|
import type { Plugin } from "@tiptap/pm/state";
|
|
4
4
|
import type { BlockNoteEditor } from "../../../editor/BlockNoteEditor.js";
|
|
5
|
+
import { createExtension } from "../../../editor/BlockNoteExtension.js";
|
|
5
6
|
import { autolink } from "./helpers/autolink.js";
|
|
6
7
|
import { findLinks } from "./helpers/linkDetector.js";
|
|
7
8
|
import { clickHandler } from "./helpers/clickHandler.js";
|
|
@@ -10,13 +11,6 @@ import { UNICODE_WHITESPACE_REGEX_GLOBAL } from "./helpers/whitespace.js";
|
|
|
10
11
|
|
|
11
12
|
const DEFAULT_PROTOCOL = "https";
|
|
12
13
|
|
|
13
|
-
const HTML_ATTRIBUTES = {
|
|
14
|
-
target: "_blank",
|
|
15
|
-
rel: "noopener noreferrer nofollow",
|
|
16
|
-
className: "bn-inline-content-section",
|
|
17
|
-
"data-inline-content-type": "link",
|
|
18
|
-
};
|
|
19
|
-
|
|
20
14
|
// Pre-compiled regex for URI protocol validation.
|
|
21
15
|
// Allows: http, https, ftp, ftps, mailto, tel, callto, sms, cid, xmpp
|
|
22
16
|
const ALLOWED_URI_REGEX =
|
|
@@ -74,8 +68,6 @@ export type LinkOptions = {
|
|
|
74
68
|
export const Link = Mark.create<LinkOptions>({
|
|
75
69
|
name: "link",
|
|
76
70
|
|
|
77
|
-
priority: 1000,
|
|
78
|
-
|
|
79
71
|
keepOnSplit: false,
|
|
80
72
|
|
|
81
73
|
exitable: true,
|
|
@@ -84,7 +76,12 @@ export const Link = Mark.create<LinkOptions>({
|
|
|
84
76
|
|
|
85
77
|
addOptions() {
|
|
86
78
|
return {
|
|
87
|
-
HTMLAttributes: {
|
|
79
|
+
HTMLAttributes: {
|
|
80
|
+
target: "_blank",
|
|
81
|
+
rel: "noopener noreferrer nofollow",
|
|
82
|
+
className: "bn-inline-content-section",
|
|
83
|
+
"data-inline-content-type": "link",
|
|
84
|
+
},
|
|
88
85
|
editor: undefined,
|
|
89
86
|
onClick: undefined,
|
|
90
87
|
isValidLink: isAllowedUri,
|
|
@@ -99,12 +96,6 @@ export const Link = Mark.create<LinkOptions>({
|
|
|
99
96
|
return element.getAttribute("href");
|
|
100
97
|
},
|
|
101
98
|
},
|
|
102
|
-
target: {
|
|
103
|
-
default: HTML_ATTRIBUTES.target,
|
|
104
|
-
},
|
|
105
|
-
rel: {
|
|
106
|
-
default: HTML_ATTRIBUTES.rel,
|
|
107
|
-
},
|
|
108
99
|
};
|
|
109
100
|
},
|
|
110
101
|
|
|
@@ -128,12 +119,22 @@ export const Link = Mark.create<LinkOptions>({
|
|
|
128
119
|
if (!this.options.isValidLink(HTMLAttributes.href)) {
|
|
129
120
|
return [
|
|
130
121
|
"a",
|
|
131
|
-
mergeAttributes(
|
|
122
|
+
mergeAttributes(
|
|
123
|
+
{
|
|
124
|
+
...HTMLAttributes,
|
|
125
|
+
href: "",
|
|
126
|
+
},
|
|
127
|
+
this.options.HTMLAttributes,
|
|
128
|
+
),
|
|
132
129
|
0,
|
|
133
130
|
];
|
|
134
131
|
}
|
|
135
132
|
|
|
136
|
-
return [
|
|
133
|
+
return [
|
|
134
|
+
"a",
|
|
135
|
+
mergeAttributes(HTMLAttributes, this.options.HTMLAttributes),
|
|
136
|
+
0,
|
|
137
|
+
];
|
|
137
138
|
},
|
|
138
139
|
|
|
139
140
|
addPasteRules() {
|
|
@@ -205,3 +206,33 @@ export const Link = Mark.create<LinkOptions>({
|
|
|
205
206
|
return plugins;
|
|
206
207
|
},
|
|
207
208
|
});
|
|
209
|
+
|
|
210
|
+
type LinkExtensionOptions = {
|
|
211
|
+
HTMLAttributes?: Record<string, any>;
|
|
212
|
+
onClick?: (
|
|
213
|
+
event: MouseEvent,
|
|
214
|
+
editor: BlockNoteEditor<any, any, any>,
|
|
215
|
+
) => boolean | void;
|
|
216
|
+
isValidLink?: (href: string) => boolean;
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* BlockNote extension wrapping the {@link Link} TipTap mark. Wrapping the mark
|
|
221
|
+
* lets other extensions order their click handlers relative to the link click
|
|
222
|
+
* handler via `runsBefore: ["link"]`.
|
|
223
|
+
*/
|
|
224
|
+
export const LinkExtension = createExtension<any, LinkExtensionOptions>(
|
|
225
|
+
({ editor, options }) => {
|
|
226
|
+
return {
|
|
227
|
+
key: "link",
|
|
228
|
+
tiptapExtensions: [
|
|
229
|
+
Link.configure({
|
|
230
|
+
HTMLAttributes: options.HTMLAttributes ?? {},
|
|
231
|
+
editor,
|
|
232
|
+
onClick: options.onClick,
|
|
233
|
+
...(options.isValidLink ? { isValidLink: options.isValidLink } : {}),
|
|
234
|
+
}),
|
|
235
|
+
],
|
|
236
|
+
} as const;
|
|
237
|
+
},
|
|
238
|
+
);
|
package/src/i18n/locales/ar.ts
CHANGED
|
@@ -214,7 +214,7 @@ export const ar: Dictionary = {
|
|
|
214
214
|
text_title: "نص",
|
|
215
215
|
background_title: "خلفية",
|
|
216
216
|
colors: {
|
|
217
|
-
default: "
|
|
217
|
+
default: "تلقائي",
|
|
218
218
|
gray: "رمادي",
|
|
219
219
|
brown: "بني",
|
|
220
220
|
red: "أحمر",
|
|
@@ -369,9 +369,11 @@ export const ar: Dictionary = {
|
|
|
369
369
|
edited: "تم التحرير",
|
|
370
370
|
save_button_text: "حفظ",
|
|
371
371
|
cancel_button_text: "إلغاء",
|
|
372
|
+
deleted_reference_text: "تم حذف المحتوى الأصلي",
|
|
372
373
|
actions: {
|
|
373
374
|
add_reaction: "أضف تفاعلًا",
|
|
374
375
|
resolve: "حل",
|
|
376
|
+
reopen: "إعادة فتح",
|
|
375
377
|
edit_comment: "تحرير التعليق",
|
|
376
378
|
delete_comment: "حذف التعليق",
|
|
377
379
|
more_actions: "المزيد من الإجراءات",
|
package/src/i18n/locales/de.ts
CHANGED
|
@@ -249,7 +249,7 @@ export const de: Dictionary = {
|
|
|
249
249
|
text_title: "Text",
|
|
250
250
|
background_title: "Hintergrund",
|
|
251
251
|
colors: {
|
|
252
|
-
default: "
|
|
252
|
+
default: "Automatisch",
|
|
253
253
|
gray: "Grau",
|
|
254
254
|
brown: "Braun",
|
|
255
255
|
red: "Rot",
|
|
@@ -403,9 +403,11 @@ export const de: Dictionary = {
|
|
|
403
403
|
edited: "bearbeitet",
|
|
404
404
|
save_button_text: "Speichern",
|
|
405
405
|
cancel_button_text: "Abbrechen",
|
|
406
|
+
deleted_reference_text: "Originalinhalt gelöscht",
|
|
406
407
|
actions: {
|
|
407
408
|
add_reaction: "Reaktion hinzufügen",
|
|
408
409
|
resolve: "Lösen",
|
|
410
|
+
reopen: "Wieder öffnen",
|
|
409
411
|
edit_comment: "Kommentar bearbeiten",
|
|
410
412
|
delete_comment: "Kommentar löschen",
|
|
411
413
|
more_actions: "Weitere Aktionen",
|
package/src/i18n/locales/en.ts
CHANGED
|
@@ -229,7 +229,7 @@ export const en = {
|
|
|
229
229
|
text_title: "Text",
|
|
230
230
|
background_title: "Background",
|
|
231
231
|
colors: {
|
|
232
|
-
default: "
|
|
232
|
+
default: "Auto",
|
|
233
233
|
gray: "Gray",
|
|
234
234
|
brown: "Brown",
|
|
235
235
|
red: "Red",
|
|
@@ -384,9 +384,11 @@ export const en = {
|
|
|
384
384
|
edited: "edited",
|
|
385
385
|
save_button_text: "Save",
|
|
386
386
|
cancel_button_text: "Cancel",
|
|
387
|
+
deleted_reference_text: "Original content deleted",
|
|
387
388
|
actions: {
|
|
388
389
|
add_reaction: "Add reaction",
|
|
389
390
|
resolve: "Resolve",
|
|
391
|
+
reopen: "Re-open",
|
|
390
392
|
edit_comment: "Edit comment",
|
|
391
393
|
delete_comment: "Delete comment",
|
|
392
394
|
more_actions: "More actions",
|
package/src/i18n/locales/es.ts
CHANGED
|
@@ -228,7 +228,7 @@ export const es: Dictionary = {
|
|
|
228
228
|
text_title: "Texto",
|
|
229
229
|
background_title: "Fondo",
|
|
230
230
|
colors: {
|
|
231
|
-
default: "
|
|
231
|
+
default: "Automático",
|
|
232
232
|
gray: "Gris",
|
|
233
233
|
brown: "Marrón",
|
|
234
234
|
red: "Rojo",
|
|
@@ -382,9 +382,11 @@ export const es: Dictionary = {
|
|
|
382
382
|
edited: "editado",
|
|
383
383
|
save_button_text: "Guardar",
|
|
384
384
|
cancel_button_text: "Cancelar",
|
|
385
|
+
deleted_reference_text: "Contenido original eliminado",
|
|
385
386
|
actions: {
|
|
386
387
|
add_reaction: "Agregar reacción",
|
|
387
388
|
resolve: "Resolver",
|
|
389
|
+
reopen: "Reabrir",
|
|
388
390
|
edit_comment: "Editar comentario",
|
|
389
391
|
delete_comment: "Eliminar comentario",
|
|
390
392
|
more_actions: "Más acciones",
|
package/src/i18n/locales/fa.ts
CHANGED
|
@@ -197,7 +197,7 @@ export const fa = {
|
|
|
197
197
|
text_title: "متن",
|
|
198
198
|
background_title: "پسزمینه",
|
|
199
199
|
colors: {
|
|
200
|
-
default: "
|
|
200
|
+
default: "خودکار",
|
|
201
201
|
gray: "خاکستری",
|
|
202
202
|
brown: "قهوهای",
|
|
203
203
|
red: "قرمز",
|
|
@@ -352,9 +352,11 @@ export const fa = {
|
|
|
352
352
|
edited: "ویرایش شده",
|
|
353
353
|
save_button_text: "ذخیره",
|
|
354
354
|
cancel_button_text: "لغو",
|
|
355
|
+
deleted_reference_text: "محتوای اصلی حذف شد",
|
|
355
356
|
actions: {
|
|
356
357
|
add_reaction: "افزودن واکنش",
|
|
357
358
|
resolve: "حل کردن",
|
|
359
|
+
reopen: "باز کردن مجدد",
|
|
358
360
|
edit_comment: "ویرایش دیدگاه",
|
|
359
361
|
delete_comment: "حذف دیدگاه",
|
|
360
362
|
more_actions: "اقدامات بیشتر",
|
package/src/i18n/locales/fr.ts
CHANGED
|
@@ -244,7 +244,7 @@ export const fr: Dictionary = {
|
|
|
244
244
|
} as Record<string, string>,
|
|
245
245
|
},
|
|
246
246
|
toggle_blocks: {
|
|
247
|
-
add_block_button: "
|
|
247
|
+
add_block_button: "Liste repliable vide. Cliquez pour ajouter un bloc.",
|
|
248
248
|
},
|
|
249
249
|
// from react package:
|
|
250
250
|
side_menu: {
|
|
@@ -275,7 +275,7 @@ export const fr: Dictionary = {
|
|
|
275
275
|
text_title: "Texte",
|
|
276
276
|
background_title: "Fond",
|
|
277
277
|
colors: {
|
|
278
|
-
default: "
|
|
278
|
+
default: "Auto",
|
|
279
279
|
gray: "Gris",
|
|
280
280
|
brown: "Marron",
|
|
281
281
|
red: "Rouge",
|
|
@@ -430,9 +430,11 @@ export const fr: Dictionary = {
|
|
|
430
430
|
edited: "modifié",
|
|
431
431
|
save_button_text: "Enregistrer",
|
|
432
432
|
cancel_button_text: "Annuler",
|
|
433
|
+
deleted_reference_text: "Contenu d'origine supprimé",
|
|
433
434
|
actions: {
|
|
434
435
|
add_reaction: "Ajouter une réaction",
|
|
435
436
|
resolve: "Résoudre",
|
|
437
|
+
reopen: "Rouvrir",
|
|
436
438
|
edit_comment: "Modifier le commentaire",
|
|
437
439
|
delete_comment: "Supprimer le commentaire",
|
|
438
440
|
more_actions: "Plus d'actions",
|
package/src/i18n/locales/he.ts
CHANGED
|
@@ -230,7 +230,7 @@ export const he: Dictionary = {
|
|
|
230
230
|
text_title: "טקסט",
|
|
231
231
|
background_title: "רקע",
|
|
232
232
|
colors: {
|
|
233
|
-
default: "
|
|
233
|
+
default: "אוטומטי",
|
|
234
234
|
gray: "אפור",
|
|
235
235
|
brown: "חום",
|
|
236
236
|
red: "אדום",
|
|
@@ -384,9 +384,11 @@ export const he: Dictionary = {
|
|
|
384
384
|
edited: "נערך",
|
|
385
385
|
save_button_text: "שמור",
|
|
386
386
|
cancel_button_text: "בטל",
|
|
387
|
+
deleted_reference_text: "התוכן המקורי נמחק",
|
|
387
388
|
actions: {
|
|
388
389
|
add_reaction: "הוסף תגובה",
|
|
389
390
|
resolve: "סמן כפתור",
|
|
391
|
+
reopen: "פתח מחדש",
|
|
390
392
|
edit_comment: "ערוך תגובה",
|
|
391
393
|
delete_comment: "מחק תגובה",
|
|
392
394
|
more_actions: "פעולות נוספות",
|
package/src/i18n/locales/hr.ts
CHANGED
|
@@ -242,7 +242,7 @@ export const hr: Dictionary = {
|
|
|
242
242
|
text_title: "Tekst",
|
|
243
243
|
background_title: "Pozadina",
|
|
244
244
|
colors: {
|
|
245
|
-
default: "
|
|
245
|
+
default: "Automatski",
|
|
246
246
|
gray: "Siva",
|
|
247
247
|
brown: "Smeđa",
|
|
248
248
|
red: "Crvena",
|
|
@@ -397,9 +397,11 @@ export const hr: Dictionary = {
|
|
|
397
397
|
edited: "uredio",
|
|
398
398
|
save_button_text: "Spremi",
|
|
399
399
|
cancel_button_text: "Odustani",
|
|
400
|
+
deleted_reference_text: "Originalni sadržaj je obrisan",
|
|
400
401
|
actions: {
|
|
401
402
|
add_reaction: "Dodaj reakciju",
|
|
402
403
|
resolve: "Riješi",
|
|
404
|
+
reopen: "Ponovno otvori",
|
|
403
405
|
edit_comment: "Uredi komentar",
|
|
404
406
|
delete_comment: "Obriši komentar",
|
|
405
407
|
more_actions: "Više radnji",
|
package/src/i18n/locales/is.ts
CHANGED
|
@@ -242,7 +242,7 @@ export const is: Dictionary = {
|
|
|
242
242
|
text_title: "Texti",
|
|
243
243
|
background_title: "Bakgrunnur",
|
|
244
244
|
colors: {
|
|
245
|
-
default: "
|
|
245
|
+
default: "Sjálfvirkt",
|
|
246
246
|
gray: "Grár",
|
|
247
247
|
brown: "Brúnn",
|
|
248
248
|
red: "Rauður",
|
|
@@ -397,9 +397,11 @@ export const is: Dictionary = {
|
|
|
397
397
|
edited: "breytt",
|
|
398
398
|
save_button_text: "Vista",
|
|
399
399
|
cancel_button_text: "Hætta",
|
|
400
|
+
deleted_reference_text: "Upprunalegu efni eytt",
|
|
400
401
|
actions: {
|
|
401
402
|
add_reaction: "Bæta við viðbrögðum",
|
|
402
403
|
resolve: "Leysa",
|
|
404
|
+
reopen: "Opna aftur",
|
|
403
405
|
edit_comment: "Breyta athugasemd",
|
|
404
406
|
delete_comment: "Eyða athugasemd",
|
|
405
407
|
more_actions: "Fleiri aðgerðir",
|
package/src/i18n/locales/it.ts
CHANGED
|
@@ -251,7 +251,7 @@ export const it: Dictionary = {
|
|
|
251
251
|
text_title: "Testo",
|
|
252
252
|
background_title: "Sfondo",
|
|
253
253
|
colors: {
|
|
254
|
-
default: "
|
|
254
|
+
default: "Automatico",
|
|
255
255
|
gray: "Grigio",
|
|
256
256
|
brown: "Marrone",
|
|
257
257
|
red: "Rosso",
|
|
@@ -406,9 +406,11 @@ export const it: Dictionary = {
|
|
|
406
406
|
edited: "modificato",
|
|
407
407
|
save_button_text: "Salva",
|
|
408
408
|
cancel_button_text: "Annulla",
|
|
409
|
+
deleted_reference_text: "Contenuto originale eliminato",
|
|
409
410
|
actions: {
|
|
410
411
|
add_reaction: "Aggiungi reazione",
|
|
411
412
|
resolve: "Risolvi",
|
|
413
|
+
reopen: "Riapri",
|
|
412
414
|
edit_comment: "Modifica commento",
|
|
413
415
|
delete_comment: "Elimina commento",
|
|
414
416
|
more_actions: "Altre azioni",
|
package/src/i18n/locales/ja.ts
CHANGED
|
@@ -269,7 +269,7 @@ export const ja: Dictionary = {
|
|
|
269
269
|
text_title: "文字色",
|
|
270
270
|
background_title: "背景色",
|
|
271
271
|
colors: {
|
|
272
|
-
default: "
|
|
272
|
+
default: "自動",
|
|
273
273
|
gray: "グレー",
|
|
274
274
|
brown: "茶色",
|
|
275
275
|
red: "赤",
|
|
@@ -424,9 +424,11 @@ export const ja: Dictionary = {
|
|
|
424
424
|
edited: "編集済み",
|
|
425
425
|
save_button_text: "保存",
|
|
426
426
|
cancel_button_text: "キャンセル",
|
|
427
|
+
deleted_reference_text: "元のコンテンツが削除されました",
|
|
427
428
|
actions: {
|
|
428
429
|
add_reaction: "リアクションを追加",
|
|
429
430
|
resolve: "解決",
|
|
431
|
+
reopen: "再開",
|
|
430
432
|
edit_comment: "コメントを編集",
|
|
431
433
|
delete_comment: "コメントを削除",
|
|
432
434
|
more_actions: "その他の操作",
|
package/src/i18n/locales/ko.ts
CHANGED
|
@@ -242,7 +242,7 @@ export const ko: Dictionary = {
|
|
|
242
242
|
text_title: "텍스트",
|
|
243
243
|
background_title: "배경",
|
|
244
244
|
colors: {
|
|
245
|
-
default: "
|
|
245
|
+
default: "자동",
|
|
246
246
|
gray: "회색",
|
|
247
247
|
brown: "갈색",
|
|
248
248
|
red: "빨간색",
|
|
@@ -397,9 +397,11 @@ export const ko: Dictionary = {
|
|
|
397
397
|
edited: "수정됨",
|
|
398
398
|
save_button_text: "저장",
|
|
399
399
|
cancel_button_text: "취소",
|
|
400
|
+
deleted_reference_text: "원본 콘텐츠 삭제됨",
|
|
400
401
|
actions: {
|
|
401
402
|
add_reaction: "반응 추가",
|
|
402
403
|
resolve: "해결",
|
|
404
|
+
reopen: "다시 열기",
|
|
403
405
|
edit_comment: "댓글 수정",
|
|
404
406
|
delete_comment: "댓글 삭제",
|
|
405
407
|
more_actions: "더 많은 작업",
|
package/src/i18n/locales/nl.ts
CHANGED
|
@@ -230,7 +230,7 @@ export const nl: Dictionary = {
|
|
|
230
230
|
text_title: "Tekst",
|
|
231
231
|
background_title: "Achtergrond",
|
|
232
232
|
colors: {
|
|
233
|
-
default: "
|
|
233
|
+
default: "Automatisch",
|
|
234
234
|
gray: "Grijs",
|
|
235
235
|
brown: "Bruin",
|
|
236
236
|
red: "Rood",
|
|
@@ -384,9 +384,11 @@ export const nl: Dictionary = {
|
|
|
384
384
|
edited: "bewerkt",
|
|
385
385
|
save_button_text: "Opslaan",
|
|
386
386
|
cancel_button_text: "Annuleren",
|
|
387
|
+
deleted_reference_text: "Originele inhoud verwijderd",
|
|
387
388
|
actions: {
|
|
388
389
|
add_reaction: "Reactie toevoegen",
|
|
389
390
|
resolve: "Oplossen",
|
|
391
|
+
reopen: "Heropenen",
|
|
390
392
|
edit_comment: "Reactie bewerken",
|
|
391
393
|
delete_comment: "Reactie verwijderen",
|
|
392
394
|
more_actions: "Meer acties",
|
package/src/i18n/locales/no.ts
CHANGED
|
@@ -247,7 +247,7 @@ export const no: Dictionary = {
|
|
|
247
247
|
text_title: "Tekst",
|
|
248
248
|
background_title: "Bakgrunn",
|
|
249
249
|
colors: {
|
|
250
|
-
default: "
|
|
250
|
+
default: "Automatisk",
|
|
251
251
|
gray: "Grå",
|
|
252
252
|
brown: "Brun",
|
|
253
253
|
red: "Rød",
|
|
@@ -401,9 +401,11 @@ export const no: Dictionary = {
|
|
|
401
401
|
edited: "redigert",
|
|
402
402
|
save_button_text: "Lagre",
|
|
403
403
|
cancel_button_text: "Avbryt",
|
|
404
|
+
deleted_reference_text: "Originalt innhold slettet",
|
|
404
405
|
actions: {
|
|
405
406
|
add_reaction: "Legg til reaksjon",
|
|
406
407
|
resolve: "Løs",
|
|
408
|
+
reopen: "Gjenåpne",
|
|
407
409
|
edit_comment: "Rediger kommentar",
|
|
408
410
|
delete_comment: "Slett kommentar",
|
|
409
411
|
more_actions: "Flere handlinger",
|
package/src/i18n/locales/pl.ts
CHANGED
|
@@ -220,7 +220,7 @@ export const pl: Dictionary = {
|
|
|
220
220
|
text_title: "Tekst",
|
|
221
221
|
background_title: "Tło",
|
|
222
222
|
colors: {
|
|
223
|
-
default: "
|
|
223
|
+
default: "Automatyczny",
|
|
224
224
|
gray: "Szary",
|
|
225
225
|
brown: "Brązowy",
|
|
226
226
|
red: "Czerwony",
|
|
@@ -375,9 +375,11 @@ export const pl: Dictionary = {
|
|
|
375
375
|
edited: "edytowany",
|
|
376
376
|
save_button_text: "Zapisz",
|
|
377
377
|
cancel_button_text: "Anuluj",
|
|
378
|
+
deleted_reference_text: "Oryginalna treść usunięta",
|
|
378
379
|
actions: {
|
|
379
380
|
add_reaction: "Dodaj reakcję",
|
|
380
381
|
resolve: "Rozwiąż",
|
|
382
|
+
reopen: "Otwórz ponownie",
|
|
381
383
|
edit_comment: "Edytuj komentarz",
|
|
382
384
|
delete_comment: "Usuń komentarz",
|
|
383
385
|
more_actions: "Więcej akcji",
|