mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 14:40:12 +01:00
This commit is contained in:
parent
dc1941da3c
commit
15141dde1f
11 changed files with 44 additions and 32 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
{
|
{
|
||||||
|
"cloudConfigTip": "Please configure in [Settings - Cloud]",
|
||||||
"confirmUninstall": "Are you sure you want to uninstall ${name}?",
|
"confirmUninstall": "Are you sure you want to uninstall ${name}?",
|
||||||
"scrollGetMore": "Don't panic... scroll up and down to load more",
|
"scrollGetMore": "Don't panic... scroll up and down to load more",
|
||||||
"flashcardNewCard": "New",
|
"flashcardNewCard": "New",
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
{
|
{
|
||||||
|
"cloudConfigTip": "Configure en [Configuración - Nube]",
|
||||||
"confirmUninstall": "¿Está seguro de que desea desinstalar ${name}?",
|
"confirmUninstall": "¿Está seguro de que desea desinstalar ${name}?",
|
||||||
"scrollGetMore": "No se asuste... desplácese hacia arriba y hacia abajo para cargar más",
|
"scrollGetMore": "No se asuste... desplácese hacia arriba y hacia abajo para cargar más",
|
||||||
"flashcardNewCard": "Nueva Tarjeta",
|
"flashcardNewCard": "Nueva Tarjeta",
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
{
|
{
|
||||||
|
"cloudConfigTip": "Veuillez configurer dans [Paramètres - Cloud]",
|
||||||
"confirmUninstall": "Êtes-vous sûr de vouloir désinstaller ${name} ?",
|
"confirmUninstall": "Êtes-vous sûr de vouloir désinstaller ${name} ?",
|
||||||
"scrollGetMore": "Ne paniquez pas... faites défiler de haut en bas pour en charger plus",
|
"scrollGetMore": "Ne paniquez pas... faites défiler de haut en bas pour en charger plus",
|
||||||
"flashcardNewCard": "Nouvelle carte",
|
"flashcardNewCard": "Nouvelle carte",
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
{
|
{
|
||||||
|
"cloudConfigTip": "請在 [設置 - 雲端] 中進行配置",
|
||||||
"confirmUninstall": "確定卸載 ${name} ?",
|
"confirmUninstall": "確定卸載 ${name} ?",
|
||||||
"scrollGetMore": "不要驚慌...上下滾動即可加載更多內容",
|
"scrollGetMore": "不要驚慌...上下滾動即可加載更多內容",
|
||||||
"flashcardNewCard": "新卡",
|
"flashcardNewCard": "新卡",
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
{
|
{
|
||||||
|
"cloudConfigTip": "请在 [设置 - 云端] 中进行配置",
|
||||||
"confirmUninstall": "确定卸载 ${name} ?",
|
"confirmUninstall": "确定卸载 ${name} ?",
|
||||||
"scrollGetMore": "不要惊慌...上下滚动即可加载更多内容",
|
"scrollGetMore": "不要惊慌...上下滚动即可加载更多内容",
|
||||||
"flashcardNewCard": "新卡",
|
"flashcardNewCard": "新卡",
|
||||||
|
|
|
||||||
|
|
@ -593,7 +593,7 @@ export const globalShortcut = (app: App) => {
|
||||||
|
|
||||||
if (!isTabWindow && matchHotKey(window.siyuan.config.keymap.general.syncNow.custom, event)) {
|
if (!isTabWindow && matchHotKey(window.siyuan.config.keymap.general.syncNow.custom, event)) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
syncGuide(document.querySelector("#barSync"));
|
syncGuide(app);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (matchHotKey(window.siyuan.config.keymap.general.editMode.custom, event)) {
|
if (matchHotKey(window.siyuan.config.keymap.general.editMode.custom, event)) {
|
||||||
|
|
|
||||||
|
|
@ -362,22 +362,16 @@ ${window.siyuan.languages.account9}
|
||||||
_afterLogin(userResponse: IWebSocketData, element: Element) {
|
_afterLogin(userResponse: IWebSocketData, element: Element) {
|
||||||
window.siyuan.user = userResponse.data;
|
window.siyuan.user = userResponse.data;
|
||||||
processSync();
|
processSync();
|
||||||
if (element.classList.contains("account") && !needSubscribe("")) {
|
|
||||||
const dialogElement = hasClosestByClassName(element, "b3-dialog--open");
|
|
||||||
if (dialogElement) {
|
|
||||||
window.siyuan.dialogs.find((item) => {
|
|
||||||
if (item.element.isSameNode(dialogElement)) {
|
|
||||||
item.destroy();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
syncGuide();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
element.innerHTML = account.genHTML();
|
element.innerHTML = account.genHTML();
|
||||||
account.bindEvent(element);
|
account.bindEvent(element);
|
||||||
account.onSetaccount();
|
account.onSetaccount();
|
||||||
|
if (element.getAttribute("data-action") === "go-repos") {
|
||||||
|
const dialogElement = hasClosestByClassName(element, "b3-dialog--open");
|
||||||
|
if (dialogElement) {
|
||||||
|
dialogElement.querySelector('.b3-tab-bar [data-name="repos"]').dispatchEvent(new CustomEvent("click"));
|
||||||
|
element.removeAttribute("data-action");
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
onSetaccount() {
|
onSetaccount() {
|
||||||
if (repos.element) {
|
if (repos.element) {
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ export const initBar = (app: App) => {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
break;
|
break;
|
||||||
} else if (target.id === "barSync") {
|
} else if (target.id === "barSync") {
|
||||||
syncGuide(target);
|
syncGuide(app);
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
break;
|
break;
|
||||||
} else if (target.id === "barWorkspace") {
|
} else if (target.id === "barWorkspace") {
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ class App {
|
||||||
window.siyuan.user = userResponse.data;
|
window.siyuan.user = userResponse.data;
|
||||||
fetchPost("/api/system/getEmojiConf", {}, emojiResponse => {
|
fetchPost("/api/system/getEmojiConf", {}, emojiResponse => {
|
||||||
window.siyuan.emojis = emojiResponse.data as IEmoji[];
|
window.siyuan.emojis = emojiResponse.data as IEmoji[];
|
||||||
initFramework();
|
initFramework(siyuanApp);
|
||||||
initRightMenu();
|
initRightMenu();
|
||||||
loadPlugins(siyuanApp);
|
loadPlugins(siyuanApp);
|
||||||
openChangelog();
|
openChangelog();
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,9 @@ import {MobileTags} from "../dock/MobileTags";
|
||||||
import {activeBlur, hideKeyboardToolbar, initKeyboardToolbar} from "./keyboardToolbar";
|
import {activeBlur, hideKeyboardToolbar, initKeyboardToolbar} from "./keyboardToolbar";
|
||||||
import {syncGuide} from "../../sync/syncGuide";
|
import {syncGuide} from "../../sync/syncGuide";
|
||||||
import {Inbox} from "../../layout/dock/Inbox";
|
import {Inbox} from "../../layout/dock/Inbox";
|
||||||
|
import {App} from "../../index";
|
||||||
|
|
||||||
export const initFramework = () => {
|
export const initFramework = (app: App) => {
|
||||||
setInlineStyle();
|
setInlineStyle();
|
||||||
renderSnippet();
|
renderSnippet();
|
||||||
initKeyboardToolbar();
|
initKeyboardToolbar();
|
||||||
|
|
@ -122,7 +123,7 @@ export const initFramework = () => {
|
||||||
fetchPost("/api/setting/setEditor", window.siyuan.config.editor);
|
fetchPost("/api/setting/setEditor", window.siyuan.config.editor);
|
||||||
});
|
});
|
||||||
document.getElementById("toolbarSync").addEventListener(getEventName(), () => {
|
document.getElementById("toolbarSync").addEventListener(getEventName(), () => {
|
||||||
syncGuide();
|
syncGuide(app);
|
||||||
});
|
});
|
||||||
if (navigator.userAgent.indexOf("iPhone") > -1 && !window.siyuan.config.readonly && !window.siyuan.config.editor.readOnly) {
|
if (navigator.userAgent.indexOf("iPhone") > -1 && !window.siyuan.config.readonly && !window.siyuan.config.editor.readOnly) {
|
||||||
// 不知道为什么 iPhone 中如果是编辑状态,点击文档后无法点击标题
|
// 不知道为什么 iPhone 中如果是编辑状态,点击文档后无法点击标题
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,9 @@ import {fetchPost} from "../util/fetch";
|
||||||
import {Dialog} from "../dialog";
|
import {Dialog} from "../dialog";
|
||||||
import {confirmDialog} from "../dialog/confirmDialog";
|
import {confirmDialog} from "../dialog/confirmDialog";
|
||||||
import {isMobile} from "../util/functions";
|
import {isMobile} from "../util/functions";
|
||||||
import {account} from "../config/account";
|
|
||||||
import {processSync} from "../dialog/processSystem";
|
import {processSync} from "../dialog/processSystem";
|
||||||
|
import {openSetting} from "../config";
|
||||||
|
import {App} from "../index";
|
||||||
|
|
||||||
export const addCloudName = (cloudPanelElement: Element) => {
|
export const addCloudName = (cloudPanelElement: Element) => {
|
||||||
const dialog = new Dialog({
|
const dialog = new Dialog({
|
||||||
|
|
@ -82,7 +83,15 @@ export const getSyncCloudList = (cloudPanelElement: Element, reload = false, cb?
|
||||||
fetchPost("/api/sync/listCloudSyncDir", {}, (response) => {
|
fetchPost("/api/sync/listCloudSyncDir", {}, (response) => {
|
||||||
let syncListHTML = `<div class="fn__hr"></div><ul><li style="padding: 0 16px" class="b3-list--empty">${window.siyuan.languages.emptyCloudSyncList}</li></ul>`;
|
let syncListHTML = `<div class="fn__hr"></div><ul><li style="padding: 0 16px" class="b3-list--empty">${window.siyuan.languages.emptyCloudSyncList}</li></ul>`;
|
||||||
if (response.code === 1) {
|
if (response.code === 1) {
|
||||||
syncListHTML = `<div class="fn__hr"></div><ul><li style="padding: 0 16px" class="b3-list--empty ft__error">${response.msg}</li></ul>`;
|
syncListHTML = `<div class="fn__hr"></div>
|
||||||
|
<ul>
|
||||||
|
<li class="b3-list--empty ft__error">
|
||||||
|
${response.msg}
|
||||||
|
</li>
|
||||||
|
<li class="b3-list--empty">
|
||||||
|
${window.siyuan.languages.cloudConfigTip}
|
||||||
|
</li>
|
||||||
|
</ul>`;
|
||||||
} else if (response.code !== 1) {
|
} else if (response.code !== 1) {
|
||||||
syncListHTML = '<div class="fn__hr"></div><ul class="b3-list b3-list--background fn__flex-1" style="overflow: auto;">';
|
syncListHTML = '<div class="fn__hr"></div><ul class="b3-list b3-list--background fn__flex-1" style="overflow: auto;">';
|
||||||
response.data.syncDirs.forEach((item: { hSize: string, cloudName: string, updated: string }) => {
|
response.data.syncDirs.forEach((item: { hSize: string, cloudName: string, updated: string }) => {
|
||||||
|
|
@ -131,25 +140,28 @@ export const getSyncCloudList = (cloudPanelElement: Element, reload = false, cb?
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const syncGuide = (element?: Element) => {
|
export const syncGuide = (app?: App) => {
|
||||||
if (window.siyuan.config.readonly) {
|
if (window.siyuan.config.readonly) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (element && element.classList.contains("toolbar__item--active")) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (isMobile()) {
|
if (isMobile()) {
|
||||||
if (0 === window.siyuan.config.sync.provider && needSubscribe()) {
|
if (0 === window.siyuan.config.sync.provider && needSubscribe()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (0 === window.siyuan.config.sync.provider && needSubscribe("")) {
|
} else {
|
||||||
const dialog = new Dialog({
|
if (document.querySelector("#barSync")?.classList.contains("toolbar__item--active")) {
|
||||||
title: window.siyuan.languages.account,
|
return;
|
||||||
content: `<div class="account" style="background-color: var(--b3-theme-background)">${account.genHTML()}</div>`,
|
}
|
||||||
width: "80vw",
|
if (0 === window.siyuan.config.sync.provider && needSubscribe("") && app) {
|
||||||
});
|
const dialogSetting = openSetting(app);
|
||||||
account.bindEvent(dialog.element.querySelector(".account"));
|
if (window.siyuan.user) {
|
||||||
return;
|
dialogSetting.element.querySelector('.b3-tab-bar [data-name="repos"]').dispatchEvent(new CustomEvent("click"));
|
||||||
|
} else {
|
||||||
|
dialogSetting.element.querySelector('.b3-tab-bar [data-name="account"]').dispatchEvent(new CustomEvent("click"));
|
||||||
|
dialogSetting.element.querySelector('.config__tab-container[data-name="account"]').setAttribute("data-action", "go-repos");
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!window.siyuan.config.repo.key) {
|
if (!window.siyuan.config.repo.key) {
|
||||||
setKey();
|
setKey();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue