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);
|
renderDoc(dialog.element, 1, options.id);
|
||||||
historyEditor = new Protyle(options.app, docElement, {
|
historyEditor = new Protyle(options.app, docElement, {
|
||||||
blockId: "",
|
blockId: "",
|
||||||
|
history: {
|
||||||
|
created: ""
|
||||||
|
},
|
||||||
action: [Constants.CB_GET_HISTORY],
|
action: [Constants.CB_GET_HISTORY],
|
||||||
render: {
|
render: {
|
||||||
background: false,
|
background: false,
|
||||||
|
|
@ -183,11 +186,13 @@ const getHistoryPath = (target: Element, op: string, id: string, cb: (path: stri
|
||||||
if (path) {
|
if (path) {
|
||||||
cb(path);
|
cb(path);
|
||||||
}
|
}
|
||||||
|
const created = target.getAttribute("data-created");
|
||||||
|
historyEditor.protyle.options.history.created = created;
|
||||||
fetchPost("/api/history/getHistoryItems", {
|
fetchPost("/api/history/getHistoryItems", {
|
||||||
query: id,
|
query: id,
|
||||||
op,
|
op,
|
||||||
type: 3,
|
type: 3,
|
||||||
created: target.getAttribute("data-created")
|
created
|
||||||
}, (response) => {
|
}, (response) => {
|
||||||
cb(response.data.items[0].path);
|
cb(response.data.items[0].path);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -442,6 +442,9 @@ const bindEvent = (app: App, element: Element, dialog?: Dialog) => {
|
||||||
renderDoc(firstPanelElement, 1);
|
renderDoc(firstPanelElement, 1);
|
||||||
historyEditor = new Protyle(app, docElement, {
|
historyEditor = new Protyle(app, docElement, {
|
||||||
blockId: "",
|
blockId: "",
|
||||||
|
history: {
|
||||||
|
created: ""
|
||||||
|
},
|
||||||
action: [Constants.CB_GET_HISTORY],
|
action: [Constants.CB_GET_HISTORY],
|
||||||
render: {
|
render: {
|
||||||
background: false,
|
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 opElement = firstPanelElement.querySelector('.b3-select[data-type="opselect"]') as HTMLSelectElement;
|
||||||
const typeElement = firstPanelElement.querySelector('.b3-select[data-type="typeselect"]') 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 notebookElement = firstPanelElement.querySelector('.b3-select[data-type="notebookselect"]') as HTMLSelectElement;
|
||||||
|
const created = target.getAttribute("data-created")
|
||||||
fetchPost("/api/history/getHistoryItems", {
|
fetchPost("/api/history/getHistoryItems", {
|
||||||
notebook: notebookElement.value,
|
notebook: notebookElement.value,
|
||||||
query: inputElement.value,
|
query: inputElement.value,
|
||||||
op: opElement.value,
|
op: opElement.value,
|
||||||
type: parseInt(typeElement.value),
|
type: parseInt(typeElement.value),
|
||||||
created: target.getAttribute("data-created")
|
created
|
||||||
}, (response) => {
|
}, (response) => {
|
||||||
iconElement.classList.add("b3-list-item__arrow--open");
|
iconElement.classList.add("b3-list-item__arrow--open");
|
||||||
let html = "";
|
let html = "";
|
||||||
response.data.items.forEach((docItem: { title: string, path: string }) => {
|
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="b3-list-item__text">${escapeHtml(docItem.title)}</span>
|
||||||
<span class="fn__space"></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}">
|
<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 {
|
} else {
|
||||||
mdElement.classList.add("fn__none");
|
mdElement.classList.add("fn__none");
|
||||||
docElement.classList.remove("fn__none");
|
docElement.classList.remove("fn__none");
|
||||||
|
historyEditor.protyle.options.history.created = target.dataset.created
|
||||||
onGet({
|
onGet({
|
||||||
data: response,
|
data: response,
|
||||||
protyle: historyEditor.protyle,
|
protyle: historyEditor.protyle,
|
||||||
|
|
|
||||||
|
|
@ -50,8 +50,10 @@ export const avRender = (element: Element, protyle: IProtyle, cb?: () => void) =
|
||||||
if (selectCellElement) {
|
if (selectCellElement) {
|
||||||
selectCellId = (hasClosestByClassName(selectCellElement, "av__row") as HTMLElement).dataset.id + Constants.ZWSP + selectCellElement.getAttribute("data-col-id");
|
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"),
|
id: e.getAttribute("data-av-id"),
|
||||||
|
created
|
||||||
}, (response) => {
|
}, (response) => {
|
||||||
const data = response.data.view as IAVTable;
|
const data = response.data.view as IAVTable;
|
||||||
// header
|
// 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 */
|
/** @link https://ld246.com/article/1549638745630#options */
|
||||||
interface IOptions {
|
interface IOptions {
|
||||||
|
history?: {
|
||||||
|
created?: string
|
||||||
|
},
|
||||||
backlinkData?: {
|
backlinkData?: {
|
||||||
blockPaths: IBreadcrumb[],
|
blockPaths: IBreadcrumb[],
|
||||||
dom: string
|
dom: string
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue