ontotext-yasgui-web-component 1.3.15 → 1.3.17

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.
@@ -1143,9 +1143,12 @@ class OntotextYasgui {
1143
1143
  * @param query The query value to be set.
1144
1144
  */
1145
1145
  setQuery(query) {
1146
- const cursor = this.yasgui.getTab().getYasqe().getDoc().getCursor();
1147
- this.yasgui.getTab().getYasqe().setValue(query);
1148
- this.yasgui.getTab().getYasqe().getDoc().setCursor(cursor);
1146
+ const yasqe = this.yasgui.getTab().getYasqe();
1147
+ const cursor = yasqe.getDoc().getCursor();
1148
+ const lastLine = yasqe.getDoc().lastLine();
1149
+ const lastLineLength = yasqe.getDoc().getLine(lastLine).length;
1150
+ yasqe.getDoc().replaceRange(query, { line: 0, ch: 0 }, { line: lastLine, ch: lastLineLength });
1151
+ yasqe.getDoc().setCursor(cursor);
1149
1152
  }
1150
1153
  query() {
1151
1154
  return this.yasgui.getTab().getYasqe().query();
@@ -1240,6 +1243,20 @@ class OntotextYasgui {
1240
1243
  }
1241
1244
  return tabInstance;
1242
1245
  }
1246
+ /**
1247
+ * Searches the local store for the given tab ID and returns the height for the yasqe editor. If no height can be found,
1248
+ * the default 300 is returned.
1249
+ * @param tabId
1250
+ */
1251
+ getEditorHeight(tabId) {
1252
+ const heightString = this.getInstance().getTab(tabId).persistentJson.yasqe.editorHeight;
1253
+ if (heightString) {
1254
+ return parseInt(heightString.replace("px", ""), 10);
1255
+ }
1256
+ else {
1257
+ return 300;
1258
+ }
1259
+ }
1243
1260
  destroy() {
1244
1261
  if (this.yasgui) {
1245
1262
  this.yasgui.destroy();
@@ -1348,8 +1365,9 @@ class VisualisationUtils {
1348
1365
  * actually rendered before trying out to find it.
1349
1366
  * @param mode
1350
1367
  * @param orientation
1368
+ * @param editorHeight if the mode is YASGUI, this height will be set for the yasqe.
1351
1369
  */
1352
- static setYasqeFullHeight(mode, orientation) {
1370
+ static setYasqeFullHeight(mode, orientation, editorHeight) {
1353
1371
  const selectActiveEditor = () => document.querySelector('.yasgui .tabPanel.active .CodeMirror');
1354
1372
  if (mode === RenderingMode.YASQE || orientation === Orientation.HORIZONTAL) {
1355
1373
  setTimeout(() => {
@@ -1368,7 +1386,7 @@ class VisualisationUtils {
1368
1386
  setTimeout(() => {
1369
1387
  const codemirrorEl = selectActiveEditor();
1370
1388
  if (codemirrorEl) {
1371
- codemirrorEl.style.removeProperty('height');
1389
+ codemirrorEl.style.setProperty('height', editorHeight + 'px');
1372
1390
  }
1373
1391
  });
1374
1392
  }
@@ -1378,8 +1396,9 @@ class VisualisationUtils {
1378
1396
  * @param hostElement
1379
1397
  * @param newMode
1380
1398
  * @param isVerticalOrientation
1399
+ * @param editorHeight
1381
1400
  */
1382
- static changeRenderMode(hostElement, newMode, isVerticalOrientation) {
1401
+ static changeRenderMode(hostElement, newMode, isVerticalOrientation, editorHeight) {
1383
1402
  VisualisationUtils.unselectAllToolbarButtons(hostElement);
1384
1403
  const button = HtmlElementsUtil.getRenderModeButton(hostElement, newMode);
1385
1404
  /** The button can be undefined if the render buttons are hidden and the {@see OntotextYasguiWebComponent#changeRenderMode} method is called.*/
@@ -1389,7 +1408,7 @@ class VisualisationUtils {
1389
1408
  const modes = Object.values(RenderingMode);
1390
1409
  hostElement.classList.remove(...modes);
1391
1410
  hostElement.classList.add(newMode);
1392
- this.setYasqeFullHeight(newMode, this.resolveOrientation(isVerticalOrientation));
1411
+ this.setYasqeFullHeight(newMode, this.resolveOrientation(isVerticalOrientation), editorHeight);
1393
1412
  }
1394
1413
  static toggleLayoutOrientationButton(hostElement, newOrientation) {
1395
1414
  const buttonOrientation = HtmlElementsUtil.getOrientationButton(hostElement);
@@ -1400,12 +1419,12 @@ class VisualisationUtils {
1400
1419
  buttonOrientation.classList.remove('icon-rotate-quarter');
1401
1420
  }
1402
1421
  }
1403
- static toggleLayoutOrientation(hostElement, isVerticalOrientation, mode) {
1422
+ static toggleLayoutOrientation(hostElement, isVerticalOrientation, mode, editorHeight) {
1404
1423
  const newOrientation = this.resolveOrientation(isVerticalOrientation);
1405
1424
  const orientations = Object.values(Orientation);
1406
1425
  hostElement.classList.remove(...orientations);
1407
1426
  hostElement.classList.add(newOrientation);
1408
- this.setYasqeFullHeight(mode, newOrientation);
1427
+ this.setYasqeFullHeight(mode, newOrientation, editorHeight);
1409
1428
  VisualisationUtils.toggleLayoutOrientationButton(hostElement, newOrientation);
1410
1429
  }
1411
1430
  static resolveOrientation(isVerticalOrientation) {
@@ -4469,11 +4488,12 @@ const OntotextYasguiWebComponent = class {
4469
4488
  * Changes rendering mode of component.
4470
4489
  *
4471
4490
  * @param newRenderMode - then new render mode of component.
4491
+ * @param editorHeight - the height for yasqe.
4472
4492
  */
4473
- changeRenderMode(newRenderMode) {
4493
+ changeRenderMode(newRenderMode, editorHeight) {
4474
4494
  return this.getOntotextYasgui()
4475
4495
  .then(() => {
4476
- VisualisationUtils.changeRenderMode(this.hostElement, newRenderMode, this.getOrientationMode() === Orientation.VERTICAL);
4496
+ VisualisationUtils.changeRenderMode(this.hostElement, newRenderMode, this.isVerticalOrientation, editorHeight);
4477
4497
  });
4478
4498
  }
4479
4499
  /**
@@ -4643,7 +4663,8 @@ const OntotextYasguiWebComponent = class {
4643
4663
  this.getOntotextYasgui()
4644
4664
  .then((ontotextYasgui) => {
4645
4665
  ontotextYasgui.refresh();
4646
- VisualisationUtils.setYasqeFullHeight(this.renderingMode, VisualisationUtils.resolveOrientation(this.isVerticalOrientation));
4666
+ const editorHeight = this.ontotextYasgui.getEditorHeight(ontotextYasgui.getTabId());
4667
+ VisualisationUtils.setYasqeFullHeight(this.renderingMode, VisualisationUtils.resolveOrientation(this.isVerticalOrientation), editorHeight);
4647
4668
  });
4648
4669
  }
4649
4670
  onBeforeunloadHandler() {
@@ -4802,13 +4823,14 @@ const OntotextYasguiWebComponent = class {
4802
4823
  this.output.emit(toOutputEvent(event));
4803
4824
  }
4804
4825
  onQuery(event) {
4805
- this.changeRenderMode(this.defaultViewMode);
4806
- this.defaultViewMode = RenderingMode.YASGUI;
4807
4826
  this.output.emit(toOutputEvent(event));
4808
4827
  this.getOntotextYasgui()
4809
4828
  .then((ontotextYasgui) => {
4810
4829
  ontotextYasgui.leaveFullScreen();
4811
- VisualisationUtils.setYasqeFullHeight(this.renderingMode, VisualisationUtils.resolveOrientation(this.isVerticalOrientation));
4830
+ const editorHeight = this.ontotextYasgui.getEditorHeight(ontotextYasgui.getTabId());
4831
+ this.changeRenderMode(this.defaultViewMode, editorHeight);
4832
+ this.defaultViewMode = RenderingMode.YASGUI;
4833
+ VisualisationUtils.setYasqeFullHeight(this.renderingMode, VisualisationUtils.resolveOrientation(this.isVerticalOrientation), editorHeight);
4812
4834
  });
4813
4835
  }
4814
4836
  onInternalQueryExecuted(event) {
@@ -4831,9 +4853,10 @@ const OntotextYasguiWebComponent = class {
4831
4853
  }
4832
4854
  changeOrientation() {
4833
4855
  this.isVerticalOrientation = !this.isVerticalOrientation;
4834
- VisualisationUtils.toggleLayoutOrientation(this.hostElement, this.isVerticalOrientation, this.renderingMode);
4835
4856
  this.getOntotextYasgui()
4836
4857
  .then((ontotextYasgui) => {
4858
+ const editorHeight = this.ontotextYasgui.getEditorHeight(ontotextYasgui.getTabId());
4859
+ VisualisationUtils.toggleLayoutOrientation(this.hostElement, this.isVerticalOrientation, this.renderingMode, editorHeight);
4837
4860
  ontotextYasgui.refresh();
4838
4861
  });
4839
4862
  }
@@ -4944,7 +4967,8 @@ const OntotextYasguiWebComponent = class {
4944
4967
  }
4945
4968
  changeRenderingMode(mode) {
4946
4969
  this.renderingMode = mode;
4947
- VisualisationUtils.changeRenderMode(this.hostElement, mode, this.isVerticalOrientation);
4970
+ const editorHeight = this.ontotextYasgui.getEditorHeight(this.ontotextYasgui.getTabId());
4971
+ VisualisationUtils.changeRenderMode(this.hostElement, mode, this.isVerticalOrientation, editorHeight);
4948
4972
  }
4949
4973
  isOntotextYasguiInitialiazed() {
4950
4974
  return !!this.ontotextYasgui && !!this.ontotextYasgui.getInstance();
@@ -4967,7 +4991,9 @@ const OntotextYasguiWebComponent = class {
4967
4991
  VisualisationUtils.changeRenderMode(this.hostElement, this.renderingMode, this.isVerticalOrientation);
4968
4992
  });
4969
4993
  this.ontotextYasgui.getInstance().on('tabSelect', (_yasgui, _tab) => {
4970
- VisualisationUtils.changeRenderMode(this.hostElement, this.renderingMode, this.isVerticalOrientation);
4994
+ const editorHeight = this.ontotextYasgui.getEditorHeight(_tab);
4995
+ VisualisationUtils.changeRenderMode(this.hostElement, this.renderingMode, this.isVerticalOrientation, editorHeight);
4996
+ this.updateYasrTopMargin();
4971
4997
  });
4972
4998
  this.ontotextYasgui.getInstance().on('autocompletionShown', (_instance, _tab, _widget) => {
4973
4999
  hint.parentNode && hint.parentNode.removeChild(hint);
@@ -5051,6 +5077,8 @@ const OntotextYasguiWebComponent = class {
5051
5077
  this.ontotextYasgui = this.yasguiBuilder.build(this.hostElement, yasguiConfiguration);
5052
5078
  this.registerEventHandlers();
5053
5079
  this.afterInit();
5080
+ const editorHeight = this.ontotextYasgui.getEditorHeight(this.ontotextYasgui.getTabId());
5081
+ VisualisationUtils.setYasqeFullHeight(this.renderingMode, VisualisationUtils.resolveOrientation(this.isVerticalOrientation), editorHeight);
5054
5082
  }
5055
5083
  }
5056
5084
  componentWillLoad() {
@@ -1,5 +1,5 @@
1
1
  import { h, Host } from '@stencil/core';
2
- import { defaultOntotextYasguiConfig, Orientation, RenderingMode } from '../../models/yasgui-configuration';
2
+ import { defaultOntotextYasguiConfig, RenderingMode } from '../../models/yasgui-configuration';
3
3
  import { YASGUI_MIN_SCRIPT } from '../yasgui/yasgui-script';
4
4
  import { YasguiBuilder } from '../../services/yasgui/yasgui-builder';
5
5
  import { VisualisationUtils } from '../../services/utils/visualisation-utils';
@@ -98,11 +98,12 @@ export class OntotextYasguiWebComponent {
98
98
  * Changes rendering mode of component.
99
99
  *
100
100
  * @param newRenderMode - then new render mode of component.
101
+ * @param editorHeight - the height for yasqe.
101
102
  */
102
- changeRenderMode(newRenderMode) {
103
+ changeRenderMode(newRenderMode, editorHeight) {
103
104
  return this.getOntotextYasgui()
104
105
  .then(() => {
105
- VisualisationUtils.changeRenderMode(this.hostElement, newRenderMode, this.getOrientationMode() === Orientation.VERTICAL);
106
+ VisualisationUtils.changeRenderMode(this.hostElement, newRenderMode, this.isVerticalOrientation, editorHeight);
106
107
  });
107
108
  }
108
109
  /**
@@ -272,7 +273,8 @@ export class OntotextYasguiWebComponent {
272
273
  this.getOntotextYasgui()
273
274
  .then((ontotextYasgui) => {
274
275
  ontotextYasgui.refresh();
275
- VisualisationUtils.setYasqeFullHeight(this.renderingMode, VisualisationUtils.resolveOrientation(this.isVerticalOrientation));
276
+ const editorHeight = this.ontotextYasgui.getEditorHeight(ontotextYasgui.getTabId());
277
+ VisualisationUtils.setYasqeFullHeight(this.renderingMode, VisualisationUtils.resolveOrientation(this.isVerticalOrientation), editorHeight);
276
278
  });
277
279
  }
278
280
  onBeforeunloadHandler() {
@@ -431,13 +433,14 @@ export class OntotextYasguiWebComponent {
431
433
  this.output.emit(toOutputEvent(event));
432
434
  }
433
435
  onQuery(event) {
434
- this.changeRenderMode(this.defaultViewMode);
435
- this.defaultViewMode = RenderingMode.YASGUI;
436
436
  this.output.emit(toOutputEvent(event));
437
437
  this.getOntotextYasgui()
438
438
  .then((ontotextYasgui) => {
439
439
  ontotextYasgui.leaveFullScreen();
440
- VisualisationUtils.setYasqeFullHeight(this.renderingMode, VisualisationUtils.resolveOrientation(this.isVerticalOrientation));
440
+ const editorHeight = this.ontotextYasgui.getEditorHeight(ontotextYasgui.getTabId());
441
+ this.changeRenderMode(this.defaultViewMode, editorHeight);
442
+ this.defaultViewMode = RenderingMode.YASGUI;
443
+ VisualisationUtils.setYasqeFullHeight(this.renderingMode, VisualisationUtils.resolveOrientation(this.isVerticalOrientation), editorHeight);
441
444
  });
442
445
  }
443
446
  onInternalQueryExecuted(event) {
@@ -460,9 +463,10 @@ export class OntotextYasguiWebComponent {
460
463
  }
461
464
  changeOrientation() {
462
465
  this.isVerticalOrientation = !this.isVerticalOrientation;
463
- VisualisationUtils.toggleLayoutOrientation(this.hostElement, this.isVerticalOrientation, this.renderingMode);
464
466
  this.getOntotextYasgui()
465
467
  .then((ontotextYasgui) => {
468
+ const editorHeight = this.ontotextYasgui.getEditorHeight(ontotextYasgui.getTabId());
469
+ VisualisationUtils.toggleLayoutOrientation(this.hostElement, this.isVerticalOrientation, this.renderingMode, editorHeight);
466
470
  ontotextYasgui.refresh();
467
471
  });
468
472
  }
@@ -573,7 +577,8 @@ export class OntotextYasguiWebComponent {
573
577
  }
574
578
  changeRenderingMode(mode) {
575
579
  this.renderingMode = mode;
576
- VisualisationUtils.changeRenderMode(this.hostElement, mode, this.isVerticalOrientation);
580
+ const editorHeight = this.ontotextYasgui.getEditorHeight(this.ontotextYasgui.getTabId());
581
+ VisualisationUtils.changeRenderMode(this.hostElement, mode, this.isVerticalOrientation, editorHeight);
577
582
  }
578
583
  isOntotextYasguiInitialiazed() {
579
584
  return !!this.ontotextYasgui && !!this.ontotextYasgui.getInstance();
@@ -596,7 +601,9 @@ export class OntotextYasguiWebComponent {
596
601
  VisualisationUtils.changeRenderMode(this.hostElement, this.renderingMode, this.isVerticalOrientation);
597
602
  });
598
603
  this.ontotextYasgui.getInstance().on('tabSelect', (_yasgui, _tab) => {
599
- VisualisationUtils.changeRenderMode(this.hostElement, this.renderingMode, this.isVerticalOrientation);
604
+ const editorHeight = this.ontotextYasgui.getEditorHeight(_tab);
605
+ VisualisationUtils.changeRenderMode(this.hostElement, this.renderingMode, this.isVerticalOrientation, editorHeight);
606
+ this.updateYasrTopMargin();
600
607
  });
601
608
  this.ontotextYasgui.getInstance().on('autocompletionShown', (_instance, _tab, _widget) => {
602
609
  hint.parentNode && hint.parentNode.removeChild(hint);
@@ -680,6 +687,8 @@ export class OntotextYasguiWebComponent {
680
687
  this.ontotextYasgui = this.yasguiBuilder.build(this.hostElement, yasguiConfiguration);
681
688
  this.registerEventHandlers();
682
689
  this.afterInit();
690
+ const editorHeight = this.ontotextYasgui.getEditorHeight(this.ontotextYasgui.getTabId());
691
+ VisualisationUtils.setYasqeFullHeight(this.renderingMode, VisualisationUtils.resolveOrientation(this.isVerticalOrientation), editorHeight);
683
692
  }
684
693
  }
685
694
  componentWillLoad() {
@@ -983,13 +992,19 @@ export class OntotextYasguiWebComponent {
983
992
  return {
984
993
  "changeRenderMode": {
985
994
  "complexType": {
986
- "signature": "(newRenderMode: RenderingMode) => Promise<void>",
995
+ "signature": "(newRenderMode: RenderingMode, editorHeight?: number) => Promise<void>",
987
996
  "parameters": [{
988
997
  "tags": [{
989
998
  "name": "param",
990
999
  "text": "newRenderMode - then new render mode of component."
991
1000
  }],
992
1001
  "text": "- then new render mode of component."
1002
+ }, {
1003
+ "tags": [{
1004
+ "name": "param",
1005
+ "text": "editorHeight - the height for yasqe."
1006
+ }],
1007
+ "text": "- the height for yasqe."
993
1008
  }],
994
1009
  "references": {
995
1010
  "Promise": {
@@ -1007,6 +1022,9 @@ export class OntotextYasguiWebComponent {
1007
1022
  "tags": [{
1008
1023
  "name": "param",
1009
1024
  "text": "newRenderMode - then new render mode of component."
1025
+ }, {
1026
+ "name": "param",
1027
+ "text": "editorHeight - the height for yasqe."
1010
1028
  }]
1011
1029
  }
1012
1030
  },
@@ -36,9 +36,12 @@ export class OntotextYasgui {
36
36
  * @param query The query value to be set.
37
37
  */
38
38
  setQuery(query) {
39
- const cursor = this.yasgui.getTab().getYasqe().getDoc().getCursor();
40
- this.yasgui.getTab().getYasqe().setValue(query);
41
- this.yasgui.getTab().getYasqe().getDoc().setCursor(cursor);
39
+ const yasqe = this.yasgui.getTab().getYasqe();
40
+ const cursor = yasqe.getDoc().getCursor();
41
+ const lastLine = yasqe.getDoc().lastLine();
42
+ const lastLineLength = yasqe.getDoc().getLine(lastLine).length;
43
+ yasqe.getDoc().replaceRange(query, { line: 0, ch: 0 }, { line: lastLine, ch: lastLineLength });
44
+ yasqe.getDoc().setCursor(cursor);
42
45
  }
43
46
  query() {
44
47
  return this.yasgui.getTab().getYasqe().query();
@@ -133,6 +136,20 @@ export class OntotextYasgui {
133
136
  }
134
137
  return tabInstance;
135
138
  }
139
+ /**
140
+ * Searches the local store for the given tab ID and returns the height for the yasqe editor. If no height can be found,
141
+ * the default 300 is returned.
142
+ * @param tabId
143
+ */
144
+ getEditorHeight(tabId) {
145
+ const heightString = this.getInstance().getTab(tabId).persistentJson.yasqe.editorHeight;
146
+ if (heightString) {
147
+ return parseInt(heightString.replace("px", ""), 10);
148
+ }
149
+ else {
150
+ return 300;
151
+ }
152
+ }
136
153
  destroy() {
137
154
  if (this.yasgui) {
138
155
  this.yasgui.destroy();
@@ -13,8 +13,9 @@ export class VisualisationUtils {
13
13
  * actually rendered before trying out to find it.
14
14
  * @param mode
15
15
  * @param orientation
16
+ * @param editorHeight if the mode is YASGUI, this height will be set for the yasqe.
16
17
  */
17
- static setYasqeFullHeight(mode, orientation) {
18
+ static setYasqeFullHeight(mode, orientation, editorHeight) {
18
19
  const selectActiveEditor = () => document.querySelector('.yasgui .tabPanel.active .CodeMirror');
19
20
  if (mode === RenderingMode.YASQE || orientation === Orientation.HORIZONTAL) {
20
21
  setTimeout(() => {
@@ -33,7 +34,7 @@ export class VisualisationUtils {
33
34
  setTimeout(() => {
34
35
  const codemirrorEl = selectActiveEditor();
35
36
  if (codemirrorEl) {
36
- codemirrorEl.style.removeProperty('height');
37
+ codemirrorEl.style.setProperty('height', editorHeight + 'px');
37
38
  }
38
39
  });
39
40
  }
@@ -43,8 +44,9 @@ export class VisualisationUtils {
43
44
  * @param hostElement
44
45
  * @param newMode
45
46
  * @param isVerticalOrientation
47
+ * @param editorHeight
46
48
  */
47
- static changeRenderMode(hostElement, newMode, isVerticalOrientation) {
49
+ static changeRenderMode(hostElement, newMode, isVerticalOrientation, editorHeight) {
48
50
  VisualisationUtils.unselectAllToolbarButtons(hostElement);
49
51
  const button = HtmlElementsUtil.getRenderModeButton(hostElement, newMode);
50
52
  /** The button can be undefined if the render buttons are hidden and the {@see OntotextYasguiWebComponent#changeRenderMode} method is called.*/
@@ -54,7 +56,7 @@ export class VisualisationUtils {
54
56
  const modes = Object.values(RenderingMode);
55
57
  hostElement.classList.remove(...modes);
56
58
  hostElement.classList.add(newMode);
57
- this.setYasqeFullHeight(newMode, this.resolveOrientation(isVerticalOrientation));
59
+ this.setYasqeFullHeight(newMode, this.resolveOrientation(isVerticalOrientation), editorHeight);
58
60
  }
59
61
  static toggleLayoutOrientationButton(hostElement, newOrientation) {
60
62
  const buttonOrientation = HtmlElementsUtil.getOrientationButton(hostElement);
@@ -65,12 +67,12 @@ export class VisualisationUtils {
65
67
  buttonOrientation.classList.remove('icon-rotate-quarter');
66
68
  }
67
69
  }
68
- static toggleLayoutOrientation(hostElement, isVerticalOrientation, mode) {
70
+ static toggleLayoutOrientation(hostElement, isVerticalOrientation, mode, editorHeight) {
69
71
  const newOrientation = this.resolveOrientation(isVerticalOrientation);
70
72
  const orientations = Object.values(Orientation);
71
73
  hostElement.classList.remove(...orientations);
72
74
  hostElement.classList.add(newOrientation);
73
- this.setYasqeFullHeight(mode, newOrientation);
75
+ this.setYasqeFullHeight(mode, newOrientation, editorHeight);
74
76
  VisualisationUtils.toggleLayoutOrientationButton(hostElement, newOrientation);
75
77
  }
76
78
  static resolveOrientation(isVerticalOrientation) {
@@ -125,9 +125,12 @@ class OntotextYasgui$1 {
125
125
  * @param query The query value to be set.
126
126
  */
127
127
  setQuery(query) {
128
- const cursor = this.yasgui.getTab().getYasqe().getDoc().getCursor();
129
- this.yasgui.getTab().getYasqe().setValue(query);
130
- this.yasgui.getTab().getYasqe().getDoc().setCursor(cursor);
128
+ const yasqe = this.yasgui.getTab().getYasqe();
129
+ const cursor = yasqe.getDoc().getCursor();
130
+ const lastLine = yasqe.getDoc().lastLine();
131
+ const lastLineLength = yasqe.getDoc().getLine(lastLine).length;
132
+ yasqe.getDoc().replaceRange(query, { line: 0, ch: 0 }, { line: lastLine, ch: lastLineLength });
133
+ yasqe.getDoc().setCursor(cursor);
131
134
  }
132
135
  query() {
133
136
  return this.yasgui.getTab().getYasqe().query();
@@ -222,6 +225,20 @@ class OntotextYasgui$1 {
222
225
  }
223
226
  return tabInstance;
224
227
  }
228
+ /**
229
+ * Searches the local store for the given tab ID and returns the height for the yasqe editor. If no height can be found,
230
+ * the default 300 is returned.
231
+ * @param tabId
232
+ */
233
+ getEditorHeight(tabId) {
234
+ const heightString = this.getInstance().getTab(tabId).persistentJson.yasqe.editorHeight;
235
+ if (heightString) {
236
+ return parseInt(heightString.replace("px", ""), 10);
237
+ }
238
+ else {
239
+ return 300;
240
+ }
241
+ }
225
242
  destroy() {
226
243
  if (this.yasgui) {
227
244
  this.yasgui.destroy();
@@ -330,8 +347,9 @@ class VisualisationUtils {
330
347
  * actually rendered before trying out to find it.
331
348
  * @param mode
332
349
  * @param orientation
350
+ * @param editorHeight if the mode is YASGUI, this height will be set for the yasqe.
333
351
  */
334
- static setYasqeFullHeight(mode, orientation) {
352
+ static setYasqeFullHeight(mode, orientation, editorHeight) {
335
353
  const selectActiveEditor = () => document.querySelector('.yasgui .tabPanel.active .CodeMirror');
336
354
  if (mode === RenderingMode.YASQE || orientation === Orientation.HORIZONTAL) {
337
355
  setTimeout(() => {
@@ -350,7 +368,7 @@ class VisualisationUtils {
350
368
  setTimeout(() => {
351
369
  const codemirrorEl = selectActiveEditor();
352
370
  if (codemirrorEl) {
353
- codemirrorEl.style.removeProperty('height');
371
+ codemirrorEl.style.setProperty('height', editorHeight + 'px');
354
372
  }
355
373
  });
356
374
  }
@@ -360,8 +378,9 @@ class VisualisationUtils {
360
378
  * @param hostElement
361
379
  * @param newMode
362
380
  * @param isVerticalOrientation
381
+ * @param editorHeight
363
382
  */
364
- static changeRenderMode(hostElement, newMode, isVerticalOrientation) {
383
+ static changeRenderMode(hostElement, newMode, isVerticalOrientation, editorHeight) {
365
384
  VisualisationUtils.unselectAllToolbarButtons(hostElement);
366
385
  const button = HtmlElementsUtil.getRenderModeButton(hostElement, newMode);
367
386
  /** The button can be undefined if the render buttons are hidden and the {@see OntotextYasguiWebComponent#changeRenderMode} method is called.*/
@@ -371,7 +390,7 @@ class VisualisationUtils {
371
390
  const modes = Object.values(RenderingMode);
372
391
  hostElement.classList.remove(...modes);
373
392
  hostElement.classList.add(newMode);
374
- this.setYasqeFullHeight(newMode, this.resolveOrientation(isVerticalOrientation));
393
+ this.setYasqeFullHeight(newMode, this.resolveOrientation(isVerticalOrientation), editorHeight);
375
394
  }
376
395
  static toggleLayoutOrientationButton(hostElement, newOrientation) {
377
396
  const buttonOrientation = HtmlElementsUtil.getOrientationButton(hostElement);
@@ -382,12 +401,12 @@ class VisualisationUtils {
382
401
  buttonOrientation.classList.remove('icon-rotate-quarter');
383
402
  }
384
403
  }
385
- static toggleLayoutOrientation(hostElement, isVerticalOrientation, mode) {
404
+ static toggleLayoutOrientation(hostElement, isVerticalOrientation, mode, editorHeight) {
386
405
  const newOrientation = this.resolveOrientation(isVerticalOrientation);
387
406
  const orientations = Object.values(Orientation);
388
407
  hostElement.classList.remove(...orientations);
389
408
  hostElement.classList.add(newOrientation);
390
- this.setYasqeFullHeight(mode, newOrientation);
409
+ this.setYasqeFullHeight(mode, newOrientation, editorHeight);
391
410
  VisualisationUtils.toggleLayoutOrientationButton(hostElement, newOrientation);
392
411
  }
393
412
  static resolveOrientation(isVerticalOrientation) {
@@ -3452,11 +3471,12 @@ const OntotextYasguiWebComponent = /*@__PURE__*/ proxyCustomElement(class extend
3452
3471
  * Changes rendering mode of component.
3453
3472
  *
3454
3473
  * @param newRenderMode - then new render mode of component.
3474
+ * @param editorHeight - the height for yasqe.
3455
3475
  */
3456
- changeRenderMode(newRenderMode) {
3476
+ changeRenderMode(newRenderMode, editorHeight) {
3457
3477
  return this.getOntotextYasgui()
3458
3478
  .then(() => {
3459
- VisualisationUtils.changeRenderMode(this.hostElement, newRenderMode, this.getOrientationMode() === Orientation.VERTICAL);
3479
+ VisualisationUtils.changeRenderMode(this.hostElement, newRenderMode, this.isVerticalOrientation, editorHeight);
3460
3480
  });
3461
3481
  }
3462
3482
  /**
@@ -3626,7 +3646,8 @@ const OntotextYasguiWebComponent = /*@__PURE__*/ proxyCustomElement(class extend
3626
3646
  this.getOntotextYasgui()
3627
3647
  .then((ontotextYasgui) => {
3628
3648
  ontotextYasgui.refresh();
3629
- VisualisationUtils.setYasqeFullHeight(this.renderingMode, VisualisationUtils.resolveOrientation(this.isVerticalOrientation));
3649
+ const editorHeight = this.ontotextYasgui.getEditorHeight(ontotextYasgui.getTabId());
3650
+ VisualisationUtils.setYasqeFullHeight(this.renderingMode, VisualisationUtils.resolveOrientation(this.isVerticalOrientation), editorHeight);
3630
3651
  });
3631
3652
  }
3632
3653
  onBeforeunloadHandler() {
@@ -3785,13 +3806,14 @@ const OntotextYasguiWebComponent = /*@__PURE__*/ proxyCustomElement(class extend
3785
3806
  this.output.emit(toOutputEvent(event));
3786
3807
  }
3787
3808
  onQuery(event) {
3788
- this.changeRenderMode(this.defaultViewMode);
3789
- this.defaultViewMode = RenderingMode.YASGUI;
3790
3809
  this.output.emit(toOutputEvent(event));
3791
3810
  this.getOntotextYasgui()
3792
3811
  .then((ontotextYasgui) => {
3793
3812
  ontotextYasgui.leaveFullScreen();
3794
- VisualisationUtils.setYasqeFullHeight(this.renderingMode, VisualisationUtils.resolveOrientation(this.isVerticalOrientation));
3813
+ const editorHeight = this.ontotextYasgui.getEditorHeight(ontotextYasgui.getTabId());
3814
+ this.changeRenderMode(this.defaultViewMode, editorHeight);
3815
+ this.defaultViewMode = RenderingMode.YASGUI;
3816
+ VisualisationUtils.setYasqeFullHeight(this.renderingMode, VisualisationUtils.resolveOrientation(this.isVerticalOrientation), editorHeight);
3795
3817
  });
3796
3818
  }
3797
3819
  onInternalQueryExecuted(event) {
@@ -3814,9 +3836,10 @@ const OntotextYasguiWebComponent = /*@__PURE__*/ proxyCustomElement(class extend
3814
3836
  }
3815
3837
  changeOrientation() {
3816
3838
  this.isVerticalOrientation = !this.isVerticalOrientation;
3817
- VisualisationUtils.toggleLayoutOrientation(this.hostElement, this.isVerticalOrientation, this.renderingMode);
3818
3839
  this.getOntotextYasgui()
3819
3840
  .then((ontotextYasgui) => {
3841
+ const editorHeight = this.ontotextYasgui.getEditorHeight(ontotextYasgui.getTabId());
3842
+ VisualisationUtils.toggleLayoutOrientation(this.hostElement, this.isVerticalOrientation, this.renderingMode, editorHeight);
3820
3843
  ontotextYasgui.refresh();
3821
3844
  });
3822
3845
  }
@@ -3927,7 +3950,8 @@ const OntotextYasguiWebComponent = /*@__PURE__*/ proxyCustomElement(class extend
3927
3950
  }
3928
3951
  changeRenderingMode(mode) {
3929
3952
  this.renderingMode = mode;
3930
- VisualisationUtils.changeRenderMode(this.hostElement, mode, this.isVerticalOrientation);
3953
+ const editorHeight = this.ontotextYasgui.getEditorHeight(this.ontotextYasgui.getTabId());
3954
+ VisualisationUtils.changeRenderMode(this.hostElement, mode, this.isVerticalOrientation, editorHeight);
3931
3955
  }
3932
3956
  isOntotextYasguiInitialiazed() {
3933
3957
  return !!this.ontotextYasgui && !!this.ontotextYasgui.getInstance();
@@ -3950,7 +3974,9 @@ const OntotextYasguiWebComponent = /*@__PURE__*/ proxyCustomElement(class extend
3950
3974
  VisualisationUtils.changeRenderMode(this.hostElement, this.renderingMode, this.isVerticalOrientation);
3951
3975
  });
3952
3976
  this.ontotextYasgui.getInstance().on('tabSelect', (_yasgui, _tab) => {
3953
- VisualisationUtils.changeRenderMode(this.hostElement, this.renderingMode, this.isVerticalOrientation);
3977
+ const editorHeight = this.ontotextYasgui.getEditorHeight(_tab);
3978
+ VisualisationUtils.changeRenderMode(this.hostElement, this.renderingMode, this.isVerticalOrientation, editorHeight);
3979
+ this.updateYasrTopMargin();
3954
3980
  });
3955
3981
  this.ontotextYasgui.getInstance().on('autocompletionShown', (_instance, _tab, _widget) => {
3956
3982
  hint.parentNode && hint.parentNode.removeChild(hint);
@@ -4034,6 +4060,8 @@ const OntotextYasguiWebComponent = /*@__PURE__*/ proxyCustomElement(class extend
4034
4060
  this.ontotextYasgui = this.yasguiBuilder.build(this.hostElement, yasguiConfiguration);
4035
4061
  this.registerEventHandlers();
4036
4062
  this.afterInit();
4063
+ const editorHeight = this.ontotextYasgui.getEditorHeight(this.ontotextYasgui.getTabId());
4064
+ VisualisationUtils.setYasqeFullHeight(this.renderingMode, VisualisationUtils.resolveOrientation(this.isVerticalOrientation), editorHeight);
4037
4065
  }
4038
4066
  }
4039
4067
  componentWillLoad() {