Compare commits

..

No commits in common. "master" and "v3.1.17-dev1" have entirely different histories.

39 changed files with 157 additions and 380 deletions

View file

@ -9,7 +9,7 @@
<Identity Name="89C2A984.SiYuan"
ProcessorArchitecture="x64"
Publisher="CN=087C656E-C1D9-42D8-8807-CED45A74FC0F"
Version="3.1.17.0"/>
Version="3.1.16.0"/>
<Properties>
<DisplayName>SiYuan</DisplayName>
<PublisherDisplayName>云南链滴科技有限公司</PublisherDisplayName>

View file

@ -1,42 +0,0 @@
## Overview
This version reduces startup time when sync is enabled.
## Changelogs
Below are the detailed changes in this version.
### Enhancement
* [Database-bound block primary key supports setting static anchor text](https://github.com/siyuan-note/siyuan/issues/10049)
* [The text pasted into the database supports the use of `\t` and `\n` for segmentation and line breaks](https://github.com/siyuan-note/siyuan/issues/13259)
* [Adjust window buttons when the interface is scaled on macOS](https://github.com/siyuan-note/siyuan/issues/13526)
* [The mobile database always displays the `Calculation` row](https://github.com/siyuan-note/siyuan/issues/13535)
* [Improve Attribute Panel - Database - Remove block](https://github.com/siyuan-note/siyuan/issues/13536)
* [Improve list item multi-select indentation interaction](https://github.com/siyuan-note/siyuan/issues/13555)
* [Remove browser default Ctrl+B/I/U](https://github.com/siyuan-note/siyuan/issues/13571)
* [Reduce startup time when sync is enabled](https://github.com/siyuan-note/siyuan/issues/13589)
### Bugfix
* [Emoji not displayed on Linux](https://github.com/siyuan-note/siyuan/issues/13213)
* [Database paste causes crash](https://github.com/siyuan-note/siyuan/issues/13410)
* [Results not highlighted when searching using query syntax](https://github.com/siyuan-note/siyuan/issues/13532)
* [Document cannot be exported as Markdown](https://github.com/siyuan-note/siyuan/issues/13545)
* [Incorrect list item styles in exported PDF](https://github.com/siyuan-note/siyuan/issues/13550)
* [Cannot export Data on mobile](https://github.com/siyuan-note/siyuan/issues/13565)
### Refactor
* [Upgrade to AWS SDK for Go v2](https://github.com/siyuan-note/siyuan/issues/13557)
* [Upgrade to Electron v32.2.7](https://github.com/siyuan-note/siyuan/issues/13566)
### Development
* [Add `renderAVAttribute` method to Protyle](https://github.com/siyuan-note/siyuan/pull/13547)
* [Add plugin function `getAllModels`](https://github.com/siyuan-note/siyuan/issues/13579)
## Download
* [B3log](https://b3log.org/siyuan/en/download.html)
* [GitHub](https://github.com/siyuan-note/siyuan/releases)

View file

@ -1,42 +0,0 @@
## 概述
此版本改變降低了啟用同步時的啟動時間。
## 變更記錄
以下是此版本中的詳細變更。
### 改進功能
* [資料庫綁定區塊主鍵支援設定靜態錨文本](https://github.com/siyuan-note/siyuan/issues/10049)
* [貼到資料庫中的文字支援使用 `\t` 和 `\n` 進行分割和換行](https://github.com/siyuan-note/siyuan/issues/13259)
* [在 macOS 上調整介面縮放時的視窗按鈕](https://github.com/siyuan-note/siyuan/issues/13526)
* [行動資料庫總是顯示 `計算` 行](https://github.com/siyuan-note/siyuan/issues/13535)
* [改進屬性面板 - 資料庫 - 刪除區塊](https://github.com/siyuan-note/siyuan/issues/13536)
* [改進清單項目多選縮排互動](https://github.com/siyuan-note/siyuan/issues/13555)
* [移除瀏覽器預設的 Ctrl+B/I/U](https://github.com/siyuan-note/siyuan/issues/13571)
* [啟用同步時減少啟動時間](https://github.com/siyuan-note/siyuan/issues/13589)
### 修復缺陷
* [Linux 上不顯示表情符號](https://github.com/siyuan-note/siyuan/issues/13213)
* [貼到資料庫導致崩潰](https://github.com/siyuan-note/siyuan/issues/13410)
* [使用查詢語法搜尋時結果未高亮顯示](https://github.com/siyuan-note/siyuan/issues/13532)
* [文件無法匯出為 Markdown](https://github.com/siyuan-note/siyuan/issues/13545)
* [匯出的 PDF 中清單項目樣式不正確](https://github.com/siyuan-note/siyuan/issues/13550)
* [無法在行動裝置上匯出資料](https://github.com/siyuan-note/siyuan/issues/13565)
### 開發重構
* [升級至 AWS SDK for Go v2](https://github.com/siyuan-note/siyuan/issues/13557)
* [升級至 Electron v32.2.7](https://github.com/siyuan-note/siyuan/issues/13566)
### 開發者
* [為 Protyle 新增 `renderAVAttribute` 方法](https://github.com/siyuan-note/siyuan/pull/13547)
* [新增外掛程式 `getAllModels`](https://github.com/siyuan-note/siyuan/issues/13579)
## 下載
* [B3log](https://b3log.org/siyuan/download.html)
* [GitHub](https://github.com/siyuan-note/siyuan/releases)

View file

@ -1,42 +0,0 @@
## 概述
该版本改降低了启用同步时的启动时间。
## 变更记录
以下是此版本中的详细变更。
### 改进功能
* [数据库绑定块主键支持设置静态锚文本](https://github.com/siyuan-note/siyuan/issues/10049)
* [粘贴到数据库中的文本支持使用 `\t` 和 `\n` 进行分割和换行](https://github.com/siyuan-note/siyuan/issues/13259)
* [在 macOS 上调整界面缩放时的窗口按钮](https://github.com/siyuan-note/siyuan/issues/13526)
* [移动数据库始终显示 `计算` 行](https://github.com/siyuan-note/siyuan/issues/13535)
* [改进属性面板 - 数据库 - 删除块](https://github.com/siyuan-note/siyuan/issues/13536)
* [改进列表项多选缩进交互](https://github.com/siyuan-note/siyuan/issues/13555)
* [移除浏览器默认的 Ctrl+B/I/U](https://github.com/siyuan-note/siyuan/issues/13571)
* [启用同步时减少启动时间](https://github.com/siyuan-note/siyuan/issues/13589)
### 修复缺陷
* [Linux 上不显示表情符号](https://github.com/siyuan-note/siyuan/issues/13213)
* [粘贴到数据库导致崩溃](https://github.com/siyuan-note/siyuan/issues/13410)
* [使用查询语法搜索时结果未高亮显示](https://github.com/siyuan-note/siyuan/issues/13532)
* [文档无法导出为 Markdown](https://github.com/siyuan-note/siyuan/issues/13545)
* [导出的 PDF 中列表项样式不正确](https://github.com/siyuan-note/siyuan/issues/13550)
* [无法在移动设备上导出数据](https://github.com/siyuan-note/siyuan/issues/13565)
### 开发重构
* [升级到 AWS SDK for Go v2](https://github.com/siyuan-note/siyuan/issues/13557)
* [升级到 Electron v32.2.7](https://github.com/siyuan-note/siyuan/issues/13566)
### 开发者
* [为 Protyle 添加 `renderAVAttribute` 方法](https://github.com/siyuan-note/siyuan/pull/13547)
* [添加插件函数 `getAllModels`](https://github.com/siyuan-note/siyuan/issues/13579)
## 下载
* [B3log](https://b3log.org/siyuan/download.html)
* [GitHub](https://github.com/siyuan-note/siyuan/releases)

View file

@ -19,10 +19,11 @@ win:
- from: "kernel-arm64"
to: "kernel"
requestedExecutionLevel: "asInvoker"
signtoolOptions:
#certificateSubjectName: "Yunnan Liandi Technology Co., Ltd."
signingHashAlgorithms: [ 'sha256' ]
rfc3161TimeStampServer: "http://timestamp.entrust.net/TSS/RFC3161sha2TS"
# certificateSubjectName: "Yunnan Liandi Technology Co., Ltd."
signingHashAlgorithms: [ 'sha256' ]
#rfc3161TimeStampServer: "http://sha256timestamp.ws.symantec.com/sha256/timestamp"
#rfc3161TimeStampServer: "http://time.certum.pl"
rfc3161TimeStampServer: "http://timestamp.entrust.net/TSS/RFC3161sha2TS"
target:
- target: "nsis"
arch: "arm64"

View file

@ -19,10 +19,11 @@ win:
- from: "kernel"
to: "kernel"
requestedExecutionLevel: "asInvoker"
signtoolOptions:
#certificateSubjectName: "Yunnan Liandi Technology Co., Ltd."
signingHashAlgorithms: [ 'sha256' ]
rfc3161TimeStampServer: "http://timestamp.entrust.net/TSS/RFC3161sha2TS"
# certificateSubjectName: "Yunnan Liandi Technology Co., Ltd."
signingHashAlgorithms: [ 'sha256' ]
#rfc3161TimeStampServer: "http://sha256timestamp.ws.symantec.com/sha256/timestamp"
#rfc3161TimeStampServer: "http://time.certum.pl"
rfc3161TimeStampServer: "http://timestamp.entrust.net/TSS/RFC3161sha2TS"
target:
- target: "nsis"
nsis:

View file

@ -6,7 +6,7 @@
"id": "20201204184532-3qm9l8n",
"title": "Template snippet",
"type": "doc",
"updated": "20241224162810"
"updated": "20241213215714"
},
"Children": [
{
@ -57,7 +57,7 @@
"HeadingLevel": 2,
"Properties": {
"id": "20210104091444-jy56z0p",
"updated": "20241224162810"
"updated": "20241213215714"
},
"Children": [
{
@ -215,7 +215,7 @@
"ListData": {},
"Properties": {
"id": "20210104091444-mwbvc9m",
"updated": "20241224162810"
"updated": "20241213215714"
},
"Children": [
{
@ -484,7 +484,7 @@
},
"Properties": {
"id": "20210504093232-vukp34t",
"updated": "20241224162810"
"updated": "20240403151002"
},
"Children": [
{
@ -516,7 +516,7 @@
"IsFencedCodeBlock": true,
"Properties": {
"id": "20241213215606-a1mq6zf",
"updated": "20241224162810"
"updated": "20241213215606"
},
"Children": [
{
@ -528,7 +528,7 @@
},
{
"Type": "NodeCodeBlockCode",
"Data": " .action{querySpans \"SELECT * FROM spans LIMIT ?\" \"3\"}\n"
"Data": " .action{querySQL \"SELECT * FROM spans LIMIT ?\" \"3\"}\n"
},
{
"Type": "NodeCodeBlockFenceCloseMarker",

View file

@ -6,7 +6,7 @@
"id": "20201204181006-7bkppue",
"title": "模板片段",
"type": "doc",
"updated": "20241224162826"
"updated": "20241213215655"
},
"Children": [
{
@ -69,7 +69,7 @@
"HeadingLevel": 2,
"Properties": {
"id": "20210104091309-fhb549c",
"updated": "20241224162826"
"updated": "20241213215655"
},
"Children": [
{
@ -237,7 +237,7 @@
"ListData": {},
"Properties": {
"id": "20210104091309-gjkg3u5",
"updated": "20241224162826"
"updated": "20241213215655"
},
"Children": [
{
@ -506,7 +506,7 @@
},
"Properties": {
"id": "20210504093313-4aoyxd0",
"updated": "20241224162826"
"updated": "20241213215416"
},
"Children": [
{
@ -538,7 +538,7 @@
"IsFencedCodeBlock": true,
"Properties": {
"id": "20241213215337-rhkoc8k",
"updated": "20241224162826"
"updated": "20241213215416"
},
"Children": [
{
@ -550,7 +550,7 @@
},
{
"Type": "NodeCodeBlockCode",
"Data": " .action{querySpans \"SELECT * FROM spans LIMIT ?\" \"3\"}\n"
"Data": " .action{querySQL \"SELECT * FROM spans LIMIT ?\" \"3\"}\n"
},
{
"Type": "NodeCodeBlockFenceCloseMarker",

View file

@ -6,7 +6,7 @@
"id": "20211226123004-dplpw0o",
"title": "範本片段",
"type": "doc",
"updated": "20241224162821"
"updated": "20241213215707"
},
"Children": [
{
@ -53,7 +53,7 @@
"HeadingLevel": 2,
"Properties": {
"id": "20211226123024-eyagqur",
"updated": "20241224162821"
"updated": "20241213215707"
},
"Children": [
{
@ -208,7 +208,7 @@
"ListData": {},
"Properties": {
"id": "20211226123024-pjvw31z",
"updated": "20241224162821"
"updated": "20241213215707"
},
"Children": [
{
@ -477,7 +477,7 @@
},
"Properties": {
"id": "20211226123024-69kddle",
"updated": "20241224162821"
"updated": "20240403150944"
},
"Children": [
{
@ -509,7 +509,7 @@
"IsFencedCodeBlock": true,
"Properties": {
"id": "20241213215524-9an3khb",
"updated": "20241224162821"
"updated": "20241213215524"
},
"Children": [
{
@ -521,7 +521,7 @@
},
{
"Type": "NodeCodeBlockCode",
"Data": " .action{querySpans \"SELECT * FROM spans LIMIT ?\" \"3\"}\n"
"Data": " .action{querySQL \"SELECT * FROM spans LIMIT ?\" \"3\"}\n"
},
{
"Type": "NodeCodeBlockFenceCloseMarker",

View file

@ -7,7 +7,7 @@
"id": "20240530101000-6x9ivi7",
"title": "テンプレートスニペット",
"type": "doc",
"updated": "20241224162728"
"updated": "20241213215720"
},
"Children": [
{
@ -66,7 +66,7 @@
"Properties": {
"ID": "20240530101000-5nvn9ad",
"id": "20240530101000-pi05yzt",
"updated": "20241224162728"
"updated": "20241213215720"
},
"Children": [
{
@ -226,7 +226,7 @@
"ListData": {},
"Properties": {
"id": "20240530101000-by5hqnb",
"updated": "20241224162728"
"updated": "20241213215720"
},
"Children": [
{
@ -495,7 +495,7 @@
},
"Properties": {
"id": "20240530101000-238ctfi",
"updated": "20241224162728"
"updated": "20240530101000"
},
"Children": [
{
@ -527,7 +527,7 @@
"IsFencedCodeBlock": true,
"Properties": {
"id": "20241213215619-gkqs282",
"updated": "20241224162728"
"updated": "20241213215619"
},
"Children": [
{
@ -539,7 +539,7 @@
},
{
"Type": "NodeCodeBlockCode",
"Data": " .action{querySpans \"SELECT * FROM spans LIMIT ?\" \"3\"}\n"
"Data": " .action{querySQL \"SELECT * FROM spans LIMIT ?\" \"3\"}\n"
},
{
"Type": "NodeCodeBlockFenceCloseMarker",

View file

@ -1,6 +1,6 @@
{
"name": "SiYuan",
"version": "3.1.17",
"version": "3.1.16",
"description": "Refactor your thinking",
"homepage": "https://b3log.org/siyuan",
"main": "./electron/main.js",

View file

@ -493,8 +493,7 @@
}
}
.av__views .block__icon,
.av__row--footer .av__calc {
.av__views .block__icon {
opacity: 1;
}

View file

@ -6,4 +6,4 @@ export const img3115 = (imgElement: HTMLElement) => {
} else {
imgElement.removeAttribute("style");
}
};
}

View file

@ -60,7 +60,6 @@ export const getAllEditor = () => {
};
export const getAllModels = () => {
/// #if !MOBILE
const models: IModels = {
editor: [],
graph: [],
@ -110,7 +109,6 @@ export const getAllModels = () => {
getTabs(window.siyuan.layout.layout);
}
return models;
/// #endif
};
export const getAllWnds = (layout: Layout, wnds: Wnd[]) => {

View file

@ -1189,7 +1189,7 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme
rangeElement.value = "0";
rangeElement.parentElement.setAttribute("aria-label", inputElement.value ? (inputElement.value + "px") : window.siyuan.languages.default);
img3115(assetElement);
img3115(assetElement)
imgElement.parentElement.style.width = inputElement.value ? (inputElement.value + "px") : "";
imgElement.style.height = "";
});
@ -1220,7 +1220,7 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme
bind(element) {
rangeElement = element.querySelector("input");
rangeElement.addEventListener("input", () => {
img3115(assetElement);
img3115(assetElement)
imgElement.parentElement.style.width = rangeElement.value + "%";
imgElement.style.height = "";
rangeElement.parentElement.setAttribute("aria-label", `${rangeElement.value}%`);
@ -1254,7 +1254,7 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme
rangeHeightElement.parentElement.setAttribute("aria-label", inputElement.value ? (inputElement.value + "px") : window.siyuan.languages.default);
imgElement.style.height = inputElement.value ? (inputElement.value + "px") : "";
img3115(assetElement);
img3115(assetElement)
imgElement.parentElement.style.width = "";
});
inputElement.addEventListener("blur", () => {
@ -1284,7 +1284,7 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme
bind(element) {
rangeHeightElement = element.querySelector("input");
rangeHeightElement.addEventListener("input", () => {
img3115(assetElement);
img3115(assetElement)
imgElement.parentElement.style.width = "";
imgElement.style.height = rangeHeightElement.value + "vh";
rangeHeightElement.parentElement.setAttribute("aria-label", `${rangeHeightElement.value}%`);
@ -1825,7 +1825,7 @@ const genImageWidthMenu = (label: string, imgElement: HTMLElement, protyle: IPro
label,
click() {
nodeElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));
img3115(imgElement.parentElement.parentElement);
img3115(imgElement.parentElement.parentElement)
imgElement.parentElement.style.width = label === window.siyuan.languages.default ? "" : label;
imgElement.style.height = "";
updateTransaction(protyle, id, nodeElement.outerHTML, html);
@ -1841,7 +1841,7 @@ const genImageHeightMenu = (label: string, imgElement: HTMLElement, protyle: IPr
click() {
nodeElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));
imgElement.style.height = label === window.siyuan.languages.default ? "" : parseInt(label) + "vh";
img3115(imgElement.parentElement.parentElement);
img3115(imgElement.parentElement.parentElement)
imgElement.parentElement.style.width = "";
updateTransaction(protyle, id, nodeElement.outerHTML, html);
focusBlock(nodeElement);

View file

@ -20,7 +20,7 @@ import {openMobileFileById} from "../mobile/editor";
import {lockScreen, exitSiYuan} from "../dialog/processSystem";
import {Model} from "../layout/Model";
import {getDockByType} from "../layout/tabUtil";
import {getAllEditor, getAllModels} from "../layout/getAll";
import {getAllEditor} from "../layout/getAll";
let openTab;
let openWindow;
@ -198,6 +198,5 @@ export const API = {
Menu,
Setting,
getAllEditor,
getAllModels,
platformUtils
};

View file

@ -440,12 +440,6 @@ export const hintRef = (key: string, protyle: IProtyle, source: THintSource): IH
let value = `<span data-type="block-ref" data-id="${item.id}" data-subtype="d">${item.name || item.refText.replace(new RegExp(Constants.ZWSP, "g"), "")}</span>`;
if (source === "search") {
value = `<span data-type="block-ref" data-id="${item.id}" data-subtype="s">${key}${Constants.ZWSP}${item.name || item.refText.replace(new RegExp(Constants.ZWSP, "g"), "")}</span>`;
} else if (source === "av") {
let refText = item.name || item.refText.replace(new RegExp(Constants.ZWSP, "g"), "");
if (nodeElement) {
refText = item.ial["custom-sy-av-s-text-" + nodeElement.getAttribute("data-av-id")] || refText;
}
value = `<span data-type="block-ref" data-id="${item.id}" data-subtype="s">${refText}</span>`;
}
dataList.push({
value,

View file

@ -339,11 +339,7 @@ ${unicode2Emoji(emoji.unicode)}</button>`;
let blockRefHTML;
if (source === "av") {
// av 搜索时需要获取值 https://github.com/siyuan-note/siyuan/issues/12020
let refText = item.name || item.refText.replace(new RegExp(Constants.ZWSP, "g"), "");
if (nodeElement) {
refText = item.ial["custom-sy-av-s-text-" + nodeElement.getAttribute("data-av-id")] || refText;
}
blockRefHTML = `<span data-type="block-ref" data-id="${item.id}" data-subtype="s">${refText}</span>`;
blockRefHTML = `<span data-type="block-ref" data-id="${item.id}" data-subtype="s">${item.name || item.refText.replace(new RegExp(Constants.ZWSP, "g"), "")}</span>`;
} else {
blockRefHTML = `<span data-type="block-ref" data-id="${item.id}" data-subtype="s">${oldValue}</span>`;
}

View file

@ -214,7 +214,7 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEle
}
const cellType = getTypeByCellElement(target);
// TODO 点击单元格的时候, lineNumber 选中整行
if (cellType === "updated" || cellType === "created" || cellType === "lineNumber") {
if (cellType === "updated" || cellType === "created" || cellType === "lineNumber" || (cellType === "block" && !target.getAttribute("data-detached"))) {
selectRow(rowElement.querySelector(".av__firstcol"), "toggle");
} else {
scrollElement.querySelectorAll(".av__row--select").forEach(item => {
@ -329,7 +329,7 @@ export const avContextmenu = (protyle: IProtyle, rowElement: HTMLElement, positi
id: "copyBlockRef",
iconHTML: "",
label: window.siyuan.languages.copyBlockRef,
click: () => {
click: async () => {
let text = "";
for (let i = 0; i < ids.length; i++) {
const id = ids[i];
@ -338,7 +338,8 @@ export const avContextmenu = (protyle: IProtyle, rowElement: HTMLElement, positi
if (cellElement.getAttribute("data-detached") === "true") {
content = cellElement.querySelector(".av__celltext").textContent;
} else {
content = `((${id} '${cellElement.querySelector(".av__celltext").textContent}'))`;
const response = await fetchSyncPost("/api/block/getRefText", {id});
content = `((${id} '${response.data}'))`;
}
if (ids.length > 1) {
text += "* ";
@ -398,7 +399,7 @@ export const avContextmenu = (protyle: IProtyle, rowElement: HTMLElement, positi
id: "copyProtocolInMd",
iconHTML: "",
label: window.siyuan.languages.copyProtocolInMd,
click: () => {
click: async () => {
let text = "";
for (let i = 0; i < ids.length; i++) {
const id = ids[i];
@ -407,7 +408,8 @@ export const avContextmenu = (protyle: IProtyle, rowElement: HTMLElement, positi
if (cellElement.getAttribute("data-detached") === "true") {
content = cellElement.querySelector(".av__celltext").textContent;
} else {
content = `[${cellElement.querySelector(".av__celltext").textContent}](siyuan://blocks/${id})`;
const response = await fetchSyncPost("/api/block/getRefText", {id});
content = `[${response.data}](siyuan://blocks/${id})`;
}
if (ids.length > 1) {
text += "* ";
@ -582,9 +584,18 @@ ${window.siyuan.languages.insertRowAfter.replace("${x}", `<span class="fn__space
});
const editAttrSubmenu: IMenu[] = [];
rowElement.parentElement.querySelectorAll(".av__row--header .av__cell").forEach((cellElement: HTMLElement) => {
let hideBlock = false;
const selectElements: HTMLElement[] = Array.from(blockElement.querySelectorAll(`.av__row--select:not(.av__row--header) .av__cell[data-col-id="${cellElement.dataset.colId}"]`));
if (cellElement.dataset.dtype === "block") {
selectElements.find(item => {
if (!item.dataset.detached) {
hideBlock = true;
return true;
}
});
}
const type = cellElement.getAttribute("data-dtype") as TAVCol;
if (!["updated", "created"].includes(type)) {
if (!hideBlock && !["updated", "created"].includes(type)) {
const icon = cellElement.dataset.icon;
editAttrSubmenu.push({
iconHTML: icon ? unicode2Emoji(icon, "b3-menu__icon", true) : `<svg class="b3-menu__icon"><use xlink:href="#${getColIconByType(type)}"></use></svg>`,

View file

@ -61,7 +61,7 @@ export const genAVValueHTML = (value: IAVCellValue) => {
let html = "";
switch (value.type) {
case "block":
html = `<input value="${value.block.content}" type="text" class="b3-text-field b3-text-field--text fn__flex-1" placeholder="${window.siyuan.languages.empty}">`;
html = `<div class="fn__flex-1" placeholder="${window.siyuan.languages.empty}">${value.block.content}</div>`;
break;
case "text":
html = `<textarea style="resize: vertical" rows="${value.text.content.split("\n").length}" class="b3-text-field b3-text-field--text fn__flex-1" placeholder="${window.siyuan.languages.empty}">${value.text.content}</textarea>`;
@ -198,7 +198,7 @@ export const renderAVAttribute = (element: HTMLElement, id: string, protyle: IPr
<div data-av-id="${table.avID}" data-col-id="${item.values[0].keyID}" data-block-id="${item.values[0].blockID}" data-id="${item.values[0].id}" data-type="${item.values[0].type}"
data-options="${item.key?.options ? escapeAttr(JSON.stringify(item.key.options)) : "[]"}"
${["text", "number", "date", "url", "phone", "template", "email"].includes(item.values[0].type) ? "" : `placeholder="${window.siyuan.languages.empty}"`}
class="fn__flex-1 fn__flex${["url", "text", "number", "email", "phone", "block"].includes(item.values[0].type) ? "" : " custom-attr__avvalue"}${["created", "updated"].includes(item.values[0].type) ? " custom-attr__avvalue--readonly" : ""}">${genAVValueHTML(item.values[0])}</div>
class="fn__flex-1 fn__flex${["url", "text", "number", "email", "phone"].includes(item.values[0].type) ? "" : " custom-attr__avvalue"}${["block", "created", "updated"].includes(item.values[0].type) ? " custom-attr__avvalue--readonly" : ""}">${genAVValueHTML(item.values[0])}</div>
</div>`;
});
innerHTML += `<div class="fn__hr"></div>
@ -412,14 +412,6 @@ class="fn__flex-1 fn__flex${["url", "text", "number", "email", "phone", "block"]
}
};
}
} else if (type === "block") {
value = {
block: {
content: item.value,
id: item.parentElement.dataset.blockId,
},
isDetached: false
};
}
fetchPost("/api/av/setAttributeViewBlockAttr", {
avID: item.parentElement.dataset.avId,
@ -429,8 +421,6 @@ class="fn__flex-1 fn__flex${["url", "text", "number", "email", "phone", "block"]
}, (setResponse) => {
if (type === "number") {
item.parentElement.querySelector(".fn__flex-center").textContent = setResponse.data.value.number.formattedContent;
} else if (type === "block" && !item.value) {
item.value = setResponse.data.value.block.content;
}
});
});

View file

@ -78,9 +78,6 @@ export const genCellValueByElement = (colType: TAVCol, cellElement: HTMLElement)
};
if (colType === "block" && textElement.dataset.id) {
cellValue.block.id = textElement.dataset.id;
if (textElement.previousElementSibling?.classList.contains("b3-menu__avemoji")) {
cellValue.block.icon = textElement.previousElementSibling.getAttribute("data-unicode");
}
}
} else if (colType === "mSelect" || colType === "select") {
const mSelect: IAVCellSelectValue[] = [];
@ -278,11 +275,7 @@ export const genCellValue = (colType: TAVCol, value: string | any) => {
}
}
if (colType === "block") {
if (typeof value === "object" && value.id) {
cellValue.isDetached = false;
} else {
cellValue.isDetached = true;
}
cellValue.isDetached = true;
}
return cellValue;
};
@ -372,6 +365,9 @@ export const popTextCell = (protyle: IProtyle, cellElements: HTMLElement[], type
if (type === "updated" || type === "created" || document.querySelector(".av__mask")) {
return;
}
if (type === "block" && (cellElements.length > 1 || !cellElements[0].getAttribute("data-detached"))) {
return;
}
const blockElement = hasClosestBlock(cellElements[0]);
if (!blockElement) {
return;
@ -395,7 +391,7 @@ export const popTextCell = (protyle: IProtyle, cellElements: HTMLElement[], type
}
if (["text", "email", "phone", "block", "template"].includes(type)) {
html = `<textarea ${style} spellcheck="false" class="b3-text-field">${cellElements[0].querySelector(".av__celltext").textContent}</textarea>`;
html = `<textarea ${style} spellcheck="false" class="b3-text-field">${cellElements[0].firstElementChild.textContent}</textarea>`;
} else if (type === "url") {
html = `<textarea ${style} spellcheck="false" class="b3-text-field">${cellElements[0].firstElementChild.getAttribute("data-href")}</textarea>`;
} else if (type === "number") {
@ -692,12 +688,6 @@ export const updateCellsValue = (protyle: IProtyle, nodeElement: HTMLElement, va
});
newValue = oldValue.mSelect.concat(newMSelectValue);
}
} else if (type === "block" && typeof value === "string" && oldValue.block.id) {
newValue = {
content: value,
id: oldValue.block.id,
icon: oldValue.block.icon
};
}
const cellValue = genCellValue(type, newValue);
cellValue.id = cellId;
@ -713,16 +703,26 @@ export const updateCellsValue = (protyle: IProtyle, nodeElement: HTMLElement, va
if (objEquals(cellValue, oldValue)) {
return;
}
doOperations.push({
action: "updateAttrViewCell",
id: cellId,
avID,
keyID: colId,
rowID,
data: cellValue
});
if (type === "block" && !item.dataset.detached) {
const newId = Lute.NewNodeID();
doOperations.push({
action: "unbindAttrViewBlock",
id: rowID,
nextID: newId,
avID,
});
rowElement.dataset.id = newId;
item.dataset.blockId = newId;
} else {
doOperations.push({
action: "updateAttrViewCell",
id: cellId,
avID,
keyID: colId,
rowID,
data: cellValue
});
}
undoOperations.push({
action: "updateAttrViewCell",
id: cellId,
@ -790,7 +790,7 @@ export const renderCell = (cellValue: IAVCellValue, rowIndex = 0) => {
if (cellValue?.isDetached) {
text = `<span class="av__celltext">${cellValue.block.content || ""}</span><span class="b3-chip b3-chip--info b3-chip--small" data-type="block-more">${window.siyuan.languages.more}</span>`;
} else {
text = `${cellValue.block.icon ? `<span class="b3-menu__avemoji" data-unicode="${cellValue.block.icon}">${unicode2Emoji(cellValue.block.icon)}</span>` : ""}<span data-type="block-ref" data-id="${cellValue.block.id}" data-subtype="s" class="av__celltext av__celltext--ref">${cellValue.block.content}</span><span class="b3-chip b3-chip--info b3-chip--small" data-type="block-more">${window.siyuan.languages.update}</span>`;
text = `${cellValue.block.icon ? `<span class="b3-menu__avemoji">${unicode2Emoji(cellValue.block.icon)}</span>` : ""}<span data-type="block-ref" data-id="${cellValue.block.id}" data-subtype="s" class="av__celltext av__celltext--ref">${cellValue.block.content || window.siyuan.languages.untitled}</span><span class="b3-chip b3-chip--info b3-chip--small" data-type="block-more">${window.siyuan.languages.update}</span>`;
}
} else if (cellValue.type === "number") {
text = `<span class="av__celltext" data-content="${cellValue?.number.isNotEmpty ? cellValue?.number.content : ""}">${cellValue?.number.formattedContent || cellValue?.number.content || ""}</span>`;
@ -878,7 +878,7 @@ const renderRollup = (cellValue: IAVCellValue) => {
if (cellValue?.isDetached) {
text = `<span class="av__celltext" data-id="${cellValue.block?.id}">${cellValue.block?.content || window.siyuan.languages.untitled}</span>`;
} else {
text = `${cellValue.block.icon ? `<span class="b3-menu__avemoji" data-unicode="${cellValue.block.icon}">${unicode2Emoji(cellValue.block.icon)}</span>` : ""}<span data-type="block-ref" data-id="${cellValue.block?.id}" data-subtype="s" class="av__celltext av__celltext--ref">${cellValue.block?.content || window.siyuan.languages.untitled}</span>`;
text = `${cellValue.block.icon ? `<span class="b3-menu__avemoji">${unicode2Emoji(cellValue.block.icon)}</span>` : ""}<span data-type="block-ref" data-id="${cellValue.block?.id}" data-subtype="s" class="av__celltext av__celltext--ref">${cellValue.block?.content || window.siyuan.languages.untitled}</span>`;
}
} else if (cellValue.type === "number") {
text = cellValue?.number.formattedContent || cellValue?.number.content.toString() || "";

View file

@ -1006,7 +1006,7 @@ export const showColMenu = (protyle: IProtyle, blockElement: Element, cellElemen
target = target.parentElement;
}
});
dialog.element.querySelector("button").focus();
dialog.element.querySelector("button").focus()
dialog.element.setAttribute("data-key", Constants.DIALOG_CONFIRM);
return;
}

View file

@ -186,52 +186,28 @@ const processAV = (range: Range, html: string, protyle: IProtyle, blockElement:
}
const text = protyle.lute.BlockDOM2Content(html);
const cellElements: HTMLElement[] = Array.from(blockElement.querySelectorAll(".av__cell--active, .av__cell--select"));
const rowsElement = blockElement.querySelectorAll(".av__row--select");
const cellsElement: HTMLElement[] = Array.from(blockElement.querySelectorAll(".av__cell--active, .av__cell--select"));
const rowsElement = blockElement.querySelector(".av__row--select");
const textJSON: string[][] = [];
text.split("\n").forEach(row => {
textJSON.push(row.split("\t"));
});
if (rowsElement && textJSON.length === 1 && textJSON[0].length === 1) {
updateCellsValue(protyle, blockElement as HTMLElement, text, undefined, columns, html);
return;
}
if (rowsElement) {
rowsElement.forEach(rowElement => {
rowElement.querySelectorAll(".av__cell").forEach((cellElement: HTMLElement) => {
cellElements.push(cellElement);
});
});
}
if (cellElements.length > 0) {
if (textJSON.length === 1 && textJSON[0].length === 1) {
updateCellsValue(protyle, blockElement as HTMLElement, text, cellElements, columns, html);
} else {
let currentRowElement:Element;
const firstColIndex = cellElements[0].getAttribute("data-col-id");
textJSON.forEach((rowValue, rowIndex) => {
if (!currentRowElement) {
currentRowElement = cellElements[0].parentElement;
} else {
currentRowElement = currentRowElement.nextElementSibling;
updateCellsValue(protyle, blockElement as HTMLElement, text, undefined, columns, html);
} else if (cellsElement.length > 0) {
if (cellsElement.length > 1) {
// 选择多个单元格时,逐行填充
let rowIndex = 0;
text.split("\n").find((row) => {
if (!row) {
return false;
}
if (!currentRowElement.classList.contains("av__row")) {
if (cellsElement[rowIndex]) {
updateCellsValue(protyle, blockElement as HTMLElement, row.trim(), [cellsElement[rowIndex]], columns, html);
rowIndex++;
} else {
return true;
}
let cellElement: HTMLElement;
rowValue.forEach((cellValue, cellIndex) => {
if (!cellElement) {
cellElement = currentRowElement.querySelector(`.av__cell[data-col-id="${firstColIndex}"]`) as HTMLElement;
} else {
cellElement = cellElement.nextElementSibling as HTMLElement;
}
if (!cellElement.classList.contains("av__cell")) {
return true;
}
updateCellsValue(protyle, blockElement as HTMLElement, cellValue, [cellElement], columns, html);
});
});
} else {
updateCellsValue(protyle, blockElement as HTMLElement, text, cellsElement, columns, html);
}
document.querySelector(".av__panel")?.remove();
} else if (hasClosestByClassName(range.startContainer, "av__title")) {

View file

@ -671,9 +671,9 @@ export class WYSIWYG {
const dragWidth = dragElement.clientWidth;
const dragHeight = dragElement.clientHeight;
const imgElement = dragElement.parentElement.parentElement;
const imgElement = dragElement.parentElement.parentElement
if (dragElement.tagName === "IMG") {
img3115(imgElement);
img3115(imgElement)
}
documentSelf.onmousemove = (moveEvent: MouseEvent) => {
if (dragElement.tagName === "IMG") {

View file

@ -1814,11 +1814,5 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
if (isNotCtrl(event) && event.key !== "Backspace" && event.key !== "Escape" && event.key !== "Delete" && !event.shiftKey && !event.altKey && event.key !== "Enter") {
hideElements(["select"], protyle);
}
if (matchHotKey("⌘B", event) || matchHotKey("⌘I", event) || matchHotKey("⌘U", event)) {
event.preventDefault();
event.stopPropagation();
return;
}
});
};

View file

@ -57,9 +57,6 @@ func statAsset(c *gin.Context) {
if strings.Contains(p, ":") {
p = strings.TrimPrefix(p, "/")
}
if strings.Contains(p, "?") {
p = p[:strings.Index(p, "?")]
}
} else {
ret.Code = 1
return

View file

@ -56,7 +56,7 @@ require (
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06
github.com/sashabaranov/go-openai v1.29.1
github.com/shirou/gopsutil/v3 v3.24.5
github.com/siyuan-note/dejavu v0.0.0-20241224022945-205805f4607e
github.com/siyuan-note/dejavu v0.0.0-20241220041421-b6410d912871
github.com/siyuan-note/encryption v0.0.0-20231219001248-1e028a4d13b4
github.com/siyuan-note/eventbus v0.0.0-20240627125516-396fdb0f0f97
github.com/siyuan-note/filelock v0.0.0-20241212013445-c66518cdacfa

View file

@ -365,8 +365,8 @@ github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+D
github.com/shurcooL/gofontwoff v0.0.0-20181114050219-180f79e6909d h1:lvCTyBbr36+tqMccdGMwuEU+hjux/zL6xSmf5S9ITaA=
github.com/shurcooL/gofontwoff v0.0.0-20181114050219-180f79e6909d/go.mod h1:05UtEgK5zq39gLST6uB0cf3NEHjETfB4Fgr3Gx5R9Vw=
github.com/simplereach/timeutils v1.2.0/go.mod h1:VVbQDfN/FHRZa1LSqcwo4kNZ62OOyqLLGQKYB3pB0Q8=
github.com/siyuan-note/dejavu v0.0.0-20241224022945-205805f4607e h1:JGxds4l/UUyYSmsuJNSjafs0WfcvOziTt5rhZOlXa34=
github.com/siyuan-note/dejavu v0.0.0-20241224022945-205805f4607e/go.mod h1:+gaHpNFsoVagw956l456Cm4eZclB/gXsjkW4YmvWmJM=
github.com/siyuan-note/dejavu v0.0.0-20241220041421-b6410d912871 h1:U65kVBfF0+PYdlJ1btDxhIfuUElmz7iRbtu3yyyIo8w=
github.com/siyuan-note/dejavu v0.0.0-20241220041421-b6410d912871/go.mod h1:YtT05UDgrYO5Cb/aWc2COwqId56n6qHP+jptvITAags=
github.com/siyuan-note/encryption v0.0.0-20231219001248-1e028a4d13b4 h1:kJaw5L/evyW6LcB9IQT8PR4ppx8JVqOFP9Ix3rfwSrc=
github.com/siyuan-note/encryption v0.0.0-20231219001248-1e028a4d13b4/go.mod h1:UYcCCY+0wh+GmUoDOaO63j1sV5lgy7laLAk1XhEiUis=
github.com/siyuan-note/eventbus v0.0.0-20240627125516-396fdb0f0f97 h1:lM5v8BfNtbOL5jYwhCdMYBcYtr06IYBKjjSLAPMKTM8=

View file

@ -65,8 +65,6 @@ func InitAppearance() {
}
Conf.Save()
util.InitEmojiChars()
}
func containTheme(name string, themes []*conf.AppearanceTheme) bool {

View file

@ -116,9 +116,6 @@ func NetAssets2LocalAssets(rootID string, onlyImg bool, originalURL string) (err
if strings.Contains(u, ":") {
u = strings.TrimPrefix(u, "/")
}
if strings.Contains(u, "?") {
u = u[:strings.Index(u, "?")]
}
if !gulu.File.IsExist(u) || gulu.File.IsDir(u) {
continue
@ -965,7 +962,7 @@ func MissingAssets() (ret []string) {
func emojisInTree(tree *parse.Tree) (ret []string) {
if icon := tree.Root.IALAttr("icon"); "" != icon {
if !strings.Contains(icon, "://") && !strings.HasPrefix(icon, "api/icon/") && !util.NativeEmojiChars[icon] {
if !strings.Contains(icon, "://") && !strings.HasPrefix(icon, "api/icon/") {
ret = append(ret, "/emojis/"+icon)
}
}

View file

@ -3106,24 +3106,13 @@ func UpdateAttributeViewCell(tx *Transaction, avID, keyID, rowID string, valueDa
unbindBlockAv(tx, avID, oldBoundBlockID)
bindBlockAv(tx, avID, val.BlockID)
} else { // 之前绑定的块和现在绑定的块一样
content := strings.TrimSpace(val.Block.Content)
node, tree, _ := getNodeByBlockID(tx, val.BlockID)
updateStaticText := true
_, blockText := getNodeAvBlockText(node)
if "" == content {
val.Block.Content = blockText
} else {
if blockText == content {
updateStaticText = false
} else {
val.Block.Content = blockText
}
// 设置静态锚文本 Database-bound block primary key supports setting static anchor text https://github.com/siyuan-note/siyuan/issues/10049
node, tree, getErr := getNodeByBlockID(tx, val.BlockID)
if nil != getErr || nil == node {
return
}
if updateStaticText {
// 设置静态锚文本 Database-bound block primary key supports setting static anchor text https://github.com/siyuan-note/siyuan/issues/10049
updateBlockValueStaticText(tx, node, tree, avID, content)
}
updateBlockValueStaticText(node, tree, avID, strings.TrimSpace(val.Block.Content))
}
}
}
@ -3292,18 +3281,14 @@ func bindBlockAv0(tx *Transaction, avID string, node *ast.Node, tree *parse.Tree
return
}
func updateBlockValueStaticText(tx *Transaction, node *ast.Node, tree *parse.Tree, avID, text string) {
if nil == node {
return
}
func updateBlockValueStaticText(node *ast.Node, tree *parse.Tree, avID, text string) {
attrs := parse.IAL2Map(node.KramdownIAL)
attrs[av.NodeAttrViewStaticText+"-"+avID] = text
var err error
if nil != tx {
err = setNodeAttrsWithTx(tx, node, tree, attrs)
if nil != tree {
err = setNodeAttrsWithTx(nil, node, tree, attrs)
} else {
err = setNodeAttrs(node, tree, attrs)
err = setNodeAttrs(node, nil, attrs)
}
if err != nil {
logging.LogWarnf("set node [%s] attrs failed: %s", node.ID, err)

View file

@ -281,12 +281,6 @@ func getNodeAvBlockText(node *ast.Node) (icon, content string) {
} else {
content = getNodeRefText0(node, 1024)
}
content = strings.TrimSpace(content)
if "" == content {
content = Conf.language(105)
}
return
}

View file

@ -154,6 +154,8 @@ func ListNotebooks() (ret []*Box, err error) {
sort.Slice(ret, func(i, j int) bool {
return util.PinYinCompare(ret[j].Name, ret[i].Name)
})
case util.SortModeUpdatedASC:
case util.SortModeUpdatedDESC:
case util.SortModeAlphanumASC:
sort.Slice(ret, func(i, j int) bool {
return util.NaturalCompare(ret[i].Name, ret[j].Name)
@ -164,10 +166,12 @@ func ListNotebooks() (ret []*Box, err error) {
})
case util.SortModeCustom:
sort.Slice(ret, func(i, j int) bool { return ret[i].Sort < ret[j].Sort })
case util.SortModeRefCountASC:
case util.SortModeRefCountDESC:
case util.SortModeCreatedASC:
sort.Slice(ret, func(i, j int) bool { return ret[i].ID < ret[j].ID })
sort.Slice(ret, func(i, j int) bool { return util.NaturalCompare(ret[j].ID, ret[i].ID) })
case util.SortModeCreatedDESC:
sort.Slice(ret, func(i, j int) bool { return ret[i].ID > ret[j].ID })
sort.Slice(ret, func(i, j int) bool { return util.NaturalCompare(ret[j].ID, ret[i].ID) })
}
return
}

View file

@ -610,7 +610,6 @@ func ExportDocx(id, savePath string, removeAssets, merge bool) (fullPath string,
}
defer os.Remove(tmpDir)
name, content := ExportMarkdownHTML(id, tmpDir, true, merge)
content = strings.ReplaceAll(content, " \n", "<br>\n")
tmpDocxPath := filepath.Join(tmpDir, name+".docx")
args := []string{ // pandoc -f html --resource-path=请从这里开始 请从这里开始\index.html -o test.docx
@ -711,12 +710,13 @@ func ExportMarkdownHTML(id, savePath string, docx, merge bool) (name, dom string
}
}
srcs := []string{"stage/build/export", "stage/protyle"}
srcs := []string{"stage/build/export", "stage/build/fonts", "stage/protyle"}
for _, src := range srcs {
from := filepath.Join(util.WorkingDir, src)
to := filepath.Join(savePath, src)
if err := filelock.Copy(from, to); err != nil {
logging.LogWarnf("copy stage from [%s] to [%s] failed: %s", from, savePath, err)
return
}
}
@ -752,6 +752,7 @@ func ExportMarkdownHTML(id, savePath string, docx, merge bool) (name, dom string
to := filepath.Join(savePath, emoji)
if err := filelock.Copy(from, to); err != nil {
logging.LogErrorf("copy emojis from [%s] to [%s] failed: %s", from, to, err)
return
}
}
@ -868,7 +869,7 @@ func ExportHTML(id, savePath string, pdf, image, keepFold, merge bool) (name, do
}
if !pdf && "" != savePath { // 导出 HTML 需要复制静态资源
srcs := []string{"stage/build/export", "stage/protyle"}
srcs := []string{"stage/build/export", "stage/build/fonts", "stage/protyle"}
for _, src := range srcs {
from := filepath.Join(util.WorkingDir, src)
to := filepath.Join(savePath, src)
@ -898,6 +899,7 @@ func ExportHTML(id, savePath string, pdf, image, keepFold, merge bool) (name, do
to := filepath.Join(savePath, "appearance", src)
if err := filelock.Copy(from, to); err != nil {
logging.LogErrorf("copy appearance from [%s] to [%s] failed: %s", from, savePath, err)
return
}
}
@ -908,6 +910,7 @@ func ExportHTML(id, savePath string, pdf, image, keepFold, merge bool) (name, do
to := filepath.Join(savePath, emoji)
if err := filelock.Copy(from, to); err != nil {
logging.LogErrorf("copy emojis from [%s] to [%s] failed: %s", from, to, err)
return
}
}
}

View file

@ -48,11 +48,6 @@ var (
// checkIndex 自动校验数据库索引,仅在数据同步执行完成后执行一次。
func checkIndex() {
checkIndexOnce.Do(func() {
if util.ContainerAndroid == util.Container || util.ContainerIOS == util.Container || util.ContainerHarmony == util.Container {
// 移动端不执行校验 https://ld246.com/article/1734939896061
return
}
logging.LogInfof("start checking index...")
removeDuplicateDatabaseIndex()

View file

@ -1288,13 +1288,14 @@ func bootSyncRepo() (err error) {
isBootSyncing.Store(true)
start := time.Now()
waitGroup := sync.WaitGroup{}
var errs []error
waitGroup.Add(1)
go func() {
defer waitGroup.Done()
start := time.Now()
_, _, indexErr := indexRepoBeforeCloudSync(repo)
if indexErr != nil {
errs = append(errs, indexErr)
@ -1310,8 +1311,6 @@ func bootSyncRepo() (err error) {
isBootSyncing.Store(false)
return
}
logging.LogInfof("boot index repo elapsed [%.2fs]", time.Since(start).Seconds())
}()
var fetchedFiles []*entity.File
@ -1319,7 +1318,6 @@ func bootSyncRepo() (err error) {
go func() {
defer waitGroup.Done()
start := time.Now()
syncContext := map[string]interface{}{eventbus.CtxPushMsg: eventbus.CtxPushMsgToStatusBar}
cloudLatest, getErr := repo.GetCloudLatest(syncContext)
if nil != getErr {
@ -1344,14 +1342,29 @@ func bootSyncRepo() (err error) {
isBootSyncing.Store(false)
return
}
logging.LogInfof("boot get sync cloud files elapsed [%.2fs]", time.Since(start).Seconds())
}()
waitGroup.Wait()
if 0 < len(errs) {
err = errs[0]
return
}
syncingFiles = sync.Map{}
syncingStorages.Store(false)
for _, fetchedFile := range fetchedFiles {
name := path.Base(fetchedFile.Path)
if strings.HasSuffix(name, ".sy") {
id := name[:len(name)-3]
syncingFiles.Store(id, true)
continue
}
if strings.HasPrefix(fetchedFile.Path, "/storage/") {
syncingStorages.Store(true)
}
}
elapsed := time.Since(start)
logging.LogInfof("boot get sync cloud files elapsed [%.2fs]", elapsed.Seconds())
if err != nil {
autoSyncErrCount++
planSyncAfter(fixSyncInterval)
@ -1374,20 +1387,6 @@ func bootSyncRepo() (err error) {
return
}
syncingFiles = sync.Map{}
syncingStorages.Store(false)
for _, fetchedFile := range fetchedFiles {
name := path.Base(fetchedFile.Path)
if strings.HasSuffix(name, ".sy") {
id := name[:len(name)-3]
syncingFiles.Store(id, true)
continue
}
if strings.HasPrefix(fetchedFile.Path, "/storage/") {
syncingStorages.Store(true)
}
}
if 0 < len(fetchedFiles) {
go func() {
_, syncErr := syncRepo(false, false)

View file

@ -214,6 +214,7 @@ func CheckAuth(c *gin.Context) {
// 放过 /appearance/
if strings.HasPrefix(c.Request.RequestURI, "/appearance/") ||
strings.HasPrefix(c.Request.RequestURI, "/stage/build/export/") ||
strings.HasPrefix(c.Request.RequestURI, "/stage/build/fonts/") ||
strings.HasPrefix(c.Request.RequestURI, "/stage/protyle/") {
c.Next()
return

View file

@ -17,13 +17,10 @@
package util
import (
"os"
"path/filepath"
"regexp"
"unicode"
"github.com/88250/gulu"
"github.com/siyuan-note/logging"
)
func ContainsCJK(text string) bool {
@ -68,29 +65,3 @@ func RemoveInvalid(text string) (ret string) {
ret = gulu.Str.RemovePUA(ret)
return
}
var NativeEmojiChars = map[string]bool{}
func InitEmojiChars() {
builtConfPath := filepath.Join(AppearancePath, "emojis", "conf.json")
data, err := os.ReadFile(builtConfPath)
if err != nil {
logging.LogErrorf("read emojis conf.json failed: %s", err)
return
}
var conf []map[string]interface{}
if err = gulu.JSON.UnmarshalJSON(data, &conf); err != nil {
logging.LogErrorf("unmarshal emojis conf.json failed: %s", err)
return
}
for _, emoji := range conf {
items := emoji["items"].([]interface{})
for _, item := range items {
e := item.(map[string]interface{})
NativeEmojiChars[e["unicode"].(string)] = true
}
}
return
}

View file

@ -44,7 +44,7 @@ import (
var Mode = "prod"
const (
Ver = "3.1.17"
Ver = "3.1.16"
IsInsider = false
)