mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-13 22:54:42 -04:00
Support pinning note in history
This commit is contained in:
parent
5ed395122d
commit
2cfcae6db2
3 changed files with 85 additions and 7 deletions
|
@ -111,12 +111,13 @@ function clearDuplicatedHistory(notehistory) {
|
|||
return newnotehistory;
|
||||
}
|
||||
|
||||
function addHistory(id, text, time, tags, notehistory) {
|
||||
function addHistory(id, text, time, tags, pinned, notehistory) {
|
||||
notehistory.push({
|
||||
id: id,
|
||||
text: text,
|
||||
time: time,
|
||||
tags: tags
|
||||
tags: tags,
|
||||
pinned: pinned
|
||||
});
|
||||
return notehistory;
|
||||
}
|
||||
|
@ -232,8 +233,16 @@ function renderHistory(view) {
|
|||
|
||||
function generateHistory(view, notehistory) {
|
||||
var info = renderHistory(view);
|
||||
//keep any pinned data
|
||||
var pinned = false;
|
||||
for (var i = 0; i < notehistory.length; i++) {
|
||||
if (notehistory[i].id == info.id && notehistory[i].pinned) {
|
||||
pinned = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
notehistory = removeHistory(info.id, notehistory);
|
||||
notehistory = addHistory(info.id, info.text, info.time, info.tags, notehistory);
|
||||
notehistory = addHistory(info.id, info.text, info.time, info.tags, pinned, notehistory);
|
||||
notehistory = clearDuplicatedHistory(notehistory);
|
||||
return notehistory;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue