@@ -35,6 +35,7 @@ import { computed, inject, onBeforeUnmount, onMounted, ref, watch } from 'vue';
3535import type { IGlobal } from ' ../interfaces' ;
3636
3737import { newDay , newNote } from ' ../services/consts' ;
38+ import directionService from ' ../services/direction' ;
3839import eventHub from ' ../services/eventHub' ;
3940import { SharedBuefy } from ' ../services/sharedBuefy' ;
4041import themeService from ' ../services/theme' ;
@@ -813,6 +814,10 @@ const getExtensions = (): Extension[] => {
813814 const newValue = update .state .doc .toString ();
814815 generateTaskList (newValue );
815816 throttledEmit (newValue );
817+ // Update auto-direction if in auto mode
818+ if (directionService .preference === ' auto' ) {
819+ debouncedDirectionUpdate (newValue );
820+ }
816821 }
817822 }),
818823 EditorView .domEventHandlers ({
@@ -859,6 +864,15 @@ const throttledEmit = _.throttle(
859864 { trailing: true , leading: false }
860865);
861866
867+ // Debounced direction update for auto-detection
868+ const debouncedDirectionUpdate = _ .debounce (
869+ (value : string ) => {
870+ directionService .updateAutoDirection (value );
871+ },
872+ 500 ,
873+ { trailing: true , leading: false }
874+ );
875+
862876onMounted (() => {
863877 if (! editorContainer .value ) return ;
864878
@@ -873,6 +887,10 @@ onMounted(() => {
873887 handleValueUpdate (true );
874888 // Generate task list on initial mount
875889 generateTaskList (props .value || ' ' );
890+ // Trigger auto-direction on initial content
891+ if (directionService .preference === ' auto' ) {
892+ directionService .updateAutoDirection (props .value || ' ' );
893+ }
876894 eventHub .on (' focusEditor' , focus );
877895});
878896
@@ -977,7 +995,7 @@ defineExpose({
977995 }
978996
979997 .editor :deep(.cm-gutters ) {
980- padding-left : 4px ;
998+ padding-inline-start : 4px ;
981999 }
9821000}
9831001 </style >
0 commit comments