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 name: logseq-win64-builds
path: ./ path: ./
- name: Generate SHA256 checksums
run: |
sha256sum *-darwin-* > SHA256SUMS.txt
sha256sum *-win-* >> SHA256SUMS.txt
sha256sum *-linux-* >> SHA256SUMS.txt
cat SHA256SUMS.txt
- name: List files - name: List files
run: ls -rl run: ls -rl
@ -388,12 +395,13 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:
tag_name: nightly tag_name: nightly
name: 'Desktop App Nightly Relase $$' name: 'Desktop APP Nightly Release $$'
draft: false draft: false
prerelease: ${{ (github.event_name == 'workflow_dispatch' && github.event.inputs.is-pre-release) || (github.event_name == 'schedule')}} 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: | files: |
./VERSION
./SHA256SUMS.txt ./SHA256SUMS.txt
./*.zip ./*.zip
./*.dmg ./*.dmg

View File

@ -177,3 +177,32 @@ test('multiple code block', async ({ page }) => {
expect(await page.inputValue('.block-editor textarea')) 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') .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 */; }; 50B271D11FEDC1A000F3C39B /* public in Resources */ = {isa = PBXBuildFile; fileRef = 50B271D01FEDC1A000F3C39B /* public */; };
7435D10C2704659F00AB88E0 /* FolderPicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7435D10B2704659F00AB88E0 /* FolderPicker.swift */; }; 7435D10C2704659F00AB88E0 /* FolderPicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7435D10B2704659F00AB88E0 /* FolderPicker.swift */; };
7435D10F2704660B00AB88E0 /* FolderPicker.m in Sources */ = {isa = PBXBuildFile; fileRef = 7435D10E2704660B00AB88E0 /* FolderPicker.m */; }; 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 */; }; D32752BE275496C60039291C /* CloudKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D32752BD275496C60039291C /* CloudKit.framework */; };
D3D62A0A275C92880003FBDC /* FileContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = D3D62A09275C92880003FBDC /* FileContainer.swift */; }; D3D62A0A275C92880003FBDC /* FileContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = D3D62A09275C92880003FBDC /* FileContainer.swift */; };
D3D62A0C275C928F0003FBDC /* FileContainer.m in Sources */ = {isa = PBXBuildFile; fileRef = D3D62A0B275C928F0003FBDC /* FileContainer.m */; }; 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>"; }; 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>"; }; 504EC3131FED79650016851F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
50B271D01FEDC1A000F3C39B /* public */ = {isa = PBXFileReference; lastKnownFileType = folder; path = public; 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>"; }; 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>"; }; 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>"; }; 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>"; }; 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>"; }; 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; }; 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>"; }; D32752BF2754C5AB0039291C /* AppDebug.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = AppDebug.entitlements; sourceTree = "<group>"; };
@ -53,7 +49,6 @@
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
D32752BE275496C60039291C /* CloudKit.framework in Frameworks */, D32752BE275496C60039291C /* CloudKit.framework in Frameworks */,
B50C6194D06FE919721B594B /* Pods_Logseq.framework in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
@ -104,7 +99,6 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
D32752BD275496C60039291C /* CloudKit.framework */, D32752BD275496C60039291C /* CloudKit.framework */,
659A484D0A608EE5D778DEF1 /* Pods_Logseq.framework */,
); );
name = Frameworks; name = Frameworks;
sourceTree = "<group>"; sourceTree = "<group>";
@ -112,8 +106,6 @@
D337740F89DEEAD18C87762B /* Pods */ = { D337740F89DEEAD18C87762B /* Pods */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
B9A79754543D95E609C23F91 /* Pods-App.debug.xcconfig */,
A693BFCEA424C37DF4D9AF1B /* Pods-App.release.xcconfig */,
DE5650F4AD4E2242AB9C012D /* Pods-Logseq.debug.xcconfig */, DE5650F4AD4E2242AB9C012D /* Pods-Logseq.debug.xcconfig */,
8A489CEC51E94726DDD58810 /* Pods-Logseq.release.xcconfig */, 8A489CEC51E94726DDD58810 /* Pods-Logseq.release.xcconfig */,
); );
@ -388,14 +380,14 @@
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = App/AppDebug.entitlements; CODE_SIGN_ENTITLEMENTS = App/AppDebug.entitlements;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 2.2; CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = K378MFWK59; DEVELOPMENT_TEAM = K378MFWK59;
INFOPLIST_FILE = App/Info.plist; INFOPLIST_FILE = App/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0; IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 2.2; MARKETING_VERSION = 0.0.1;
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\""; OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\"";
PRODUCT_BUNDLE_IDENTIFIER = com.logseq.app; PRODUCT_BUNDLE_IDENTIFIER = com.logseq.logseq;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OBJC_BRIDGING_HEADER = "App/App-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "App/App-Bridging-Header.h";
@ -413,13 +405,13 @@
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = App/App.entitlements; CODE_SIGN_ENTITLEMENTS = App/App.entitlements;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 2.2; CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = K378MFWK59; DEVELOPMENT_TEAM = K378MFWK59;
INFOPLIST_FILE = App/Info.plist; INFOPLIST_FILE = App/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0; IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 2.2; MARKETING_VERSION = 0.0.1;
PRODUCT_BUNDLE_IDENTIFIER = com.logseq.app; PRODUCT_BUNDLE_IDENTIFIER = com.logseq.logseq;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = ""; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "";
SWIFT_OBJC_BRIDGING_HEADER = "App/App-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "App/App-Bridging-Header.h";

View File

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

View File

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

View File

@ -14,8 +14,7 @@ public class FileContainer: CAPPlugin, UIDocumentPickerDelegate {
public var _call: CAPPluginCall? = nil public var _call: CAPPluginCall? = nil
var containerUrl: URL? { var containerUrl: URL? {
let id = "iCloud.com.logseq.app" return FileManager.default.url(forUbiquityContainerIdentifier: nil)?.appendingPathComponent("Documents")
return FileManager.default.url(forUbiquityContainerIdentifier: id)?.appendingPathComponent("Documents")
} }
@objc func ensureDocuments(_ call: CAPPluginCall) { @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([ self._call?.resolve([
"path": self.containerUrl!.path "path": self.containerUrl!.path
]) ])

View File

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

View File

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

View File

@ -82,7 +82,6 @@
"d3-force": "3.0.0", "d3-force": "3.0.0",
"diff": "5.0.0", "diff": "5.0.0",
"diff-match-patch": "1.0.5", "diff-match-patch": "1.0.5",
"electron": "15.1.2",
"fs": "0.0.1-security", "fs": "0.0.1-security",
"fs-extra": "9.1.0", "fs-extra": "9.1.0",
"fuse.js": "6.4.6", "fuse.js": "6.4.6",
@ -108,6 +107,7 @@
"react-tweet-embed": "1.2.2", "react-tweet-embed": "1.2.2",
"reakit": "0.11.1", "reakit": "0.11.1",
"threads": "1.6.5", "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-rpm": "^6.0.0-beta.57",
"@electron-forge/maker-squirrel": "^6.0.0-beta.57", "@electron-forge/maker-squirrel": "^6.0.0-beta.57",
"@electron-forge/maker-zip": "^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-builder": "^22.11.7",
"electron-forge-maker-appimage": "trusktr/electron-forge-maker-appimage#patch-1", "electron-forge-maker-appimage": "trusktr/electron-forge-maker-appimage#patch-1",
"electron-rebuild": "3.2.5" "electron-rebuild": "3.2.5"

View File

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

View File

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

View File

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

View File

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

View File

@ -216,6 +216,8 @@
(on-load-events) (on-load-events)
(set-network-watcher!) (set-network-watcher!)
(mobile/init!)
(util/indexeddb-check? (util/indexeddb-check?
(fn [_error] (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) (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)) (enable-datalog-console))
(when (util/electron?) (when (util/electron?)
(el/listen!)) (el/listen!))
(mobile/init!)
(js/setTimeout instrument! (* 60 1000)))) (js/setTimeout instrument! (* 60 1000))))
(defn stop! [] (defn stop! []

View File

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

View File

@ -3,8 +3,8 @@
[frontend.state :as state] [frontend.state :as state]
["@capacitor/app" :refer [^js App]] ["@capacitor/app" :refer [^js App]]
[reitit.frontend.easy :as rfe] [reitit.frontend.easy :as rfe]
[clojure.string :as string])) [clojure.string :as string]
[frontend.fs.capacitor-fs :as fs]))
(defn init! (defn init!
[] []
@ -28,4 +28,7 @@
(string/ends-with? href "/") (string/ends-with? href "/")
(not (string/includes? href "#/"))) (not (string/includes? href "#/")))
(.exitApp App) (.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]
(view route-match)) (view route-match))
(defn- teardown-fn (defn- setup-fns!
[] []
(try (try
(comp
(ui/setup-active-keystroke!) (ui/setup-active-keystroke!)
(ui/setup-patch-ios-visual-viewport-state!) (ui/setup-patch-ios-visual-viewport-state!))
(catch js/Error _e (catch js/Error _e
nil))) nil)))
@ -25,11 +26,10 @@
(ui/inject-document-devices-envs!) (ui/inject-document-devices-envs!)
(ui/inject-dynamic-style-node!) (ui/inject-dynamic-style-node!)
(plugin-handler/host-mounted!) (plugin-handler/host-mounted!)
(assoc state ::teardown teardown-fn)) (assoc state ::teardown (setup-fns!) ))
:will-unmount (fn [state] :will-unmount (fn [state]
(let [teardown (::teardown state)] (when-let [teardown (::teardown state)]
(when-not (nil? teardown) (teardown)))}
(teardown))))}
[] []
(when-let [route-match (state/sub :route-match)] (when-let [route-match (state/sub :route-match)]
(i18n/tongue-provider (i18n/tongue-provider

View File

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