From caa446f9335c5255c202bcd097a38e3673d539af Mon Sep 17 00:00:00 2001 From: Rebeka Dekany <50901361+rebekadekany@users.noreply.github.com> Date: Mon, 4 Nov 2024 14:36:22 +0100 Subject: [PATCH] Merge pull request #21512 from overleaf/rd-insert-link Migrate the editor command tooltips to Bootstrap 5 GitOrigin-RevId: 9e3b477608e334e6e8bc0e79710cd2b3878680e6 --- .../command-tooltip/href-tooltip.tsx | 54 ++++++++++++------- .../command-tooltip/include-tooltip.tsx | 15 ++++-- .../command-tooltip/input-tooltip.tsx | 15 ++++-- .../command-tooltip/ref-tooltip.tsx | 15 ++++-- .../command-tooltip/url-tooltip.tsx | 15 ++++-- .../figure-modal-upload-source.tsx | 15 +----- .../ui/components/ol/ol-form-control.tsx | 1 + 7 files changed, 77 insertions(+), 53 deletions(-) diff --git a/services/web/frontend/js/features/source-editor/components/command-tooltip/href-tooltip.tsx b/services/web/frontend/js/features/source-editor/components/command-tooltip/href-tooltip.tsx index 7f26d5f391..d183c27fef 100644 --- a/services/web/frontend/js/features/source-editor/components/command-tooltip/href-tooltip.tsx +++ b/services/web/frontend/js/features/source-editor/components/command-tooltip/href-tooltip.tsx @@ -14,10 +14,16 @@ import { ShortTextArgument, UrlArgument, } from '../../lezer-latex/latex.terms.mjs' -import { Button, ControlLabel, FormControl, FormGroup } from 'react-bootstrap' import Icon from '../../../../shared/components/icon' import { EditorState } from '@codemirror/state' import { openURL } from '@/features/source-editor/utils/url' +import OLFormGroup from '@/features/ui/components/ol/ol-form-group' +import OLFormLabel from '@/features/ui/components/ol/ol-form-label' +import OLFormControl from '@/features/ui/components/ol/ol-form-control' +import OLForm from '@/features/ui/components/ol/ol-form' +import OLButton from '@/features/ui/components/ol/ol-button' +import BootstrapVersionSwitcher from '@/features/ui/components/bootstrap-5/bootstrap-version-switcher' +import MaterialIcon from '@/shared/components/material-icon' export const HrefTooltipContent: FC = () => { const state = useCodeMirrorStateContext() @@ -77,16 +83,16 @@ export const HrefTooltipContent: FC = () => { return (
-
- - URL - + + URL + { + ref={element => { inputRef.current = element }} autoComplete="off" @@ -100,27 +106,31 @@ export const HrefTooltipContent: FC = () => { }} disabled={state.readOnly} /> - -
+ + - + {!state.readOnly && ( - + )}
) diff --git a/services/web/frontend/js/features/source-editor/components/command-tooltip/include-tooltip.tsx b/services/web/frontend/js/features/source-editor/components/command-tooltip/include-tooltip.tsx index 87957a48ad..9a6d024b98 100644 --- a/services/web/frontend/js/features/source-editor/components/command-tooltip/include-tooltip.tsx +++ b/services/web/frontend/js/features/source-editor/components/command-tooltip/include-tooltip.tsx @@ -1,8 +1,10 @@ import { FC } from 'react' import { useTranslation } from 'react-i18next' -import { Button } from 'react-bootstrap' import Icon from '@/shared/components/icon' import { useIncludedFile } from '@/features/source-editor/hooks/use-included-file' +import BootstrapVersionSwitcher from '@/features/ui/components/bootstrap-5/bootstrap-version-switcher' +import MaterialIcon from '@/shared/components/material-icon' +import OLButton from '@/features/ui/components/ol/ol-button' export const IncludeTooltipContent: FC = () => { const { t } = useTranslation() @@ -10,15 +12,18 @@ export const IncludeTooltipContent: FC = () => { return (
- +
) } diff --git a/services/web/frontend/js/features/source-editor/components/command-tooltip/input-tooltip.tsx b/services/web/frontend/js/features/source-editor/components/command-tooltip/input-tooltip.tsx index 332e02a1ac..fb3f78b191 100644 --- a/services/web/frontend/js/features/source-editor/components/command-tooltip/input-tooltip.tsx +++ b/services/web/frontend/js/features/source-editor/components/command-tooltip/input-tooltip.tsx @@ -1,8 +1,10 @@ import { FC } from 'react' import { useTranslation } from 'react-i18next' -import { Button } from 'react-bootstrap' import Icon from '@/shared/components/icon' import { useIncludedFile } from '@/features/source-editor/hooks/use-included-file' +import OLButton from '@/features/ui/components/ol/ol-button' +import BootstrapVersionSwitcher from '@/features/ui/components/bootstrap-5/bootstrap-version-switcher' +import MaterialIcon from '@/shared/components/material-icon' export const InputTooltipContent: FC = () => { const { t } = useTranslation() @@ -10,15 +12,18 @@ export const InputTooltipContent: FC = () => { return (
- +
) } diff --git a/services/web/frontend/js/features/source-editor/components/command-tooltip/ref-tooltip.tsx b/services/web/frontend/js/features/source-editor/components/command-tooltip/ref-tooltip.tsx index 6e80513741..feab52ce87 100644 --- a/services/web/frontend/js/features/source-editor/components/command-tooltip/ref-tooltip.tsx +++ b/services/web/frontend/js/features/source-editor/components/command-tooltip/ref-tooltip.tsx @@ -4,7 +4,6 @@ import { useCodeMirrorStateContext, useCodeMirrorViewContext, } from '../codemirror-context' -import { Button } from 'react-bootstrap' import { resolveCommandNode } from '../../extensions/command-tooltip' import { LabelArgument, @@ -21,6 +20,9 @@ import { } from '@codemirror/state' import { EditorView } from '@codemirror/view' import Icon from '../../../../shared/components/icon' +import OLButton from '@/features/ui/components/ol/ol-button' +import BootstrapVersionSwitcher from '@/features/ui/components/bootstrap-5/bootstrap-version-switcher' +import MaterialIcon from '@/shared/components/material-icon' export const RefTooltipContent: FC = () => { const { t } = useTranslation() @@ -29,9 +31,9 @@ export const RefTooltipContent: FC = () => { return (
- +
) } diff --git a/services/web/frontend/js/features/source-editor/components/command-tooltip/url-tooltip.tsx b/services/web/frontend/js/features/source-editor/components/command-tooltip/url-tooltip.tsx index 7034c286ea..37c6b13943 100644 --- a/services/web/frontend/js/features/source-editor/components/command-tooltip/url-tooltip.tsx +++ b/services/web/frontend/js/features/source-editor/components/command-tooltip/url-tooltip.tsx @@ -1,7 +1,6 @@ import { FC } from 'react' import { useTranslation } from 'react-i18next' import { useCodeMirrorStateContext } from '../codemirror-context' -import { Button } from 'react-bootstrap' import { resolveCommandNode } from '../../extensions/command-tooltip' import { LiteralArgContent, @@ -10,6 +9,9 @@ import { import Icon from '../../../../shared/components/icon' import { EditorState } from '@codemirror/state' import { openURL } from '@/features/source-editor/utils/url' +import OLButton from '@/features/ui/components/ol/ol-button' +import BootstrapVersionSwitcher from '@/features/ui/components/bootstrap-5/bootstrap-version-switcher' +import MaterialIcon from '@/shared/components/material-icon' export const UrlTooltipContent: FC = () => { const { t } = useTranslation() @@ -17,9 +19,9 @@ export const UrlTooltipContent: FC = () => { return (
- +
) } diff --git a/services/web/frontend/js/features/source-editor/components/figure-modal/file-sources/figure-modal-upload-source.tsx b/services/web/frontend/js/features/source-editor/components/figure-modal/file-sources/figure-modal-upload-source.tsx index 629c6c79e7..056a4d562e 100644 --- a/services/web/frontend/js/features/source-editor/components/figure-modal/file-sources/figure-modal-upload-source.tsx +++ b/services/web/frontend/js/features/source-editor/components/figure-modal/file-sources/figure-modal-upload-source.tsx @@ -20,8 +20,8 @@ import OLFormGroup from '@/features/ui/components/ol/ol-form-group' import OLButton from '@/features/ui/components/ol/ol-button' import BootstrapVersionSwitcher from '@/features/ui/components/bootstrap-5/bootstrap-version-switcher' import MaterialIcon from '@/shared/components/material-icon' -import { Spinner } from 'react-bootstrap-5' import { isBootstrap5 } from '@/features/utils/bootstrap-5' +import OLSpinner from '@/features/ui/components/ol/ol-spinner' /* eslint-disable no-unused-vars */ export enum FileUploadStatus { @@ -297,18 +297,7 @@ export const FileContainer: FC<{ })} > {status === FileUploadStatus.UPLOADING ? ( - } - bs5={ -