Browse Source

Merge branch 'master' into feat/db

Gabriel Horner 1 year ago
parent
commit
e4587f8259

+ 4 - 4
ios/App/App.xcodeproj/project.pbxproj

@@ -519,7 +519,7 @@
 				INFOPLIST_FILE = App/Info.plist;
 				IPHONEOS_DEPLOYMENT_TARGET = 14.0;
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
-				MARKETING_VERSION = 0.10.6;
+				MARKETING_VERSION = 0.10.7;
 				OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\"";
 				PRODUCT_BUNDLE_IDENTIFIER = com.logseq.logseq;
 				PRODUCT_NAME = "$(TARGET_NAME)";
@@ -546,7 +546,7 @@
 				INFOPLIST_FILE = App/Info.plist;
 				IPHONEOS_DEPLOYMENT_TARGET = 14.0;
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
-				MARKETING_VERSION = 0.10.6;
+				MARKETING_VERSION = 0.10.7;
 				PRODUCT_BUNDLE_IDENTIFIER = com.logseq.logseq;
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				SWIFT_ACTIVE_COMPILATION_CONDITIONS = "";
@@ -571,7 +571,7 @@
 				INFOPLIST_KEY_NSHumanReadableCopyright = "";
 				IPHONEOS_DEPLOYMENT_TARGET = 14.0;
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
-				MARKETING_VERSION = 0.10.6;
+				MARKETING_VERSION = 0.10.7;
 				MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
 				MTL_FAST_MATH = YES;
 				PRODUCT_BUNDLE_IDENTIFIER = com.logseq.logseq.ShareViewController;
@@ -598,7 +598,7 @@
 				INFOPLIST_KEY_NSHumanReadableCopyright = "";
 				IPHONEOS_DEPLOYMENT_TARGET = 14.0;
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
-				MARKETING_VERSION = 0.10.6;
+				MARKETING_VERSION = 0.10.7;
 				MTL_FAST_MATH = YES;
 				PRODUCT_BUNDLE_IDENTIFIER = com.logseq.logseq.ShareViewController;
 				PRODUCT_NAME = "$(TARGET_NAME)";

+ 1 - 0
ios/App/Podfile

@@ -11,6 +11,7 @@ install! 'cocoapods', :disable_input_output_paths => true
 def capacitor_pods
   pod 'Capacitor', :path => '../../node_modules/@capacitor/ios'
   pod 'CapacitorCordova', :path => '../../node_modules/@capacitor/ios'
+  pod 'CapacitorActionSheet', :path => '../../node_modules/@capacitor/action-sheet'
   pod 'CapacitorApp', :path => '../../node_modules/@capacitor/app'
   pod 'CapacitorCamera', :path => '../../node_modules/@capacitor/camera'
   pod 'CapacitorClipboard', :path => '../../node_modules/@capacitor/clipboard'

+ 4 - 4
src/main/frontend/components/encryption.cljs

@@ -101,11 +101,11 @@
        [:h1#modal-headline.text-2xl.font-bold.text-center
         (if init-graph-keys
           (if remote-pw?
-            "Secure this remote graph!"
-            "Encrypt this graph")
+            "Secure graph!"
+            "Encrypt graph")
           (if remote-pw?
-            "Unlock this remote graph!"
-            "Decrypt this graph"))]]
+            "Unlock graph!"
+            "Decrypt graph"))]]
 
       ;; decrypt remote graph with one password
       (when (and remote-pw? (not init-graph-keys))

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

@@ -131,7 +131,7 @@
   #{:doc :docx :xls :xlsx :ppt :pptx :one :pdf :epub})
 
 (def image-formats
-  #{:png :jpg :jpeg :bmp :gif :webp :svg})
+  #{:png :jpg :jpeg :bmp :gif :webp :svg :heic})
 
 (def audio-formats
   #{:mp3 :ogg :mpeg :wav :m4a :flac :wma :aac})

+ 37 - 0
src/main/frontend/handler/editor.cljs

@@ -3611,6 +3611,43 @@
                (doseq [{:block/keys [uuid]} blocks-to-collapse]
                  (collapse-block! uuid))))))))))
 
+(defn toggle-collapse!
+  ([e] (toggle-collapse! e false))
+  ([e clear-selection?]
+    (when e (util/stop e))
+    (cond
+      (state/editing?)
+      (when-let [block (state/get-edit-block)]
+        ;; get-edit-block doesn't track the latest collapsed state, so we need to reload from db.
+        (let [block-id (:block/uuid block)
+              block (db/pull [:block/uuid block-id])]
+          (if (:block/collapsed? block)
+            (expand! e clear-selection?)
+            (collapse! e clear-selection?))))
+
+      (state/selection?)
+      (do
+        (let [block-ids (map #(-> % (dom/attr "blockid") uuid) (get-selected-blocks))
+              first-block-id (first block-ids)]
+          (when first-block-id
+            ;; If multiple blocks are selected, they may not have all the same collapsed state.
+            ;; For simplicity, use the first block's state to decide whether to collapse/expand all.
+            (let [first-block (db/pull [:block/uuid first-block-id])]
+              (if (:block/collapsed? first-block)
+                (doseq [block-id block-ids] (expand-block! block-id))
+                (doseq [block-id block-ids] (collapse-block! block-id))))))
+        (and clear-selection? (clear-selection!)))
+
+      (whiteboard?)
+      ;; TODO: Looks like detecting the whiteboard selection's collapse state will take more work.
+      ;; Leaving unimplemented for now.
+      nil
+
+      :else
+      ;; If no block is being edited or selected, the "toggle" action doesn't make sense,
+      ;; so we no-op here, unlike in the expand! & collapse! functions.
+      nil)))
+
 (defn collapse-all!
   ([]
    (collapse-all! nil {}))

+ 5 - 0
src/main/frontend/modules/shortcut/config.cljs

@@ -320,6 +320,9 @@
    :editor/collapse-block-children          {:binding "mod+up"
                                              :fn      editor-handler/collapse!}
 
+   :editor/toggle-block-children            {:binding "mod+;"
+                                             :fn      editor-handler/toggle-collapse!}
+
    :editor/indent                           {:binding "tab"
                                              :fn      (editor-handler/keydown-tab-handler :right)}
 
@@ -702,6 +705,7 @@
             :editor/delete-selection
             :editor/expand-block-children
             :editor/collapse-block-children
+            :editor/toggle-block-children
             :editor/indent
             :editor/outdent
             :editor/copy
@@ -819,6 +823,7 @@
       :editor/right
       :editor/collapse-block-children
       :editor/expand-block-children
+      :editor/toggle-block-children
       :editor/toggle-open-blocks
       :go/backward
       :go/forward

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

@@ -1135,7 +1135,7 @@
    (lazy-visible content-fn nil))
   ([content-fn {:keys [initial-state trigger-once? fade-in? root-margin _debug-id]
                 :or {initial-state false
-                     trigger-once? false
+                     trigger-once? true
                      fade-in? true
                      root-margin 100}}]
    (let [[visible? set-visible!] (rum/use-state initial-state)

+ 1 - 0
src/resources/dicts/en.edn

@@ -713,6 +713,7 @@
   :editor/delete-selection        "Delete selected blocks"
   :editor/expand-block-children   "Expand"
   :editor/collapse-block-children "Collapse"
+  :editor/toggle-block-children   "Toggle expand/collapse"
   :editor/indent                  "Indent block"
   :editor/outdent                 "Outdent block"
   :editor/copy                    "Copy (copies either selection, or block reference)"