hfviewer automation commited on
Commit
8ef4265
·
1 Parent(s): 322e68f

Sync private Space from hfviewer-f11fce5fbf33

Browse files
Files changed (2) hide show
  1. index.html +2 -2
  2. space-shell.js +8 -0
index.html CHANGED
@@ -183,7 +183,7 @@
183
  window.HFVIEWER_PRODUCT_CONTEXT = Object.freeze({
184
  product_surface: "hf_space",
185
  space_repo: "embedl/hfviewer",
186
- space_revision: "hfviewer-357a8f23da04",
187
  });
188
  try {
189
  var initialUrl = new URL(window.location.href);
@@ -10162,7 +10162,7 @@ body.sx-viewer-open { overflow: hidden; }
10162
  window.hfviewerAnalyticsBridge?.capture?.(eventName, Object.assign({
10163
  product_surface: "hf_space",
10164
  space_repo: "embedl/hfviewer",
10165
- space_revision: "hfviewer-357a8f23da04",
10166
  }, properties || {}));
10167
  } catch (error) { /* analytics must never break navigation */ }
10168
  }
 
183
  window.HFVIEWER_PRODUCT_CONTEXT = Object.freeze({
184
  product_surface: "hf_space",
185
  space_repo: "embedl/hfviewer",
186
+ space_revision: "hfviewer-f11fce5fbf33",
187
  });
188
  try {
189
  var initialUrl = new URL(window.location.href);
 
10162
  window.hfviewerAnalyticsBridge?.capture?.(eventName, Object.assign({
10163
  product_surface: "hf_space",
10164
  space_repo: "embedl/hfviewer",
10165
+ space_revision: "hfviewer-f11fce5fbf33",
10166
  }, properties || {}));
10167
  } catch (error) { /* analytics must never break navigation */ }
10168
  }
space-shell.js CHANGED
@@ -430,6 +430,11 @@
430
  actions.id = "sx-model-actions";
431
  actions.className = "sx-model-actions";
432
  var embedAction = compactAction("embed", "Embed", '<svg viewBox="0 0 24 24" aria-hidden="true"><rect x="8" y="8" width="12" height="12" rx="2"/><path d="M4 16H3a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v1"/></svg>', "Embed on model card");
 
 
 
 
 
433
  var editReadmeAction = compactAction("edit-readme", "Edit README.md", COMPACT_EDIT_ICON, "Go to edit page", { link: true });
434
  editReadmeAction.hidden = true;
435
  actions.append(
@@ -633,6 +638,9 @@
633
  if (!button) return;
634
  var actionState = state.actions?.[name] || {};
635
  button.hidden = pageMode !== "model" || actionState.visible === false;
 
 
 
636
  if (name === "bookmark") {
637
  if (
638
  window.hfviewerSpaceAuth?.isAuthenticated?.() &&
 
430
  actions.id = "sx-model-actions";
431
  actions.className = "sx-model-actions";
432
  var embedAction = compactAction("embed", "Embed", '<svg viewBox="0 0 24 24" aria-hidden="true"><rect x="8" y="8" width="12" height="12" rx="2"/><path d="M4 16H3a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v1"/></svg>', "Embed on model card");
433
+ // The compact controls are installed before the viewer has posted its
434
+ // model-specific header state. Do not accept an Embed click during that
435
+ // short gap: the compatibility fallback crosses an iframe boundary and
436
+ // therefore cannot retain clipboard user activation.
437
+ embedAction.disabled = true;
438
  var editReadmeAction = compactAction("edit-readme", "Edit README.md", COMPACT_EDIT_ICON, "Go to edit page", { link: true });
439
  editReadmeAction.hidden = true;
440
  actions.append(
 
638
  if (!button) return;
639
  var actionState = state.actions?.[name] || {};
640
  button.hidden = pageMode !== "model" || actionState.visible === false;
641
+ if (name === "embed") {
642
+ button.disabled = !String(actionState.snippet || "");
643
+ }
644
  if (name === "bookmark") {
645
  if (
646
  window.hfviewerSpaceAuth?.isAuthenticated?.() &&