Просмотр исходного кода

Use "*:placeholder" as placeholder label (#27520)

GitOrigin-RevId: eb6566e8cab401675df21a54d0b1035fd6e8a8df
Alf Eaton 1 год назад
Родитель
Сommit
677ebf3590

+ 2 - 2
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}

+ 1 - 1
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

+ 2 - 2
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}`,
   ],
   [

+ 6 - 6
services/web/test/frontend/features/source-editor/components/codemirror-editor-figure-modal.spec.tsx

@@ -130,7 +130,7 @@ describe('<FigureModal />', 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('<FigureModal />', 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('<FigureModal />', 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('<FigureModal />', 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('<FigureModal />', 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('<FigureModal />', 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}'
       )
     })