mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 15:10:12 +01:00
This commit is contained in:
parent
5e4ac24a64
commit
c08dffd0a7
4 changed files with 11 additions and 7 deletions
|
|
@ -345,10 +345,11 @@
|
||||||
[data-subtype="echarts"],
|
[data-subtype="echarts"],
|
||||||
[data-subtype="mindmap"] {
|
[data-subtype="mindmap"] {
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
|
height: 420px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
|
||||||
& > div:not(.protyle-icons):not(.protyle-attr) {
|
& > div:not(.protyle-icons):not(.protyle-attr) {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
height: 420px;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1500,14 +1500,17 @@ export class Gutter {
|
||||||
element.querySelector("input").addEventListener("change", (event) => {
|
element.querySelector("input").addEventListener("change", (event) => {
|
||||||
const newHeight = ((event.target as HTMLInputElement).value || "420") + "px";
|
const newHeight = ((event.target as HTMLInputElement).value || "420") + "px";
|
||||||
(nodeElement as HTMLElement).style.height = newHeight;
|
(nodeElement as HTMLElement).style.height = newHeight;
|
||||||
(nodeElement.firstElementChild.nextElementSibling as HTMLElement).style.height = newHeight;
|
|
||||||
updateTransaction(protyle, id, nodeElement.outerHTML, html);
|
updateTransaction(protyle, id, nodeElement.outerHTML, html);
|
||||||
html = nodeElement.outerHTML;
|
html = nodeElement.outerHTML;
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
const chartInstance = window.echarts.getInstanceById(nodeElement.firstElementChild.nextElementSibling.getAttribute("_echarts_instance_"));
|
const renderElement = nodeElement.querySelector('[contenteditable="false"]') as HTMLElement;
|
||||||
|
if (renderElement) {
|
||||||
|
renderElement.style.height = newHeight;
|
||||||
|
const chartInstance = window.echarts.getInstanceById(renderElement.getAttribute("_echarts_instance_"));
|
||||||
if (chartInstance) {
|
if (chartInstance) {
|
||||||
chartInstance.resize();
|
chartInstance.resize();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ export const chartRender = (element: Element, cdn = Constants.PROTYLE_CDN) => {
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
if (!renderElement.lastElementChild || renderElement.childElementCount === 1) {
|
if (!renderElement.lastElementChild || renderElement.childElementCount === 1) {
|
||||||
renderElement.innerHTML = `<span style="position: absolute;left:0;top:0;width: 1px;">${Constants.ZWSP}</span><div style="height:420px" contenteditable="false"></div>`;
|
renderElement.innerHTML = `<span style="position: absolute;left:0;top:0;width: 1px;">${Constants.ZWSP}</span><div style="height:${e.style.height || "420px"}" contenteditable="false"></div>`;
|
||||||
}
|
}
|
||||||
const chartInstance = window.echarts.getInstanceById(renderElement.lastElementChild?.getAttribute("_echarts_instance_"));
|
const chartInstance = window.echarts.getInstanceById(renderElement.lastElementChild?.getAttribute("_echarts_instance_"));
|
||||||
const option = await looseJsonParse(Lute.UnEscapeHTMLStr(e.getAttribute("data-content")));
|
const option = await looseJsonParse(Lute.UnEscapeHTMLStr(e.getAttribute("data-content")));
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ export const mindmapRender = (element: Element, cdn = Constants.PROTYLE_CDN) =>
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
if (!renderElement.lastElementChild || renderElement.childElementCount === 1) {
|
if (!renderElement.lastElementChild || renderElement.childElementCount === 1) {
|
||||||
renderElement.innerHTML = `<span style="position: absolute;left:0;top:0;width: 1px;">${Constants.ZWSP}</span><div style="height:420px" contenteditable="false"></div>`;
|
renderElement.innerHTML = `<span style="position: absolute;left:0;top:0;width: 1px;">${Constants.ZWSP}</span><div style="height:${e.style.height || "420px"}" contenteditable="false"></div>`;
|
||||||
}
|
}
|
||||||
window.echarts.init(renderElement.lastElementChild, window.siyuan.config.appearance.mode === 1 ? "dark" : undefined, {
|
window.echarts.init(renderElement.lastElementChild, window.siyuan.config.appearance.mode === 1 ? "dark" : undefined, {
|
||||||
width,
|
width,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue