@fabwcie/free-drawing / components/ExportModal
components/ExportModal
Classes
ExportModal
Defined in: packages/free-drawing/src/components/ExportModal/ExportModal.ts:16
Export dialog: preview, options (selected shapes or whole drawing, background, dark mode, scale), image or drawing file saved, image copied to clipboard
Extends
Constructors
Constructor
new ExportModal(
drawer):ExportModal
Defined in: packages/free-drawing/src/components/ExportModal/ExportModal.ts:40
Build the dialog: preview, options (switches, scales) updating it, save and copy buttons
Parameters
drawer
Drawer whose drawing or selection is exported
Returns
Overrides
Properties
$backdrop
$backdrop:
HTMLDivElement
Defined in: packages/free-drawing/src/components/Modal/Modal.ts:53
Backdrop around the dialog (only with backdrop option), shown and hidden with it
Inherited from
$background
$background:
HTMLInputElement
Defined in: packages/free-drawing/src/components/ExportModal/ExportModal.ts:26
Switch exporting the background color (else transparent, pdf always has one)
$buttons
$buttons:
HTMLButtonElement[]
Defined in: packages/free-drawing/src/components/ExportModal/ExportModal.ts:34
Buttons of the footer: save as PNG, SVG, PDF, drawing file, then copy, disabled when nothing to export
$dark
$dark:
HTMLInputElement
Defined in: packages/free-drawing/src/components/ExportModal/ExportModal.ts:28
Switch exporting colors of dark mode, checked on show when the drawer is dark
$empty
$empty:
HTMLParagraphElement
Defined in: packages/free-drawing/src/components/ExportModal/ExportModal.ts:22
Message shown instead of the preview when there is nothing to export
$modal
$modal:
HTMLDivElement
Defined in: packages/free-drawing/src/components/Modal/Modal.ts:41
Dialog element (role="dialog", aria-modal), holds header, body and footer
Inherited from
$modalBody
$modalBody:
HTMLDivElement
Defined in: packages/free-drawing/src/components/Modal/Modal.ts:45
Body of the dialog: content of the dialog
Inherited from
$modalFooter
$modalFooter:
HTMLDivElement
Defined in: packages/free-drawing/src/components/Modal/Modal.ts:47
Footer of the dialog: buttons of the dialog
Inherited from
$modalHeader
$modalHeader:
HTMLDivElement
Defined in: packages/free-drawing/src/components/Modal/Modal.ts:43
Header of the dialog: title and close button, removed when showHeader option is false
Inherited from
$preview
$preview:
HTMLCanvasElement
Defined in: packages/free-drawing/src/components/ExportModal/ExportModal.ts:18
Rendered image, replaced on each update
$previewContainer
$previewContainer:
HTMLDivElement
Defined in: packages/free-drawing/src/components/ExportModal/ExportModal.ts:20
Container of the preview and of the empty message
$scales
$scales:
HTMLInputElement[]
Defined in: packages/free-drawing/src/components/ExportModal/ExportModal.ts:32
Radio buttons of the scale of the image (1×, 2×, 3×), 2× by default
$selected
$selected:
HTMLInputElement
Defined in: packages/free-drawing/src/components/ExportModal/ExportModal.ts:24
Switch exporting selected shapes only, hidden without selection
$withDrawing
$withDrawing:
HTMLInputElement
Defined in: packages/free-drawing/src/components/ExportModal/ExportModal.ts:30
Switch keeping the drawing in png and svg images, to open them again for editing
drawer
drawer:
Drawer
Defined in: packages/free-drawing/src/components/Modal/Modal.ts:51
Drawer the dialog belongs to
Inherited from
options
options:
ModalOptions
Defined in: packages/free-drawing/src/components/Modal/Modal.ts:49
Options of the dialog, merged with default ones
Inherited from
Accessors
exportOptions
Get Signature
get exportOptions():
Required<ExportImageOptions>
Defined in: packages/free-drawing/src/components/ExportModal/ExportModal.ts:140
Options chosen in dialog
Returns
Required<ExportImageOptions>
Methods
_createSwitch()
private_createSwitch($container,text,checked?):HTMLInputElement
Defined in: packages/free-drawing/src/components/ExportModal/ExportModal.ts:125
Adds a switch with its translated label to the options
Parameters
$container
HTMLElement
Group of options receiving the labelled switch
text
"drawer.label" | "language.auto" | "toast.collaborationUnavailable" | "toast.collaborationFull" | "toast.collaborationTooBig" | "toast.canDraw" | "toast.viewOnly" | "toast.joinedViewOnly" | "toast.presentationStarted" | "toast.presentationEnded" | "toast.requestSent" | "toast.requestReceived" | "toast.requestRefused" | "toast.saveFailed" | "toast.saved" | "toast.styleCopied" | "toast.libraryImported" | "toast.libraryNotSaved" | "toast.loadFailed" | "toast.invalidFile" | "toast.linkCopied" | "toast.linkNotCopied" | "toast.invalidLink" | "toast.invalidShapeLink" | "toast.clipboardUnavailable" | "toast.exportFailed" | "toast.imageCopied" | "toast.storageCleared" | "toast.imageNotCopied" | "error.clipboardUnavailable" | "error.nothingToExport" | "error.notDrawingFile" | "error.notImage" | "error.damagedLink" | "error.drawingTooBig" | "error.imageNotCreated" | "error.serverUnreachable" | "error.notAllowed" | "error.storageFull" | "error.notLibraryFile" | "error.noDrawingInImage" | "error.insecurePage" | "error.roomKey" | "error.encryptionUnsupported" | "toast.selectionTool" | "modal.close" | "confirm.message" | "confirm.clearCanvas" | "confirm.clearStorage" | "confirm.stopCollaboration" | "confirm.leaveCollaboration" | "confirm.cancel" | "confirm.confirm" | "menu.label" | "menu.open" | "menu.saveAs" | "menu.save" | "menu.unsaved" | "menu.copyLink" | "menu.collaboration" | "menu.collaborationOn" | "menu.collaborationUsers" | "menu.export" | "menu.clearCanvas" | "menu.showGrid" | "menu.zenMode" | "menu.darkMode" | "menu.github" | "menu.githubLabel" | "menu.clearStorage" | "menu.background" | "menu.language" | "menu.commands" | "menu.preferences" | "preferences.title" | "preferences.autoSave" | "preferences.shapeRecognition" | "grid.style" | "grid.squares" | "grid.dots" | "grid.lines" | "grid.isometric" | "grid.styleCommand" | "preferences.wheel" | "wheel.zoom" | "wheel.pan" | "wheel.command" | "help.spaceDrag" | "help.wheelDrag" | "preferences.save" | "preferences.appearance" | "preferences.theme" | "preferences.light" | "preferences.dark" | "preferences.system" | "preferences.drawing" | "commands.search" | "commands.empty" | "commands.file" | "commands.language" | "color.white" | "color.lightGray" | "color.lightBlue" | "color.lightYellow" | "color.lightBeige" | "color.lightRed" | "color.lightGreen" | "color.black" | "color.red" | "color.green" | "color.blue" | "color.orange" | "color.yellow" | "color.pink" | "color.transparent" | "color.custom" | "color.pick" | "help.title" | "help.documentation" | "help.issue" | "help.shortcuts" | "help.tools" | "help.editor" | "help.view" | "help.or" | "help.selectAll" | "help.deleteSelection" | "help.duplicate" | "help.group" | "help.selectInGroup" | "help.constrainDrawing" | "help.whileDrawing" | "help.cancelDrawing" | "help.arrowUnlinked" | "help.constrainSelection" | "help.whileTransforming" | "help.move" | "help.forwardBackward" | "help.frontBack" | "help.lock" | "help.paste" | "help.open" | "help.save" | "help.export" | "help.grid" | "help.layers" | "help.layersSelect" | "help.snap" | "help.zoom" | "help.toolsConstrain" | "key.delete" | "key.arrows" | "key.click" | "key.space" | "key.wheel" | "key.ctrl" | "key.shift" | "key.alt" | "key.escape" | "key.enter" | "key.tab" | "key.home" | "key.end" | "key.backspace" | "toolbar.label" | "toolbar.moreTools" | "toolbar.keepTool" | "tools.pan" | "tools.selection" | "tools.brush" | "tools.eraser" | "tools.text" | "tools.note" | "tools.line" | "tools.square" | "tools.circle" | "tools.arrow" | "tools.image" | "tools.triangle" | "tools.diamond" | "tools.laser" | "tools.frame" | "zoom.label" | "zoom.out" | "zoom.in" | "zoom.reset" | "zoom.fit" | "zoom.selection" | "zoom.to100" | "history.label" | "history.undo" | "history.redo" | "position.label" | "position.recenter" | "context.paste" | "context.snap" | "context.lock" | "context.unlock" | "selectionMenu.label" | "action.duplicate" | "action.copyStyle" | "action.pasteStyle" | "library.title" | "library.add" | "library.empty" | "library.hint" | "library.insert" | "library.remove" | "library.import" | "library.export" | "library.close" | "library.shapes" | "search.label" | "search.count" | "search.none" | "slideshow.start" | "slideshow.presentFrom" | "slideshow.label" | "slideshow.previous" | "slideshow.next" | "slideshow.stop" | "slideshow.count" | "slideshow.slide" | "slideshow.slideTitled" | "slideshow.noFrames" | "slideshow.nextPrevious" | "slideshow.firstLast" | "slideshow.whilePresenting" | "replay.start" | "replay.label" | "replay.play" | "replay.pause" | "replay.restart" | "replay.speed" | "replay.stop" | "replay.count" | "replay.empty" | "replay.finished" | "replay.playPause" | "replay.step" | "replay.firstLast" | "replay.whileReplaying" | "navigation.description" | "navigation.text" | "navigation.shapes" | "navigation.from" | "navigation.to" | "navigation.link" | "navigation.locked" | "navigation.in" | "navigation.index" | "navigation.left" | "navigation.nextPrevious" | "navigation.enter" | "navigation.parent" | "navigation.leave" | "navigation.onDrawing" | "search.previous" | "search.next" | "search.close" | "action.group" | "action.ungroup" | "action.sendToBack" | "action.sendBackward" | "action.bringForward" | "action.bringToFront" | "action.delete" | "action.rotateRight" | "action.rotateLeft" | "action.flipHorizontal" | "action.flipVertical" | "action.insertImage" | "toast.imageFailed" | "action.alignLeft" | "action.alignCenter" | "action.alignRight" | "action.alignTop" | "action.alignMiddle" | "action.alignBottom" | "action.distributeHorizontal" | "action.distributeVertical" | "action.stackHorizontal" | "action.stackVertical" | "action.fitTextWidth" | "action.copyPng" | "action.copySvg" | "action.link" | "overlay.tool" | "overlay.selection" | "overlay.shape" | "overlay.brush" | "overlay.recognizeShapes" | "overlay.recognizeShapesHint" | "overlay.note" | "overlay.text" | "overlay.stroke" | "overlay.color" | "overlay.background" | "overlay.strokeWidth" | "overlay.strokeStyle" | "overlay.edges" | "overlay.arrowType" | "overlay.startHead" | "overlay.endHead" | "overlay.opacity" | "overlay.layers" | "overlay.align" | "overlay.distribute" | "overlay.actions" | "link.address" | "link.placeholder" | "link.open" | "link.remove" | "width.thin" | "width.medium" | "width.thick" | "width.extraThick" | "style.solid" | "style.dashed" | "style.dotted" | "edges.sharp" | "edges.round" | "edges.radius" | "edges.auto" | "arrow.straight" | "arrow.curved" | "arrow.elbow" | "arrowhead.none" | "arrowhead.arrow" | "arrowhead.triangle" | "arrowhead.dot" | "arrowhead.bar" | "text.fontFamily" | "text.fontSize" | "text.small" | "text.medium" | "text.large" | "text.extraLarge" | "text.style" | "text.bold" | "text.italic" | "text.underline" | "text.strikethrough" | "text.align" | "text.alignLeft" | "text.alignCenter" | "text.alignRight" | "layers.title" | "layers.group" | "layers.close" | "layers.empty" | "layers.drag" | "layers.shapesOf" | "layers.hide" | "layers.lock" | "layers.delete" | "layers.name" | "layers.toggle" | "layers.range" | "shapes.freehand" | "shapes.line" | "shapes.rect" | "shapes.ellipse" | "shapes.arrow" | "shapes.triangle" | "shapes.diamond" | "shapes.heart" | "shapes.cloud" | "shapes.star" | "shapes.hexagon" | "shapes.blockArrow" | "shapes.bubble" | "shapes.checkbox" | "shapes.shape" | "shapes.highlighter" | "shapes.frame" | "shapes.frameName" | "shapes.text" | "shapes.note" | "shapes.group" | "shapes.image" | "export.title" | "export.empty" | "export.options" | "export.selected" | "export.background" | "export.dark" | "export.withDrawing" | "export.scale" | "export.saveAs" | "export.saveFile" | "export.copy" | "export.preview" | "collab.title" | "collab.intro" | "collab.introInvited" | "collab.introJoined" | "collab.introJoinedOf" | "collab.name" | "collab.anonymous" | "collab.link" | "collab.copy" | "collab.qrCode" | "collab.start" | "collab.join" | "collab.stop" | "collab.leave" | "collab.live" | "collab.liveState" | "collab.connected" | "collab.connecting" | "collab.you" | "collab.invitedBy" | "collab.canDrawLabel" | "collab.canDraw" | "collab.newUsersCanDraw" | "collab.encrypted" | "collab.notEncrypted" | "collab.owner" | "collab.viewOnly" | "collab.present" | "collab.presenting" | "collab.follow" | "collab.followPresentation" | "collab.following" | "collab.youCanDraw" | "collab.youViewOnly" | "collab.requestEdit" | "collab.requestSent" | "collab.requests" | "collab.requestsCount" | "collab.accept" | "collab.refuse" | "collab.acceptLabel" | "collab.refuseLabel" | "collab.users" | "collab.settings"
Key of the label text (translated again when language changes)
checked?
boolean = false
Initial state of the switch
Returns
HTMLInputElement
the switch input
appendBodyContent()
appendBodyContent(
content):void
Defined in: packages/free-drawing/src/components/Modal/Modal.ts:272
Adds text at the end of the body (as text, not parsed as HTML)
Parameters
content
string
Text added after the body content
Returns
void
Inherited from
copy()
copy():
Promise<void>
Defined in: packages/free-drawing/src/components/ExportModal/ExportModal.ts:228
Copy png image to clipboard
Returns
Promise<void>
destroy()
destroy():
void
Defined in: packages/free-drawing/src/components/Modal/Modal.ts:346
Hides the dialog and removes it from the page
Returns
void
Inherited from
hide()
hide():
void
Defined in: packages/free-drawing/src/components/Modal/Modal.ts:318
Hides the dialog and gives focus back to the element which opened it, else to the drawer, unless an element out of the drawer took it (field of the page or another drawer clicked)
Returns
void
Inherited from
isVisible()
isVisible():
boolean
Defined in: packages/free-drawing/src/components/Modal/Modal.ts:339
Whether the dialog is shown
Returns
boolean
True while the dialog is shown
Inherited from
keepFocus()
protectedkeepFocus(...$preferred):void
Defined in: packages/free-drawing/src/components/Modal/Modal.ts:195
Focus kept in the dialog when an update hid or disabled its focused element (its own button: start, stop...): on the first reachable of the given elements, else on the first element of the dialog, never on the page behind it
Parameters
$preferred
...HTMLElement[]
Elements to focus, in order of preference
Returns
void
Inherited from
save()
save(
format):Promise<void>
Defined in: packages/free-drawing/src/components/ExportModal/ExportModal.ts:203
Save image or drawing file (selected shapes or whole drawing)
Parameters
format
ImageFormat | "json"
Image format, or json for a drawing file (.freedrawing)
Returns
Promise<void>
setBodyContent()
setBodyContent(
content):void
Defined in: packages/free-drawing/src/components/Modal/Modal.ts:264
Replaces the body with an HTML string
Parameters
content
string
HTML markup of the body, empty to clear it
Returns
void
Inherited from
setFooterContent()
setFooterContent(
content):void
Defined in: packages/free-drawing/src/components/Modal/Modal.ts:280
Replaces the footer with an HTML string
Parameters
content
string
HTML markup of the footer (buttons), empty to clear it
Returns
void
Inherited from
setHeaderContent()
setHeaderContent(
content):void
Defined in: packages/free-drawing/src/components/Modal/Modal.ts:254
Replaces the header with an HTML string (an empty string keeps the current header)
Parameters
content
string
HTML markup of the header
Returns
void
Inherited from
setTitle()
setTitle(
title):void
Defined in: packages/free-drawing/src/components/Modal/Modal.ts:108
Title in header
Parameters
title
string
Text of the title (nothing without header)
Returns
void
Inherited from
show()
show():
void
Defined in: packages/free-drawing/src/components/ExportModal/ExportModal.ts:153
Show dialog, selected shapes exported when there is a selection (whole drawing can be chosen in dialog)
Returns
void
Overrides
updatePreview()
updatePreview(
fontsLoaded?):void
Defined in: packages/free-drawing/src/components/ExportModal/ExportModal.ts:169
Preview rendered at once (canvas shown as is: no image encoding), at screen resolution, again once fonts of its texts and its images are loaded (drawn with a fallback font, without the images before)
Parameters
fontsLoaded?
boolean = false
Fonts of texts and images loaded since the last preview: not loaded again
Returns
void