mirror of
https://github.com/IRBorisov/ConceptPortal.git
synced 2025-06-26 04:50:36 +03:00
R: Remove redundant font option
This commit is contained in:
parent
ceba6b882f
commit
9b87120b1e
|
@ -10,7 +10,6 @@ import { forwardRef, useCallback, useMemo, useRef } from 'react';
|
|||
|
||||
import Label from '@/components/ui/Label';
|
||||
import { useConceptOptions } from '@/context/ConceptOptionsContext';
|
||||
import { getFontClassName } from '@/models/miscellaneousAPI';
|
||||
import { ConstituentaID, IRSForm } from '@/models/rsform';
|
||||
import { generateAlias, getCstTypePrefix, guessCstType } from '@/models/rsformAPI';
|
||||
import { extractGlobals } from '@/models/rslangAPI';
|
||||
|
@ -64,7 +63,7 @@ const RSInput = forwardRef<ReactCodeMirrorRef, RSInputProps>(
|
|||
},
|
||||
ref
|
||||
) => {
|
||||
const { darkMode, colors, mathFont } = useConceptOptions();
|
||||
const { darkMode, colors } = useConceptOptions();
|
||||
|
||||
const internalRef = useRef<ReactCodeMirrorRef>(null);
|
||||
const thisRef = useMemo(() => (!ref || typeof ref === 'function' ? internalRef : ref), [internalRef, ref]);
|
||||
|
@ -152,7 +151,7 @@ const RSInput = forwardRef<ReactCodeMirrorRef, RSInputProps>(
|
|||
<div className={clsx('flex flex-col gap-2', className, cursor)} style={style}>
|
||||
<Label text={label} />
|
||||
<CodeMirror
|
||||
className={getFontClassName(mathFont)}
|
||||
className={'font-math'}
|
||||
id={id}
|
||||
ref={thisRef}
|
||||
basicSetup={editorSetup}
|
||||
|
|
|
@ -83,7 +83,7 @@ function PickMultiConstituenta({ id, schema, prefixID, rows, selected, setSelect
|
|||
<ToolbarGraphSelection
|
||||
graph={schema.graph}
|
||||
isCore={cstID => isBasicConcept(schema.cstByID.get(cstID)?.cst_type)}
|
||||
isOwned={cstID => !schema.cstByID.get(cstID)?.is_inherited ?? false}
|
||||
isOwned={cstID => !schema.cstByID.get(cstID)?.is_inherited}
|
||||
setSelected={setSelected}
|
||||
emptySelection={selected.length === 0}
|
||||
className='w-full ml-8'
|
||||
|
|
|
@ -5,7 +5,6 @@ import { createContext, useCallback, useContext, useLayoutEffect, useMemo, useSt
|
|||
|
||||
import Tooltip from '@/components/ui/Tooltip';
|
||||
import useLocalStorage from '@/hooks/useLocalStorage';
|
||||
import { FontStyle } from '@/models/miscellaneous';
|
||||
import { animationDuration } from '@/styling/animations';
|
||||
import { darkT, IColorTheme, lightT } from '@/styling/color';
|
||||
import { globals, storage } from '@/utils/constants';
|
||||
|
@ -23,9 +22,6 @@ interface IOptionsContext {
|
|||
adminMode: boolean;
|
||||
toggleAdminMode: () => void;
|
||||
|
||||
mathFont: FontStyle;
|
||||
setMathFont: (value: FontStyle) => void;
|
||||
|
||||
noNavigationAnimation: boolean;
|
||||
noNavigation: boolean;
|
||||
toggleNoNavigation: () => void;
|
||||
|
@ -58,7 +54,6 @@ interface OptionsStateProps {
|
|||
export const OptionsState = ({ children }: OptionsStateProps) => {
|
||||
const [darkMode, setDarkMode] = useLocalStorage(storage.themeDark, false);
|
||||
const [adminMode, setAdminMode] = useLocalStorage(storage.optionsAdmin, false);
|
||||
const [mathFont, setMathFont] = useLocalStorage<FontStyle>(storage.rseditFont, 'math');
|
||||
const [showHelp, setShowHelp] = useLocalStorage(storage.optionsHelp, true);
|
||||
const [noNavigation, setNoNavigation] = useState(false);
|
||||
|
||||
|
@ -128,8 +123,6 @@ export const OptionsState = ({ children }: OptionsStateProps) => {
|
|||
darkMode,
|
||||
adminMode,
|
||||
colors,
|
||||
mathFont,
|
||||
setMathFont,
|
||||
noNavigationAnimation,
|
||||
noNavigation,
|
||||
noFooter,
|
||||
|
|
|
@ -55,11 +55,6 @@ export type GraphColoring = 'none' | 'status' | 'type';
|
|||
*/
|
||||
export type GraphSizing = 'none' | 'complex' | 'derived';
|
||||
|
||||
/**
|
||||
* Represents font styles.
|
||||
*/
|
||||
export type FontStyle = 'controls' | 'main' | 'math' | 'math2';
|
||||
|
||||
/**
|
||||
* Represents manuals topic.
|
||||
*/
|
||||
|
|
|
@ -1,16 +1,9 @@
|
|||
/**
|
||||
* Module: API for miscellaneous frontend model types. Future targets for refactoring aimed at extracting modules.
|
||||
*/
|
||||
import { DependencyMode, FontStyle, GraphSizing } from './miscellaneous';
|
||||
import { DependencyMode, GraphSizing } from './miscellaneous';
|
||||
import { IConstituenta, IRSForm } from './rsform';
|
||||
|
||||
/**
|
||||
* Create style name from {@link FontStyle}.
|
||||
*/
|
||||
export function getFontClassName(style: FontStyle): string {
|
||||
return `font-${style}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter list of {@link ILibraryItem} to a given graph query.
|
||||
*/
|
||||
|
|
|
@ -15,7 +15,6 @@ import {
|
|||
IconSave,
|
||||
IconSettings,
|
||||
IconStatusOK,
|
||||
IconText,
|
||||
IconTree
|
||||
} from '@/components/Icons';
|
||||
import LinkTopic from '@/components/ui/LinkTopic';
|
||||
|
@ -88,9 +87,6 @@ function HelpRSEditor() {
|
|||
<li>
|
||||
<IconStatusOK className='inline-icon' /> индикатор статуса определения сверху
|
||||
</li>
|
||||
<li>
|
||||
<IconText className='inline-icon' /> переключение шрифта
|
||||
</li>
|
||||
<li>
|
||||
<IconControls className='inline-icon' /> специальная клавиатура и горячие клавиши
|
||||
</li>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import { IconControls, IconText, IconTextOff, IconTree } from '@/components/Icons';
|
||||
import { IconControls, IconTree } from '@/components/Icons';
|
||||
import MiniButton from '@/components/ui/MiniButton';
|
||||
import Overlay from '@/components/ui/Overlay';
|
||||
import { useConceptOptions } from '@/context/ConceptOptionsContext';
|
||||
import { useRSForm } from '@/context/RSFormContext';
|
||||
|
||||
interface ToolbarRSExpressionProps {
|
||||
|
@ -14,21 +13,9 @@ interface ToolbarRSExpressionProps {
|
|||
|
||||
function ToolbarRSExpression({ disabled, showControls, toggleControls, showAST }: ToolbarRSExpressionProps) {
|
||||
const model = useRSForm();
|
||||
const { mathFont, setMathFont } = useConceptOptions();
|
||||
|
||||
function toggleFont() {
|
||||
setMathFont(mathFont === 'math' ? 'math2' : 'math');
|
||||
}
|
||||
|
||||
return (
|
||||
<Overlay position='top-[-0.5rem] right-0' className='cc-icons'>
|
||||
<MiniButton
|
||||
title='Изменить шрифт'
|
||||
onClick={toggleFont}
|
||||
icon={
|
||||
mathFont === 'math' ? <IconText size='1.25rem' className='icon-primary' /> : <IconTextOff size='1.25rem' />
|
||||
}
|
||||
/>
|
||||
{!disabled || model.processing ? (
|
||||
<MiniButton
|
||||
title='Отображение специальной клавиатуры'
|
||||
|
|
|
@ -325,7 +325,7 @@ function EditorTermGraph({ onOpenEdit }: EditorTermGraphProps) {
|
|||
<ToolbarGraphSelection
|
||||
graph={controller.schema!.graph}
|
||||
isCore={cstID => isBasicConcept(controller.schema?.cstByID.get(cstID)?.cst_type)}
|
||||
isOwned={cstID => !controller.schema?.cstByID.get(cstID)?.is_inherited ?? false}
|
||||
isOwned={cstID => !controller.schema?.cstByID.get(cstID)?.is_inherited}
|
||||
setSelected={controller.setSelected}
|
||||
emptySelection={controller.selected.length === 0}
|
||||
/>
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
--font-ui: 'Alegreya Sans SC', 'Rubik', 'Segoe UI Symbol', sans-serif;
|
||||
--font-main: 'Rubik', 'Fira Code', 'Noto Sans Math', 'Noto Sans Symbols 2', 'Segoe UI Symbol', sans-serif;
|
||||
--font-math: 'Fira Code', 'Noto Sans Math', 'Noto Sans Symbols 2', 'Rubik', 'Segoe UI Symbol', sans-serif;
|
||||
--font-math2: 'Noto Sans Math', 'Noto Sans Symbols 2', 'Rubik', 'Segoe UI Symbol', sans-serif;
|
||||
|
||||
/* Light Theme */
|
||||
--cl-bg-120: hsl(000, 000%, 100%);
|
||||
|
|
|
@ -18,9 +18,6 @@
|
|||
.font-math {
|
||||
font-family: var(--font-math);
|
||||
}
|
||||
.font-math2 {
|
||||
font-family: var(--font-math2);
|
||||
}
|
||||
}
|
||||
|
||||
@layer components {
|
||||
|
|
|
@ -102,7 +102,6 @@ export const storage = {
|
|||
optionsAdmin: 'options.admin',
|
||||
optionsHelp: 'options.help',
|
||||
|
||||
rseditFont: 'rsedit.font',
|
||||
rseditShowList: 'rsedit.show_list',
|
||||
rseditShowControls: 'rsedit.show_controls',
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user