Extensions (#737)

- add the current document title in the toolbar
- allow user extensions to define optional parameters
- more events for renamedElement, beforeClear, afterClear, sourceChanged
- remove "message" event used for iframe integration not used anymore. can be readded through a new extension if necessary
- default precision down to 2 digits (and applied in rotation)
This commit is contained in:
JFH
2022-03-13 12:59:53 +01:00
committed by GitHub
parent 95f9ea3abb
commit a335e44dc8
25 changed files with 457 additions and 512 deletions

View File

@@ -1,4 +1,4 @@
/* globals seConfirm, seAlert */
/* globals seAlert */
import SvgCanvas from '../svgcanvas/svgcanvas.js'
import { convertUnit, isValidUnit } from '../common/units.js'
import { isChrome } from '../common/browser.js'
@@ -21,26 +21,6 @@ class MainMenu {
this.exportWindowCt = 0
}
/**
* @fires module:svgcanvas.SvgCanvas#event:ext_onNewDocument
* @returns {void}
*/
async clickClear () {
const [x, y] = this.editor.configObj.curConfig.dimensions
const ok = await seConfirm(this.editor.i18next.t('notification.QwantToClear'))
if (ok === 'Cancel') {
return
}
this.editor.leftPanel.clickSelect()
this.editor.svgCanvas.clear()
this.editor.svgCanvas.setResolution(x, y)
this.editor.updateCanvas(true)
this.editor.zoomImage()
this.editor.layersPanel.populateLayers()
this.editor.topPanel.updateContextPanel()
this.editor.svgCanvas.runExtensions('onNewDocument')
}
/**
*
* @returns {void}