mirror of
https://github.com/mifi/lossless-cut.git
synced 2024-11-22 10:22:31 +01:00
Allow copying selected segments to clipboard
by pressing ctrl/cmd+c closes #1535
This commit is contained in:
parent
6df11a0759
commit
44813b4f39
@ -62,6 +62,9 @@ const defaultKeyBindings = [
|
||||
{ keys: 'ctrl+shift+z', action: 'redo' },
|
||||
{ keys: 'command+shift+z', action: 'redo' },
|
||||
|
||||
{ keys: 'ctrl+c', action: 'copySegmentsToClipboard' },
|
||||
{ keys: 'command+c', action: 'copySegmentsToClipboard' },
|
||||
|
||||
{ keys: 'enter', action: 'labelCurrentSegment' },
|
||||
|
||||
{ keys: 'e', action: 'export' },
|
||||
|
10
src/App.jsx
10
src/App.jsx
@ -61,7 +61,7 @@ import {
|
||||
} from './ffmpeg';
|
||||
import { shouldCopyStreamByDefault, getAudioStreams, getRealVideoStreams, isAudioDefinitelyNotSupported, willPlayerProperlyHandleVideo, doesPlayerSupportHevcPlayback, isStreamThumbnail } from './util/streams';
|
||||
import { exportEdlFile, readEdlFile, saveLlcProject, loadLlcProject, askForEdlImport } from './edlStore';
|
||||
import { formatYouTube, getFrameCountRaw } from './edlFormats';
|
||||
import { formatYouTube, getFrameCountRaw, formatTsv } from './edlFormats';
|
||||
import {
|
||||
getOutPath, getSuffixedOutPath, handleError, getOutDir,
|
||||
isMasBuild, isStoreBuild, dragPreventer,
|
||||
@ -1790,6 +1790,11 @@ const App = memo(() => {
|
||||
|
||||
const toggleLoopSelectedSegments = useCallback(() => togglePlay({ resetPlaybackRate: true, playbackMode: 'loop-selected-segments' }), [togglePlay]);
|
||||
|
||||
const copySegmentsToClipboard = useCallback(async () => {
|
||||
if (!checkFileOpened()) return;
|
||||
electron.clipboard.writeText(await formatTsv(selectedSegments));
|
||||
}, [checkFileOpened, selectedSegments]);
|
||||
|
||||
const onKeyPress = useCallback(({ action, keyup }) => {
|
||||
function seekReset() {
|
||||
seekAccelerationRef.current = 1;
|
||||
@ -1891,6 +1896,7 @@ const App = memo(() => {
|
||||
shiftAllSegmentTimes,
|
||||
increaseVolume: () => setPlaybackVolume((val) => Math.min(1, val + 0.07)),
|
||||
decreaseVolume: () => setPlaybackVolume((val) => Math.max(0, val - 0.07)),
|
||||
copySegmentsToClipboard,
|
||||
};
|
||||
|
||||
function tryMainActions() {
|
||||
@ -1933,7 +1939,7 @@ const App = memo(() => {
|
||||
if (match) return bubble;
|
||||
|
||||
return true; // bubble the event
|
||||
}, [addSegment, alignSegmentTimesToKeyframes, askSetStartTimeOffset, batchFileJump, batchOpenSelectedFile, captureSnapshot, captureSnapshotAsCoverArt, changePlaybackRate, cleanupFilesDialog, clearSegments, closeBatch, closeExportConfirm, combineOverlappingSegments, concatCurrentBatch, concatDialogVisible, convertFormatBatch, createFixedDurationSegments, createNumSegments, createRandomSegments, currentSegIndexSafe, cutSegmentsHistory, deselectAllSegments, exportConfirmVisible, extractAllStreams, extractCurrentSegmentFramesAsImages, fillSegmentsGaps, goToTimecode, increaseRotation, invertAllSegments, invertSelectedSegments, jumpCutEnd, jumpCutStart, jumpSeg, jumpTimelineEnd, jumpTimelineStart, keyboardNormalSeekSpeed, keyboardSeekAccFactor, keyboardShortcutsVisible, onExportConfirm, onExportPress, onLabelSegment, pause, play, removeCutSegment, removeSelectedSegments, reorderSegsByStartTime, seekClosestKeyframe, seekRel, seekRelPercent, selectAllSegments, selectOnlyCurrentSegment, setCutEnd, setCutStart, setPlaybackVolume, shiftAllSegmentTimes, shortStep, shuffleSegments, splitCurrentSegment, timelineToggleComfortZoom, toggleCaptureFormat, toggleCurrentSegmentSelected, toggleKeyboardShortcuts, toggleKeyframeCut, toggleLastCommands, toggleLoopSelectedSegments, togglePlay, toggleSegmentsList, toggleStreamsSelector, toggleStripAudio, tryFixInvalidDuration, userHtml5ifyCurrentFile, zoomRel]);
|
||||
}, [addSegment, alignSegmentTimesToKeyframes, askSetStartTimeOffset, batchFileJump, batchOpenSelectedFile, captureSnapshot, captureSnapshotAsCoverArt, changePlaybackRate, cleanupFilesDialog, clearSegments, closeBatch, closeExportConfirm, combineOverlappingSegments, concatCurrentBatch, concatDialogVisible, convertFormatBatch, copySegmentsToClipboard, createFixedDurationSegments, createNumSegments, createRandomSegments, currentSegIndexSafe, cutSegmentsHistory, deselectAllSegments, exportConfirmVisible, extractAllStreams, extractCurrentSegmentFramesAsImages, fillSegmentsGaps, goToTimecode, increaseRotation, invertAllSegments, invertSelectedSegments, jumpCutEnd, jumpCutStart, jumpSeg, jumpTimelineEnd, jumpTimelineStart, keyboardNormalSeekSpeed, keyboardSeekAccFactor, keyboardShortcutsVisible, onExportConfirm, onExportPress, onLabelSegment, pause, play, removeCutSegment, removeSelectedSegments, reorderSegsByStartTime, seekClosestKeyframe, seekRel, seekRelPercent, selectAllSegments, selectOnlyCurrentSegment, setCutEnd, setCutStart, setPlaybackVolume, shiftAllSegmentTimes, shortStep, shuffleSegments, splitCurrentSegment, timelineToggleComfortZoom, toggleCaptureFormat, toggleCurrentSegmentSelected, toggleKeyboardShortcuts, toggleKeyframeCut, toggleLastCommands, toggleLoopSelectedSegments, togglePlay, toggleSegmentsList, toggleStreamsSelector, toggleStripAudio, tryFixInvalidDuration, userHtml5ifyCurrentFile, zoomRel]);
|
||||
|
||||
useKeyboard({ keyBindings, onKeyPress });
|
||||
|
||||
|
@ -481,6 +481,10 @@ const KeyboardShortcuts = memo(({
|
||||
name: t('Redo'),
|
||||
category: otherCategory,
|
||||
},
|
||||
copySegmentsToClipboard: {
|
||||
name: t('Copy selected segments times to clipboard'),
|
||||
category: otherCategory,
|
||||
},
|
||||
closeActiveScreen: {
|
||||
name: t('Close current screen'),
|
||||
category: otherCategory,
|
||||
|
Loading…
Reference in New Issue
Block a user