@bhsd/codemirror-mediawiki 3.6.6 → 3.7.0

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
@@ -1229,6 +1229,7 @@ registerSignatureHelp();
1229
1229
  1. Non-existing parser functions starting with `#` are highlighted as parser functions ([Example](http://bhsd-harry.github.io/codemirror-mediawiki/tests.html#Parsoid%3A%20unknown%20parser%20function%20(T314524))).
1230
1230
  1. Wikitext in template parameter names is not highlighted ([Example](http://bhsd-harry.github.io/codemirror-mediawiki/tests.html#Templates%3A%20Other%20wikitext%20in%20parameter%20names%20(T69657))).
1231
1231
  1. Template parameter names followed by a newline are not recognized ([Example](http://bhsd-harry.github.io/codemirror-mediawiki/tests.html#Templates%3A%20Handle%20comments%20in%20parameter%20names%20(T69657))).
1232
+ 1. Template-like syntax without a template name ([Example](http://bhsd-harry.github.io/codemirror-mediawiki/tests.html#T408631%3A%20Invalid%20templates%20inside%20template%20parameters)).
1232
1233
 
1233
1234
  ### Heading
1234
1235
 
@@ -1237,6 +1238,7 @@ registerSignatureHelp();
1237
1238
  ### Table
1238
1239
 
1239
1240
  1. Comments at the SOL should not break table syntax ([Example](https://bhsd-harry.github.io/codemirror-mediawiki/tests.html#3c.%20Table%20cells%20without%20escapable%20prefixes%20after%20edits)).
1241
+ 1. `!!` in links should start a new `<th>` ([Example](http://bhsd-harry.github.io/codemirror-mediawiki/tests.html#Precedence%20of%20table%20over%20links)).
1240
1242
 
1241
1243
  ### External link
1242
1244
 
@@ -9,6 +9,7 @@ import type { Option, LiveOption } from './linter';
9
9
  import type { LintSource, LintSources, LintSourceGetter } from './lintsource';
10
10
  import type statusBar from './statusBar';
11
11
  import type { MwConfig } from './token';
12
+ import type { Selection } from './matchBrackets';
12
13
  export type AddonMain<T> = (config?: T, cm?: CodeMirror6) => Extension;
13
14
  export type Addon<T> = [AddonMain<T>, Record<string, T>?];
14
15
  export type Dialect = 'sanitized-css' | undefined;
@@ -128,10 +129,7 @@ export declare class CodeMirror6 {
128
129
  * Scroll to the specified position
129
130
  * @param position position or selection range
130
131
  */
131
- scrollTo(position?: number | {
132
- anchor: number;
133
- head: number;
134
- }): void;
132
+ scrollTo(position?: number | Selection): void;
135
133
  /**
136
134
  * Set the editor theme
137
135
  * @param theme theme name
package/dist/fold.js CHANGED
@@ -338,7 +338,14 @@ export const foldRef = /* @__PURE__ */ foldCommand(true), unfoldRef = (view) =>
338
338
  }
339
339
  return false;
340
340
  };
341
- export default ((e = defaultFoldExtension) => e);
341
+ export default ((e = defaultFoldExtension) => [
342
+ e,
343
+ EditorView.theme({
344
+ '.cm-foldGutter': {
345
+ order: 2,
346
+ },
347
+ }),
348
+ ]);
342
349
  export const mediaWikiFold = /* @__PURE__ */ (() => [
343
350
  codeFolding({
344
351
  placeholderDOM(view) {
@@ -1,13 +1,16 @@
1
1
  import type { EditorView } from '@codemirror/view';
2
2
  import type { EditorState, Text } from '@codemirror/state';
3
3
  import type { Language } from '@codemirror/language';
4
- import type { Diagnostic } from '@codemirror/lint';
4
+ import type { Diagnostic, Action } from '@codemirror/lint';
5
5
  import type { Option, LiveOption } from './linter';
6
6
  export type LintSource = ((state: EditorState) => Diagnostic[] | Promise<Diagnostic[]>) & {
7
7
  fixer?: (doc: Text, rule?: string) => string | Promise<string>;
8
8
  };
9
9
  export type LintSources = LintSource | [LintSource] | [LintSource, LintSource];
10
10
  export type LintSourceGetter = (opt?: Option | LiveOption, view?: EditorView, nestedMWLanguage?: Language) => LintSource | Promise<LintSource>;
11
+ export interface ExtendedAction extends Action {
12
+ tooltip: string | undefined;
13
+ }
11
14
  /**
12
15
  * 获取Linter选项
13
16
  * @param opt Linter选项
@@ -74,9 +74,14 @@ const jsLintSource = (esLint, code, opt, doc, f = 0, t) => esLint(code, opt)
74
74
  if (fix || suggestions.length > 0) {
75
75
  diagnostic.actions = [
76
76
  ...fix ? [{ name: 'fix', fix }] : [],
77
- ...suggestions.map(suggestion => ({ name: 'suggestion', fix: suggestion.fix })),
78
- ].map(({ name, fix: { range: [from, to], text } }) => ({
77
+ ...suggestions.map(suggestion => ({
78
+ name: suggestion.messageId || 'suggestion',
79
+ fix: suggestion.fix,
80
+ tooltip: suggestion.desc,
81
+ })),
82
+ ].map(({ name, fix: { range: [from, to], text }, tooltip }) => ({
79
83
  name,
84
+ tooltip,
80
85
  apply(view) {
81
86
  view.dispatch({
82
87
  changes: { from: from + f, to: to + f, insert: text },