Skip to content

Commit

Permalink
modified: main.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
joycode-hub committed Jul 13, 2024
1 parent 840fc4e commit 5cbd892
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
Decoration,
DecorationSet
} from "@codemirror/view";
import { platform } from 'os';

interface DateMatch {
from: number;
Expand All @@ -23,7 +22,7 @@ interface DateFormat {
}

class PickerButtonWidget extends WidgetType {
toDOM(view: EditorView): HTMLElement {
toDOM(): HTMLElement {
const button = document.createElement('span');
button.className = 'datepicker-button';
setIcon(button, 'calendar');
Expand All @@ -50,7 +49,6 @@ function pickerButtons(dateMatches: DateMatch[]) {
class DatepickerCMPlugin implements PluginValue {

private view: EditorView;
private previousDocumentTop: number | undefined;

datepickerScrollPositionHandler = (view: EditorView) => {
if (this.datepicker === undefined) return;
Expand All @@ -60,11 +58,13 @@ class DatepickerCMPlugin implements PluginValue {
return pos;
},
write: pos => {
this.datepicker!.updatePosition({
top: pos!.top,
left: pos!.left,
bottom: pos!.bottom
});
if (pos) {
this.datepicker!.updatePosition({
top: pos!.top,
left: pos!.left,
bottom: pos!.bottom
});
}
}
});
};
Expand Down

0 comments on commit 5cbd892

Please sign in to comment.