Compare commits
No commits in common. "f8a94455cd8be78da0b8463b06f34a851f69d85c" and "8da06bc9397906c6962f6dcf40393af03ba4775f" have entirely different histories.
f8a94455cd
...
8da06bc939
|
|
@ -36,7 +36,7 @@ function addSaver(editor, saveUrl, page, beforeSave) {
|
||||||
save() {
|
save() {
|
||||||
return editor.save()
|
return editor.save()
|
||||||
.then(outputData => {
|
.then(outputData => {
|
||||||
beforeSave(outputData)
|
beforeSave()
|
||||||
let data = {
|
let data = {
|
||||||
'json': 1,
|
'json': 1,
|
||||||
'p': page,
|
'p': page,
|
||||||
|
|
@ -429,12 +429,8 @@ function Editor(holder, input) {
|
||||||
let saveUrl = element.dataset.saveurl;
|
let saveUrl = element.dataset.saveurl;
|
||||||
let page = element.dataset.page;
|
let page = element.dataset.page;
|
||||||
|
|
||||||
let beforeSave = (curDoc) => {
|
|
||||||
indicator.setText('saving...')
|
|
||||||
}
|
|
||||||
|
|
||||||
addIndicator(
|
addIndicator(
|
||||||
addSaver(editor, saveUrl, page, beforeSave),
|
addSaver(editor, saveUrl, page, () => indicator.setText('saving...')),
|
||||||
indicator
|
indicator
|
||||||
).save().then(() => indicator.done())
|
).save().then(() => indicator.done())
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -73,10 +73,8 @@ function editor(root, inputData, options) {
|
||||||
|
|
||||||
function save() {
|
function save() {
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
|
|
||||||
if (store.hasChanged()) {
|
if (store.hasChanged()) {
|
||||||
let result = store.debug().result
|
resolve(store.debug().result)
|
||||||
resolve(result)
|
|
||||||
store.clearChanged()
|
store.clearChanged()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -320,12 +318,9 @@ 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) {
|
||||||
|
|
@ -361,8 +356,6 @@ 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))
|
||||||
|
|
@ -432,7 +425,6 @@ 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')
|
||||||
|
|
|
||||||
|
|
@ -203,20 +203,9 @@ function Store(inputData) {
|
||||||
values[currentId] = newValue
|
values[currentId] = newValue
|
||||||
changed = true
|
changed = true
|
||||||
}
|
}
|
||||||
updateFold(currentId, newValue.fold === 'open')
|
|
||||||
return currentId
|
return currentId
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateFold(id, open) {
|
|
||||||
let closedFolds = JSON.parse(localStorage.getItem("closed-folds") || '{}') || {}
|
|
||||||
if (!open) {
|
|
||||||
closedFolds[id] = true
|
|
||||||
} else {
|
|
||||||
delete closedFolds[id]
|
|
||||||
}
|
|
||||||
localStorage.setItem('closed-folds', JSON.stringify(closedFolds))
|
|
||||||
}
|
|
||||||
|
|
||||||
function length() {
|
function length() {
|
||||||
return idList.length;
|
return idList.length;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user