Skip to content

Commit e7672d1

Browse files
authored
Merge branch 'main' into add-esmf-qr-code
2 parents e08781f + 05f7df4 commit e7672d1

File tree

4 files changed

+27
-19
lines changed

4 files changed

+27
-19
lines changed

.eslintrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,8 @@
1010
}],
1111
"max-len": [1, 120, 2],
1212
"spaced-comment": "off"
13+
},
14+
"globals": {
15+
"globalThis": "writable"
1316
}
1417
}

docs/logo-and-color-palette/ESMF_description.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ The following colors are used:
3030
|--------------|-----------------------------------------------------------------|-----------|----------|
3131
| Consumption | ![Consumption purple](images/esmf_color_consumption_purple.png) | #995FAB | API Consumption in UI & backend - the consumption of all required APIs in one UI to provide a customer friendly semantics aware software|
3232
| Provisioning | ![Provisioning blue](images/esmf_color_provisioning_blue.png) | #8298E0 | API Provisioning - provisioning/implementation phase where (at least) one API is provided per Aspect Model to make semantic information available in a modular way - also suitable for microservice style software solutions|
33-
| Modeling | ![Modeling bluegray](images/esmf_color_modeling_bluegrey.png) | #8DA5BF | Modeling - modeling phase where raw data (from the south side) is explained and turned into Aspect Models|
33+
| Modeling | ![Modeling bluegrey](images/esmf_color_modelling_bluegrey.png) | #8DA5BF | Modeling - modeling phase where raw data (from the south side) is explained and turned into Aspect Models|
3434
| Eclipse OSS | ![Eclipse orange](images/esmf_color_eclipse_orange.png) | #F88D2B | SAMM - depicts SAMM like a sun – SAMM as the meta model which is at its heart and formally how to express the meaning of data in Aspect Models|
3535

3636

src/js/vendor/search.js renamed to src/js/vendor/search-ui.js

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
/* eslint-env browser */
2-
window.antoraLunr = (function (lunr) {
3-
const scriptAttrs = document.getElementById('search-script').dataset
4-
const basePath = scriptAttrs.basePath
5-
const pagePath = scriptAttrs.pagePath
1+
;(globalThis || window).lunrSiteSearch = (function () {
2+
/* eslint-disable no-var */
3+
const config = document.getElementById('search-script').dataset
4+
const siteRootPath = config.siteRootPath || ''
65
var searchInput = document.getElementById('search-input')
76
var searchResult = document.createElement('div')
87
searchResult.classList.add('search-result-dropdown-menu')
@@ -20,7 +19,7 @@ window.antoraLunr = (function (lunr) {
2019

2120
var end = start + length
2221
var textEnd = text.length - 1
23-
var contextOffset = 15
22+
var contextOffset = 100
2423
var contextAfter = end + contextOffset > textEnd ? textEnd : end + contextOffset
2524
var contextBefore = start - contextOffset < 0 ? 0 : start - contextOffset
2625
if (start === 0 && end === textEnd) {
@@ -93,7 +92,7 @@ window.antoraLunr = (function (lunr) {
9392
return hits
9493
}
9594

96-
function createSearchResult(result, store, searchResultDataset) {
95+
function createSearchResult (result, store, searchResultDataset) {
9796
result.forEach(function (item) {
9897
var url = item.ref
9998
var hash
@@ -115,8 +114,7 @@ window.antoraLunr = (function (lunr) {
115114
var documentHit = document.createElement('div')
116115
documentHit.classList.add('search-result-document-hit')
117116
var documentHitLink = document.createElement('a')
118-
var rootPath = basePath
119-
documentHitLink.href = rootPath + item.ref
117+
documentHitLink.href = siteRootPath + item.ref
120118
documentHit.appendChild(documentHitLink)
121119
hits.forEach(function (hit) {
122120
documentHitLink.appendChild(hit)
@@ -194,13 +192,22 @@ window.antoraLunr = (function (lunr) {
194192
}
195193
}
196194

197-
function init (data) {
198-
var index = Object.assign({index: lunr.Index.load(data.index), store: data.store})
195+
function init (lunr, data) {
196+
var index = Object.assign({ index: lunr.Index.load(data.index), store: data.store })
197+
var debug = 'URLSearchParams' in window && new URLSearchParams(window.location.search).has('lunr-debug')
199198
var search = debounce(function () {
200-
searchIndex(index.index, index.store, searchInput.value)
199+
try {
200+
searchIndex(index.index, index.store, searchInput.value)
201+
} catch (err) {
202+
if (debug) console.debug('Invalid search query: ' + searchInput.value + ' (' + err.message + ')')
203+
}
201204
}, 100)
202205
searchInput.addEventListener('keydown', search)
203206

207+
searchInput.addEventListener('keydown', function (event) {
208+
if (event.key === 'Escape') searchInput.value = ''
209+
})
210+
204211
// this is prevented in case of mousedown attached to SearchResultItem
205212
searchInput.addEventListener('blur', function (e) {
206213
while (searchResult.firstChild) {
@@ -209,7 +216,5 @@ window.antoraLunr = (function (lunr) {
209216
})
210217
}
211218

212-
return {
213-
init: init,
214-
}
215-
})(window.lunr)
219+
return { init: init }
220+
})()

src/partials/footer-scripts.hbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script src="{{uiRootPath}}/js/site.js"></script>
22
<script src="{{uiRootPath}}/js/vendor/lunr.min.js"></script>
3-
<script src="{{uiRootPath}}/js/vendor/search.js" id="search-script" data-base-path="{{or siteRootPath (or site.url siteRootUrl)}}" data-page-path="{{@root.page.url}}"></script>
4-
<script async src="{{uiRootPath}}/../search-index.js"></script>
3+
<script src="{{uiRootPath}}/js/vendor/search-ui.js" id="search-script" data-site-root-path="{{siteRootPath}}" data-stylesheet="{{uiRootPath}}/css/search.css"></script>
4+
<script async src="{{siteRootPath}}/search-index.js"></script>
55
<script async src="{{uiRootPath}}/js/vendor/highlight.js"></script>

0 commit comments

Comments
 (0)