@ixo/editor 6.30.1 → 6.30.2

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.
@@ -52374,7 +52374,7 @@ var GeneralTab18 = ({
52374
52374
  onHeightChange(v);
52375
52375
  }
52376
52376
  }
52377
- ), /* @__PURE__ */ React442.createElement(Stack323, { gap: "xs" }, /* @__PURE__ */ React442.createElement(Switch22, { label: "Allow authenticated embeds", checked: allowAuth, onChange: (event) => onAllowAuthChange(event.currentTarget.checked) }), /* @__PURE__ */ React442.createElement(Text305, { size: "xs", c: "dimmed" }, "Enable for services like Google Calendar that require cookie access. Only use with trusted URLs.")));
52377
+ ), /* @__PURE__ */ React442.createElement(Stack323, { gap: "xs" }, /* @__PURE__ */ React442.createElement(Switch22, { label: "Allow authenticated embeds", checked: allowAuth, onChange: (event) => onAllowAuthChange(event.currentTarget.checked) }), /* @__PURE__ */ React442.createElement(Text305, { size: "xs", c: "dimmed" }, "Enable for services like Google Calendar that require cookie access. Only use with trusted URLs. Origins your workspace administrator has marked as trusted are granted this automatically.")));
52378
52378
  };
52379
52379
 
52380
52380
  // src/mantine/blocks/embed/template/TemplateConfig.tsx
@@ -52415,6 +52415,8 @@ var TemplateConfig18 = ({ editor, block }) => {
52415
52415
 
52416
52416
  // src/mantine/blocks/embed/sanitizeUrl.ts
52417
52417
  var ALLOWED_PROTOCOLS = ["https:"];
52418
+ var BASE_EMBED_SANDBOX = ["allow-scripts", "allow-forms", "allow-popups"];
52419
+ var AUTHENTICATED_EMBED_SANDBOX = ["allow-same-origin", "allow-downloads"];
52418
52420
  function sanitizeEmbedUrl(raw) {
52419
52421
  if (!raw) return null;
52420
52422
  try {
@@ -52426,6 +52428,30 @@ function sanitizeEmbedUrl(raw) {
52426
52428
  }
52427
52429
  return null;
52428
52430
  }
52431
+ function buildEmbedSandbox(raw, allowAuth, trustedOrigins = []) {
52432
+ if (isImageUrl(raw)) return "";
52433
+ const sandbox = new Set(BASE_EMBED_SANDBOX);
52434
+ if ((allowAuth || isTrustedAppEmbedUrl(raw, trustedOrigins)) && !isHostOriginUrl(raw)) {
52435
+ AUTHENTICATED_EMBED_SANDBOX.forEach((permission) => sandbox.add(permission));
52436
+ }
52437
+ return Array.from(sandbox).join(" ");
52438
+ }
52439
+ function isHostOriginUrl(raw) {
52440
+ if (typeof window === "undefined") return false;
52441
+ try {
52442
+ return new URL(raw).origin === window.location.origin;
52443
+ } catch {
52444
+ return true;
52445
+ }
52446
+ }
52447
+ function isTrustedAppEmbedUrl(raw, trustedOrigins) {
52448
+ if (!trustedOrigins.length) return false;
52449
+ try {
52450
+ return trustedOrigins.includes(new URL(raw).origin);
52451
+ } catch {
52452
+ return false;
52453
+ }
52454
+ }
52429
52455
  var IMAGE_EXTENSIONS = /\.(png|jpe?g|gif|webp|svg|bmp|ico|avif)(\?.*)?$/i;
52430
52456
  function isImageUrl(url) {
52431
52457
  try {
@@ -52445,9 +52471,10 @@ var EmbedTemplateView = ({ editor, block }) => {
52445
52471
  const panelId = `${EMBED_TEMPLATE_PANEL_ID}-${block.id}`;
52446
52472
  const panelContent = useMemo179(() => /* @__PURE__ */ React444.createElement(TemplateConfig18, { editor, block }), [editor, block]);
52447
52473
  const { open } = usePanel(panelId, panelContent);
52474
+ const handlers = useBlocknoteHandlers();
52448
52475
  const safeUrl = sanitizeEmbedUrl(block.props.url);
52449
52476
  const height = Number(block.props.height) || 400;
52450
- const sandbox = block.props.allowAuth === "true" ? "allow-scripts allow-same-origin allow-forms allow-popups" : "allow-scripts allow-forms allow-popups";
52477
+ const sandbox = buildEmbedSandbox(safeUrl ?? "", block.props.allowAuth === "true", handlers?.getTrustedEmbedOrigins?.() ?? []);
52451
52478
  return /* @__PURE__ */ React444.createElement(BaseContainer, { blockId: block.id, onClick: open, style: { minHeight: 90, justifyContent: "center" } }, /* @__PURE__ */ React444.createElement(Stack324, { gap: "xs", justify: "center" }, /* @__PURE__ */ React444.createElement(Group182, { wrap: "nowrap", align: "center" }, getIcon("code", block.props.icon), /* @__PURE__ */ React444.createElement(Stack324, { gap: 2 }, /* @__PURE__ */ React444.createElement(Text306, { fw: 500, size: "sm", contentEditable: false }, block.props.title || "Embed"), /* @__PURE__ */ React444.createElement(Text306, { size: "xs", c: "dimmed", contentEditable: false, lineClamp: 1 }, block.props.description || safeUrl || "Click to configure"))), safeUrl && /* @__PURE__ */ React444.createElement(Box79, { style: { borderRadius: 8, overflow: "hidden" } }, /* @__PURE__ */ React444.createElement(
52452
52479
  "iframe",
52453
52480
  {
@@ -52511,9 +52538,10 @@ var EmbedFlowView = ({ editor, block }) => {
52511
52538
  const panelId = `${EMBED_FLOW_PANEL_ID}-${block.id}`;
52512
52539
  const panelContent = useMemo180(() => /* @__PURE__ */ React446.createElement(FlowConfig4, { editor, block }), [editor, block]);
52513
52540
  const { open } = usePanel(panelId, panelContent);
52541
+ const handlers = useBlocknoteHandlers();
52514
52542
  const safeUrl = sanitizeEmbedUrl(block.props.url);
52515
52543
  const height = Number(block.props.height) || 400;
52516
- const sandbox = block.props.allowAuth === "true" ? "allow-scripts allow-same-origin allow-forms allow-popups" : "allow-scripts allow-forms allow-popups";
52544
+ const sandbox = buildEmbedSandbox(safeUrl ?? "", block.props.allowAuth === "true", handlers?.getTrustedEmbedOrigins?.() ?? []);
52517
52545
  return /* @__PURE__ */ React446.createElement(BaseContainer, { blockId: block.id, onClick: open, style: { minHeight: 90, justifyContent: "center" } }, /* @__PURE__ */ React446.createElement(Stack325, { gap: "xs", justify: "center" }, /* @__PURE__ */ React446.createElement(Group183, { wrap: "nowrap", align: "center" }, getIcon("code", block.props.icon), /* @__PURE__ */ React446.createElement(Stack325, { gap: 2 }, /* @__PURE__ */ React446.createElement(Text307, { fw: 500, size: "sm", contentEditable: false }, block.props.title || "Embed"), /* @__PURE__ */ React446.createElement(Text307, { size: "xs", c: "dimmed", contentEditable: false, lineClamp: 1 }, block.props.description || safeUrl || "No URL configured"))), safeUrl && /* @__PURE__ */ React446.createElement(Box80, { style: { borderRadius: 8, overflow: "hidden" } }, /* @__PURE__ */ React446.createElement(
52518
52546
  "iframe",
52519
52547
  {
@@ -57841,4 +57869,4 @@ export {
57841
57869
  ixoGraphQLClient,
57842
57870
  getEntity
57843
57871
  };
57844
- //# sourceMappingURL=chunk-MJUVGIIR.js.map
57872
+ //# sourceMappingURL=chunk-2XPZAUWP.js.map