@difizen/libro-codemirror 0.2.35-next.0 → 0.2.35

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.
@@ -1 +1 @@
1
- {"version":3,"file":"editor-contribution.d.ts","sourceRoot":"","sources":["../src/editor-contribution.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAMpE,qBACa,4BAA6B,YAAW,sBAAsB;IAEzE,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAI/B,OAAO,EAAE,iBAAiB,CAA2B;IACrD,YAAY,0DAAgB;IAC5B,aAAa,mDAA2B;CACzC"}
1
+ {"version":3,"file":"editor-contribution.d.ts","sourceRoot":"","sources":["../src/editor-contribution.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAOpE,qBACa,4BAA6B,YAAW,sBAAsB;IAEzE,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAO/B,OAAO,EAAE,iBAAiB,CAA2B;IACrD,YAAY,0DAAgB;IAC5B,aAAa,mDAA2B;CACzC"}
@@ -6,6 +6,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
6
6
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
7
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
8
8
  import { CodeEditorContribution } from '@difizen/libro-code-editor';
9
+ import { MIME } from '@difizen/libro-common';
9
10
  import { singleton } from '@difizen/mana-app';
10
11
  import { codeMirrorDefaultConfig } from "./editor.js";
11
12
  import { codeMirrorEditorFactory, stateFactory } from "./factory.js";
@@ -23,8 +24,11 @@ export var CodeMirrorEditorContribution = (_dec = singleton({
23
24
  value:
24
25
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
25
26
  function canHandle(mime) {
26
- // default editor
27
- return 50;
27
+ var mimes = [MIME.codemirror, MIME.text];
28
+ if (mimes.includes(mime)) {
29
+ return 50 + 1;
30
+ }
31
+ return 10;
28
32
  }
29
33
  }]);
30
34
  return CodeMirrorEditorContribution;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@difizen/libro-codemirror",
3
- "version": "0.2.35-next.0",
3
+ "version": "0.2.35",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "libro",
@@ -41,10 +41,10 @@
41
41
  "@codemirror/search": "^6.0.0",
42
42
  "@codemirror/state": "^6.4.0",
43
43
  "@codemirror/view": "^6.23.0",
44
- "@difizen/libro-code-editor": "^0.2.35-next.0",
45
- "@difizen/libro-common": "^0.2.35-next.0",
46
- "@difizen/libro-lsp": "^0.2.35-next.0",
47
- "@difizen/libro-rendermime": "^0.2.35-next.0",
44
+ "@difizen/libro-code-editor": "^0.2.35",
45
+ "@difizen/libro-common": "^0.2.35",
46
+ "@difizen/libro-lsp": "^0.2.35",
47
+ "@difizen/libro-rendermime": "^0.2.35",
48
48
  "@difizen/mana-app": "latest",
49
49
  "@lezer/common": "^1.2.1",
50
50
  "@lezer/highlight": "^1.1.4",
@@ -1,5 +1,6 @@
1
1
  import type { CodeEditorFactory } from '@difizen/libro-code-editor';
2
2
  import { CodeEditorContribution } from '@difizen/libro-code-editor';
3
+ import { MIME } from '@difizen/libro-common';
3
4
  import { singleton } from '@difizen/mana-app';
4
5
 
5
6
  import { codeMirrorDefaultConfig } from './editor.js';
@@ -9,8 +10,11 @@ import { codeMirrorEditorFactory, stateFactory } from './factory.js';
9
10
  export class CodeMirrorEditorContribution implements CodeEditorContribution {
10
11
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
11
12
  canHandle(mime: string): number {
12
- // default editor
13
- return 50;
13
+ const mimes = [MIME.codemirror, MIME.text] as string[];
14
+ if (mimes.includes(mime)) {
15
+ return 50 + 1;
16
+ }
17
+ return 10;
14
18
  }
15
19
  factory: CodeEditorFactory = codeMirrorEditorFactory;
16
20
  stateFactory = stateFactory;