@ones-editor/editor 3.1.6-beta.ONES22303077.1 → 3.1.6-beta.ONES22303077.2
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/index.js
CHANGED
|
@@ -29819,7 +29819,7 @@ var __publicField = (obj, key, value) => {
|
|
|
29819
29819
|
});
|
|
29820
29820
|
return true;
|
|
29821
29821
|
}
|
|
29822
|
-
function defaultGetResourceFromBlock(editor,
|
|
29822
|
+
function defaultGetResourceFromBlock(editor, block, resources) {
|
|
29823
29823
|
if (block.type === "embed") {
|
|
29824
29824
|
const embedData = block.embedData;
|
|
29825
29825
|
const src = embedData.src;
|
|
@@ -29856,43 +29856,23 @@ var __publicField = (obj, key, value) => {
|
|
|
29856
29856
|
}
|
|
29857
29857
|
});
|
|
29858
29858
|
}
|
|
29859
|
-
|
|
29860
|
-
|
|
29861
|
-
|
|
29862
|
-
|
|
29863
|
-
|
|
29864
|
-
|
|
29865
|
-
|
|
29866
|
-
|
|
29859
|
+
}
|
|
29860
|
+
function getResourcesFromBlock(editor, doc2, block, resources) {
|
|
29861
|
+
var _a, _b;
|
|
29862
|
+
const blockClass = editor.editorBlocks.getBlockClass(block.type);
|
|
29863
|
+
const declaredResources = (_a = blockClass.getResources) == null ? void 0 : _a.call(blockClass, editor, block);
|
|
29864
|
+
if (declaredResources) {
|
|
29865
|
+
declaredResources.forEach((resource) => resources.add(resource));
|
|
29866
|
+
} else {
|
|
29867
|
+
defaultGetResourceFromBlock(editor, block, resources);
|
|
29867
29868
|
}
|
|
29869
|
+
(_b = block.children) == null ? void 0 : _b.forEach((containerId) => {
|
|
29870
|
+
doc2.blocks[containerId].forEach((child) => getResourcesFromBlock(editor, doc2, child, resources));
|
|
29871
|
+
});
|
|
29868
29872
|
}
|
|
29869
29873
|
function getAllResourcesFromDoc(editor, doc2) {
|
|
29870
29874
|
const resources = /* @__PURE__ */ new Set();
|
|
29871
|
-
|
|
29872
|
-
blocks.forEach((block) => {
|
|
29873
|
-
const blockClass = editor.editorBlocks.getBlockClass(block.type);
|
|
29874
|
-
if (blockClass.getResources) {
|
|
29875
|
-
const ret = blockClass.getResources(editor, block);
|
|
29876
|
-
if (ret) {
|
|
29877
|
-
ret.forEach((resource) => {
|
|
29878
|
-
resources.add(resource);
|
|
29879
|
-
});
|
|
29880
|
-
const children = block.children;
|
|
29881
|
-
if (children) {
|
|
29882
|
-
children.forEach((childContainerId) => {
|
|
29883
|
-
const blocks2 = doc2.blocks[childContainerId];
|
|
29884
|
-
blocks2.forEach((b) => {
|
|
29885
|
-
defaultGetResourceFromBlock(editor, doc2, b, resources);
|
|
29886
|
-
});
|
|
29887
|
-
});
|
|
29888
|
-
}
|
|
29889
|
-
} else {
|
|
29890
|
-
defaultGetResourceFromBlock(editor, doc2, block, resources);
|
|
29891
|
-
}
|
|
29892
|
-
} else {
|
|
29893
|
-
defaultGetResourceFromBlock(editor, doc2, block, resources);
|
|
29894
|
-
}
|
|
29895
|
-
});
|
|
29875
|
+
doc2.blocks.root.forEach((block) => getResourcesFromBlock(editor, doc2, block, resources));
|
|
29896
29876
|
return Array.from(resources);
|
|
29897
29877
|
}
|
|
29898
29878
|
function injectDocToHtmlFragment(htmlFragment, doc2) {
|
|
@@ -30205,8 +30185,14 @@ ${codeText}
|
|
|
30205
30185
|
}
|
|
30206
30186
|
return true;
|
|
30207
30187
|
}
|
|
30208
|
-
function defaultReplaceBlockResources(doc2, block, resources) {
|
|
30188
|
+
function defaultReplaceBlockResources(editor, doc2, block, resources) {
|
|
30189
|
+
var _a;
|
|
30209
30190
|
if (block.type === "embed") {
|
|
30191
|
+
const blockClass = editor.editorBlocks.getBlockClass(block.type);
|
|
30192
|
+
const declaredResources = (_a = blockClass.getResources) == null ? void 0 : _a.call(blockClass, editor, block);
|
|
30193
|
+
if (declaredResources && declaredResources.length === 0) {
|
|
30194
|
+
return;
|
|
30195
|
+
}
|
|
30210
30196
|
const embedData = block.embedData;
|
|
30211
30197
|
const src = embedData.src;
|
|
30212
30198
|
if (src && typeof src === "string") {
|
|
@@ -30247,23 +30233,26 @@ ${codeText}
|
|
|
30247
30233
|
children.forEach((childContainerId) => {
|
|
30248
30234
|
const blocks = doc2.blocks[childContainerId];
|
|
30249
30235
|
blocks.forEach((b) => {
|
|
30250
|
-
|
|
30236
|
+
replaceBlockResources(editor, doc2, b, resources);
|
|
30251
30237
|
});
|
|
30252
30238
|
});
|
|
30253
30239
|
}
|
|
30254
30240
|
}
|
|
30241
|
+
function replaceBlockResources(editor, doc2, block, resources) {
|
|
30242
|
+
const blockClass = editor.editorBlocks.getBlockClass(block.type);
|
|
30243
|
+
if (blockClass.replaceResources) {
|
|
30244
|
+
blockClass.replaceResources(block, resources);
|
|
30245
|
+
} else {
|
|
30246
|
+
defaultReplaceBlockResources(editor, doc2, block, resources);
|
|
30247
|
+
}
|
|
30248
|
+
}
|
|
30255
30249
|
function replaceDocResources(editor, doc2, resources) {
|
|
30256
30250
|
if (resources.size === 0) {
|
|
30257
30251
|
return;
|
|
30258
30252
|
}
|
|
30259
30253
|
const blocks = doc2.blocks.root;
|
|
30260
30254
|
blocks.forEach((block) => {
|
|
30261
|
-
|
|
30262
|
-
if (blockClass.replaceResources) {
|
|
30263
|
-
blockClass.replaceResources(block, resources);
|
|
30264
|
-
} else {
|
|
30265
|
-
defaultReplaceBlockResources(doc2, block, resources);
|
|
30266
|
-
}
|
|
30255
|
+
replaceBlockResources(editor, doc2, block, resources);
|
|
30267
30256
|
});
|
|
30268
30257
|
}
|
|
30269
30258
|
async function addLocalResourcesToDoc(editor, resources) {
|
|
@@ -97398,7 +97387,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
97398
97387
|
}
|
|
97399
97388
|
}
|
|
97400
97389
|
});
|
|
97401
|
-
editor.version = "3.1.6-beta.ONES22303077.
|
|
97390
|
+
editor.version = "3.1.6-beta.ONES22303077.2";
|
|
97402
97391
|
return editor;
|
|
97403
97392
|
}
|
|
97404
97393
|
function isDoc(doc2) {
|
|
@@ -97539,7 +97528,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
97539
97528
|
OnesEditorDropTarget.register(editor);
|
|
97540
97529
|
OnesEditorTocProvider.register(editor);
|
|
97541
97530
|
OnesEditorExclusiveBlock.register(editor);
|
|
97542
|
-
editor.version = "3.1.6-beta.ONES22303077.
|
|
97531
|
+
editor.version = "3.1.6-beta.ONES22303077.2";
|
|
97543
97532
|
return editor;
|
|
97544
97533
|
} catch (error2) {
|
|
97545
97534
|
if (editorForCleanup) {
|