@bhsd/codemirror-mediawiki 2.4.1 → 2.4.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 +18 -0
- package/dist/codemirror.d.ts +6 -0
- package/dist/main.min.js +11 -11
- package/dist/mw.min.js +1 -1
- package/dist/mw.min.js.map +3 -3
- package/i18n/en.json +1 -1
- package/i18n/zh-hans.json +1 -1
- package/i18n/zh-hant.json +1 -1
- package/mw/base.ts +2 -2
- package/mw/msg.ts +1 -1
- package/mw/openLinks.ts +43 -30
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
- [Methods](#methods)
|
|
16
16
|
- [extraKeys](#extrakeys)
|
|
17
17
|
- [getLinter](#getlinter)
|
|
18
|
+
- [getNodeAt](#getnodeat)
|
|
18
19
|
- [lint](#lint)
|
|
19
20
|
- [localize](#localize)
|
|
20
21
|
- [prefer](#prefer)
|
|
@@ -157,6 +158,23 @@ const linterCSS = await cm.getLinter({rules}); // Stylelint configuration
|
|
|
157
158
|
|
|
158
159
|
</details>
|
|
159
160
|
|
|
161
|
+
## getNodeAt
|
|
162
|
+
|
|
163
|
+
<details>
|
|
164
|
+
<summary>Expand</summary>
|
|
165
|
+
|
|
166
|
+
*version added: 2.4.2*
|
|
167
|
+
|
|
168
|
+
**param**: `number` position
|
|
169
|
+
**returns**: [`SyntaxNode | undefined`](https://lezer.codemirror.net/docs/ref/#common.SyntaxNode)
|
|
170
|
+
Get the syntax node at the given position.
|
|
171
|
+
|
|
172
|
+
```js
|
|
173
|
+
const tree = cm.getNodeAt(0);
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
</details>
|
|
177
|
+
|
|
160
178
|
## lint
|
|
161
179
|
|
|
162
180
|
<details>
|
package/dist/codemirror.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { EditorView } from '@codemirror/view';
|
|
2
2
|
import type { KeyBinding } from '@codemirror/view';
|
|
3
3
|
import type { Text } from '@codemirror/state';
|
|
4
|
+
import type { SyntaxNode } from '@lezer/common';
|
|
4
5
|
import type { Diagnostic } from '@codemirror/lint';
|
|
5
6
|
export type { MwConfig } from './mediawiki';
|
|
6
7
|
export type LintSource = (doc: Text) => Diagnostic[] | Promise<Diagnostic[]>;
|
|
@@ -65,6 +66,11 @@ export declare class CodeMirror6 {
|
|
|
65
66
|
* @param messages 翻译信息
|
|
66
67
|
*/
|
|
67
68
|
localize(messages: Record<string, string>): void;
|
|
69
|
+
/**
|
|
70
|
+
* 获取语法树节点
|
|
71
|
+
* @param position 位置
|
|
72
|
+
*/
|
|
73
|
+
getNodeAt(position: number): SyntaxNode | undefined;
|
|
68
74
|
/**
|
|
69
75
|
* 替换选中内容
|
|
70
76
|
* @param view EditorView
|