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

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.2",
4
+ "version": "0.1.4",
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, 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: "start", yMargin: verticalMargin })
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: "start", yMargin: verticalMargin })
138
+ effects: EditorView.scrollIntoView(node.from, { y: verticalScrollStrategy, yMargin: verticalMargin })
139
139
  });
140
140
  }
141
141
  return {
@@ -25,7 +25,7 @@ function buildInternalLinkDecorations(state) {
25
25
  props.display = state.doc.sliceString(displayNode.from, displayNode.to);
26
26
  }
27
27
  widgets.push(Decoration.widget({
28
- widget: new ProseVueComponentEmbedWidget(linkInfo.embedComponent, props, node.from),
28
+ widget: new ProseVueComponentEmbedWidget(linkInfo.embedComponent, linkInfo?.componentProps || props, node.from),
29
29
  block: true,
30
30
  side: 1
31
31
  }).range(line.to));
@@ -30,6 +30,10 @@ export interface InternalLink {
30
30
  * If not provided, embeds of this link will be rendered as standard links.
31
31
  */
32
32
  embedComponent?: Component;
33
+ /**
34
+ * An optional parameter to pass alongside into the component as the prop.
35
+ */
36
+ componentProps?: Record<string, any>
33
37
  }
34
38
 
35
39
  export interface InternalLinkNode {
@@ -108,4 +112,4 @@ export interface SearchMatch {
108
112
  export interface SearchOptions {
109
113
  query: string;
110
114
  caseSensitive?: boolean;
111
- }
115
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@type32/codemirror-rich-obsidian-editor",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "OFM Editor Component for Nuxt.",
5
5
  "repository": "Type-32/codemirror-rich-obsidian",
6
6
  "license": "MIT",