mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-20 08:33:52 +01:00
Request pane context (#69)
This commit is contained in:
@@ -22,6 +22,7 @@ import { parseTemplate } from '../../../hooks/useParseTemplate';
|
||||
import { useSettings } from '../../../hooks/useSettings';
|
||||
import { useTemplateFunctions } from '../../../hooks/useTemplateFunctions';
|
||||
import { useDialog } from '../../DialogContext';
|
||||
import { useRequestEditor } from '../../RequestEditorContext';
|
||||
import { TemplateFunctionDialog } from '../../TemplateFunctionDialog';
|
||||
import { TemplateVariableDialog } from '../../TemplateVariableDialog';
|
||||
import { IconButton } from '../IconButton';
|
||||
@@ -227,9 +228,13 @@ export const Editor = forwardRef<EditorView | undefined, EditorProps>(function E
|
||||
[dialog],
|
||||
);
|
||||
|
||||
const onClickPathParameter = useCallback(async (name: string) => {
|
||||
console.log('TODO: Focus', name, 'in params tab');
|
||||
}, []);
|
||||
const { focusParamValue } = useRequestEditor();
|
||||
const onClickPathParameter = useCallback(
|
||||
async (name: string) => {
|
||||
focusParamValue(name);
|
||||
},
|
||||
[focusParamValue],
|
||||
);
|
||||
|
||||
// Update the language extension when the language changes
|
||||
useEffect(() => {
|
||||
|
||||
@@ -120,7 +120,6 @@ function templateTags(
|
||||
const onClick = () => onClickPathParameter(rawText);
|
||||
const widget = new PathPlaceholderWidget(rawText, globalFrom, onClick);
|
||||
const deco = Decoration.replace({ widget, inclusive: false });
|
||||
console.log('ADDED WIDGET', globalFrom, node, rawText);
|
||||
widgets.push(deco.range(globalFrom, globalTo));
|
||||
},
|
||||
});
|
||||
@@ -201,13 +200,6 @@ export function templateTagsPlugin(
|
||||
return view.plugin(plugin)?.decorations || Decoration.none;
|
||||
});
|
||||
},
|
||||
eventHandlers: {
|
||||
mousedown(e) {
|
||||
const target = e.target as HTMLElement;
|
||||
if (target.classList.contains('template-tag')) console.log('CLICKED TEMPLATE TAG');
|
||||
// return toggleBoolean(view, view.posAtDOM(target));
|
||||
},
|
||||
},
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -3,9 +3,9 @@ import { styleTags, tags as t } from '@lezer/highlight';
|
||||
export const highlight = styleTags({
|
||||
Protocol: t.comment,
|
||||
Placeholder: t.emphasis,
|
||||
PathSegment: t.tagName,
|
||||
Port: t.attributeName,
|
||||
Host: t.variableName,
|
||||
Path: t.bool,
|
||||
Query: t.string,
|
||||
// PathSegment: t.tagName,
|
||||
// Port: t.attributeName,
|
||||
// Host: t.variableName,
|
||||
// Path: t.bool,
|
||||
// Query: t.string,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user