@layers-app/editor-video 0.1.12 → 0.1.14

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
@@ -288,17 +288,20 @@ function isValidMediaUrl(url) {
288
288
  return false;
289
289
  }
290
290
  function insertVideoNode(editor, payload, createMediaComponent) {
291
- editor.update(() => {
292
- const videoNode = $createVideoNode(
293
- payload,
294
- "100%",
295
- "100%",
296
- "left",
297
- payload === "upload"
298
- );
299
- videoNode.setChaptersDisabled(true);
300
- createMediaComponent(videoNode);
301
- });
291
+ editor.update(
292
+ () => {
293
+ const videoNode = $createVideoNode(
294
+ payload,
295
+ "100%",
296
+ "100%",
297
+ "left",
298
+ payload === "upload"
299
+ );
300
+ videoNode.setChaptersDisabled(true);
301
+ createMediaComponent(videoNode);
302
+ },
303
+ { tag: "skip-scroll-into-view" }
304
+ );
302
305
  }
303
306
  function applyVideoSource(editor, nodeKey, { url, isLink = false, platformOverride, overrideId }) {
304
307
  const { platform, id } = platformOverride && overrideId ? { platform: platformOverride, id: overrideId } : parseVideoURL(url, isLink);
@@ -306,26 +309,32 @@ function applyVideoSource(editor, nodeKey, { url, isLink = false, platformOverri
306
309
  return false;
307
310
  }
308
311
  const resolvedId = id ?? "";
309
- editor.update(() => {
310
- const node = $getNodeByKey(nodeKey);
311
- if (!node || !$isVideoNode(node)) return;
312
- node.setPlatform(platform);
313
- node.setId(resolvedId);
314
- node.setUrl(url);
315
- node.setCreated(false);
316
- const nextSibling = node.getNextSibling();
317
- if (nextSibling) {
318
- $setSelection(nextSibling.selectNext());
319
- }
320
- });
312
+ editor.update(
313
+ () => {
314
+ const node = $getNodeByKey(nodeKey);
315
+ if (!node || !$isVideoNode(node)) return;
316
+ node.setPlatform(platform);
317
+ node.setId(resolvedId);
318
+ node.setUrl(url);
319
+ node.setCreated(false);
320
+ const nextSibling = node.getNextSibling();
321
+ if (nextSibling) {
322
+ $setSelection(nextSibling.selectNext());
323
+ }
324
+ },
325
+ { tag: "skip-scroll-into-view" }
326
+ );
321
327
  return true;
322
328
  }
323
329
  function setVideoSize(editor, nodeKey, width, height) {
324
- editor.update(() => {
325
- const node = $getNodeByKey(nodeKey);
326
- if (!node || !$isVideoNode(node)) return;
327
- node.setWidthAndHeight(width, height);
328
- });
330
+ editor.update(
331
+ () => {
332
+ const node = $getNodeByKey(nodeKey);
333
+ if (!node || !$isVideoNode(node)) return;
334
+ node.setWidthAndHeight(width, height);
335
+ },
336
+ { tag: "skip-scroll-into-view" }
337
+ );
329
338
  }
330
339
  function setVideoPoster(editor, nodeKey, posterUrl) {
331
340
  editor.update(
@@ -4468,7 +4477,6 @@ function VideoPlayerState({
4468
4477
  }, [onPlayerInfo, optimizedReady, hlsFailed, currentVideoUrl, currentNativeVideoUrl, activeVideoElement]);
4469
4478
  useEffect(() => {
4470
4479
  var _a;
4471
- console.log("[Cover] posterUrl effect:", posterUrl);
4472
4480
  const nativeVideo = nativeVideoRef.current;
4473
4481
  if (nativeVideo) {
4474
4482
  nativeVideo.poster = posterUrl || "";
@@ -5429,7 +5437,7 @@ function VideoUploadComponent({
5429
5437
  onStateChange == null ? void 0 : onStateChange(currentState);
5430
5438
  }, [currentState, onStateChange]);
5431
5439
  const renderState = () => {
5432
- var _a2, _b2;
5440
+ var _a2;
5433
5441
  if (sourceType === "link" && currentState !== "video-preview") {
5434
5442
  return /* @__PURE__ */ jsx(
5435
5443
  LinkState,
@@ -5523,7 +5531,6 @@ function VideoUploadComponent({
5523
5531
  ) });
5524
5532
  }
5525
5533
  const effectivePoster = posterUrl ?? ((_a2 = resolvedStatus == null ? void 0 : resolvedStatus.cover) == null ? void 0 : _a2.url) ?? null;
5526
- console.log("[Cover] VideoUploadComponent render: posterUrl prop=", posterUrl, "cover.url=", (_b2 = resolvedStatus == null ? void 0 : resolvedStatus.cover) == null ? void 0 : _b2.url, "effective=", effectivePoster);
5527
5534
  return /* @__PURE__ */ jsx(
5528
5535
  VideoPlayerState,
5529
5536
  {
@@ -6477,7 +6484,6 @@ function CoverSection({
6477
6484
  className: `video-settings-modal-cover-cell video-settings-modal-cover-thumb ${isSelected && !isError ? "selected" : ""} ${isLoading2 ? "loading" : ""} ${isError ? "error" : ""}`,
6478
6485
  onClick: () => {
6479
6486
  if (isError) return;
6480
- console.log("[Cover] click preview:", preview.id, preview.url);
6481
6487
  setSelectedPreviewId(preview.id);
6482
6488
  onSelectedPosterChange == null ? void 0 : onSelectedPosterChange(preview.url);
6483
6489
  },
@@ -7016,7 +7022,6 @@ function VideoSettingsModal({
7016
7022
  const saveSubtitlesRef = useRef(null);
7017
7023
  const [isSaving, setIsSaving] = useState(false);
7018
7024
  const handlePosterSelect = useCallback((url) => {
7019
- console.log("[Cover] handlePosterSelect:", url);
7020
7025
  setSelectedPosterUrl(url);
7021
7026
  }, []);
7022
7027
  useEffect(() => {
@@ -7059,12 +7064,8 @@ function VideoSettingsModal({
7059
7064
  await saveSubtitlesRef.current();
7060
7065
  }
7061
7066
  onSubtitlesSaved == null ? void 0 : onSubtitlesSaved(subtitlesSnapshot);
7062
- console.log("[Cover] handleSave: selectedPosterUrl=", selectedPosterUrl, "onPosterChange=", !!onPosterChange);
7063
7067
  if (selectedPosterUrl !== null) {
7064
- console.log("[Cover] calling onPosterChange with:", selectedPosterUrl);
7065
7068
  onPosterChange == null ? void 0 : onPosterChange(selectedPosterUrl);
7066
- } else {
7067
- console.log("[Cover] selectedPosterUrl is null, skipping onPosterChange");
7068
7069
  }
7069
7070
  if (videoId) {
7070
7071
  const updatedStatus = await fetchStatus(videoId);
@@ -7284,7 +7285,6 @@ function VideoBlock({
7284
7285
  };
7285
7286
  const handlePosterChange = useCallback(
7286
7287
  (posterUrl2) => {
7287
- console.log("[Cover] handlePosterChange: setting posterUrl=", posterUrl2);
7288
7288
  setPosterUrl(posterUrl2);
7289
7289
  setVideoPoster(editor, nodeKey, posterUrl2);
7290
7290
  },