mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 09:30:14 +01:00
This commit is contained in:
parent
533669abc7
commit
29e5f10c2e
4 changed files with 424 additions and 326 deletions
|
|
@ -1,9 +1,9 @@
|
|||
import {transaction} from "../../wysiwyg/transaction";
|
||||
import {fetchPost} from "../../../util/fetch";
|
||||
import {addCol} from "./addCol";
|
||||
import {addCol} from "./col";
|
||||
import {bindEditEvent, duplicateCol, getColIconByType, getEditHTML} from "./col";
|
||||
import {setPosition} from "../../../util/setPosition";
|
||||
import {hasClosestByAttribute} from "../../util/hasClosest";
|
||||
import {hasClosestByAttribute, hasClosestByClassName} from "../../util/hasClosest";
|
||||
import {bindSelectEvent, getSelectHTML, addColOptionOrCell, setColOption, removeCellOption} from "./select";
|
||||
import {addFilter, getFiltersHTML, setFilter} from "./filter";
|
||||
import {addSort, bindSortsEvent, getSortsHTML} from "./sort";
|
||||
|
|
@ -599,6 +599,47 @@ export const openMenuPanel = (options: {
|
|||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
break;
|
||||
} else if (type === "updateColType") {
|
||||
if (target.dataset.newType !== target.dataset.oldType) {
|
||||
const name = target.dataset.name
|
||||
transaction(options.protyle, [{
|
||||
action: "updateAttrViewCol",
|
||||
id: options.colId,
|
||||
avID,
|
||||
name,
|
||||
type: target.dataset.newType as TAVCol,
|
||||
}], [{
|
||||
action: "updateAttrViewCol",
|
||||
id: options.colId,
|
||||
avID,
|
||||
name,
|
||||
type: target.dataset.oldType as TAVCol,
|
||||
}]);
|
||||
}
|
||||
avPanelElement.remove();
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
break;
|
||||
} else if (type === "goUpdateColType") {
|
||||
const editMenuElement = hasClosestByClassName(target, "b3-menu")
|
||||
if (editMenuElement) {
|
||||
editMenuElement.firstElementChild.classList.add("fn__none");
|
||||
editMenuElement.lastElementChild.classList.remove("fn__none");
|
||||
}
|
||||
setPosition(menuElement, tabRect.right - menuElement.clientWidth, tabRect.bottom, tabRect.height);
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
break;
|
||||
} else if (type === "goEditCol") {
|
||||
const editMenuElement = hasClosestByClassName(target, "b3-menu")
|
||||
if (editMenuElement) {
|
||||
editMenuElement.firstElementChild.classList.remove("fn__none");
|
||||
editMenuElement.lastElementChild.classList.add("fn__none");
|
||||
}
|
||||
setPosition(menuElement, tabRect.right - menuElement.clientWidth, tabRect.bottom, tabRect.height);
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
break;
|
||||
} else if (type === "hideCol") {
|
||||
const isEdit = menuElement.querySelector('[data-type="goProperties"]');
|
||||
const colId = isEdit ? menuElement.querySelector(".b3-menu__item").getAttribute("data-col-id") : target.parentElement.getAttribute("data-id");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue