mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
This commit is contained in:
parent
2fc28b7609
commit
88788909ab
2 changed files with 24 additions and 7 deletions
|
|
@ -600,21 +600,37 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
|
||||||
}
|
}
|
||||||
const ghostElement = document.createElement("div");
|
const ghostElement = document.createElement("div");
|
||||||
ghostElement.className = "protyle-wysiwyg protyle-wysiwyg--attr";
|
ghostElement.className = "protyle-wysiwyg protyle-wysiwyg--attr";
|
||||||
const selectElements = blockElement.querySelectorAll(".av__gallery-item--select");
|
const isKanban = blockElement.getAttribute("data-av-type") === "kanban";
|
||||||
|
if (isKanban) {
|
||||||
|
ghostElement.innerHTML = `<div class="av__kanban"></div>`;
|
||||||
|
}
|
||||||
let galleryElement: HTMLElement;
|
let galleryElement: HTMLElement;
|
||||||
let cloneGalleryElement = document.createElement("div");
|
let cloneGalleryElement = document.createElement("div");
|
||||||
|
const selectElements = blockElement.querySelectorAll(".av__gallery-item--select");
|
||||||
selectElements.forEach(item => {
|
selectElements.forEach(item => {
|
||||||
if (!galleryElement || !galleryElement.contains(item)) {
|
if (!galleryElement || !galleryElement.contains(item)) {
|
||||||
galleryElement = item.parentElement;
|
galleryElement = item.parentElement;
|
||||||
cloneGalleryElement = document.createElement("div");
|
cloneGalleryElement = document.createElement("div");
|
||||||
cloneGalleryElement.classList.add("av__gallery");
|
if (isKanban) {
|
||||||
cloneGalleryElement.setAttribute("style", `width: 100vw;margin-bottom: 16px;grid-template-columns: repeat(auto-fill, ${selectElements[0].clientWidth}px);`);
|
cloneGalleryElement.className = "av__kanban-group";
|
||||||
ghostElement.appendChild(cloneGalleryElement);
|
cloneGalleryElement.setAttribute("style", item.parentElement.parentElement.parentElement.getAttribute("style"));
|
||||||
|
cloneGalleryElement.innerHTML = `<div class="av__gallery"></div>`;
|
||||||
|
ghostElement.firstElementChild.appendChild(cloneGalleryElement);
|
||||||
|
} else {
|
||||||
|
cloneGalleryElement.classList.add("av__gallery");
|
||||||
|
cloneGalleryElement.setAttribute("style", `width: 100vw;margin-bottom: 16px;grid-template-columns: repeat(auto-fill, ${selectElements[0].clientWidth}px);`);
|
||||||
|
ghostElement.appendChild(cloneGalleryElement);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const cloneItem = processClonePHElement(item.cloneNode(true) as Element);
|
const cloneItem = processClonePHElement(item.cloneNode(true) as Element);
|
||||||
cloneItem.setAttribute("style", `height:${item.clientHeight}px;`);
|
cloneItem.setAttribute("style", `height:${item.clientHeight}px;`);
|
||||||
cloneItem.querySelector(".av__gallery-fields").setAttribute("style", "background-color: var(--b3-theme-background)");
|
cloneItem.classList.remove("av__gallery-item--select");
|
||||||
cloneGalleryElement.appendChild(cloneItem);
|
if (isKanban) {
|
||||||
|
cloneGalleryElement.firstElementChild.appendChild(cloneItem);
|
||||||
|
} else {
|
||||||
|
cloneItem.querySelector(".av__gallery-fields").setAttribute("style", "background-color: var(--b3-theme-background)");
|
||||||
|
cloneGalleryElement.appendChild(cloneItem);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
ghostElement.setAttribute("style", "top:100vh;position:fixed;opacity:.1;padding:0;z-index: 8");
|
ghostElement.setAttribute("style", "top:100vh;position:fixed;opacity:.1;padding:0;z-index: 8");
|
||||||
document.body.append(ghostElement);
|
document.body.append(ghostElement);
|
||||||
|
|
|
||||||
|
|
@ -982,7 +982,8 @@ export class WYSIWYG {
|
||||||
if (targetCellElement) {
|
if (targetCellElement) {
|
||||||
target = targetCellElement;
|
target = targetCellElement;
|
||||||
}
|
}
|
||||||
if (target.tagName === "TH" || target.tagName === "TD" || target.firstElementChild?.tagName === "TABLE" || target.classList.contains("table__resize") || target.classList.contains("table__select")) {
|
if (target.tagName === "TH" || target.tagName === "TD" || target.firstElementChild?.tagName === "TABLE" ||
|
||||||
|
target.classList.contains("table__resize") || target.classList.contains("table__select")) {
|
||||||
tableBlockElement = nodeElement;
|
tableBlockElement = nodeElement;
|
||||||
if (tableBlockElement) {
|
if (tableBlockElement) {
|
||||||
tableBlockElement.querySelector(".table__select").removeAttribute("style");
|
tableBlockElement.querySelector(".table__select").removeAttribute("style");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue