mirror of
https://github.com/logseq/logseq.git
synced 2026-05-02 09:56:31 +00:00
enhance(iOS): disable webview resize
This commit is contained in:
@@ -1,13 +1,15 @@
|
||||
(ns frontend.handler.editor
|
||||
(:require ["/frontend/utils" :as utils]
|
||||
["path" :as path]
|
||||
[cljs.core.match :refer [match]]
|
||||
[clojure.set :as set]
|
||||
[clojure.string :as string]
|
||||
[clojure.walk :as w]
|
||||
[dommy.core :as dom]
|
||||
[frontend.commands :as commands
|
||||
:refer [*angle-bracket-caret-pos *show-block-commands
|
||||
*show-commands *slash-caret-pos]]
|
||||
:refer [*angle-bracket-caret-pos
|
||||
*show-block-commands *show-commands
|
||||
*slash-caret-pos]]
|
||||
[frontend.config :as config]
|
||||
[frontend.date :as date]
|
||||
[frontend.db :as db]
|
||||
@@ -25,12 +27,12 @@
|
||||
[frontend.handler.notification :as notification]
|
||||
[frontend.handler.repeated :as repeated]
|
||||
[frontend.handler.route :as route-handler]
|
||||
[frontend.image :as image]
|
||||
[frontend.idb :as idb]
|
||||
[frontend.image :as image]
|
||||
[frontend.mobile.util :as mobile-util]
|
||||
[frontend.modules.outliner.core :as outliner-core]
|
||||
[frontend.modules.outliner.tree :as tree]
|
||||
[frontend.modules.outliner.transaction :as outliner-tx]
|
||||
[frontend.modules.outliner.tree :as tree]
|
||||
[frontend.search :as search]
|
||||
[frontend.state :as state]
|
||||
[frontend.template :as template]
|
||||
@@ -40,19 +42,18 @@
|
||||
[frontend.util.clock :as clock]
|
||||
[frontend.util.cursor :as cursor]
|
||||
[frontend.util.drawer :as drawer]
|
||||
[frontend.util.marker :as marker]
|
||||
[frontend.util.property :as property]
|
||||
[frontend.util.priority :as priority]
|
||||
[frontend.util.thingatpt :as thingatpt]
|
||||
[frontend.util.keycode :as keycode]
|
||||
[frontend.util.list :as list]
|
||||
[frontend.util.marker :as marker]
|
||||
[frontend.util.priority :as priority]
|
||||
[frontend.util.property :as property]
|
||||
[frontend.util.thingatpt :as thingatpt]
|
||||
[goog.dom :as gdom]
|
||||
[goog.dom.classes :as gdom-classes]
|
||||
[goog.object :as gobj]
|
||||
[lambdaisland.glogi :as log]
|
||||
[medley.core :as medley]
|
||||
[promesa.core :as p]
|
||||
[frontend.util.keycode :as keycode]
|
||||
["path" :as path]))
|
||||
[promesa.core :as p]))
|
||||
|
||||
;; FIXME: should support multiple images concurrently uploading
|
||||
|
||||
@@ -1414,7 +1415,7 @@
|
||||
(util/electron?)
|
||||
(str "assets://" repo-dir path)
|
||||
|
||||
(mobile-util/is-native-platform?)
|
||||
(mobile-util/native-platform?)
|
||||
(mobile-util/convert-file-src (str repo-dir path))
|
||||
|
||||
:else
|
||||
@@ -2605,7 +2606,7 @@
|
||||
;; FIXME: On mobile, a backspace click to call keydown-backspace-handler
|
||||
;; does not work sometimes in an empty block, hence the empty block
|
||||
;; can't be deleted. Need to figure out why and find a better solution.
|
||||
(and (mobile-util/is-native-platform?)
|
||||
(and (mobile-util/native-platform?)
|
||||
(= key "Backspace")
|
||||
(= value ""))
|
||||
(do
|
||||
@@ -2788,23 +2789,14 @@
|
||||
[id]
|
||||
(fn [_e]
|
||||
(let [input (gdom/getElement id)]
|
||||
(util/scroll-editor-cursor input)
|
||||
(close-autocomplete-if-outside input))))
|
||||
|
||||
(defonce mobile-toolbar-height 40)
|
||||
(defn editor-on-height-change!
|
||||
[id]
|
||||
(fn [box-height ^js row-height]
|
||||
(let [row-height (:rowHeight (js->clj row-height :keywordize-keys true))
|
||||
input (gdom/getElement id)
|
||||
caret (cursor/get-caret-pos input)
|
||||
cursor-bottom (if caret (+ row-height (:top caret)) box-height)
|
||||
box-top (gobj/get (.getBoundingClientRect input) "top")
|
||||
cursor-y (+ cursor-bottom box-top)
|
||||
vw-height (.-height js/window.visualViewport)]
|
||||
(when (< vw-height (+ cursor-y mobile-toolbar-height))
|
||||
(let [main-node (gdom/getElement "main-content-container")
|
||||
scroll-top (.-scrollTop main-node)]
|
||||
(set! (.-scrollTop main-node) (+ scroll-top row-height)))))))
|
||||
(fn [_box-height ^js _row-height]
|
||||
(let [input (gdom/getElement id)]
|
||||
(util/scroll-editor-cursor input))))
|
||||
|
||||
(defn editor-on-change!
|
||||
[block id search-timeout]
|
||||
@@ -2817,7 +2809,9 @@
|
||||
(js/setTimeout
|
||||
#(edit-box-on-change! e block id)
|
||||
timeout)))
|
||||
(edit-box-on-change! e block id))))
|
||||
(let [input (gdom/getElement id)]
|
||||
(edit-box-on-change! e block id)
|
||||
(util/scroll-editor-cursor input)))))
|
||||
|
||||
(defn- paste-text-parseable
|
||||
[format text]
|
||||
@@ -2882,12 +2876,12 @@
|
||||
(and (util/url? text)
|
||||
(or (string/includes? text "youtube.com")
|
||||
(string/includes? text "youtu.be"))
|
||||
(mobile-util/is-native-platform?))
|
||||
(mobile-util/native-platform?))
|
||||
(commands/simple-insert! (state/get-edit-input-id) (util/format "{{youtube %s}}" text) nil)
|
||||
|
||||
(and (util/url? text)
|
||||
(string/includes? text "twitter.com")
|
||||
(mobile-util/is-native-platform?))
|
||||
(mobile-util/native-platform?))
|
||||
(commands/simple-insert! (state/get-edit-input-id) (util/format "{{twitter %s}}" text) nil)
|
||||
|
||||
(and (text/block-ref? text)
|
||||
|
||||
Reference in New Issue
Block a user