@ones-editor/editor 2.3.0-beta.1 → 2.3.0-beta.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/index.js CHANGED
@@ -80173,8 +80173,11 @@ ${docStr}
80173
80173
  }
80174
80174
  return toc.nodes[0].children.length === 0;
80175
80175
  }
80176
- function renderNodes(parent, nodes) {
80176
+ function renderNodes(parent, nodes, hiddenHeadings = /* @__PURE__ */ new Set()) {
80177
80177
  nodes.forEach((node) => {
80178
+ if (hiddenHeadings.has(node.block.id)) {
80179
+ return;
80180
+ }
80178
80181
  const content = createElement("div", ["toc-node"], parent);
80179
80182
  const title = createElement("div", ["toc-title"], content);
80180
80183
  const text2 = createElement("span", ["toc-text"], title, node.text);
@@ -80206,7 +80209,7 @@ ${docStr}
80206
80209
  });
80207
80210
  editor.selection.selectBlock(block, 0, void 0, { noScroll: true });
80208
80211
  }
80209
- function renderToc(editor, parent, toc) {
80212
+ function renderToc(editor, parent, toc, hiddenHeadings = /* @__PURE__ */ new Set()) {
80210
80213
  removeClass(parent, "loading");
80211
80214
  parent.innerHTML = "";
80212
80215
  if (isEmptyToc(editor, toc)) {
@@ -80215,11 +80218,11 @@ ${docStr}
80215
80218
  }
80216
80219
  const firstBlock = editor.findBlockById(toc.nodes[0].block.id);
80217
80220
  if (firstBlock && !isTitleBlock$2(firstBlock)) {
80218
- renderNodes(parent, toc.nodes);
80221
+ renderNodes(parent, toc.nodes, hiddenHeadings);
80219
80222
  } else if (toc.nodes.length >= 1) {
80220
80223
  const [first, ...rest] = toc.nodes;
80221
80224
  const contentNodes = [...first.children, ...rest];
80222
- renderNodes(parent, contentNodes);
80225
+ renderNodes(parent, contentNodes, hiddenHeadings);
80223
80226
  }
80224
80227
  editorRunOnce(editor, "toc-click-handler", () => {
80225
80228
  editor.addListener("click", handleClickToc);
@@ -80232,7 +80235,20 @@ ${docStr}
80232
80235
  blocks.forEach((block) => {
80233
80236
  const parent = block.querySelector(".editor-toc-container");
80234
80237
  if (parent) {
80235
- renderToc(editor, parent, toc);
80238
+ const blockData = editor.getBlockData(block);
80239
+ const embedData = blockData.embedData;
80240
+ const hiddenHeadingsCustomIds = new Set(embedData.hiddenHeadings || []);
80241
+ const hiddenHeadings = /* @__PURE__ */ new Set();
80242
+ toc.nodes.forEach((node) => {
80243
+ var _a;
80244
+ const text2 = node.block.text || [];
80245
+ const first = text2[0];
80246
+ const customId = (_a = first == null ? void 0 : first.attributes) == null ? void 0 : _a["custom-heading-id"];
80247
+ if (customId && hiddenHeadingsCustomIds.has(customId)) {
80248
+ hiddenHeadings.add(customId);
80249
+ }
80250
+ });
80251
+ renderToc(editor, parent, toc, hiddenHeadings);
80236
80252
  }
80237
80253
  });
80238
80254
  });
@@ -89653,7 +89669,7 @@ ${data2.flowchartText}
89653
89669
  }
89654
89670
  }
89655
89671
  });
89656
- editor.version = "2.3.0-beta.1";
89672
+ editor.version = "2.3.0-beta.3";
89657
89673
  return editor;
89658
89674
  }
89659
89675
  function isDoc(doc2) {
@@ -89767,7 +89783,7 @@ ${data2.flowchartText}
89767
89783
  }
89768
89784
  }
89769
89785
  OnesEditorToolbar.register(editor);
89770
- editor.version = "2.3.0-beta.1";
89786
+ editor.version = "2.3.0-beta.3";
89771
89787
  return editor;
89772
89788
  }
89773
89789
  async function showDocVersions(editor, options, serverUrl) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ones-editor/editor",
3
- "version": "2.3.0-beta.1",
3
+ "version": "2.3.0-beta.3",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",