Browse Source

Merge remote-tracking branch 'origin/master' into feat/ui-tweaks-settings

charlie 4 years ago
parent
commit
ffbf6f9fca

+ 6 - 2
src/main/frontend/components/content.cljs

@@ -84,6 +84,9 @@
 (rum/defcs block-template < rum/reactive
   (rum/local false ::edit?)
   (rum/local "" ::input)
+  {:will-unmount (fn [state]
+                   (reset! *including-parent? nil)
+                   state)}
   [state block-id]
   (let [edit? (get state ::edit?)
         input (get state ::input)
@@ -91,6 +94,7 @@
         block-id (if (string? block-id) (uuid block-id) block-id)
         block (db/entity [:block/uuid block-id])
         has-children? (seq (:block/children block))]
+    (prn {:has-children? has-children?})
     (when (and (nil? including-parent?) has-children?)
       (reset! *including-parent? true))
 
@@ -99,7 +103,7 @@
         (state/clear-edit!)
         [:div.px-4.py-2 {:on-click (fn [e] (util/stop e))}
          [:p "What's the template's name?"]
-         [:input#new-template.form-input.block.w-full.sm:text-sm.sm:leading-5.my-2.text-gray-700
+         [:input#new-template.form-input.block.w-full.sm:text-sm.sm:leading-5.my-2
           {:auto-focus true
            :on-change (fn [e]
                         (reset! input (util/evalue e)))}]
@@ -115,7 +119,7 @@
                                        :error)
                                       (do
                                         (editor-handler/set-block-property! block-id "template" title)
-                                        (when-not including-parent?
+                                        (when (false? including-parent?)
                                           (editor-handler/set-block-property! block-id "including-parent" false))
                                         (state/hide-custom-context-menu!)))))))])
       (ui/menu-link

+ 1 - 1
src/main/frontend/components/editor.cljs

@@ -220,7 +220,7 @@
                                               (let [new-level (+ new-level
                                                                  (- level template-parent-level
                                                                     (if (not including-parent?) 1 0)))
-                                                    properties' (dissoc (into {} properties) "id" "custom_id" "template")]
+                                                    properties' (dissoc (into {} properties) "id" "custom_id" "template" "including-parent")]
                                                 (-> content
                                                    (string/replace-first (apply str (repeat level pattern))
                                                                          (apply str (repeat new-level pattern)))

+ 2 - 1
src/main/frontend/db/query_dsl.cljs

@@ -274,7 +274,8 @@
              nil)))
 
        (= 'page fe)
-       (let [page-name (string/lower-case (first (rest e)))]
+       (let [page-name (string/lower-case (first (rest e)))
+             page-name (text/page-ref-un-brackets! page-name)]
          [['?b :block/page [:page/name page-name]]])
 
        (= 'page-property fe)

+ 1 - 1
src/main/frontend/version.cljs

@@ -1,3 +1,3 @@
 (ns frontend.version)
 
-(defonce version "0.0.9-2")
+(defonce version "0.0.10")