mirror of
https://github.com/stablyai/orca.git
synced 2026-10-19 16:03:26 +00:00
Merge remote-tracking branch 'origin/main' into brennanb2025/native-chat-multiline-send
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import type { Dispatch, MutableRefObject, SetStateAction } from 'react'
|
||||
import type { Editor } from '@tiptap/react'
|
||||
import type { DocLinkMenuState } from './rich-markdown-commands'
|
||||
import { describe, expect, it, vi } from 'vitest'
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
import type { LinkBubbleState } from './RichMarkdownLinkBubble'
|
||||
import {
|
||||
createRichMarkdownEditorConfig,
|
||||
@@ -88,6 +88,10 @@ function createConfigParams(overrides: Partial<EditorConfigParams> = {}): Editor
|
||||
}
|
||||
|
||||
describe('createRichMarkdownEditorConfig', () => {
|
||||
afterEach(() => {
|
||||
vi.unstubAllGlobals()
|
||||
})
|
||||
|
||||
it('disables browser spellcheck when the rich Markdown setting is off', () => {
|
||||
const config = createRichMarkdownEditorConfig(
|
||||
createConfigParams({ richMarkdownSpellcheckEnabled: false })
|
||||
@@ -101,4 +105,22 @@ describe('createRichMarkdownEditorConfig', () => {
|
||||
|
||||
expect(getSpellcheckAttribute(config)).toBe('true')
|
||||
})
|
||||
|
||||
it('flushes pending serialization when the rich editor blurs', () => {
|
||||
const setMarkdownEditorFocused = vi.fn()
|
||||
vi.stubGlobal('window', {
|
||||
api: { ui: { setMarkdownEditorFocused } }
|
||||
})
|
||||
const flushPendingSerialization = vi.fn()
|
||||
const clearAnnotationTarget = vi.fn()
|
||||
const config = createRichMarkdownEditorConfig(
|
||||
createConfigParams({ clearAnnotationTarget, flushPendingSerialization })
|
||||
)
|
||||
|
||||
config.onBlur?.({} as never)
|
||||
|
||||
expect(setMarkdownEditorFocused).toHaveBeenCalledWith(false)
|
||||
expect(clearAnnotationTarget).toHaveBeenCalledOnce()
|
||||
expect(flushPendingSerialization).toHaveBeenCalledOnce()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -204,6 +204,7 @@ export function createRichMarkdownEditorConfig(params: EditorConfigParams): UseE
|
||||
onBlur: () => {
|
||||
window.api.ui.setMarkdownEditorFocused(false)
|
||||
clearAnnotationTarget()
|
||||
params.flushPendingSerialization()
|
||||
},
|
||||
onCreate: ({ editor: nextEditor }) => {
|
||||
// Why: normalizeEmptyListItems (not normalizeSoftBreaks) so hard-wrapped
|
||||
|
||||
@@ -35,7 +35,7 @@ beforeEach(() => {
|
||||
vi.stubGlobal('window', {
|
||||
api: { pty: { hasPty: mocks.hasPty } }
|
||||
})
|
||||
vi.spyOn(console, 'error').mockImplementation(() => {})
|
||||
vi.spyOn(console, 'warn').mockImplementation(() => {})
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
|
||||
@@ -276,7 +276,10 @@ export async function requestTerminalPaneRecovery(request: RecoveryRequest): Pro
|
||||
// would suppress input on a pane that never recovered.
|
||||
armTerminalInputQuarantine(request.tabId)
|
||||
}
|
||||
console.error(
|
||||
// warn, not error: this is the recovery succeeding, and the breadcrumb below is
|
||||
// what diagnostics actually read. STA-2373 made this path routine (every daemon
|
||||
// death remounts each live pane), so error level just floods the logs.
|
||||
console.warn(
|
||||
`[terminal] recovering pane tab ${request.tabId} — ${request.reason} with a live PTY (${request.ptyId ?? 'unbound'}); remounting to rebuild the renderer`
|
||||
)
|
||||
recordRendererCrashBreadcrumb('terminal_pane_recovery_remount', {
|
||||
|
||||
Reference in New Issue
Block a user