@remotion/studio 4.0.501 → 4.0.503
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/components/AssetSelectorItem.js +4 -4
- package/dist/components/Canvas.js +37 -57
- package/dist/components/ColorPicker/AlphaSlider.js +14 -10
- package/dist/components/ColorPicker/HueSlider.js +14 -10
- package/dist/components/ColorPicker/SaturationValueArea.js +14 -12
- package/dist/components/CompositionContextButton.js +1 -1
- package/dist/components/CompositionSelector.js +4 -4
- package/dist/components/CompositionSelectorItem.js +5 -5
- package/dist/components/ConfigureDefaultEditorModal.d.ts +2 -0
- package/dist/components/ConfigureDefaultEditorModal.js +151 -0
- package/dist/components/ConfirmationDialog.js +6 -3
- package/dist/components/ContextMenu.js +0 -2
- package/dist/components/Editor.js +1 -4
- package/dist/components/EditorContent.js +1 -1
- package/dist/components/EditorGuides/Guide.js +48 -74
- package/dist/components/EditorRuler/Ruler.d.ts +1 -0
- package/dist/components/EditorRuler/Ruler.js +3 -1
- package/dist/components/EditorRuler/index.js +26 -23
- package/dist/components/ElementInstallConfirmation.d.ts +12 -0
- package/dist/components/ElementInstallConfirmation.js +205 -0
- package/dist/components/ForceSpecificCursor.js +14 -0
- package/dist/components/FullscreenToggle.d.ts +3 -1
- package/dist/components/FullscreenToggle.js +2 -2
- package/dist/components/InlineAction.d.ts +2 -1
- package/dist/components/InlineAction.js +4 -4
- package/dist/components/InspectorLocationCopy.d.ts +1 -0
- package/dist/components/InspectorLocationCopy.js +7 -3
- package/dist/components/InspectorOpenInEditor.d.ts +5 -0
- package/dist/components/InspectorOpenInEditor.js +135 -0
- package/dist/components/InspectorPanel/AlignmentControls.js +1 -1
- package/dist/components/InspectorPanel/CompositionInspectorHeader.js +3 -3
- package/dist/components/InspectorPanel/CompositionMetadata.js +1 -1
- package/dist/components/InspectorPanel/KeyframeEasingNavigator.js +2 -2
- package/dist/components/InspectorPanel/SequenceInspectorHeader.js +2 -2
- package/dist/components/InspectorPanel/use-composition-actions.d.ts +1 -1
- package/dist/components/InspectorPanel/use-composition-actions.js +46 -3
- package/dist/components/InspectorSequenceSection.js +2 -2
- package/dist/components/LoopToggle.d.ts +1 -0
- package/dist/components/LoopToggle.js +9 -5
- package/dist/components/Menu/MenuItem.js +13 -6
- package/dist/components/Menu/MenuSubItem.js +11 -1
- package/dist/components/MenuBuildIndicator.js +1 -1
- package/dist/components/MenuCompositionName.js +1 -1
- package/dist/components/MobilePanel.js +5 -1
- package/dist/components/ModalContainer.js +1 -1
- package/dist/components/ModalFooter.d.ts +1 -0
- package/dist/components/ModalFooter.js +2 -2
- package/dist/components/Modals.js +11 -2
- package/dist/components/NewComposition/InputDragger.js +19 -29
- package/dist/components/ObserveDefaultPropsContext.js +7 -4
- package/dist/components/PlayPause.d.ts +1 -0
- package/dist/components/PlayPause.js +2 -4
- package/dist/components/PlaybackRateSelector.d.ts +9 -2
- package/dist/components/PlaybackRateSelector.js +21 -10
- package/dist/components/PreviewToolbar.js +19 -109
- package/dist/components/PreviewToolbarOverflowButton.d.ts +12 -0
- package/dist/components/PreviewToolbarOverflowButton.js +217 -0
- package/dist/components/QuickSwitcher/QuickSwitcher.d.ts +1 -0
- package/dist/components/QuickSwitcher/QuickSwitcherContent.d.ts +1 -0
- package/dist/components/QuickSwitcher/QuickSwitcherContent.js +16 -1
- package/dist/components/QuickSwitcher/QuickSwitcherResult.d.ts +2 -0
- package/dist/components/QuickSwitcher/QuickSwitcherResult.js +7 -1
- package/dist/components/RenderButton.d.ts +1 -0
- package/dist/components/RenderButton.js +6 -4
- package/dist/components/RenderModal/InlineEyeIcon.js +1 -1
- package/dist/components/RenderModal/InlineRemoveButton.js +1 -1
- package/dist/components/RenderModal/RenderModalOutputName.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/SchemaResetButton.js +1 -1
- package/dist/components/RenderQueue/RenderQueueCopyToClipboard.js +1 -1
- package/dist/components/RenderQueue/RenderQueueDownloadItem.js +1 -1
- package/dist/components/RenderQueue/RenderQueueItemCancelButton.js +1 -1
- package/dist/components/RenderQueue/RenderQueueOpenInFolder.js +1 -1
- package/dist/components/RenderQueue/RenderQueueRemoveItem.js +1 -1
- package/dist/components/RenderQueue/RenderQueueRepeat.js +1 -1
- package/dist/components/SelectedOutlineCropControls.js +7 -6
- package/dist/components/SelectedOutlineElement.js +28 -26
- package/dist/components/SelectedOutlineUvControls.js +25 -24
- package/dist/components/ShowGuidesProvider.js +2 -0
- package/dist/components/SidebarCollapserControls.js +2 -2
- package/dist/components/SidebarRenderButton.js +1 -1
- package/dist/components/SizeSelector.d.ts +6 -0
- package/dist/components/SizeSelector.js +17 -8
- package/dist/components/Splitter/SplitterContainer.d.ts +1 -0
- package/dist/components/Splitter/SplitterContainer.js +23 -3
- package/dist/components/Splitter/SplitterContext.d.ts +14 -0
- package/dist/components/Splitter/SplitterContext.js +16 -1
- package/dist/components/Splitter/SplitterHandle.js +25 -74
- package/dist/components/Timeline/EasingEditorModal.js +27 -19
- package/dist/components/Timeline/Timeline.js +2 -1
- package/dist/components/Timeline/TimelineAssetField.d.ts +1 -1
- package/dist/components/Timeline/TimelineAssetField.js +37 -2
- package/dist/components/Timeline/TimelineDragHandler.js +39 -8
- package/dist/components/Timeline/TimelineInOutDragHandler.js +26 -11
- package/dist/components/Timeline/TimelineLayerEye.js +36 -4
- package/dist/components/Timeline/TimelineSelection.js +14 -21
- package/dist/components/Timeline/TimelineSequence.js +7 -3
- package/dist/components/Timeline/TimelineSequenceItem.js +24 -18
- package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.d.ts +1 -1
- package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +76 -43
- package/dist/components/Timeline/TimelineStack/get-stack.js +13 -0
- package/dist/components/Timeline/get-sequence-context-menu-items.d.ts +4 -2
- package/dist/components/Timeline/get-sequence-context-menu-items.js +38 -2
- package/dist/components/Timeline/save-sequence-prop.js +4 -4
- package/dist/components/Timeline/sequence-props-subscription-store.d.ts +2 -2
- package/dist/components/Timeline/sequence-props-subscription-store.js +3 -3
- package/dist/components/Timeline/should-subscribe-to-source-file.d.ts +1 -0
- package/dist/components/Timeline/should-subscribe-to-source-file.js +11 -0
- package/dist/components/Timeline/use-open-sequence-in-editor.d.ts +3 -1
- package/dist/components/Timeline/use-open-sequence-in-editor.js +5 -2
- package/dist/components/Timeline/use-sequence-props-subscription.js +2 -0
- package/dist/components/Timeline/use-timeline-asset-drop.js +0 -4
- package/dist/components/Timeline/use-timeline-keyframe-drag.js +31 -16
- package/dist/components/TopPanel.js +1 -1
- package/dist/components/UndoRedoButtons.js +1 -1
- package/dist/components/UpdateCheck.d.ts +2 -0
- package/dist/components/UpdateCheck.js +20 -8
- package/dist/components/UpdateModal/UpdateModal.js +26 -10
- package/dist/components/VisualControls/ClickableFileName.js +5 -2
- package/dist/components/composition-menu-items.js +1 -1
- package/dist/components/default-props-api.d.ts +3 -0
- package/dist/components/default-props-api.js +19 -0
- package/dist/components/drop-handler-data.d.ts +1 -1
- package/dist/components/drop-handler-data.js +6 -6
- package/dist/components/effect-drag-and-drop.d.ts +1 -1
- package/dist/components/effect-drag-and-drop.js +3 -3
- package/dist/components/element-drag-and-drop.d.ts +1 -1
- package/dist/components/element-drag-and-drop.js +3 -3
- package/dist/components/element-install-request.d.ts +3 -0
- package/dist/components/element-install-request.js +17 -0
- package/dist/components/folder-menu-items.js +1 -1
- package/dist/components/handle-drop.d.ts +2 -3
- package/dist/components/handle-drop.js +11 -4
- package/dist/components/import-assets.d.ts +9 -9
- package/dist/components/import-assets.js +4 -15
- package/dist/components/sequence-props-api.d.ts +4 -0
- package/dist/components/sequence-props-api.js +26 -0
- package/dist/components/use-default-editor-info.d.ts +4 -0
- package/dist/components/use-default-editor-info.js +47 -0
- package/dist/error-overlay/remotion-overlay/ErrorDisplay.d.ts +1 -0
- package/dist/error-overlay/remotion-overlay/ErrorDisplay.js +29 -5
- package/dist/error-overlay/remotion-overlay/ErrorLoader.js +4 -20
- package/dist/error-overlay/remotion-overlay/OpenInEditor.js +1 -1
- package/dist/error-overlay/remotion-overlay/StackFrame.js +1 -1
- package/dist/esm/{chunk-n1kj09yv.js → chunk-bj1r1hh5.js} +8153 -6662
- package/dist/esm/internals.mjs +8153 -6662
- package/dist/esm/previewEntry.mjs +8210 -6719
- package/dist/esm/renderEntry.mjs +1 -1
- package/dist/helpers/inject-css.js +18 -44
- package/dist/helpers/open-in-editor.d.ts +3 -3
- package/dist/helpers/open-in-editor.js +10 -6
- package/dist/helpers/pointer-session.d.ts +9 -0
- package/dist/helpers/pointer-session.js +94 -0
- package/dist/helpers/use-menu-structure.js +24 -2
- package/dist/icons/custom-editor.d.ts +4 -0
- package/dist/icons/custom-editor.js +11 -0
- package/dist/icons/editor.d.ts +6 -0
- package/dist/icons/editor.js +52 -0
- package/dist/icons/upload.d.ts +4 -0
- package/dist/icons/upload.js +8 -0
- package/dist/state/editor-guides.d.ts +1 -0
- package/dist/state/editor-guides.js +1 -0
- package/dist/state/modals.d.ts +3 -0
- package/dist/state/z-index.d.ts +1 -0
- package/dist/state/z-index.js +34 -18
- package/package.json +12 -13
- package/dist/components/StudioCanvasCapture.d.ts +0 -5
- package/dist/components/StudioCanvasCapture.js +0 -40
- package/dist/components/canvas-capture-enabled.d.ts +0 -1
- package/dist/components/canvas-capture-enabled.js +0 -4
- package/dist/components/use-element-overwrite-confirmation.d.ts +0 -2
- package/dist/components/use-element-overwrite-confirmation.js +0 -73
|
@@ -35,7 +35,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.AssetFolderTree = exports.getAssetContextMenuItems = exports.getCanDragAsset = exports.getAssetActionAvailability = void 0;
|
|
37
37
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
|
-
const
|
|
38
|
+
const studio_protocol_1 = require("@remotion/studio-protocol");
|
|
39
39
|
const react_1 = require("react");
|
|
40
40
|
const remotion_1 = require("remotion");
|
|
41
41
|
const no_react_1 = require("remotion/no-react");
|
|
@@ -338,7 +338,7 @@ const AssetSelectorItem = ({ item, tabIndex, level, parentFolder, readOnlyStudio
|
|
|
338
338
|
mediaMetadata.duration > 0
|
|
339
339
|
? mediaMetadata.duration
|
|
340
340
|
: null;
|
|
341
|
-
const dragData =
|
|
341
|
+
const dragData = studio_protocol_1.StudioProtocolInternals.makeDragData({
|
|
342
342
|
type: 'asset',
|
|
343
343
|
assetPath: relativePath,
|
|
344
344
|
width: hasDimensions ? width : null,
|
|
@@ -469,7 +469,7 @@ const AssetSelectorItem = ({ item, tabIndex, level, parentFolder, readOnlyStudio
|
|
|
469
469
|
}, [copyStaticFilePath]);
|
|
470
470
|
return (jsx_runtime_1.jsx(ContextMenu_1.ContextMenu, { values: contextMenu, onOpen: null, children: jsx_runtime_1.jsx(layout_1.Row, { align: "center", children: jsx_runtime_1.jsxs("div", { ref: rowRef, style: style, onPointerEnter: onPointerEnter, onPointerLeave: onPointerLeave, onClick: onClick, draggable: canDragAsset, onDragStart: onDragStart, onDragEnd: onDragEnd, tabIndex: tabIndex, title: item.name, children: [
|
|
471
471
|
jsx_runtime_1.jsx(AssetFileIcon_1.AssetFileIcon, { fileType: previewFileType, style: iconStyle, color: colors_1.LIGHT_TEXT }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsx("div", { style: label, children: item.name }), hovered && !isDragging ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
472
|
-
jsx_runtime_1.jsx(layout_1.Spacing, { x: 0.5 }), jsx_runtime_1.jsx(InlineAction_1.InlineAction, { title: "Copy staticFile() path", renderAction: renderCopyAction, onClick: copyToClipboard }), fileExplorerDisabled ? null : (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
473
|
-
jsx_runtime_1.jsx(layout_1.Spacing, { x: 0.5 }), jsx_runtime_1.jsx(InlineAction_1.InlineAction, { title: `Show in ${fileManagerName}`, renderAction: renderFileExplorerAction, onClick: revealInExplorer })
|
|
472
|
+
jsx_runtime_1.jsx(layout_1.Spacing, { x: 0.5 }), jsx_runtime_1.jsx(InlineAction_1.InlineAction, { variant: null, title: "Copy staticFile() path", renderAction: renderCopyAction, onClick: copyToClipboard }), fileExplorerDisabled ? null : (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
473
|
+
jsx_runtime_1.jsx(layout_1.Spacing, { x: 0.5 }), jsx_runtime_1.jsx(InlineAction_1.InlineAction, { variant: null, title: `Show in ${fileManagerName}`, renderAction: renderFileExplorerAction, onClick: revealInExplorer })
|
|
474
474
|
] }))] })) : null] }) }) }));
|
|
475
475
|
};
|
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.Canvas = void 0;
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
-
const
|
|
8
|
+
const studio_protocol_1 = require("@remotion/studio-protocol");
|
|
9
9
|
const react_1 = require("react");
|
|
10
10
|
const remotion_1 = require("remotion");
|
|
11
11
|
const get_static_files_1 = require("../api/get-static-files");
|
|
@@ -33,6 +33,8 @@ const EditorGuides_1 = __importDefault(require("./EditorGuides"));
|
|
|
33
33
|
const EditorRuler_1 = require("./EditorRuler");
|
|
34
34
|
const use_is_ruler_visible_1 = require("./EditorRuler/use-is-ruler-visible");
|
|
35
35
|
const effect_drag_and_drop_1 = require("./effect-drag-and-drop");
|
|
36
|
+
const element_install_request_1 = require("./element-install-request");
|
|
37
|
+
const ElementInstallConfirmation_1 = require("./ElementInstallConfirmation");
|
|
36
38
|
const handle_drop_1 = require("./handle-drop");
|
|
37
39
|
const import_assets_1 = require("./import-assets");
|
|
38
40
|
const layout_1 = require("./layout");
|
|
@@ -42,44 +44,7 @@ const ResetZoomButton_1 = require("./ResetZoomButton");
|
|
|
42
44
|
const SvgImportDialog_1 = require("./SvgImportDialog");
|
|
43
45
|
const imperative_state_1 = require("./Timeline/imperative-state");
|
|
44
46
|
const use_resolved_stack_1 = require("./Timeline/use-resolved-stack");
|
|
45
|
-
const
|
|
46
|
-
const elementInstallCompositionIdStyle = {
|
|
47
|
-
fontFamily: 'monospace',
|
|
48
|
-
fontSize: 13,
|
|
49
|
-
};
|
|
50
|
-
const elementInstallDependencyListStyle = {
|
|
51
|
-
marginTop: 8,
|
|
52
|
-
marginBottom: 0,
|
|
53
|
-
paddingLeft: 24,
|
|
54
|
-
listStyleType: 'disc',
|
|
55
|
-
};
|
|
56
|
-
const elementInstallDependencyStyle = {
|
|
57
|
-
color: 'inherit',
|
|
58
|
-
fontFamily: 'monospace',
|
|
59
|
-
fontSize: 13,
|
|
60
|
-
lineHeight: 1.5,
|
|
61
|
-
};
|
|
62
|
-
const elementInstallCodeDetailsStyle = {
|
|
63
|
-
marginTop: 12,
|
|
64
|
-
fontSize: 13,
|
|
65
|
-
};
|
|
66
|
-
const elementInstallCodeSummaryStyle = {
|
|
67
|
-
cursor: 'pointer',
|
|
68
|
-
fontSize: 13,
|
|
69
|
-
fontWeight: 500,
|
|
70
|
-
};
|
|
71
|
-
const elementInstallCodeBlockStyle = {
|
|
72
|
-
marginTop: 8,
|
|
73
|
-
marginBottom: 0,
|
|
74
|
-
maxHeight: 240,
|
|
75
|
-
overflow: 'auto',
|
|
76
|
-
padding: 12,
|
|
77
|
-
borderRadius: 6,
|
|
78
|
-
backgroundColor: 'rgba(255, 255, 255, 0.06)',
|
|
79
|
-
fontSize: 12,
|
|
80
|
-
lineHeight: 1.5,
|
|
81
|
-
whiteSpace: 'pre',
|
|
82
|
-
};
|
|
47
|
+
const elementInstallDependencyIgnoreList = ['react', 'react-dom', 'remotion'];
|
|
83
48
|
const getContainerStyle = (editorZoomGestures) => ({
|
|
84
49
|
flex: 1,
|
|
85
50
|
display: 'flex',
|
|
@@ -159,7 +124,6 @@ const Canvas = ({ canvasContent, size }) => {
|
|
|
159
124
|
const touchPinchRef = (0, react_1.useRef)(null);
|
|
160
125
|
const keybindings = (0, use_keybinding_1.useKeybinding)();
|
|
161
126
|
const confirm = (0, ConfirmationDialog_1.useConfirmationDialog)();
|
|
162
|
-
const confirmElementOverwrite = (0, use_element_overwrite_confirmation_1.useElementOverwriteConfirmation)();
|
|
163
127
|
const chooseSvgImportMode = (0, SvgImportDialog_1.useSvgImportDialog)();
|
|
164
128
|
const config = remotion_1.Internals.useUnsafeVideoConfig();
|
|
165
129
|
const areRulersVisible = (0, use_is_ruler_visible_1.useIsRulerVisible)();
|
|
@@ -646,6 +610,11 @@ const Canvas = ({ canvasContent, size }) => {
|
|
|
646
610
|
]);
|
|
647
611
|
});
|
|
648
612
|
}, [previewServerClientId, subscribeToEvent]);
|
|
613
|
+
(0, react_1.useEffect)(() => {
|
|
614
|
+
return (0, element_install_request_1.subscribeToElementInstallRequests)((request) => {
|
|
615
|
+
setPendingElementInstallRequests((requests) => [...requests, request]);
|
|
616
|
+
});
|
|
617
|
+
}, []);
|
|
649
618
|
(0, react_1.useEffect)(() => {
|
|
650
619
|
if (activeElementInstallRequest !== null ||
|
|
651
620
|
pendingElementInstallRequests.length === 0) {
|
|
@@ -665,17 +634,29 @@ const Canvas = ({ canvasContent, size }) => {
|
|
|
665
634
|
let canceled = false;
|
|
666
635
|
const handleInstallRequest = async () => {
|
|
667
636
|
setInstallingElementName(activeElementInstallRequest.element.displayName);
|
|
668
|
-
const
|
|
637
|
+
const preflight = await (0, call_api_1.callApi)('/api/prepare-element-install', {
|
|
638
|
+
compositionFile: activeElementInstallRequest.compositionFile,
|
|
639
|
+
compositionId: activeElementInstallRequest.compositionId,
|
|
640
|
+
element: activeElementInstallRequest.element,
|
|
641
|
+
});
|
|
642
|
+
if (!preflight.success) {
|
|
643
|
+
(0, NotificationCenter_1.showNotification)(`Could not review Element installation: ${preflight.reason}`, 4000);
|
|
644
|
+
return;
|
|
645
|
+
}
|
|
646
|
+
if (canceled) {
|
|
647
|
+
return;
|
|
648
|
+
}
|
|
649
|
+
const declaredDependencies = Array.from(new Set(activeElementInstallRequest.element.dependencies));
|
|
650
|
+
const missingPackages = (0, install_required_package_1.getMissingPackages)(declaredDependencies);
|
|
651
|
+
const ignoredDependencies = declaredDependencies.filter((packageName) => elementInstallDependencyIgnoreList.includes(packageName) &&
|
|
652
|
+
!missingPackages.includes(packageName));
|
|
653
|
+
const dependenciesToReview = declaredDependencies.filter((packageName) => !ignoredDependencies.includes(packageName));
|
|
654
|
+
const sourceLabel = activeElementInstallRequest.source.type === 'studio-protocol'
|
|
655
|
+
? activeElementInstallRequest.source.origin
|
|
656
|
+
: 'Unverified drag-and-drop payload';
|
|
669
657
|
const accepted = await confirm({
|
|
670
658
|
title: 'Install Element',
|
|
671
|
-
message: (jsx_runtime_1.
|
|
672
|
-
jsx_runtime_1.jsx("br", {}), jsx_runtime_1.jsx("br", {}),
|
|
673
|
-
"The following dependencies will also be installed:",
|
|
674
|
-
jsx_runtime_1.jsx("ul", { style: elementInstallDependencyListStyle, children: missingPackages.map((packageName) => (jsx_runtime_1.jsx("li", { style: elementInstallDependencyStyle, children: packageName }, packageName))) })
|
|
675
|
-
] })) : null, jsx_runtime_1.jsxs("details", { style: elementInstallCodeDetailsStyle, children: [
|
|
676
|
-
jsx_runtime_1.jsx("summary", { style: elementInstallCodeSummaryStyle, children: "Preview Element source" }), jsx_runtime_1.jsx("pre", { style: elementInstallCodeBlockStyle, children: jsx_runtime_1.jsx("code", { children: activeElementInstallRequest.element.sourceCode }) })
|
|
677
|
-
] })
|
|
678
|
-
] })),
|
|
659
|
+
message: (jsx_runtime_1.jsx(ElementInstallConfirmation_1.ElementInstallConfirmation, { displayName: activeElementInstallRequest.element.displayName, sourceLabel: sourceLabel, sourceIsUnverified: activeElementInstallRequest.source.type === 'drag-and-drop', compositionId: activeElementInstallRequest.compositionId, filePath: preflight.plan.filePath, overwritesExistingFile: preflight.plan.expectedFileState.exists, dependenciesToReview: dependenciesToReview, missingPackages: missingPackages, sourceCode: activeElementInstallRequest.element.sourceCode })),
|
|
679
660
|
confirmLabel: 'Install',
|
|
680
661
|
cancelLabel: 'Cancel',
|
|
681
662
|
});
|
|
@@ -684,9 +665,10 @@ const Canvas = ({ canvasContent, size }) => {
|
|
|
684
665
|
element: activeElementInstallRequest.element,
|
|
685
666
|
compositionFile: activeElementInstallRequest.compositionFile,
|
|
686
667
|
compositionId: activeElementInstallRequest.compositionId,
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
668
|
+
expectedFileState: preflight.plan.expectedFileState,
|
|
669
|
+
from: activeElementInstallRequest.from,
|
|
670
|
+
position: activeElementInstallRequest.position,
|
|
671
|
+
overwriteExisting: preflight.plan.expectedFileState.exists,
|
|
690
672
|
});
|
|
691
673
|
}
|
|
692
674
|
};
|
|
@@ -706,7 +688,7 @@ const Canvas = ({ canvasContent, size }) => {
|
|
|
706
688
|
return () => {
|
|
707
689
|
canceled = true;
|
|
708
690
|
};
|
|
709
|
-
}, [activeElementInstallRequest, confirm
|
|
691
|
+
}, [activeElementInstallRequest, confirm]);
|
|
710
692
|
const onDragOver = (0, react_1.useCallback)((event) => {
|
|
711
693
|
var _a;
|
|
712
694
|
var _b;
|
|
@@ -728,7 +710,7 @@ const Canvas = ({ canvasContent, size }) => {
|
|
|
728
710
|
setCompositionDropPreview(null);
|
|
729
711
|
return;
|
|
730
712
|
}
|
|
731
|
-
const metadata =
|
|
713
|
+
const metadata = studio_protocol_1.StudioProtocolInternals.getDragPreviewMetadata((_b = (_a = event.dataTransfer) === null || _a === void 0 ? void 0 : _a.types) !== null && _b !== void 0 ? _b : []);
|
|
732
714
|
if ((metadata === null || metadata === void 0 ? void 0 : metadata.type) !== 'composition' ||
|
|
733
715
|
metadata.width === undefined ||
|
|
734
716
|
metadata.height === undefined) {
|
|
@@ -835,7 +817,7 @@ const Canvas = ({ canvasContent, size }) => {
|
|
|
835
817
|
event.stopPropagation();
|
|
836
818
|
setIsAddingAsset(true);
|
|
837
819
|
try {
|
|
838
|
-
const metadata =
|
|
820
|
+
const metadata = studio_protocol_1.StudioProtocolInternals.getDragPreviewMetadata((_b = (_a = event.dataTransfer) === null || _a === void 0 ? void 0 : _a.types) !== null && _b !== void 0 ? _b : []);
|
|
839
821
|
const isComposition = (metadata === null || metadata === void 0 ? void 0 : metadata.type) === 'composition';
|
|
840
822
|
let dropPosition = getDropPosition({
|
|
841
823
|
addFitPadding,
|
|
@@ -874,7 +856,6 @@ const Canvas = ({ canvasContent, size }) => {
|
|
|
874
856
|
await (0, handle_drop_1.handleDrop)({
|
|
875
857
|
chooseSvgImportMode,
|
|
876
858
|
compositionFile,
|
|
877
|
-
confirmElementOverwrite,
|
|
878
859
|
compositionId: currentCompositionId,
|
|
879
860
|
destinationDimensions: contentDimensions === 'none' ? null : contentDimensions,
|
|
880
861
|
dropPosition,
|
|
@@ -892,7 +873,6 @@ const Canvas = ({ canvasContent, size }) => {
|
|
|
892
873
|
cannotAddSequence,
|
|
893
874
|
chooseSvgImportMode,
|
|
894
875
|
compositionFile,
|
|
895
|
-
confirmElementOverwrite,
|
|
896
876
|
config,
|
|
897
877
|
contentDimensions,
|
|
898
878
|
currentCompositionId,
|
|
@@ -5,6 +5,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const color_conversion_1 = require("../../helpers/color-conversion");
|
|
7
7
|
const colors_1 = require("../../helpers/colors");
|
|
8
|
+
const pointer_session_1 = require("../../helpers/pointer-session");
|
|
8
9
|
const checker_1 = require("./checker");
|
|
9
10
|
const SLIDER_HEIGHT = 12;
|
|
10
11
|
const HANDLE_WIDTH = 8;
|
|
@@ -57,16 +58,19 @@ const AlphaSlider = ({ hue, saturation, value, alpha, onChange, onChangeComplete
|
|
|
57
58
|
}
|
|
58
59
|
e.preventDefault();
|
|
59
60
|
updateFromEvent(e.clientX, false);
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
61
|
+
let lastClientX = e.clientX;
|
|
62
|
+
(0, pointer_session_1.startPointerSession)({
|
|
63
|
+
event: e.nativeEvent,
|
|
64
|
+
target: e.currentTarget,
|
|
65
|
+
onMove: (ev) => {
|
|
66
|
+
lastClientX = ev.clientX;
|
|
67
|
+
updateFromEvent(ev.clientX, false);
|
|
68
|
+
},
|
|
69
|
+
onEnd: (reason, ev) => {
|
|
70
|
+
const shouldUseEndEvent = reason === 'pointerup' || reason === 'buttons-released';
|
|
71
|
+
updateFromEvent(shouldUseEndEvent && ev ? ev.clientX : lastClientX, true);
|
|
72
|
+
},
|
|
73
|
+
});
|
|
70
74
|
}, [updateFromEvent]);
|
|
71
75
|
const handleStyle = (0, react_1.useMemo)(() => {
|
|
72
76
|
return {
|
|
@@ -5,6 +5,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const color_conversion_1 = require("../../helpers/color-conversion");
|
|
7
7
|
const colors_1 = require("../../helpers/colors");
|
|
8
|
+
const pointer_session_1 = require("../../helpers/pointer-session");
|
|
8
9
|
const SLIDER_HEIGHT = 12;
|
|
9
10
|
const HANDLE_WIDTH = 8;
|
|
10
11
|
const containerStyle = {
|
|
@@ -39,16 +40,19 @@ const HueSlider = ({ hue, onChange, onChangeComplete }) => {
|
|
|
39
40
|
}
|
|
40
41
|
e.preventDefault();
|
|
41
42
|
updateFromEvent(e.clientX, false);
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
43
|
+
let lastClientX = e.clientX;
|
|
44
|
+
(0, pointer_session_1.startPointerSession)({
|
|
45
|
+
event: e.nativeEvent,
|
|
46
|
+
target: e.currentTarget,
|
|
47
|
+
onMove: (ev) => {
|
|
48
|
+
lastClientX = ev.clientX;
|
|
49
|
+
updateFromEvent(ev.clientX, false);
|
|
50
|
+
},
|
|
51
|
+
onEnd: (reason, ev) => {
|
|
52
|
+
const shouldUseEndEvent = reason === 'pointerup' || reason === 'buttons-released';
|
|
53
|
+
updateFromEvent(shouldUseEndEvent && ev ? ev.clientX : lastClientX, true);
|
|
54
|
+
},
|
|
55
|
+
});
|
|
52
56
|
}, [updateFromEvent]);
|
|
53
57
|
const handleStyle = (0, react_1.useMemo)(() => {
|
|
54
58
|
return {
|
|
@@ -5,6 +5,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const color_conversion_1 = require("../../helpers/color-conversion");
|
|
7
7
|
const colors_1 = require("../../helpers/colors");
|
|
8
|
+
const pointer_session_1 = require("../../helpers/pointer-session");
|
|
8
9
|
const AREA_HEIGHT = 140;
|
|
9
10
|
const containerStyle = {
|
|
10
11
|
position: 'relative',
|
|
@@ -48,23 +49,24 @@ const SaturationValueArea = ({ hue, saturation, value, onChange, onChangeComplet
|
|
|
48
49
|
}
|
|
49
50
|
}, [onChange, onChangeComplete]);
|
|
50
51
|
const onPointerDown = (0, react_1.useCallback)((e) => {
|
|
51
|
-
var _a, _b;
|
|
52
52
|
if (e.button !== 0) {
|
|
53
53
|
return;
|
|
54
54
|
}
|
|
55
55
|
e.preventDefault();
|
|
56
|
-
(_b = (_a = e.target).setPointerCapture) === null || _b === void 0 ? void 0 : _b.call(_a, e.pointerId);
|
|
57
56
|
updateFromEvent(e.clientX, e.clientY, false);
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
57
|
+
let lastPosition = { clientX: e.clientX, clientY: e.clientY };
|
|
58
|
+
(0, pointer_session_1.startPointerSession)({
|
|
59
|
+
event: e.nativeEvent,
|
|
60
|
+
target: e.currentTarget,
|
|
61
|
+
onMove: (ev) => {
|
|
62
|
+
lastPosition = { clientX: ev.clientX, clientY: ev.clientY };
|
|
63
|
+
updateFromEvent(ev.clientX, ev.clientY, false);
|
|
64
|
+
},
|
|
65
|
+
onEnd: (reason, ev) => {
|
|
66
|
+
const shouldUseEndEvent = reason === 'pointerup' || reason === 'buttons-released';
|
|
67
|
+
updateFromEvent(shouldUseEndEvent && ev ? ev.clientX : lastPosition.clientX, shouldUseEndEvent && ev ? ev.clientY : lastPosition.clientY, true);
|
|
68
|
+
},
|
|
69
|
+
});
|
|
68
70
|
}, [updateFromEvent]);
|
|
69
71
|
const containerWithBg = (0, react_1.useMemo)(() => {
|
|
70
72
|
return {
|
|
@@ -22,6 +22,6 @@ const CompositionContextButton = ({ visible, values }) => {
|
|
|
22
22
|
if (!visible || connectionStatus !== 'connected') {
|
|
23
23
|
return null;
|
|
24
24
|
}
|
|
25
|
-
return jsx_runtime_1.jsx(InlineDropdown_1.InlineDropdown, { renderAction: renderAction, values: values });
|
|
25
|
+
return (jsx_runtime_1.jsx(InlineDropdown_1.InlineDropdown, { renderAction: renderAction, values: values, variant: null }));
|
|
26
26
|
};
|
|
27
27
|
exports.CompositionContextButton = CompositionContextButton;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CompositionSelector = exports.useCompositionNavigation = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const
|
|
5
|
+
const studio_protocol_1 = require("@remotion/studio-protocol");
|
|
6
6
|
const studio_shared_1 = require("@remotion/studio-shared");
|
|
7
7
|
const react_1 = require("react");
|
|
8
8
|
const remotion_1 = require("remotion");
|
|
@@ -161,7 +161,7 @@ const CompositionSelector = () => {
|
|
|
161
161
|
const onCompositionListDragOverCapture = (0, react_1.useCallback)((event) => {
|
|
162
162
|
var _a;
|
|
163
163
|
if (window.remotion_isReadOnlyStudio ||
|
|
164
|
-
((_a =
|
|
164
|
+
((_a = studio_protocol_1.StudioProtocolInternals.getDragPreviewMetadata(event.dataTransfer.types)) === null || _a === void 0 ? void 0 : _a.type) !== 'composition') {
|
|
165
165
|
stopCompositionListAutoScroll();
|
|
166
166
|
return;
|
|
167
167
|
}
|
|
@@ -178,7 +178,7 @@ const CompositionSelector = () => {
|
|
|
178
178
|
const onRootDragOver = (0, react_1.useCallback)((event) => {
|
|
179
179
|
var _a;
|
|
180
180
|
if (window.remotion_isReadOnlyStudio ||
|
|
181
|
-
((_a =
|
|
181
|
+
((_a = studio_protocol_1.StudioProtocolInternals.getDragPreviewMetadata(event.dataTransfer.types)) === null || _a === void 0 ? void 0 : _a.type) !== 'composition') {
|
|
182
182
|
return;
|
|
183
183
|
}
|
|
184
184
|
event.preventDefault();
|
|
@@ -198,7 +198,7 @@ const CompositionSelector = () => {
|
|
|
198
198
|
if (window.remotion_isReadOnlyStudio) {
|
|
199
199
|
return;
|
|
200
200
|
}
|
|
201
|
-
const parsed =
|
|
201
|
+
const parsed = studio_protocol_1.StudioProtocolInternals.parseDragData(event.dataTransfer);
|
|
202
202
|
if ((parsed === null || parsed === void 0 ? void 0 : parsed.type) !== 'composition') {
|
|
203
203
|
return;
|
|
204
204
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CompositionSelectorItem = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const
|
|
5
|
+
const studio_protocol_1 = require("@remotion/studio-protocol");
|
|
6
6
|
const studio_shared_1 = require("@remotion/studio-shared");
|
|
7
7
|
const react_1 = require("react");
|
|
8
8
|
const client_id_1 = require("../helpers/client-id");
|
|
@@ -150,7 +150,7 @@ const CompositionSelectorItem = ({ item, level, currentComposition, tabIndex, se
|
|
|
150
150
|
}
|
|
151
151
|
setIsDragging(true);
|
|
152
152
|
event.dataTransfer.effectAllowed = 'copyMove';
|
|
153
|
-
const dragData =
|
|
153
|
+
const dragData = studio_protocol_1.StudioProtocolInternals.makeDragData({
|
|
154
154
|
type: 'composition',
|
|
155
155
|
compositionFile: (_a = resolvedLocation === null || resolvedLocation === void 0 ? void 0 : resolvedLocation.source) !== null && _a !== void 0 ? _a : null,
|
|
156
156
|
compositionId: item.composition.id,
|
|
@@ -167,7 +167,7 @@ const CompositionSelectorItem = ({ item, level, currentComposition, tabIndex, se
|
|
|
167
167
|
var _a;
|
|
168
168
|
if (item.type !== 'folder' ||
|
|
169
169
|
window.remotion_isReadOnlyStudio ||
|
|
170
|
-
((_a =
|
|
170
|
+
((_a = studio_protocol_1.StudioProtocolInternals.getDragPreviewMetadata(event.dataTransfer.types)) === null || _a === void 0 ? void 0 : _a.type) !== 'composition') {
|
|
171
171
|
return;
|
|
172
172
|
}
|
|
173
173
|
event.preventDefault();
|
|
@@ -183,7 +183,7 @@ const CompositionSelectorItem = ({ item, level, currentComposition, tabIndex, se
|
|
|
183
183
|
var _a;
|
|
184
184
|
if (item.type !== 'folder' ||
|
|
185
185
|
window.remotion_isReadOnlyStudio ||
|
|
186
|
-
((_a =
|
|
186
|
+
((_a = studio_protocol_1.StudioProtocolInternals.getDragPreviewMetadata(event.dataTransfer.types)) === null || _a === void 0 ? void 0 : _a.type) !== 'composition') {
|
|
187
187
|
return;
|
|
188
188
|
}
|
|
189
189
|
event.preventDefault();
|
|
@@ -195,7 +195,7 @@ const CompositionSelectorItem = ({ item, level, currentComposition, tabIndex, se
|
|
|
195
195
|
if (item.type !== 'folder' || window.remotion_isReadOnlyStudio) {
|
|
196
196
|
return;
|
|
197
197
|
}
|
|
198
|
-
const parsed =
|
|
198
|
+
const parsed = studio_protocol_1.StudioProtocolInternals.parseDragData(event.dataTransfer);
|
|
199
199
|
if ((parsed === null || parsed === void 0 ? void 0 : parsed.type) !== 'composition') {
|
|
200
200
|
return;
|
|
201
201
|
}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConfigureDefaultEditorModal = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const colors_1 = require("../helpers/colors");
|
|
7
|
+
const Checkmark_1 = require("../icons/Checkmark");
|
|
8
|
+
const custom_editor_1 = require("../icons/custom-editor");
|
|
9
|
+
const modals_1 = require("../state/modals");
|
|
10
|
+
const call_api_1 = require("./call-api");
|
|
11
|
+
const layout_1 = require("./layout");
|
|
12
|
+
const ModalButton_1 = require("./ModalButton");
|
|
13
|
+
const ModalContainer_1 = require("./ModalContainer");
|
|
14
|
+
const ModalFooter_1 = require("./ModalFooter");
|
|
15
|
+
const ModalHeader_1 = require("./ModalHeader");
|
|
16
|
+
const ComboBox_1 = require("./NewComposition/ComboBox");
|
|
17
|
+
const ValidationMessage_1 = require("./NewComposition/ValidationMessage");
|
|
18
|
+
const content = {
|
|
19
|
+
padding: 16,
|
|
20
|
+
width: 440,
|
|
21
|
+
maxWidth: 'calc(100vw - 40px)',
|
|
22
|
+
};
|
|
23
|
+
const description = {
|
|
24
|
+
color: colors_1.LIGHT_TEXT,
|
|
25
|
+
fontFamily: 'sans-serif',
|
|
26
|
+
fontSize: 14,
|
|
27
|
+
lineHeight: 1.5,
|
|
28
|
+
margin: 0,
|
|
29
|
+
};
|
|
30
|
+
const comboBoxStyle = {
|
|
31
|
+
boxSizing: 'border-box',
|
|
32
|
+
width: '100%',
|
|
33
|
+
};
|
|
34
|
+
const customEditorLabel = {
|
|
35
|
+
display: 'inline-flex',
|
|
36
|
+
alignItems: 'center',
|
|
37
|
+
gap: 8,
|
|
38
|
+
maxWidth: '100%',
|
|
39
|
+
minWidth: 0,
|
|
40
|
+
color: 'inherit',
|
|
41
|
+
fontFamily: 'inherit',
|
|
42
|
+
fontSize: 'inherit',
|
|
43
|
+
lineHeight: 'inherit',
|
|
44
|
+
};
|
|
45
|
+
const customEditorName = {
|
|
46
|
+
minWidth: 0,
|
|
47
|
+
overflow: 'hidden',
|
|
48
|
+
textOverflow: 'ellipsis',
|
|
49
|
+
whiteSpace: 'nowrap',
|
|
50
|
+
color: 'inherit',
|
|
51
|
+
fontFamily: 'inherit',
|
|
52
|
+
fontSize: 'inherit',
|
|
53
|
+
lineHeight: 'inherit',
|
|
54
|
+
};
|
|
55
|
+
const NO_PREFERENCE_ID = 'no-preference';
|
|
56
|
+
const ConfigureDefaultEditorModal = () => {
|
|
57
|
+
const { setSelectedModal } = (0, react_1.useContext)(modals_1.ModalsContext);
|
|
58
|
+
const [editorInfo, setEditorInfo] = (0, react_1.useState)(null);
|
|
59
|
+
const [selectedEditor, setSelectedEditor] = (0, react_1.useState)(null);
|
|
60
|
+
const [isSubmitting, setIsSubmitting] = (0, react_1.useState)(false);
|
|
61
|
+
const [error, setError] = (0, react_1.useState)(null);
|
|
62
|
+
const editorValues = (0, react_1.useMemo)(() => {
|
|
63
|
+
var _a;
|
|
64
|
+
const noPreference = {
|
|
65
|
+
id: NO_PREFERENCE_ID,
|
|
66
|
+
keyHint: null,
|
|
67
|
+
label: 'No preference',
|
|
68
|
+
leftItem: selectedEditor === null ? jsx_runtime_1.jsx(Checkmark_1.Checkmark, {}) : null,
|
|
69
|
+
onClick: () => {
|
|
70
|
+
setSelectedEditor(null);
|
|
71
|
+
setError(null);
|
|
72
|
+
},
|
|
73
|
+
quickSwitcherLabel: null,
|
|
74
|
+
subMenu: null,
|
|
75
|
+
type: 'item',
|
|
76
|
+
value: NO_PREFERENCE_ID,
|
|
77
|
+
};
|
|
78
|
+
const installedEditors = ((_a = editorInfo === null || editorInfo === void 0 ? void 0 : editorInfo.installedEditors) !== null && _a !== void 0 ? _a : []).map((editor) => {
|
|
79
|
+
return {
|
|
80
|
+
id: editor.id,
|
|
81
|
+
keyHint: null,
|
|
82
|
+
label: editor.id === 'custom' ? (jsx_runtime_1.jsxs("span", { style: customEditorLabel, children: [
|
|
83
|
+
jsx_runtime_1.jsx(custom_editor_1.CustomEditorIcon, { size: null }), jsx_runtime_1.jsx("span", { style: customEditorName, children: editor.name })
|
|
84
|
+
] })) : (editor.name),
|
|
85
|
+
leftItem: selectedEditor === editor.id ? jsx_runtime_1.jsx(Checkmark_1.Checkmark, {}) : null,
|
|
86
|
+
onClick: () => {
|
|
87
|
+
setSelectedEditor(editor.id);
|
|
88
|
+
setError(null);
|
|
89
|
+
},
|
|
90
|
+
quickSwitcherLabel: null,
|
|
91
|
+
subMenu: null,
|
|
92
|
+
type: 'item',
|
|
93
|
+
value: editor.id,
|
|
94
|
+
};
|
|
95
|
+
});
|
|
96
|
+
return [noPreference, ...installedEditors];
|
|
97
|
+
}, [editorInfo === null || editorInfo === void 0 ? void 0 : editorInfo.installedEditors, selectedEditor]);
|
|
98
|
+
const dismiss = (0, react_1.useCallback)(() => {
|
|
99
|
+
setSelectedModal(null);
|
|
100
|
+
}, [setSelectedModal]);
|
|
101
|
+
(0, react_1.useEffect)(() => {
|
|
102
|
+
const controller = new AbortController();
|
|
103
|
+
(0, call_api_1.callApi)('/api/default-editor-info', {}, controller.signal)
|
|
104
|
+
.then((response) => {
|
|
105
|
+
setEditorInfo(response);
|
|
106
|
+
setSelectedEditor(response.defaultEditor !== null &&
|
|
107
|
+
response.installedEditors.some(({ id }) => id === response.defaultEditor)
|
|
108
|
+
? response.defaultEditor
|
|
109
|
+
: null);
|
|
110
|
+
})
|
|
111
|
+
.catch((err) => {
|
|
112
|
+
if (controller.signal.aborted) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
setError(err.message);
|
|
116
|
+
});
|
|
117
|
+
return () => controller.abort();
|
|
118
|
+
}, []);
|
|
119
|
+
const submit = (0, react_1.useCallback)(async () => {
|
|
120
|
+
if (editorInfo === null) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
setIsSubmitting(true);
|
|
124
|
+
setError(null);
|
|
125
|
+
try {
|
|
126
|
+
const response = await (0, call_api_1.callApi)('/api/update-default-editor', {
|
|
127
|
+
defaultEditor: selectedEditor,
|
|
128
|
+
});
|
|
129
|
+
if (!response.success) {
|
|
130
|
+
setError(response.reason);
|
|
131
|
+
setIsSubmitting(false);
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
dismiss();
|
|
135
|
+
}
|
|
136
|
+
catch (err) {
|
|
137
|
+
setError(err.message);
|
|
138
|
+
setIsSubmitting(false);
|
|
139
|
+
}
|
|
140
|
+
}, [dismiss, editorInfo, selectedEditor]);
|
|
141
|
+
if (editorInfo === null && error === null) {
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
return (jsx_runtime_1.jsxs(ModalContainer_1.ModalContainer, { onEscape: dismiss, onOutsideClick: dismiss, children: [
|
|
145
|
+
jsx_runtime_1.jsx(ModalHeader_1.ModalHeader, { title: "Configure default editor", onClose: dismiss }), jsx_runtime_1.jsxs("div", { style: content, children: [
|
|
146
|
+
jsx_runtime_1.jsx("p", { style: description, children: "This setting gets saved to your config file." }), jsx_runtime_1.jsx(layout_1.Spacing, { y: 2, block: true }), (editorInfo === null || editorInfo === void 0 ? void 0 : editorInfo.installedEditors.length) === 0 ? (jsx_runtime_1.jsx("p", { style: description, children: "No supported editors were found on this computer." })) : null, editorInfo === null ? null : (jsx_runtime_1.jsx(ComboBox_1.Combobox, { values: editorValues, selectedId: selectedEditor !== null && selectedEditor !== void 0 ? selectedEditor : NO_PREFERENCE_ID, style: comboBoxStyle, title: "Default editor" })), error ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
147
|
+
jsx_runtime_1.jsx(layout_1.Spacing, { y: 1.5 }), jsx_runtime_1.jsx(ValidationMessage_1.ValidationMessage, { message: error, align: "flex-start", type: "error" })
|
|
148
|
+
] })) : null] }), jsx_runtime_1.jsx(ModalFooter_1.ModalFooterContainer, { children: jsx_runtime_1.jsx(layout_1.Row, { justify: "flex-end", children: jsx_runtime_1.jsx(ModalButton_1.ModalButton, { onClick: submit, disabled: isSubmitting || editorInfo === null, children: isSubmitting ? 'Saving...' : 'Save and reload' }) }) })
|
|
149
|
+
] }));
|
|
150
|
+
};
|
|
151
|
+
exports.ConfigureDefaultEditorModal = ConfigureDefaultEditorModal;
|
|
@@ -15,10 +15,13 @@ const content = {
|
|
|
15
15
|
padding: 16,
|
|
16
16
|
fontSize: 14,
|
|
17
17
|
flex: 1,
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
width: 'min(600px, calc(100vw - 40px))',
|
|
19
|
+
minWidth: 0,
|
|
20
20
|
lineHeight: 1.4,
|
|
21
21
|
};
|
|
22
|
+
const footerStyle = {
|
|
23
|
+
minWidth: 0,
|
|
24
|
+
};
|
|
22
25
|
const useConfirmationDialog = () => {
|
|
23
26
|
const { setSelectedModal } = (0, react_1.useContext)(modals_1.ModalsContext);
|
|
24
27
|
return (0, react_1.useCallback)((options) => {
|
|
@@ -93,7 +96,7 @@ const ConfirmationDialog = ({ state }) => {
|
|
|
93
96
|
}, []);
|
|
94
97
|
return (jsx_runtime_1.jsxs(ModalContainer_1.ModalContainer, { onOutsideClick: onCancel, onEscape: onCancel, children: [
|
|
95
98
|
jsx_runtime_1.jsx(ModalHeader_1.ModalHeader, { title: state.title, onClose: onCancel }), jsx_runtime_1.jsxs("form", { onSubmit: onSubmit, children: [
|
|
96
|
-
jsx_runtime_1.jsx("div", { style: content, children: state.message }), jsx_runtime_1.jsx(ModalFooter_1.ModalFooterContainer, { children: jsx_runtime_1.jsxs(layout_1.Row, { align: "center", children: [
|
|
99
|
+
jsx_runtime_1.jsx("div", { style: content, children: state.message }), jsx_runtime_1.jsx(ModalFooter_1.ModalFooterContainer, { style: footerStyle, children: jsx_runtime_1.jsxs(layout_1.Row, { align: "center", children: [
|
|
97
100
|
jsx_runtime_1.jsx(layout_1.Flex, {}), jsx_runtime_1.jsx(Button_1.Button, { onClick: onCancel, style: cancelStyle, children: state.cancelLabel }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsxs(ModalButton_1.ModalButton, { onClick: onConfirm, autoFocus: true, children: [state.confirmLabel, jsx_runtime_1.jsx(ShortcutHint_1.ShortcutHint, { keyToPress: "\u21B5", cmdOrCtrl: false })
|
|
98
101
|
] })
|
|
99
102
|
] }) })
|
|
@@ -47,11 +47,9 @@ const z_index_1 = require("../state/z-index");
|
|
|
47
47
|
const portals_1 = require("./Menu/portals");
|
|
48
48
|
const styles_1 = require("./Menu/styles");
|
|
49
49
|
const MenuContent_1 = require("./NewComposition/MenuContent");
|
|
50
|
-
const CONTEXT_MENU_Z_INDEX = 1001;
|
|
51
50
|
const contextMenuFullScreenOverlay = {
|
|
52
51
|
...styles_1.fullScreenOverlay,
|
|
53
52
|
pointerEvents: 'none',
|
|
54
|
-
zIndex: CONTEXT_MENU_Z_INDEX,
|
|
55
53
|
};
|
|
56
54
|
const contextMenuOuterPortal = {
|
|
57
55
|
...styles_1.outerPortal,
|