mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-20 16:40:13 +01:00
This commit is contained in:
parent
18d4c5800c
commit
d87fd0f109
5 changed files with 21 additions and 7 deletions
|
|
@ -191,7 +191,7 @@ export const addEmoji = (unicode: string) => {
|
|||
fetchPost("/api/setting/setEmoji", {emoji: window.siyuan.config.editor.emoji});
|
||||
};
|
||||
|
||||
export const openEmojiPanel = (id: string, type: "doc" | "notebook" | "av", position: IPosition) => {
|
||||
export const openEmojiPanel = (id: string, type: "doc" | "notebook" | "av", position: IPosition, avCB?: (emoji: string) => void) => {
|
||||
if (type !== "av") {
|
||||
window.siyuan.menus.menu.remove();
|
||||
} else {
|
||||
|
|
@ -303,7 +303,7 @@ export const openEmojiPanel = (id: string, type: "doc" | "notebook" | "av", posi
|
|||
updateOutlineEmoji(unicode, id);
|
||||
});
|
||||
} else {
|
||||
|
||||
avCB(unicode);
|
||||
}
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
|
@ -395,7 +395,7 @@ ${unicode2Emoji(emoji.unicode)}</button>`;
|
|||
updateOutlineEmoji("", id);
|
||||
});
|
||||
} else {
|
||||
|
||||
avCB("");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
@ -429,7 +429,7 @@ ${unicode2Emoji(emoji.unicode)}</button>`;
|
|||
updateOutlineEmoji(unicode, id);
|
||||
});
|
||||
} else {
|
||||
|
||||
avCB(unicode);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -399,6 +399,18 @@ export const showColMenu = (protyle: IProtyle, blockElement: Element, cellElemen
|
|||
y: rect.bottom,
|
||||
h: rect.height,
|
||||
w: rect.width
|
||||
}, (unicode) => {
|
||||
transaction(protyle, [{
|
||||
action: "setAttrViewColIcon",
|
||||
id: colId,
|
||||
avID,
|
||||
data: unicode,
|
||||
}], [{
|
||||
action: "setAttrViewColIcon",
|
||||
id: colId,
|
||||
avID,
|
||||
data: cellElement.dataset.icon,
|
||||
}]);
|
||||
});
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import {getColIconByType} from "./col";
|
|||
import {Constants} from "../../../constants";
|
||||
import {getCalcValue} from "./cell";
|
||||
import * as dayjs from "dayjs";
|
||||
import {unicode2Emoji} from "../../../emoji";
|
||||
|
||||
export const avRender = (element: Element, protyle: IProtyle, cb?: () => void) => {
|
||||
let avElements: Element[] = [];
|
||||
|
|
@ -32,11 +33,11 @@ export const avRender = (element: Element, protyle: IProtyle, cb?: () => void) =
|
|||
if (column.hidden) {
|
||||
return;
|
||||
}
|
||||
tableHTML += `<div class="av__cell" data-col-id="${column.id}" data-dtype="${column.type}"
|
||||
tableHTML += `<div class="av__cell" data-col-id="${column.id}" data-icon="${column.icon}" data-dtype="${column.type}"
|
||||
style="width: ${column.width || "200px"};
|
||||
${column.wrap ? "" : "white-space: nowrap;"}">
|
||||
<div draggable="true" class="av__cellheader">
|
||||
<svg><use xlink:href="#${column.icon || getColIconByType(column.type)}"></use></svg>
|
||||
${column.icon ? unicode2Emoji(column.icon) : `<svg><use xlink:href="#${getColIconByType(column.type)}"></use></svg>`}
|
||||
<span class="av__celltext">${column.name}</span>
|
||||
</div>
|
||||
<div class="av__widthdrag"></div>
|
||||
|
|
|
|||
|
|
@ -709,7 +709,7 @@ export const onTransaction = (protyle: IProtyle, operation: IOperation, isUndo:
|
|||
"updateAttrViewColOption", "updateAttrViewCell", "sortAttrViewRow", "sortAttrViewCol", "setAttrViewColHidden",
|
||||
"setAttrViewColWrap", "setAttrViewColWidth", "removeAttrViewColOption", "setAttrViewName", "setAttrViewFilters",
|
||||
"setAttrViewSorts", "setAttrViewColCalc", "removeAttrViewCol", "updateAttrViewColNumberFormat",
|
||||
"replaceAttrViewBlock", "updateAttrViewColTemplate"].includes(operation.action)) {
|
||||
"replaceAttrViewBlock", "updateAttrViewColTemplate", "setAttrViewColIcon"].includes(operation.action)) {
|
||||
refreshAV(protyle, operation);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
1
app/src/types/index.d.ts
vendored
1
app/src/types/index.d.ts
vendored
|
|
@ -34,6 +34,7 @@ type TOperation =
|
|||
| "removeAttrViewColOption"
|
||||
| "updateAttrViewColOption"
|
||||
| "setAttrViewName"
|
||||
| "setAttrViewColIcon"
|
||||
| "setAttrViewFilters"
|
||||
| "setAttrViewSorts"
|
||||
| "setAttrViewColCalc"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue