fix: disable all the editing commands when focusing on the dialog

pull/2734/head
Tienson Qin 2021-08-27 16:58:25 +08:00
parent 2bad23404e
commit 5bd2f9cedc
3 changed files with 12 additions and 3 deletions

View File

@ -1,7 +1,8 @@
(ns frontend.mixins
(:require [rum.core :as rum]
[goog.dom :as dom]
[frontend.util :refer [profile]])
[frontend.util :refer [profile]]
[frontend.state :as state])
(:import [goog.events EventHandler]))
(defn detach
@ -162,6 +163,15 @@
(handler (:rum/args state))
state)})
(def component-editing-mode
{:will-mount
(fn [state]
(state/set-block-component-editing-mode! true)
state)
:will-unmount
(fn [state]
(state/set-block-component-editing-mode! false)
state)})
(defn perf-measure-mixin
[desc]

View File

@ -1059,8 +1059,6 @@
([modal-panel-content]
(set-modal! modal-panel-content false))
([modal-panel-content fullscreen?]
;; Temporal fix: to avoid deleting selected blocks (backspace in input/textarea)
(clear-selection!)
(swap! state assoc
:modal/show? (boolean modal-panel-content)
:modal/panel-content modal-panel-content

View File

@ -466,6 +466,7 @@
(panel-content close-fn)]])
(rum/defc modal < rum/reactive
mixins/component-editing-mode
(mixins/event-mixin
(fn [state]
(mixins/hide-when-esc-or-outside