@codemirror/lint 6.1.0 → 6.1.1

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/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## 6.1.1 (2023-02-15)
2
+
3
+ ### Bug fixes
4
+
5
+ Give lint action buttons a pointer cursor style.
6
+
7
+ Fix a bug that caused diagnostic action callbacks to be called twice when their button was clicked.
8
+
1
9
  ## 6.1.0 (2022-11-15)
2
10
 
3
11
  ### New features
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (C) 2018-2021 by Marijn Haverbeke <marijnh@gmail.com> and others
3
+ Copyright (C) 2018-2021 by Marijn Haverbeke <marijn@haverbeke.berlin> and others
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/dist/index.cjs CHANGED
@@ -291,8 +291,11 @@ function renderDiagnostic(view, diagnostic, inPanel) {
291
291
  var _a;
292
292
  let keys = inPanel ? assignKeys(diagnostic.actions) : [];
293
293
  return elt__default["default"]("li", { class: "cm-diagnostic cm-diagnostic-" + diagnostic.severity }, elt__default["default"]("span", { class: "cm-diagnosticText" }, diagnostic.renderMessage ? diagnostic.renderMessage() : diagnostic.message), (_a = diagnostic.actions) === null || _a === void 0 ? void 0 : _a.map((action, i) => {
294
- let click = (e) => {
294
+ let fired = false, click = (e) => {
295
295
  e.preventDefault();
296
+ if (fired)
297
+ return;
298
+ fired = true;
296
299
  let found = findDiagnostic(view.state.field(lintState).diagnostics, diagnostic);
297
300
  if (found)
298
301
  action.apply(view, found.from, found.to);
@@ -519,7 +522,8 @@ const baseTheme = view.EditorView.baseTheme({
519
522
  backgroundColor: "#444",
520
523
  color: "white",
521
524
  borderRadius: "3px",
522
- marginLeft: "8px"
525
+ marginLeft: "8px",
526
+ cursor: "pointer"
523
527
  },
524
528
  ".cm-diagnosticSource": {
525
529
  fontSize: "70%",
@@ -739,7 +743,7 @@ function lintGutter(config = {}) {
739
743
  /**
740
744
  Iterate over the marked diagnostics for the given editor state,
741
745
  calling `f` for each of them. Note that, if the document changed
742
- since the diagnostics werecreated, the `Diagnostic` object will
746
+ since the diagnostics were created, the `Diagnostic` object will
743
747
  hold the original outdated position, whereas the `to` and `from`
744
748
  arguments hold the diagnostic's current position.
745
749
  */
package/dist/index.d.ts CHANGED
@@ -148,7 +148,7 @@ declare function lintGutter(config?: LintGutterConfig): Extension;
148
148
  /**
149
149
  Iterate over the marked diagnostics for the given editor state,
150
150
  calling `f` for each of them. Note that, if the document changed
151
- since the diagnostics werecreated, the `Diagnostic` object will
151
+ since the diagnostics were created, the `Diagnostic` object will
152
152
  hold the original outdated position, whereas the `to` and `from`
153
153
  arguments hold the diagnostic's current position.
154
154
  */
package/dist/index.js CHANGED
@@ -283,8 +283,11 @@ function renderDiagnostic(view, diagnostic, inPanel) {
283
283
  var _a;
284
284
  let keys = inPanel ? assignKeys(diagnostic.actions) : [];
285
285
  return elt("li", { class: "cm-diagnostic cm-diagnostic-" + diagnostic.severity }, elt("span", { class: "cm-diagnosticText" }, diagnostic.renderMessage ? diagnostic.renderMessage() : diagnostic.message), (_a = diagnostic.actions) === null || _a === void 0 ? void 0 : _a.map((action, i) => {
286
- let click = (e) => {
286
+ let fired = false, click = (e) => {
287
287
  e.preventDefault();
288
+ if (fired)
289
+ return;
290
+ fired = true;
288
291
  let found = findDiagnostic(view.state.field(lintState).diagnostics, diagnostic);
289
292
  if (found)
290
293
  action.apply(view, found.from, found.to);
@@ -511,7 +514,8 @@ const baseTheme = /*@__PURE__*/EditorView.baseTheme({
511
514
  backgroundColor: "#444",
512
515
  color: "white",
513
516
  borderRadius: "3px",
514
- marginLeft: "8px"
517
+ marginLeft: "8px",
518
+ cursor: "pointer"
515
519
  },
516
520
  ".cm-diagnosticSource": {
517
521
  fontSize: "70%",
@@ -731,7 +735,7 @@ function lintGutter(config = {}) {
731
735
  /**
732
736
  Iterate over the marked diagnostics for the given editor state,
733
737
  calling `f` for each of them. Note that, if the document changed
734
- since the diagnostics werecreated, the `Diagnostic` object will
738
+ since the diagnostics were created, the `Diagnostic` object will
735
739
  hold the original outdated position, whereas the `to` and `from`
736
740
  arguments hold the diagnostic's current position.
737
741
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemirror/lint",
3
- "version": "6.1.0",
3
+ "version": "6.1.1",
4
4
  "description": "Linting support for the CodeMirror code editor",
5
5
  "scripts": {
6
6
  "test": "cm-runtests",
@@ -12,7 +12,7 @@
12
12
  ],
13
13
  "author": {
14
14
  "name": "Marijn Haverbeke",
15
- "email": "marijnh@gmail.com",
15
+ "email": "marijn@haverbeke.berlin",
16
16
  "url": "http://marijnhaverbeke.nl"
17
17
  },
18
18
  "type": "module",