mirror of
https://github.com/langgenius/dify.git
synced 2026-05-02 08:28:03 +08:00
refactor: move to modern monaco (#32966)
This commit is contained in:
@ -146,6 +146,16 @@ describe('isEventTargetInputArea', () => {
|
||||
expect(isEventTargetInputArea(el)).toBe(true)
|
||||
})
|
||||
|
||||
it('should return true for monaco editor descendants', () => {
|
||||
const wrapper = document.createElement('div')
|
||||
wrapper.className = 'monaco-editor'
|
||||
const child = document.createElement('div')
|
||||
wrapper.appendChild(child)
|
||||
document.body.appendChild(wrapper)
|
||||
expect(isEventTargetInputArea(child)).toBe(true)
|
||||
wrapper.remove()
|
||||
})
|
||||
|
||||
it('should return undefined for non-input elements', () => {
|
||||
const el = document.createElement('div')
|
||||
expect(isEventTargetInputArea(el)).toBeUndefined()
|
||||
|
||||
@ -32,6 +32,9 @@ export const isEventTargetInputArea = (target: HTMLElement) => {
|
||||
|
||||
if (target.contentEditable === 'true')
|
||||
return true
|
||||
|
||||
if (target.closest?.('.monaco-editor, .monaco-diff-editor'))
|
||||
return true
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user