@sendbird/actionbook-core 0.10.8 → 0.10.9

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/ui/index.js CHANGED
@@ -5833,7 +5833,7 @@ var END_ACTION_TEXTS = /* @__PURE__ */ new Set([
5833
5833
  function isEndActionTag(tagType, resourceId, text2) {
5834
5834
  return tagType === "handoff" || END_ACTION_RESOURCE_IDS.has(resourceId) || END_ACTION_TEXTS.has(text2.toLowerCase());
5835
5835
  }
5836
- function extractInlineItems(content, blockIndex) {
5836
+ function extractInlineItems(content, blockIndex, listItemPath = []) {
5837
5837
  const items = [];
5838
5838
  for (const node of content) {
5839
5839
  if (node.type === "jumpPoint") {
@@ -5850,22 +5850,26 @@ function extractInlineItems(content, blockIndex) {
5850
5850
  label: endAction ? `End ${node.text}` : node.text,
5851
5851
  blockIndex,
5852
5852
  children: [],
5853
- meta: { tagType: node.tagType, resourceId: node.resourceId }
5853
+ meta: {
5854
+ tagType: node.tagType,
5855
+ resourceId: node.resourceId,
5856
+ ...listItemPath.length > 0 && { listItemPath: [...listItemPath] }
5857
+ }
5854
5858
  });
5855
5859
  }
5856
5860
  }
5857
5861
  return items;
5858
5862
  }
5859
- function extractBlockItems(blocks, startIndex, depth) {
5863
+ function extractBlockItems(blocks, startIndex, depth, listItemPath = [], fixedBlockIndex) {
5860
5864
  if (depth > MAX_DEPTH6) return [];
5861
5865
  const items = [];
5862
5866
  for (let i = 0; i < blocks.length; i++) {
5863
5867
  const block = blocks[i];
5864
- const blockIndex = startIndex + i;
5868
+ const blockIndex = fixedBlockIndex ?? startIndex + i;
5865
5869
  switch (block.type) {
5866
5870
  case "heading": {
5867
5871
  const label = textContent(block) || `Heading ${block.level}`;
5868
- const inlineItems = extractInlineItems(block.content, blockIndex);
5872
+ const inlineItems = extractInlineItems(block.content, blockIndex, listItemPath);
5869
5873
  items.push({
5870
5874
  type: "heading",
5871
5875
  label,
@@ -5876,7 +5880,7 @@ function extractBlockItems(blocks, startIndex, depth) {
5876
5880
  break;
5877
5881
  }
5878
5882
  case "paragraph": {
5879
- const inlineItems = extractInlineItems(block.content, blockIndex);
5883
+ const inlineItems = extractInlineItems(block.content, blockIndex, listItemPath);
5880
5884
  items.push(...inlineItems);
5881
5885
  break;
5882
5886
  }
@@ -5912,14 +5916,15 @@ function extractBlockItems(blocks, startIndex, depth) {
5912
5916
  }
5913
5917
  case "bulletList":
5914
5918
  case "orderedList": {
5915
- for (const li of block.content) {
5916
- const childItems = extractBlockItems(li.content, blockIndex, depth + 1);
5919
+ for (let liIdx = 0; liIdx < block.content.length; liIdx++) {
5920
+ const li = block.content[liIdx];
5921
+ const childItems = extractBlockItems(li.content, blockIndex, depth + 1, [...listItemPath, liIdx], blockIndex);
5917
5922
  items.push(...childItems);
5918
5923
  }
5919
5924
  break;
5920
5925
  }
5921
5926
  case "blockquote": {
5922
- const childItems = extractBlockItems(block.content, blockIndex, depth + 1);
5927
+ const childItems = extractBlockItems(block.content, blockIndex, depth + 1, listItemPath, blockIndex);
5923
5928
  items.push(...childItems);
5924
5929
  break;
5925
5930
  }
@@ -7873,23 +7878,10 @@ function createLinkClickPlugin() {
7873
7878
  if (target.tagName !== "A") return false;
7874
7879
  const href = target.getAttribute("href");
7875
7880
  if (!href) return false;
7876
- if (href.startsWith("#")) {
7877
- event.preventDefault();
7878
- const targetId = `jp-${href.slice(1)}`;
7879
- const el = document.getElementById(targetId);
7880
- if (el) {
7881
- el.scrollIntoView({ block: "end" });
7882
- el.focus();
7883
- if (el.parentElement) {
7884
- el.parentElement.style.outline = "2px solid #6213cc";
7885
- setTimeout(() => {
7886
- el.parentElement.style.outline = "none";
7887
- }, 500);
7888
- }
7889
- }
7890
- return true;
7891
- }
7892
- return false;
7881
+ event.preventDefault();
7882
+ if (href.startsWith("#")) return true;
7883
+ window.open(href, "_blank", "noopener,noreferrer");
7884
+ return true;
7893
7885
  }
7894
7886
  }
7895
7887
  }