diff --git a/resources/electron-dev.html b/resources/electron-dev.html index 7423a7eba36..2e383d7e8e9 100644 --- a/resources/electron-dev.html +++ b/resources/electron-dev.html @@ -30,7 +30,6 @@
- - diff --git a/resources/electron.html b/resources/electron.html index dd41354f69f..9568f3903e0 100644 --- a/resources/electron.html +++ b/resources/electron.html @@ -31,7 +31,6 @@ - - diff --git a/resources/js/preload.js b/resources/js/preload.js index c7f33fbf5b9..bed63f3f5f9 100644 --- a/resources/js/preload.js +++ b/resources/js/preload.js @@ -1,6 +1,6 @@ const fs = require('fs') const path = require('path') -const { ipcRenderer, contextBridge, shell, clipboard, webFrame } = require('electron') +const { ipcRenderer, contextBridge, shell, clipboard } = require('electron') const IS_MAC = process.platform === 'darwin' const IS_WIN32 = process.platform === 'win32' @@ -136,8 +136,4 @@ contextBridge.exposeInMainWorld('apis', { getFilePathFromClipboard, isClipboardHasImage, - - setZoomFactor (factor) { - webFrame.setZoomFactor(factor) - } }) diff --git a/src/electron/electron/handler.cljs b/src/electron/electron/handler.cljs index 1577fa3d9a3..680c9465478 100644 --- a/src/electron/electron/handler.cljs +++ b/src/electron/electron/handler.cljs @@ -89,25 +89,6 @@ (remove nil?))] (vec (cons {:path (fix-win-path! path)} result)))) -(defn- get-ls-dotdir-root - [] - (let [lg-dir (str (.getPath app "home") "/.logseq")] - (if-not (fs/existsSync lg-dir) - (and (fs/mkdirSync lg-dir) lg-dir) - lg-dir))) - -(defn- get-ls-default-plugins - [] - (let [plugins-root (path/join (get-ls-dotdir-root) "plugins") - _ (if-not (fs/existsSync plugins-root) - (fs/mkdirSync plugins-root)) - dirs (js->clj (fs/readdirSync plugins-root #js{"withFileTypes" true})) - dirs (->> dirs - (filter #(.isDirectory %)) - (filter #(not (string/starts-with? (.-name %) "_"))) - (map #(path/join plugins-root (.-name %))))] - dirs)) - (defmethod handle :openDir [^js window _messages] (let [result (.showOpenDialogSync dialog (bean/->js {:properties ["openDirectory" "createDirectory" "promptToCreate"]})) @@ -197,18 +178,6 @@ (when dir (watch-dir! window dir))) -(defmethod handle :openDialogSync [^js window _messages] - (let [result (.showOpenDialogSync dialog (bean/->js - {:properties ["openDirectory"]})) - path (first result)] - path)) - -(defmethod handle :getLogseqDotDirRoot [] - (get-ls-dotdir-root)) - -(defmethod handle :getUserDefaultPlugins [] - (get-ls-default-plugins)) - (defmethod handle :default [args] (println "Error: no ipc handler for: " (bean/->js args))) diff --git a/src/main/frontend/components/header.cljs b/src/main/frontend/components/header.cljs index d64f92a5251..57002441a77 100644 --- a/src/main/frontend/components/header.cljs +++ b/src/main/frontend/components/header.cljs @@ -15,7 +15,6 @@ [frontend.components.repo :as repo] [frontend.components.search :as search] [frontend.components.export :as export] - [frontend.components.plugins :as plugins] [frontend.components.right-sidebar :as sidebar] [frontend.handler.page :as page-handler] [frontend.handler.web.nfs :as nfs] @@ -72,7 +71,6 @@ (rum/defc dropdown-menu < rum/reactive [{:keys [me current-repo t default-home]}] (let [projects (state/sub [:me :projects]) - developer-mode? (state/sub [:ui/developer-mode?]) logged? (state/logged?)] (ui/dropdown-with-links (fn [{:keys [toggle-fn]}] @@ -116,14 +114,6 @@ :options {:on-click #(ui-handler/toggle-settings-modal!)} :icon svg/settings-sm}) - (when developer-mode? - {:title (t :plugins) - :options {:href (rfe/href :plugins)}}) - - (when developer-mode? - {:title (t :themes) - :options {:on-click #(plugins/open-select-theme!)}}) - (when current-repo {:title (t :export) :options {:on-click #(state/set-modal! export/export)} diff --git a/src/main/frontend/components/plugins.cljs b/src/main/frontend/components/plugins.cljs index a7f6e3cb68c..ee088072a7f 100644 --- a/src/main/frontend/components/plugins.cljs +++ b/src/main/frontend/components/plugins.cljs @@ -81,8 +81,7 @@ [:sup.inline-block.px-1.text-xs.opacity-30 version]] [:div.desc.text-xs.opacity-60 [:p description] - ;;[:small (js/JSON.stringify (bean/->js settings))] -] + [:small (js/JSON.stringify (bean/->js settings))]] [:div.flag [:p.text-xs.text-gray-300.pr-2.flex.justify-between.dark:opacity-40 [:small author] @@ -147,9 +146,9 @@ ([type payload opts] (let [id (str "slot__" (util/rand-str 8))] (rum/use-effect! - (fn [] - (plugin-handler/hook-plugin-app type {:slot id :payload payload} nil) - #()) - []) + (fn [] + (plugin-handler/hook-plugin-app type {:slot id :payload payload} nil) + #()) + []) [:div.lsp-hook-ui-slot (merge opts {:id id})]))) \ No newline at end of file diff --git a/src/main/frontend/components/settings.cljs b/src/main/frontend/components/settings.cljs index c4b10732e5a..374d91d5a39 100644 --- a/src/main/frontend/components/settings.cljs +++ b/src/main/frontend/components/settings.cljs @@ -244,7 +244,7 @@ (config-handler/set-config! :date-formatter format))))} (for [format (sort (date/journal-title-formatters))] [:option (cond-> - {:key format} + {:key format} (= format custom-date-format) (assoc :selected "selected")) format])]]]] @@ -352,10 +352,7 @@ [:div.mt-1.sm:mt-0.sm:col-span-2 [:div.rounded-md.sm:max-w-xs (ui/toggle developer-mode? - (fn [] - (let [mode (not developer-mode?)] - (state/set-developer-mode! mode) - (and mode (js/alert (t :developer-mode-alert))))) + #(state/set-developer-mode! (not developer-mode?)) true)]]] [:div.text-sm.opacity-50 (t :settings-page/developer-mode-desc)] diff --git a/src/main/frontend/components/theme.cljs b/src/main/frontend/components/theme.cljs index 32a110e503d..d2ced96f012 100644 --- a/src/main/frontend/components/theme.cljs +++ b/src/main/frontend/components/theme.cljs @@ -2,7 +2,6 @@ (:require [rum.core :as rum] [frontend.util :as util] [frontend.handler.route :as route-handler] - [frontend.handler.plugin :as plugin-handler] [frontend.components.svg :as svg])) (rum/defc container @@ -13,8 +12,7 @@ (.setAttribute doc "data-theme" (if (= theme "white") "light" theme)) (if (= theme "dark") ;; for tailwind dark mode (.add cls "dark") - (.remove cls "dark")) - (plugin-handler/hook-plugin-app :theme-mode-changed theme nil)) + (.remove cls "dark"))) [theme]) (rum/use-effect! diff --git a/src/main/frontend/components/theme.css b/src/main/frontend/components/theme.css index 423e6b72aa1..42601b2fa06 100644 --- a/src/main/frontend/components/theme.css +++ b/src/main/frontend/components/theme.css @@ -214,12 +214,3 @@ html.is-resizing-buf { transition: none; } } - -body[data-page=plugins] { - .cp__sidebar-main-content { - max-width: 1280px; - width: 80%; - padding-left: 30px; - padding-right: 30px; - } -} \ No newline at end of file diff --git a/src/main/frontend/core.cljs b/src/main/frontend/core.cljs index 0c1e5bc98bd..ef1fcd2c96b 100644 --- a/src/main/frontend/core.cljs +++ b/src/main/frontend/core.cljs @@ -1,7 +1,6 @@ (ns frontend.core (:require [rum.core :as rum] [frontend.handler :as handler] - [frontend.handler.plugin :as plugin-handler] [frontend.handler.route :as route] [frontend.page :as page] [frontend.routes :as routes] @@ -45,8 +44,7 @@ ;; this is called in the index.html and must be exported ;; so it is available even in :advanced release builds - (plugin-handler/setup! - #(handler/start! start)) + (handler/start! start) ;; popup to notify user, could be toggled in settings ;; (handler/request-notifications-if-not-asked) diff --git a/src/main/frontend/dicts.cljs b/src/main/frontend/dicts.cljs index d29eec14474..7cc82cfe46b 100644 --- a/src/main/frontend/dicts.cljs +++ b/src/main/frontend/dicts.cljs @@ -325,9 +325,6 @@ title: How to take dummy notes? :all-journals "All journals" :my-publishing "My publishing" :settings "Settings" - :plugins "Plugins" - :themes "Themes" - :developer-mode-alert "If you want enable plugin system just now, please restart app." :import "Import" :join-community "Join the community" :sponsor-us "Sponsor Us" @@ -1051,9 +1048,6 @@ title: How to take dummy notes? :all-files "所有文件" :my-publishing "我的发布" :settings "设置" - :plugins "插件" - :themes "主题" - :developer-mode-alert "如果希望插件功能立刻生效, 请重启应用" :import "导入" :join-community "加入社区" :sponsor-us "赞助我们!" diff --git a/src/main/frontend/handler/plugin.cljs b/src/main/frontend/handler/plugin.cljs index c392674a6cd..40a961dc07a 100644 --- a/src/main/frontend/handler/plugin.cljs +++ b/src/main/frontend/handler/plugin.cljs @@ -4,7 +4,6 @@ [frontend.util :as util] [frontend.fs :as fs] [frontend.handler.notification :as notifications] - [frontend.storage :as storage] [camel-snake-kebab.core :as csk] [frontend.state :as state] [medley.core :as md] @@ -12,9 +11,7 @@ [cljs-bean.core :as bean] [clojure.string :as string])) -(defonce lsp-enabled? - (and (util/electron?) - (= (storage/get "developer-mode") "true"))) +(defonce lsp-enabled? (util/electron?)) ;; state handlers (defn register-plugin diff --git a/src/main/frontend/handler/route.cljs b/src/main/frontend/handler/route.cljs index cf7b914c991..b82055a8fc3 100644 --- a/src/main/frontend/handler/route.cljs +++ b/src/main/frontend/handler/route.cljs @@ -77,11 +77,6 @@ title (get-title (:name data) path-params)] (util/set-title! title))) -(defn update-page-label! - [route] - (let [{:keys [data]} route] - (set! (. js/document.body.dataset -page) (name (:name data))))) - (defn jump-to-anchor! [anchor-text] (when anchor-text @@ -92,7 +87,6 @@ (let [route route] (swap! state/state assoc :route-match route) (update-page-title! route) - (update-page-label! route) (when-let [anchor (get-in route [:query-params :anchor])] (jump-to-anchor! anchor) (util/scroll-to-top)))) diff --git a/src/main/frontend/page.cljs b/src/main/frontend/page.cljs index f403a4a243c..9b8630114ca 100644 --- a/src/main/frontend/page.cljs +++ b/src/main/frontend/page.cljs @@ -3,7 +3,6 @@ [frontend.state :as state] [frontend.ui :as ui] [frontend.components.sidebar :as sidebar] - [frontend.handler.plugin :as plugin-handler] [frontend.context.i18n :as i18n])) (rum/defc route-view @@ -16,7 +15,6 @@ (state/setup-electron-updater!) (ui/inject-document-devices-envs!) (ui/inject-dynamic-style-node!) - (plugin-handler/host-mounted!) (let [teardown-fn (comp (ui/setup-patch-ios-fixed-bottom-position!))] (assoc state ::teardown teardown-fn))) :will-unmount (fn [state] diff --git a/src/main/frontend/routes.cljs b/src/main/frontend/routes.cljs index a8817312b18..9962a33e11f 100644 --- a/src/main/frontend/routes.cljs +++ b/src/main/frontend/routes.cljs @@ -4,7 +4,6 @@ [frontend.components.file :as file] [frontend.components.page :as page] [frontend.components.diff :as diff] - [frontend.components.plugins :as plugins] [frontend.components.journal :as journal] [frontend.components.search :as search] [frontend.components.settings :as settings] @@ -66,8 +65,4 @@ ["/all-journals" {:name :all-journals - :view journal/all-journals}] - - ["/plugins" - {:name :plugins - :view plugins/installed-page}]]) + :view journal/all-journals}]]) diff --git a/src/main/frontend/state.cljs b/src/main/frontend/state.cljs index ac0376c53a6..96204f12f9c 100644 --- a/src/main/frontend/state.cljs +++ b/src/main/frontend/state.cljs @@ -112,16 +112,6 @@ :electron/updater-pending? false :electron/updater {} - ;; plugin - :plugin/indicator-text nil - :plugin/installed-plugins {} - :plugin/installed-themes [] - :plugin/installed-commands {} - :plugin/simple-commands {} - :plugin/selected-theme nil - :plugin/selected-unpacked-pkg nil - :plugin/active-readme nil - ;; all notification contents as k-v pairs :notification/contents {} :graph/syncing? false @@ -1040,15 +1030,6 @@ [] (:commands (get-config))) -(defn get-plugins-commands - [] - (mapcat seq (flatten (vals (:plugin/installed-commands @state))))) - -(defn get-plugins-commands-with-type - [type] - (filterv #(= (keyword (first %)) (keyword type)) - (apply concat (vals (:plugin/simple-commands @state))))) - (defn get-scheduled-future-days [] (let [days (:scheduled/future-days (get-config))]