66import { computed , type ComputedRef } from 'vue'
77import { loadState } from '@nextcloud/initial-state'
88import { usePoliciesStore } from '../../../../../store/policies'
9+ import { getDefaultSignatureTextPolicyConfig } from './model'
910
10- // Defaults matching backend SignatureTextPolicyValue::DEFAULTS
11- const SIGNATURE_TEXT_DEFAULTS = {
12- template : '' ,
13- templateFontSize : 9.0 ,
14- signatureFontSize : 9.0 ,
15- signatureWidth : 90.0 ,
16- signatureHeight : 60.0 ,
17- renderMode : 'default' ,
18- }
11+ const SIGNATURE_TEXT_DEFAULTS = getDefaultSignatureTextPolicyConfig ( )
1912
2013interface SignatureTextValues {
2114 template : string
@@ -28,6 +21,27 @@ interface SignatureTextValues {
2821 parsed : string
2922}
3023
24+ export interface SignatureTextUiDefaults {
25+ template : string
26+ templateFontSize : number
27+ signatureFontSize : number
28+ signatureWidth : number
29+ signatureHeight : number
30+ renderMode : string
31+ }
32+
33+ export function getSignatureTextUiDefaults ( ) : SignatureTextUiDefaults {
34+ return {
35+ template : loadState < string > ( 'libresign' , 'default_signature_text_template' , SIGNATURE_TEXT_DEFAULTS . template ) ,
36+ templateFontSize : Number ( loadState < number > ( 'libresign' , 'default_template_font_size' , SIGNATURE_TEXT_DEFAULTS . templateFontSize ) ) ,
37+ signatureFontSize : Number ( loadState < number > ( 'libresign' , 'default_signature_font_size' , SIGNATURE_TEXT_DEFAULTS . signatureFontSize ) ) ,
38+ signatureWidth : Number ( loadState < number > ( 'libresign' , 'default_signature_width' , SIGNATURE_TEXT_DEFAULTS . signatureWidth ) ) ,
39+ signatureHeight : Number ( loadState < number > ( 'libresign' , 'default_signature_height' , SIGNATURE_TEXT_DEFAULTS . signatureHeight ) ) ,
40+ // Reset must use canonical default, not current effective value.
41+ renderMode : 'GRAPHIC_AND_DESCRIPTION' ,
42+ }
43+ }
44+
3145export function useSignatureTextPolicy ( ) : { values : ComputedRef < SignatureTextValues > } {
3246 const policiesStore = usePoliciesStore ( )
3347
0 commit comments