|
|
@ -320,9 +320,12 @@ function editor(root, inputData, options) {
|
|
|
|
|
|
|
|
|
|
|
|
let hideLevel = 99999;
|
|
|
|
let hideLevel = 99999;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let closedFolds = JSON.parse(localStorage.getItem('closed-folds') || '{}') || {}
|
|
|
|
|
|
|
|
|
|
|
|
$enter.each(function (index, li) {
|
|
|
|
$enter.each(function (index, li) {
|
|
|
|
let storeId = enterData[index]
|
|
|
|
let storeId = enterData[index]
|
|
|
|
let value = rootData.value(storeId)
|
|
|
|
let value = rootData.value(storeId)
|
|
|
|
|
|
|
|
value.fold = closedFolds[value.id] ? 'closed' : 'open'
|
|
|
|
|
|
|
|
|
|
|
|
let hasChildren = false;
|
|
|
|
let hasChildren = false;
|
|
|
|
if (index + 1 < last) {
|
|
|
|
if (index + 1 < last) {
|
|
|
@ -358,6 +361,8 @@ function editor(root, inputData, options) {
|
|
|
|
|
|
|
|
|
|
|
|
_.each(exitData, function (storeId, index) {
|
|
|
|
_.each(exitData, function (storeId, index) {
|
|
|
|
let value = rootData.value(storeId)
|
|
|
|
let value = rootData.value(storeId)
|
|
|
|
|
|
|
|
value.fold = closedFolds[value.id] ? 'closed' : 'open'
|
|
|
|
|
|
|
|
|
|
|
|
let $li = newItem(value)
|
|
|
|
let $li = newItem(value)
|
|
|
|
.css('margin-left', (value.indented * 32) + 'px')
|
|
|
|
.css('margin-left', (value.indented * 32) + 'px')
|
|
|
|
.toggleClass('selected', cursor.atPosition(index + $enter.length))
|
|
|
|
.toggleClass('selected', cursor.atPosition(index + $enter.length))
|
|
|
@ -427,6 +432,7 @@ function editor(root, inputData, options) {
|
|
|
|
|
|
|
|
|
|
|
|
let newPosition = store.moveBefore(startID, stopID)
|
|
|
|
let newPosition = store.moveBefore(startID, stopID)
|
|
|
|
cursor.set(newPosition[0])
|
|
|
|
cursor.set(newPosition[0])
|
|
|
|
|
|
|
|
// fix indent
|
|
|
|
|
|
|
|
|
|
|
|
_.defer(() => {
|
|
|
|
_.defer(() => {
|
|
|
|
trigger('change')
|
|
|
|
trigger('change')
|
|
|
@ -726,7 +732,7 @@ function editor(root, inputData, options) {
|
|
|
|
'{': '{}',
|
|
|
|
'{': '{}',
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
let c = prefix[prefix.length-1]
|
|
|
|
let c = prefix[prefix.length - 1]
|
|
|
|
let braceSet = braces[c]
|
|
|
|
let braceSet = braces[c]
|
|
|
|
|
|
|
|
|
|
|
|
let prefixCount = _(prefix)
|
|
|
|
let prefixCount = _(prefix)
|
|
|
|