File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -100,12 +100,9 @@ const emit = defineEmits<{
100100}>()
101101
102102const capabilities = getCapabilities () as LibresignCapabilities
103- const signElementsConfig = capabilities .libresign ?.config [' sign-elements' ] ?? {
104- ' signature-width' : 0 ,
105- ' signature-height' : 0 ,
106- }
107- const canvasWidth = signElementsConfig [' signature-width' ]
108- const canvasHeight = signElementsConfig [' signature-height' ]
103+ const signElementsConfig = capabilities .libresign ?.config [' sign-elements' ]
104+ const canvasWidth = Number (signElementsConfig ?.[' signature-width' ])
105+ const canvasHeight = Number (signElementsConfig ?.[' signature-height' ])
109106const color = ref (' #000000' )
110107const customPalette = [
111108 ' #000000' ,
Original file line number Diff line number Diff line change @@ -160,10 +160,7 @@ const emit = defineEmits<{
160160}>()
161161
162162const capabilities = getCapabilities () as LibresignCapabilities
163- const signElementsConfig = capabilities .libresign ?.config [' sign-elements' ] ?? {
164- ' signature-width' : 0 ,
165- ' signature-height' : 0 ,
166- }
163+ const signElementsConfig = capabilities .libresign ?.config [' sign-elements' ]
167164
168165const file = ref <HTMLInputElement | null >(null )
169166const cropper = ref <CropperInstance | null >(null )
@@ -179,8 +176,8 @@ const zoomLevel = ref(1)
179176const zoomMin = 0.1
180177const zoomMax = 8
181178const zoomStep = 0.1
182- const stencilBaseWidth = signElementsConfig [' signature-width' ]
183- const stencilBaseHeight = signElementsConfig [' signature-height' ]
179+ const stencilBaseWidth = Number ( signElementsConfig ?. [' signature-width' ])
180+ const stencilBaseHeight = Number ( signElementsConfig ?. [' signature-height' ])
184181
185182const hasImage = computed (() => !! image .value )
186183const canSave = computed (() => hasImage .value && imageData .value .length > 0 )
Original file line number Diff line number Diff line change @@ -60,12 +60,9 @@ const emit = defineEmits<{
6060}>()
6161
6262const capabilities = getCapabilities () as LibresignCapabilities
63- const signElementsConfig = capabilities .libresign ?.config [' sign-elements' ] ?? {
64- ' signature-width' : 0 ,
65- ' signature-height' : 0 ,
66- }
67- const canvasWidth = signElementsConfig [' signature-width' ]
68- const canvasHeight = signElementsConfig [' signature-height' ]
63+ const signElementsConfig = capabilities .libresign ?.config [' sign-elements' ]
64+ const canvasWidth = Number (signElementsConfig ?.[' signature-width' ])
65+ const canvasHeight = Number (signElementsConfig ?.[' signature-height' ])
6966const value = ref (' ' )
7067const modal = ref (false )
7168const imageData = ref (' ' )
Original file line number Diff line number Diff line change @@ -63,12 +63,9 @@ const loading = ref(true)
6363const isLoaded = ref (false )
6464const imageData = ref (' ' )
6565const capabilities = getCapabilities () as LibresignCapabilities
66- const signElementsConfig = capabilities .libresign ?.config [' sign-elements' ] ?? {
67- ' signature-width' : 0 ,
68- ' signature-height' : 0 ,
69- }
70- const width = ref (` ${signElementsConfig [' signature-width' ]}px ` )
71- const height = ref (` ${signElementsConfig [' signature-height' ]}px ` )
66+ const signElementsConfig = capabilities .libresign ?.config [' sign-elements' ]
67+ const width = ref (` ${Number (signElementsConfig ?.[' signature-width' ])}px ` )
68+ const height = ref (` ${Number (signElementsConfig ?.[' signature-height' ])}px ` )
7269
7370function arrayBufferToBase64(data : ArrayBuffer ) {
7471 const bytes = new Uint8Array (data )
Original file line number Diff line number Diff line change @@ -459,13 +459,9 @@ const modal = ref(false)
459459const loading = ref (false )
460460const signerSelected = ref <SignerSummaryRecord | null >(null )
461461const capabilities = getCapabilities () as LibresignCapabilities
462- const signElementsConfig = capabilities .libresign ?.config [' sign-elements' ] ?? {
463- ' is-available' : false ,
464- ' full-signature-width' : 0 ,
465- ' full-signature-height' : 0 ,
466- }
467- const width = ref (signElementsConfig [' full-signature-width' ])
468- const height = ref (signElementsConfig [' full-signature-height' ])
462+ const signElementsConfig = capabilities .libresign ?.config [' sign-elements' ]
463+ const width = ref (Number (signElementsConfig ?.[' full-signature-width' ]))
464+ const height = ref (Number (signElementsConfig ?.[' full-signature-height' ]))
469465const filePagesMap = ref <Record <number , FilePageInfo >>({})
470466const elementsLoaded = ref (false )
471467const fetchedFiles = ref <EditableRequestChildFile []>([])
@@ -603,7 +599,7 @@ async function showModal() {
603599 if (! canRequestSign .value ) {
604600 return
605601 }
606- if (signElementsConfig [' is-available' ] === false ) {
602+ if (signElementsConfig ?. [' is-available' ] === false ) {
607603 return
608604 }
609605 modal .value = true
You can’t perform that action at this time.
0 commit comments