@worktile/theia 2.4.10 → 2.5.0-next.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.
@@ -528,11 +528,22 @@
528
528
  showName: 'Plain Text',
529
529
  value: ''
530
530
  },
531
+ {
532
+ showName: 'C',
533
+ value: 'text/x-csrc'
534
+ },
535
+ {
536
+ showName: 'C#',
537
+ value: 'text/x-csharp'
538
+ },
539
+ {
540
+ showName: 'C++',
541
+ value: 'text/x-c++src'
542
+ },
531
543
  {
532
544
  showName: 'C-like',
533
545
  value: 'clike'
534
546
  },
535
- DEFAULT_LANGUAGE,
536
547
  {
537
548
  showName: 'CSS',
538
549
  value: 'css'
@@ -553,6 +564,15 @@
553
564
  showName: 'Go',
554
565
  value: 'go'
555
566
  },
567
+ {
568
+ showName: 'HTML',
569
+ value: 'htmlmixed'
570
+ },
571
+ {
572
+ showName: 'Java',
573
+ value: 'text/x-java'
574
+ },
575
+ DEFAULT_LANGUAGE,
556
576
  {
557
577
  showName: 'Markdown',
558
578
  value: 'markdown'
@@ -561,14 +581,14 @@
561
581
  showName: 'Nginx',
562
582
  value: 'nginx'
563
583
  },
564
- {
565
- showName: 'PHP',
566
- value: 'php'
567
- },
568
584
  {
569
585
  showName: 'Python',
570
586
  value: 'python'
571
587
  },
588
+ {
589
+ showName: 'PHP',
590
+ value: 'php'
591
+ },
572
592
  {
573
593
  showName: 'Shell',
574
594
  value: 'shell'
@@ -582,8 +602,8 @@
582
602
  value: 'swift'
583
603
  },
584
604
  {
585
- showName: 'HTML',
586
- value: 'htmlmixed'
605
+ showName: 'Typescript',
606
+ value: 'text/typescript'
587
607
  }
588
608
  ];
589
609
  var CODEMIRROR_PADDING_TOP = 10;
@@ -4760,6 +4780,62 @@
4760
4780
  }
4761
4781
  };
4762
4782
 
4783
+ var CodeEditor = {
4784
+ setCodeAttribute: function (editor, element, value) {
4785
+ var at = i1.AngularEditor.findPath(editor, element);
4786
+ slate.Transforms.setNodes(editor, value, {
4787
+ at: at
4788
+ });
4789
+ },
4790
+ insertCode: function (editor) {
4791
+ var isSelectContent = slate.Editor.string(editor, editor.selection);
4792
+ var _a = __read(slate.Range.edges(editor.selection), 2), startPoint = _a[0], endPoint = _a[1];
4793
+ var elementEntryIterator = slate.Node.elements(editor, {
4794
+ from: startPoint.path,
4795
+ to: endPoint.path,
4796
+ pass: function (_a) {
4797
+ var _b = __read(_a, 2), node = _b[0], path = _b[1];
4798
+ return slate.Editor.isBlock(editor, node);
4799
+ }
4800
+ });
4801
+ var elementEntrys = Array.from(elementEntryIterator);
4802
+ var isAllParagraph = elementEntrys.every(function (item) { return item[0].type === exports.ElementKinds.paragraph; });
4803
+ if (isSelectContent && editor.selection.anchor.path.length === 2 && isAllParagraph) {
4804
+ var content = elementEntrys.reduce(function (content, _a, index) {
4805
+ var _b = __read(_a, 2), element = _b[0], path = _b[1];
4806
+ var text = slate.Node.string(element);
4807
+ return content + (elementEntrys.length - 1 === index ? "" + text : text + "\n");
4808
+ }, '');
4809
+ var codeElement_1 = {
4810
+ type: exports.ElementKinds.code,
4811
+ content: content,
4812
+ language: DEFAULT_LANGUAGE.value,
4813
+ children: [{ text: '' }]
4814
+ };
4815
+ slate.Editor.withoutNormalizing(editor, function () {
4816
+ var lastPath = elementEntrys[elementEntrys.length - 1][1];
4817
+ slate.Transforms.insertNodes(editor, codeElement_1, { at: slate.Path.next(lastPath) });
4818
+ slate.Transforms.select(editor, slate.Path.next(lastPath));
4819
+ slate.Transforms.removeNodes(editor, {
4820
+ at: {
4821
+ anchor: slate.Editor.start(editor, elementEntrys[0][1]),
4822
+ focus: slate.Editor.end(editor, lastPath)
4823
+ }
4824
+ });
4825
+ });
4826
+ }
4827
+ else {
4828
+ var codeElement = {
4829
+ type: exports.ElementKinds.code,
4830
+ content: '',
4831
+ language: DEFAULT_LANGUAGE.value,
4832
+ children: [{ text: '' }]
4833
+ };
4834
+ insertElement(editor, codeElement);
4835
+ }
4836
+ }
4837
+ };
4838
+
4763
4839
  var defaultAutoFormatRules = [
4764
4840
  {
4765
4841
  type: exports.ElementKinds.heading_1,
@@ -4852,7 +4928,9 @@
4852
4928
  {
4853
4929
  type: exports.ElementKinds.code,
4854
4930
  markup: '```',
4855
- insertTrigger: true
4931
+ format: function (editor) {
4932
+ CodeEditor.insertCode(editor);
4933
+ }
4856
4934
  },
4857
4935
  {
4858
4936
  type: exports.ElementKinds.listItem,
@@ -7118,62 +7196,6 @@
7118
7196
  return editor;
7119
7197
  };
7120
7198
 
7121
- var CodeEditor = {
7122
- setCodeAttribute: function (editor, element, value) {
7123
- var at = i1.AngularEditor.findPath(editor, element);
7124
- slate.Transforms.setNodes(editor, value, {
7125
- at: at
7126
- });
7127
- },
7128
- insertCode: function (editor) {
7129
- var isSelectContent = slate.Editor.string(editor, editor.selection);
7130
- var _a = __read(slate.Range.edges(editor.selection), 2), startPoint = _a[0], endPoint = _a[1];
7131
- var elementEntryIterator = slate.Node.elements(editor, {
7132
- from: startPoint.path,
7133
- to: endPoint.path,
7134
- pass: function (_a) {
7135
- var _b = __read(_a, 2), node = _b[0], path = _b[1];
7136
- return slate.Editor.isBlock(editor, node);
7137
- }
7138
- });
7139
- var elementEntrys = Array.from(elementEntryIterator);
7140
- var isAllParagraph = elementEntrys.every(function (item) { return item[0].type === exports.ElementKinds.paragraph; });
7141
- if (isSelectContent && editor.selection.anchor.path.length === 2 && isAllParagraph) {
7142
- var content = elementEntrys.reduce(function (content, _a, index) {
7143
- var _b = __read(_a, 2), element = _b[0], path = _b[1];
7144
- var text = slate.Node.string(element);
7145
- return content + (elementEntrys.length - 1 === index ? "" + text : text + "\n");
7146
- }, '');
7147
- var codeElement_1 = {
7148
- type: exports.ElementKinds.code,
7149
- content: content,
7150
- language: DEFAULT_LANGUAGE.value,
7151
- children: [{ text: '' }]
7152
- };
7153
- slate.Editor.withoutNormalizing(editor, function () {
7154
- var lastPath = elementEntrys[elementEntrys.length - 1][1];
7155
- slate.Transforms.insertNodes(editor, codeElement_1, { at: slate.Path.next(lastPath) });
7156
- slate.Transforms.select(editor, slate.Path.next(lastPath));
7157
- slate.Transforms.removeNodes(editor, {
7158
- at: {
7159
- anchor: slate.Editor.start(editor, elementEntrys[0][1]),
7160
- focus: slate.Editor.end(editor, lastPath)
7161
- }
7162
- });
7163
- });
7164
- }
7165
- else {
7166
- var codeElement = {
7167
- type: exports.ElementKinds.code,
7168
- content: '',
7169
- language: DEFAULT_LANGUAGE.value,
7170
- children: [{ text: '' }]
7171
- };
7172
- insertElement(editor, codeElement);
7173
- }
7174
- }
7175
- };
7176
-
7177
7199
  var CodeOptions = [
7178
7200
  {
7179
7201
  key: exports.ElementKinds.code,