@openui5/sap.ui.documentation 1.115.1 → 1.117.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.
- package/.reuse/dep5 +0 -5
- package/THIRDPARTY.txt +1 -7
- package/package.json +7 -7
- package/src/sap/ui/documentation/.library +1 -1
- package/src/sap/ui/documentation/library.js +2 -2
- package/src/sap/ui/documentation/messagebundle.properties +6 -0
- package/src/sap/ui/documentation/messagebundle_ar.properties +3 -0
- package/src/sap/ui/documentation/messagebundle_bg.properties +3 -0
- package/src/sap/ui/documentation/messagebundle_ca.properties +3 -0
- package/src/sap/ui/documentation/messagebundle_cs.properties +3 -0
- package/src/sap/ui/documentation/messagebundle_cy.properties +3 -0
- package/src/sap/ui/documentation/messagebundle_da.properties +3 -0
- package/src/sap/ui/documentation/messagebundle_de.properties +3 -0
- package/src/sap/ui/documentation/messagebundle_el.properties +3 -0
- package/src/sap/ui/documentation/messagebundle_en.properties +3 -0
- package/src/sap/ui/documentation/messagebundle_en_GB.properties +3 -0
- package/src/sap/ui/documentation/messagebundle_en_US_sappsd.properties +3 -0
- package/src/sap/ui/documentation/messagebundle_en_US_saprigi.properties +3 -0
- package/src/sap/ui/documentation/messagebundle_en_US_saptrc.properties +3 -0
- package/src/sap/ui/documentation/messagebundle_es.properties +3 -0
- package/src/sap/ui/documentation/messagebundle_es_MX.properties +3 -0
- package/src/sap/ui/documentation/messagebundle_et.properties +3 -0
- package/src/sap/ui/documentation/messagebundle_fi.properties +3 -0
- package/src/sap/ui/documentation/messagebundle_fr.properties +3 -0
- package/src/sap/ui/documentation/messagebundle_fr_CA.properties +3 -0
- package/src/sap/ui/documentation/messagebundle_hi.properties +3 -0
- package/src/sap/ui/documentation/messagebundle_hr.properties +3 -0
- package/src/sap/ui/documentation/messagebundle_hu.properties +3 -0
- package/src/sap/ui/documentation/messagebundle_id.properties +3 -0
- package/src/sap/ui/documentation/messagebundle_it.properties +3 -0
- package/src/sap/ui/documentation/messagebundle_iw.properties +3 -0
- package/src/sap/ui/documentation/messagebundle_ja.properties +3 -0
- package/src/sap/ui/documentation/messagebundle_kk.properties +3 -0
- package/src/sap/ui/documentation/messagebundle_ko.properties +3 -0
- package/src/sap/ui/documentation/messagebundle_lt.properties +3 -0
- package/src/sap/ui/documentation/messagebundle_lv.properties +3 -0
- package/src/sap/ui/documentation/messagebundle_ms.properties +3 -0
- package/src/sap/ui/documentation/messagebundle_nl.properties +3 -0
- package/src/sap/ui/documentation/messagebundle_no.properties +3 -0
- package/src/sap/ui/documentation/messagebundle_pl.properties +3 -0
- package/src/sap/ui/documentation/messagebundle_pt.properties +4 -1
- package/src/sap/ui/documentation/messagebundle_pt_PT.properties +3 -0
- package/src/sap/ui/documentation/messagebundle_ro.properties +3 -0
- package/src/sap/ui/documentation/messagebundle_ru.properties +3 -0
- package/src/sap/ui/documentation/messagebundle_sh.properties +3 -0
- package/src/sap/ui/documentation/messagebundle_sk.properties +3 -0
- package/src/sap/ui/documentation/messagebundle_sl.properties +3 -0
- package/src/sap/ui/documentation/messagebundle_sv.properties +3 -0
- package/src/sap/ui/documentation/messagebundle_th.properties +3 -0
- package/src/sap/ui/documentation/messagebundle_tr.properties +3 -0
- package/src/sap/ui/documentation/messagebundle_uk.properties +3 -0
- package/src/sap/ui/documentation/messagebundle_vi.properties +3 -0
- package/src/sap/ui/documentation/messagebundle_zh_CN.properties +3 -0
- package/src/sap/ui/documentation/messagebundle_zh_TW.properties +3 -0
- package/src/sap/ui/documentation/sdk/controller/ApiDetailIndexDeprecatedExperimental.controller.js +25 -2
- package/src/sap/ui/documentation/sdk/controller/App.controller.js +11 -4
- package/src/sap/ui/documentation/sdk/controller/Code.controller.js +226 -196
- package/src/sap/ui/documentation/sdk/controller/ControlsMaster.controller.js +1 -1
- package/src/sap/ui/documentation/sdk/controller/Sample.controller.js +76 -30
- package/src/sap/ui/documentation/sdk/controller/SampleBaseController.js +3 -2
- package/src/sap/ui/documentation/sdk/controller/util/ResourceDownloadUtil.js +2 -2
- package/src/sap/ui/documentation/sdk/controls/FileEditor.js +447 -0
- package/src/sap/ui/documentation/sdk/css/style.css +17 -0
- package/src/sap/ui/documentation/sdk/model/ExploreSettingsModel.js +18 -0
- package/src/sap/ui/documentation/sdk/util/FileUtils.js +96 -0
- package/src/sap/ui/documentation/sdk/view/Code.view.xml +144 -58
- package/src/sap/ui/documentation/sdk/view/Sample.view.xml +7 -0
- package/src/sap/ui/documentation/sdk/view/samplesWarning.fragment.xml +14 -0
- package/ui5.yaml +1 -1
|
@@ -4,277 +4,307 @@
|
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
sap.ui.define(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
sap.ui.define(
|
|
8
|
+
[
|
|
9
|
+
"sap/ui/documentation/sdk/controller/Sample.controller",
|
|
10
|
+
"../model/ExploreSettingsModel",
|
|
11
|
+
"sap/ui/core/Component",
|
|
12
|
+
"sap/ui/core/HTML",
|
|
13
|
+
"sap/ui/Device",
|
|
14
|
+
"sap/base/util/restricted/_debounce",
|
|
15
|
+
"sap/ui/model/odata/v4/lib/_MetadataRequestor",
|
|
16
|
+
"sap/ui/documentation/sdk/controller/util/ControlsInfo",
|
|
17
|
+
"sap/ui/documentation/sdk/model/formatter"
|
|
18
|
+
],
|
|
19
|
+
function (
|
|
20
|
+
SampleController,
|
|
21
|
+
ExploreSettingsModel,
|
|
22
|
+
Component,
|
|
23
|
+
HTML,
|
|
24
|
+
Device,
|
|
25
|
+
_debounce,
|
|
26
|
+
_MetadataRequestor,
|
|
27
|
+
ControlsInfo,
|
|
28
|
+
formatter
|
|
29
|
+
) {
|
|
16
30
|
"use strict";
|
|
17
31
|
|
|
18
|
-
return
|
|
32
|
+
return SampleController.extend("sap.ui.documentation.sdk.controller.Code", {
|
|
33
|
+
constructor: function () {
|
|
34
|
+
this.onFileEditorFileChangeDebounced = _debounce(this.onFileEditorFileChangeDebounced, 500);
|
|
35
|
+
},
|
|
19
36
|
|
|
20
37
|
/**
|
|
21
38
|
* Called when the controller is instantiated.
|
|
22
|
-
* @public
|
|
23
39
|
*/
|
|
24
|
-
onInit
|
|
25
|
-
|
|
40
|
+
onInit: function () {
|
|
41
|
+
SampleController.prototype.onInit.call(this);
|
|
42
|
+
|
|
43
|
+
this.getView().setModel(ExploreSettingsModel, "settings");
|
|
44
|
+
|
|
45
|
+
this._fileEditor = this.byId("fileEditor");
|
|
46
|
+
this._fileEditor.attachBeforeFileChange(this.onBeforeFileChanged.bind(this));
|
|
47
|
+
this._fileEditor.attachFileChange(this.onFileEditorFileChangeDebounced.bind(this));
|
|
26
48
|
|
|
27
|
-
this.
|
|
28
|
-
|
|
49
|
+
this._registerResize();
|
|
50
|
+
},
|
|
29
51
|
|
|
30
|
-
|
|
31
|
-
this.
|
|
32
|
-
|
|
52
|
+
onExit: function () {
|
|
53
|
+
this._deregisterResize();
|
|
54
|
+
},
|
|
33
55
|
|
|
34
|
-
|
|
56
|
+
onBeforeFileChanged: function (oEvent) {
|
|
57
|
+
var sFile = oEvent.getParameter("sFile");
|
|
58
|
+
this._oChangedFile = {
|
|
59
|
+
sFile: sFile
|
|
60
|
+
};
|
|
61
|
+
},
|
|
62
|
+
|
|
63
|
+
onFileEditorFileChangeDebounced: function () {
|
|
64
|
+
var oModelData = this.oModel.getData();
|
|
65
|
+
|
|
66
|
+
if (this._oChangedFile) {
|
|
67
|
+
var sRef = sap.ui.require.toUrl((this._sId).replace(/\./g, "/"));
|
|
68
|
+
var sLocalStorageDKSamples = this._getChangedSamplesLocalStorage();
|
|
69
|
+
if (!sLocalStorageDKSamples) {
|
|
70
|
+
this._setChangedSamplesLocalStorage(JSON.stringify([this._sId]));
|
|
71
|
+
} else {
|
|
72
|
+
var aChangedDKSamples = JSON.parse(sLocalStorageDKSamples);
|
|
73
|
+
|
|
74
|
+
if (aChangedDKSamples.indexOf(this._sId) < 0) {
|
|
75
|
+
aChangedDKSamples.push(this._sId);
|
|
76
|
+
this._setChangedSamplesLocalStorage(JSON.stringify(aChangedDKSamples));
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
oModelData.showWarning = true;
|
|
80
|
+
this.oModel.setData(oModelData);
|
|
35
81
|
|
|
36
|
-
|
|
82
|
+
this._updateFileContent(sRef, this._oChangedFile.sFile, true);
|
|
83
|
+
this._oChangedFile = null;
|
|
84
|
+
}
|
|
85
|
+
if (ExploreSettingsModel.getProperty("/autoRun")) {
|
|
86
|
+
this._updateSample();
|
|
87
|
+
}
|
|
88
|
+
},
|
|
37
89
|
|
|
38
|
-
|
|
39
|
-
|
|
90
|
+
onFileSwitch: function (oEvent) {
|
|
91
|
+
ExploreSettingsModel.setProperty("/editable", oEvent.getParameter("editable"));
|
|
40
92
|
},
|
|
41
93
|
|
|
42
|
-
|
|
43
|
-
this.
|
|
94
|
+
onRunPressed: function (oEvent) {
|
|
95
|
+
this._updateSample();
|
|
44
96
|
},
|
|
45
97
|
|
|
46
|
-
|
|
47
|
-
var
|
|
98
|
+
onClearButtonPressed: function (oEvent) {
|
|
99
|
+
var oFrame = document.getElementById("sampleFrameEdit"),
|
|
100
|
+
sLocalStorageDKSamples = this._getChangedSamplesLocalStorage(),
|
|
101
|
+
oModelData = this.oModel.getData(),
|
|
102
|
+
sRef = sap.ui.require.toUrl((this._sId).replace(/\./g, "/"));
|
|
103
|
+
|
|
104
|
+
if (sLocalStorageDKSamples) {
|
|
105
|
+
var aChangedDKSamples = JSON.parse(sLocalStorageDKSamples);
|
|
106
|
+
aChangedDKSamples.splice(aChangedDKSamples.indexOf(this._sId), 1);
|
|
107
|
+
this._setChangedSamplesLocalStorage(JSON.stringify(aChangedDKSamples));
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
oModelData.showWarning = false;
|
|
111
|
+
this.oModel.setData(oModelData);
|
|
48
112
|
|
|
49
|
-
this.
|
|
113
|
+
this._getPage().setBusy(true);
|
|
114
|
+
oFrame.addEventListener("load", function() {
|
|
115
|
+
this._getPage().setBusy(false);
|
|
116
|
+
}.bind(this), {
|
|
117
|
+
once: true
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
Promise.allSettled(this._oData.files.map(function(file) {
|
|
121
|
+
return fetch(file.url, { method: "DELETE" });
|
|
122
|
+
}))
|
|
123
|
+
.then(function() {
|
|
124
|
+
this._fileEditor._setClearButtonPressed(true);
|
|
125
|
+
this._updateSample();
|
|
126
|
+
this._fileEditor._fetchContents();
|
|
127
|
+
this._oData.files.forEach(function (oFile) {
|
|
128
|
+
this._updateFileContent(sRef, oFile.name, true);
|
|
129
|
+
}, this);
|
|
130
|
+
}.bind(this));
|
|
131
|
+
},
|
|
132
|
+
|
|
133
|
+
onChangeSplitterOrientation: function (oEvent) {
|
|
134
|
+
//Toggles the value of splitter orientation
|
|
135
|
+
ExploreSettingsModel.setProperty("/splitViewVertically", !ExploreSettingsModel.getProperty("/splitViewVertically"));
|
|
136
|
+
var isOrientationVertical = ExploreSettingsModel.getProperty("/splitViewVertically");
|
|
137
|
+
this.getView()
|
|
138
|
+
.byId("splitView")
|
|
139
|
+
.getRootPaneContainer()
|
|
140
|
+
.setOrientation(isOrientationVertical ? "Vertical" : "Horizontal");
|
|
141
|
+
},
|
|
142
|
+
|
|
143
|
+
_attachPaternMatched: function () {
|
|
144
|
+
this.oRouter.getRoute("code").attachPatternMatched(this._onRouteMatched, this);
|
|
145
|
+
this.oRouter.getRoute("codeFile").attachPatternMatched(this._onRouteMatched, this);
|
|
146
|
+
},
|
|
147
|
+
|
|
148
|
+
_deregisterResize: function () {
|
|
149
|
+
Device.media.detachHandler(this._onResize, this);
|
|
150
|
+
},
|
|
151
|
+
|
|
152
|
+
_registerResize: function () {
|
|
153
|
+
Device.media.attachHandler(this._onResize, this);
|
|
154
|
+
this._onResize();
|
|
155
|
+
},
|
|
156
|
+
|
|
157
|
+
_onResize: function () {
|
|
158
|
+
var isOrientationVertical = ExploreSettingsModel.getProperty("/splitViewVertically"),
|
|
159
|
+
sRangeName = Device.media.getCurrentRange("StdExt").name;
|
|
160
|
+
|
|
161
|
+
if (sRangeName == "Tablet" || (sRangeName == "Phone" && !isOrientationVertical)) {
|
|
162
|
+
ExploreSettingsModel.setProperty("/splitViewVertically", true);
|
|
163
|
+
this.getView().byId("splitView").getRootPaneContainer().setOrientation("Vertical");
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
|
|
167
|
+
_onRouteMatched: function (oEvent) {
|
|
168
|
+
var oArguments = oEvent.getParameter("arguments");
|
|
50
169
|
|
|
51
170
|
this._sId = oArguments.sampleId;
|
|
52
171
|
this._sEntityId = oArguments.entityId;
|
|
53
172
|
this._sFileName = formatter.routeParamsToFilePath(oArguments);
|
|
54
|
-
|
|
55
|
-
|
|
173
|
+
this.byId("splitView").setBusy(true);
|
|
174
|
+
|
|
175
|
+
ControlsInfo.loadData()
|
|
176
|
+
.then(function(oData) {
|
|
177
|
+
return Promise.all([
|
|
178
|
+
this._loadCode(oData),
|
|
179
|
+
this._loadSample(oData)
|
|
180
|
+
]);
|
|
181
|
+
}.bind(this))
|
|
182
|
+
.then(function(aResults) {
|
|
183
|
+
this._showCode(aResults[0]);
|
|
184
|
+
}.bind(this));
|
|
56
185
|
},
|
|
57
186
|
|
|
58
187
|
_loadCode: function (oData) {
|
|
59
|
-
var sFileName = this._sFileName
|
|
60
|
-
|
|
188
|
+
var sFileName = this._sFileName;
|
|
189
|
+
var oSample = oData.samples[this._sId]; // retrieve sample object
|
|
61
190
|
|
|
62
191
|
// If there is no sample or the context from the URL is for the wrong sample we redirect to not found page
|
|
63
192
|
// If you modify this expression please check with both class and tutorial which won't have a context.
|
|
64
193
|
if (!oSample || (oSample.contexts && !oSample.contexts[this._sEntityId])) {
|
|
65
194
|
this.onRouteNotFound();
|
|
66
|
-
return;
|
|
195
|
+
return Promise.reject();
|
|
67
196
|
}
|
|
68
197
|
|
|
69
198
|
// cache the data to be reused
|
|
70
199
|
if (!this._oData || oSample.id !== this._oData.id) {
|
|
71
200
|
// get component and data when sample is changed or nothing exists so far
|
|
72
|
-
this._createComponent().then(function (oComponent) {
|
|
201
|
+
return this._createComponent().then(function (oComponent) {
|
|
73
202
|
// create data object
|
|
74
|
-
var aPromises = [];
|
|
75
203
|
var oConfig = oComponent.getManifestEntry("/sap.ui5/config") || {};
|
|
76
204
|
this._oData = {
|
|
77
205
|
id: oSample.id,
|
|
78
206
|
title: "Code: " + oSample.name,
|
|
79
207
|
name: oSample.name,
|
|
80
208
|
stretch: oConfig.sample ? oConfig.sample.stretch : false,
|
|
81
|
-
files:
|
|
209
|
+
files: oConfig.sample.files.map(function(sFile) {
|
|
210
|
+
return {
|
|
211
|
+
key: sFile,
|
|
212
|
+
name: sFile,
|
|
213
|
+
url: sap.ui.require.toUrl((oSample.id).replace(/\./g, "/")) + "/" + sFile
|
|
214
|
+
};
|
|
215
|
+
}),
|
|
82
216
|
iframe: oConfig.sample.iframe,
|
|
83
217
|
fileName: sFileName,
|
|
84
218
|
includeInDownload: oConfig.sample.additionalDownloadFiles,
|
|
85
219
|
customIndexHTML: oConfig.sample.customIndexHTML
|
|
86
220
|
};
|
|
87
221
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
if (oConfig.sample && oConfig.sample.files) {
|
|
91
|
-
var sRef = sap.ui.require.toUrl((oSample.id).replace(/\./g, "/"));
|
|
92
|
-
for (var i = 0; i < oConfig.sample.files.length; i++) {
|
|
93
|
-
var sFile = oConfig.sample.files[i];
|
|
94
|
-
aPromises.push(this._updateFileContent(sRef, sFile));
|
|
95
|
-
|
|
96
|
-
this._oData.files.push({
|
|
97
|
-
name: sFile
|
|
98
|
-
});
|
|
99
|
-
this._aFilesAvailable.push(sFile);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
return Promise.all(aPromises);
|
|
103
|
-
}.bind(this)).then(this._showCode.bind(this, sFileName));
|
|
222
|
+
return this._oData;
|
|
223
|
+
}.bind(this));
|
|
104
224
|
} else {
|
|
105
225
|
this._oData.fileName = sFileName;
|
|
106
|
-
this.
|
|
226
|
+
return Promise.resolve(this._oData);
|
|
107
227
|
}
|
|
108
|
-
|
|
109
228
|
},
|
|
110
229
|
|
|
111
|
-
_showCode: function(
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
if (sFileName === undefined) {
|
|
120
|
-
sFileName = this._getInitialFileName();
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
if (this._aFilesAvailable.indexOf(sFileName) === -1) {
|
|
124
|
-
this.onRouteNotFound();
|
|
125
|
-
return;
|
|
230
|
+
_showCode: function (oCurrentSample) {
|
|
231
|
+
var bUseIFrame = !!oCurrentSample.useIFrame;
|
|
232
|
+
this._oCurrSample = oCurrentSample;
|
|
233
|
+
if (oCurrentSample.files) {
|
|
234
|
+
this._fileEditor.setFiles(oCurrentSample.files);
|
|
235
|
+
} else {
|
|
236
|
+
this.byId("splitView").setBusy(false);
|
|
126
237
|
}
|
|
127
238
|
|
|
128
|
-
|
|
129
|
-
this.
|
|
130
|
-
|
|
131
|
-
this._getTabHeader().setSelectedKey(sFileName);
|
|
132
|
-
|
|
133
|
-
// scroll to the top of the page
|
|
134
|
-
var page = this.byId("page");
|
|
135
|
-
page.scrollTo(0);
|
|
136
|
-
|
|
137
|
-
this.appendPageTitle(this.getModel().getProperty("/title"));
|
|
138
|
-
},
|
|
239
|
+
ExploreSettingsModel.setProperty("/useIFrame", bUseIFrame);
|
|
240
|
+
this.oModel.setProperty("/sample", oCurrentSample);
|
|
139
241
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
oFile.raw = vContent;
|
|
145
|
-
oFile.code = this._convertCodeToHtml(vContent);
|
|
146
|
-
return true;
|
|
147
|
-
}
|
|
148
|
-
}, this);
|
|
149
|
-
this.oModel.setData(this._oData);
|
|
242
|
+
window.addEventListener("message", function (event) {
|
|
243
|
+
if (event.data === "sampleLoaded") {
|
|
244
|
+
this.byId("splitView").setBusy(false);
|
|
245
|
+
}
|
|
150
246
|
}.bind(this));
|
|
151
247
|
},
|
|
152
248
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
onNavBack : function () {
|
|
158
|
-
this.router.navTo("sample", {
|
|
159
|
-
sampleId: this._sId,
|
|
160
|
-
entityId: this._sEntityId
|
|
249
|
+
_createHTMLControl: function () {
|
|
250
|
+
return new HTML({
|
|
251
|
+
id : "sampleFrameEdit",
|
|
252
|
+
content : '<iframe src="' + this.sIFrameUrl + '" frameBorder="0" width="100%" height="100%"></iframe>'
|
|
161
253
|
});
|
|
162
254
|
},
|
|
163
255
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
// Get rid of function around code
|
|
168
|
-
code = code.replace(/^function.+{/, "");
|
|
169
|
-
|
|
170
|
-
code = code.replace(/}[!}]*$/, "");
|
|
171
|
-
|
|
172
|
-
// Get rid of unwanted code if CODESNIP tags are used
|
|
173
|
-
code = code.replace(/^[\n\s\S]*\/\/\s*CODESNIP_START\n/, "");
|
|
174
|
-
code = code.replace(/\/\/\s*CODESNIP_END[\n\s\S]*$/, "");
|
|
175
|
-
|
|
176
|
-
// Improve indentation for display
|
|
177
|
-
code = code.replace(/\t/g, " ");
|
|
178
|
-
|
|
179
|
-
return code;
|
|
180
|
-
},
|
|
181
|
-
|
|
182
|
-
handleTabSelectEvent: function(oEvent) {
|
|
183
|
-
var sFileName = oEvent.getParameter("selectedKey"),
|
|
184
|
-
oRouteParams = merge(formatter.filePathToRouteParams(sFileName), {
|
|
185
|
-
entityId: this._sEntityId,
|
|
186
|
-
sampleId: this._sId
|
|
187
|
-
});
|
|
188
|
-
|
|
189
|
-
this._bFirstLoad = false;
|
|
190
|
-
this.router.navTo("codeFile", oRouteParams, false);
|
|
256
|
+
_getPage: function () {
|
|
257
|
+
return this.byId("samplePageEdit");
|
|
191
258
|
},
|
|
192
259
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
oCodeEditor.setValue(this._getCode(sFileName));
|
|
200
|
-
oCodeEditor.setType(this._getFileType(sFileName));
|
|
201
|
-
|
|
202
|
-
// set the <code>CodeEditor</code> scroll pos to line 0
|
|
203
|
-
oAceInstance.gotoLine(/*line*/0, /*column*/0, /*animate*/false);
|
|
204
|
-
|
|
205
|
-
if (this._bFirstLoad) {
|
|
206
|
-
setTimeout(function(){
|
|
207
|
-
oAceRenderer.onResize();
|
|
208
|
-
}, 0);
|
|
260
|
+
onMessage: function(eMessage) {
|
|
261
|
+
if (eMessage.origin !== this.getOwnerComponent()._sSampleIframeOrigin) {
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
if (eMessage.source !== (this._oHtmlControl.getDomRef() && this._oHtmlControl.getDomRef().contentWindow)) {
|
|
265
|
+
return;
|
|
209
266
|
}
|
|
210
267
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
if (sTheme.indexOf("hcb") > -1) {
|
|
218
|
-
sEditorTheme = "chaos";
|
|
219
|
-
} else if (sTheme.indexOf("hcw") > -1) {
|
|
220
|
-
sEditorTheme = "github";
|
|
221
|
-
} else if (sTheme === "sap_fiori_3") {
|
|
222
|
-
sEditorTheme = "crimson_editor";
|
|
223
|
-
} else if (sTheme === "sap_fiori_3_dark" || sTheme === "sap_horizon_dark") {
|
|
224
|
-
sEditorTheme = "clouds_midnight";
|
|
268
|
+
if (eMessage.data.type === "INIT") {
|
|
269
|
+
this.fnMessageInit(eMessage);
|
|
270
|
+
} else if (eMessage.data.type === "ERR") {
|
|
271
|
+
this.fnMessageError(eMessage);
|
|
272
|
+
} else if (eMessage.data.type === "LOAD") {
|
|
273
|
+
this.fnMessageLoad(eMessage);
|
|
225
274
|
}
|
|
226
|
-
this._getCodeEditor().setColorTheme(sEditorTheme);
|
|
227
275
|
},
|
|
228
276
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
if (oFile.name === sFileName) {
|
|
235
|
-
sCode = oFile.raw;
|
|
236
|
-
return true;
|
|
237
|
-
}
|
|
238
|
-
});
|
|
239
|
-
|
|
240
|
-
return sCode;
|
|
277
|
+
onNavBack: function () {
|
|
278
|
+
this.oRouter.navTo("sample", {
|
|
279
|
+
entityId: this.entityId,
|
|
280
|
+
sampleId: this._sId
|
|
281
|
+
}, false);
|
|
241
282
|
},
|
|
242
283
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
case "ts":
|
|
249
|
-
return "typescript";
|
|
250
|
-
case "feature":
|
|
251
|
-
return "text";
|
|
252
|
-
default:
|
|
253
|
-
return sFileExtension;
|
|
254
|
-
}
|
|
284
|
+
onPreviousSample: function (oEvent) {
|
|
285
|
+
this.oRouter.navTo("code", {
|
|
286
|
+
entityId: this.entityId,
|
|
287
|
+
sampleId: this.oModel.getProperty("/previousSampleId")
|
|
288
|
+
});
|
|
255
289
|
},
|
|
256
290
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
291
|
+
onNextSample: function (oEvent) {
|
|
292
|
+
this.oRouter.navTo("code", {
|
|
293
|
+
entityId: this.entityId,
|
|
294
|
+
sampleId: this.oModel.getProperty("/nextSampleId")
|
|
295
|
+
});
|
|
262
296
|
},
|
|
263
297
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
},
|
|
298
|
+
/**
|
|
299
|
+
* Reflects changes in the code editor to the sample.
|
|
300
|
+
* @param {string} sValue The value of the manifest.json file.
|
|
301
|
+
*/
|
|
302
|
+
_updateSample: function () {
|
|
303
|
+
var oFrame = document.getElementById("sampleFrameEdit");
|
|
271
304
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
this.oTabHeader = this.byId("tabHeader");
|
|
305
|
+
if (oFrame.contentWindow && oFrame.contentWindow.sap) {
|
|
306
|
+
oFrame.contentWindow.location.reload();
|
|
275
307
|
}
|
|
276
|
-
|
|
277
|
-
return this.oTabHeader;
|
|
278
308
|
},
|
|
279
309
|
|
|
280
310
|
_createComponent : function () {
|