mirror of
https://github.com/IRBorisov/ConceptPortal.git
synced 2025-06-26 04:50:36 +03:00
Small UI fixes
This commit is contained in:
parent
ac85bfdba7
commit
65872cbce7
|
@ -15,6 +15,7 @@ import DlgEditReference from '@/dialogs/DlgEditReference';
|
||||||
import { ReferenceType } from '@/models/language';
|
import { ReferenceType } from '@/models/language';
|
||||||
import { IRSForm } from '@/models/rsform';
|
import { IRSForm } from '@/models/rsform';
|
||||||
import { CodeMirrorWrapper } from '@/utils/codemirror';
|
import { CodeMirrorWrapper } from '@/utils/codemirror';
|
||||||
|
import { PARAMETER } from '@/utils/constants';
|
||||||
|
|
||||||
import { NaturalLanguage, ReferenceTokens } from './parse';
|
import { NaturalLanguage, ReferenceTokens } from './parse';
|
||||||
import { RefEntity } from './parse/parser.terms';
|
import { RefEntity } from './parse/parser.terms';
|
||||||
|
@ -165,12 +166,17 @@ const RefsInput = forwardRef<ReactCodeMirrorRef, RefsInputInputProps>(
|
||||||
[thisRef]
|
[thisRef]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const hideEditReference = useCallback(() => {
|
||||||
|
setShowEditor(false);
|
||||||
|
setTimeout(() => thisRef.current?.view?.focus(), PARAMETER.refreshTimeout);
|
||||||
|
}, [thisRef]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={clsx('flex flex-col gap-2', cursor)}>
|
<div className={clsx('flex flex-col gap-2', cursor)}>
|
||||||
<AnimatePresence>
|
<AnimatePresence>
|
||||||
{showEditor && schema ? (
|
{showEditor && schema ? (
|
||||||
<DlgEditReference
|
<DlgEditReference
|
||||||
hideWindow={() => setShowEditor(false)}
|
hideWindow={hideEditReference}
|
||||||
schema={schema}
|
schema={schema}
|
||||||
initial={{
|
initial={{
|
||||||
type: currentType,
|
type: currentType,
|
||||||
|
@ -193,7 +199,7 @@ const RefsInput = forwardRef<ReactCodeMirrorRef, RefsInputInputProps>(
|
||||||
value={isFocused ? value : value !== initialValue || showEditor ? value : resolved}
|
value={isFocused ? value : value !== initialValue || showEditor ? value : resolved}
|
||||||
indentWithTab={false}
|
indentWithTab={false}
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
editable={!disabled}
|
editable={!disabled && !showEditor}
|
||||||
onKeyDown={handleInput}
|
onKeyDown={handleInput}
|
||||||
onFocus={handleFocusIn}
|
onFocus={handleFocusIn}
|
||||||
onBlur={handleFocusOut}
|
onBlur={handleFocusOut}
|
||||||
|
|
|
@ -145,9 +145,11 @@ function RSTabs() {
|
||||||
|
|
||||||
const onOpenCst = useCallback(
|
const onOpenCst = useCallback(
|
||||||
(cstID: ConstituentaID) => {
|
(cstID: ConstituentaID) => {
|
||||||
navigateTab(RSTabID.CST_EDIT, cstID);
|
if (cstID !== activeCst?.id) {
|
||||||
|
navigateTab(RSTabID.CST_EDIT, cstID);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
[navigateTab]
|
[navigateTab, activeCst]
|
||||||
);
|
);
|
||||||
|
|
||||||
const onDestroySchema = useCallback(() => {
|
const onDestroySchema = useCallback(() => {
|
||||||
|
|
|
@ -16,6 +16,7 @@ export const PARAMETER = {
|
||||||
smallScreen: 640, // == tailwind:xs
|
smallScreen: 640, // == tailwind:xs
|
||||||
smallTreeNodes: 50, // amount of nodes threshold for size increase for large graphs
|
smallTreeNodes: 50, // amount of nodes threshold for size increase for large graphs
|
||||||
refreshTimeout: 100, // milliseconds delay for post-refresh actions
|
refreshTimeout: 100, // milliseconds delay for post-refresh actions
|
||||||
|
minimalTimeout: 10, // milliseconds delay for fast updates
|
||||||
graphRefreshDelay: 10, // milliseconds delay for graph viewpoint reset
|
graphRefreshDelay: 10, // milliseconds delay for graph viewpoint reset
|
||||||
|
|
||||||
logicLabel: 'LOGIC'
|
logicLabel: 'LOGIC'
|
||||||
|
|
Loading…
Reference in New Issue
Block a user