From 40c26705a5f4615ecbb9fc91dc462973a06c8786 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 1 Sep 2022 17:56:51 +0300 Subject: [PATCH] [DE] Set placeholder when add email/phone forms --- apps/documenteditor/main/app/controller/FormsTab.js | 7 ++++++- apps/documenteditor/main/app/controller/Toolbar.js | 5 ++++- apps/documenteditor/main/app/view/FormsTab.js | 4 ++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/apps/documenteditor/main/app/controller/FormsTab.js b/apps/documenteditor/main/app/controller/FormsTab.js index 18386db6c..456c25627 100644 --- a/apps/documenteditor/main/app/controller/FormsTab.js +++ b/apps/documenteditor/main/app/controller/FormsTab.js @@ -182,14 +182,19 @@ define([ } else if (type == 'combobox' || type == 'dropdown') this.api.asc_AddContentControlList(type == 'combobox', oPr, oFormPr); else if (type == 'text') { + var props = new AscCommon.CContentControlPr(); oPr = new AscCommon.CSdtTextFormPr(); if (options) { if (options.reg) oPr.put_RegExpFormat(options.reg); else if (options.mask) oPr.put_MaskFormat(options.mask); + if (options.placeholder) + props.put_PlaceholderText(options.placeholder); } - this.api.asc_AddContentControlTextForm(oPr, oFormPr); + props.put_TextFormPr(oPr); + props.put_FormPr(oFormPr); + this.api.asc_AddContentControlTextForm(props); } else if (type == 'complex') { this.api.asc_AddComplexForm(); } diff --git a/apps/documenteditor/main/app/controller/Toolbar.js b/apps/documenteditor/main/app/controller/Toolbar.js index 4c0215782..6be815ed4 100644 --- a/apps/documenteditor/main/app/controller/Toolbar.js +++ b/apps/documenteditor/main/app/controller/Toolbar.js @@ -2040,8 +2040,11 @@ define([ else if (item.value.indexOf('combobox')>=0 || item.value.indexOf('dropdown')>=0) this.api.asc_AddContentControlList(item.value.indexOf('combobox')>=0, oPr, oFormPr); else if (item.value == 'new-field') { + var props = new AscCommon.CContentControlPr(); oPr = new AscCommon.CSdtTextFormPr(); - this.api.asc_AddContentControlTextForm(oPr, oFormPr); + props.put_TextFormPr(oPr); + props.put_FormPr(oFormPr); + this.api.asc_AddContentControlTextForm(props); } Common.component.Analytics.trackEvent('ToolBar', 'Add Content Control'); diff --git a/apps/documenteditor/main/app/view/FormsTab.js b/apps/documenteditor/main/app/view/FormsTab.js index cb845e959..8ea32648d 100644 --- a/apps/documenteditor/main/app/view/FormsTab.js +++ b/apps/documenteditor/main/app/view/FormsTab.js @@ -106,10 +106,10 @@ define([ me.fireEvent('forms:insert', ['complex']); }); this.btnEmailField && this.btnEmailField.on('click', function (b, e) { - me.fireEvent('forms:insert', ['text', {reg: "\\S+@\\S+\\.\\S+"}]); + me.fireEvent('forms:insert', ['text', {reg: "\\S+@\\S+\\.\\S+", placeholder: 'user_name@email.com'}]); }); this.btnPhoneField && this.btnPhoneField.on('click', function (b, e) { - me.fireEvent('forms:insert', ['text', {mask: "(999)999-9999"}]); + me.fireEvent('forms:insert', ['text', {mask: "(999)999-9999", placeholder: '(999)999-9999'}]); }); this.btnViewForm && this.btnViewForm.on('click', function (b, e) { me.fireEvent('forms:mode', [b.pressed]);