- Fix: Have export handler, if triggered, always open a window even if no

window name was given (needed in Chrome to avoid opening an extra window)
- Fix (Embedded editor regression): Ensure event handlers are added even if
    document cannot be directly modified
- Enhancement: Add `opts` object to `rasterExport` with `avoidEvent` property
  to avoid calling the `exported` event
- Docs (CHANGES): Update
- Docs (README): Deemphasize unstable embedded editor fixes
This commit is contained in:
Brett Zamir
2018-10-24 14:45:52 +08:00
parent 07f59ba01a
commit 283ef0b521
13 changed files with 71 additions and 45 deletions

13
dist/index-es.js vendored
View File

@@ -17417,12 +17417,15 @@ function SvgCanvas(container, config) {
* @param {Float} [quality] Between 0 and 1
* @param {string} [exportWindowName]
* @param {module:svgcanvas.ImageExportedCallback} [cb]
* @param {PlainObject} [opts]
* @param {boolean} [opts.avoidEvent]
* @fires module:svgcanvas.SvgCanvas#event:exported
* @todo Confirm/fix ICO type
* @returns {Promise} Resolves to {@link module:svgcanvas.ImageExportedResults}
*/
this.rasterExport = function (imgType, quality, exportWindowName, cb) {
var opts = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
var type = imgType === 'ICO' ? 'BMP' : imgType || 'PNG';
var mimeType = 'image/' + type.toLowerCase();
@@ -17455,7 +17458,10 @@ function SvgCanvas(container, config) {
quality: quality,
exportWindowName: exportWindowName
};
call('exported', obj);
if (!opts.avoidEvent) {
call('exported', obj);
}
if (cb) {
cb(obj);
@@ -29416,10 +29422,7 @@ editor.init = function () {
var exportHandler = function exportHandler(win, data) {
var issues = data.issues,
exportWindowName = data.exportWindowName;
if (exportWindowName) {
exportWindow = window.open(blankPageObjectURL || '', exportWindowName); // A hack to get the window via JSON-able name without opening a new one
}
exportWindow = window.open(blankPageObjectURL || '', exportWindowName); // A hack to get the window via JSON-able name without opening a new one
if (!exportWindow || exportWindow.closed) {
$$b.alert(uiStrings$1.notification.popupWindowBlocked);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

13
dist/index-umd.js vendored
View File

@@ -17423,12 +17423,15 @@
* @param {Float} [quality] Between 0 and 1
* @param {string} [exportWindowName]
* @param {module:svgcanvas.ImageExportedCallback} [cb]
* @param {PlainObject} [opts]
* @param {boolean} [opts.avoidEvent]
* @fires module:svgcanvas.SvgCanvas#event:exported
* @todo Confirm/fix ICO type
* @returns {Promise} Resolves to {@link module:svgcanvas.ImageExportedResults}
*/
this.rasterExport = function (imgType, quality, exportWindowName, cb) {
var opts = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
var type = imgType === 'ICO' ? 'BMP' : imgType || 'PNG';
var mimeType = 'image/' + type.toLowerCase();
@@ -17461,7 +17464,10 @@
quality: quality,
exportWindowName: exportWindowName
};
call('exported', obj);
if (!opts.avoidEvent) {
call('exported', obj);
}
if (cb) {
cb(obj);
@@ -29422,10 +29428,7 @@
var exportHandler = function exportHandler(win, data) {
var issues = data.issues,
exportWindowName = data.exportWindowName;
if (exportWindowName) {
exportWindow = window.open(blankPageObjectURL || '', exportWindowName); // A hack to get the window via JSON-able name without opening a new one
}
exportWindow = window.open(blankPageObjectURL || '', exportWindowName); // A hack to get the window via JSON-able name without opening a new one
if (!exportWindow || exportWindow.closed) {
$$b.alert(uiStrings$1.notification.popupWindowBlocked);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long