|
|
@@ -1,34 +1,25 @@
|
|
|
(ns frontend.components.editor
|
|
|
- (:require [rum.core :as rum]
|
|
|
+ (:require [clojure.string :as string]
|
|
|
+ [dommy.core :as d]
|
|
|
+ [frontend.commands :as commands
|
|
|
+ :refer [*angle-bracket-caret-pos *matched-block-commands *matched-commands *show-block-commands *show-commands *slash-caret-pos]]
|
|
|
+ [frontend.components.datetime :as datetime-comp]
|
|
|
+ [frontend.components.search :as search]
|
|
|
[frontend.components.svg :as svg]
|
|
|
- [cljs-bean.core :as bean]
|
|
|
[frontend.config :as config]
|
|
|
+ [frontend.db :as db]
|
|
|
[frontend.handler.editor :as editor-handler :refer [get-state]]
|
|
|
[frontend.handler.editor.lifecycle :as lifecycle]
|
|
|
- [frontend.util :as util :refer-macros [profile]]
|
|
|
- [frontend.handler.block :as block-handler]
|
|
|
- [frontend.components.block :as block]
|
|
|
- [frontend.components.search :as search]
|
|
|
[frontend.handler.page :as page-handler]
|
|
|
- [frontend.components.datetime :as datetime-comp]
|
|
|
- [frontend.state :as state]
|
|
|
[frontend.mixins :as mixins]
|
|
|
+ [frontend.modules.shortcut.core :as shortcut]
|
|
|
+ [frontend.state :as state]
|
|
|
[frontend.ui :as ui]
|
|
|
- [frontend.db :as db]
|
|
|
- [dommy.core :as d]
|
|
|
- [goog.object :as gobj]
|
|
|
+ [frontend.util :as util]
|
|
|
+ [frontend.util.cursor :as cursor]
|
|
|
[goog.dom :as gdom]
|
|
|
- [clojure.string :as string]
|
|
|
[promesa.core :as p]
|
|
|
- [frontend.commands :as commands
|
|
|
- :refer [*show-commands
|
|
|
- *matched-commands
|
|
|
- *slash-caret-pos
|
|
|
- *angle-bracket-caret-pos
|
|
|
- *matched-block-commands
|
|
|
- *show-block-commands]]
|
|
|
- ["/frontend/utils" :as utils]
|
|
|
- [frontend.modules.shortcut.core :as shortcut]))
|
|
|
+ [rum.core :as rum]))
|
|
|
|
|
|
(rum/defc commands < rum/reactive
|
|
|
[id format]
|
|
|
@@ -77,7 +68,7 @@
|
|
|
(let [pos (:editor/last-saved-cursor @state/state)
|
|
|
input (gdom/getElement id)]
|
|
|
(when input
|
|
|
- (let [current-pos (:pos (util/get-caret-pos input))
|
|
|
+ (let [current-pos (cursor/pos input)
|
|
|
edit-content (or (state/sub [:editor/content id]) "")
|
|
|
edit-block (state/sub :editor/block)
|
|
|
q (or
|
|
|
@@ -135,7 +126,7 @@
|
|
|
(let [pos (:editor/last-saved-cursor @state/state)
|
|
|
input (gdom/getElement id)
|
|
|
[id format] (:rum/args state)
|
|
|
- current-pos (:pos (util/get-caret-pos input))
|
|
|
+ current-pos (cursor/pos input)
|
|
|
edit-content (state/sub [:editor/content id])
|
|
|
edit-block (state/get-edit-block)
|
|
|
q (or
|
|
|
@@ -152,7 +143,7 @@
|
|
|
(let [pos (:editor/last-saved-cursor @state/state)
|
|
|
input (gdom/getElement id)]
|
|
|
(when input
|
|
|
- (let [current-pos (:pos (util/get-caret-pos input))
|
|
|
+ (let [current-pos (cursor/pos input)
|
|
|
edit-content (state/sub [:editor/content id])
|
|
|
edit-block (state/sub :editor/block)
|
|
|
q (or
|