Skip to content

Commit

Permalink
🚨
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed Oct 1, 2023
1 parent c321223 commit e8359ed
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 22 deletions.
16 changes: 8 additions & 8 deletions app/src/layout/getAll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,29 @@ export const getAllEditor = () => {
const models = getAllModels();
const editors: Protyle[] = [];
models.editor.forEach(item => {
editors.push(item.editor)
})
editors.push(item.editor);
});
models.search.forEach(item => {
editors.push(item.edit)
})
editors.push(item.edit);
});
models.custom.forEach(item => {
if (item.data?.editor instanceof Protyle) {
editors.push(item.data.editor)
editors.push(item.data.editor);
}
})
});
models.backlink.forEach(item => {
item.editors.forEach(editorItem => {
editors.push(editorItem);
});
});
window.siyuan.dialogs.forEach(item => {
if (item.editor) {
editors.push(item.editor)
editors.push(item.editor);
}
});
window.siyuan.blockPanels.forEach(item => {
item.editors.forEach(editorItem => {
editors.push(editorItem)
editors.push(editorItem);
});
});
return editors;
Expand Down
8 changes: 4 additions & 4 deletions app/src/protyle/render/av/openMenuPanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ export const openMenuPanel = (options: {
avPanelElement.remove();
} else {
// 优先关闭资源文件搜索
hideElements(["util"], options.protyle)
hideElements(["util"], options.protyle);
}
window.siyuan.menus.menu.remove();
event.preventDefault();
Expand Down Expand Up @@ -680,21 +680,21 @@ export const openMenuPanel = (options: {
event.stopPropagation();
break;
} else if (type === "addAssetExist") {
const rect = target.getBoundingClientRect()
const rect = target.getBoundingClientRect();
options.protyle.toolbar.showAssets(options.protyle, {x: rect.right, y: rect.bottom, w: target.parentElement.clientWidth + 8, h: rect.height}, (url) => {
let value: IAVCellAssetValue;
if (Constants.SIYUAN_ASSETS_IMAGE.includes(pathPosix().extname(url).toLowerCase())) {
value = {
type: "image",
content: url,
name: ""
}
};
} else {
value = {
type: "file",
content: url,
name: pathPosix().basename(url).substring(0, Constants.SIZE_LINK_TEXT_MAX)
}
};
}
updateAssetCell({
protyle: options.protyle,
Expand Down
8 changes: 4 additions & 4 deletions app/src/protyle/toolbar/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1577,9 +1577,9 @@ export class Toolbar {

if (event.key === "Enter") {
if (!isEmpty) {
const currentURL = this.subElement.querySelector(".b3-list-item--focus").getAttribute("data-value")
const currentURL = this.subElement.querySelector(".b3-list-item--focus").getAttribute("data-value");
if (avCB) {
avCB(currentURL)
avCB(currentURL);
} else {
hintRenderAssets(currentURL, protyle);
}
Expand Down Expand Up @@ -1625,9 +1625,9 @@ export class Toolbar {
const listItemElement = hasClosestByClassName(target, "b3-list-item");
if (listItemElement) {
event.stopPropagation();
const currentURL = listItemElement.getAttribute("data-value")
const currentURL = listItemElement.getAttribute("data-value");
if (avCB) {
avCB(currentURL)
avCB(currentURL);
} else {
hintRenderAssets(currentURL, protyle);
}
Expand Down
12 changes: 6 additions & 6 deletions app/src/protyle/wysiwyg/keydown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,15 @@ const getContentByInlineHTML = (range: Range, cb: (content: string) => void) =>
let html = "";
Array.from(range.cloneContents().childNodes).forEach((item: HTMLElement) => {
if (item.nodeType === 3) {
html += item.textContent
html += item.textContent;
} else {
html += item.outerHTML
html += item.outerHTML;
}
})
});
fetchPost("/api/block/getDOMText", {dom: html}, (response) => {
cb(response.data)
})
}
cb(response.data);
});
};

export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
editorElement.addEventListener("keydown", (event: KeyboardEvent & { target: HTMLElement }) => {
Expand Down

0 comments on commit e8359ed

Please sign in to comment.