@@ -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 }
0 commit comments