mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-19 16:10:12 +01:00
This commit is contained in:
parent
f2766ede4c
commit
ddcd38cb2e
4 changed files with 19 additions and 4 deletions
|
|
@ -108,6 +108,9 @@ export const openDocHistory = (options: {
|
|||
renderDoc(dialog.element, 1, options.id);
|
||||
historyEditor = new Protyle(options.app, docElement, {
|
||||
blockId: "",
|
||||
history: {
|
||||
created: ""
|
||||
},
|
||||
action: [Constants.CB_GET_HISTORY],
|
||||
render: {
|
||||
background: false,
|
||||
|
|
@ -183,11 +186,13 @@ const getHistoryPath = (target: Element, op: string, id: string, cb: (path: stri
|
|||
if (path) {
|
||||
cb(path);
|
||||
}
|
||||
const created = target.getAttribute("data-created");
|
||||
historyEditor.protyle.options.history.created = created;
|
||||
fetchPost("/api/history/getHistoryItems", {
|
||||
query: id,
|
||||
op,
|
||||
type: 3,
|
||||
created: target.getAttribute("data-created")
|
||||
created
|
||||
}, (response) => {
|
||||
cb(response.data.items[0].path);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -442,6 +442,9 @@ const bindEvent = (app: App, element: Element, dialog?: Dialog) => {
|
|||
renderDoc(firstPanelElement, 1);
|
||||
historyEditor = new Protyle(app, docElement, {
|
||||
blockId: "",
|
||||
history: {
|
||||
created: ""
|
||||
},
|
||||
action: [Constants.CB_GET_HISTORY],
|
||||
render: {
|
||||
background: false,
|
||||
|
|
@ -533,17 +536,18 @@ const bindEvent = (app: App, element: Element, dialog?: Dialog) => {
|
|||
const opElement = firstPanelElement.querySelector('.b3-select[data-type="opselect"]') as HTMLSelectElement;
|
||||
const typeElement = firstPanelElement.querySelector('.b3-select[data-type="typeselect"]') as HTMLSelectElement;
|
||||
const notebookElement = firstPanelElement.querySelector('.b3-select[data-type="notebookselect"]') as HTMLSelectElement;
|
||||
const created = target.getAttribute("data-created")
|
||||
fetchPost("/api/history/getHistoryItems", {
|
||||
notebook: notebookElement.value,
|
||||
query: inputElement.value,
|
||||
op: opElement.value,
|
||||
type: parseInt(typeElement.value),
|
||||
created: target.getAttribute("data-created")
|
||||
created
|
||||
}, (response) => {
|
||||
iconElement.classList.add("b3-list-item__arrow--open");
|
||||
let html = "";
|
||||
response.data.items.forEach((docItem: { title: string, path: string }) => {
|
||||
html += `<li title="${escapeAttr(docItem.title)}" data-type="${typeElement.value === "2" ? "assets" : "doc"}" data-path="${docItem.path}" class="b3-list-item b3-list-item--hide-action" style="padding-left: 40px">
|
||||
html += `<li title="${escapeAttr(docItem.title)}" data-created="${created}" data-type="${typeElement.value === "2" ? "assets" : "doc"}" data-path="${docItem.path}" class="b3-list-item b3-list-item--hide-action" style="padding-left: 40px">
|
||||
<span class="b3-list-item__text">${escapeHtml(docItem.title)}</span>
|
||||
<span class="fn__space"></span>
|
||||
<span class="b3-list-item__action b3-tooltips b3-tooltips__w" data-type="rollback" aria-label="${window.siyuan.languages.rollback}">
|
||||
|
|
@ -611,6 +615,7 @@ const bindEvent = (app: App, element: Element, dialog?: Dialog) => {
|
|||
} else {
|
||||
mdElement.classList.add("fn__none");
|
||||
docElement.classList.remove("fn__none");
|
||||
historyEditor.protyle.options.history.created = target.dataset.created
|
||||
onGet({
|
||||
data: response,
|
||||
protyle: historyEditor.protyle,
|
||||
|
|
|
|||
|
|
@ -50,8 +50,10 @@ export const avRender = (element: Element, protyle: IProtyle, cb?: () => void) =
|
|||
if (selectCellElement) {
|
||||
selectCellId = (hasClosestByClassName(selectCellElement, "av__row") as HTMLElement).dataset.id + Constants.ZWSP + selectCellElement.getAttribute("data-col-id");
|
||||
}
|
||||
fetchPost("/api/av/renderAttributeView", {
|
||||
const created = protyle.options.history?.created;
|
||||
fetchPost(created ? "/api/av/renderHistoryAttributeView" : "/api/av/renderAttributeView", {
|
||||
id: e.getAttribute("data-av-id"),
|
||||
created
|
||||
}, (response) => {
|
||||
const data = response.data.view as IAVTable;
|
||||
// header
|
||||
|
|
|
|||
3
app/src/types/protyle.d.ts
vendored
3
app/src/types/protyle.d.ts
vendored
|
|
@ -375,6 +375,9 @@ interface IHint {
|
|||
|
||||
/** @link https://ld246.com/article/1549638745630#options */
|
||||
interface IOptions {
|
||||
history?: {
|
||||
created?: string
|
||||
},
|
||||
backlinkData?: {
|
||||
blockPaths: IBreadcrumb[],
|
||||
dom: string
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue