Skip to content

Commit

Permalink
Merge pull request #665 from Hi-Windom/v0.32
Browse files Browse the repository at this point in the history
V0.32
  • Loading branch information
Soltus authored Apr 30, 2024
2 parents 65c99c5 + 19589d6 commit 2c12269
Show file tree
Hide file tree
Showing 29 changed files with 361 additions and 303 deletions.
2 changes: 2 additions & 0 deletions .vscode/Sillot.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@
"YuTengjing.package-manager-enhancer", // 非常好用,前端必备
// Output Colorizer
"IBM.output-colorizer", // log 文件高亮
// Partial Diff
"ryu1kn.partial-diff", // 右键菜单对比命令,很好用
],
"unwantedRecommendations": [
"oderwat.indent-rainbow", // 花里胡哨影响观感
Expand Down
2 changes: 1 addition & 1 deletion _vscode_plugin/Sillot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "sillot",
"displayName": "汐洛 Sillot",
"description": "汐洛(Sillot)孵化自思源笔记(siyuan-note),致力于服务智慧新彖乄。此插件为汐洛官方插件,提供多功能一体化集成。",
"version": "0.1.1600",
"version": "0.1.1610",
"preview": true,
"repository": "https://github.com/Hi-Windom/Sillot",
"publisher": "Hi-Windom",
Expand Down
58 changes: 54 additions & 4 deletions _vscode_plugin/Sillot/snippets/sofill.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,62 @@
{
"等效于 dayjs().format(\"YYYYMMDDHHmmss\")": {
"newDate -> yyyyMMddHHmmss": {
"prefix": [
"formatDate_newDate",
"dayjs().format"
"formatDate_newDate",
"dayjs().format"
],
"body": [
"formatDate(new Date($1), 'yyyyMMddHHmmss')"
],
"description": "等效于 dayjs().format(\"YYYYMMDDHHmmss\")\nformatDate 是 sofill/mid 中的一个代理函数,最终调用 date-fns 库的 format 函数"
"description": "等效于 dayjs().format(\"YYYYMMDDHHmmss\")\tformatDate 是 sofill/mid 中的一个代理函数,最终调用 date-fns 库的 format 函数"
},
"newDate -> yyyy-MM-dd HH:mm:ss": {
"prefix": [
"⏰formatDate_newDate",
"⏰dayjs().format"
],
"body": [
"formatDate(new Date($1), 'yyyy-MM-dd HH:mm:ss')"
],
"description": "等效于 dayjs().format(\"YYYY-MM-DD HH:mm:ss\")\tformatDate 是 sofill/mid 中的一个代理函数,最终调用 date-fns 库的 format 函数"
},
"newDate -> yyyy-MM-dd": {
"prefix": [
"⏰formatDate_newDate",
"⏰dayjs().format"
],
"body": [
"formatDate(new Date($1), 'yyyy-MM-dd')"
],
"description": "等效于 dayjs().format(\"YYYY-MM-DD\")\tformatDate 是 sofill/mid 中的一个代理函数,最终调用 date-fns 库的 format 函数"
},
"numberInt -> yyyyMMddHHmmss": {
"prefix": [
"⏰formatDate_numberInt",
"⏰dayjs().format"
],
"body": [
"formatDate(Number.parseInt($1) * 1000, 'yyyyMMddHHmmss')"
],
"description": "等效于 dayjs(parseInt() * 1000).format(\"YYYYMMDDHHmmss\")\tformatDate 是 sofill/mid 中的一个代理函数,最终调用 date-fns 库的 format 函数"
},
"numberInt -> yyyy-MM-dd HH:mm:ss": {
"prefix": [
"⏰formatDate_numberInt",
"⏰dayjs().format"
],
"body": [
"formatDate(Number.parseInt($1) * 1000, 'yyyy-MM-dd HH:mm:ss')"
],
"description": "等效于 dayjs(parseInt() * 1000).format(\"YYYY-MM-DD HH:mm:ss\")\tformatDate 是 sofill/mid 中的一个代理函数,最终调用 date-fns 库的 format 函数"
},
"numberInt -> yyyy-MM-dd": {
"prefix": [
"⏰formatDate_numberInt",
"⏰dayjs().format"
],
"body": [
"formatDate(Number.parseInt($1) * 1000, 'yyyy-MM-dd')"
],
"description": "等效于 dayjs(parseInt() * 1000).format(\"YYYY-MM-DD\")\tformatDate 是 sofill/mid 中的一个代理函数,最终调用 date-fns 库的 format 函数"
}
}
4 changes: 4 additions & 0 deletions app/appearance/icons/ant/icon.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/appearance/icons/ant/icon.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"name": "ant",
"author": "Vanessa",
"url": "https://github.com/Vanessa219",
"version": "1.31.0"
"version": "1.32.0"
}
6 changes: 6 additions & 0 deletions app/appearance/icons/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ <h2>SiYuan</h2>
</svg>
iconCamera
</div>
<div>
<svg>
<use xlink:href="#iconTerminal"></use>
</svg>
iconTerminal
</div>
<div>
<svg>
<use xlink:href="#iconSoftWrap"></use>
Expand Down
4 changes: 4 additions & 0 deletions app/appearance/icons/material/icon.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/appearance/icons/material/icon.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"name": "material",
"author": "Vanessa",
"url": "https://github.com/Vanessa219",
"version": "1.31.0"
"version": "1.32.0"
}
2 changes: 1 addition & 1 deletion app/changelogs/v3.0.12/v3.0.12.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Below are the detailed changes in this version.
* [Soft newline editing parsing exception](https://github.com/siyuan-note/siyuan/issues/11118)
* [S3/WebDAV data backup failed](https://github.com/siyuan-note/siyuan/issues/11138)
* [Unable to enter title immediately after creating database](https://github.com/siyuan-note/siyuan/issues/11143)
* [Fix the index task of the embedd block](https://github.com/siyuan-note/siyuan/pull/11154)
* [Fix the index task of the embed block](https://github.com/siyuan-note/siyuan/pull/11154)
* [Gutter tip prompt shortcut keys do not follow settings](https://github.com/siyuan-note/siyuan/issues/11161)
* [Marketplace count error](https://github.com/siyuan-note/siyuan/pull/11163)
* [Alt shortcut key conflict](https://github.com/siyuan-note/siyuan/issues/11168)
Expand Down
6 changes: 3 additions & 3 deletions app/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "sillot",
"version": "0.31.2200",
"syv": "3.0.12",
"version": "0.32.1100",
"syv": "3.0.13",
"sypv": "[]",
"description": "Build Your Eternal Digital Garden",
"author": "Hi-Windom",
Expand All @@ -26,7 +26,7 @@
"check:electron": "pnpm install electron@alpha",
"gentpl": "node ./scripts/genTPL.js && echo '危险覆写操作警告:git 提交前请确认'",
"build": "pnpm run gentpl && pnpm run '/build:.*/'",
"docker:build": "pnpm run build:mobile && pnpm run build-docker",
"docker:build": "pnpm run build:export && pnpm run build:desktop && pnpm run build:mobile && pnpm run build-docker",
"build-docker": "webpack --mode production --config webpack.docker.js",
"build:app": "webpack --mode production",
"build:mobile": "webpack --mode production --config webpack.mobile.js",
Expand Down
120 changes: 14 additions & 106 deletions app/src/boot/globalEvent/commandPanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,9 @@ import {Search} from "../../search";
/// #if !MOBILE
import {Custom} from "../../layout/dock/Custom";
import {getAllModels} from "../../layout/getAll";
import {openSearchAV} from "../../protyle/render/av/relation";
import {transaction} from "../../protyle/wysiwyg/transaction";
import {focusByRange} from "../../protyle/util/selection";
import {hasClosestBlock, hasClosestByClassName} from "../../protyle/util/hasClosest";
// import * as dayjs from "dayjs";
import { formatDate } from "sofill/mid";
import {hasClosestByClassName} from "../../protyle/util/hasClosest";
import type {Files} from "../../layout/dock/Files";
import {addEditorToDatabase, addFilesToDatabase} from "../../protyle/render/av/addToDatabase";
/// #endif

export const commandPanel = (app: App) => {
Expand All @@ -41,14 +37,16 @@ export const commandPanel = (app: App) => {
dialog.element.setAttribute("data-key", Constants.DIALOG_COMMANDPANEL);
const listElement = dialog.element.querySelector("#commands");
/// #if !MOBILE
// let html = ""
// Object.keys(window.siyuan.config.keymap.general).forEach((key) => {
// html += `<li class="b3-list-item" data-command="${key}">
// <span class="b3-list-item__text">${window.siyuan.languages[key]}</span>
// <span class="b3-list-item__meta${isMobile() ? " fn__none" : ""}">${updateHotkeyTip(window.siyuan.config.keymap.general[key].custom)}</span>
// </li>`;
// });
// listElement.insertAdjacentHTML("beforeend", html);
let html = ""
Object.keys(window.siyuan.config.keymap.general).forEach((key) => {
if (["addToDatabase"].includes(key)) {
html += `<li class="b3-list-item" data-command="${key}">
<span class="b3-list-item__text">${window.siyuan.languages[key]}</span>
<span class="b3-list-item__meta${isMobile() ? " fn__none" : ""}">${updateHotkeyTip(window.siyuan.config.keymap.general[key].custom)}</span>
</li>`;
}
});
listElement.insertAdjacentHTML("beforeend", html);
/// #endif
app.plugins.forEach(plugin => {
plugin.commands.forEach(command => {
Expand Down Expand Up @@ -257,99 +255,9 @@ export const execByCommand = (options: {
switch (options.command) {
case "addToDatabase":
if (!isFileFocus) {
if (protyle.title?.editElement.contains(range.startContainer)) {
openSearchAV("", protyle.breadcrumb.element, (listItemElement) => {
const avID = listItemElement.dataset.avId;
transaction(protyle, [{
action: "insertAttrViewBlock",
avID,
ignoreFillFilter: true,
srcs: [{
id: protyle.block.rootID,
isDetached: false
}],
blockID: listItemElement.dataset.blockId
}, {
action: "doUpdateUpdated",
id: listItemElement.dataset.blockId,
data: formatDate(new Date(), 'yyyyMMddHHmmss'),
}], [{
action: "removeAttrViewBlock",
srcIDs: [protyle.block.rootID],
avID,
}]);
focusByRange(range);
});
} else {
const selectElement: Element[] = [];
protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select").forEach(item => {
selectElement.push(item);
});
if (selectElement.length === 0) {
const nodeElement = hasClosestBlock(range.startContainer);
if (nodeElement) {
selectElement.push(nodeElement);
}
}
if (selectElement.length === 0) {
return;
}
openSearchAV("", selectElement[0] as HTMLElement, (listItemElement) => {
const srcIDs: string[] = [];
const srcs: IOperationSrcs[] = [];
selectElement.forEach(item => {
srcIDs.push(item.getAttribute("data-node-id"));
srcs.push({
id: item.getAttribute("data-node-id"),
isDetached: false
});
});
const avID = listItemElement.dataset.avId;
transaction(protyle, [{
action: "insertAttrViewBlock",
avID,
ignoreFillFilter: true,
srcs,
blockID: listItemElement.dataset.blockId
}, {
action: "doUpdateUpdated",
id: listItemElement.dataset.blockId,
data: formatDate(new Date(), 'yyyyMMddHHmmss'),
}], [{
action: "removeAttrViewBlock",
srcIDs,
avID,
}]);
focusByRange(range);
});
}
addEditorToDatabase(protyle, range);
} else {
const srcs: IOperationSrcs[] = [];
fileLiElements.forEach(item => {
const id = item.getAttribute("data-node-id");
if (id) {
srcs.push({
id,
isDetached: false
});
}
});
if (srcs.length > 0) {
openSearchAV("", fileLiElements[0] as HTMLElement, (listItemElement) => {
const avID = listItemElement.dataset.avId;
transaction(undefined, [{
action: "insertAttrViewBlock",
avID,
ignoreFillFilter: true,
srcs,
blockID: listItemElement.dataset.blockId
}, {
action: "doUpdateUpdated",
id: listItemElement.dataset.blockId,
data: formatDate(new Date(), 'yyyyMMddHHmmss'),
}]);
});
}
addFilesToDatabase(fileLiElements);
}
break;
}
Expand Down
12 changes: 12 additions & 0 deletions app/src/boot/onGetConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,27 +32,33 @@ import {checkFold} from "../util/noRelyPCFunction";
const matchKeymap = (keymap: Config.IKeys, key1: "general" | "editor", key2?: "general" | "insert" | "heading" | "list" | "table") => {
if (key1 === "general") {
if (!window.siyuan.config.keymap[key1]) {
/// #if !BROWSER
ipcRenderer.send(Constants.SIYUAN_CMD, {
cmd: "writeLog",
msg: "window.siyuan.config.keymap.general is not found"
});
/// #endif
window.siyuan.config.keymap[key1] = keymap as Config.IKeymapGeneral;
return false;
}
} else {
if (!window.siyuan.config.keymap[key1]) {
/// #if !BROWSER
ipcRenderer.send(Constants.SIYUAN_CMD, {
cmd: "writeLog",
msg: "window.siyuan.config.keymap.editor is not found"
});
/// #endif
window.siyuan.config.keymap[key1] = JSON.parse(JSON.stringify(Constants.SIYUAN_KEYMAP.editor));
return false;
}
if (!window.siyuan.config.keymap[key1][key2]) {
/// #if !BROWSER
ipcRenderer.send(Constants.SIYUAN_CMD, {
cmd: "writeLog",
msg: `window.siyuan.config.keymap.editor.${key2} is not found`
});
/// #endif
(window.siyuan.config.keymap[key1][key2] as Config.IKeymapEditor[typeof key2]) = keymap as Config.IKeymapEditor[typeof key2];
return false;
}
Expand All @@ -61,19 +67,23 @@ const matchKeymap = (keymap: Config.IKeys, key1: "general" | "editor", key2?: "g
Object.keys(keymap).forEach(key => {
if (key1 === "general") {
if (!window.siyuan.config.keymap[key1][key] || window.siyuan.config.keymap[key1][key].default !== keymap[key].default) {
/// #if !BROWSER
ipcRenderer.send(Constants.SIYUAN_CMD, {
cmd: "writeLog",
msg: `window.siyuan.config.keymap.${key1}.${key} is not found or match: ${window.siyuan.config.keymap[key1][key]?.default}`
});
/// #endif
match = false;
window.siyuan.config.keymap[key1][key] = keymap[key];
}
} else {
if (!window.siyuan.config.keymap[key1][key2][key] || window.siyuan.config.keymap[key1][key2][key].default !== keymap[key].default) {
/// #if !BROWSER
ipcRenderer.send(Constants.SIYUAN_CMD, {
cmd: "writeLog",
msg: `window.siyuan.config.keymap.${key1}.${key2}.${key} is not found or match: ${window.siyuan.config.keymap[key1][key2][key]?.default}`
});
/// #endif
match = false;
window.siyuan.config.keymap[key1][key2][key] = keymap[key];
}
Expand Down Expand Up @@ -123,10 +133,12 @@ export const onGetConfig = (isStart: boolean, app: App) => {
if (!window.siyuan.config.readonly &&
(!matchKeymap1 || !matchKeymap2 || !matchKeymap3 || !matchKeymap4 || !matchKeymap5 || !matchKeymap6 ||
!hasKeymap1 || !hasKeymap2 || !hasKeymap3 || !hasKeymap4 || !hasKeymap5 || !hasKeymap6)) {
/// #if !BROWSER
ipcRenderer.send(Constants.SIYUAN_CMD, {
cmd: "writeLog",
msg: "update keymap"
});
/// #endif
fetchPost("/api/setting/setKeymap", {
data: window.siyuan.config.keymap
}, () => {
Expand Down
4 changes: 0 additions & 4 deletions app/src/layout/dock/Files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -360,10 +360,6 @@ export class Files extends Model {
}
target = target.parentElement;
}
} else {
this.element.querySelectorAll(".b3-list-item--focus").forEach((item: HTMLElement) => {
item.classList.remove("b3-list-item--focus");
});
}
if (needFocus) {
setPanelFocus(this.element.parentElement);
Expand Down
Loading

0 comments on commit 2c12269

Please sign in to comment.