Skip to content

Commit 50894e5

Browse files
1.0.3
1 parent 2bbe79b commit 50894e5

File tree

3 files changed

+48
-60
lines changed

3 files changed

+48
-60
lines changed

example/src/routes/index.svelte

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,50 @@
33
import CodeMirror from "../../../src/CodeMirror.svelte";
44
</script>
55

6+
<style>
7+
.codemirror-container {
8+
position: relative;
9+
width: 100%;
10+
height: 100%;
11+
border: none;
12+
line-height: 1.5;
13+
overflow: hidden;
14+
}
15+
16+
.codemirror-container :global(.CodeMirror) {
17+
height: 100%;
18+
background: transparent;
19+
font: 400 14px/1.7 var(--font-mono);
20+
color: var(--base);
21+
}
22+
23+
.codemirror-container.flex :global(.CodeMirror) {
24+
height: auto;
25+
}
26+
27+
.codemirror-container.flex :global(.CodeMirror-lines) {
28+
padding: 0;
29+
}
30+
31+
.codemirror-container :global(.CodeMirror-gutters) {
32+
padding: 0 16px 0 8px;
33+
border: none;
34+
}
35+
36+
.codemirror-container :global(.error-loc) {
37+
position: relative;
38+
border-bottom: 2px solid #da106e;
39+
}
40+
41+
.codemirror-container :global(.error-line) {
42+
background-color: rgba(200, 0, 0, 0.05);
43+
}
44+
</style>
45+
646
<svelte:head>
747
<title>svelte-codemirror example</title>
848
</svelte:head>
949

10-
<CodeMirror />
50+
<div class="codemirror-container">
51+
<CodeMirror />
52+
</div>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "svelte-codemirror",
3-
"version": "1.0.2",
3+
"version": "1.0.3",
44
"description": "An svelte v3 component for embedding codemirrorjs",
55
"main": "src/CodeMirror.svelte",
66
"svelte": "src/CodeMirror.svelte",

src/CodeMirror.svelte

Lines changed: 4 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -199,44 +199,6 @@
199199
</script>
200200

201201
<style>
202-
.codemirror-container {
203-
position: relative;
204-
width: 100%;
205-
height: 100%;
206-
border: none;
207-
line-height: 1.5;
208-
overflow: hidden;
209-
}
210-
211-
.codemirror-container :global(.CodeMirror) {
212-
height: 100%;
213-
background: transparent;
214-
font: 400 14px/1.7 var(--font-mono);
215-
color: var(--base);
216-
}
217-
218-
.codemirror-container.flex :global(.CodeMirror) {
219-
height: auto;
220-
}
221-
222-
.codemirror-container.flex :global(.CodeMirror-lines) {
223-
padding: 0;
224-
}
225-
226-
.codemirror-container :global(.CodeMirror-gutters) {
227-
padding: 0 16px 0 8px;
228-
border: none;
229-
}
230-
231-
.codemirror-container :global(.error-loc) {
232-
position: relative;
233-
border-bottom: 2px solid #da106e;
234-
}
235-
236-
.codemirror-container :global(.error-line) {
237-
background-color: rgba(200, 0, 0, 0.05);
238-
}
239-
240202
textarea {
241203
visibility: hidden;
242204
}
@@ -259,25 +221,9 @@
259221
tab-size: 2;
260222
-moz-tab-size: 2;
261223
}
262-
263-
.flex pre {
264-
padding: 0 0 0 4px;
265-
height: auto;
266-
}
267224
</style>
268225

269-
<div
270-
class="codemirror-container"
271-
class:flex
272-
bind:offsetWidth={w}
273-
bind:offsetHeight={h}>
274-
<textarea tabindex="0" bind:this={refs.editor} readonly value={code} />
275-
276-
{#if !CodeMirror}
277-
<pre style="position: absolute; left: 0; top: 0">{code}</pre>
278-
279-
<!-- <div style="position: absolute; width: 100%; bottom: 0">
280-
<Message kind="info">loading editor...</Message>
281-
</div> -->
282-
{/if}
283-
</div>
226+
<textarea tabindex="0" bind:this={refs.editor} readonly value={code} />
227+
{#if !CodeMirror}
228+
<pre style="position: absolute; left: 0; top: 0">{code}</pre>
229+
{/if}

0 commit comments

Comments
 (0)