Skip to content

Commit

Permalink
Merge pull request #857 from Hi-Windom/v0.35
Browse files Browse the repository at this point in the history
V0.35
  • Loading branch information
Soltus authored Jul 6, 2024
2 parents 93fd962 + e016235 commit b566355
Show file tree
Hide file tree
Showing 25 changed files with 63 additions and 46 deletions.
2 changes: 1 addition & 1 deletion .vscode/extensions/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 T☳Converbenk Matrix)为智慧新彖务服务。此插件为汐洛官方插件,提供多功能一体化集成。",
"version": "0.35.24070523",
"version": "0.35.24070622",
"preview": true,
"repository": "https://github.com/Hi-Windom/Sillot",
"publisher": "Hi-Windom",
Expand Down
2 changes: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sillot",
"version": "0.35.24070523",
"version": "0.35.24070622",
"syv": "3.1.0",
"sypv": "[3.0.16, 3.0.17]",
"description": "Build Your Eternal Digital Garden",
Expand Down
2 changes: 1 addition & 1 deletion app/src/ai/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ export const AIActions = (elements: Element[], protyle: IProtyle) => {
let target = event.target as HTMLElement;
while (target && !target.isSameNode(element)) {
if (target.classList.contains("b3-list-item__action")) {
const subItem = window.siyuan.storage[Constants.LOCAL_AI][target.parentElement.dataset.index]
const subItem = window.siyuan.storage[Constants.LOCAL_AI][target.parentElement.dataset.index];
editDialog(subItem.name, subItem.memo);
menu.close();
event.stopPropagation();
Expand Down
2 changes: 1 addition & 1 deletion app/src/block/popover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export const initBlockPopover = (app: App) => {
const hidePopover = (event: MouseEvent & { path: HTMLElement[] }) => {
// window.sout.tracker("invoked"); // 这里调用频繁
// pad 端点击后 event.target 不会更新。
const target = isTouchDevice() ? document.elementFromPoint(event.clientX, event.clientY) : event.target as HTMLElement
const target = isTouchDevice() ? document.elementFromPoint(event.clientX, event.clientY) : event.target as HTMLElement;
if (!target) {
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion app/src/card/openCard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ const emitEvent = (app: App, card: ICard, type: string) => {

export const openCard = (app: App) => {
if (window.siyuan.config.readonly) {
return
return;
}
window.sout.tracker("invoked");
fetchPost("/api/riff/getRiffDueCards", {deckID: ""}, (cardsResponse) => {
Expand Down
4 changes: 2 additions & 2 deletions app/src/dialog/processSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,10 +309,10 @@ export const refreshFileTree = (cb?: () => void) => {
setStorageVal(Constants.LOCAL_FILEPOSITION, window.siyuan.storage[Constants.LOCAL_FILEPOSITION]);
fetchPost("/api/filetree/refreshFiletree", {}, () => {
if (cb) {
cb()
cb();
}
});
}
};

let statusTimeout: number;
export const progressStatus = (data: IWebSocketData) => {
Expand Down
15 changes: 14 additions & 1 deletion app/src/editor/rename.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {getAssetName, getDisplayName, pathPosix, setNotebookName} from "../util/
import {fetchPost} from "../util/fetch";
import {Constants} from "../constants";
import {showTooltip} from "../dialog/tooltip";
import {getAllEditor, getAllModels} from "../layout/getAll";

export const validateName = (name: string, targetElement?: HTMLElement) => {
window.sout.tracker("invoked");
Expand Down Expand Up @@ -137,7 +138,19 @@ export const renameAsset = (assetPath: string) => {
dialog.destroy();
return false;
}
fetchPost("/api/asset/renameAsset", {oldPath: assetPath, newName: inputElement.value});

fetchPost("/api/asset/renameAsset", {oldPath: assetPath, newName: inputElement.value}, (response) => {
getAllModels().asset.forEach(item => {
if (item.path === assetPath) {
item.path = response.data.newPath;
item.parent.updateTitle(getDisplayName(response.data.newPath));
}
});
getAllEditor().forEach(item => {
item.reload(false);
});
dialog.destroy();
});
});
};

Expand Down
2 changes: 1 addition & 1 deletion app/src/emoji/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ export const getEmojiDesc = (emoji: IEmojiItem) => {
return emoji.description_ja_jp;
}
return emoji.description;
}
};


export const getEmojiTitle = (index: number) => {
Expand Down
2 changes: 1 addition & 1 deletion app/src/layout/Tab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export class Tab {
this.headElement.setAttribute("aria-label", escapeGreat(response.data));
});
} else {
this.headElement.setAttribute("aria-label", escapeGreat(options.title));
this.headElement.setAttribute("aria-label", escapeGreat(this.title));
}
});
this.headElement.addEventListener("dragstart", (event: DragEvent & { target: HTMLElement }) => {
Expand Down
6 changes: 3 additions & 3 deletions app/src/layout/dock/Graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -322,11 +322,11 @@ export class Graph extends Model {
this.searchGraph(false, undefined, true);
} else if (dataType === "fullscreen") {
fullscreen(this.element, target);
const minElement = this.element.querySelector('.block__icons .block__icon[data-type="min"]')
const minElement = this.element.querySelector('.block__icons .block__icon[data-type="min"]');
if (this.element.className.includes("fullscreen")) {
minElement.classList.add("fn__none")
minElement.classList.add("fn__none");
} else {
minElement.classList.remove("fn__none")
minElement.classList.remove("fn__none");
}
}
break;
Expand Down
2 changes: 1 addition & 1 deletion app/src/layout/dock/Outline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ export class Outline extends Model {
if ((item.action === "update" || item.action === "insert") &&
(item.data.indexOf('data-type="NodeHeading"') > -1 || item.data.indexOf(`<div contenteditable="true" spellcheck="${window.siyuan.config.editor.spellcheck}"><wbr></div>`) > -1)) {
needReload = true;
return true
return true;
} else if (item.action === "delete" || item.action === "move") {
needReload = true;
return true;
Expand Down
2 changes: 1 addition & 1 deletion app/src/layout/dock/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ export class Dock {
return;
}
// 关系图全屏不应该退出 & https://github.com/siyuan-note/siyuan/issues/11775
const fullscreenElement = this.layout.element.querySelector(".fullscreen")
const fullscreenElement = this.layout.element.querySelector(".fullscreen");
if (fullscreenElement && fullscreenElement.clientHeight > 0) {
return;
}
Expand Down
14 changes: 7 additions & 7 deletions app/src/menus/protyle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ export const contentMenu = (protyle: IProtyle, nodeElement: Element) => {
protyle.toolbar.showContent(protyle, range, nodeElement);
/// #else
const oldHTML = nodeElement.outerHTML;
const id = nodeElement.getAttribute("data-node-id")
const id = nodeElement.getAttribute("data-node-id");
if (range.toString() !== "" || (range.cloneContents().childNodes[0] as HTMLElement)?.classList?.contains("emoji")) {
window.siyuan.menus.menu.append(new MenuItem({
icon: "iconCopy",
Expand Down Expand Up @@ -1642,7 +1642,7 @@ export const inlineMathMenu = (protyle: IProtyle, element: Element) => {
y: rect.top + 26,
h: 26
});
}
};

const genImageWidthMenu = (label: string, assetElement: HTMLElement, imgElement: HTMLElement, protyle: IProtyle, id: string, nodeElement: HTMLElement, html: string) => {
window.sout.tracker("invoked");
Expand Down Expand Up @@ -1888,7 +1888,7 @@ export const tableMenu = (protyle: IProtyle, nodeElement: Element, cellElement:
}
});
const menus: IMenu[] = [];
menus.push(...otherMenus)
menus.push(...otherMenus);
menus.push({
type: "separator"
});
Expand Down Expand Up @@ -1964,7 +1964,7 @@ export const tableMenu = (protyle: IProtyle, nodeElement: Element, cellElement:
return true;
}
});
const insertMenus = []
const insertMenus = [];
insertMenus.push({
icon: "iconBefore",
label: window.siyuan.languages.insertRowAbove,
Expand Down Expand Up @@ -2003,8 +2003,8 @@ export const tableMenu = (protyle: IProtyle, nodeElement: Element, cellElement:
}
});
}
menus.push(...insertMenus)
const other2Menus: IMenu[] = []
menus.push(...insertMenus);
const other2Menus: IMenu[] = [];
if (((!hasNone || (hasNone && !hasRowSpan && hasColSpan)) &&
(!previousHasNone || (previousHasNone && !previousHasRowSpan && previousHasColSpan))) ||
((!hasNone || (hasNone && !hasRowSpan && hasColSpan)) &&
Expand Down Expand Up @@ -2066,7 +2066,7 @@ export const tableMenu = (protyle: IProtyle, nodeElement: Element, cellElement:
type: "separator"
});
}
const removeMenus = []
const removeMenus = [];
if (cellElement.parentElement.parentElement.tagName !== "THEAD" &&
((!hasNone && !hasRowSpan) || (hasNone && !hasRowSpan && hasColSpan))) {
removeMenus.push({
Expand Down
17 changes: 8 additions & 9 deletions app/src/protyle/gutter/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import {focusBlock, focusByRange, getEditorRange} from "../util/selection";
import {hideElements} from "../ui/hideElements";
import {highlightRender} from "../render/highlightRender";
import {blockRender} from "../render/blockRender";
import {removeEmbed} from "../wysiwyg/removeEmbed";
import {getContenteditableElement, getTopAloneElement, isNotEditBlock} from "../wysiwyg/getBlock";
// import * as dayjs from "dayjs";
import {formatDate} from "sofill/mid";
Expand Down Expand Up @@ -97,24 +96,24 @@ export class Gutter {
selectElements.push(item);
});
} else {
const gutterId = buttonElement.getAttribute("data-node-id")
const gutterId = buttonElement.getAttribute("data-node-id");
selectElements = Array.from(protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select"));
let selectedIncludeGutter = false;
selectElements.forEach((item => {
const itemId = item.getAttribute("data-node-id")
const itemId = item.getAttribute("data-node-id");
if (itemId === gutterId) {
selectedIncludeGutter = true
selectedIncludeGutter = true;
}
selectIds.push(itemId);
}))
}));
if (!selectedIncludeGutter) {
const gutterNodeElement = protyle.wysiwyg.element.querySelector(`[data-node-id="${gutterId}"]`)
const gutterNodeElement = protyle.wysiwyg.element.querySelector(`[data-node-id="${gutterId}"]`);
if (gutterNodeElement) {
selectElements.forEach((item => {
item.classList.remove("protyle-wysiwyg--select")
item.classList.remove("protyle-wysiwyg--select");
}));
gutterNodeElement.classList.add("protyle-wysiwyg--select")
selectElements = [gutterNodeElement]
gutterNodeElement.classList.add("protyle-wysiwyg--select");
selectElements = [gutterNodeElement];
selectIds = [gutterId];
}
}
Expand Down
2 changes: 1 addition & 1 deletion app/src/protyle/header/Title.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export class Title {
event.stopPropagation();
}
} else if (event.key === "Enter") {
const editElment = getContenteditableElement(protyle.wysiwyg.element.firstElementChild)
const editElment = getContenteditableElement(protyle.wysiwyg.element.firstElementChild);
if (editElment && editElment.textContent === "" && !protyle.wysiwyg.element.firstElementChild.classList.contains("av")) {
// 配合提示文本使用,避免提示文本挤压到第二个块中
focusBlock(protyle.wysiwyg.element.firstElementChild, protyle.wysiwyg.element);
Expand Down
2 changes: 1 addition & 1 deletion app/src/protyle/render/av/row.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ ${getTypeByCellElement(item) === "block" ? ' data-detached="true"' : ""}><span c
});
let html = "";
srcIDs.forEach((id) => {
const blockCellElement = blockElement.querySelector(`[data-block-id="${id}"]`)
const blockCellElement = blockElement.querySelector(`[data-block-id="${id}"]`);
if (!blockCellElement) {
html += `<div class="av__row" data-type="ghost" data-id="${id}" data-avid="${avId}" data-previous-id="${previousId}">
${colHTML}
Expand Down
2 changes: 1 addition & 1 deletion app/src/protyle/wysiwyg/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@ export class WYSIWYG {
this.element.querySelectorAll("iframe").forEach(item => {
item.style.pointerEvents = "none";
});
const needScroll = ["IMG", "VIDEO", "AUDIO"].includes(target.tagName) || target.classList.contains("img")
const needScroll = ["IMG", "VIDEO", "AUDIO"].includes(target.tagName) || target.classList.contains("img");
documentSelf.onmousemove = (moveEvent: MouseEvent) => {
const moveTarget = moveEvent.target as HTMLElement;
// table cell select
Expand Down
2 changes: 1 addition & 1 deletion app/src/protyle/wysiwyg/keydown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1185,7 +1185,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {

// h1 - h6 hotkey
if (matchHotKey(window.siyuan.config.keymap.editor.heading.paragraph.custom, event)) {
const selectsElement = Array.from(protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select"))
const selectsElement = Array.from(protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select"));
if (selectsElement.length === 0) {
selectsElement.push(nodeElement);
}
Expand Down
2 changes: 1 addition & 1 deletion app/src/protyle/wysiwyg/remove.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ export const removeBlock = (protyle: IProtyle, blockElement: Element, range: Ran
if (previousElement) {
if (previousElement.classList.contains("p") && getContenteditableElement(previousElement).textContent === "") {
// 空块向后删除时移除改块 https://github.com/siyuan-note/siyuan/issues/11732
const ppElement = getPreviousBlock(previousElement)
const ppElement = getPreviousBlock(previousElement);
transaction(protyle, [{
action: "delete",
id: previousElement.getAttribute("data-node-id"),
Expand Down
8 changes: 4 additions & 4 deletions app/src/protyle/wysiwyg/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1155,7 +1155,7 @@ export const transaction = (protyle: IProtyle, doOperations: IOperation[], undoO
});
}
});
})
});
return;
}
if (needDebounce) {
Expand All @@ -1177,10 +1177,10 @@ export const transaction = (protyle: IProtyle, doOperations: IOperation[], undoO
// 插入块后会导致高度变化,从而产生再次定位 https://github.com/siyuan-note/siyuan/issues/11798
doOperations.find(item => {
if (item.action === "insert") {
protyle.observerLoad?.disconnect()
protyle.observerLoad?.disconnect();
return true;
}
})
});
};

const processFold = (operation: IOperation, protyle: IProtyle) => {
Expand Down Expand Up @@ -1236,7 +1236,7 @@ const processFold = (operation: IOperation, protyle: IProtyle) => {
}
return;
}
}
};

export const updateTransaction = (protyle: IProtyle, id: string, newHTML: string, html: string) => {
window.sout.tracker("invoked");
Expand Down
2 changes: 1 addition & 1 deletion docs/starlight/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "starlight",
"type": "module",
"version": "0.35.24070523",
"version": "0.35.24070622",
"scripts": {
"test": "echo 'Test your sister day by day'",
"dev": "astro dev",
Expand Down
5 changes: 4 additions & 1 deletion kernel/api/asset.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,13 +160,16 @@ func renameAsset(c *gin.Context) {

oldPath := arg["oldPath"].(string)
newName := arg["newName"].(string)
err := model.RenameAsset(oldPath, newName)
newPath, err := model.RenameAsset(oldPath, newName)
if nil != err {
ret.Code = -1
ret.Msg = err.Error()
ret.Data = map[string]interface{}{"closeTimeout": 5000}
return
}
ret.Data = map[string]interface{}{
"newPath": newPath,
}
}

func getDocImageAssets(c *gin.Context) {
Expand Down
5 changes: 2 additions & 3 deletions kernel/model/assets.go
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,7 @@ func RemoveUnusedAsset(p string) (ret string) {
return
}

func RenameAsset(oldPath, newName string) (err error) {
func RenameAsset(oldPath, newName string) (newPath string, err error) {
util.PushEndlessProgress(Conf.Language(110))
defer util.PushClearProgress()

Expand All @@ -781,7 +781,7 @@ func RenameAsset(oldPath, newName string) (err error) {
}

newName = util.AssetName(newName + filepath.Ext(oldPath))
newPath := "assets/" + newName
newPath = "assets/" + newName
if err = filelock.Copy(filepath.Join(util.DataDir, oldPath), filepath.Join(util.DataDir, newPath)); nil != err {
logging.LogErrorf("copy asset [%s] failed: %s", oldPath, err)
return
Expand Down Expand Up @@ -842,7 +842,6 @@ func RenameAsset(oldPath, newName string) (err error) {
}

IncSync()
util.ReloadUI()
return
}

Expand Down
3 changes: 3 additions & 0 deletions kernel/treenode/tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ func NodeHash(node *ast.Node, tree *parse.Tree, luteEngine *lute.Lute) string {
}
hpath := tree.HPath
data := tree.Box + tree.Path + hpath + string(ial) + md
if nil != node.Parent {
data += node.Parent.ID
}
return fmt.Sprintf("%x", sha256.Sum256(gulu.Str.ToBytes(data)))[:7]
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Sillot-workspace",
"version": "0.35.24070523",
"version": "0.35.24070622",
"description": "汐洛 pnpm 工作区",
"packageManager": "[email protected]",
"scripts": {
Expand Down

0 comments on commit b566355

Please sign in to comment.