@ones-editor/editor 5.0.6 → 5.0.7-beta.ONES22303077.1
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
|
@@ -29965,7 +29965,7 @@ var __publicField = (obj, key, value) => {
|
|
|
29965
29965
|
});
|
|
29966
29966
|
return true;
|
|
29967
29967
|
}
|
|
29968
|
-
function defaultGetResourceFromBlock(editor,
|
|
29968
|
+
function defaultGetResourceFromBlock(editor, block, resources) {
|
|
29969
29969
|
if (block.type === "embed") {
|
|
29970
29970
|
const embedData = block.embedData;
|
|
29971
29971
|
if (block.embedType === WIKI_MACRO_TYPE) {
|
|
@@ -30006,43 +30006,23 @@ var __publicField = (obj, key, value) => {
|
|
|
30006
30006
|
}
|
|
30007
30007
|
});
|
|
30008
30008
|
}
|
|
30009
|
-
|
|
30010
|
-
|
|
30011
|
-
|
|
30012
|
-
|
|
30013
|
-
|
|
30014
|
-
|
|
30015
|
-
|
|
30016
|
-
|
|
30009
|
+
}
|
|
30010
|
+
function getResourcesFromBlock(editor, doc2, block, resources) {
|
|
30011
|
+
var _a, _b;
|
|
30012
|
+
const blockClass = editor.editorBlocks.getBlockClass(block.type);
|
|
30013
|
+
const declaredResources = (_a = blockClass.getResources) == null ? void 0 : _a.call(blockClass, editor, block);
|
|
30014
|
+
if (declaredResources) {
|
|
30015
|
+
declaredResources.forEach((resource) => resources.add(resource));
|
|
30016
|
+
} else {
|
|
30017
|
+
defaultGetResourceFromBlock(editor, block, resources);
|
|
30017
30018
|
}
|
|
30019
|
+
(_b = block.children) == null ? void 0 : _b.forEach((containerId) => {
|
|
30020
|
+
doc2.blocks[containerId].forEach((child) => getResourcesFromBlock(editor, doc2, child, resources));
|
|
30021
|
+
});
|
|
30018
30022
|
}
|
|
30019
30023
|
function getAllResourcesFromDoc(editor, doc2) {
|
|
30020
30024
|
const resources = /* @__PURE__ */ new Set();
|
|
30021
|
-
|
|
30022
|
-
blocks.forEach((block) => {
|
|
30023
|
-
const blockClass = editor.editorBlocks.getBlockClass(block.type);
|
|
30024
|
-
if (blockClass.getResources) {
|
|
30025
|
-
const ret = blockClass.getResources(editor, block);
|
|
30026
|
-
if (ret) {
|
|
30027
|
-
ret.forEach((resource) => {
|
|
30028
|
-
resources.add(resource);
|
|
30029
|
-
});
|
|
30030
|
-
const children = block.children;
|
|
30031
|
-
if (children) {
|
|
30032
|
-
children.forEach((childContainerId) => {
|
|
30033
|
-
const blocks2 = doc2.blocks[childContainerId];
|
|
30034
|
-
blocks2.forEach((b) => {
|
|
30035
|
-
defaultGetResourceFromBlock(editor, doc2, b, resources);
|
|
30036
|
-
});
|
|
30037
|
-
});
|
|
30038
|
-
}
|
|
30039
|
-
} else {
|
|
30040
|
-
defaultGetResourceFromBlock(editor, doc2, block, resources);
|
|
30041
|
-
}
|
|
30042
|
-
} else {
|
|
30043
|
-
defaultGetResourceFromBlock(editor, doc2, block, resources);
|
|
30044
|
-
}
|
|
30045
|
-
});
|
|
30025
|
+
doc2.blocks.root.forEach((block) => getResourcesFromBlock(editor, doc2, block, resources));
|
|
30046
30026
|
return Array.from(resources);
|
|
30047
30027
|
}
|
|
30048
30028
|
function injectDocToHtmlFragment(htmlFragment, doc2) {
|
|
@@ -30355,8 +30335,14 @@ ${codeText}
|
|
|
30355
30335
|
}
|
|
30356
30336
|
return true;
|
|
30357
30337
|
}
|
|
30358
|
-
function defaultReplaceBlockResources(doc2, block, resources) {
|
|
30338
|
+
function defaultReplaceBlockResources(editor, doc2, block, resources) {
|
|
30339
|
+
var _a;
|
|
30359
30340
|
if (block.type === "embed") {
|
|
30341
|
+
const blockClass = editor.editorBlocks.getBlockClass(block.type);
|
|
30342
|
+
const declaredResources = (_a = blockClass.getResources) == null ? void 0 : _a.call(blockClass, editor, block);
|
|
30343
|
+
if (declaredResources && declaredResources.length === 0) {
|
|
30344
|
+
return;
|
|
30345
|
+
}
|
|
30360
30346
|
const embedData = block.embedData;
|
|
30361
30347
|
if (block.embedType === WIKI_MACRO_TYPE) {
|
|
30362
30348
|
replaceWikiMacroResources(embedData, resources);
|
|
@@ -30401,23 +30387,26 @@ ${codeText}
|
|
|
30401
30387
|
children.forEach((childContainerId) => {
|
|
30402
30388
|
const blocks = doc2.blocks[childContainerId];
|
|
30403
30389
|
blocks.forEach((b) => {
|
|
30404
|
-
|
|
30390
|
+
replaceBlockResources(editor, doc2, b, resources);
|
|
30405
30391
|
});
|
|
30406
30392
|
});
|
|
30407
30393
|
}
|
|
30408
30394
|
}
|
|
30395
|
+
function replaceBlockResources(editor, doc2, block, resources) {
|
|
30396
|
+
const blockClass = editor.editorBlocks.getBlockClass(block.type);
|
|
30397
|
+
if (blockClass.replaceResources) {
|
|
30398
|
+
blockClass.replaceResources(block, resources);
|
|
30399
|
+
} else {
|
|
30400
|
+
defaultReplaceBlockResources(editor, doc2, block, resources);
|
|
30401
|
+
}
|
|
30402
|
+
}
|
|
30409
30403
|
function replaceDocResources(editor, doc2, resources) {
|
|
30410
30404
|
if (resources.size === 0) {
|
|
30411
30405
|
return;
|
|
30412
30406
|
}
|
|
30413
30407
|
const blocks = doc2.blocks.root;
|
|
30414
30408
|
blocks.forEach((block) => {
|
|
30415
|
-
|
|
30416
|
-
if (blockClass.replaceResources) {
|
|
30417
|
-
blockClass.replaceResources(block, resources);
|
|
30418
|
-
} else {
|
|
30419
|
-
defaultReplaceBlockResources(doc2, block, resources);
|
|
30420
|
-
}
|
|
30409
|
+
replaceBlockResources(editor, doc2, block, resources);
|
|
30421
30410
|
});
|
|
30422
30411
|
}
|
|
30423
30412
|
async function addLocalResourcesToDoc(editor, resources) {
|
|
@@ -98055,7 +98044,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
98055
98044
|
}
|
|
98056
98045
|
}
|
|
98057
98046
|
});
|
|
98058
|
-
editor.version = "5.0.
|
|
98047
|
+
editor.version = "5.0.7-beta.ONES22303077.1";
|
|
98059
98048
|
return editor;
|
|
98060
98049
|
}
|
|
98061
98050
|
function isDoc(doc2) {
|
|
@@ -98191,7 +98180,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
98191
98180
|
OnesEditorDropTarget.register(editor);
|
|
98192
98181
|
OnesEditorTocProvider.register(editor);
|
|
98193
98182
|
OnesEditorExclusiveBlock.register(editor);
|
|
98194
|
-
editor.version = "5.0.
|
|
98183
|
+
editor.version = "5.0.7-beta.ONES22303077.1";
|
|
98195
98184
|
return editor;
|
|
98196
98185
|
} catch (error2) {
|
|
98197
98186
|
try {
|
|
@@ -98334,7 +98323,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
98334
98323
|
}
|
|
98335
98324
|
}
|
|
98336
98325
|
});
|
|
98337
|
-
editor.version = "5.0.
|
|
98326
|
+
editor.version = "5.0.7-beta.ONES22303077.1";
|
|
98338
98327
|
return editor;
|
|
98339
98328
|
}
|
|
98340
98329
|
const emojis$1 = {
|