mirror of
https://github.com/stablyai/orca.git
synced 2026-10-30 16:47:34 +00:00
fix(editor): suppress ambiguous Unicode highlights in Markdown (#36009)
This commit is contained in:
@@ -144,3 +144,34 @@ describe('MonacoEditor system theme', () => {
|
||||
expect(editorProps.current?.theme).toBe('vs')
|
||||
})
|
||||
})
|
||||
|
||||
it('updates Unicode highlighting when the editor language changes', () => {
|
||||
installMatchMedia(false)
|
||||
const props = {
|
||||
fileId: 'file',
|
||||
filePath: '/repo/file.md',
|
||||
viewStateKey: 'pane:file',
|
||||
relativePath: 'file.md',
|
||||
content: '中文说明:( example )\u200b',
|
||||
onContentChange: vi.fn(),
|
||||
onSave: vi.fn()
|
||||
}
|
||||
const view = render(<MonacoEditor {...props} language="markdown" />)
|
||||
expect(editorProps.current?.options).toEqual(
|
||||
expect.objectContaining({
|
||||
unicodeHighlight: { ambiguousCharacters: false, invisibleCharacters: true }
|
||||
})
|
||||
)
|
||||
view.rerender(<MonacoEditor {...props} language="typescript" />)
|
||||
expect(editorProps.current?.options).toEqual(
|
||||
expect.objectContaining({
|
||||
unicodeHighlight: { ambiguousCharacters: true, invisibleCharacters: true }
|
||||
})
|
||||
)
|
||||
view.rerender(<MonacoEditor {...props} language="markdown" />)
|
||||
expect(editorProps.current?.options).toEqual(
|
||||
expect.objectContaining({
|
||||
unicodeHighlight: { ambiguousCharacters: false, invisibleCharacters: true }
|
||||
})
|
||||
)
|
||||
})
|
||||
|
||||
@@ -306,6 +306,10 @@ export default function MonacoEditor({
|
||||
lineNumbers: 'on',
|
||||
renderLineHighlight: 'line',
|
||||
automaticLayout: true,
|
||||
unicodeHighlight: {
|
||||
ambiguousCharacters: language !== 'markdown',
|
||||
invisibleCharacters: true
|
||||
},
|
||||
tabSize: 2,
|
||||
readOnly,
|
||||
scrollbar: autoHeight
|
||||
|
||||
Reference in New Issue
Block a user