@blocknote/core 0.14.2 → 0.14.3
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.js +792 -462
- package/dist/blocknote.js.map +1 -1
- package/dist/blocknote.umd.cjs +4 -4
- package/dist/blocknote.umd.cjs.map +1 -1
- package/dist/webpack-stats.json +1 -1
- package/package.json +2 -2
- package/src/api/exporters/html/__snapshots_fragment_edge_cases__/selectionLeavesBlockChildren.html +1 -0
- package/src/api/exporters/html/__snapshots_fragment_edge_cases__/selectionSpansBlocksChildren.html +1 -0
- package/src/api/exporters/html/__snapshots_fragment_edge_cases__/selectionWithinBlockChildren.html +1 -0
- package/src/api/exporters/html/htmlConversion.test.ts +140 -0
- package/src/api/exporters/html/util/simplifyBlocksRehypePlugin.ts +31 -8
- package/src/editor/BlockNoteExtensions.ts +1 -0
- package/src/i18n/locales/index.ts +2 -1
- package/src/i18n/locales/ru.ts +323 -0
- package/types/src/editor/BlockNoteExtensions.d.ts +1 -0
- package/types/src/i18n/locales/index.d.ts +1 -0
- package/types/src/i18n/locales/ru.d.ts +2 -0
package/dist/webpack-stats.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"builtAt":
|
|
1
|
+
{"builtAt":1720006023046,"assets":[{"name":"blocknote.umd.cjs","size":182010},{"name":"blocknote.umd.cjs.map","size":667946}],"chunks":[{"id":"a1ee98a","entry":true,"initial":true,"files":["blocknote.umd.cjs"],"names":["index"]}],"modules":[{"name":"./src/i18n/locales/ar.ts","size":6398,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/en.ts","size":6512,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/fr.ts","size":7122,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/is.ts","size":6695,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/ja.ts","size":6185,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/ko.ts","size":5879,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/nl.ts","size":6834,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/pl.ts","size":6595,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/pt.ts","size":6785,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/vi.ts","size":6643,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/zh.ts","size":5872,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/ru.ts","size":7393,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/index.ts","size":0,"chunks":["a1ee98a"]},{"name":"./src/extensions/UniqueID/UniqueID.ts","size":8518,"chunks":["a1ee98a"]},{"name":"./src/api/getBlockInfoFromPos.ts","size":1691,"chunks":["a1ee98a"]},{"name":"./src/schema/inlineContent/types.ts","size":302,"chunks":["a1ee98a"]},{"name":"./src/util/typescript.ts","size":331,"chunks":["a1ee98a"]},{"name":"./src/api/nodeConversions/nodeConversions.ts","size":11998,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/html/util/sharedHTMLConversion.ts","size":2293,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/html/util/simplifyBlocksRehypePlugin.ts","size":3119,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/html/externalHTMLExporter.ts","size":1107,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/html/internalHTMLSerializer.ts","size":704,"chunks":["a1ee98a"]},{"name":"./src/util/browser.ts","size":536,"chunks":["a1ee98a"]},{"name":"./src/blocks/defaultBlockHelpers.ts","size":1731,"chunks":["a1ee98a"]},{"name":"./src/blocks/defaultProps.ts","size":269,"chunks":["a1ee98a"]},{"name":"./src/util/string.ts","size":299,"chunks":["a1ee98a"]},{"name":"./src/schema/blocks/internal.ts","size":3877,"chunks":["a1ee98a"]},{"name":"./src/schema/blocks/createSpec.ts","size":2814,"chunks":["a1ee98a"]},{"name":"./src/schema/inlineContent/internal.ts","size":1357,"chunks":["a1ee98a"]},{"name":"./src/schema/inlineContent/createSpec.ts","size":1627,"chunks":["a1ee98a"]},{"name":"./src/schema/styles/internal.ts","size":1162,"chunks":["a1ee98a"]},{"name":"./src/schema/styles/createSpec.ts","size":1263,"chunks":["a1ee98a"]},{"name":"./src/blocks/FileBlockContent/fileBlockHelpers.ts","size":8593,"chunks":["a1ee98a"]},{"name":"./src/blocks/FileBlockContent/FileBlockContent.ts","size":1939,"chunks":["a1ee98a"]},{"name":"./src/blocks/ImageBlockContent/imageBlockHelpers.ts","size":175,"chunks":["a1ee98a"]},{"name":"./src/blocks/ImageBlockContent/ImageBlockContent.ts","size":3959,"chunks":["a1ee98a"]},{"name":"./src/blocks/VideoBlockContent/videoBlockHelpers.ts","size":175,"chunks":["a1ee98a"]},{"name":"./src/blocks/VideoBlockContent/VideoBlockContent.ts","size":3763,"chunks":["a1ee98a"]},{"name":"./src/blocks/AudioBlockContent/audioBlockHelpers.ts","size":108,"chunks":["a1ee98a"]},{"name":"./src/blocks/AudioBlockContent/AudioBlockContent.ts","size":3741,"chunks":["a1ee98a"]},{"name":"./src/blocks/FileBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.ts","size":316,"chunks":["a1ee98a"]},{"name":"./src/extensions/BackgroundColor/BackgroundColorMark.ts","size":946,"chunks":["a1ee98a"]},{"name":"./src/extensions/TextColor/TextColorMark.ts","size":866,"chunks":["a1ee98a"]},{"name":"./src/api/getCurrentBlockContentType.ts","size":192,"chunks":["a1ee98a"]},{"name":"./src/blocks/HeadingBlockContent/HeadingBlockContent.ts","size":3439,"chunks":["a1ee98a"]},{"name":"./src/blocks/ListItemBlockContent/ListItemKeyboardShortcuts.ts","size":1201,"chunks":["a1ee98a"]},{"name":"./src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.ts","size":3122,"chunks":["a1ee98a"]},{"name":"./src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListIndexingPlugin.ts","size":1862,"chunks":["a1ee98a"]},{"name":"./src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts","size":3437,"chunks":["a1ee98a"]},{"name":"./src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.ts","size":6423,"chunks":["a1ee98a"]},{"name":"./src/blocks/ParagraphBlockContent/ParagraphBlockContent.ts","size":1307,"chunks":["a1ee98a"]},{"name":"./src/blocks/TableBlockContent/TableExtension.ts","size":1462,"chunks":["a1ee98a"]},{"name":"./src/blocks/TableBlockContent/TableBlockContent.ts","size":1624,"chunks":["a1ee98a"]},{"name":"./src/blocks/defaultBlocks.ts","size":1123,"chunks":["a1ee98a"]},{"name":"./src/blocks/defaultBlockTypeGuards.ts","size":1331,"chunks":["a1ee98a"]},{"name":"./src/api/nodeUtil.ts","size":548,"chunks":["a1ee98a"]},{"name":"./src/api/blockManipulation/blockManipulation.ts","size":5738,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/markdown/removeUnderlinesRehypePlugin.ts","size":752,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/markdown/util/addSpacesToCheckboxesRehypePlugin.ts","size":775,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/markdown/markdownExporter.ts","size":622,"chunks":["a1ee98a"]},{"name":"./src/api/parsers/html/util/nestedLists.ts","size":2174,"chunks":["a1ee98a"]},{"name":"./src/api/parsers/html/parseHTML.ts","size":503,"chunks":["a1ee98a"]},{"name":"./src/api/parsers/markdown/parseMarkdown.ts","size":1054,"chunks":["a1ee98a"]},{"name":"./src/util/EventEmitter.ts","size":744,"chunks":["a1ee98a"]},{"name":"./src/extensions/FilePanel/FilePanelPlugin.ts","size":3480,"chunks":["a1ee98a"]},{"name":"./src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts","size":4355,"chunks":["a1ee98a"]},{"name":"./src/extensions/LinkToolbar/LinkToolbarPlugin.ts","size":7365,"chunks":["a1ee98a"]},{"name":"./src/extensions/SuggestionMenu/SuggestionPlugin.ts","size":7738,"chunks":["a1ee98a"]},{"name":"./src/extensions/SideMenu/MultipleNodeSelection.ts","size":1616,"chunks":["a1ee98a"]},{"name":"./src/extensions/SideMenu/SideMenuPlugin.ts","size":16932,"chunks":["a1ee98a"]},{"name":"./src/extensions/TableHandles/TableHandlesPlugin.ts","size":15292,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/copyExtension.ts","size":2883,"chunks":["a1ee98a"]},{"name":"./src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts","size":6248,"chunks":["a1ee98a"]},{"name":"./src/api/parsers/acceptedMIMETypes.ts","size":91,"chunks":["a1ee98a"]},{"name":"./src/api/parsers/handleFileInsertion.ts","size":1983,"chunks":["a1ee98a"]},{"name":"./src/api/parsers/pasteExtension.ts","size":1244,"chunks":["a1ee98a"]},{"name":"./src/api/parsers/fileDropExtension.ts","size":884,"chunks":["a1ee98a"]},{"name":"./src/extensions/BackgroundColor/BackgroundColorExtension.ts","size":688,"chunks":["a1ee98a"]},{"name":"./src/extensions/TextAlignment/TextAlignmentExtension.ts","size":825,"chunks":["a1ee98a"]},{"name":"./src/extensions/TextColor/TextColorExtension.ts","size":622,"chunks":["a1ee98a"]},{"name":"./src/extensions/TrailingNode/TrailingNodeExtension.ts","size":1594,"chunks":["a1ee98a"]},{"name":"./src/extensions/NonEditableBlocks/NonEditableBlockPlugin.ts","size":1014,"chunks":["a1ee98a"]},{"name":"./src/extensions/PreviousBlockType/PreviousBlockTypePlugin.ts","size":4578,"chunks":["a1ee98a"]},{"name":"./src/pm-nodes/BlockContainer.ts","size":18112,"chunks":["a1ee98a"]},{"name":"./src/pm-nodes/BlockGroup.ts","size":1097,"chunks":["a1ee98a"]},{"name":"./src/pm-nodes/Doc.ts","size":90,"chunks":["a1ee98a"]},{"name":"./src/editor/BlockNoteExtensions.ts","size":4243,"chunks":["a1ee98a"]},{"name":"./src/editor/transformPasted.ts","size":1062,"chunks":["a1ee98a"]},{"name":"./src/editor/BlockNoteSchema.ts","size":1044,"chunks":["a1ee98a"]},{"name":"./src/editor/BlockNoteTipTapEditor.ts","size":2655,"chunks":["a1ee98a"]},{"name":"./src/extensions/Placeholder/PlaceholderPlugin.ts","size":2758,"chunks":["a1ee98a"]},{"name":"./src/editor/Block.css","size":17,"chunks":["a1ee98a"]},{"name":"./src/editor/editor.css","size":18,"chunks":["a1ee98a"]},{"name":"./src/editor/BlockNoteEditor.ts","size":23024,"chunks":["a1ee98a"]},{"name":"./src/api/testUtil/partialBlockTestUtil.ts","size":2166,"chunks":["a1ee98a"]},{"name":"./src/index.ts","size":0,"chunks":["a1ee98a"]}]}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"homepage": "https://github.com/TypeCellOS/BlockNote",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
|
-
"version": "0.14.
|
|
6
|
+
"version": "0.14.3",
|
|
7
7
|
"files": [
|
|
8
8
|
"dist",
|
|
9
9
|
"types",
|
|
@@ -116,5 +116,5 @@
|
|
|
116
116
|
"access": "public",
|
|
117
117
|
"registry": "https://registry.npmjs.org/"
|
|
118
118
|
},
|
|
119
|
-
"gitHead": "
|
|
119
|
+
"gitHead": "7e815acca6ced4d59becf0b375cc02e50b5c3ab5"
|
|
120
120
|
}
|
package/src/api/exporters/html/__snapshots_fragment_edge_cases__/selectionLeavesBlockChildren.html
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<p class="bn-inline-content">Nested Paragraph 1</p><p class="bn-inline-content">Nested Paragraph 2</p><p class="bn-inline-content">Nested Paragraph 3</p><p class="bn-inline-content">Paragraph 2</p>
|
package/src/api/exporters/html/__snapshots_fragment_edge_cases__/selectionSpansBlocksChildren.html
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<p class="bn-inline-content">Nested Paragraph 1</p><p class="bn-inline-content">Nested Paragraph 2</p><p class="bn-inline-content">Nested Paragraph 3</p><p class="bn-inline-content">Paragraph 2</p><p class="bn-inline-content">Nested Paragraph 1</p><p class="bn-inline-content">Nested Paragraph 2</p><p class="bn-inline-content">Nested Paragraph 3</p>
|
package/src/api/exporters/html/__snapshots_fragment_edge_cases__/selectionWithinBlockChildren.html
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<p class="bn-inline-content">Nested Paragraph 1</p><p class="bn-inline-content">Nested Paragraph 2</p><p class="bn-inline-content">Nested Paragraph 3</p>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TextSelection } from "prosemirror-state";
|
|
1
2
|
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
|
2
3
|
import { BlockNoteEditor } from "../../../editor/BlockNoteEditor";
|
|
3
4
|
|
|
@@ -101,3 +102,142 @@ describe("Test HTML conversion", () => {
|
|
|
101
102
|
});
|
|
102
103
|
}
|
|
103
104
|
});
|
|
105
|
+
|
|
106
|
+
// Fragments created from ProseMirror selections don't always conform to the
|
|
107
|
+
// schema. This is because ProseMirror preserves the full ancestry of selected
|
|
108
|
+
// nodes, but not the siblings of ancestor nodes. These tests are to verify that
|
|
109
|
+
// Fragments like this are exported to HTML properly, as they can't be created
|
|
110
|
+
// from Block objects like all the other test cases (Block object conversions
|
|
111
|
+
// always conform to the schema).
|
|
112
|
+
describe("Test ProseMirror fragment edge case conversion", () => {
|
|
113
|
+
let editor: BlockNoteEditor;
|
|
114
|
+
const div = document.createElement("div");
|
|
115
|
+
beforeEach(() => {
|
|
116
|
+
editor = BlockNoteEditor.create();
|
|
117
|
+
editor.mount(div);
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
afterEach(() => {
|
|
121
|
+
editor.mount(undefined);
|
|
122
|
+
editor._tiptapEditor.destroy();
|
|
123
|
+
editor = undefined as any;
|
|
124
|
+
|
|
125
|
+
delete (window as Window & { __TEST_OPTIONS?: any }).__TEST_OPTIONS;
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
// When the selection starts in a nested block, the Fragment from it omits the
|
|
129
|
+
// `blockContent` node of the parent `blockContainer` if it's not also
|
|
130
|
+
// included in the selection. In the schema, `blockContainer` nodes should
|
|
131
|
+
// contain a single `blockContent` node, so this edge case needs to be tested.
|
|
132
|
+
describe("No block content", () => {
|
|
133
|
+
const blocks: PartialBlock[] = [
|
|
134
|
+
{
|
|
135
|
+
type: "paragraph",
|
|
136
|
+
content: "Paragraph 1",
|
|
137
|
+
children: [
|
|
138
|
+
{
|
|
139
|
+
type: "paragraph",
|
|
140
|
+
content: "Nested Paragraph 1",
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
type: "paragraph",
|
|
144
|
+
content: "Nested Paragraph 2",
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
type: "paragraph",
|
|
148
|
+
content: "Nested Paragraph 3",
|
|
149
|
+
},
|
|
150
|
+
],
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
type: "paragraph",
|
|
154
|
+
content: "Paragraph 2",
|
|
155
|
+
children: [
|
|
156
|
+
{
|
|
157
|
+
type: "paragraph",
|
|
158
|
+
content: "Nested Paragraph 1",
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
type: "paragraph",
|
|
162
|
+
content: "Nested Paragraph 2",
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
type: "paragraph",
|
|
166
|
+
content: "Nested Paragraph 3",
|
|
167
|
+
},
|
|
168
|
+
],
|
|
169
|
+
},
|
|
170
|
+
];
|
|
171
|
+
|
|
172
|
+
beforeEach(() => {
|
|
173
|
+
editor.replaceBlocks(editor.document, blocks);
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
it("Selection within a block's children", () => {
|
|
177
|
+
// Selection starts and ends within the first block's children.
|
|
178
|
+
editor.prosemirrorView.dispatch(
|
|
179
|
+
editor._tiptapEditor.state.tr.setSelection(
|
|
180
|
+
TextSelection.create(editor._tiptapEditor.state.doc, 18, 80)
|
|
181
|
+
)
|
|
182
|
+
);
|
|
183
|
+
|
|
184
|
+
const copiedFragment =
|
|
185
|
+
editor._tiptapEditor.state.selection.content().content;
|
|
186
|
+
|
|
187
|
+
const exporter = createExternalHTMLExporter(
|
|
188
|
+
editor._tiptapEditor.schema,
|
|
189
|
+
editor
|
|
190
|
+
);
|
|
191
|
+
const externalHTML = exporter.exportProseMirrorFragment(copiedFragment);
|
|
192
|
+
expect(externalHTML).toMatchFileSnapshot(
|
|
193
|
+
"./__snapshots_fragment_edge_cases__/" +
|
|
194
|
+
"selectionWithinBlockChildren.html"
|
|
195
|
+
);
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
it("Selection leaves a block's children", () => {
|
|
199
|
+
// Selection starts and ends within the first block's children and ends
|
|
200
|
+
// outside, at a shallower nesting level in the second block.
|
|
201
|
+
editor.prosemirrorView.dispatch(
|
|
202
|
+
editor._tiptapEditor.state.tr.setSelection(
|
|
203
|
+
TextSelection.create(editor._tiptapEditor.state.doc, 18, 97)
|
|
204
|
+
)
|
|
205
|
+
);
|
|
206
|
+
|
|
207
|
+
const copiedFragment =
|
|
208
|
+
editor._tiptapEditor.state.selection.content().content;
|
|
209
|
+
|
|
210
|
+
const exporter = createExternalHTMLExporter(
|
|
211
|
+
editor._tiptapEditor.schema,
|
|
212
|
+
editor
|
|
213
|
+
);
|
|
214
|
+
const externalHTML = exporter.exportProseMirrorFragment(copiedFragment);
|
|
215
|
+
expect(externalHTML).toMatchFileSnapshot(
|
|
216
|
+
"./__snapshots_fragment_edge_cases__/" +
|
|
217
|
+
"selectionLeavesBlockChildren.html"
|
|
218
|
+
);
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
it("Selection spans multiple blocks' children", () => {
|
|
222
|
+
// Selection starts and ends within the first block's children and ends
|
|
223
|
+
// within the second block's children.
|
|
224
|
+
editor.prosemirrorView.dispatch(
|
|
225
|
+
editor._tiptapEditor.state.tr.setSelection(
|
|
226
|
+
TextSelection.create(editor._tiptapEditor.state.doc, 18, 163)
|
|
227
|
+
)
|
|
228
|
+
);
|
|
229
|
+
|
|
230
|
+
const copiedFragment =
|
|
231
|
+
editor._tiptapEditor.state.selection.content().content;
|
|
232
|
+
const exporter = createExternalHTMLExporter(
|
|
233
|
+
editor._tiptapEditor.schema,
|
|
234
|
+
editor
|
|
235
|
+
);
|
|
236
|
+
const externalHTML = exporter.exportProseMirrorFragment(copiedFragment);
|
|
237
|
+
expect(externalHTML).toMatchFileSnapshot(
|
|
238
|
+
"./__snapshots_fragment_edge_cases__/" +
|
|
239
|
+
"selectionSpansBlocksChildren.html"
|
|
240
|
+
);
|
|
241
|
+
});
|
|
242
|
+
});
|
|
243
|
+
});
|
|
@@ -41,11 +41,34 @@ export function simplifyBlocks(options: SimplifyBlocksOptions) {
|
|
|
41
41
|
for (let i = 0; i < numChildElements; i++) {
|
|
42
42
|
const blockOuter = tree.children[i] as HASTElement;
|
|
43
43
|
const blockContainer = blockOuter.children[0] as HASTElement;
|
|
44
|
-
const blockContent = blockContainer.children
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
const blockContent = blockContainer.children.find((child) => {
|
|
45
|
+
const properties = (child as HASTElement).properties;
|
|
46
|
+
const classNames = properties?.["className"] as string[] | undefined;
|
|
47
|
+
|
|
48
|
+
return classNames?.includes("bn-block-content");
|
|
49
|
+
}) as HASTElement | undefined;
|
|
50
|
+
const blockGroup = blockContainer.children.find((child) => {
|
|
51
|
+
const properties = (child as HASTElement).properties;
|
|
52
|
+
const classNames = properties?.["className"] as string[] | undefined;
|
|
53
|
+
|
|
54
|
+
return classNames?.includes("bn-block-group");
|
|
55
|
+
}) as HASTElement | undefined;
|
|
56
|
+
|
|
57
|
+
// When the selection starts in a nested block, the Fragment from it omits
|
|
58
|
+
// the `blockContent` node of the parent `blockContainer` if it's not also
|
|
59
|
+
// included in the selection. This is because ProseMirror preserves the
|
|
60
|
+
// nesting hierarchy of the nested nodes, even if their ancestors aren't
|
|
61
|
+
// fully selected. In this case, we just lift the child `blockContainer`
|
|
62
|
+
// nodes up.
|
|
63
|
+
// NOTE: This only happens for the first `blockContainer`, since to get to
|
|
64
|
+
// any nested blocks later in the document, the selection must also
|
|
65
|
+
// include their parents.
|
|
66
|
+
if (!blockContent) {
|
|
67
|
+
tree.children.splice(i, 1, ...blockGroup!.children);
|
|
68
|
+
simplifyBlocksHelper(tree);
|
|
69
|
+
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
49
72
|
|
|
50
73
|
const isListItemBlock = listItemBlockTypes.has(
|
|
51
74
|
blockContent.properties!["dataContentType"] as string
|
|
@@ -60,7 +83,7 @@ export function simplifyBlocks(options: SimplifyBlocksOptions) {
|
|
|
60
83
|
: null;
|
|
61
84
|
|
|
62
85
|
// Plugin runs recursively to process nested blocks.
|
|
63
|
-
if (blockGroup
|
|
86
|
+
if (blockGroup) {
|
|
64
87
|
simplifyBlocksHelper(blockGroup);
|
|
65
88
|
}
|
|
66
89
|
|
|
@@ -101,13 +124,13 @@ export function simplifyBlocks(options: SimplifyBlocksOptions) {
|
|
|
101
124
|
listItemElement.children.push(...blockContent.children);
|
|
102
125
|
// Nested blocks have already been processed in the recursive function call, so the resulting elements are
|
|
103
126
|
// also added to the active list.
|
|
104
|
-
if (blockGroup
|
|
127
|
+
if (blockGroup) {
|
|
105
128
|
listItemElement.children.push(...blockGroup.children);
|
|
106
129
|
}
|
|
107
130
|
|
|
108
131
|
// Adds the list item representing the block to the active list.
|
|
109
132
|
activeList.children.push(listItemElement);
|
|
110
|
-
} else if (blockGroup
|
|
133
|
+
} else if (blockGroup) {
|
|
111
134
|
// Lifts all children out of the current block, as only list items should allow nesting.
|
|
112
135
|
tree.children.splice(i + 1, 0, ...blockGroup.children);
|
|
113
136
|
// Replaces the block with only the content inside it.
|
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
import { Dictionary } from "../dictionary";
|
|
2
|
+
|
|
3
|
+
export const ru: Dictionary = {
|
|
4
|
+
slash_menu: {
|
|
5
|
+
heading: {
|
|
6
|
+
title: "Заголовок 1 уровня",
|
|
7
|
+
subtext: "Используется для заголовка верхнего уровня",
|
|
8
|
+
aliases: ["h", "heading1", "h1", "заголовок1"],
|
|
9
|
+
group: "Заголовки",
|
|
10
|
+
},
|
|
11
|
+
heading_2: {
|
|
12
|
+
title: "Заголовок 2 уровня",
|
|
13
|
+
subtext: "Используется для ключевых разделов",
|
|
14
|
+
aliases: ["h2", "heading2", "subheading", "заголовок2", "подзаголовок"],
|
|
15
|
+
group: "Заголовки",
|
|
16
|
+
},
|
|
17
|
+
heading_3: {
|
|
18
|
+
title: "Заголовок 3 уровня",
|
|
19
|
+
subtext: "Используется для подразделов и групп",
|
|
20
|
+
aliases: ["h3", "heading3", "subheading", "заголовок3", "подзаголовок"],
|
|
21
|
+
group: "Заголовки",
|
|
22
|
+
},
|
|
23
|
+
numbered_list: {
|
|
24
|
+
title: "Нумерованный список",
|
|
25
|
+
subtext: "Используется для отображения нумерованного списка",
|
|
26
|
+
aliases: [
|
|
27
|
+
"ol",
|
|
28
|
+
"li",
|
|
29
|
+
"list",
|
|
30
|
+
"numberedlist",
|
|
31
|
+
"numbered list",
|
|
32
|
+
"список",
|
|
33
|
+
"нумерованный список",
|
|
34
|
+
],
|
|
35
|
+
group: "Базовые блоки",
|
|
36
|
+
},
|
|
37
|
+
bullet_list: {
|
|
38
|
+
title: "Маркированный список",
|
|
39
|
+
subtext: "Для отображения неупорядоченного списка.",
|
|
40
|
+
aliases: ["ul", "li", "list", "bulletlist", "bullet list", "список", "маркированный список"],
|
|
41
|
+
group: "Базовые блоки",
|
|
42
|
+
},
|
|
43
|
+
check_list: {
|
|
44
|
+
title: "Контрольный список",
|
|
45
|
+
subtext: "Для отображения списка с флажками",
|
|
46
|
+
aliases: [
|
|
47
|
+
"ul",
|
|
48
|
+
"li",
|
|
49
|
+
"list",
|
|
50
|
+
"checklist",
|
|
51
|
+
"check list",
|
|
52
|
+
"checked list",
|
|
53
|
+
"checkbox",
|
|
54
|
+
"список",
|
|
55
|
+
],
|
|
56
|
+
group: "Базовые блоки",
|
|
57
|
+
},
|
|
58
|
+
paragraph: {
|
|
59
|
+
title: "Параграф",
|
|
60
|
+
subtext: "Основной текст",
|
|
61
|
+
aliases: ["p", "paragraph", "параграф"],
|
|
62
|
+
group: "Базовые блоки",
|
|
63
|
+
},
|
|
64
|
+
table: {
|
|
65
|
+
title: "Таблица",
|
|
66
|
+
subtext: "Используется для таблиц",
|
|
67
|
+
aliases: ["table", "таблица"],
|
|
68
|
+
group: "Продвинутый",
|
|
69
|
+
},
|
|
70
|
+
image: {
|
|
71
|
+
title: "Картинка",
|
|
72
|
+
subtext: "Вставить изображение",
|
|
73
|
+
aliases: [
|
|
74
|
+
"image",
|
|
75
|
+
"imageUpload",
|
|
76
|
+
"upload",
|
|
77
|
+
"img",
|
|
78
|
+
"picture",
|
|
79
|
+
"media",
|
|
80
|
+
"url",
|
|
81
|
+
"загрузка",
|
|
82
|
+
"картинка",
|
|
83
|
+
"рисунок",
|
|
84
|
+
],
|
|
85
|
+
group: "Медиа",
|
|
86
|
+
},
|
|
87
|
+
video: {
|
|
88
|
+
title: "Видео",
|
|
89
|
+
subtext: "Вставить видео",
|
|
90
|
+
aliases: [
|
|
91
|
+
"video",
|
|
92
|
+
"videoUpload",
|
|
93
|
+
"upload",
|
|
94
|
+
"mp4",
|
|
95
|
+
"film",
|
|
96
|
+
"media",
|
|
97
|
+
"url",
|
|
98
|
+
"загрузка",
|
|
99
|
+
"видео",
|
|
100
|
+
],
|
|
101
|
+
group: "Медиа",
|
|
102
|
+
},
|
|
103
|
+
audio: {
|
|
104
|
+
title: "Аудио",
|
|
105
|
+
subtext: "Вставить аудио",
|
|
106
|
+
aliases: [
|
|
107
|
+
"audio",
|
|
108
|
+
"audioUpload",
|
|
109
|
+
"upload",
|
|
110
|
+
"mp3",
|
|
111
|
+
"sound",
|
|
112
|
+
"media",
|
|
113
|
+
"url",
|
|
114
|
+
"загрузка",
|
|
115
|
+
"аудио",
|
|
116
|
+
"звук",
|
|
117
|
+
"музыка",
|
|
118
|
+
],
|
|
119
|
+
group: "Медиа",
|
|
120
|
+
},
|
|
121
|
+
file: {
|
|
122
|
+
title: "Файл",
|
|
123
|
+
subtext: "Вставить файл",
|
|
124
|
+
aliases: ["file", "upload", "embed", "media", "url", "загрузка", "файл"],
|
|
125
|
+
group: "Медиа",
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
placeholders: {
|
|
129
|
+
default: "Ведите текст или введите «/» для команд",
|
|
130
|
+
heading: "Заголовок",
|
|
131
|
+
bulletListItem: "Список",
|
|
132
|
+
numberedListItem: "Список",
|
|
133
|
+
checkListItem: "Список",
|
|
134
|
+
},
|
|
135
|
+
file_blocks: {
|
|
136
|
+
image: {
|
|
137
|
+
add_button_text: "Добавить изображение",
|
|
138
|
+
},
|
|
139
|
+
video: {
|
|
140
|
+
add_button_text: "Добавить видео",
|
|
141
|
+
},
|
|
142
|
+
audio: {
|
|
143
|
+
add_button_text: "Добавить аудио",
|
|
144
|
+
},
|
|
145
|
+
file: {
|
|
146
|
+
add_button_text: "Добавить файл",
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
// from react package:
|
|
150
|
+
side_menu: {
|
|
151
|
+
add_block_label: "Добавить блок",
|
|
152
|
+
drag_handle_label: "Открыть меню блока",
|
|
153
|
+
},
|
|
154
|
+
drag_handle: {
|
|
155
|
+
delete_menuitem: "Удалить",
|
|
156
|
+
colors_menuitem: "Цвета",
|
|
157
|
+
},
|
|
158
|
+
table_handle: {
|
|
159
|
+
delete_column_menuitem: "Удалить столбец",
|
|
160
|
+
delete_row_menuitem: "Удалить строку",
|
|
161
|
+
add_left_menuitem: "Добавить столбец слева",
|
|
162
|
+
add_right_menuitem: "Добавить столбец справа",
|
|
163
|
+
add_above_menuitem: "Добавить строку выше",
|
|
164
|
+
add_below_menuitem: "Добавить строку ниже",
|
|
165
|
+
},
|
|
166
|
+
suggestion_menu: {
|
|
167
|
+
no_items_title: "ничего не найдено",
|
|
168
|
+
loading: "Загрузка…",
|
|
169
|
+
},
|
|
170
|
+
color_picker: {
|
|
171
|
+
text_title: "Текст",
|
|
172
|
+
background_title: "Задний фон",
|
|
173
|
+
colors: {
|
|
174
|
+
default: "По умолчинию",
|
|
175
|
+
gray: "Серый",
|
|
176
|
+
brown: "Коричневый",
|
|
177
|
+
red: "Красный",
|
|
178
|
+
orange: "Оранжевый",
|
|
179
|
+
yellow: "Жёлтый",
|
|
180
|
+
green: "Зелёный",
|
|
181
|
+
blue: "Голубой",
|
|
182
|
+
purple: "Фиолетовый",
|
|
183
|
+
pink: "Розовый",
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
|
|
187
|
+
formatting_toolbar: {
|
|
188
|
+
bold: {
|
|
189
|
+
tooltip: "Жирный",
|
|
190
|
+
secondary_tooltip: "Mod+B",
|
|
191
|
+
},
|
|
192
|
+
italic: {
|
|
193
|
+
tooltip: "Курсив",
|
|
194
|
+
secondary_tooltip: "Mod+I",
|
|
195
|
+
},
|
|
196
|
+
underline: {
|
|
197
|
+
tooltip: "Подчёркнутый",
|
|
198
|
+
secondary_tooltip: "Mod+U",
|
|
199
|
+
},
|
|
200
|
+
strike: {
|
|
201
|
+
tooltip: "Зачёркнутый",
|
|
202
|
+
secondary_tooltip: "Mod+Shift+X",
|
|
203
|
+
},
|
|
204
|
+
code: {
|
|
205
|
+
tooltip: "Код",
|
|
206
|
+
secondary_tooltip: "",
|
|
207
|
+
},
|
|
208
|
+
colors: {
|
|
209
|
+
tooltip: "Цвета",
|
|
210
|
+
},
|
|
211
|
+
link: {
|
|
212
|
+
tooltip: "Создать ссылку",
|
|
213
|
+
secondary_tooltip: "Mod+K",
|
|
214
|
+
},
|
|
215
|
+
file_caption: {
|
|
216
|
+
tooltip: "Изменить подпись",
|
|
217
|
+
input_placeholder: "Изменить подпись",
|
|
218
|
+
},
|
|
219
|
+
file_replace: {
|
|
220
|
+
tooltip: {
|
|
221
|
+
image: "Заменить изображение",
|
|
222
|
+
video: "Заменить видео",
|
|
223
|
+
audio: "Заменить аудио",
|
|
224
|
+
file: "Заменить файл",
|
|
225
|
+
},
|
|
226
|
+
},
|
|
227
|
+
file_rename: {
|
|
228
|
+
tooltip: {
|
|
229
|
+
image: "Переименовать изображение",
|
|
230
|
+
video: "Переименовать видео",
|
|
231
|
+
audio: "Переименовать аудио",
|
|
232
|
+
file: "Переименовать файл",
|
|
233
|
+
},
|
|
234
|
+
input_placeholder: {
|
|
235
|
+
image: "Переименовать изображение",
|
|
236
|
+
video: "Переименовать видео",
|
|
237
|
+
audio: "Переименовать аудио",
|
|
238
|
+
file: "Переименовать файл",
|
|
239
|
+
},
|
|
240
|
+
},
|
|
241
|
+
file_download: {
|
|
242
|
+
tooltip: {
|
|
243
|
+
image: "Скачать картинку",
|
|
244
|
+
video: "Скачать видео",
|
|
245
|
+
audio: "Скачать аудио",
|
|
246
|
+
file: "Скачать файл",
|
|
247
|
+
},
|
|
248
|
+
},
|
|
249
|
+
file_delete: {
|
|
250
|
+
tooltip: {
|
|
251
|
+
image: "Удалить картинку",
|
|
252
|
+
video: "Удалить видео",
|
|
253
|
+
audio: "Удалить аудио",
|
|
254
|
+
file: "Скачать файл",
|
|
255
|
+
},
|
|
256
|
+
},
|
|
257
|
+
file_preview_toggle: {
|
|
258
|
+
tooltip: "Переключить предварительный просмотр",
|
|
259
|
+
},
|
|
260
|
+
nest: {
|
|
261
|
+
tooltip: "Сдвинуть вправо",
|
|
262
|
+
secondary_tooltip: "Tab",
|
|
263
|
+
},
|
|
264
|
+
unnest: {
|
|
265
|
+
tooltip: "Сдвинуть влево",
|
|
266
|
+
secondary_tooltip: "Shift+Tab",
|
|
267
|
+
},
|
|
268
|
+
align_left: {
|
|
269
|
+
tooltip: "Текст по левому краю",
|
|
270
|
+
},
|
|
271
|
+
align_center: {
|
|
272
|
+
tooltip: "Текст по середине",
|
|
273
|
+
},
|
|
274
|
+
align_right: {
|
|
275
|
+
tooltip: "Текст по правому краю",
|
|
276
|
+
},
|
|
277
|
+
align_justify: {
|
|
278
|
+
tooltip: "По середине текст",
|
|
279
|
+
},
|
|
280
|
+
},
|
|
281
|
+
file_panel: {
|
|
282
|
+
upload: {
|
|
283
|
+
title: "Загрузить",
|
|
284
|
+
file_placeholder: {
|
|
285
|
+
image: "Загрузить картинки",
|
|
286
|
+
video: "Загрузить видео",
|
|
287
|
+
audio: "Загрузить аудио",
|
|
288
|
+
file: "Загрузить файл",
|
|
289
|
+
},
|
|
290
|
+
upload_error: "Ошибка: не удалось загрузить",
|
|
291
|
+
},
|
|
292
|
+
embed: {
|
|
293
|
+
title: "Вставить",
|
|
294
|
+
embed_button: {
|
|
295
|
+
image: "Вставить картинку",
|
|
296
|
+
video: "Вставить видео",
|
|
297
|
+
audio: "Вставить аудио",
|
|
298
|
+
file: "Вставить файл",
|
|
299
|
+
},
|
|
300
|
+
url_placeholder: "Введите URL",
|
|
301
|
+
},
|
|
302
|
+
},
|
|
303
|
+
link_toolbar: {
|
|
304
|
+
delete: {
|
|
305
|
+
tooltip: "Удалить ссылку",
|
|
306
|
+
},
|
|
307
|
+
edit: {
|
|
308
|
+
text: "Изменить ссылку",
|
|
309
|
+
tooltip: "Редактировать",
|
|
310
|
+
},
|
|
311
|
+
open: {
|
|
312
|
+
tooltip: "Открыть в новой вкладке",
|
|
313
|
+
},
|
|
314
|
+
form: {
|
|
315
|
+
title_placeholder: "Изменить заголовок",
|
|
316
|
+
url_placeholder: "Изменить URL",
|
|
317
|
+
},
|
|
318
|
+
},
|
|
319
|
+
generic: {
|
|
320
|
+
ctrl_shortcut: "Ctrl",
|
|
321
|
+
},
|
|
322
|
+
};
|
|
323
|
+
|