@pdfme/schemas 6.1.1-dev.14 → 6.1.1-dev.16

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
@@ -7,7 +7,7 @@ import { a as normalizeListItems, c as LIST_STYLE_BULLET, i as normalizeListItem
7
7
  import { n as substituteVariablesAsInlineMarkdownLiterals, r as validateVariables, t as substituteVariables } from "./helper-BJzBqIT4.js";
8
8
  import "./tables.js";
9
9
  import "./lists.js";
10
- import { DEFAULT_FONT_NAME, ZOOM, b64toUint8Array, getDefaultFont, getFallbackFontName, mm2pt, px2mm } from "@pdfme/common";
10
+ import { DEFAULT_FONT_NAME, ZOOM, b64toUint8Array, getDefaultFont, getFallbackFontName, getInternalLinkTarget, mm2pt, normalizeLinkHref, px2mm } from "@pdfme/common";
11
11
  import { Buffer as Buffer$1 } from "buffer";
12
12
  import { toRadians } from "@pdfme/pdf-lib";
13
13
  import { Barcode, Calendar, CalendarClock, ChevronDown, Circle, CircleDot, Clock, Image, List, Minus, QrCode, Route, Square, SquareCheck, Table, Type } from "lucide";
@@ -390,7 +390,7 @@ var renderSplitVariableSpans = (arg) => {
390
390
  });
391
391
  return;
392
392
  }
393
- const span = document.createElement("span");
393
+ const span = segment.run ? createStaticInlineMarkdownElement(segment.run) : document.createElement("span");
394
394
  span.style.letterSpacing = lineIndex === lineSegments.length - 1 ? "0" : "inherit";
395
395
  span.textContent = segment.text;
396
396
  if (segment.run) applyInlineMarkdownStyle({
@@ -558,6 +558,7 @@ var applyInlineMarkdownStyle = (arg) => {
558
558
  }
559
559
  if (resolvedFont.syntheticItalic) element.style.fontStyle = "italic";
560
560
  const textDecorations = [];
561
+ if (run.href) textDecorations.push("underline");
561
562
  if (run.strikethrough) textDecorations.push("line-through");
562
563
  if (textDecorations.length > 0) element.style.textDecoration = textDecorations.join(" ");
563
564
  if (run.code) {
@@ -567,10 +568,21 @@ var applyInlineMarkdownStyle = (arg) => {
567
568
  if (!schema.fontVariants?.code || !font[schema.fontVariants.code]) element.style.fontFamily = resolvedFont.fontName ? `'${resolvedFont.fontName}', monospace` : "monospace";
568
569
  }
569
570
  };
571
+ var createStaticInlineMarkdownElement = (run) => {
572
+ const href = run.href ? normalizeLinkHref(run.href) : void 0;
573
+ if (!href) return document.createElement("span");
574
+ const anchor = document.createElement("a");
575
+ anchor.href = href;
576
+ if (!getInternalLinkTarget(href)) {
577
+ anchor.target = "_blank";
578
+ anchor.rel = "noopener noreferrer";
579
+ }
580
+ return anchor;
581
+ };
570
582
  var appendTextSpan = (arg) => {
571
583
  const { textBlock, text, run, schema, font } = arg;
572
584
  if (!text) return;
573
- const span = document.createElement("span");
585
+ const span = createStaticInlineMarkdownElement(run);
574
586
  span.textContent = text;
575
587
  applyInlineMarkdownStyle({
576
588
  element: span,