@superdoc/sdk 2.17.1-next.9 → 2.18.0-next.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.
@@ -619,11 +619,17 @@ function withChangeModeOption(invokeOptions, changeMode) {
619
619
  }
620
620
  async function createCopiedSectionBlock(input) {
621
621
  const text = textOfListedBlock(input.block);
622
+ // SD-4886: forward the source block's own styleId so a copied block keeps
623
+ // its source-accurate style instead of falling back to anchor-based
624
+ // inheritance (which may pick up an unrelated neighboring style at the
625
+ // destination position).
626
+ const styleId = input.block.styleId ?? undefined;
622
627
  if (input.block.nodeType === 'heading') {
623
628
  const result = await input.context.documentHandle.create.heading({
624
629
  text,
625
630
  level: headingLevelForCopiedBlock(input.block),
626
631
  at: input.at,
632
+ ...(styleId ? { styleId } : {}),
627
633
  }, withChangeModeOption(input.context.invokeOptions, input.changeMode));
628
634
  return {
629
635
  nodeId: result.heading.nodeId,
@@ -633,6 +639,7 @@ async function createCopiedSectionBlock(input) {
633
639
  const result = await input.context.documentHandle.create.paragraph({
634
640
  text,
635
641
  at: input.at,
642
+ ...(styleId ? { styleId } : {}),
636
643
  }, withChangeModeOption(input.context.invokeOptions, input.changeMode));
637
644
  return {
638
645
  nodeId: result.paragraph.nodeId,
@@ -616,11 +616,17 @@ function withChangeModeOption(invokeOptions, changeMode) {
616
616
  }
617
617
  async function createCopiedSectionBlock(input) {
618
618
  const text = textOfListedBlock(input.block);
619
+ // SD-4886: forward the source block's own styleId so a copied block keeps
620
+ // its source-accurate style instead of falling back to anchor-based
621
+ // inheritance (which may pick up an unrelated neighboring style at the
622
+ // destination position).
623
+ const styleId = input.block.styleId ?? undefined;
619
624
  if (input.block.nodeType === 'heading') {
620
625
  const result = await input.context.documentHandle.create.heading({
621
626
  text,
622
627
  level: headingLevelForCopiedBlock(input.block),
623
628
  at: input.at,
629
+ ...(styleId ? { styleId } : {}),
624
630
  }, withChangeModeOption(input.context.invokeOptions, input.changeMode));
625
631
  return {
626
632
  nodeId: result.heading.nodeId,
@@ -630,6 +636,7 @@ async function createCopiedSectionBlock(input) {
630
636
  const result = await input.context.documentHandle.create.paragraph({
631
637
  text,
632
638
  at: input.at,
639
+ ...(styleId ? { styleId } : {}),
633
640
  }, withChangeModeOption(input.context.invokeOptions, input.changeMode));
634
641
  return {
635
642
  nodeId: result.paragraph.nodeId,