mirror of
				https://github.com/blakeblackshear/frigate.git
				synced 2025-10-27 10:52:11 +01:00 
			
		
		
		
	Use library to handle copying to clipboard (#4989)
* Use library to handle copying * Typo
This commit is contained in:
		
							parent
							
								
									d49359e26a
								
							
						
					
					
						commit
						581c2591ae
					
				@ -14,6 +14,7 @@
 | 
			
		||||
  "dependencies": {
 | 
			
		||||
    "@cycjimmy/jsmpeg-player": "^6.0.5",
 | 
			
		||||
    "axios": "^1.2.2",
 | 
			
		||||
    "copy-to-clipboard": "3.3.3",
 | 
			
		||||
    "date-fns": "^2.29.3",
 | 
			
		||||
    "idb-keyval": "^6.2.0",
 | 
			
		||||
    "immer": "^9.0.16",
 | 
			
		||||
 | 
			
		||||
@ -8,6 +8,7 @@ import { useEffect, useState } from 'preact/hooks';
 | 
			
		||||
import Button from '../components/Button';
 | 
			
		||||
import { editor, Uri } from 'monaco-editor';
 | 
			
		||||
import { setDiagnosticsOptions } from 'monaco-yaml';
 | 
			
		||||
import copy from 'copy-to-clipboard';
 | 
			
		||||
 | 
			
		||||
export default function Config() {
 | 
			
		||||
  const apiHost = useApiHost();
 | 
			
		||||
@ -40,7 +41,7 @@ export default function Config() {
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  const handleCopyConfig = async () => {
 | 
			
		||||
    await window.navigator.clipboard.writeText(window.editor.getValue());
 | 
			
		||||
    copy(window.editor.getValue());
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  useEffect(() => {
 | 
			
		||||
 | 
			
		||||
@ -9,6 +9,7 @@ import axios from 'axios';
 | 
			
		||||
import { Table, Tbody, Thead, Tr, Th, Td } from '../components/Table';
 | 
			
		||||
import { useState } from 'preact/hooks';
 | 
			
		||||
import Dialog from '../components/Dialog';
 | 
			
		||||
import copy from 'copy-to-clipboard';
 | 
			
		||||
 | 
			
		||||
const emptyObject = Object.freeze({});
 | 
			
		||||
 | 
			
		||||
@ -54,7 +55,7 @@ export default function System() {
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  const onCopyFfprobe = async () => {
 | 
			
		||||
    await window.navigator.clipboard.writeText(JSON.stringify(state.ffprobe, null, 2));
 | 
			
		||||
    copy(JSON.stringify(state.ffprobe, null, 2));
 | 
			
		||||
    setState({ ...state, ffprobe: '', showFfprobe: false });
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
@ -73,7 +74,7 @@ export default function System() {
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  const onCopyVainfo = async () => {
 | 
			
		||||
    await window.navigator.clipboard.writeText(JSON.stringify(state.vaifp, null, 2));
 | 
			
		||||
    copy(JSON.stringify(state.vainfo, null, 2));
 | 
			
		||||
    setState({ ...state, vainfo: '', showVainfo: false });
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user