From 0da826f5790e34f2b60592eca58c32b939e1f623 Mon Sep 17 00:00:00 2001 From: "Julia.Radzhabova" Date: Thu, 24 Apr 2025 13:36:46 +0300 Subject: [PATCH] [PDF] Add readonly form option --- .../main/app/template/FormSettings.template | 5 ++++ apps/pdfeditor/main/app/view/FormSettings.js | 23 +++++++++++++++++++ apps/pdfeditor/main/locale/en.json | 1 + 3 files changed, 29 insertions(+) diff --git a/apps/pdfeditor/main/app/template/FormSettings.template b/apps/pdfeditor/main/app/template/FormSettings.template index 10afa851e6..3922acd6ee 100644 --- a/apps/pdfeditor/main/app/template/FormSettings.template +++ b/apps/pdfeditor/main/app/template/FormSettings.template @@ -291,6 +291,11 @@
+ + +
+ +
diff --git a/apps/pdfeditor/main/app/view/FormSettings.js b/apps/pdfeditor/main/app/view/FormSettings.js index 657e131afd..bc3f80cb07 100644 --- a/apps/pdfeditor/main/app/view/FormSettings.js +++ b/apps/pdfeditor/main/app/view/FormSettings.js @@ -136,6 +136,16 @@ define([ this.chRequired.on('change', this.onChRequired.bind(this)); this.lockedControls.push(this.chRequired); + this.chReadonly = new Common.UI.CheckBox({ + el: $markup.findById('#form-chb-readonly'), + labelText: this.textReadonly, + dataHint: '1', + dataHintDirection: 'left', + dataHintOffset: 'small' + }); + this.chReadonly.on('change', this.onChReadonly.bind(this)); + this.lockedControls.push(this.chReadonly); + this.cmbLineWidth = new Common.UI.ComboBox({ el: $markup.findById('#form-combo-line-width'), cls: 'input-group-nr', @@ -770,6 +780,13 @@ define([ } }, + onChReadonly: function(field, newValue, oldValue, eOpts){ + if (this.api && !this._noApply) { + this.api.SetFieldReadOnly(field.getValue()==='checked'); + this.fireEvent('editcomplete', this); + } + }, + onColorBGSelect: function(btn, color) { this.BackgroundColor = color; this._state.BackgroundColor = undefined; @@ -1247,6 +1264,12 @@ define([ this._state.Required=val; } + val = props.asc_getReadOnly(); + if ( this._state.Readonly!==val ) { + this.chReadonly.setValue(!!val, true); + this._state.Readonly=val; + } + var color = props.asc_getStroke(); if (color) { if (color.get_type() == Asc.c_oAscColor.COLOR_TYPE_SCHEME) { diff --git a/apps/pdfeditor/main/locale/en.json b/apps/pdfeditor/main/locale/en.json index 9b4626cebd..53c545e1d1 100644 --- a/apps/pdfeditor/main/locale/en.json +++ b/apps/pdfeditor/main/locale/en.json @@ -1416,6 +1416,7 @@ "PDFE.Views.FormSettings.textColor": "Color", "PDFE.Views.FormSettings.textBackgroundColor": "Background color", "PDFE.Views.FormSettings.textRequired": "Required", + "PDFE.Views.FormSettings.textReadonly": "Read only", "PDFE.Views.FormSettings.textNoBorder": "No border", "PDFE.Views.FormSettings.textNoFill": "No fill", "PDFE.Views.FormSettings.textThin": "Thin",