M: Revert to default selection behavior and fix minor issues

This commit is contained in:
Ivan 2025-03-19 12:44:35 +03:00
parent 79158c5cf5
commit aecac71283
9 changed files with 52 additions and 50 deletions

View File

@ -151,6 +151,7 @@
"rsconcept",
"rsedit",
"rseditor",
"rsexpression",
"rsform",
"rsforms",
"rsgraph",

View File

@ -13,18 +13,18 @@ import { ToggleNavigation } from './toggle-navigation';
import { UserMenu } from './user-menu';
export function Navigation() {
const router = useConceptNavigation();
const { push } = useConceptNavigation();
const size = useWindowSize();
const noNavigationAnimation = useAppLayoutStore(state => state.noNavigationAnimation);
const navigateHome = (event: React.MouseEvent<Element>) =>
router.push({ path: urls.home, newTab: event.ctrlKey || event.metaKey });
push({ path: urls.home, newTab: event.ctrlKey || event.metaKey });
const navigateLibrary = (event: React.MouseEvent<Element>) =>
router.push({ path: urls.library, newTab: event.ctrlKey || event.metaKey });
push({ path: urls.library, newTab: event.ctrlKey || event.metaKey });
const navigateHelp = (event: React.MouseEvent<Element>) =>
router.push({ path: urls.manuals, newTab: event.ctrlKey || event.metaKey });
push({ path: urls.manuals, newTab: event.ctrlKey || event.metaKey });
const navigateCreateNew = (event: React.MouseEvent<Element>) =>
router.push({ path: urls.create_schema, newTab: event.ctrlKey || event.metaKey });
push({ path: urls.create_schema, newTab: event.ctrlKey || event.metaKey });
return (
<nav className='z-navigation sticky top-0 left-0 right-0 select-none bg-prim-100'>

View File

@ -29,34 +29,6 @@ import { refsNavigation } from './click-navigation';
import { NaturalLanguage, ReferenceTokens } from './parse';
import { refsHoverTooltip } from './tooltip';
const editorSetup: BasicSetupOptions = {
highlightSpecialChars: false,
history: true,
drawSelection: true,
syntaxHighlighting: false,
defaultKeymap: true,
historyKeymap: true,
lineNumbers: false,
highlightActiveLineGutter: false,
foldGutter: false,
dropCursor: true,
allowMultipleSelections: false,
indentOnInput: false,
bracketMatching: false,
closeBrackets: false,
autocompletion: false,
rectangularSelection: false,
crosshairCursor: false,
highlightActiveLine: false,
highlightSelectionMatches: false,
closeBracketsKeymap: false,
searchKeymap: false,
foldKeymap: false,
completionKeymap: false,
lintKeymap: false
};
interface RefsInputInputProps
extends Pick<
ReactCodeMirrorProps,
@ -117,7 +89,6 @@ export const RefsInput = forwardRef<ReactCodeMirrorRef, RefsInputInputProps>(
fontFamily: 'inherit',
background: !disabled ? APP_COLORS.bgInput : APP_COLORS.bgDefault,
foreground: APP_COLORS.fgDefault,
selection: APP_COLORS.bgHover,
caret: APP_COLORS.fgDefault
},
styles: [
@ -225,3 +196,32 @@ export const RefsInput = forwardRef<ReactCodeMirrorRef, RefsInputInputProps>(
);
}
);
// ======= Internal ==========
const editorSetup: BasicSetupOptions = {
highlightSpecialChars: false,
history: true,
drawSelection: false,
syntaxHighlighting: false,
defaultKeymap: true,
historyKeymap: true,
lineNumbers: false,
highlightActiveLineGutter: false,
foldGutter: false,
dropCursor: true,
allowMultipleSelections: false,
indentOnInput: false,
bracketMatching: false,
closeBrackets: false,
autocompletion: false,
rectangularSelection: false,
crosshairCursor: false,
highlightActiveLine: false,
highlightSelectionMatches: false,
closeBracketsKeymap: false,
searchKeymap: false,
foldKeymap: false,
completionKeymap: false,
lintKeymap: false
};

View File

@ -81,7 +81,6 @@ export const RSInput = forwardRef<ReactCodeMirrorRef, RSInputProps>(
fontFamily: 'inherit',
background: !disabled ? APP_COLORS.bgInput : APP_COLORS.bgDefault,
foreground: APP_COLORS.fgDefault,
selection: APP_COLORS.bgHover,
caret: APP_COLORS.fgDefault
},
styles: [
@ -184,7 +183,7 @@ export const RSInput = forwardRef<ReactCodeMirrorRef, RSInputProps>(
const editorSetup: BasicSetupOptions = {
highlightSpecialChars: false,
history: true,
drawSelection: true,
drawSelection: false,
syntaxHighlighting: false,
defaultKeymap: true,
historyKeymap: true,

View File

@ -113,7 +113,7 @@ export function FormCreateCst({ schema }: FormCreateCstProps) {
id='dlg_cst_show_comment'
tabIndex={-1}
type='button'
className='self-start cc-label text-sec-600 hover:underline'
className='self-start cc-label text-sec-600 hover:underline select-none'
onClick={() => setForceComment(true)}
>
Добавить комментарий

View File

@ -146,7 +146,7 @@ export function FormConstituenta({ disabled, id, toggleReset, schema, activeCst,
) : null}
<div className='absolute z-pop top-0 left-[calc(7ch+4px+3rem)] flex select-none'>
<div className='pt-1 text-sm font-medium whitespace-nowrap select-text cursor-default'>
<div className='pt-1 text-sm font-medium min-w-16 whitespace-nowrap select-text cursor-default'>
<span>Имя </span>
<span className='ml-1'>{activeCst?.alias ?? ''}</span>
</div>
@ -264,7 +264,7 @@ export function FormConstituenta({ disabled, id, toggleReset, schema, activeCst,
<button
type='button'
tabIndex={-1}
className='self-start cc-label text-sec-600 hover:underline'
className='self-start cc-label text-sec-600 hover:underline select-none'
onClick={() => setForceComment(true)}
>
Добавить комментарий

View File

@ -41,9 +41,7 @@ export const APP_COLORS = {
fgOrange: 'var(--acc-fg-orange)'
}
/**
* Represents Select component theme.
*/
/** Represents Select component theme. */
export const SELECT_THEME = {
primary: APP_COLORS.bgPrimary,
primary75: APP_COLORS.bgSelected,

View File

@ -19,6 +19,15 @@
z-index: 100;
}
.cm-selectionBackground {
background: highlight !important;
}
.cm-content ::selection {
background: highlight !important;
color: highlighttext !important;
}
.cm-editor {
resize: vertical;
overflow-y: auto;
@ -43,6 +52,8 @@
.cm-editor .cm-placeholder {
font-family: var(--font-main);
color: var(--clr-prim-600);
user-select: none;
-webkit-user-select: none;
}
.react-flow__handle {

View File

@ -94,16 +94,9 @@
outline-color: transparent;
}
::selection {
background: var(--clr-sec-100);
}
tr:hover ::selection {
background: var(--clr-warn-100);
}
::placeholder {
color: var(--clr-prim-600);
user-select: none;
}
/* Wrapping headers */