mirror of
https://github.com/penpot/penpot.git
synced 2026-08-05 04:18:41 +00:00
🐛 Fix Firefox not inserting emoji from MacOS Character Viewer
This commit is contained in:
parent
14a6ea5c52
commit
e2e8b9040c
@ -421,9 +421,21 @@
|
||||
|
||||
on-blur
|
||||
(mf/use-fn
|
||||
(fn [^js _event]
|
||||
(sync-wasm-text-editor-content! {:finalize? true})
|
||||
(wasm.api/text-editor-blur)))
|
||||
(fn [^js event]
|
||||
;; The macOS Character Viewer (emoji picker) on Firefox fires a
|
||||
;; spurious `blur` when it opens: the surface stays the document's
|
||||
;; activeElement and focus only returns AFTER the emoji arrives as an
|
||||
;; `insertText` input. Tearing down the WASM editor focus here clears
|
||||
;; `has_focus`, and since `_text_editor_insert_text` is gated on it,
|
||||
;; the emoji would be silently dropped (nothing gets inserted).
|
||||
;; Skip the teardown while the surface is still the active element; a
|
||||
;; genuine blur (focus moved elsewhere) and the explicit unmount
|
||||
;; finalize (called with no event) still run.
|
||||
(when-not (and (some? event)
|
||||
(= (.-activeElement js/document)
|
||||
(mf/ref-val contenteditable-ref)))
|
||||
(sync-wasm-text-editor-content! {:finalize? true})
|
||||
(wasm.api/text-editor-blur))))
|
||||
|
||||
style #js {:pointerEvents "all"
|
||||
"--editor-container-width" (dm/str width "px")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user