mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-09-22 00:20:47 +02:00
This commit is contained in:
parent
73b80d3c82
commit
5a1c885e76
9 changed files with 14 additions and 3 deletions
|
@ -281,6 +281,7 @@ export class Gutter {
|
|||
avID,
|
||||
previousID,
|
||||
srcs: [{
|
||||
itemID: Lute.NewNodeID(),
|
||||
id: srcIDs[0],
|
||||
isDetached: true,
|
||||
content: ""
|
||||
|
|
|
@ -571,6 +571,7 @@ export const avContextmenu = (protyle: IProtyle, rowElement: HTMLElement, positi
|
|||
const rowId = item.getAttribute("data-id");
|
||||
const blockValue = genCellValueByElement("block", item.querySelector('.av__cell[data-dtype="block"]'));
|
||||
srcs.push({
|
||||
itemID: Lute.NewNodeID(),
|
||||
content: blockValue.block.content,
|
||||
id: rowId,
|
||||
isDetached: blockValue.isDetached,
|
||||
|
|
|
@ -10,6 +10,7 @@ export const addFilesToDatabase = (fileLiElements: Element[]) => {
|
|||
const id = item.getAttribute("data-node-id");
|
||||
if (id) {
|
||||
srcs.push({
|
||||
itemID: Lute.NewNodeID(),
|
||||
id,
|
||||
isDetached: false
|
||||
});
|
||||
|
@ -40,6 +41,7 @@ export const addEditorToDatabase = (protyle: IProtyle, range: Range, type?: stri
|
|||
action: "insertAttrViewBlock",
|
||||
avID,
|
||||
srcs: [{
|
||||
itemID: Lute.NewNodeID(),
|
||||
id: protyle.block.rootID,
|
||||
isDetached: false
|
||||
}],
|
||||
|
@ -81,6 +83,7 @@ export const addEditorToDatabase = (protyle: IProtyle, range: Range, type?: stri
|
|||
ids.forEach(item => {
|
||||
srcIDs.push(item);
|
||||
srcs.push({
|
||||
itemID: Lute.NewNodeID(),
|
||||
id: item,
|
||||
isDetached: false
|
||||
});
|
||||
|
|
|
@ -425,6 +425,7 @@ draggable="true">${genSelectItemHTML("selected", targetId, !target.querySelector
|
|||
action: "insertAttrViewBlock",
|
||||
avID: menuElement.firstElementChild.getAttribute("data-av-id"),
|
||||
srcs: [{
|
||||
itemID: Lute.NewNodeID(),
|
||||
id: rowId,
|
||||
isDetached: true,
|
||||
content
|
||||
|
|
|
@ -718,14 +718,14 @@ export const refreshAV = (protyle: IProtyle, operation: IOperation) => {
|
|||
const groupQuery = operation.groupID ? `[data-group-id="${operation.groupID}"]` : "";
|
||||
if (item.getAttribute("data-av-type") === "gallery") {
|
||||
operation.srcs.forEach(srcItem => {
|
||||
const filesElement = item.querySelector(`.av__body${groupQuery} .av__gallery-item[data-id="${srcItem.id}"]`)?.querySelector(".av__gallery-fields");
|
||||
const filesElement = item.querySelector(`.av__body${groupQuery} .av__gallery-item[data-id="${srcItem.itemID}"]`)?.querySelector(".av__gallery-fields");
|
||||
if (filesElement && filesElement.querySelector('[data-dtype="block"]')?.getAttribute("data-empty") === "true") {
|
||||
filesElement.classList.add("av__gallery-fields--edit");
|
||||
}
|
||||
});
|
||||
}
|
||||
if (operation.srcs.length === 1) {
|
||||
const popCellElement = item.querySelector(`.av__body${groupQuery} [data-id="${operation.srcs[0].id}"] .av__cell[data-dtype="block"]`) as HTMLElement;
|
||||
const popCellElement = item.querySelector(`.av__body${groupQuery} [data-id="${operation.srcs[0].itemID}"] .av__cell[data-dtype="block"]`) as HTMLElement;
|
||||
if (popCellElement) {
|
||||
popTextCell(protyle, [popCellElement], "block");
|
||||
}
|
||||
|
|
|
@ -360,6 +360,7 @@ export const deleteRow = (blockElement: HTMLElement, protyle: IProtyle) => {
|
|||
avID,
|
||||
previousID: item.previousElementSibling?.getAttribute("data-id") || "",
|
||||
srcs: [{
|
||||
itemID: Lute.NewNodeID(),
|
||||
id: item.getAttribute("data-id"),
|
||||
isDetached: blockValue.isDetached,
|
||||
content: blockValue.block.content
|
||||
|
@ -405,6 +406,7 @@ export const insertRows = (options: {
|
|||
const newNodeID = Lute.NewNodeID();
|
||||
srcIDs.push(newNodeID);
|
||||
srcs.push({
|
||||
itemID: Lute.NewNodeID(),
|
||||
id: newNodeID,
|
||||
isDetached: true,
|
||||
content: "",
|
||||
|
|
|
@ -1023,6 +1023,7 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
|
|||
const id = item.getAttribute("data-node-id");
|
||||
sourceIds.push(id);
|
||||
srcs.push({
|
||||
itemID: Lute.NewNodeID(),
|
||||
id,
|
||||
isDetached: false,
|
||||
});
|
||||
|
@ -1320,6 +1321,7 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
|
|||
const groupID = bodyElement && bodyElement.getAttribute("data-group-id");
|
||||
ids.forEach(id => {
|
||||
srcs.push({
|
||||
itemID: Lute.NewNodeID(),
|
||||
id,
|
||||
isDetached: false,
|
||||
});
|
||||
|
|
|
@ -854,7 +854,7 @@ export const onTransaction = (protyle: IProtyle, operation: IOperation, isUndo:
|
|||
}
|
||||
return;
|
||||
}
|
||||
if (["addAttrViewCol", "insertAttrViewBlock", "updateAttrViewCol", "updateAttrViewColOptions",
|
||||
if (["addAttrViewCol", "updateAttrViewCol", "updateAttrViewColOptions",
|
||||
"updateAttrViewColOption", "updateAttrViewCell", "sortAttrViewRow", "sortAttrViewCol", "setAttrViewColHidden",
|
||||
"setAttrViewColWrap", "setAttrViewColWidth", "removeAttrViewColOption", "setAttrViewName", "setAttrViewFilters",
|
||||
"setAttrViewSorts", "setAttrViewColCalc", "removeAttrViewCol", "updateAttrViewColNumberFormat", "removeAttrViewBlock",
|
||||
|
|
1
app/src/types/index.d.ts
vendored
1
app/src/types/index.d.ts
vendored
|
@ -556,6 +556,7 @@ interface IOperation {
|
|||
}
|
||||
|
||||
interface IOperationSrcs {
|
||||
itemID: string,
|
||||
id: string,
|
||||
content?: string,
|
||||
isDetached: boolean
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue