@type32/codemirror-rich-obsidian-editor 0.1.1 → 0.1.2

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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@type32/codemirror-rich-obsidian-editor",
3
3
  "configKey": "cmOfmEditor",
4
- "version": "0.1.1",
4
+ "version": "0.1.2",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -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) => void;
30
+ scrollToNode: (node: SyntaxNode, 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) {
76
+ function selectAndScrollToMatch(match, 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: "center" })
81
+ effects: EditorView.scrollIntoView(match.from, { y: "start", 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) {
134
+ function scrollToNode(node, verticalMargin) {
135
135
  const editorView = unref(view);
136
136
  if (!editorView || !node) return;
137
137
  editorView.dispatch({
138
- effects: EditorView.scrollIntoView(node.from, { y: "center" })
138
+ effects: EditorView.scrollIntoView(node.from, { y: "start", yMargin: verticalMargin })
139
139
  });
140
140
  }
141
141
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@type32/codemirror-rich-obsidian-editor",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "OFM Editor Component for Nuxt.",
5
5
  "repository": "Type-32/codemirror-rich-obsidian",
6
6
  "license": "MIT",