mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-04 15:58:49 +01:00
This commit is contained in:
parent
f5fdab844e
commit
4100f80958
4 changed files with 16 additions and 9 deletions
|
|
@ -22,6 +22,8 @@ import {openAsset} from "../../../editor/util";
|
|||
import {previewImage} from "../../preview/image";
|
||||
import {assetMenu} from "../../../menus/protyle";
|
||||
import {bindViewEvent, getViewHTML} from "./view";
|
||||
import {removeBlock} from "../../wysiwyg/remove";
|
||||
import {getEditorRange} from "../../util/selection";
|
||||
|
||||
export const openMenuPanel = (options: {
|
||||
protyle: IProtyle,
|
||||
|
|
@ -552,15 +554,21 @@ export const openMenuPanel = (options: {
|
|||
avID,
|
||||
id
|
||||
}]);
|
||||
avPanelElement.remove();
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
break;
|
||||
} else if (type === "delete-view") {
|
||||
transaction(options.protyle, [{
|
||||
action: "removeAttrViewView",
|
||||
avID,
|
||||
id: data.viewID
|
||||
}]);
|
||||
if (data.views.length === 1) {
|
||||
removeBlock(options.protyle, options.blockElement, getEditorRange(options.blockElement))
|
||||
} else {
|
||||
transaction(options.protyle, [{
|
||||
action: "removeAttrViewView",
|
||||
avID,
|
||||
id: data.viewID
|
||||
}]);
|
||||
}
|
||||
avPanelElement.remove();
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -202,7 +202,7 @@ ${cell.color ? `color:${cell.color};` : ""}">${text}</div>`;
|
|||
let tabHTML = "";
|
||||
response.data.views.forEach((item: IAVView) => {
|
||||
tabHTML += `<div data-id="${item.id}" class="item${item.id === response.data.viewID ? " item--focus" : ""}">
|
||||
${response.data.view.icon ? unicode2Emoji(response.data.view.icon, "item__graphic") : '<svg class="item__graphic"><use xlink:href="#iconTable"></use></svg>'}
|
||||
${item.icon ? unicode2Emoji(item.icon, "item__graphic", true) : '<svg class="item__graphic"><use xlink:href="#iconTable"></use></svg>'}
|
||||
<span class="item__text">${item.name}</span>
|
||||
</div>`;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -3,9 +3,7 @@ import {unicode2Emoji} from "../../../emoji";
|
|||
import {transaction} from "../../wysiwyg/transaction";
|
||||
|
||||
export const openViewMenu = (element: HTMLElement) => {
|
||||
const menu = new Menu("av-view", () => {
|
||||
|
||||
});
|
||||
const menu = new Menu("av-view");
|
||||
if (menu.isOpen) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
1
app/src/types/index.d.ts
vendored
1
app/src/types/index.d.ts
vendored
|
|
@ -1015,6 +1015,7 @@ interface IAVView {
|
|||
name: string
|
||||
id: string
|
||||
type: string
|
||||
icon: string
|
||||
}
|
||||
|
||||
interface IAVTable {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue