Skip to content

Commit

Permalink
fix export
Browse files Browse the repository at this point in the history
  • Loading branch information
jfhenon committed Dec 9, 2023
1 parent ec3e052 commit 9498ed4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 30 deletions.
2 changes: 1 addition & 1 deletion packages/svgcanvas/core/svg-exec.js
Original file line number Diff line number Diff line change
Expand Up @@ -896,7 +896,7 @@ const rasterExport = async (imgType, quality, WindowName, opts = {}) => {
WindowName
}
if (!opts.avoidEvent) {
svgCanvas.call('ed', obj)
svgCanvas.call('exported', obj)
}
resolve(obj)
}
Expand Down
7 changes: 2 additions & 5 deletions src/editor/Editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import LayersPanel from './panels/LayersPanel.js'
import MainMenu from './MainMenu.js'
import { getParentsUntil } from '@svgedit/svgcanvas/common/util.js'

const { $id, $click, decode64, blankPageObjectURL } = SvgCanvas
const { $id, $click, decode64 } = SvgCanvas

/**
*
Expand Down Expand Up @@ -295,9 +295,7 @@ class Editor extends EditorStartup {
*/
exportHandler (win, data) {
const { issues, exportWindowName } = data

this.exportWindow = window.open(blankPageObjectURL || '', exportWindowName) // A hack to get the window via JSON-able name without opening a new one

this.exportWindow = window.open('', exportWindowName) // A hack to get the window via JSON-able name without opening a new one
if (!this.exportWindow || this.exportWindow.closed) {
seAlert(this.i18next.t('notification.popupWindowBlocked'))
return
Expand All @@ -319,7 +317,6 @@ class Editor extends EditorStartup {
pre +
issues.join(pre)
}

// Note that this will also prevent the notice even though new issues may appear later.
// May want to find a way to deal with that without annoying the user
this.configObj.pref('export_notice_done', 'all')
Expand Down
24 changes: 0 additions & 24 deletions src/editor/MainMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,35 +129,11 @@ class MainMenu {
* @returns {void}
*/
const openExportWindow = () => {
const loadingImage = this.editor.i18next.t('notification.loadingImage')
if (this.editor.configObj.curConfig.exportWindowType === 'new') {
this.editor.exportWindowCt++
}
this.editor.exportWindowName =
this.editor.configObj.curConfig.canvasName + this.editor.exportWindowCt
let popHTML; let popURL
if (this.editor.loadingURL) {
popURL = this.editor.loadingURL
} else {
popHTML = `<!DOCTYPE html><html>
<head>
<meta charset="utf-8">
<title>${loadingImage}</title>
</head>
<body><h1>${loadingImage}</h1></body>
<html>`
if (URL?.createObjectURL) {
const blob = new Blob([popHTML], { type: 'text/html' })
popURL = URL.createObjectURL(blob)
} else {
popURL = 'data:text/html;base64;charset=utf-8,' + popHTML
}
this.editor.loadingURL = popURL
}
this.editor.exportWindow = window.open(
popURL,
this.editor.exportWindowName
)
}
const chrome = isChrome()
if (imgType === 'PDF') {
Expand Down

0 comments on commit 9498ed4

Please sign in to comment.