mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-15 08:30:42 +08:00
This commit is contained in:
parent
a11ea9c347
commit
f95084e96a
@ -20,6 +20,7 @@ import {openAsset} from "../../../editor/util";
|
|||||||
import {getSearch, isMobile} from "../../../util/functions";
|
import {getSearch, isMobile} from "../../../util/functions";
|
||||||
import {unicode2Emoji} from "../../../emoji";
|
import {unicode2Emoji} from "../../../emoji";
|
||||||
import {selectRow} from "./row";
|
import {selectRow} from "./row";
|
||||||
|
import * as dayjs from "dayjs";
|
||||||
|
|
||||||
export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLElement }) => {
|
export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLElement }) => {
|
||||||
const blockElement = hasClosestBlock(event.target);
|
const blockElement = hasClosestBlock(event.target);
|
||||||
@ -330,19 +331,30 @@ export const avContextmenu = (protyle: IProtyle, rowElement: HTMLElement, positi
|
|||||||
|
|
||||||
export const updateAVName = (protyle: IProtyle, blockElement: Element) => {
|
export const updateAVName = (protyle: IProtyle, blockElement: Element) => {
|
||||||
const avId = blockElement.getAttribute("data-av-id");
|
const avId = blockElement.getAttribute("data-av-id");
|
||||||
|
const id = blockElement.getAttribute("data-node-id");
|
||||||
const nameElement = blockElement.querySelector(".av__title") as HTMLElement;
|
const nameElement = blockElement.querySelector(".av__title") as HTMLElement;
|
||||||
const newData = nameElement.textContent.trim();
|
const newData = nameElement.textContent.trim();
|
||||||
if (newData === nameElement.dataset.title.trim()) {
|
if (newData === nameElement.dataset.title.trim()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
const newUpdated = dayjs().format("YYYYMMDDHHmmss")
|
||||||
|
blockElement.setAttribute("updated", newUpdated);
|
||||||
transaction(protyle, [{
|
transaction(protyle, [{
|
||||||
action: "setAttrViewName",
|
action: "setAttrViewName",
|
||||||
id: avId,
|
id: avId,
|
||||||
data: newData,
|
data: newData,
|
||||||
|
}, {
|
||||||
|
action: "doUpdateUpdated",
|
||||||
|
id,
|
||||||
|
data: newUpdated,
|
||||||
}], [{
|
}], [{
|
||||||
action: "setAttrViewName",
|
action: "setAttrViewName",
|
||||||
id: avId,
|
id: avId,
|
||||||
name: nameElement.dataset.title,
|
name: nameElement.dataset.title,
|
||||||
|
}, {
|
||||||
|
action: "doUpdateUpdated",
|
||||||
|
id,
|
||||||
|
data: blockElement.getAttribute("updated")
|
||||||
}]);
|
}]);
|
||||||
nameElement.dataset.title = newData;
|
nameElement.dataset.title = newData;
|
||||||
};
|
};
|
||||||
|
1
app/src/types/index.d.ts
vendored
1
app/src/types/index.d.ts
vendored
@ -34,6 +34,7 @@ type TOperation =
|
|||||||
| "removeAttrViewColOption"
|
| "removeAttrViewColOption"
|
||||||
| "updateAttrViewColOption"
|
| "updateAttrViewColOption"
|
||||||
| "setAttrViewName"
|
| "setAttrViewName"
|
||||||
|
| "doUpdateUpdated"
|
||||||
| "setAttrViewColIcon"
|
| "setAttrViewColIcon"
|
||||||
| "setAttrViewFilters"
|
| "setAttrViewFilters"
|
||||||
| "setAttrViewSorts"
|
| "setAttrViewSorts"
|
||||||
|
Loading…
Reference in New Issue
Block a user