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