fix: subs dependencies

pull/6650/head
Tienson Qin 2022-09-06 09:04:02 +08:00 committed by Andelf
parent 7fa9209e29
commit 56668eeaef
2 changed files with 7 additions and 14 deletions

View File

@ -506,11 +506,6 @@
[:span {:id (str "mock-text_" idx)
:key idx} c])))])
(rum/defc mock-textarea-wrapper < rum/reactive
[]
(let [content (state/sub-edit-content)]
(mock-textarea content)))
(rum/defc animated-modal < rum/reactive
[modal-name component set-default-width?]
(when-let [pos (:pos (state/get-editor-action-data))]
@ -582,7 +577,7 @@
(shortcut/mixin :shortcut.handler/block-editing-only)
lifecycle/lifecycle
[state {:keys [format block]} id _config]
(let [content (state/sub-edit-content)
(let [content (state/sub-edit-content id)
heading-class (get-editor-style-class content format)]
[:div.editor-inner {:class (if block "block-editor" "non-block-editor")}
@ -597,7 +592,7 @@
:auto-focus false
:class heading-class})
(mock-textarea-wrapper)
(mock-textarea content)
(modals id format)
(when format

View File

@ -488,9 +488,6 @@ should be done through this fn in order to get global config and config defaults
;; State cursor fns for use with rum components
;; ============================================
;; State that some subs are dependent on. Should they use sub too?
(declare get-edit-input-id document-mode?)
(defn sub
"Creates a rum cursor, https://github.com/tonsky/rum#cursors, for use in rum components.
Similar to re-frame subscriptions"
@ -562,8 +559,8 @@ Similar to re-frame subscriptions"
(get-in (sub-config) [:default-home :page] ""))
(defn sub-edit-content
[]
(sub [:editor/content (get-edit-input-id)]))
[id]
(sub [:editor/content id]))
(defn- get-selected-block-ids
[blocks]
@ -608,8 +605,9 @@ Similar to re-frame subscriptions"
(defn doc-mode-enter-for-new-line?
[]
(and (document-mode?)
(not (:shortcut/doc-mode-enter-for-new-block? (sub-config)))))
(let [config (sub-config)]
(and (:document/mode? config)
(not (:shortcut/doc-mode-enter-for-new-block? config)))))
(defn user-groups
[]