mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-23 00:58:32 +02:00
Variables in pair editor
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"productName": "yaak",
|
"productName": "yaak",
|
||||||
"version": "2024.6.0",
|
"version": "2024.6.1",
|
||||||
"identifier": "app.yaak.desktop",
|
"identifier": "app.yaak.desktop",
|
||||||
"build": {
|
"build": {
|
||||||
"beforeBuildCommand": "npm run build",
|
"beforeBuildCommand": "npm run build",
|
||||||
|
|||||||
@@ -32,8 +32,6 @@ import { monokaiProDefault } from '../lib/theme/themes/monokai-pro';
|
|||||||
import { rosePineDefault } from '../lib/theme/themes/rose-pine';
|
import { rosePineDefault } from '../lib/theme/themes/rose-pine';
|
||||||
import { yaakDark } from '../lib/theme/themes/yaak';
|
import { yaakDark } from '../lib/theme/themes/yaak';
|
||||||
import { getThemeCSS } from '../lib/theme/window';
|
import { getThemeCSS } from '../lib/theme/window';
|
||||||
import { Button } from './core/Button';
|
|
||||||
import { useToast } from './ToastContext';
|
|
||||||
|
|
||||||
export function GlobalHooks() {
|
export function GlobalHooks() {
|
||||||
// Include here so they always update, even if no component references them
|
// Include here so they always update, even if no component references them
|
||||||
@@ -41,16 +39,6 @@ export function GlobalHooks() {
|
|||||||
useRecentEnvironments();
|
useRecentEnvironments();
|
||||||
useRecentRequests();
|
useRecentRequests();
|
||||||
|
|
||||||
const toast = useToast();
|
|
||||||
useEffect(() => {
|
|
||||||
toast.show({
|
|
||||||
id: 'test',
|
|
||||||
message: 'Hello Toast!',
|
|
||||||
action: <Button color="primary">HEllo</Button>,
|
|
||||||
timeout: 1000000,
|
|
||||||
});
|
|
||||||
}, [toast]);
|
|
||||||
|
|
||||||
// Other useful things
|
// Other useful things
|
||||||
useSyncThemeToDocument();
|
useSyncThemeToDocument();
|
||||||
useCommandPalette();
|
useCommandPalette();
|
||||||
|
|||||||
@@ -2,12 +2,7 @@ import { useCallback, useMemo } from 'react';
|
|||||||
import { Editor } from './Editor';
|
import { Editor } from './Editor';
|
||||||
import type { PairEditorProps } from './PairEditor';
|
import type { PairEditorProps } from './PairEditor';
|
||||||
|
|
||||||
type Props = Pick<
|
type Props = PairEditorProps;
|
||||||
PairEditorProps,
|
|
||||||
'onChange' | 'pairs' | 'namePlaceholder' | 'valuePlaceholder'
|
|
||||||
> & {
|
|
||||||
foo?: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
export function BulkPairEditor({ pairs, onChange, namePlaceholder, valuePlaceholder }: Props) {
|
export function BulkPairEditor({ pairs, onChange, namePlaceholder, valuePlaceholder }: Props) {
|
||||||
const pairsText = useMemo(() => {
|
const pairsText = useMemo(() => {
|
||||||
@@ -30,6 +25,8 @@ export function BulkPairEditor({ pairs, onChange, namePlaceholder, valuePlacehol
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Editor
|
<Editor
|
||||||
|
useTemplating
|
||||||
|
autocompleteVariables
|
||||||
placeholder={`${namePlaceholder ?? 'name'}: ${valuePlaceholder ?? 'value'}`}
|
placeholder={`${namePlaceholder ?? 'name'}: ${valuePlaceholder ?? 'value'}`}
|
||||||
defaultValue={pairsText}
|
defaultValue={pairsText}
|
||||||
contentType="pairs"
|
contentType="pairs"
|
||||||
|
|||||||
Reference in New Issue
Block a user