Some cleanup
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Peter Stuifzand 2020-11-14 15:56:22 +01:00
parent 045cf17dee
commit 10d6d7521a
3 changed files with 5 additions and 3 deletions

View File

@ -107,6 +107,7 @@ function showSearchResults(searchTool, query, input, value, resultType) {
function showSearchResultsExtended(element, template, searchTool, query, input, value, resultType, options) { function showSearchResultsExtended(element, template, searchTool, query, input, value, resultType, options) {
const $lc = $(element) const $lc = $(element)
// FIXME(peter): we should not reload this every time we search
return searchTool(query).then(results => { return searchTool(query).then(results => {
let opt = options || {}; let opt = options || {};
if (opt.showOnlyResults && (query.length === 0 || !results.length)) { if (opt.showOnlyResults && (query.length === 0 || !results.length)) {

View File

@ -137,9 +137,10 @@ function editor(root, inputData, options) {
startEditing(root, store, cursor) startEditing(root, store, cursor)
} }
function getChildren(id ) { function getChildren(id) {
return store.children(id ) return store.children(id)
} }
function replaceChildren(id, children) { function replaceChildren(id, children) {
store.replaceChildren(id, children) store.replaceChildren(id, children)
} }

View File

@ -293,7 +293,7 @@ function Store(inputData) {
let fromIndex = index(from) let fromIndex = index(from)
let toIndex = to && to !== 'at-end' ? index(to) : idList.length let toIndex = to && to !== 'at-end' ? index(to) : idList.length
let n = lastHigherIndented(fromIndex) - fromIndex let n = lastHigherIndented(fromIndex) - fromIndex
if (toIndex >= fromIndex && toIndex < fromIndex + n) return index(from) if (toIndex >= fromIndex && toIndex < fromIndex + n) return [index(from), n]
if (fromIndex < toIndex) { if (fromIndex < toIndex) {
rotate(idList, fromIndex, toIndex, n) rotate(idList, fromIndex, toIndex, n)
changed = true changed = true