Skip to content

Commit

Permalink
🎨 #13284
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed Nov 27, 2024
1 parent 6718512 commit 4e33419
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 23 deletions.
4 changes: 2 additions & 2 deletions app/src/assets/scss/business/_av.scss
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,11 @@
}

&.dragover__top::after {
top: -3px;
top: -2.5px;
}

&.dragover__bottom::after {
bottom: -2px;
bottom: -2.5px;
}

&:hover [data-type="block-more"] {
Expand Down
3 changes: 2 additions & 1 deletion app/src/assets/scss/business/_custom.scss
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@

.b3-button[data-type="addColumn"] {
margin-left: 28px;

svg {
width: 16px;
height: 16px;
Expand Down Expand Up @@ -105,6 +106,6 @@
}

.av__row.dragover__top::after {
top: -2px
top: -1.5px;
}
}
4 changes: 2 additions & 2 deletions app/src/config/keymap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const keymap = {
});
item.updateProtyleToolbar([]).forEach(toolbarItem => {
if (typeof toolbarItem === "string" || Constants.INLINE_TYPE.concat("|").includes(toolbarItem.name) || !toolbarItem.hotkey) {
return
return;
}
const dockKeymap = window.siyuan.config.keymap.plugin[item.name][toolbarItem.name];
const keyValue = updateHotkeyTip(dockKeymap.custom);
Expand All @@ -71,7 +71,7 @@ export const keymap = {
<span data-type="update" class="config-keymap__key">${keyValue}</span>
<input data-key="plugin${Constants.ZWSP}${item.name}${Constants.ZWSP}${toolbarItem.name}" data-value="${dockKeymap.custom}" data-default="${dockKeymap.default}" class="b3-text-field fn__none" value="${keyValue}" spellcheck="false">
</label>`;
})
});
Object.keys(item.docks).forEach(key => {
const dockConfig = item.docks[key].config;
if (!dockConfig.hotkey) {
Expand Down
10 changes: 5 additions & 5 deletions app/src/history/doc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const renderDoc = (element: HTMLElement, currentPage: number, id: string) => {
}
const opElement = element.querySelector('.b3-select[data-type="opselect"]') as HTMLSelectElement;
const listElement = element.querySelector(".b3-list--background");
element.querySelector('.protyle-title__input').classList.add("fn__none");
element.querySelector(".protyle-title__input").classList.add("fn__none");
element.querySelector('.history__text[data-type="docPanel"]').classList.add("fn__none");
element.querySelector('.history__text[data-type="mdPanel"]').classList.add("fn__none");
fetchPost("/api/history/searchHistory", {
Expand All @@ -36,7 +36,7 @@ const renderDoc = (element: HTMLElement, currentPage: number, id: string) => {
} else {
nextElement.setAttribute("disabled", "disabled");
}
const pageNumElement = element.querySelector('[data-type="jumpRepoPage"]')
const pageNumElement = element.querySelector('[data-type="jumpRepoPage"]');
if (response.data.pageCount > 1) {
pageNumElement.removeAttribute("disabled");
} else {
Expand Down Expand Up @@ -134,8 +134,8 @@ export const openDocHistory = (options: {
typewriterMode: false,
});
disabledProtyle(historyEditor.protyle);
const pageNumElement = dialog.element.querySelector('[data-type="jumpRepoPage"]')
const titleElement = dialog.element.querySelector(".protyle-title__input")
const pageNumElement = dialog.element.querySelector('[data-type="jumpRepoPage"]');
const titleElement = dialog.element.querySelector(".protyle-title__input");
dialog.element.addEventListener("click", (event) => {
let target = event.target as HTMLElement;
while (target && !target.isEqualNode(dialog.element)) {
Expand Down Expand Up @@ -176,7 +176,7 @@ export const openDocHistory = (options: {
});
}
titleElement.textContent = item.title;
titleElement.classList.remove("fn__none")
titleElement.classList.remove("fn__none");
isLoading = false;
});
target.parentElement.querySelector(".b3-list-item--focus")?.classList.remove("b3-list-item--focus");
Expand Down
2 changes: 1 addition & 1 deletion app/src/history/history.ts
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ export const openHistory = (app: App) => {
icon: "iconHistory",
title: window.siyuan.languages.dataHistory,
bindEvent(element) {
element.firstElementChild.setAttribute("style", "background-color:var(--b3-theme-background);height:100%")
element.firstElementChild.setAttribute("style", "background-color:var(--b3-theme-background);height:100%");
bindEvent(app, element.firstElementChild);
}
});
Expand Down
6 changes: 3 additions & 3 deletions app/src/plugin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export class Plugin {

this.updateProtyleToolbar([]).forEach(toolbarItem => {
if (typeof toolbarItem === "string" || Constants.INLINE_TYPE.concat("|").includes(toolbarItem.name) || !toolbarItem.hotkey) {
return
return;
}
if (!window.siyuan.config.keymap.plugin) {
window.siyuan.config.keymap.plugin = {};
Expand All @@ -96,9 +96,9 @@ export class Plugin {
window.siyuan.config.keymap.plugin[options.name][toolbarItem.name] = {
default: toolbarItem.hotkey,
custom: toolbarItem.hotkey,
}
};
}
})
});
}

public onload() {
Expand Down
4 changes: 2 additions & 2 deletions app/src/protyle/render/av/relation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ const genSelectItemHTML = (type: "selected" | "empty" | "unselect", id?: string,
if (type === "empty") {
if (id) {
return `<button class="b3-menu__item" data-type="setRelationCell">
<span class="b3-menu__label">${window.siyuan.languages.newRowInRelation.replace('${x}', text).replace('${y}', id)}</span>
<span class="b3-menu__label">${window.siyuan.languages.newRowInRelation.replace("${x}", text).replace("${y}", id)}</span>
</button>`;
}
return `<button class="b3-menu__item">
Expand Down Expand Up @@ -407,7 +407,7 @@ export const setRelationCell = (protyle: IProtyle, nodeElement: HTMLElement, tar
}
} else {
const blockID = target.querySelector(".popover__block").getAttribute("data-id");
const content = target.querySelector("b").textContent
const content = target.querySelector("b").textContent;
const rowId = Lute.NewNodeID();
transaction(protyle, [{
action: "insertAttrViewBlock",
Expand Down
12 changes: 6 additions & 6 deletions app/src/protyle/toolbar/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,15 @@ export class Toolbar {
/// #endif
this.toolbarHeight = 29;
protyle.app.plugins.forEach(item => {
const pluginToolbar = item.updateProtyleToolbar(options.toolbar)
const pluginToolbar = item.updateProtyleToolbar(options.toolbar);
pluginToolbar.forEach(toolbarItem => {
if (typeof toolbarItem === "string" || Constants.INLINE_TYPE.concat("|").includes(toolbarItem.name) || !toolbarItem.hotkey) {
return
return;
}
if (window.siyuan.config.keymap.plugin && window.siyuan.config.keymap.plugin[item.name] && window.siyuan.config.keymap.plugin[item.name][toolbarItem.name]) {
toolbarItem.hotkey = window.siyuan.config.keymap.plugin[item.name][toolbarItem.name].custom;
}
})
});
options.toolbar = toolbarKeyToMenu(pluginToolbar);
});
options.toolbar.forEach((menuItem: IMenuItem) => {
Expand All @@ -90,15 +90,15 @@ export class Toolbar {
this.element.innerHTML = "";
protyle.options.toolbar = toolbarKeyToMenu(Constants.PROTYLE_TOOLBAR);
protyle.app.plugins.forEach(item => {
const pluginToolbar = item.updateProtyleToolbar(protyle.options.toolbar)
const pluginToolbar = item.updateProtyleToolbar(protyle.options.toolbar);
pluginToolbar.forEach(toolbarItem => {
if (typeof toolbarItem === "string" || Constants.INLINE_TYPE.concat("|").includes(toolbarItem.name) || !toolbarItem.hotkey) {
return
return;
}
if (window.siyuan.config.keymap.plugin && window.siyuan.config.keymap.plugin[item.name] && window.siyuan.config.keymap.plugin[item.name][toolbarItem.name]) {
toolbarItem.hotkey = window.siyuan.config.keymap.plugin[item.name][toolbarItem.name].custom;
}
})
});
protyle.options.toolbar = toolbarKeyToMenu(pluginToolbar);
});
protyle.options.toolbar.forEach((menuItem: IMenuItem) => {
Expand Down
3 changes: 2 additions & 1 deletion app/src/protyle/util/editorCommonEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1332,7 +1332,8 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
addDragover(targetElement);
return;
}
if (targetElement.getAttribute("data-type") === "NodeListItem" || fileTreeIds.indexOf("-") > -1) {
// 忘记为什么要限定文档树的拖拽了,先放开 https://github.com/siyuan-note/siyuan/pull/13284#issuecomment-2503853135
if (targetElement.getAttribute("data-type") === "NodeListItem") {
if (event.clientY > nodeRect.top + nodeRect.height / 2) {
targetElement.classList.add("dragover__bottom");
addDragover(targetElement);
Expand Down

0 comments on commit 4e33419

Please sign in to comment.