多行文本输入的标签坏了?

Label of multiline text input broken?

我有一个 TextInput 已设置为多行。它有一个很长的标题,并且呈现为损坏的标签(错误的位置)。

我设置不正确吗?

function onDefaultHomePageOpen(e) {
  let introText = CardService.newTextParagraph()
    .setText(UNREGISTERED_INTRO_TEXT);

  let checkAddressAction = CardService.newAction()
    .setFunctionName("checkInputAddress")
    .setLoadIndicator(CardService.LoadIndicator.SPINNER);

  let addrInput = CardService.newTextInput()
    .setFieldName(USER_REF_ADDRESS)
    .setTitle("Quelle est votre adresse de départ habituelle ? (votre domicile ou votre bureau)")
    .setMultiline(true)
    .setOnChangeAction(checkAddressAction);

  /* some other stuff here */

  let homeSection = CardService.newCardSection()
    .addWidget(introText)
    .addWidget(addrInput)
    .addWidget(transportModeInput)
    .addWidget(validateButton);
 
  return CardService.newCardBuilder()
    .addSection(homeSection)
    .build()
}

当值为空时

当我输入内容时

阅读样式指南后发现,专门为文本输入标签使用长文本似乎不是个好主意,因为样式指南建议使用短文本。

您可以使用较短的文本作为文本输入标签,并添加简短的解释作为提示。

来自 Copy Macros,工作区 add-ons 样本:

.addWidget(CardService.newTextInput()
   .setFieldName('sourceScriptId')
   .setValue(sourceScriptId || '')
   .setTitle('Script ID of the source macro')
   .setHint('You must have at least edit permission for the source spreadsheet to access its script project'))

来自https://developers.google.com/apps-script/add-ons/guides/workspace-style#text_inputs

Writing style

You shouldn’t need to write much. Most actions should be made clear through iconography, layout, and short labels. If you find a portion of your add-on needs more extensive explanation than short labels can provide, it's a best practice to create a separate web page describing your add-on and link to it.

When writing UI text:

  • Use sentence case (especially for buttons, labels, and card actions).
  • Prefer short, simple text without jargon or acronyms.