A privacy-first, self-hosted, fully open source personal knowledge management software, written in typescript and golang. (PERSONAL FORK)
at lambda-fork/main 28 lines 1.4 kB view raw
1import {MenuItem} from "./Menu"; 2 3const moveMenuItem = (label: string, target: Element) => { 4 return new MenuItem({ 5 label: window.siyuan.languages[label], 6 icon: label.replace("moveTo", "icon"), 7 click: () => { 8 if (label.indexOf("moveToLeft") > -1) { 9 window.siyuan.layout.leftDock.add(label.endsWith("Top") ? 0 : 1, target); 10 } else if (label.indexOf("moveToRight") > -1) { 11 window.siyuan.layout.rightDock.add(label.endsWith("Top") ? 0 : 1, target); 12 } else if (label.indexOf("moveToBottom") > -1) { 13 window.siyuan.layout.bottomDock.add(label.endsWith("Left") ? 0 : 1, target); 14 } 15 } 16 }); 17}; 18 19export const initDockMenu = (target: Element) => { 20 window.siyuan.menus.menu.remove(); 21 window.siyuan.menus.menu.append(moveMenuItem("moveToLeftTop", target).element); 22 window.siyuan.menus.menu.append(moveMenuItem("moveToLeftBottom", target).element); 23 window.siyuan.menus.menu.append(moveMenuItem("moveToRightTop", target).element); 24 window.siyuan.menus.menu.append(moveMenuItem("moveToRightBottom", target).element); 25 window.siyuan.menus.menu.append(moveMenuItem("moveToBottomLeft", target).element); 26 window.siyuan.menus.menu.append(moveMenuItem("moveToBottomRight", target).element); 27 return window.siyuan.menus.menu; 28};