jgraph / drawio

draw.io is a JavaScript, client-side editor for general diagramming.
https://www.drawio.com
Apache License 2.0
39.68k stars 7.42k forks source link

Retain settings within the "Export As>Advanced" menu #3375

Open floongle opened 1 year ago

floongle commented 1 year ago

Is your feature request related to a problem? Please describe. When exporting images using File>Export As>Advanced, the settings are forgotten by diagrams.net. This wastes time and repetition of setting these values results in higher chance of mistakes.

Describe the solution you'd like I'd like the File>Export As>Advanced dialog to remember the settings selected, both within an editing session and (preferably) when a file is reopened.

For example, the "DPI" value and "Transparent" are forgotten every time the user attempts to export. , whereas the "Border" is remembered (but only within an editing session, not when reopening the file).

stale[bot] commented 4 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. See the FAQ for more information.

YodaEmbedding commented 4 months ago

Same with the other settings, e.g. "Export As -> PDF".

Usually, I have to repeatedly click: crop, transparent background, download to PC.

If anyone's interested, here's some JavaScript to ease the task a bit:

// Run this from the JavaScript Console.

// File
$(".geMenubar > .geItem:nth-of-type(1)").click()
// File > Export As
$(".geMenubarMenu > .mxPopupMenu > tbody > .mxPopupMenuItem:nth-of-type(16)").dispatchEvent(new Event("pointermove"))
// File > Export As > PDF
var menuItem = $(".geEditor > .mxPopupMenu + .mxPopupMenu > table.mxPopupMenu > tbody > tr.mxPopupMenuItem:nth-child(6)")
menuItem.dispatchEvent(new Event("pointerdown"))
menuItem.dispatchEvent(new Event("pointerup"))

// Selection Only = true
$(".geDialog > div > div > input:nth-of-type(5)").checked = true
// Crop = true
$(".geDialog > div > div > input:nth-of-type(6)").checked = true
// Grid = false
$(".geDialog > div > div > input:nth-of-type(7)").checked = false
// Include a copy of my diagram = true
$(".geDialog > div > div > input:nth-of-type(8)").checked = true
// Transparent Background = true
$(".geDialog > div > div > input:nth-of-type(9)").checked = true
// Export
$(".geDialog > div .geBtn:nth-of-type(2)").click()

// Where: "Download"
$(".geDialog > div > div > div:nth-of-type(4) > select").value = "download"
// OK
$(".geDialog > div > div:nth-of-type(2) .gePrimaryBtn").click()

To make it easy to use, one can probably convert it to a Bookmarklet with jQuery enabled.