@difizen/libro-markdown-cell 0.2.28 → 0.2.30

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,12 +1,15 @@
1
+ import type { LanguageSpecRegistry } from '@difizen/libro-code-editor';
2
+ import { LanguageSpecContribution } from '@difizen/libro-code-editor';
1
3
  import type { CellMeta, CellOptions, CellModel } from '@difizen/libro-core';
2
4
  import { CellModelContribution, CellViewContribution } from '@difizen/libro-core';
3
5
  import { MarkdownCellModelFactory } from './markdown-cell-protocol.js';
4
6
  import { MarkdownCellView } from './markdown-cell-view.js';
5
- export declare class MarkdownCellContribution implements CellModelContribution, CellViewContribution {
7
+ export declare class MarkdownCellContribution implements CellModelContribution, CellViewContribution, LanguageSpecContribution {
6
8
  markdownCellModelFactory: MarkdownCellModelFactory;
7
9
  cellMeta: CellMeta;
8
10
  canHandle(options: CellOptions): number;
9
11
  createModel(options: CellOptions): CellModel;
10
12
  view: typeof MarkdownCellView;
13
+ registerLanguageSpec: (register: LanguageSpecRegistry) => void;
11
14
  }
12
15
  //# sourceMappingURL=markdown-cell-contribution.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"markdown-cell-contribution.d.ts","sourceRoot":"","sources":["../src/markdown-cell-contribution.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAGlF,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,qBACa,wBACX,YAAW,qBAAqB,EAAE,oBAAoB;IAEpB,wBAAwB,EAAE,wBAAwB,CAAC;IAErF,QAAQ,EAAE,QAAQ,CAIhB;IAEF,SAAS,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM;IAOvC,WAAW,CAAC,OAAO,EAAE,WAAW,GAAG,SAAS;IAK5C,IAAI,0BAAoB;CACzB"}
1
+ {"version":3,"file":"markdown-cell-contribution.d.ts","sourceRoot":"","sources":["../src/markdown-cell-contribution.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAGlF,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,qBAGa,wBACX,YAAW,qBAAqB,EAAE,oBAAoB,EAAE,wBAAwB;IAE9C,wBAAwB,EAAE,wBAAwB,CAAC;IAErF,QAAQ,EAAE,QAAQ,CAIhB;IAEF,SAAS,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM;IAOvC,WAAW,CAAC,OAAO,EAAE,WAAW,GAAG,SAAS;IAK5C,IAAI,0BAAoB;IAExB,oBAAoB,aAAc,oBAAoB,UAOpD;CACH"}
@@ -8,12 +8,13 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
8
8
  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); }
9
9
  function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; }
10
10
  function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'transform-class-properties is enabled and runs after the decorators transform.'); }
11
+ import { LanguageSpecContribution } from '@difizen/libro-code-editor';
11
12
  import { CellModelContribution, CellViewContribution } from '@difizen/libro-core';
12
13
  import { singleton, inject } from '@difizen/mana-app';
13
14
  import { MarkdownCellModelFactory } from "./markdown-cell-protocol.js";
14
15
  import { MarkdownCellView } from "./markdown-cell-view.js";
15
16
  export var MarkdownCellContribution = (_dec = singleton({
16
- contrib: [CellModelContribution, CellViewContribution]
17
+ contrib: [CellModelContribution, CellViewContribution, LanguageSpecContribution]
17
18
  }), _dec2 = inject(MarkdownCellModelFactory), _dec(_class = (_class2 = /*#__PURE__*/function () {
18
19
  function MarkdownCellContribution() {
19
20
  _classCallCheck(this, MarkdownCellContribution);
@@ -24,6 +25,14 @@ export var MarkdownCellContribution = (_dec = singleton({
24
25
  order: 'c'
25
26
  };
26
27
  this.view = MarkdownCellView;
28
+ this.registerLanguageSpec = function (register) {
29
+ register.registerLanguageSpec({
30
+ name: 'Markdown',
31
+ language: 'markdown',
32
+ mime: 'text/x-markdown',
33
+ ext: ['.md', '.markdown', '.mkd', '.sh']
34
+ });
35
+ };
27
36
  }
28
37
  _createClass(MarkdownCellContribution, [{
29
38
  key: "canHandle",
@@ -1 +1 @@
1
- {"version":3,"file":"markdown-cell-view.d.ts","sourceRoot":"","sources":["../src/markdown-cell-view.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,OAAO,EACP,cAAc,EACf,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CA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xB,WAAW,EAAE,WAAW,EAClB,iBAAiB,EAAE,iBAAiB,EACvC,cAAc,EAAE,cAAc;IAS/C,WAAW;IAWX,YAAY,CAAC,IAAI,EAAE,QAAQ;IAMpC,oBAAoB;IAIpB,SAAS,CAAC,eAAe,IAAI,qBAAqB;IAgB5C,YAAY;cAwBF,gBAAgB;IAKvB,qBAAqB,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC;IAOtD,KAAK,CAAC,MAAM,EAAE,OAAO;IAWrB,IAAI;IAIJ,IAAI,IAAI,IAAI;IAKZ,IAAI,IAAI,IAAI;CAItB"}
@@ -19,6 +19,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
19
19
  function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; }
20
20
  function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'transform-class-properties is enabled and runs after the decorators transform.'); }
21
21
  import { CodeEditorManager } from '@difizen/libro-code-editor';
22
+ import { CellUri } from '@difizen/libro-common';
22
23
  import { CellService, EditorStatus, LibroEditorCellView } from '@difizen/libro-core';
23
24
  import { MarkdownParser } from '@difizen/libro-markdown';
24
25
  import { getOrigin, prop, useInject, watch } from '@difizen/mana-app';
@@ -137,7 +138,7 @@ export var MarkdownCellView = (_dec = transient(), _dec2 = view('libro-markdown-
137
138
  key: "getEditorOption",
138
139
  value: function getEditorOption() {
139
140
  var option = {
140
- uuid: "".concat(this.parent.model.id, "-").concat(this.model.id),
141
+ uuid: CellUri.from(this.parent.model.id, this.model.id).toString(),
141
142
  model: this.model,
142
143
  config: {
143
144
  lineNumbers: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@difizen/libro-markdown-cell",
3
- "version": "0.2.28",
3
+ "version": "0.2.30",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "libro",
@@ -39,10 +39,10 @@
39
39
  "@types/react": "^18.2.25"
40
40
  },
41
41
  "dependencies": {
42
- "@difizen/libro-core": "^0.2.28",
43
- "@difizen/libro-common": "^0.2.28",
44
- "@difizen/libro-code-editor": "^0.2.28",
45
- "@difizen/libro-markdown": "^0.2.28",
42
+ "@difizen/libro-core": "^0.2.30",
43
+ "@difizen/libro-common": "^0.2.30",
44
+ "@difizen/libro-code-editor": "^0.2.30",
45
+ "@difizen/libro-markdown": "^0.2.30",
46
46
  "@difizen/mana-app": "latest",
47
47
  "@types/markdown-it": "^12.2.3",
48
48
  "markdown-it": "^13.0.1",
@@ -1,3 +1,5 @@
1
+ import type { LanguageSpecRegistry } from '@difizen/libro-code-editor';
2
+ import { LanguageSpecContribution } from '@difizen/libro-code-editor';
1
3
  import type { CellMeta, CellOptions, CellModel } from '@difizen/libro-core';
2
4
  import { CellModelContribution, CellViewContribution } from '@difizen/libro-core';
3
5
  import { singleton, inject } from '@difizen/mana-app';
@@ -5,9 +7,11 @@ import { singleton, inject } from '@difizen/mana-app';
5
7
  import { MarkdownCellModelFactory } from './markdown-cell-protocol.js';
6
8
  import { MarkdownCellView } from './markdown-cell-view.js';
7
9
 
8
- @singleton({ contrib: [CellModelContribution, CellViewContribution] })
10
+ @singleton({
11
+ contrib: [CellModelContribution, CellViewContribution, LanguageSpecContribution],
12
+ })
9
13
  export class MarkdownCellContribution
10
- implements CellModelContribution, CellViewContribution
14
+ implements CellModelContribution, CellViewContribution, LanguageSpecContribution
11
15
  {
12
16
  @inject(MarkdownCellModelFactory) markdownCellModelFactory: MarkdownCellModelFactory;
13
17
 
@@ -30,4 +34,13 @@ export class MarkdownCellContribution
30
34
  }
31
35
 
32
36
  view = MarkdownCellView;
37
+
38
+ registerLanguageSpec = (register: LanguageSpecRegistry) => {
39
+ register.registerLanguageSpec({
40
+ name: 'Markdown',
41
+ language: 'markdown',
42
+ mime: 'text/x-markdown',
43
+ ext: ['.md', '.markdown', '.mkd', '.sh'],
44
+ });
45
+ };
33
46
  }
@@ -4,6 +4,7 @@ import type {
4
4
  CodeEditorView,
5
5
  } from '@difizen/libro-code-editor';
6
6
  import { CodeEditorManager } from '@difizen/libro-code-editor';
7
+ import { CellUri } from '@difizen/libro-common';
7
8
  import type { CellCollapsible, CellViewOptions } from '@difizen/libro-core';
8
9
  import { CellService, EditorStatus, LibroEditorCellView } from '@difizen/libro-core';
9
10
  import { MarkdownParser } from '@difizen/libro-markdown';
@@ -144,7 +145,7 @@ export class MarkdownCellView extends LibroEditorCellView implements CellCollaps
144
145
 
145
146
  protected getEditorOption(): CodeEditorViewOptions {
146
147
  const option: CodeEditorViewOptions = {
147
- uuid: `${this.parent.model.id}-${this.model.id}`,
148
+ uuid: CellUri.from(this.parent.model.id, this.model.id).toString(),
148
149
  model: this.model,
149
150
  config: {
150
151
  lineNumbers: false,