Skip to content

The cursor focus position fails in the macOS system #1200

Description

@alindas

Jodit Version: 4.1.2

Browser: Safary
OS: Mac
Is React App: True
Reproduced on xdsoft.net: False

Description
When the editor loses focus, it is impossible to insert content into the original cursor by calling APIs such as insertHTML and insertImage elsewhere;
Moreover, methods such as editor. s. save() and editor. s. restore() are ineffective, and editor. s. focus cannot be refocused;
Only appears on macOS, not on Windows!

Test like this Code

// editor config
{
        buttons: [
            // When the editor loses focus, click here,It won't take effect, the cursor cannot be added correctly to the editor
            {
                name: 'testFocus',
                tooltip: 'testFocus',
                exec: (e) => {
                    // e === window._MDEditor
                    e.selection.restore() 
                    e.selection.focus()
                },
              },
        ]
        event: {
            blur: () => {
                window._MDEditor.selection.save()
              }
        }
    }

Expected behavior:
The cursor can be correctly restored. Consistent with running on windows.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmanual-testing-requiredReproducible only in a real browser (scroll/caret/zoom) — cannot be covered by headless karma tests

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions