Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Vanessa 2023-03-18 23:38:54 +08:00
commit 76da700991
29 changed files with 264 additions and 150 deletions

View file

@ -1120,6 +1120,7 @@
"193": "Please refer to the [Artificial Intelligence] chapter of the User Guide for configuration",
"194": "There are restrictions on the Nutstore interface, please use other WebDAV services",
"195": "The system time is incorrect, please calibrate the system time and try again",
"196": "Do not set the workspace under the path of a third-party sync disk, otherwise the data will be damaged (OneDrive/Dropbox/Google Drive/Nutstore/Baidu Netdisk/Tencent Weiyun, etc.)"
"196": "Do not set the workspace under the path of a third-party sync disk, otherwise the data will be damaged (iCloud/OneDrive/Dropbox/Google Drive/Nutstore/Baidu Netdisk/Tencent Weiyun, etc.)",
"197": "Currently the editor is in read-only mode. If you need to edit content, please switch to edit mode"
}
}

View file

@ -1120,6 +1120,7 @@
"193": "Consulte el capítulo [Inteligencia artificial] de la guía del usuario para la configuración",
"194": "Existen restricciones en la interfaz de Nutstore, utilice otros servicios WebDAV",
"195": "La hora del sistema es incorrecta, calibre la hora del sistema y vuelva a intentarlo",
"196": "No configure el espacio de trabajo bajo la ruta de un disco de sincronización de terceros, de lo contrario, los datos se dañarán (OneDrive/Dropbox/Google Drive/Nutstore/Baidu Netdisk/Tencent Weiyun, etc.)"
"196": "No configure el espacio de trabajo bajo la ruta de un disco de sincronización de terceros, de lo contrario, los datos se dañarán (iCloud/OneDrive/Dropbox/Google Drive/Nutstore/Baidu Netdisk/Tencent Weiyun, etc.)",
"197": "Actualmente, el editor se encuentra en modo de solo lectura. Si necesita editar contenido, cambie al modo de edición"
}
}

View file

@ -1120,6 +1120,7 @@
"193": "Veuillez vous référer au chapitre [Intelligence Artificielle] du guide de l'utilisateur pour la configuration",
"194": "Il existe des restrictions sur l'interface Nutstore, veuillez utiliser d'autres services WebDAV",
"195": "L'heure du système est incorrecte, veuillez calibrer l'heure du système et réessayer",
"196": "Ne définissez pas l'espace de travail sous le chemin d'un disque de synchronisation tiers, sinon les données seront endommagées (OneDrive/Dropbox/Google Drive/Nutstore/Baidu Netdisk/Tencent Weiyun, etc.)"
"196": "Ne définissez pas l'espace de travail sous le chemin d'un disque de synchronisation tiers, sinon les données seront endommagées (iCloud/OneDrive/Dropbox/Google Drive/Nutstore/Baidu Netdisk/Tencent Weiyun, etc.)",
"197": "Actuellement, l'éditeur est en mode lecture seule. Si vous devez modifier le contenu, veuillez passer en mode édition"
}
}

View file

@ -1120,6 +1120,7 @@
"193": "請先參考用戶指南 [人工智能] 章節進行配置",
"194": "堅果雲接口存在限制,請使用其他 WebDAV 服務",
"195": "系統時間不正確,請校準系統時間後再試",
"196": "請勿將工作空間設置在第三方同步盤路徑下否則數據會被損壞OneDrive/Dropbox/Google Drive/堅果雲/百度網盤/騰訊微雲等)"
"196": "請勿將工作空間設置在第三方同步盤路徑下否則數據會被損壞iCloud/OneDrive/Dropbox/Google Drive/堅果雲/百度網盤/騰訊微雲等)",
"197": "目前編輯器正處於只讀模式狀態,如果需要編輯內容,請切換到編輯模式"
}
}

View file

@ -1120,6 +1120,7 @@
"193": "请先参考用户指南 [人工智能] 章节进行配置",
"194": "坚果云接口存在限制,请使用其他 WebDAV 服务",
"195": "系统时间不正确,请校准系统时间后再试",
"196": "请勿将工作空间设置在第三方同步盘路径下否则数据会被损坏OneDrive/Dropbox/Google Drive/坚果云/百度网盘/腾讯微云等)"
"196": "请勿将工作空间设置在第三方同步盘路径下否则数据会被损坏iCloud/OneDrive/Dropbox/Google Drive/坚果云/百度网盘/腾讯微云等)",
"197": "目前编辑器正处于只读模式状态,如果需要编辑内容,请切换到编辑模式"
}
}

View file

@ -285,98 +285,112 @@
</svg>
<div class="drag"></div>
<script>
const getSearch = (key) => {
if (window.location.search.indexOf('?') === -1) {
return ''
}
let value = ''
const data = window.location.search.split('?')[1].split('&')
data.find(item => {
const keyValue = item.split('=')
if (keyValue[0] === key) {
value = keyValue[1]
return true
}
})
return value
}
const setLang = (lang) => {
if (lang === 'zh_CN') {
document.title = `思源笔记 v${getSearch('v')}`
document.getElementById('zhCN').classList.remove('fn__none')
document.getElementById('enUS').classList.add('fn__none')
} else {
document.title = `SiYuan v${getSearch('v')}`
document.getElementById('zhCN').classList.add('fn__none')
document.getElementById('enUS').classList.remove('fn__none')
}
}
let lang = decodeURIComponent(getSearch('lang'));
setLang(lang)
document.querySelectorAll('.version').forEach(item => {
item.textContent = `🔖 v${getSearch('v')}`
})
document.querySelectorAll('.icon').forEach(item => {
item.src = decodeURIComponent(`${getSearch('icon')}`)
})
document.querySelectorAll('.lang').forEach(item => {
item.value = lang
item.addEventListener('change', () => {
document.querySelectorAll('.lang').forEach(item1 => {
item1.value = item.value
})
setLang(item.value)
})
})
document.getElementById('close').addEventListener('click', () => {
const {ipcRenderer} = require('electron')
ipcRenderer.send('siyuan-first-quit')
})
document.getElementById('min').addEventListener('click', () => {
const {getCurrentWindow} = require('@electron/remote')
getCurrentWindow().minimize()
})
document.querySelectorAll('.choosePath').forEach((item) => {
item.addEventListener('click', () => {
const {dialog} = require('@electron/remote')
const path = require('path')
dialog.showOpenDialog({
defaultPath: path.join(decodeURIComponent(getSearch('home')), 'Documents'),
properties: ['openDirectory', 'createDirectory'],
}).then((result) => {
if (!result.canceled) {
const {ipcRenderer} = require('electron')
const fs = require('fs')
const initPath = result.filePaths[0]
if (isCloudDrivePath(initPath)) {
alert('⚠️ This folder may be a cloud sync disk folder, please change to a local folder')
return
}
if (!fs.existsSync(initPath)) {
fs.mkdirSync(initPath, {mode: 0o755, recursive: true})
}
ipcRenderer.send('siyuan-first-init', {
workspace: initPath,
lang: document.querySelector('.lang').value
})
const getSearch = (key) => {
if (window.location.search.indexOf('?') === -1) {
return ''
}
})
})
})
let value = ''
const data = window.location.search.split('?')[1].split('&')
data.find(item => {
const keyValue = item.split('=')
if (keyValue[0] === key) {
value = keyValue[1]
return true
}
})
return value
}
const isCloudDrivePath = (absPath) => {
const absPathLower = absPath.toLowerCase()
return -1 < absPathLower.indexOf("onedrive") || -1 < absPathLower.indexOf("dropbox") ||
-1 < absPathLower.indexOf("google drive") || -1 < absPathLower.indexOf("pcloud")
}
let currentLang = decodeURIComponent(getSearch('lang'))
const setLang = (lang) => {
if ('zh_CN' === lang) {
document.title = `思源笔记 v${getSearch('v')}`
document.getElementById('zhCN').classList.remove('fn__none')
document.getElementById('enUS').classList.add('fn__none')
} else {
document.title = `SiYuan v${getSearch('v')}`
document.getElementById('zhCN').classList.add('fn__none')
document.getElementById('enUS').classList.remove('fn__none')
}
currentLang = lang
}
setLang(currentLang)
document.querySelectorAll('.version').forEach(item => {
item.textContent = `🔖 v${getSearch('v')}`
})
document.querySelectorAll('.icon').forEach(item => {
item.src = decodeURIComponent(`${getSearch('icon')}`)
})
document.querySelectorAll('.lang').forEach(item => {
item.value = currentLang
item.addEventListener('change', () => {
document.querySelectorAll('.lang').forEach(item1 => {
item1.value = item.value
})
setLang(item.value)
})
})
document.getElementById('close').addEventListener('click', () => {
const {ipcRenderer} = require('electron')
ipcRenderer.send('siyuan-first-quit')
})
document.getElementById('min').addEventListener('click', () => {
const {getCurrentWindow} = require('@electron/remote')
getCurrentWindow().minimize()
})
document.querySelectorAll('.choosePath').forEach((item) => {
item.addEventListener('click', () => {
const {dialog} = require('@electron/remote')
const path = require('path')
dialog.showOpenDialog({
defaultPath: path.join(decodeURIComponent(getSearch('home')), 'Documents'),
properties: ['openDirectory', 'createDirectory'],
}).then((result) => {
if (result.canceled) {
return
}
const {ipcRenderer} = require('electron')
const fs = require('fs')
const initPath = result.filePaths[0]
if (isCloudDrivePath(initPath)) {
let msg = '⚠️ This folder may be a cloud sync disk folder, please change to another path'
if ('zh_CN' === currentLang) {
msg = '⚠️ 该文件夹可能是云同步盘文件夹,请更换其他路径'
}
alert(msg)
return
}
let msg = '⚠️ Do not set the workspace under the path of a third-party sync disk, otherwise the data will be damaged (iCloud/OneDrive/Dropbox/Google Drive/Nutstore/Baidu Netdisk/Tencent Weiyun, etc.), continue?'
if ('zh_CN' === currentLang) {
msg = '⚠️ 请勿将工作空间设置在第三方同步盘路径下否则数据会被损坏iCloud/OneDrive/Dropbox/Google Drive/坚果云/百度网盘/腾讯微云等),是否继续?'
}
if (!confirm(msg)) {
return
}
if (!fs.existsSync(initPath)) {
fs.mkdirSync(initPath, {mode: 0o755, recursive: true})
}
ipcRenderer.send('siyuan-first-init', {
workspace: initPath,
lang: document.querySelector('.lang').value
})
})
})
})
const isCloudDrivePath = (absPath) => {
const absPathLower = absPath.toLowerCase()
return -1 < absPathLower.indexOf("onedrive") || -1 < absPathLower.indexOf("dropbox") ||
-1 < absPathLower.indexOf("google drive") || -1 < absPathLower.indexOf("pcloud")
}
</script>
</body>
</html>

View file

@ -540,7 +540,7 @@ const initKernel = (workspace, port, lang) => {
case 26:
showErrorWindow(
"⚠️ 文件系统不一致 File system inconsistent",
"<div>请勿使用第三方同步盘进行数据同步,否则数据会被损坏(OneDrive/Dropbox/Google Drive/坚果云/百度网盘/腾讯微云等)</div><div>Do not use a third-party sync disk for data sync, otherwise the data will be damaged (OneDrive/Dropbox/Google Drive/Nutstore/Baidu Netdisk/Tencent Weiyun, etc.)</div>");
"<div>请勿使用第三方同步盘进行数据同步,否则数据会被损坏(iCloud/OneDrive/Dropbox/Google Drive/坚果云/百度网盘/腾讯微云等)</div><div>Do not use a third-party sync disk for data sync, otherwise the data will be damaged (OneDrive/Dropbox/Google Drive/Nutstore/Baidu Netdisk/Tencent Weiyun, etc.)</div>");
break;
case 0:
case 1: // Fatal error

View file

@ -82,7 +82,7 @@ export class Scroll {
if (protyle.block.showAll) {
this.element.classList.add("fn__none");
} else {
if (protyle.block.childBlockCount > window.siyuan.config.editor.dynamicLoadBlocks) {
if (protyle.block.scroll) {
this.element.classList.remove("fn__none");
} else {
this.element.classList.add("fn__none");

View file

@ -72,7 +72,7 @@ export const onGet = (data: IWebSocketData, protyle: IProtyle, action: string[]
protyle.block.showAll = false;
protyle.block.mode = data.data.mode;
protyle.block.blockCount = data.data.blockCount;
protyle.block.childBlockCount = data.data.childBlockCount;
protyle.block.scroll = data.data.scroll;
protyle.block.action = action;
if (!action.includes(Constants.CB_GET_UNCHANGEID)) {
protyle.block.id = data.data.id;

View file

@ -409,7 +409,7 @@ interface IProtyle {
id: string,
block: {
id?: string,
childBlockCount?: number,
scroll?: boolean
parentID?: string,
parent2ID?: string,
rootID?: string,