@type32/codemirror-rich-obsidian-editor 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/module.json
CHANGED
|
@@ -27,5 +27,5 @@ export declare function useEditorUtils(editor: Ref<any>): {
|
|
|
27
27
|
findNext: () => void;
|
|
28
28
|
findPrevious: () => void;
|
|
29
29
|
replaceCurrent: (replacement: string) => void;
|
|
30
|
-
scrollToNode: (node: SyntaxNode, verticalMargin?: number) => void;
|
|
30
|
+
scrollToNode: (node: SyntaxNode, verticalScrollStrategy?: "nearest" | "start" | "end" | "center", verticalMargin?: number) => void;
|
|
31
31
|
};
|
|
@@ -73,12 +73,12 @@ export function useEditorUtils(editor) {
|
|
|
73
73
|
searchResults.value = findAllMatches(doc, options);
|
|
74
74
|
currentMatchIndex.value = -1;
|
|
75
75
|
}
|
|
76
|
-
function selectAndScrollToMatch(match, verticalMargin) {
|
|
76
|
+
function selectAndScrollToMatch(match, verticalScrollStrategy = "start", verticalMargin) {
|
|
77
77
|
const editorView = unref(view);
|
|
78
78
|
if (!editorView || !match) return;
|
|
79
79
|
editorView.dispatch({
|
|
80
80
|
selection: { anchor: match.from, head: match.to },
|
|
81
|
-
effects: EditorView.scrollIntoView(match.from, { y:
|
|
81
|
+
effects: EditorView.scrollIntoView(match.from, { y: verticalScrollStrategy, yMargin: verticalMargin })
|
|
82
82
|
});
|
|
83
83
|
}
|
|
84
84
|
function findNext() {
|
|
@@ -131,11 +131,11 @@ export function useEditorUtils(editor) {
|
|
|
131
131
|
searchResults.value = [];
|
|
132
132
|
currentMatchIndex.value = -1;
|
|
133
133
|
}
|
|
134
|
-
function scrollToNode(node, verticalMargin) {
|
|
134
|
+
function scrollToNode(node, verticalScrollStrategy = "start", verticalMargin) {
|
|
135
135
|
const editorView = unref(view);
|
|
136
136
|
if (!editorView || !node) return;
|
|
137
137
|
editorView.dispatch({
|
|
138
|
-
effects: EditorView.scrollIntoView(node.from, { y:
|
|
138
|
+
effects: EditorView.scrollIntoView(node.from, { y: verticalScrollStrategy, yMargin: verticalMargin })
|
|
139
139
|
});
|
|
140
140
|
}
|
|
141
141
|
return {
|