Skip to content

Commit

Permalink
Merge pull request #803 from Hi-Windom/v0.35
Browse files Browse the repository at this point in the history
V0.35
  • Loading branch information
Soltus authored Jun 1, 2024
2 parents 404798d + c79092e commit bcbc2d9
Show file tree
Hide file tree
Showing 15 changed files with 295 additions and 200 deletions.
5 changes: 0 additions & 5 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,6 @@ jobs:
with:
install: p7zip mingw-w64-x86_64-lua

- name: 🔨 Set up TDM-GCC
run: msys2 -c "bash ${{ env.repo_owner }}/${{ env.repo_name }}/scripts/get-tdm-gcc.sh tdm https://github.com/jmeubank/tdm-gcc/releases/download/v10.3.0-tdm-1/tdm-gcc-10.3.0.exe" && echo "CC=${{ github.workspace }}/tdm/bin/gcc.exe" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
if: contains( matrix.config.goarch, '386')
working-directory: ${{ github.workspace }}

- name: 🔨 Set up Go
uses: actions/setup-go@v5
with:
Expand Down
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.2297",
"version": "0.35.2310",
"preview": true,
"repository": "https://github.com/Hi-Windom/Sillot",
"publisher": "Hi-Windom",
Expand Down
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ ENV RUN_IN_CONTAINER=true
EXPOSE 58131
LABEL maintainer="Soltus<[email protected]>"

# 默认值,用户应当修改
ENV SILLOT_ARGS_KERNEL="--accessAuthCode 58131"
ENV SILLOT_ARGS_JUPYTER="--port=8888 --ip=* --no-browser --allow-root"
ENTRYPOINT [ "/tini", "--", "/opt/Sillot/Docker_entry.sh" ]
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.2297",
"version": "0.35.2310",
"syv": "3.1.0",
"sypv": "[3.0.16]",
"description": "Build Your Eternal Digital Garden",
Expand Down
5 changes: 5 additions & 0 deletions app/src/assets/scss/business/_layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,11 @@
border-top: .5px solid var(--b3-border-color);
}

&__items {
min-height: 26px;
min-width: 26px;
}

svg {
height: 14px;
width: 14px;
Expand Down
5 changes: 5 additions & 0 deletions app/src/assets/scss/protyle/_wysiwyg.scss
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,11 @@
background-color: var(--b3-theme-primary-lightest) !important;
}

// https://github.com/siyuan-note/siyuan/issues/11589
.hljs wbr {
display: none;
}

&--hl,
&--hl .hljs {
transition: var(--b3-background-transition);
Expand Down
43 changes: 35 additions & 8 deletions app/src/boot/globalEvent/click.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,40 @@ export const globalClick = (event: MouseEvent & { target: HTMLElement }) => {
window.sout.tracker("invoked");
const ghostElement = document.getElementById("dragGhost");
if (ghostElement) {
const startElement = ghostElement.parentElement.querySelector(`[data-node-id="${ghostElement.getAttribute("data-node-id")}"]`) as HTMLElement;
// biome-ignore lint/suspicious/noAssignInExpressions: <explanation>
startElement ? startElement.style.opacity = "" : "";
ghostElement.parentElement.querySelectorAll(".dragover__top, .dragover__bottom, .dragover").forEach((item: HTMLElement) => {
item.classList.remove("dragover__top", "dragover__bottom", "dragover");
item.style.opacity = "";
});
if (ghostElement.dataset.ghostType === "dock") {
ghostElement.parentElement.querySelectorAll(".dock__item").forEach((item: HTMLElement) => {
item.style.opacity = "";
item.classList.add("b3-tooltips");
});
const original = JSON.parse(ghostElement.getAttribute("data-original"));
let dock
if (original.position === "Left") {
dock = window.siyuan.layout.leftDock;
} else if (original.position === "Right") {
dock = window.siyuan.layout.rightDock;
} else if (original.position === "Bottom") {
dock = window.siyuan.layout.bottomDock;
}
const previousElement = dock.element.querySelector(`.dock__item[data-type="${original.previousType}"]`)
const dockElement = dock.element.querySelector(`.dock__item[data-type="${original.type}"]`)
if (previousElement) {
previousElement.after(dockElement)
} else {
if (original.index === "0") {
dock.element.firstElementChild.prepend(dockElement)
} else {
dock.element.lastElementChild.previousElementSibling.prepend(dockElement)
}
}
} else {
const startElement = ghostElement.parentElement.querySelector(`[data-node-id="${ghostElement.getAttribute("data-node-id")}"]`) as HTMLElement;
// biome-ignore lint/suspicious/noAssignInExpressions: <explanation>
startElement ? startElement.style.opacity = "" : "";
ghostElement.parentElement.querySelectorAll(".dragover__top, .dragover__bottom, .dragover").forEach((item: HTMLElement) => {
item.classList.remove("dragover__top", "dragover__bottom", "dragover");
item.style.opacity = "";
});
}
ghostElement.remove();
}
if (!window.siyuan.menus.menu.element.contains(event.target) && !hasClosestByAttribute(event.target, "data-menu", "true")) {
Expand Down Expand Up @@ -50,7 +77,7 @@ export const globalClick = (event: MouseEvent & { target: HTMLElement }) => {
window.siyuan.layout.rightDock.hideDock();
}

const protyleElement = hasClosestByClassName(event.target, "protyle", true);
const protyleElement = hasClosestByClassName(event.target, "protyle", true);
if (protyleElement) {
const wysiwygElement = protyleElement.querySelector(".protyle-wysiwyg");
if (wysiwygElement.getAttribute("data-readonly") === "true" || !wysiwygElement.contains(event.target)) {
Expand Down
119 changes: 112 additions & 7 deletions app/src/layout/dock/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {Bookmark} from "./Bookmark";
import {Tag} from "./Tag";
import {Graph} from "./Graph";
import type {Model} from "../Model";
import {setPanelFocus} from "../util";
import {saveLayout, setPanelFocus} from "../util";
import {getDockByType, resizeTabs} from "../tabUtil";
import {Inbox} from "./Inbox";
import type {Protyle} from "../../protyle";
Expand Down Expand Up @@ -62,7 +62,7 @@ export class Dock {
}
this.app = options.app;
this.element = document.getElementById("dock" + options.position);
const dockClass = options.position === "Bottom" ? ' class="fn__flex"' : "";
const dockClass = options.position === "Bottom" ? ' class="fn__flex dock__items"' : ' class="dock__items"';
this.element.innerHTML = `<div${dockClass}></div><div class="fn__flex-1"></div><div${dockClass}></div>`;
this.position = options.position;
this.pin = options.data.pin;
Expand Down Expand Up @@ -133,6 +133,106 @@ export class Dock {
target = target.parentElement;
}
});

this.element.addEventListener("mousedown", (event: MouseEvent) => {
const item = hasClosestByClassName(event.target as HTMLElement, "dock__item");
if (!item || !item.getAttribute("data-type")) {
return;
}
const documentSelf = document;
documentSelf.ondragstart = () => false;
let ghostElement: HTMLElement;
let selectItem: HTMLElement;
documentSelf.onmousemove = (moveEvent: MouseEvent) => {
if (window.siyuan.config.readonly ||
Math.abs(moveEvent.clientY - event.clientY) < 3 && Math.abs(moveEvent.clientX - event.clientX) < 3) {
return;
}
console.log(moveEvent.clientY - event.clientY)
moveEvent.preventDefault();
moveEvent.stopPropagation();
if (!ghostElement) {
item.style.opacity = "0.38";
item.classList.remove("b3-tooltips");
ghostElement = item.cloneNode(true) as HTMLElement;
ghostElement.setAttribute("data-ghost-type", "dock");
this.element.append(ghostElement);
ghostElement.setAttribute("data-original", JSON.stringify({
position: this.position,
index: item.getAttribute("data-index"),
previousType: item.previousElementSibling?.getAttribute("data-type"),
type: item.getAttribute("data-type"),
}));
ghostElement.setAttribute("id", "dragGhost");
ghostElement.setAttribute("style", `background-color:var(--b3-theme-background-light);position: fixed; top: ${event.clientY}px; left: ${event.clientX}px; z-index:999997;`);
}
if (this.position === "Bottom") {
ghostElement.style.top = (moveEvent.clientY - 40) + "px";
ghostElement.style.left = (moveEvent.clientX - 20) + "px";
} else {
ghostElement.style.top = (moveEvent.clientY - 20) + "px";
if (this.position === "Left") {
ghostElement.style.left = (moveEvent.clientX) + "px";
} else {
ghostElement.style.left = (moveEvent.clientX - 40) + "px";
}
}

const targetItem = hasClosestByClassName(moveEvent.target as HTMLElement, "dock__item") ||
hasClosestByClassName(moveEvent.target as HTMLElement, "dock__items") as HTMLElement;
if (targetItem && selectItem && targetItem.isSameNode(selectItem)) {
if (selectItem.classList.contains("dock__item")) {
const selectRect = selectItem.getBoundingClientRect();
if (selectItem.parentElement.parentElement.id === "dockBottom") {
if (selectRect.left + selectRect.width / 2 > moveEvent.clientX) {
selectItem.before(item);
} else {
selectItem.after(item);
}
} else {
if (selectRect.top + selectRect.height / 2 > moveEvent.clientY) {
selectItem.before(item);
} else {
selectItem.after(item);
}
}
} else if (selectItem.childElementCount === 0) {
selectItem.append(item)
} else if (selectItem.childElementCount === 1 && selectItem.firstElementChild.classList.contains("dock__item--pin")) {
selectItem.insertAdjacentElement("afterbegin", item);
}
return;
}
if (!targetItem || targetItem.classList.contains("dock__item--pin") || targetItem.style.position === "fixed" || targetItem.isSameNode(item)) {
return;
}
selectItem = targetItem;
};

documentSelf.onmouseup = () => {
documentSelf.onmousemove = null;
documentSelf.onmouseup = null;
documentSelf.ondragstart = null;
documentSelf.onselectstart = null;
documentSelf.onselect = null;
ghostElement?.remove();
if (item.classList.contains("b3-tooltips")) {
return;
}
item.style.opacity = "";
item.classList.add("b3-tooltips");
let dock
if (item.parentElement.parentElement.id === "dockBottom") {
dock = window.siyuan.layout.bottomDock;
} else if (item.parentElement.parentElement.id === "dockLeft") {
dock = window.siyuan.layout.leftDock;
} else if (item.parentElement.parentElement.id === "dockRight") {
dock = window.siyuan.layout.rightDock;
}
dock.add(item.parentElement.isSameNode(dock.element.firstElementChild) ? 0 : 1, item, item.previousElementSibling?.getAttribute("data-type"));
};
});

this.layout.element.addEventListener("mouseleave", (event: MouseEvent & { toElement: HTMLElement }) => {
if (event.buttons !== 0 || this.pin || event.toElement?.classList.contains("b3-menu")) {
return;
Expand Down Expand Up @@ -584,7 +684,7 @@ export class Dock {
this.showDock();
}

public add(index: number, sourceElement: Element) {
public add(index: number, sourceElement: Element, previousType?:string) {
sourceElement.setAttribute("data-height", "");
sourceElement.setAttribute("data-width", "");
const type = sourceElement.getAttribute("data-type");
Expand All @@ -608,17 +708,22 @@ export class Dock {
sourceElement.classList.remove("b3-tooltips__n", "b3-tooltips__ne", "b3-tooltips__nw", "b3-tooltips__s", "b3-tooltips__se", "b3-tooltips__sw", "b3-tooltips__e", "b3-tooltips__w");
sourceElement.classList.add(`b3-tooltips__${this.getClassDirect(index)}`);
sourceElement.setAttribute("data-index", index.toString());
if (index === 0) {
this.element.firstElementChild.insertAdjacentElement("afterbegin", sourceElement);
if (previousType) {
this.element.querySelector(`[data-type="${previousType}"]`).after(sourceElement);
} else {
this.element.lastElementChild.insertAdjacentElement("afterbegin", sourceElement);
if (index === 0) {
this.element.firstElementChild.insertAdjacentElement("afterbegin", sourceElement);
} else {
this.element.lastElementChild.insertAdjacentElement("afterbegin", sourceElement);
}
}
this.element.classList.remove("fn__none");
resetFloatDockSize();
this.data[type] = true;
if (hasActive) {
this.toggleModel(type, true);
this.toggleModel(type, true, false, false, false);
}
saveLayout();
}

public remove(key: string) {
Expand Down
1 change: 0 additions & 1 deletion app/src/menus/dock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const moveMenuItem = (label: string, target: Element) => {
} else if (label.indexOf("moveToBottom") > -1) {
window.siyuan.layout.bottomDock.add(label.endsWith("Left") ? 0 : 1, target);
}
saveLayout();
}
});
};
Expand Down
8 changes: 4 additions & 4 deletions app/src/protyle/wysiwyg/turnIntoList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,16 @@ export const turnIntoTaskList = (protyle: IProtyle, type: string, blockElement:
action: "delete",
id: emptyId
}], [{
action: "update",
id,
data: oldHTML,
}, {
action: "move",
id,
previousID: newId,
}, {
action: "delete",
id: newId
}, {
action: "update",
id,
data: oldHTML,
}]);
blockElement.outerHTML = `<div data-subtype="t" data-node-id="${newId}" data-type="NodeList" class="list" updated="${newId.split("-")[0]}"><div data-marker="*" data-subtype="t" data-node-id="${liItemId}" data-type="NodeListItem" class="li${isDone ? " protyle-task--done" : ""}" updated="${liItemId.split("-")[0]}"><div class="protyle-action protyle-action--task" draggable="true"><svg><use xlink:href="#icon${isDone ? "C" : "Unc"}heck"></use></svg></div>${blockElement.outerHTML}<div class="protyle-attr" contenteditable="false"></div></div><div class="protyle-attr" contenteditable="false"></div></div>`;
focusByWbr(protyle.wysiwyg.element, range);
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.2297",
"version": "0.35.2310",
"scripts": {
"test": "echo 'Test your sister day by day'",
"dev": "astro dev",
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.2297",
"version": "0.35.2310",
"description": "汐洛 pnpm 工作区",
"packageManager": "[email protected]",
"scripts": {
Expand Down
Loading

0 comments on commit bcbc2d9

Please sign in to comment.