mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 09:30:14 +01:00
This commit is contained in:
parent
cf154dcaa1
commit
ce35191bf5
4 changed files with 42 additions and 17 deletions
|
|
@ -9,12 +9,12 @@ import {addFilter, getFiltersHTML, setFilter} from "./filter";
|
|||
import {addSort, bindSortsEvent, getSortsHTML} from "./sort";
|
||||
import {bindDateEvent, getDateHTML, setDateValue} from "./date";
|
||||
import {formatNumber} from "./number";
|
||||
import {removeAttrViewColAnimation} from "./action";
|
||||
import {removeAttrViewColAnimation, updateAttrViewCellAnimation} from "./action";
|
||||
import {addAssetLink, bindAssetEvent, editAssetItem, getAssetHTML, updateAssetCell} from "./asset";
|
||||
import {Constants} from "../../../constants";
|
||||
import {hideElements} from "../../ui/hideElements";
|
||||
import {pathPosix} from "../../../util/pathName";
|
||||
import {openEmojiPanel} from "../../../emoji";
|
||||
import {openEmojiPanel, unicode2Emoji} from "../../../emoji";
|
||||
|
||||
export const openMenuPanel = (options: {
|
||||
protyle: IProtyle,
|
||||
|
|
@ -509,6 +509,21 @@ export const openMenuPanel = (options: {
|
|||
y: rect.bottom,
|
||||
h: rect.height,
|
||||
w: rect.width
|
||||
}, (unicode) => {
|
||||
const colId = menuElement.querySelector(".b3-menu__item").getAttribute("data-col-id");
|
||||
transaction(options.protyle, [{
|
||||
action: "setAttrViewColIcon",
|
||||
id: colId,
|
||||
avID,
|
||||
data: unicode,
|
||||
}], [{
|
||||
action: "setAttrViewColIcon",
|
||||
id: colId,
|
||||
avID,
|
||||
data: target.dataset.icon,
|
||||
}]);
|
||||
target.innerHTML = unicode ? unicode2Emoji(unicode) : `<svg><use xlink:href="#${getColIconByType(target.dataset.colType as TAVCol)}"></use></svg>`
|
||||
updateAttrViewCellAnimation(options.blockElement.querySelector(`.av__row--header .av__cell[data-col-id="${colId}"]`))
|
||||
});
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
|
@ -693,7 +708,12 @@ export const openMenuPanel = (options: {
|
|||
break;
|
||||
} else if (type === "addAssetExist") {
|
||||
const rect = target.getBoundingClientRect();
|
||||
options.protyle.toolbar.showAssets(options.protyle, {x: rect.right, y: rect.bottom, w: target.parentElement.clientWidth + 8, h: rect.height}, (url) => {
|
||||
options.protyle.toolbar.showAssets(options.protyle, {
|
||||
x: rect.right,
|
||||
y: rect.bottom,
|
||||
w: target.parentElement.clientWidth + 8,
|
||||
h: rect.height
|
||||
}, (url) => {
|
||||
let value: IAVCellAssetValue;
|
||||
if (Constants.SIYUAN_ASSETS_IMAGE.includes(pathPosix().extname(url).toLowerCase())) {
|
||||
value = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue