An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: Supports drag-and-drop sorting of document tags https://github.com/siyuan-note/siyuan/issues/13436 https://github.com/siyuan-note/siyuan/issues/17384#issuecomment-4358838442 37
Daniel0e8155054782
diff --git a/app/src/assets/scss/component/_chip.scss b/app/src/assets/scss/component/_chip.scssindex 045efbf13c..ac39e42911 100644--- a/app/src/assets/scss/component/_chip.scss+++ b/app/src/assets/scss/component/_chip.scss@@ -100,12 +100,12 @@opacity: .38;}- &--insert-before {- box-shadow: -3px 0 0 var(--b3-theme-primary);+ &--dragclone {+ opacity: .38;}&--insert-after {- box-shadow: 3px 0 0 var(--b3-theme-primary);+ box-shadow: inset -2px 0 0 0 var(--b3-theme-primary-lighter);}svg:not(.b3-chip__close) {diff --git a/app/src/protyle/header/Background.ts b/app/src/protyle/header/Background.tsindex f2a323c018..183e5db075 100644--- a/app/src/protyle/header/Background.ts+++ b/app/src/protyle/header/Background.ts@@ -479,19 +479,16 @@ export class Background {break;}}- if (targetChip !== lastTargetChip) {- if (lastTargetChip) {- lastTargetChip.classList.remove("b3-chip--insert-before", "b3-chip--insert-after");- }+ if (targetChip && targetChip !== lastTargetChip) {lastTargetChip = targetChip;- if (targetChip) {- const rect = targetChip.getBoundingClientRect();- if (dragMouseX < rect.left + rect.width / 2) {- targetChip.classList.add("b3-chip--insert-before");- } else {- targetChip.classList.add("b3-chip--insert-after");- }+ const rect = targetChip.getBoundingClientRect();+ if (dragMouseX < rect.left + rect.width / 2) {+ targetChip.before(dragSourceElement);+ } else {+ targetChip.after(dragSourceElement);}+ } else if (!targetChip) {+ lastTargetChip = null;}};@@ -519,16 +516,7 @@ export class Background {dragClone.remove();dragClone = null;}- if (lastTargetChip) {- const insertBefore = lastTargetChip.classList.contains("b3-chip--insert-before");- lastTargetChip.classList.remove("b3-chip--insert-before", "b3-chip--insert-after");- if (insertBefore) {- lastTargetChip.before(dragSourceElement);- } else {- lastTargetChip.after(dragSourceElement);- }- lastTargetChip = null;- }+ lastTargetChip = null;document.body.style.cursor = "";document.body.style.userSelect = "";if (dragSourceElement.parentElement) {@@ -572,12 +560,11 @@ export class Background {this.element.setAttribute("data-node-id", rootId);if (tags) {let html = "";- const colors = ["secondary", "primary", "info", "success", "warning", "error", "pink"];- Array.from(new Set(tags.split(",").map(item => item.trim()))).forEach((item, index) => {+ Array.from(new Set(tags.split(",").map(item => item.trim()))).forEach((item) => {if (!item.replace(/ /g, "")) {return;}- html += `<div class="b3-chip b3-chip--middle b3-chip--pointer b3-chip--${colors[index % 7]}" data-type="open-search">${escapeHtml(item)}<svg class="b3-chip__close" data-type="remove-tag"><use xlink:href="#iconCloseRound"></use></svg></div>`;+ html += `<div class="b3-chip b3-chip--middle b3-chip--pointer" data-type="open-search">${escapeHtml(item)}<svg class="b3-chip__close" data-type="remove-tag"><use xlink:href="#iconCloseRound"></use></svg></div>`;});this.tagsElement.innerHTML = `${html}<div class="protyle-background__action fn__flex-center">