mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 09:30:14 +01:00
This commit is contained in:
parent
1da805255b
commit
62e35b5c52
12 changed files with 55 additions and 44 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
{
|
{
|
||||||
|
"tabToWindow": "Move Tab to New Window",
|
||||||
"exitFocus": "Exit focus",
|
"exitFocus": "Exit focus",
|
||||||
"pointExchangeSize": "Point Exchange",
|
"pointExchangeSize": "Point Exchange",
|
||||||
"panel": "Panel",
|
"panel": "Panel",
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
{
|
{
|
||||||
|
"tabToWindow": "Mover pestaña a nueva ventana",
|
||||||
"exitFocus": "Salir del enfoque",
|
"exitFocus": "Salir del enfoque",
|
||||||
"pointExchangeSize": "Intercambio de puntos",
|
"pointExchangeSize": "Intercambio de puntos",
|
||||||
"panel": "Panel",
|
"panel": "Panel",
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
{
|
{
|
||||||
|
"tabToWindow": "Déplacer l'onglet vers une nouvelle fenêtre",
|
||||||
"exitFocus": "Quitter le focus",
|
"exitFocus": "Quitter le focus",
|
||||||
"pointExchangeSize": "Échange de points",
|
"pointExchangeSize": "Échange de points",
|
||||||
"panel": "Panneau",
|
"panel": "Panneau",
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
{
|
{
|
||||||
|
"tabToWindow": "移動頁簽到新窗口",
|
||||||
"exitFocus": "退出聚焦",
|
"exitFocus": "退出聚焦",
|
||||||
"pointExchangeSize": "積分兌換",
|
"pointExchangeSize": "積分兌換",
|
||||||
"panel": "面板",
|
"panel": "面板",
|
||||||
|
|
@ -1074,4 +1075,4 @@
|
||||||
"184": "由<a href=\"https://b3log.org/siyuan\" target=\"_blank\">思源筆記</a>強力驅動",
|
"184": "由<a href=\"https://b3log.org/siyuan\" target=\"_blank\">思源筆記</a>強力驅動",
|
||||||
"185": "索引校驗完畢"
|
"185": "索引校驗完畢"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
{
|
{
|
||||||
|
"tabToWindow": "移动页签到新窗口",
|
||||||
"exitFocus": "退出聚焦",
|
"exitFocus": "退出聚焦",
|
||||||
"pointExchangeSize": "积分兑换",
|
"pointExchangeSize": "积分兑换",
|
||||||
"panel": "面板",
|
"panel": "面板",
|
||||||
|
|
|
||||||
|
|
@ -184,6 +184,18 @@ progressLoading: 400
|
||||||
padding-left: 0;
|
padding-left: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&__window {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
display: flex;
|
||||||
|
z-index: 502;
|
||||||
|
|
||||||
|
.toolbar__item {
|
||||||
|
padding: 14px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#windowAppIcon {
|
#windowAppIcon {
|
||||||
-webkit-app-region: drag;
|
-webkit-app-region: drag;
|
||||||
width: 42px;
|
width: 42px;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import {Tab} from "../layout/Tab";
|
import {Tab} from "../layout/Tab";
|
||||||
import {MenuItem} from "./Menu";
|
import {MenuItem} from "./Menu";
|
||||||
import {Editor} from "../editor";
|
import {Editor} from "../editor";
|
||||||
import {copyTab} from "../layout/util";
|
import {copyTab, layoutToJSON} from "../layout/util";
|
||||||
/// #if !BROWSER
|
/// #if !BROWSER
|
||||||
import {BrowserWindow} from "@electron/remote";
|
import {BrowserWindow} from "@electron/remote";
|
||||||
import * as path from "path";
|
import * as path from "path";
|
||||||
|
|
@ -168,7 +168,7 @@ export const initTabMenu = (tab: Tab) => {
|
||||||
submenu: splitSubMenu(tab)
|
submenu: splitSubMenu(tab)
|
||||||
}).element);
|
}).element);
|
||||||
const model = tab.model;
|
const model = tab.model;
|
||||||
let rootId:string;
|
let rootId: string;
|
||||||
if ((model && model instanceof Editor)) {
|
if ((model && model instanceof Editor)) {
|
||||||
rootId = model.editor.protyle.block.rootID;
|
rootId = model.editor.protyle.block.rootID;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -205,10 +205,12 @@ export const initTabMenu = (tab: Tab) => {
|
||||||
}
|
}
|
||||||
/// #if !BROWSER
|
/// #if !BROWSER
|
||||||
window.siyuan.menus.menu.append(new MenuItem({
|
window.siyuan.menus.menu.append(new MenuItem({
|
||||||
label: "new window",
|
label: window.siyuan.languages.tabToWindow,
|
||||||
|
icon: "iconMove",
|
||||||
click: () => {
|
click: () => {
|
||||||
const win = new BrowserWindow({
|
const win = new BrowserWindow({
|
||||||
show: true,
|
show: true,
|
||||||
|
trafficLightPosition: {x: 8, y: 13},
|
||||||
width: 1032,
|
width: 1032,
|
||||||
height: 650,
|
height: 650,
|
||||||
frame: "darwin" === window.siyuan.config.system.os,
|
frame: "darwin" === window.siyuan.config.system.os,
|
||||||
|
|
@ -221,7 +223,10 @@ export const initTabMenu = (tab: Tab) => {
|
||||||
webSecurity: false,
|
webSecurity: false,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
win.loadURL(`${window.location.protocol}//${window.location.host}/stage/build/app/window.html?v=${Constants.SIYUAN_VERSION}&id=${rootId}`)
|
const json = {}
|
||||||
|
layoutToJSON(tab, json)
|
||||||
|
win.loadURL(`${window.location.protocol}//${window.location.host}/stage/build/app/window.html?v=${Constants.SIYUAN_VERSION}&json=${JSON.stringify(json)}`)
|
||||||
|
tab.parent.removeTab(tab.id);
|
||||||
}
|
}
|
||||||
}).element);
|
}).element);
|
||||||
/// #endif
|
/// #endif
|
||||||
|
|
|
||||||
|
|
@ -518,7 +518,7 @@ export const initWindow = () => {
|
||||||
</svg>
|
</svg>
|
||||||
</div>`;
|
</div>`;
|
||||||
if (isWindow()) {
|
if (isWindow()) {
|
||||||
document.body.insertAdjacentHTML("beforeend", `<div style="position: fixed;top: 0;right: 0;display: flex;z-index: 502;">${controlsHTML}</div>`)
|
document.body.insertAdjacentHTML("beforeend", `<div class="toolbar__window">${controlsHTML}</div>`)
|
||||||
} else {
|
} else {
|
||||||
document.getElementById("windowControls").innerHTML = controlsHTML;
|
document.getElementById("windowControls").innerHTML = controlsHTML;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
import {Constants} from "./constants";
|
import {Constants} from "../constants";
|
||||||
import {Menus} from "./menus";
|
import {Menus} from "../menus";
|
||||||
import {Model} from "./layout/Model";
|
import {Model} from "../layout/Model";
|
||||||
import "./assets/scss/base.scss";
|
import "../assets/scss/base.scss";
|
||||||
import {initBlockPopover} from "./block/popover";
|
import {initBlockPopover} from "../block/popover";
|
||||||
import {addScript, addScriptSync} from "./protyle/util/addScript";
|
import {addScript, addScriptSync} from "../protyle/util/addScript";
|
||||||
import {genUUID} from "./util/genID";
|
import {genUUID} from "../util/genID";
|
||||||
import {fetchGet, fetchPost} from "./util/fetch";
|
import {fetchGet, fetchPost} from "../util/fetch";
|
||||||
import {addBaseURL, setNoteBook} from "./util/pathName";
|
import {addBaseURL, setNoteBook} from "../util/pathName";
|
||||||
import {openFileById} from "./editor/util";
|
import {openFileById} from "../editor/util";
|
||||||
import {
|
import {
|
||||||
downloadProgress,
|
downloadProgress,
|
||||||
processSync, progressBackgroundTask,
|
processSync, progressBackgroundTask,
|
||||||
|
|
@ -15,12 +15,12 @@ import {
|
||||||
progressStatus,
|
progressStatus,
|
||||||
setTitle,
|
setTitle,
|
||||||
transactionError
|
transactionError
|
||||||
} from "./dialog/processSystem";
|
} from "../dialog/processSystem";
|
||||||
import {promiseTransactions} from "./protyle/wysiwyg/transaction";
|
import {promiseTransactions} from "../protyle/wysiwyg/transaction";
|
||||||
import {initMessage} from "./dialog/message";
|
import {initMessage} from "../dialog/message";
|
||||||
import {getAllTabs} from "./layout/getAll";
|
import {getAllTabs} from "../layout/getAll";
|
||||||
import {getLocalStorage} from "./protyle/util/compatibility";
|
import {getLocalStorage} from "../protyle/util/compatibility";
|
||||||
import {init} from "./window/init";
|
import {init} from "../window/init";
|
||||||
|
|
||||||
class App {
|
class App {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
|
@ -16,27 +16,16 @@ export const init = () => {
|
||||||
globalShortcut();
|
globalShortcut();
|
||||||
fetchPost("/api/system/getEmojiConf", {}, response => {
|
fetchPost("/api/system/getEmojiConf", {}, response => {
|
||||||
window.siyuan.emojis = response.data as IEmoji[];
|
window.siyuan.emojis = response.data as IEmoji[];
|
||||||
const id = getSearch("id");
|
const tabJSON = JSON.parse(getSearch("json"));
|
||||||
JSONToCenter({
|
JSONToCenter({
|
||||||
"direction": "lr",
|
direction: "lr",
|
||||||
"resize": "lr",
|
resize: "lr",
|
||||||
"size": "auto",
|
size: "auto",
|
||||||
"type": "center",
|
type: "center",
|
||||||
"instance": "Layout",
|
instance: "Layout",
|
||||||
"children": [{
|
children: [{
|
||||||
"instance": "Wnd",
|
instance: "Wnd",
|
||||||
"children": [{
|
children: [tabJSON]
|
||||||
"instance": "Tab",
|
|
||||||
active: true,
|
|
||||||
docIcon: "1f389",
|
|
||||||
title: "请从这里开始",
|
|
||||||
"children": [{
|
|
||||||
rootId: id,
|
|
||||||
blockId: id,
|
|
||||||
instance: "Editor",
|
|
||||||
mode: "wysiwyg"
|
|
||||||
}]
|
|
||||||
}]
|
|
||||||
}]
|
}]
|
||||||
});
|
});
|
||||||
window.siyuan.layout.centerLayout = window.siyuan.layout.layout;
|
window.siyuan.layout.centerLayout = window.siyuan.layout.layout;
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ export const setTabPosition = () => {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (rect.top <= 0 && rect.right >= window.innerWidth) {
|
if (rect.top <= 0 && rect.right >= window.innerWidth) {
|
||||||
(headerElement.lastElementChild as HTMLElement).style.paddingRight = (32 * 3) + "px";
|
(headerElement.lastElementChild as HTMLElement).style.paddingRight = (42 * 3) + "px";
|
||||||
} else {
|
} else {
|
||||||
(headerElement.lastElementChild as HTMLElement).style.paddingRight = "";
|
(headerElement.lastElementChild as HTMLElement).style.paddingRight = "";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ module.exports = (env, argv) => {
|
||||||
},
|
},
|
||||||
entry: {
|
entry: {
|
||||||
'main': './src/index.ts',
|
'main': './src/index.ts',
|
||||||
'window': './src/window.ts',
|
'window': './src/window/index.ts',
|
||||||
},
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
extensions: ['.ts', '.js', '.tpl', '.scss', '.png', '.svg'],
|
extensions: ['.ts', '.js', '.tpl', '.scss', '.png', '.svg'],
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue