From 677ebf359017b5e6ddd41e56cf1b8d2efe8969ff Mon Sep 17 00:00:00 2001 From: Alf Eaton Date: Thu, 31 Jul 2025 14:05:21 +0100 Subject: [PATCH] Use "*:placeholder" as placeholder label (#27520) GitOrigin-RevId: eb6566e8cab401675df21a54d0b1035fd6e8a8df --- .../components/figure-modal/figure-modal.tsx | 4 ++-- .../source-editor/extensions/toolbar/commands.ts | 2 +- .../languages/latex/completions/data/environments.ts | 4 ++-- .../codemirror-editor-figure-modal.spec.tsx | 12 ++++++------ 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/services/web/frontend/js/features/source-editor/components/figure-modal/figure-modal.tsx b/services/web/frontend/js/features/source-editor/components/figure-modal/figure-modal.tsx index b392b7e627..a74962f4b3 100644 --- a/services/web/frontend/js/features/source-editor/components/figure-modal/figure-modal.tsx +++ b/services/web/frontend/js/features/source-editor/components/figure-modal/figure-modal.tsx @@ -155,7 +155,7 @@ const FigureModalContent = () => { dispatch({ error: String(error) }) return } - const labelCommand = includeLabel ? '\\label{fig:enter-label}' : '' + const labelCommand = includeLabel ? '\\label{fig:placeholder}' : '' const captionCommand = includeCaption ? '\\caption{Enter Caption}' : '' if (figure) { @@ -228,7 +228,7 @@ const FigureModalContent = () => { const widthArgument = width !== undefined ? `[width=${width}\\linewidth]` : '' const caption = includeCaption ? `\n\t\\caption{\${Enter Caption}}` : '' - const label = includeLabel ? `\n\t\\label{\${fig:enter-label}}` : '' + const label = includeLabel ? `\n\t\\label{\${fig:placeholder}}` : '' snippet( `\\begin{figure} diff --git a/services/web/frontend/js/features/source-editor/extensions/toolbar/commands.ts b/services/web/frontend/js/features/source-editor/extensions/toolbar/commands.ts index 7b1b05369c..fad9ba0e61 100644 --- a/services/web/frontend/js/features/source-editor/extensions/toolbar/commands.ts +++ b/services/web/frontend/js/features/source-editor/extensions/toolbar/commands.ts @@ -86,7 +86,7 @@ ${( '\\\\\n' ).repeat(sizeY)}\t\\end{tabular} \t\\caption{Caption} -\t\\label{tab:my_label} +\t\\label{tab:placeholder} \\end{table}${suffix}` snippet(template)({ state, dispatch }, { label: 'Table' }, pos, pos) return true diff --git a/services/web/frontend/js/features/source-editor/languages/latex/completions/data/environments.ts b/services/web/frontend/js/features/source-editor/languages/latex/completions/data/environments.ts index 0d32962563..df82a3a315 100644 --- a/services/web/frontend/js/features/source-editor/languages/latex/completions/data/environments.ts +++ b/services/web/frontend/js/features/source-editor/languages/latex/completions/data/environments.ts @@ -39,7 +39,7 @@ export const environments = new Map([ \t\\centering \t\\includegraphics[width=0.5\\linewidth]{$1} \t\\caption{\${2:Caption}} -\t\\label{\${3:fig:enter-label}} +\t\\label{\${3:fig:placeholder}} \\end{figure}`, ], [ @@ -69,7 +69,7 @@ export const environments = new Map([ \t\t$5 & $6 \t\\end{tabular} \t\\caption{\${7:Caption}} -\t\\label{\${8:tab:my_label}} +\t\\label{\${8:tab:placeholder}} \\end{table}`, ], [ diff --git a/services/web/test/frontend/features/source-editor/components/codemirror-editor-figure-modal.spec.tsx b/services/web/test/frontend/features/source-editor/components/codemirror-editor-figure-modal.spec.tsx index 22a99e1fc7..696b6fd1d8 100644 --- a/services/web/test/frontend/features/source-editor/components/codemirror-editor-figure-modal.spec.tsx +++ b/services/web/test/frontend/features/source-editor/components/codemirror-editor-figure-modal.spec.tsx @@ -130,7 +130,7 @@ describe('', function () { // icon, which is literal text in the document cy.get('.cm-content').should( 'have.text', - '\\begin{figure} \\centeringedit \\caption{Enter Caption} 🏷fig:enter-label\\end{figure}' + '\\begin{figure} \\centeringedit \\caption{Enter Caption} 🏷fig:placeholder\\end{figure}' ) }) @@ -179,7 +179,7 @@ describe('', function () { // icon, which is literal text in the document cy.get('.cm-content').should( 'have.text', - '\\begin{figure} \\centeringedit \\caption{Enter Caption} 🏷fig:enter-label\\end{figure}' + '\\begin{figure} \\centeringedit \\caption{Enter Caption} 🏷fig:placeholder\\end{figure}' ) }) }) @@ -267,7 +267,7 @@ describe('', function () { // icon, which is literal text in the document cy.get('.cm-content').should( 'have.text', - '\\begin{figure} \\centeringedit \\caption{Enter Caption} 🏷fig:enter-label\\end{figure}' + '\\begin{figure} \\centeringedit \\caption{Enter Caption} 🏷fig:placeholder\\end{figure}' ) }) @@ -296,7 +296,7 @@ describe('', function () { // icon, which is literal text in the document cy.get('.cm-content').should( 'have.text', - '\\begin{figure} \\centeringedit \\caption{Enter Caption} 🏷fig:enter-label\\end{figure}' + '\\begin{figure} \\centeringedit \\caption{Enter Caption} 🏷fig:placeholder\\end{figure}' ) }) }) @@ -442,7 +442,7 @@ describe('', function () { // icon, which is literal text in the document cy.get('.cm-content').should( 'have.text', - '\\begin{figure} \\centeringedit \\caption{Enter Caption} 🏷fig:enter-label\\end{figure}' + '\\begin{figure} \\centeringedit \\caption{Enter Caption} 🏷fig:placeholder\\end{figure}' ) }) @@ -471,7 +471,7 @@ describe('', function () { // icon, which is literal text in the document cy.get('.cm-content').should( 'have.text', - '\\begin{figure} \\centeringedit \\caption{My caption} 🏷fig:enter-label\\end{figure}' + '\\begin{figure} \\centeringedit \\caption{My caption} 🏷fig:placeholder\\end{figure}' ) })