Compare commits
2 Commits
61bef3b785
...
fe305528ee
| Author | SHA1 | Date | |
|---|---|---|---|
| fe305528ee | |||
| 4dc3d16713 |
|
|
@ -279,7 +279,7 @@ function Editor(holder, input) {
|
||||||
if (col.children && col.children.length > 0) {
|
if (col.children && col.children.length > 0) {
|
||||||
value = col.children[0].text
|
value = col.children[0].text
|
||||||
}
|
}
|
||||||
transform(typeof value === 'string' ? value.replace(/^:/, '=') : '', $(td), id, editor, rowData)
|
transform(typeof value === 'string' ? value.replace(/^:/, '=') : '', $(td), id, editor, {row: rowData})
|
||||||
return td
|
return td
|
||||||
})
|
})
|
||||||
])
|
])
|
||||||
|
|
@ -365,6 +365,7 @@ function Editor(holder, input) {
|
||||||
|
|
||||||
element.html(converted)
|
element.html(converted)
|
||||||
})
|
})
|
||||||
|
.catch(e => console.warn(e))
|
||||||
} else {
|
} else {
|
||||||
let re = /^([A-Z0-9 ]+)::\s*(.*)$/i;
|
let re = /^([A-Z0-9 ]+)::\s*(.*)$/i;
|
||||||
let res = text.match(re)
|
let res = text.match(re)
|
||||||
|
|
@ -633,22 +634,21 @@ function Editor(holder, input) {
|
||||||
|
|
||||||
let query = $input.val()
|
let query = $input.val()
|
||||||
|
|
||||||
Promise.any([
|
match(query, /{{query(!?):\s*([^}]+)}}/)
|
||||||
match(query, /{{query(!?):\s*([^}]+)}}/)
|
.then(res => {
|
||||||
]).then(res => {
|
if (res[1] === '!') {
|
||||||
if (res[1] === '!') {
|
return search.startQuery(res[2])
|
||||||
return search.startQuery(res[2])
|
.then(hits => _.uniqBy(_.flatMap(hits, formatTitleResult), _.property('text')))
|
||||||
.then(hits => _.uniqBy(_.flatMap(hits, formatTitleResult), _.property('text')))
|
.then(results => editor.replaceChildren(id, results))
|
||||||
.then(results => editor.replaceChildren(id, results))
|
.finally(() => editor.render())
|
||||||
.finally(() => editor.render())
|
} else {
|
||||||
} else {
|
return search.startQuery(res[2])
|
||||||
return search.startQuery(res[2])
|
.then(hits => _.groupBy(hits, (it) => it.title))
|
||||||
.then(hits => _.groupBy(hits, (it) => it.title))
|
.then(hits => _.flatMap(hits, formatLineResult))
|
||||||
.then(hits => _.flatMap(hits, formatLineResult))
|
.then(results => editor.replaceChildren(id, results))
|
||||||
.then(results => editor.replaceChildren(id, results))
|
.finally(() => editor.render())
|
||||||
.finally(() => editor.render())
|
}
|
||||||
}
|
})
|
||||||
}).catch(() => console.log('match error'))
|
|
||||||
});
|
});
|
||||||
return editor
|
return editor
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
|
import "moment/locale/nl"
|
||||||
|
moment.locale('nl')
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string|moment.Moment} x
|
* @param {string|moment.Moment} x
|
||||||
|
|
@ -13,6 +15,10 @@ function date(x) {
|
||||||
if (r) {
|
if (r) {
|
||||||
return moment(r[1], "DD MMM YYYY")
|
return moment(r[1], "DD MMM YYYY")
|
||||||
}
|
}
|
||||||
|
return moment(x, "DD MMM YYYY")
|
||||||
|
}
|
||||||
|
if (_.isObject(x) && _.has(x, 'title')) {
|
||||||
|
return moment(x.title, "DD MMM YYYY")
|
||||||
}
|
}
|
||||||
return moment(x, "YYYY-MM-DD");
|
return moment(x, "YYYY-MM-DD");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,13 +19,13 @@ function handleKeyDown(editor, event) {
|
||||||
if (this.keys.hasOwnProperty(key)) {
|
if (this.keys.hasOwnProperty(key)) {
|
||||||
const action = this.keys[key]
|
const action = this.keys[key]
|
||||||
if (editor.hasOwnProperty(action)) {
|
if (editor.hasOwnProperty(action)) {
|
||||||
console.log('Key down ' + key + ', calling action ' + action)
|
// console.log('Key down ' + key + ', calling action ' + action)
|
||||||
return editor[action](event)
|
return editor[action](event)
|
||||||
} else {
|
} else {
|
||||||
console.warn('Unknown action on editor: ' + action)
|
console.warn('Unknown action on editor: ' + action)
|
||||||
}
|
}
|
||||||
} else {
|
// } else {
|
||||||
console.log('Key down ' + key)
|
// console.log('Key down ' + key)
|
||||||
}
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
|
|
@ -34,8 +34,8 @@ function handleKeyDown(editor, event) {
|
||||||
function mapKey(key, action) {
|
function mapKey(key, action) {
|
||||||
if (this.keys.hasOwnProperty(key)) {
|
if (this.keys.hasOwnProperty(key)) {
|
||||||
console.warn(`Re-defining ${key} to call ${action}`)
|
console.warn(`Re-defining ${key} to call ${action}`)
|
||||||
} else {
|
// } else {
|
||||||
console.log(`Defining ${key} to call ${action}`)
|
// console.log(`Defining ${key} to call ${action}`)
|
||||||
}
|
}
|
||||||
this.keys[key] = action
|
this.keys[key] = action
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user