Problem: can't copy and paste multiline text as multiple items
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Solution: split text and add multiple items
This commit is contained in:
parent
258dd4f7ab
commit
e2aa173432
|
@ -509,21 +509,33 @@ function editor(root, inputData, options) {
|
||||||
}
|
}
|
||||||
|
|
||||||
let pastedData = event.originalEvent.clipboardData.getData('text/plain')
|
let pastedData = event.originalEvent.clipboardData.getData('text/plain')
|
||||||
let items = JSON.parse(pastedData.toString());
|
try {
|
||||||
|
let items = JSON.parse(pastedData.toString());
|
||||||
|
let item = $(this).parents('.list-item')
|
||||||
|
let id = item.attr('data-id')
|
||||||
|
|
||||||
let item = $(this).parents('.list-item')
|
// reset ids
|
||||||
let id = item.attr('data-id')
|
_.each(items, item => {
|
||||||
|
item.id = null
|
||||||
|
})
|
||||||
|
|
||||||
// reset ids
|
store.insertAfter(id, ...items)
|
||||||
_.each(items, item => {
|
trigger('change')
|
||||||
item.id = null
|
return false
|
||||||
})
|
} catch (e) {
|
||||||
|
let items = pastedData.toString().split(/\n+/);
|
||||||
store.insertAfter(id, ...items)
|
let item = $(this).parents('.list-item')
|
||||||
|
let id = item.attr('data-id')
|
||||||
trigger('change')
|
const firstItem = store.value(id)
|
||||||
|
items = _.map(items, text => {
|
||||||
return false
|
const item = newListItem(firstItem.indented)
|
||||||
|
item.text = text
|
||||||
|
return item
|
||||||
|
})
|
||||||
|
store.insertAfter(id, ...items)
|
||||||
|
trigger('change')
|
||||||
|
return false
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function moveCursor(event, dir) {
|
function moveCursor(event, dir) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user