Problem: copy and paste always creates new nodes
All checks were successful
continuous-integration/drone/push Build is passing

Solution: allow one line text as normals text
This commit is contained in:
Peter Stuifzand 2022-01-09 23:46:54 +01:00
parent e743576043
commit c30156dd10

View File

@ -526,6 +526,9 @@ function editor(root, inputData, options) {
let items = pastedData.toString().split(/\n+/); let items = pastedData.toString().split(/\n+/);
let item = $(this).parents('.list-item') let item = $(this).parents('.list-item')
let id = item.attr('data-id') let id = item.attr('data-id')
if (items.length === 1) {
return true
} else {
const firstItem = store.value(id) const firstItem = store.value(id)
items = _.map(items, text => { items = _.map(items, text => {
const item = newListItem(firstItem.indented) const item = newListItem(firstItem.indented)
@ -534,6 +537,7 @@ function editor(root, inputData, options) {
}) })
store.insertAfter(id, ...items) store.insertAfter(id, ...items)
trigger('change') trigger('change')
}
return false return false
} }
}); });