@blocknote/core 0.40.0 → 0.41.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/BlockNoteSchema-COA0fsXW.cjs +11 -0
- package/dist/BlockNoteSchema-COA0fsXW.cjs.map +1 -0
- package/dist/{BlockNoteSchema-oR047ACf.js → BlockNoteSchema-CYRHak18.js} +681 -581
- package/dist/BlockNoteSchema-CYRHak18.js.map +1 -0
- package/dist/blocknote.cjs +4 -4
- package/dist/blocknote.cjs.map +1 -1
- package/dist/blocknote.js +3663 -2817
- package/dist/blocknote.js.map +1 -1
- package/dist/blocks.cjs +1 -1
- package/dist/blocks.js +51 -49
- package/dist/en-Cl87Uuyf.cjs +2 -0
- package/dist/en-Cl87Uuyf.cjs.map +1 -0
- package/dist/{en-Bq3Es3Np.js → en-njEqD7AG.js} +9 -3
- package/dist/en-njEqD7AG.js.map +1 -0
- package/dist/locales.cjs +1 -1
- package/dist/locales.cjs.map +1 -1
- package/dist/locales.js +122 -2
- package/dist/locales.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/webpack-stats.json +1 -1
- package/package.json +4 -3
- package/src/api/exporters/html/externalHTMLExporter.ts +1 -1
- package/src/api/exporters/html/util/serializeBlocksInternalHTML.ts +2 -1
- package/src/api/exporters/markdown/markdownExporter.ts +3 -1
- package/src/api/exporters/markdown/util/convertVideoToMarkdownRehypePlugin.ts +19 -0
- package/src/api/parsers/markdown/parseMarkdown.ts +31 -0
- package/src/blocks/Code/block.ts +14 -14
- package/src/blocks/Divider/block.ts +49 -0
- package/src/blocks/ListItem/BulletListItem/block.ts +9 -1
- package/src/blocks/ListItem/CheckListItem/block.ts +1 -0
- package/src/blocks/ListItem/NumberedListItem/block.ts +9 -1
- package/src/blocks/Table/block.ts +56 -1
- package/src/blocks/ToggleWrapper/createToggleWrapper.ts +1 -1
- package/src/blocks/defaultBlocks.ts +16 -14
- package/src/blocks/index.ts +1 -0
- package/src/editor/Block.css +14 -20
- package/src/editor/BlockNoteEditor.test.ts +40 -0
- package/src/editor/BlockNoteEditor.ts +248 -465
- package/src/editor/BlockNoteExtensions.ts +3 -1
- package/src/editor/managers/BlockManager.ts +251 -0
- package/src/editor/managers/CollaborationManager.ts +212 -0
- package/src/editor/managers/EventManager.ts +134 -0
- package/src/editor/managers/ExportManager.ts +137 -0
- package/src/editor/managers/ExtensionManager.ts +130 -0
- package/src/editor/managers/SelectionManager.ts +114 -0
- package/src/editor/managers/StateManager.ts +238 -0
- package/src/editor/managers/StyleManager.ts +182 -0
- package/src/editor/managers/index.ts +11 -0
- package/src/extensions/Comments/CommentsPlugin.ts +7 -4
- package/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts +10 -0
- package/src/i18n/locales/ar.ts +6 -0
- package/src/i18n/locales/de.ts +6 -0
- package/src/i18n/locales/en.ts +6 -0
- package/src/i18n/locales/es.ts +6 -0
- package/src/i18n/locales/fr.ts +6 -0
- package/src/i18n/locales/he.ts +6 -0
- package/src/i18n/locales/hr.ts +6 -0
- package/src/i18n/locales/is.ts +6 -0
- package/src/i18n/locales/it.ts +6 -0
- package/src/i18n/locales/ja.ts +6 -0
- package/src/i18n/locales/ko.ts +6 -0
- package/src/i18n/locales/nl.ts +6 -0
- package/src/i18n/locales/no.ts +6 -0
- package/src/i18n/locales/pl.ts +6 -0
- package/src/i18n/locales/pt.ts +6 -0
- package/src/i18n/locales/ru.ts +6 -0
- package/src/i18n/locales/sk.ts +6 -0
- package/src/i18n/locales/uk.ts +6 -0
- package/src/i18n/locales/vi.ts +6 -0
- package/src/i18n/locales/zh-tw.ts +6 -0
- package/src/i18n/locales/zh.ts +6 -0
- package/src/schema/blocks/createSpec.ts +1 -0
- package/src/util/string.ts +21 -0
- package/types/src/api/exporters/markdown/util/convertVideoToMarkdownRehypePlugin.d.ts +2 -0
- package/types/src/blocks/Divider/block.d.ts +3 -0
- package/types/src/blocks/Heading/block.d.ts +3 -3
- package/types/src/blocks/defaultBlocks.d.ts +2 -1
- package/types/src/blocks/index.d.ts +1 -0
- package/types/src/editor/BlockNoteEditor.d.ts +68 -47
- package/types/src/editor/BlockNoteExtensions.d.ts +2 -1
- package/types/src/editor/managers/BlockManager.d.ts +114 -0
- package/types/src/editor/managers/CollaborationManager.d.ts +115 -0
- package/types/src/editor/managers/EventManager.d.ts +58 -0
- package/types/src/editor/managers/ExportManager.d.ts +64 -0
- package/types/src/editor/managers/ExtensionManager.d.ts +68 -0
- package/types/src/editor/managers/SelectionManager.d.ts +54 -0
- package/types/src/editor/managers/StateManager.d.ts +115 -0
- package/types/src/editor/managers/StyleManager.d.ts +48 -0
- package/types/src/editor/managers/index.d.ts +8 -0
- package/types/src/extensions/Comments/CommentsPlugin.d.ts +4 -3
- package/types/src/i18n/locales/en.d.ts +6 -0
- package/types/src/i18n/locales/sk.d.ts +6 -0
- package/types/src/util/string.d.ts +1 -0
- package/dist/BlockNoteSchema-DmZ6UQfY.cjs +0 -11
- package/dist/BlockNoteSchema-DmZ6UQfY.cjs.map +0 -1
- package/dist/BlockNoteSchema-oR047ACf.js.map +0 -1
- package/dist/en-Bq3Es3Np.js.map +0 -1
- package/dist/en-D3B48eJ7.cjs +0 -2
- package/dist/en-D3B48eJ7.cjs.map +0 -1
- /package/src/api/exporters/markdown/{removeUnderlinesRehypePlugin.ts → util/removeUnderlinesRehypePlugin.ts} +0 -0
- /package/types/src/api/exporters/markdown/{removeUnderlinesRehypePlugin.d.ts → util/removeUnderlinesRehypePlugin.d.ts} +0 -0
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { insertContentAt } from "../../api/blockManipulation/insertContentAt.js";
|
|
2
|
+
import { inlineContentToNodes } from "../../api/nodeConversions/blockToNode.js";
|
|
3
|
+
import {
|
|
4
|
+
BlockSchema,
|
|
5
|
+
InlineContentSchema,
|
|
6
|
+
PartialInlineContent,
|
|
7
|
+
StyleSchema,
|
|
8
|
+
Styles,
|
|
9
|
+
} from "../../schema/index.js";
|
|
10
|
+
import {
|
|
11
|
+
DefaultBlockSchema,
|
|
12
|
+
DefaultInlineContentSchema,
|
|
13
|
+
DefaultStyleSchema,
|
|
14
|
+
} from "../../blocks/defaultBlocks.js";
|
|
15
|
+
import { TextSelection } from "@tiptap/pm/state";
|
|
16
|
+
import { UnreachableCaseError } from "../../util/typescript.js";
|
|
17
|
+
import { BlockNoteEditor } from "../BlockNoteEditor.js";
|
|
18
|
+
|
|
19
|
+
export class StyleManager<
|
|
20
|
+
BSchema extends BlockSchema = DefaultBlockSchema,
|
|
21
|
+
ISchema extends InlineContentSchema = DefaultInlineContentSchema,
|
|
22
|
+
SSchema extends StyleSchema = DefaultStyleSchema,
|
|
23
|
+
> {
|
|
24
|
+
constructor(private editor: BlockNoteEditor<BSchema, ISchema, SSchema>) {}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Insert a piece of content at the current cursor position.
|
|
28
|
+
*
|
|
29
|
+
* @param content can be a string, or array of partial inline content elements
|
|
30
|
+
*/
|
|
31
|
+
public insertInlineContent(
|
|
32
|
+
content: PartialInlineContent<ISchema, SSchema>,
|
|
33
|
+
{ updateSelection = false }: { updateSelection?: boolean } = {},
|
|
34
|
+
) {
|
|
35
|
+
const nodes = inlineContentToNodes(content, this.editor.pmSchema);
|
|
36
|
+
|
|
37
|
+
this.editor.transact((tr) => {
|
|
38
|
+
insertContentAt(
|
|
39
|
+
tr,
|
|
40
|
+
{
|
|
41
|
+
from: tr.selection.from,
|
|
42
|
+
to: tr.selection.to,
|
|
43
|
+
},
|
|
44
|
+
nodes,
|
|
45
|
+
{
|
|
46
|
+
updateSelection,
|
|
47
|
+
},
|
|
48
|
+
);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Gets the active text styles at the text cursor position or at the end of the current selection if it's active.
|
|
54
|
+
*/
|
|
55
|
+
public getActiveStyles() {
|
|
56
|
+
return this.editor.transact((tr) => {
|
|
57
|
+
const styles: Styles<SSchema> = {};
|
|
58
|
+
const marks = tr.selection.$to.marks();
|
|
59
|
+
|
|
60
|
+
for (const mark of marks) {
|
|
61
|
+
const config = this.editor.schema.styleSchema[mark.type.name];
|
|
62
|
+
if (!config) {
|
|
63
|
+
if (
|
|
64
|
+
// Links are not considered styles in blocknote
|
|
65
|
+
mark.type.name !== "link" &&
|
|
66
|
+
// "blocknoteIgnore" tagged marks (such as comments) are also not considered BlockNote "styles"
|
|
67
|
+
!mark.type.spec.blocknoteIgnore
|
|
68
|
+
) {
|
|
69
|
+
// eslint-disable-next-line no-console
|
|
70
|
+
console.warn("mark not found in styleschema", mark.type.name);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
if (config.propSchema === "boolean") {
|
|
76
|
+
(styles as any)[config.type] = true;
|
|
77
|
+
} else {
|
|
78
|
+
(styles as any)[config.type] = mark.attrs.stringValue;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return styles;
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Adds styles to the currently selected content.
|
|
88
|
+
* @param styles The styles to add.
|
|
89
|
+
*/
|
|
90
|
+
public addStyles(styles: Styles<SSchema>) {
|
|
91
|
+
for (const [style, value] of Object.entries(styles)) {
|
|
92
|
+
const config = this.editor.schema.styleSchema[style];
|
|
93
|
+
if (!config) {
|
|
94
|
+
throw new Error(`style ${style} not found in styleSchema`);
|
|
95
|
+
}
|
|
96
|
+
if (config.propSchema === "boolean") {
|
|
97
|
+
this.editor._tiptapEditor.commands.setMark(style);
|
|
98
|
+
} else if (config.propSchema === "string") {
|
|
99
|
+
this.editor._tiptapEditor.commands.setMark(style, {
|
|
100
|
+
stringValue: value,
|
|
101
|
+
});
|
|
102
|
+
} else {
|
|
103
|
+
throw new UnreachableCaseError(config.propSchema);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Removes styles from the currently selected content.
|
|
110
|
+
* @param styles The styles to remove.
|
|
111
|
+
*/
|
|
112
|
+
public removeStyles(styles: Styles<SSchema>) {
|
|
113
|
+
for (const style of Object.keys(styles)) {
|
|
114
|
+
this.editor._tiptapEditor.commands.unsetMark(style);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Toggles styles on the currently selected content.
|
|
120
|
+
* @param styles The styles to toggle.
|
|
121
|
+
*/
|
|
122
|
+
public toggleStyles(styles: Styles<SSchema>) {
|
|
123
|
+
for (const [style, value] of Object.entries(styles)) {
|
|
124
|
+
const config = this.editor.schema.styleSchema[style];
|
|
125
|
+
if (!config) {
|
|
126
|
+
throw new Error(`style ${style} not found in styleSchema`);
|
|
127
|
+
}
|
|
128
|
+
if (config.propSchema === "boolean") {
|
|
129
|
+
this.editor._tiptapEditor.commands.toggleMark(style);
|
|
130
|
+
} else if (config.propSchema === "string") {
|
|
131
|
+
this.editor._tiptapEditor.commands.toggleMark(style, {
|
|
132
|
+
stringValue: value,
|
|
133
|
+
});
|
|
134
|
+
} else {
|
|
135
|
+
throw new UnreachableCaseError(config.propSchema);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Gets the currently selected text.
|
|
142
|
+
*/
|
|
143
|
+
public getSelectedText() {
|
|
144
|
+
return this.editor.transact((tr) => {
|
|
145
|
+
return tr.doc.textBetween(tr.selection.from, tr.selection.to);
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Gets the URL of the last link in the current selection, or `undefined` if there are no links in the selection.
|
|
151
|
+
*/
|
|
152
|
+
public getSelectedLinkUrl() {
|
|
153
|
+
return this.editor._tiptapEditor.getAttributes("link").href as
|
|
154
|
+
| string
|
|
155
|
+
| undefined;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Creates a new link to replace the selected content.
|
|
160
|
+
* @param url The link URL.
|
|
161
|
+
* @param text The text to display the link with.
|
|
162
|
+
*/
|
|
163
|
+
public createLink(url: string, text?: string) {
|
|
164
|
+
if (url === "") {
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
const mark = this.editor.pmSchema.mark("link", { href: url });
|
|
168
|
+
this.editor.transact((tr) => {
|
|
169
|
+
const { from, to } = tr.selection;
|
|
170
|
+
|
|
171
|
+
if (text) {
|
|
172
|
+
tr.insertText(text, from, to).addMark(from, from + text.length, mark);
|
|
173
|
+
} else {
|
|
174
|
+
tr.setSelection(TextSelection.create(tr.doc, to)).addMark(
|
|
175
|
+
from,
|
|
176
|
+
to,
|
|
177
|
+
mark,
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { BlockManager } from "./BlockManager.js";
|
|
2
|
+
export {
|
|
3
|
+
CollaborationManager,
|
|
4
|
+
type CollaborationOptions,
|
|
5
|
+
} from "./CollaborationManager.js";
|
|
6
|
+
export { EventManager } from "./EventManager.js";
|
|
7
|
+
export { ExportManager } from "./ExportManager.js";
|
|
8
|
+
export { ExtensionManager } from "./ExtensionManager.js";
|
|
9
|
+
export { SelectionManager } from "./SelectionManager.js";
|
|
10
|
+
export { StateManager } from "./StateManager.js";
|
|
11
|
+
export { StyleManager } from "./StyleManager.js";
|
|
@@ -10,7 +10,7 @@ import type {
|
|
|
10
10
|
} from "../../comments/index.js";
|
|
11
11
|
import { BlockNoteEditor } from "../../editor/BlockNoteEditor.js";
|
|
12
12
|
import { BlockNoteExtension } from "../../editor/BlockNoteExtension.js";
|
|
13
|
-
import {
|
|
13
|
+
import { CustomBlockNoteSchema } from "../../schema/schema.js";
|
|
14
14
|
import { UserStore } from "./userstore/UserStore.js";
|
|
15
15
|
|
|
16
16
|
const PLUGIN_KEY = new PluginKey(`blocknote-comments`);
|
|
@@ -135,14 +135,17 @@ export class CommentsPlugin extends BlockNoteExtension {
|
|
|
135
135
|
private readonly editor: BlockNoteEditor<any, any, any>,
|
|
136
136
|
public readonly threadStore: ThreadStore,
|
|
137
137
|
private readonly markType: string,
|
|
138
|
-
public readonly
|
|
138
|
+
public readonly resolveUsers:
|
|
139
|
+
| undefined
|
|
140
|
+
| ((userIds: string[]) => Promise<User[]>),
|
|
141
|
+
public readonly commentEditorSchema?: CustomBlockNoteSchema<any, any, any>,
|
|
139
142
|
) {
|
|
140
143
|
super();
|
|
141
144
|
|
|
142
|
-
if (!
|
|
145
|
+
if (!resolveUsers) {
|
|
143
146
|
throw new Error("resolveUsers is required for comments");
|
|
144
147
|
}
|
|
145
|
-
this.userStore = new UserStore<User>(
|
|
148
|
+
this.userStore = new UserStore<User>(resolveUsers);
|
|
146
149
|
|
|
147
150
|
// Note: Plugins are currently not destroyed when the editor is destroyed.
|
|
148
151
|
// We should unsubscribe from the threadStore when the editor is destroyed.
|
|
@@ -215,6 +215,16 @@ export function getDefaultSlashMenuItems<
|
|
|
215
215
|
});
|
|
216
216
|
}
|
|
217
217
|
|
|
218
|
+
if (editorHasBlockWithType(editor, "divider")) {
|
|
219
|
+
items.push({
|
|
220
|
+
onItemClick: () => {
|
|
221
|
+
insertOrUpdateBlock(editor, { type: "divider" });
|
|
222
|
+
},
|
|
223
|
+
key: "divider",
|
|
224
|
+
...editor.dictionary.slash_menu.divider,
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
|
|
218
228
|
if (editorHasBlockWithType(editor, "table")) {
|
|
219
229
|
items.push({
|
|
220
230
|
onItemClick: () => {
|
package/src/i18n/locales/ar.ts
CHANGED
|
@@ -156,6 +156,12 @@ export const ar: Dictionary = {
|
|
|
156
156
|
aliases: ["رمز تعبيري", "إيموجي", "إيموت", "عاطفة", "وجه"],
|
|
157
157
|
group: "آخرون",
|
|
158
158
|
},
|
|
159
|
+
divider: {
|
|
160
|
+
title: "فاصل",
|
|
161
|
+
subtext: "يستخدم لفصل الكتل",
|
|
162
|
+
aliases: ["فاصل", "فاصل", "فاصل", "فاصل"],
|
|
163
|
+
group: "الكتل الأساسية",
|
|
164
|
+
},
|
|
159
165
|
},
|
|
160
166
|
placeholders: {
|
|
161
167
|
default: "أدخل نصًا أو اكتب '/' للأوامر",
|
package/src/i18n/locales/de.ts
CHANGED
|
@@ -191,6 +191,12 @@ export const de: Dictionary = {
|
|
|
191
191
|
aliases: ["emoji", "emote", "emotion", "gesicht"],
|
|
192
192
|
group: "Andere",
|
|
193
193
|
},
|
|
194
|
+
divider: {
|
|
195
|
+
title: "Trennlinie",
|
|
196
|
+
subtext: "Trennlinie zwischen Blöcken",
|
|
197
|
+
aliases: ["trennlinie", "hr", "horizontal rule"],
|
|
198
|
+
group: "Grundlegende Blöcke",
|
|
199
|
+
},
|
|
194
200
|
},
|
|
195
201
|
placeholders: {
|
|
196
202
|
default: "Text eingeben oder '/' für Befehle tippen",
|
package/src/i18n/locales/en.ts
CHANGED
|
@@ -170,6 +170,12 @@ export const en = {
|
|
|
170
170
|
aliases: ["emoji", "emote", "emotion", "face"],
|
|
171
171
|
group: "Others",
|
|
172
172
|
},
|
|
173
|
+
divider: {
|
|
174
|
+
title: "Divider",
|
|
175
|
+
subtext: "Visually divide blocks",
|
|
176
|
+
aliases: ["divider", "hr", "line", "horizontal rule"],
|
|
177
|
+
group: "Basic blocks",
|
|
178
|
+
},
|
|
173
179
|
},
|
|
174
180
|
placeholders: {
|
|
175
181
|
default: "Enter text or type '/' for commands",
|
package/src/i18n/locales/es.ts
CHANGED
|
@@ -171,6 +171,12 @@ export const es: Dictionary = {
|
|
|
171
171
|
aliases: ["emoji", "emoticono", "emoción", "cara"],
|
|
172
172
|
group: "Otros",
|
|
173
173
|
},
|
|
174
|
+
divider: {
|
|
175
|
+
title: "Divisor",
|
|
176
|
+
subtext: "Divisor de bloques",
|
|
177
|
+
aliases: ["divisor", "hr", "horizontal rule"],
|
|
178
|
+
group: "Bloques básicos",
|
|
179
|
+
},
|
|
174
180
|
},
|
|
175
181
|
placeholders: {
|
|
176
182
|
default: "Escribe o teclea '/' para comandos",
|
package/src/i18n/locales/fr.ts
CHANGED
|
@@ -216,6 +216,12 @@ export const fr: Dictionary = {
|
|
|
216
216
|
aliases: ["emoji", "émoticône", "émotion", "visage", "smiley"],
|
|
217
217
|
group: "Autres",
|
|
218
218
|
},
|
|
219
|
+
divider: {
|
|
220
|
+
title: "Diviseur",
|
|
221
|
+
subtext: "Utilisé pour diviser les blocs",
|
|
222
|
+
aliases: ["diviseur", "hr", "horizontal rule"],
|
|
223
|
+
group: "Blocs de base",
|
|
224
|
+
},
|
|
219
225
|
},
|
|
220
226
|
placeholders: {
|
|
221
227
|
default:
|
package/src/i18n/locales/he.ts
CHANGED
|
@@ -172,6 +172,12 @@ export const he: Dictionary = {
|
|
|
172
172
|
aliases: ["emoji", "emote", "emotion", "face"],
|
|
173
173
|
group: "אחר",
|
|
174
174
|
},
|
|
175
|
+
divider: {
|
|
176
|
+
title: "מחיצה",
|
|
177
|
+
subtext: "מחיצה בין בלוקים",
|
|
178
|
+
aliases: ["divider", "hr", "horizontal rule"],
|
|
179
|
+
group: "בלוקים בסיסיים",
|
|
180
|
+
},
|
|
175
181
|
},
|
|
176
182
|
placeholders: {
|
|
177
183
|
default: "הזן טקסט או הקלד '/' לפקודות",
|
package/src/i18n/locales/hr.ts
CHANGED
|
@@ -184,6 +184,12 @@ export const hr: Dictionary = {
|
|
|
184
184
|
aliases: ["emoji", "emotikon", "emocija", "lice"],
|
|
185
185
|
group: "Ostalo",
|
|
186
186
|
},
|
|
187
|
+
divider: {
|
|
188
|
+
title: "Razdjelnik",
|
|
189
|
+
subtext: "Razdjelnik blokova",
|
|
190
|
+
aliases: ["razdjelnik", "hr", "horizontal rule"],
|
|
191
|
+
group: "Osnovni blokovi",
|
|
192
|
+
},
|
|
187
193
|
},
|
|
188
194
|
placeholders: {
|
|
189
195
|
default: "Unesi tekst ili upiši ‘/’ za naredbe",
|
package/src/i18n/locales/is.ts
CHANGED
|
@@ -185,6 +185,12 @@ export const is: Dictionary = {
|
|
|
185
185
|
aliases: ["emoji", "andlitsávísun", "tilfinningar", "andlit"],
|
|
186
186
|
group: "Annað",
|
|
187
187
|
},
|
|
188
|
+
divider: {
|
|
189
|
+
title: "Razdjelnik",
|
|
190
|
+
subtext: "Razdjelnik blokova",
|
|
191
|
+
aliases: ["razdjelnik", "hr", "horizontal rule"],
|
|
192
|
+
group: "Osnovni blokovi",
|
|
193
|
+
},
|
|
188
194
|
},
|
|
189
195
|
placeholders: {
|
|
190
196
|
default: "Sláðu inn texta eða skrifaðu '/' fyrir skipanir",
|
package/src/i18n/locales/it.ts
CHANGED
|
@@ -193,6 +193,12 @@ export const it: Dictionary = {
|
|
|
193
193
|
aliases: ["emoji", "emote", "emozione", "faccia"],
|
|
194
194
|
group: "Altri",
|
|
195
195
|
},
|
|
196
|
+
divider: {
|
|
197
|
+
title: "Divisore",
|
|
198
|
+
subtext: "Divisore di blocchi",
|
|
199
|
+
aliases: ["divisore", "hr", "horizontal rule"],
|
|
200
|
+
group: "Blocchi base",
|
|
201
|
+
},
|
|
196
202
|
},
|
|
197
203
|
placeholders: {
|
|
198
204
|
default: "Inserisci testo o digita '/' per i comandi",
|
package/src/i18n/locales/ja.ts
CHANGED
|
@@ -211,6 +211,12 @@ export const ja: Dictionary = {
|
|
|
211
211
|
aliases: ["絵文字", "顔文字", "感情表現", "顔"],
|
|
212
212
|
group: "その他",
|
|
213
213
|
},
|
|
214
|
+
divider: {
|
|
215
|
+
title: "区切り",
|
|
216
|
+
subtext: "区切りを表示するために使用",
|
|
217
|
+
aliases: ["divider", "hr", "horizontal rule"],
|
|
218
|
+
group: "基本ブロック",
|
|
219
|
+
},
|
|
214
220
|
},
|
|
215
221
|
placeholders: {
|
|
216
222
|
default: "テキストを入力するか'/' を入力してコマンド選択",
|
package/src/i18n/locales/ko.ts
CHANGED
|
@@ -184,6 +184,12 @@ export const ko: Dictionary = {
|
|
|
184
184
|
],
|
|
185
185
|
group: "기타",
|
|
186
186
|
},
|
|
187
|
+
divider: {
|
|
188
|
+
title: "구분선",
|
|
189
|
+
subtext: "구분선 블록",
|
|
190
|
+
aliases: ["divider", "hr", "horizontal rule"],
|
|
191
|
+
group: "기본 블록",
|
|
192
|
+
},
|
|
187
193
|
},
|
|
188
194
|
placeholders: {
|
|
189
195
|
default: "텍스트를 입력하거나 /를 입력하여 명령을 입력하세요.",
|
package/src/i18n/locales/nl.ts
CHANGED
|
@@ -172,6 +172,12 @@ export const nl: Dictionary = {
|
|
|
172
172
|
],
|
|
173
173
|
group: "Overig",
|
|
174
174
|
},
|
|
175
|
+
divider: {
|
|
176
|
+
title: "Scheidingslijn",
|
|
177
|
+
subtext: "Scheidingslijn tussen blokken",
|
|
178
|
+
aliases: ["scheidingslijn", "hr", "horizontal rule"],
|
|
179
|
+
group: "Basisblokken",
|
|
180
|
+
},
|
|
175
181
|
},
|
|
176
182
|
placeholders: {
|
|
177
183
|
default: "Voer tekst in of type '/' voor commando's",
|
package/src/i18n/locales/no.ts
CHANGED
|
@@ -190,6 +190,12 @@ export const no: Dictionary = {
|
|
|
190
190
|
aliases: ["emoji", "emote", "emosjon", "ansikt"],
|
|
191
191
|
group: "Andre",
|
|
192
192
|
},
|
|
193
|
+
divider: {
|
|
194
|
+
title: "Delingslinje",
|
|
195
|
+
subtext: "Delingslinje mellom blokker",
|
|
196
|
+
aliases: ["delingslinje", "hr", "horizontal rule"],
|
|
197
|
+
group: "Grunnleggende blokker",
|
|
198
|
+
},
|
|
193
199
|
},
|
|
194
200
|
placeholders: {
|
|
195
201
|
default: "Skriv tekst eller skriv '/' for å vise kommandoer",
|
package/src/i18n/locales/pl.ts
CHANGED
|
@@ -162,6 +162,12 @@ export const pl: Dictionary = {
|
|
|
162
162
|
aliases: ["emoji", "emotka", "wyrażenie emocji", "twarz"],
|
|
163
163
|
group: "Inne",
|
|
164
164
|
},
|
|
165
|
+
divider: {
|
|
166
|
+
title: "Separator",
|
|
167
|
+
subtext: "Separator bloków",
|
|
168
|
+
aliases: ["separator", "hr", "horizontal rule"],
|
|
169
|
+
group: "Podstawowe bloki",
|
|
170
|
+
},
|
|
165
171
|
},
|
|
166
172
|
placeholders: {
|
|
167
173
|
default: "Wprowadź tekst lub wpisz '/' aby użyć poleceń",
|
package/src/i18n/locales/pt.ts
CHANGED
|
@@ -163,6 +163,12 @@ export const pt: Dictionary = {
|
|
|
163
163
|
aliases: ["emoji", "emoticon", "expressão emocional", "rosto"],
|
|
164
164
|
group: "Outros",
|
|
165
165
|
},
|
|
166
|
+
divider: {
|
|
167
|
+
title: "Separador",
|
|
168
|
+
subtext: "Separador de blocos",
|
|
169
|
+
aliases: ["separador", "hr", "horizontal rule"],
|
|
170
|
+
group: "Blocos básicos",
|
|
171
|
+
},
|
|
166
172
|
},
|
|
167
173
|
placeholders: {
|
|
168
174
|
default: "Digite texto ou use '/' para comandos",
|
package/src/i18n/locales/ru.ts
CHANGED
|
@@ -214,6 +214,12 @@ export const ru: Dictionary = {
|
|
|
214
214
|
aliases: ["эмодзи", "смайлик", "выражение эмоций", "лицо"],
|
|
215
215
|
group: "Прочее",
|
|
216
216
|
},
|
|
217
|
+
divider: {
|
|
218
|
+
title: "Разделитель",
|
|
219
|
+
subtext: "Разделитель блоков",
|
|
220
|
+
aliases: ["divider", "hr", "horizontal rule"],
|
|
221
|
+
group: "Базовые блоки",
|
|
222
|
+
},
|
|
217
223
|
},
|
|
218
224
|
placeholders: {
|
|
219
225
|
default: "Введите текст или введите «/» для команд",
|
package/src/i18n/locales/sk.ts
CHANGED
|
@@ -170,6 +170,12 @@ export const sk = {
|
|
|
170
170
|
aliases: ["emoji", "emócia", "tvár"],
|
|
171
171
|
group: "Ostatné",
|
|
172
172
|
},
|
|
173
|
+
divider: {
|
|
174
|
+
title: "Oddelovač",
|
|
175
|
+
subtext: "Oddelovač blokov",
|
|
176
|
+
aliases: ["oddelovač", "hr", "horizontal rule"],
|
|
177
|
+
group: "Základné bloky",
|
|
178
|
+
},
|
|
173
179
|
},
|
|
174
180
|
placeholders: {
|
|
175
181
|
default: "Zadajte text alebo napíšte '/' pre príkazy",
|
package/src/i18n/locales/uk.ts
CHANGED
|
@@ -196,6 +196,12 @@ export const uk: Dictionary = {
|
|
|
196
196
|
aliases: ["emoji", "emote", "emotion", "face", "смайлик", "емодзі"],
|
|
197
197
|
group: "Інше",
|
|
198
198
|
},
|
|
199
|
+
divider: {
|
|
200
|
+
title: "Розділювач",
|
|
201
|
+
subtext: "Розділювач блоків",
|
|
202
|
+
aliases: ["divider", "hr", "horizontal rule"],
|
|
203
|
+
group: "Базові блоки",
|
|
204
|
+
},
|
|
199
205
|
},
|
|
200
206
|
placeholders: {
|
|
201
207
|
default: "Введіть текст або наберіть '/' для команд",
|
package/src/i18n/locales/vi.ts
CHANGED
|
@@ -170,6 +170,12 @@ export const vi: Dictionary = {
|
|
|
170
170
|
],
|
|
171
171
|
group: "Khác",
|
|
172
172
|
},
|
|
173
|
+
divider: {
|
|
174
|
+
title: "Phân cách",
|
|
175
|
+
subtext: "Phân cách khối",
|
|
176
|
+
aliases: ["divider", "hr", "horizontal rule"],
|
|
177
|
+
group: "Khối cơ bản",
|
|
178
|
+
},
|
|
173
179
|
},
|
|
174
180
|
placeholders: {
|
|
175
181
|
default: "Nhập văn bản hoặc gõ '/' để thêm định dạng",
|
|
@@ -212,6 +212,12 @@ export const zhTW: Dictionary = {
|
|
|
212
212
|
],
|
|
213
213
|
group: "其他",
|
|
214
214
|
},
|
|
215
|
+
divider: {
|
|
216
|
+
title: "分隔線",
|
|
217
|
+
subtext: "分隔線區塊",
|
|
218
|
+
aliases: ["divider", "hr", "horizontal rule"],
|
|
219
|
+
group: "基礎區塊",
|
|
220
|
+
},
|
|
215
221
|
},
|
|
216
222
|
placeholders: {
|
|
217
223
|
default: "輸入 '/' 以使用指令",
|
package/src/i18n/locales/zh.ts
CHANGED
|
@@ -212,6 +212,12 @@ export const zh: Dictionary = {
|
|
|
212
212
|
],
|
|
213
213
|
group: "其他",
|
|
214
214
|
},
|
|
215
|
+
divider: {
|
|
216
|
+
title: "分隔线",
|
|
217
|
+
subtext: "分隔线区块",
|
|
218
|
+
aliases: ["divider", "hr", "horizontal rule"],
|
|
219
|
+
group: "基础区块",
|
|
220
|
+
},
|
|
215
221
|
},
|
|
216
222
|
placeholders: {
|
|
217
223
|
default: "输入 '/' 以使用命令",
|
package/src/util/string.ts
CHANGED
|
@@ -13,3 +13,24 @@ export function filenameFromURL(url: string): string {
|
|
|
13
13
|
}
|
|
14
14
|
return parts[parts.length - 1];
|
|
15
15
|
}
|
|
16
|
+
|
|
17
|
+
export function isVideoUrl(url: string) {
|
|
18
|
+
const videoExtensions = [
|
|
19
|
+
"mp4",
|
|
20
|
+
"webm",
|
|
21
|
+
"ogg",
|
|
22
|
+
"mov",
|
|
23
|
+
"mkv",
|
|
24
|
+
"flv",
|
|
25
|
+
"avi",
|
|
26
|
+
"wmv",
|
|
27
|
+
"m4v",
|
|
28
|
+
];
|
|
29
|
+
try {
|
|
30
|
+
const pathname = new URL(url).pathname;
|
|
31
|
+
const ext = pathname.split(".").pop()?.toLowerCase() || "";
|
|
32
|
+
return videoExtensions.includes(ext);
|
|
33
|
+
} catch (_) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export type DividerBlockConfig = ReturnType<typeof createDividerBlockConfig>;
|
|
2
|
+
export declare const createDividerBlockConfig: () => import("../../index.js").BlockConfig<"divider", {}, "none">;
|
|
3
|
+
export declare const createDividerBlockSpec: (options?: Partial<Partial<Record<string, any>>> | undefined) => import("../../index.js").BlockSpec<"divider", {}, "none">;
|
|
@@ -11,7 +11,7 @@ export declare const createHeadingBlockConfig: (() => import("../../index.js").B
|
|
|
11
11
|
readonly optional: true;
|
|
12
12
|
} | undefined;
|
|
13
13
|
readonly level: {
|
|
14
|
-
readonly default: 1 |
|
|
14
|
+
readonly default: 1 | 4 | 2 | 3 | 5 | 6;
|
|
15
15
|
readonly values: readonly number[];
|
|
16
16
|
};
|
|
17
17
|
readonly backgroundColor: {
|
|
@@ -30,7 +30,7 @@ export declare const createHeadingBlockConfig: (() => import("../../index.js").B
|
|
|
30
30
|
readonly optional: true;
|
|
31
31
|
} | undefined;
|
|
32
32
|
readonly level: {
|
|
33
|
-
readonly default: 1 |
|
|
33
|
+
readonly default: 1 | 4 | 2 | 3 | 5 | 6;
|
|
34
34
|
readonly values: readonly number[];
|
|
35
35
|
};
|
|
36
36
|
readonly backgroundColor: {
|
|
@@ -54,7 +54,7 @@ export declare const createHeadingBlockSpec: (options?: Partial<{
|
|
|
54
54
|
readonly optional: true;
|
|
55
55
|
} | undefined;
|
|
56
56
|
readonly level: {
|
|
57
|
-
readonly default: 1 |
|
|
57
|
+
readonly default: 1 | 4 | 2 | 3 | 5 | 6;
|
|
58
58
|
readonly values: readonly number[];
|
|
59
59
|
};
|
|
60
60
|
readonly backgroundColor: {
|
|
@@ -50,6 +50,7 @@ export declare const defaultBlockSpecs: {
|
|
|
50
50
|
readonly default: string;
|
|
51
51
|
};
|
|
52
52
|
}, "inline">;
|
|
53
|
+
readonly divider: import("../index.js").BlockSpec<"divider", {}, "none">;
|
|
53
54
|
readonly file: import("../index.js").BlockSpec<"file", {
|
|
54
55
|
readonly backgroundColor: {
|
|
55
56
|
default: "default";
|
|
@@ -70,7 +71,7 @@ export declare const defaultBlockSpecs: {
|
|
|
70
71
|
readonly optional: true;
|
|
71
72
|
} | undefined;
|
|
72
73
|
readonly level: {
|
|
73
|
-
readonly default: 1 |
|
|
74
|
+
readonly default: 1 | 4 | 2 | 3 | 5 | 6;
|
|
74
75
|
readonly values: readonly number[];
|
|
75
76
|
};
|
|
76
77
|
readonly backgroundColor: {
|