Merge pull request #23940 from overleaf/td-react-18

Upgrade to React 18

GitOrigin-RevId: 9b81936e6eea2bccd97fe5c2c5841f0b946371b8
This commit is contained in:
Tim Down
2025-05-02 08:05:29 +00:00
committed by Copybot
parent 4464320757
commit 7abafb01ea
213 changed files with 2469 additions and 2105 deletions
@@ -307,7 +307,7 @@ describe('autocomplete', { scrollBehavior: false }, function () {
packageNames: new Set(['foo']),
}
const MetadataProvider: FC = ({ children }) => {
const MetadataProvider: FC<React.PropsWithChildren> = ({ children }) => {
return (
<MetadataContext.Provider value={metadata}>
{children}
@@ -376,7 +376,7 @@ describe('autocomplete', { scrollBehavior: false }, function () {
const scope = mockScope()
const ReferencesProvider: FC = ({ children }) => {
const ReferencesProvider: FC<React.PropsWithChildren> = ({ children }) => {
return (
<ReferencesContext.Provider
value={{
@@ -728,7 +728,7 @@ describe('autocomplete', { scrollBehavior: false }, function () {
packageNames: new Set<string>('amsmath'),
}
const MetadataProvider: FC = ({ children }) => {
const MetadataProvider: FC<React.PropsWithChildren> = ({ children }) => {
return (
<MetadataContext.Provider value={metadata}>
{children}
@@ -43,7 +43,9 @@ describe('<FigureModal />', function () {
const scope = mockScope(content)
scope.editor.showVisual = true
const FileTreePathProvider: FC = ({ children }) => (
const FileTreePathProvider: FC<React.PropsWithChildren> = ({
children,
}) => (
<FileTreePathContext.Provider
value={{
dirname: cy.stub(),
@@ -545,7 +547,7 @@ describe('<FigureModal />', function () {
cy.findByText('Done').click()
cy.get('.cm-content').should(
'have.text',
'\\begin{figure}\\centering\\end{figure}'
'\\begin{figure}\\centering\\includegraphics[width=0.75\\linewidth]{frog.jpg}\\end{figure}'
)
})
@@ -567,7 +569,7 @@ describe('<FigureModal />', function () {
cy.findByText('Done').click()
cy.get('.cm-content').should(
'have.text',
'\\begin{figure}\\centering🏷fig:my-label\\end{figure}'
'\\begin{figure}\\centering\\includegraphics[width=0.75\\linewidth]{frog.jpg}🏷fig:my-label\\end{figure}'
)
})
@@ -178,7 +178,9 @@ cell 3 & cell 4 \\\\
})
it('Adds and removes borders when theme is changed', function () {
// Add a blank line above the table to allow room for the table toolbar
mountEditor(`
\\begin{tabular}{c|c}
cell 1 & cell 2 \\\\
cell 3 & cell 4 \\\\
@@ -216,7 +218,9 @@ cell 3 & cell 4 \\\\
})
it('Changes the column alignment with dropdown buttons', function () {
// Add a blank line above the table to allow room for the table toolbar
mountEditor(`
\\begin{tabular}{cc}
cell 1 & cell 2 \\\\
cell 3 & cell 4 \\\\
@@ -269,7 +273,9 @@ cell 3 & cell 4 \\\\
})
it('Removes rows and columns', function () {
// Add a blank line above the table to allow room for the table toolbar
mountEditor(`
\\begin{tabular}{|c|c|c|}
\\hline
cell 1 & cell 2 & cell 3 \\\\ \\hline
@@ -304,7 +310,9 @@ cell 3 & cell 4 \\\\
})
it('Removes rows correctly when removing from the left', function () {
// Add a blank line above the table to allow room for the table toolbar
mountEditor(`
\\begin{tabular}{|c|c|c|}\\hline
cell 1&cell 2&cell 3 \\\\\\hline
\\end{tabular}
@@ -324,7 +332,9 @@ cell 3 & cell 4 \\\\
})
it('Merges and unmerged cells', function () {
// Add a blank line above the table to allow room for the table toolbar
mountEditor(`
\\begin{tabular}{ccc}
cell 1 & cell 2 & cell 3 \\\\
cell 4 & cell 5 & cell 6 \\\\
@@ -333,6 +343,7 @@ cell 3 & cell 4 \\\\
cy.get('.table-generator-cell').first().click()
cy.get('.table-generator-cell').first().type('{shift}{rightarrow}')
cy.get('.table-generator-floating-toolbar').as('toolbar').should('exist')
cy.get('@toolbar').scrollIntoView()
cy.get('@toolbar').findByLabelText('Merge cells').click()
checkTable([
[{ text: 'cell 1 cell 2', colspan: 2 }, 'cell 3'],
@@ -346,7 +357,9 @@ cell 3 & cell 4 \\\\
})
it('Adds rows and columns', function () {
// Add a blank line above the table to allow room for the table toolbar
mountEditor(`
\\begin{tabular}{c}
cell 1
\\end{tabular}
@@ -398,7 +411,9 @@ cell 3 & cell 4 \\\\
})
it('Removes the table on toolbar button click', function () {
// Add a blank line above the table to allow room for the table toolbar
mountEditor(`
\\begin{tabular}{c}
cell 1
\\end{tabular}`)
@@ -409,7 +424,9 @@ cell 3 & cell 4 \\\\
})
it('Moves the caption when using dropdown', function () {
// Add a blank line above the table to allow room for the table toolbar
mountEditor(`
\\begin{table}
\\caption{Table caption}
\\label{tab:table}
@@ -456,7 +473,9 @@ cell 3 & cell 4 \\\\
})
it('Renders a table with custom column spacing', function () {
// Add a blank line above the table to allow room for the table toolbar
mountEditor(`
\\begin{tabular}{@{}c@{}l!{}}
cell 1 & cell 2 \\\\
cell 3 & cell 4 \\\\
@@ -498,8 +517,10 @@ cell 3 & cell 4 \\\\
describe('Fixed width columns', function () {
it('Can add fixed width columns', function () {
// Add a blank line above the table to allow room for the table toolbar
// Check that no column indicators exist
mountEditor(`
\\begin{tabular}{cc}
cell 1 & cell 2\\\\
cell 3 & cell 4 \\\\
@@ -574,9 +595,11 @@ cell 3 & cell 4 \\\\
}
)
it(`It can justify fixed width cells`, function () {
it(`Can justify fixed width cells`, function () {
// Add a blank line above the table to allow room for the table toolbar
// Check that no column indicators exist
mountEditor(`
\\begin{tabular}{>{\\raggedright\\arraybackslash}p{2cm}c}
cell 1 & cell 2\\\\
cell 3 & cell 4 \\\\
@@ -6,7 +6,7 @@ import { FileTreePathContext } from '@/features/file-tree/contexts/file-tree-pat
import { TestContainer } from '../helpers/test-container'
import { PermissionsContext } from '@/features/ide-react/context/permissions-context'
const FileTreePathProvider: FC = ({ children }) => (
const FileTreePathProvider: FC<React.PropsWithChildren> = ({ children }) => (
<FileTreePathContext.Provider
value={{
dirname: cy.stub(),
@@ -22,7 +22,7 @@ const FileTreePathProvider: FC = ({ children }) => (
</FileTreePathContext.Provider>
)
const PermissionsProvider: FC = ({ children }) => (
const PermissionsProvider: FC<React.PropsWithChildren> = ({ children }) => (
<PermissionsContext.Provider
value={{
read: true,
@@ -21,7 +21,9 @@ describe('<CodeMirrorEditor/> in Visual mode', function () {
const scope = mockScope(content)
scope.editor.showVisual = true
const FileTreePathProvider: FC = ({ children }) => (
const FileTreePathProvider: FC<React.PropsWithChildren> = ({
children,
}) => (
<FileTreePathContext.Provider
value={{
dirname: cy.stub(),
@@ -216,7 +216,7 @@ describe('<CodeMirrorEditor/>', { scrollBehavior: false }, function () {
onlineUsersCount: 3,
}
const OnlineUsersProvider: FC = ({ children }) => {
const OnlineUsersProvider: FC<React.PropsWithChildren> = ({ children }) => {
return (
<OnlineUsersContext.Provider value={value}>
{children}