diff --git a/src/main/frontend/components/property.cljs b/src/main/frontend/components/property.cljs index e0f391d13a..5ed75205bd 100644 --- a/src/main/frontend/components/property.cljs +++ b/src/main/frontend/components/property.cljs @@ -320,25 +320,18 @@ (let [config {:editor-opts {:on-key-down (fn [e] - (let [enter? (= (util/ekey e) "Enter")] - (when (and (contains? #{"Enter" "Escape"} (util/ekey e)) - (not (state/get-editor-action))) - (util/stop e) - (property-handler/set-block-property! repo (:block/uuid block) - (:block/original-name property) - (util/evalue e) - :old-value value) - (exit-edit-property) - - (when (and enter? multiple-values?) - (let [values-count (-> (:block/properties (db/entity (:db/id block))) - (get (:block/uuid property)) - (count)) - editor-id (str "ls-property-" blocks-container-id "-" (:db/id block) "-" (:db/id property) "-" values-count)] - (set-editing! property editor-id nil ""))))))}}] - (editor-box editor-args editor-id (cond-> config - multiple-values? - (assoc :property-value value)))))] + (when (and (contains? #{"Enter" "Escape"} (util/ekey e)) + (not (state/get-editor-action))) + (util/stop e) + (property-handler/set-block-property! repo (:block/uuid block) + (:block/original-name property) + (util/evalue e) + :old-value value) + (when editing-atom (reset! editing-atom false)) + (exit-edit-property)))}}] + [:div.pl-1 (editor-box editor-args editor-id (cond-> config + multiple-values? + (assoc :property-value value)))]))] (let [class (str (when-not row? "flex flex-1 ") (when multiple-values? "property-value-content"))] [:div {:id (or dom-id (random-uuid)) @@ -566,7 +559,7 @@ (cond @*editing? - (property-scalar-value block property v + (property-scalar-value block property "" (merge opts {:editor-args editor-args diff --git a/src/main/frontend/handler/editor.cljs b/src/main/frontend/handler/editor.cljs index ba946fb86e..0ee65b1f6a 100644 --- a/src/main/frontend/handler/editor.cljs +++ b/src/main/frontend/handler/editor.cljs @@ -739,7 +739,6 @@ (delete-block! repo true)) ([repo delete-children?] (state/set-editor-op! :delete) - (prn :debug 0) (let [{:keys [id block-id block-parent-id value format config]} (get-state)] (when block-id (let [page-id (:db/id (:block/page (db/entity [:block/uuid block-id]))) @@ -753,10 +752,8 @@ (when-let [block-id (:block/uuid (:data left))] (let [block (db/entity [:block/uuid block-id])] (seq (:block/_parent block)))))] - (prn :debug 1) (when-not (and has-children? left-has-children?) (when block-parent-id - (prn :debug 2) (let [block-parent (gdom/getElement block-parent-id) sibling-block (if (:embed? config) (util/get-prev-block-non-collapsed @@ -795,7 +792,6 @@ opts (cond-> {:outliner-op :delete-blocks} (config/db-based-graph? repo) (assoc :persist-op? true :repo repo))] - (prn {:blocks blocks}) (outliner-tx/transact! opts (outliner-core/delete-blocks! blocks {})) diff --git a/src/main/frontend/state.cljs b/src/main/frontend/state.cljs index f65fb0a552..bd85f71c62 100644 --- a/src/main/frontend/state.cljs +++ b/src/main/frontend/state.cljs @@ -1186,6 +1186,7 @@ Similar to re-frame subscriptions" (swap! state merge {:editor/editing? nil :cursor-range nil :editor/last-saved-cursor nil}) + (set-state! :editor/content {}) (set-state! :editor/block nil)) (defn into-code-editor-mode!