Skip to content

Commit 05fc04e

Browse files
committed
support multiple codemirror values
1 parent 6a3215d commit 05fc04e

File tree

4 files changed

+13
-8
lines changed

4 files changed

+13
-8
lines changed

src/renderer/attribute/impl/style.cljs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@
1010
(defmethod attribute.hierarchy/form-element [:default :style]
1111
[_ k v {:keys [disabled]}]
1212
(let [codemirror-theme @(rf/subscribe [::theme.subs/codemirror])]
13-
[:div.w-full.bg-primary.p-1
13+
[:div.w-full.bg-primary.px-2.py-1
1414
{:class (when disabled "*:[&.CodeMirror]:opacity-50")}
15-
[views/cm-editor v {:on-blur #(rf/dispatch [::element.events/set-attr k %])
16-
:attrs {:id (name k)}
17-
:options {:mode "css"
18-
:readOnly disabled
19-
:theme codemirror-theme}}]]))
15+
[views/cm-editor (str v) {:on-blur #(rf/dispatch [::element.events/set-attr k %])
16+
:attrs {:id (name k)}
17+
:options {:mode "css"
18+
:placeholder (when-not v "multiple")
19+
:readOnly disabled
20+
:theme codemirror-theme}}]]))

src/renderer/components.css

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
@utility form-element {
2-
@apply bg-primary border-0 w-full outline-none shadow-none!;
2+
@apply bg-primary border-0 w-full outline-none px-3 py-1 shadow-none!;
33

4-
padding: 4px 12px;
54
box-sizing: border-box;
65
font-size: 12px;
76
color: var(--font-color) !important;

src/renderer/overrides.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@
125125
@apply bg-secondary!;
126126
}
127127

128+
.CodeMirror-placeholder {
129+
@apply text-disabled! font-sans!;
130+
}
131+
128132
.CodeMirror {
129133
@apply font-mono h-auto z-0;
130134
background: transparent !important;

src/renderer/views.cljs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
["@radix-ui/react-switch" :as Switch]
1111
["@repath-project/react-color" :refer [PhotoshopPicker]]
1212
["codemirror" :as codemirror]
13+
["codemirror/addon/display/placeholder.js"]
1314
["codemirror/addon/hint/css-hint.js"]
1415
["codemirror/addon/hint/show-hint.js"]
1516
["codemirror/mode/css/css.js"]

0 commit comments

Comments
 (0)