-
Notifications
You must be signed in to change notification settings - Fork 124
Expand file tree
/
Copy patheditor.js
More file actions
117 lines (101 loc) · 2.31 KB
/
editor.js
File metadata and controls
117 lines (101 loc) · 2.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
import { BACKGROUND_COLOR, LINE_HEIGHT, FONT_SIZE } from './theme-default';
const FONT_FAMILY = `"SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace`;
const COLOR = (CSS.supports('caret-color', '#000')) ? BACKGROUND_COLOR : '#ccc';
const LINE_NUMBER_WIDTH = '40px'
export const editor_css = `
.codeflask {
position: absolute;
width: 100%;
height: 100%;
overflow: hidden;
}
.codeflask, .codeflask * {
box-sizing: border-box;
}
.codeflask__pre {
pointer-events: none;
z-index: 3;
overflow: hidden;
}
.codeflask__textarea {
background: none;
border: none;
color: ${COLOR};
z-index: 1;
resize: none;
font-family: ${FONT_FAMILY};
-webkit-appearance: pre;
caret-color: #111;
z-index: 2;
width: 100%;
height: 100%;
}
.codeflask--has-line-numbers .codeflask__textarea {
width: calc(100% - ${LINE_NUMBER_WIDTH});
}
.codeflask__code {
display: block;
font-family: ${FONT_FAMILY};
overflow: hidden;
}
.codeflask__flatten {
padding: 10px;
font-size: ${FONT_SIZE};
line-height: ${LINE_HEIGHT};
white-space: pre;
position: absolute;
top: 0;
left: 0;
overflow: auto;
margin: 0 !important;
outline: none;
text-align: left;
}
.codeflask__flatten.word-wrap {
white-space: pre-wrap;
word-wrap: break-word;
}
.codeflask--has-line-numbers .codeflask__flatten {
width: calc(100% - ${LINE_NUMBER_WIDTH});
left: ${LINE_NUMBER_WIDTH};
}
.codeflask__line-highlight {
position: absolute;
top: 10px;
left: 0;
width: 100%;
height: ${LINE_HEIGHT};
background: rgba(0,0,0,0.1);
z-index: 1;
}
.codeflask__lines {
padding: 10px 4px;
font-size: 12px;
line-height: ${LINE_HEIGHT};
font-family: 'Cousine', monospace;
position: absolute;
left: 0;
top: 0;
width: ${LINE_NUMBER_WIDTH};
height: 100%;
text-align: right;
color: #999;
z-index: 2;
}
.codeflask__lines__line {
display: block;
}
.codeflask.codeflask--has-line-numbers {
padding-left: ${LINE_NUMBER_WIDTH};
}
.codeflask.codeflask--has-line-numbers:before {
content: '';
position: absolute;
left: 0;
top: 0;
width: ${LINE_NUMBER_WIDTH};
height: 100%;
background: #eee;
z-index: 1;
}
`;