Compare commits
3 Commits
c30156dd10
...
e4539b520c
Author | SHA1 | Date | |
---|---|---|---|
e4539b520c | |||
2ed65e417f | |||
293c9d66a4 |
|
@ -79,10 +79,6 @@ body {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.list-item .fold {
|
|
||||||
visibility: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.list-item:hover .fold {
|
.list-item:hover .fold {
|
||||||
visibility: visible;
|
visibility: visible;
|
||||||
}
|
}
|
||||||
|
@ -96,11 +92,17 @@ body {
|
||||||
}
|
}
|
||||||
|
|
||||||
.list-item .fold {
|
.list-item .fold {
|
||||||
|
height: 24px;
|
||||||
|
width: 24px;
|
||||||
|
text-align: center;
|
||||||
align-self: flex-start;
|
align-self: flex-start;
|
||||||
|
flex-shrink: 0;
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
margin-top: 4px;
|
|
||||||
margin-right: 3px;
|
margin-right: 3px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
visibility: hidden;
|
||||||
|
display: inline-block;
|
||||||
|
padding-top: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
// enable to close multi line content
|
// enable to close multi line content
|
||||||
|
@ -338,6 +340,7 @@ mark {
|
||||||
|
|
||||||
.footer {
|
.footer {
|
||||||
padding: 0 12px;
|
padding: 0 12px;
|
||||||
|
margin-top: 300px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.wiki-list-editor {
|
.wiki-list-editor {
|
||||||
|
|
|
@ -523,22 +523,42 @@ function editor(root, inputData, options) {
|
||||||
trigger('change')
|
trigger('change')
|
||||||
return false
|
return false
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
let items = pastedData.toString().split(/\n+/);
|
let inputString = pastedData.toString()
|
||||||
let item = $(this).parents('.list-item')
|
if (inputString.match(/^- /)) {
|
||||||
let id = item.attr('data-id')
|
let item = $(this).parents('.list-item')
|
||||||
if (items.length === 1) {
|
let id = item.attr('data-id')
|
||||||
return true
|
let lines = inputString.split(/( *)- /)
|
||||||
} else {
|
lines.shift()
|
||||||
const firstItem = store.value(id)
|
const firstItem = store.value(id)
|
||||||
items = _.map(items, text => {
|
const firstIndent = firstItem.indented
|
||||||
const item = newListItem(firstItem.indented)
|
|
||||||
item.text = text
|
let items = _.map(_.chunk(lines, 2), line => {
|
||||||
|
const indent = Math.trunc(line[0].length / 4);
|
||||||
|
const item = newListItem(firstItem.indented+indent)
|
||||||
|
item.text = _.trimEnd(line[1]).replace(/\n/g, " \n")
|
||||||
return item
|
return item
|
||||||
})
|
})
|
||||||
store.insertAfter(id, ...items)
|
store.insertAfter(id, ...items)
|
||||||
trigger('change')
|
trigger('change')
|
||||||
|
return false
|
||||||
|
} else {
|
||||||
|
let items = inputString.split(/\n+/);
|
||||||
|
let item = $(this).parents('.list-item')
|
||||||
|
let id = item.attr('data-id')
|
||||||
|
if (items.length === 1) {
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
const firstItem = store.value(id)
|
||||||
|
items = _.map(items, text => {
|
||||||
|
const item = newListItem(firstItem.indented)
|
||||||
|
item.text = text
|
||||||
|
return item
|
||||||
|
})
|
||||||
|
store.insertAfter(id, ...items)
|
||||||
|
trigger('change')
|
||||||
|
}
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user