Merge branch 'master' into enhance/mobile

pull/3374/head
llcc 2021-12-16 13:51:27 +08:00 committed by GitHub
commit 3dfa44eeba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 282 additions and 237 deletions

View File

@ -379,6 +379,13 @@ jobs:
name: logseq-win64-builds
path: ./
- name: Generate SHA256 checksums
run: |
sha256sum *-darwin-* > SHA256SUMS.txt
sha256sum *-win-* >> SHA256SUMS.txt
sha256sum *-linux-* >> SHA256SUMS.txt
cat SHA256SUMS.txt
- name: List files
run: ls -rl
@ -388,12 +395,13 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: nightly
name: 'Desktop App Nightly Relase $$'
name: 'Desktop APP Nightly Release $$'
draft: false
prerelease: ${{ (github.event_name == 'workflow_dispatch' && github.event.inputs.is-pre-release) || (github.event_name == 'schedule')}}
body: "This is a nightly release of the Logseq desktop app."
body: |
This is a nightly release of the Logseq desktop app.
It's unstable compared to the official releases, **use it with caution**!
files: |
./VERSION
./SHA256SUMS.txt
./*.zip
./*.dmg

View File

@ -177,3 +177,32 @@ test('multiple code block', async ({ page }) => {
expect(await page.inputValue('.block-editor textarea'))
.toBe('中文 Heading\n```clojure\n:key-test\n\n```\nMiddle 🚀\n```clojure\n\n :key-test 日本語\n\n```\nFooter')
})
test('click outside to exit', async ({ page }) => {
await createRandomPage(page)
await page.fill('.block-editor textarea', 'Header ``Click``\n```\n ABC\n```')
await page.waitForTimeout(500) // wait for fill
await escapeToCodeEditor(page)
await page.type('.CodeMirror textarea', ' DEF\nGHI')
await page.waitForTimeout(500)
await page.click('text=Click')
await page.waitForTimeout(500)
// NOTE: auto-indent is on
expect(await page.inputValue('.block-editor textarea')).toBe('Header ``Click``\n```\n ABC DEF\n GHI\n```')
})
test('click lanuage label to exit #3463', async ({ page }) => {
await createRandomPage(page)
await page.fill('.block-editor textarea', '```cpp\n```')
await page.waitForTimeout(500)
await escapeToCodeEditor(page)
await page.type('.CodeMirror textarea', '#include<iostream>')
await page.waitForTimeout(500)
await page.click('text=cpp') // the language label
await page.waitForTimeout(500)
expect(await page.inputValue('.block-editor textarea')).toBe('```cpp\n#include<iostream>\n```')
})

View File

@ -16,7 +16,6 @@
50B271D11FEDC1A000F3C39B /* public in Resources */ = {isa = PBXBuildFile; fileRef = 50B271D01FEDC1A000F3C39B /* public */; };
7435D10C2704659F00AB88E0 /* FolderPicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7435D10B2704659F00AB88E0 /* FolderPicker.swift */; };
7435D10F2704660B00AB88E0 /* FolderPicker.m in Sources */ = {isa = PBXBuildFile; fileRef = 7435D10E2704660B00AB88E0 /* FolderPicker.m */; };
B50C6194D06FE919721B594B /* Pods_Logseq.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 659A484D0A608EE5D778DEF1 /* Pods_Logseq.framework */; };
D32752BE275496C60039291C /* CloudKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D32752BD275496C60039291C /* CloudKit.framework */; };
D3D62A0A275C92880003FBDC /* FileContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = D3D62A09275C92880003FBDC /* FileContainer.swift */; };
D3D62A0C275C928F0003FBDC /* FileContainer.m in Sources */ = {isa = PBXBuildFile; fileRef = D3D62A0B275C928F0003FBDC /* FileContainer.m */; };
@ -32,13 +31,10 @@
504EC3111FED79650016851F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
504EC3131FED79650016851F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
50B271D01FEDC1A000F3C39B /* public */ = {isa = PBXFileReference; lastKnownFileType = folder; path = public; sourceTree = "<group>"; };
659A484D0A608EE5D778DEF1 /* Pods_Logseq.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Logseq.framework; sourceTree = BUILT_PRODUCTS_DIR; };
7435D10B2704659F00AB88E0 /* FolderPicker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FolderPicker.swift; sourceTree = "<group>"; };
7435D10D2704660A00AB88E0 /* App-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "App-Bridging-Header.h"; sourceTree = "<group>"; };
7435D10E2704660B00AB88E0 /* FolderPicker.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FolderPicker.m; sourceTree = "<group>"; };
8A489CEC51E94726DDD58810 /* Pods-Logseq.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Logseq.release.xcconfig"; path = "Target Support Files/Pods-Logseq/Pods-Logseq.release.xcconfig"; sourceTree = "<group>"; };
A693BFCEA424C37DF4D9AF1B /* Pods-App.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-App.release.xcconfig"; path = "Target Support Files/Pods-App/Pods-App.release.xcconfig"; sourceTree = "<group>"; };
B9A79754543D95E609C23F91 /* Pods-App.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-App.debug.xcconfig"; path = "Target Support Files/Pods-App/Pods-App.debug.xcconfig"; sourceTree = "<group>"; };
D32752BC275496A60039291C /* App.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = App.entitlements; sourceTree = "<group>"; };
D32752BD275496C60039291C /* CloudKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CloudKit.framework; path = System/Library/Frameworks/CloudKit.framework; sourceTree = SDKROOT; };
D32752BF2754C5AB0039291C /* AppDebug.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = AppDebug.entitlements; sourceTree = "<group>"; };
@ -53,7 +49,6 @@
buildActionMask = 2147483647;
files = (
D32752BE275496C60039291C /* CloudKit.framework in Frameworks */,
B50C6194D06FE919721B594B /* Pods_Logseq.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -104,7 +99,6 @@
isa = PBXGroup;
children = (
D32752BD275496C60039291C /* CloudKit.framework */,
659A484D0A608EE5D778DEF1 /* Pods_Logseq.framework */,
);
name = Frameworks;
sourceTree = "<group>";
@ -112,8 +106,6 @@
D337740F89DEEAD18C87762B /* Pods */ = {
isa = PBXGroup;
children = (
B9A79754543D95E609C23F91 /* Pods-App.debug.xcconfig */,
A693BFCEA424C37DF4D9AF1B /* Pods-App.release.xcconfig */,
DE5650F4AD4E2242AB9C012D /* Pods-Logseq.debug.xcconfig */,
8A489CEC51E94726DDD58810 /* Pods-Logseq.release.xcconfig */,
);
@ -388,14 +380,14 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = App/AppDebug.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 2.2;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = K378MFWK59;
INFOPLIST_FILE = App/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 2.2;
MARKETING_VERSION = 0.0.1;
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\"";
PRODUCT_BUNDLE_IDENTIFIER = com.logseq.app;
PRODUCT_BUNDLE_IDENTIFIER = com.logseq.logseq;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OBJC_BRIDGING_HEADER = "App/App-Bridging-Header.h";
@ -413,13 +405,13 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = App/App.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 2.2;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = K378MFWK59;
INFOPLIST_FILE = App/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 2.2;
PRODUCT_BUNDLE_IDENTIFIER = com.logseq.app;
MARKETING_VERSION = 0.0.1;
PRODUCT_BUNDLE_IDENTIFIER = com.logseq.logseq;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "";
SWIFT_OBJC_BRIDGING_HEADER = "App/App-Bridging-Header.h";

View File

@ -6,7 +6,7 @@
<string>development</string>
<key>com.apple.developer.icloud-container-identifiers</key>
<array>
<string>iCloud.com.logseq.app</string>
<string>iCloud.com.logseq.logseq</string>
</array>
<key>com.apple.developer.icloud-services</key>
<array>
@ -14,7 +14,7 @@
</array>
<key>com.apple.developer.ubiquity-container-identifiers</key>
<array>
<string>iCloud.com.logseq.app</string>
<string>iCloud.com.logseq.logseq</string>
</array>
</dict>
</plist>

View File

@ -8,7 +8,7 @@
<string>Development</string>
<key>com.apple.developer.icloud-container-identifiers</key>
<array>
<string>iCloud.com.logseq.app</string>
<string>iCloud.com.logseq.logseq</string>
</array>
<key>com.apple.developer.icloud-services</key>
<array>
@ -16,7 +16,7 @@
</array>
<key>com.apple.developer.ubiquity-container-identifiers</key>
<array>
<string>iCloud.com.logseq.app</string>
<string>iCloud.com.logseq.logseq</string>
</array>
</dict>
</plist>

View File

@ -14,8 +14,7 @@ public class FileContainer: CAPPlugin, UIDocumentPickerDelegate {
public var _call: CAPPluginCall? = nil
var containerUrl: URL? {
let id = "iCloud.com.logseq.app"
return FileManager.default.url(forUbiquityContainerIdentifier: id)?.appendingPathComponent("Documents")
return FileManager.default.url(forUbiquityContainerIdentifier: nil)?.appendingPathComponent("Documents")
}
@objc func ensureDocuments(_ call: CAPPluginCall) {
@ -33,6 +32,15 @@ public class FileContainer: CAPPlugin, UIDocumentPickerDelegate {
}
}
let str = ""
let filename = (self.containerUrl?.appendingPathComponent(".logseq"))!
do {
try str.write(to: filename, atomically: true, encoding: String.Encoding.utf8)
} catch {
// failed to write file bad permissions, bad filename, missing permissions, or more likely it can't be converted to the encoding
}
self._call?.resolve([
"path": self.containerUrl!.path
])

View File

@ -40,8 +40,6 @@
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>NSCameraUsageDescription</key>
<string></string>
<key>NSDocumentsFolderUsageDescription</key>
<string></string>
<key>NSDownloadsFolderUsageDescription</key>
@ -50,20 +48,16 @@
<string></string>
<key>NSFileProviderPresenceUsageDescription</key>
<string></string>
<key>NSPhotoLibraryAddUsageDescription</key>
<string></string>
<key>NSPhotoLibraryUsageDescription</key>
<string></string>
<key>NSUbiquitousContainers</key>
<dict>
<key>iCloud.$(PRODUCT_BUNDLE_IDENTIFIER)</key>
<key>iCloud.com.logseq.logseq</key>
<dict>
<key>NSUbiquitousContainerIsDocumentScopePublic</key>
<true/>
<key>NSUbiquitousContainerName</key>
<string>Logseq</string>
<key>NSUbiquitousContainerSupportedFolderLevels</key>
<string>None</string>
<string>ANY</string>
</dict>
</dict>
<key>UILaunchStoryboardName</key>

View File

@ -14,5 +14,9 @@
},
"ios": {
"scheme": "Logseq"
},
"server": {
"url": "http://192.168.1.59:3001",
"cleartext": true
}
}

View File

@ -82,7 +82,6 @@
"d3-force": "3.0.0",
"diff": "5.0.0",
"diff-match-patch": "1.0.5",
"electron": "15.1.2",
"fs": "0.0.1-security",
"fs-extra": "9.1.0",
"fuse.js": "6.4.6",
@ -108,6 +107,7 @@
"react-tweet-embed": "1.2.2",
"reakit": "0.11.1",
"threads": "1.6.5",
"yargs-parser": "20.2.4"
"yargs-parser": "20.2.4",
"electron": "15.1.2"
}
}

View File

@ -38,7 +38,7 @@
"@electron-forge/maker-rpm": "^6.0.0-beta.57",
"@electron-forge/maker-squirrel": "^6.0.0-beta.57",
"@electron-forge/maker-zip": "^6.0.0-beta.57",
"electron": "16.0.4",
"electron": "15.1.2",
"electron-builder": "^22.11.7",
"electron-forge-maker-appimage": "trusktr/electron-forge-maker-appimage#patch-1",
"electron-rebuild": "3.2.5"

View File

@ -1742,18 +1742,18 @@
(d/has-class? target "image-resize"))
(editor-handler/clear-selection!)
(editor-handler/unhighlight-blocks!)
(let [block (or (db/pull [:block/uuid (:block/uuid block)]) block)
f #(let [cursor-range (util/caret-range (gdom/getElement block-id))
(let [f #(let [block (or (db/pull [:block/uuid (:block/uuid block)]) block)
cursor-range (util/caret-range (gdom/getElement block-id))
new-content (:block/content block)
content (-> (property/remove-built-in-properties (:block/format block)
content)
(drawer/remove-logbook))]
;; save current editing block
(let [{:keys [value] :as state} (editor-handler/get-state)]
(editor-handler/save-block! state value))
(state/set-editing!
edit-input-id
content
new-content
block
cursor-range
false))]
@ -2612,6 +2612,8 @@
(highlight/highlight (str (medley/random-uuid)) {:data-lang language} code)
[:div
(lazy-editor/editor config (str (dc/squuid)) attr code options)
;; FIXME: The following code seemed unreachable
;; options has key: :lines, :language, :full_content, :pos_meta
(let [options (:options options)]
(when (and (= language "text/x-clojure") (contains? (set options) ":results"))
(sci/eval-result code)))]))))))

View File

@ -108,10 +108,10 @@
block-id (or (:block/uuid (state/get-edit-block))
(:block/uuid block))
typ (or @commands/*current-command typ)]
(state/clear-edit!)
(editor-handler/set-block-timestamp! block-id
typ
text)
(state/clear-edit!)
(when show?
(reset! show? false))))
(clear-timestamp!)

View File

@ -104,7 +104,6 @@
(when input
(let [current-pos (cursor/pos input)
edit-content (or (state/sub [:editor/content id]) "")
edit-block (state/sub :editor/block)
sidebar? (in-sidebar? input)
q (or
@editor-handler/*selected-text

View File

@ -15,7 +15,7 @@
[frontend.config :as config]
[frontend.search :as search]
[clojure.string :as string]
[goog.dom :as gdom]
[goog.object :as gobj]
[medley.core :as medley]
[frontend.context.i18n :as i18n]
[frontend.date :as date]
@ -387,8 +387,9 @@
:on-change (fn [e]
(when @search-timeout
(js/clearTimeout @search-timeout))
(let [value (util/evalue e)]
(if (string/blank? value)
(let [value (util/evalue e)
is-composing? (util/event-is-composing? e)]
(if (and (string/blank? value) (not is-composing?))
(search-handler/clear-search! false)
(let [search-mode (state/get-search-mode)
opts (if (= :page search-mode)

View File

@ -216,6 +216,8 @@
(on-load-events)
(set-network-watcher!)
(mobile/init!)
(util/indexeddb-check?
(fn [_error]
(notification/show! "Sorry, it seems that your browser doesn't support IndexedDB, we recommend to use latest Chrome(Chromium) or Firefox(Non-private mode)." :error false)
@ -237,7 +239,6 @@
(enable-datalog-console))
(when (util/electron?)
(el/listen!))
(mobile/init!)
(js/setTimeout instrument! (* 60 1000))))
(defn stop! []

View File

@ -1257,7 +1257,7 @@
;; expand collapsed blocks
(mapv (fn [b] (if (:collapsed (:block/properties b))
(vec (tree/sort-blocks (db/get-block-children repo (:block/uuid b)) b))
[b])) )
[b])))
(flatten))
block-ids* (mapv :block/uuid blocks*)
level-blocks (blocks-with-level blocks*)
@ -1702,9 +1702,9 @@
"^" "^"
"=" "="
"/" "/"
"+" "+"
"+" "+"})
;; ":" ":" ; TODO: only properties editing and org mode tag
})
(def reversed-autopair-map
(zipmap (vals autopair-map)
@ -2790,13 +2790,11 @@
value (gobj/get input "value")
ctrlKey (gobj/get e "ctrlKey")
metaKey (gobj/get e "metaKey")
is-composing? (gobj/getValueByKeys e "event_" "isComposing")
pos (cursor/pos input)
shift? (.-shiftKey e)
code (gobj/getValueByKeys e "event_" "code")]
(cond
(and (or is-composing? (= key-code 229))
(not (state/get-editor-show-page-search-hashtag?)))
(util/event-is-composing? e)
nil
(or ctrlKey metaKey)
@ -2873,13 +2871,12 @@
:else
nil))))
;; key up
(defn keyup-handler
[state input input-id search-timeout]
(fn [e key-code]
(let [k (gobj/get e "key")]
(when-not (= k "Process")
(let [code (gobj/getValueByKeys e "event_" "code")
(when-not (util/event-is-composing? e)
(let [k (gobj/get e "key")
code (gobj/getValueByKeys e "event_" "code")
format (:format (get-state))
current-pos (cursor/pos input)
value (gobj/get input "value")
@ -2978,7 +2975,8 @@
(when-not (= k "Shift")
(state/set-last-key-code! {:key-code key-code
:code code
:shift? (.-shiftKey e)})))))))
:shift? (.-shiftKey e)}))))))
(defn editor-on-click!
[id]

View File

@ -3,8 +3,8 @@
[frontend.state :as state]
["@capacitor/app" :refer [^js App]]
[reitit.frontend.easy :as rfe]
[clojure.string :as string]))
[clojure.string :as string]
[frontend.fs.capacitor-fs :as fs]))
(defn init!
[]
@ -28,4 +28,7 @@
(string/ends-with? href "/")
(not (string/includes? href "#/")))
(.exitApp App)
(js/window.history.back)))))))
(js/window.history.back))))))
(when (mobile-util/native-ios?)
(let [path (fs/iOS-ensure-documents!)]
(println "iOS container path: " path))))

View File

@ -10,11 +10,12 @@
[view route-match]
(view route-match))
(defn- teardown-fn
(defn- setup-fns!
[]
(try
(comp
(ui/setup-active-keystroke!)
(ui/setup-patch-ios-visual-viewport-state!)
(ui/setup-patch-ios-visual-viewport-state!))
(catch js/Error _e
nil)))
@ -25,11 +26,10 @@
(ui/inject-document-devices-envs!)
(ui/inject-dynamic-style-node!)
(plugin-handler/host-mounted!)
(assoc state ::teardown teardown-fn))
(assoc state ::teardown (setup-fns!) ))
:will-unmount (fn [state]
(let [teardown (::teardown state)]
(when-not (nil? teardown)
(teardown))))}
(when-let [teardown (::teardown state)]
(teardown)))}
[]
(when-let [route-match (state/sub :route-match)]
(i18n/tongue-provider

View File

@ -1490,3 +1490,9 @@
(defn sm-breakpoint?
[]
(< (.-offsetWidth js/document.documentElement) 640)))
#?(:cljs
(defn event-is-composing?
[e]
(or (gobj/getValueByKeys e "event_" "isComposing")
(= (.-keyCode e) 229))))