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

[visual] Decorate backslash-prefixed dollar sign (#14552)

GitOrigin-RevId: 3d846eeb1a25051b794a3673e9f48ac7fe4b2cbf
Alf Eaton 3 лет назад
Родитель
Сommit
a0347c53f0

+ 1 - 0
services/web/frontend/js/features/source-editor/extensions/visual/visual-widgets/character.ts

@@ -35,6 +35,7 @@ const SUBSTITUTIONS = new Map([
   ['\\&', '\u0026'],
   ['\\#', '\u0023'],
   ['\\{', '\u007B'],
+  ['\\$', '\u0024'],
   ['\\textasciicircum', '\u005E'],
   ['\\textless', '\u003C'],
   ['\\textasciitilde', '\u007E'],

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

@@ -626,6 +626,12 @@ describe('<CodeMirrorEditor/> in Visual mode', function () {
       cy.get('@first-line').should('have.text', 'Test~test')
     })
 
+    it('decorates a backslash-prefixed dollar sign with a dollar sign', function () {
+      cy.get('@first-line').type('\\$5.00')
+      cy.get('@first-line').should('have.text', '$5.00')
+      cy.get('.ol-cm-character').should('have.length', 1)
+    })
+
     it('decorates line breaks', function () {
       cy.get('@first-line').type('Test \\\\ test')
       cy.get('@second-line').click()