Skip to content

Commit 6ce1488

Browse files
committed
Fix: Dark mode
1 parent 14eb63f commit 6ce1488

File tree

2 files changed

+22
-9
lines changed

2 files changed

+22
-9
lines changed

src/NoteEditor.js

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ function NoteEditor(props) {
88
var note = props.editNoteData;
99
// Set default screen size - full
1010
const [splitscreen, setSplitscreen] = useState(false);
11-
1211
const styles = {
1312
main_editor: {
1413
paddingLeft: "5px",
@@ -42,16 +41,20 @@ function NoteEditor(props) {
4241
borderRadius: "5px",
4342
},
4443
dark: {
45-
backgroundColor: "#2c2c2c",
46-
color: "#ffffff",
44+
backgroundColor: "hsl(0, 0%, 14%)",
45+
color: "#afafaf",
4746
},
4847
light: {
4948
backgroundColor: "#fafafa",
5049
color: "#000000",
5150
},
5251
mdtools_dark: {
53-
backgroundColor: "#5c5c5c",
54-
color: "#000000",
52+
backgroundColor: "hsl(0, 0%, 14%)",
53+
color: "#292a2b",
54+
},
55+
btn_dark: {
56+
backgroundColor: "hsl(0, 0%, 14%)",
57+
color: "#afafaf",
5558
},
5659
mdtools_light: {
5760
color: "#333",
@@ -61,10 +64,6 @@ function NoteEditor(props) {
6164
backgroundColor: "#fff",
6265
color: "#777",
6366
},
64-
btn_dark: {
65-
backgroundColor: "#5c5c5c",
66-
color: "#fff",
67-
},
6867
};
6968
// Toggle screensize
7069
const handleSplitScreen = () => {
@@ -257,6 +256,14 @@ function NoteEditor(props) {
257256
}
258257
};
259258

259+
// Handle Text selection / cursor position
260+
const inputRef = useRef();
261+
useEffect(() => {
262+
inputRef.current.selectionStart = cusor.start;
263+
inputRef.current.selectionEnd = cusor.end;
264+
inputRef.current.focus();
265+
}, [bodytxt]);
266+
260267
// Paste Event
261268
const handlePaste = (e) => {
262269
// Prevent the default action
@@ -472,6 +479,7 @@ function NoteEditor(props) {
472479
data-action={note.action}
473480
value={bodytxt}
474481
id="notebody"
482+
ref={inputRef}
475483
data-action={note.action}
476484
selectionEnd={cusor.end}
477485
selectionStart={cusor.start}

src/styles.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,10 @@ h3 {
396396
height: calc(100% - 50px);
397397
}
398398

399+
textarea:focus {
400+
background: hsl(0, 7%, 20%);
401+
}
402+
399403
.md-txtarea {
400404
height: inherit;
401405
}
@@ -548,6 +552,7 @@ button[disabled]:hover {
548552
padding: 6px 12px;
549553
}
550554

555+
/* WIP */
551556
.tooltiptext {
552557
visibility: hidden;
553558
width: 120px;

0 commit comments

Comments
 (0)