@layers-app/editor-video 0.1.13 → 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
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
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
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
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
|
-
|
|
326
|
-
|
|
327
|
-
|
|
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(
|
|
@@ -6475,7 +6484,6 @@ function CoverSection({
|
|
|
6475
6484
|
className: `video-settings-modal-cover-cell video-settings-modal-cover-thumb ${isSelected && !isError ? "selected" : ""} ${isLoading2 ? "loading" : ""} ${isError ? "error" : ""}`,
|
|
6476
6485
|
onClick: () => {
|
|
6477
6486
|
if (isError) return;
|
|
6478
|
-
console.log("[Cover] click preview:", preview.id, preview.url);
|
|
6479
6487
|
setSelectedPreviewId(preview.id);
|
|
6480
6488
|
onSelectedPosterChange == null ? void 0 : onSelectedPosterChange(preview.url);
|
|
6481
6489
|
},
|
|
@@ -7014,7 +7022,6 @@ function VideoSettingsModal({
|
|
|
7014
7022
|
const saveSubtitlesRef = useRef(null);
|
|
7015
7023
|
const [isSaving, setIsSaving] = useState(false);
|
|
7016
7024
|
const handlePosterSelect = useCallback((url) => {
|
|
7017
|
-
console.log("[Cover] handlePosterSelect:", url);
|
|
7018
7025
|
setSelectedPosterUrl(url);
|
|
7019
7026
|
}, []);
|
|
7020
7027
|
useEffect(() => {
|
|
@@ -7057,12 +7064,8 @@ function VideoSettingsModal({
|
|
|
7057
7064
|
await saveSubtitlesRef.current();
|
|
7058
7065
|
}
|
|
7059
7066
|
onSubtitlesSaved == null ? void 0 : onSubtitlesSaved(subtitlesSnapshot);
|
|
7060
|
-
console.log("[Cover] handleSave: selectedPosterUrl=", selectedPosterUrl, "onPosterChange=", !!onPosterChange);
|
|
7061
7067
|
if (selectedPosterUrl !== null) {
|
|
7062
|
-
console.log("[Cover] calling onPosterChange with:", selectedPosterUrl);
|
|
7063
7068
|
onPosterChange == null ? void 0 : onPosterChange(selectedPosterUrl);
|
|
7064
|
-
} else {
|
|
7065
|
-
console.log("[Cover] selectedPosterUrl is null, skipping onPosterChange");
|
|
7066
7069
|
}
|
|
7067
7070
|
if (videoId) {
|
|
7068
7071
|
const updatedStatus = await fetchStatus(videoId);
|