@bhsd/codemirror-mediawiki 2.6.0 → 2.6.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/README.md CHANGED
@@ -19,6 +19,7 @@
19
19
  - [lint](#lint)
20
20
  - [localize](#localize)
21
21
  - [prefer](#prefer)
22
+ - [scrollTo](#scrollto)
22
23
  - [setContent](#setcontent)
23
24
  - [setIndent](#setindent)
24
25
  - [setLanguage](#setlanguage)
@@ -287,6 +288,22 @@ cm.prefer({
287
288
 
288
289
  </details>
289
290
 
291
+ ## scrollTo
292
+
293
+ <details>
294
+ <summary>Expand</summary>
295
+
296
+ *version added: 2.6.2*
297
+
298
+ **param**: [`number | {anchor: number, head: number}`](https://codemirror.net/docs/ref/#state.SelectionRange.anchor) the position or range to scroll to, default as the current cursor position
299
+ Scroll to the given position or range.
300
+
301
+ ```js
302
+ cm.scrollTo();
303
+ ```
304
+
305
+ </details>
306
+
290
307
  ## setContent
291
308
 
292
309
  <details>
@@ -8,6 +8,7 @@ import type { MwConfig } from './mediawiki';
8
8
  export type { MwConfig };
9
9
  export type LintSource = (doc: Text) => Diagnostic[] | Promise<Diagnostic[]>;
10
10
  export declare const CDN = "https://testingcf.jsdelivr.net";
11
+ /** CodeMirror 6 编辑器 */
11
12
  export declare class CodeMirror6 {
12
13
  #private;
13
14
  get textarea(): HTMLTextAreaElement;
@@ -73,6 +74,14 @@ export declare class CodeMirror6 {
73
74
  * @param position 位置
74
75
  */
75
76
  getNodeAt(position: number): SyntaxNode | undefined;
77
+ /**
78
+ * 滚动至指定位置
79
+ * @param r 位置
80
+ */
81
+ scrollTo(r?: number | {
82
+ anchor: number;
83
+ head: number;
84
+ }): void;
76
85
  /**
77
86
  * 替换选中内容
78
87
  * @param view