mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 19:26:39 +02:00
CmdPal: Add hints about bookmark placeholders to the Add/Edit Bookmark form (#42793)
## Summary of the Pull Request This PR adds a short explanation to the Add/Edit Bookmark form, describing how to use placeholders in bookmark URLs or paths <img width="823" height="525" alt="image" src="https://github.com/user-attachments/assets/b66adfc4-2dbc-4934-8796-9d4ad46d9f5f" /> <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [x] Closes: #42265 - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx <!-- Provide a more detailed description of the PR, other things fixed, or any additional comments/features here --> ## Detailed Description of the Pull Request / Additional comments <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed
This commit is contained in:
@@ -30,25 +30,72 @@ internal sealed partial class AddBookmarkForm : FormContent
|
||||
"type": "Input.Text",
|
||||
"style": "text",
|
||||
"id": "bookmark",
|
||||
"value": {{JsonSerializer.Serialize(url, BookmarkSerializationContext.Default.String)}},
|
||||
"label": "{{Resources.bookmarks_form_bookmark_label}}",
|
||||
"value": {{EncodeString(url)}},
|
||||
"label": {{EncodeString(Resources.bookmarks_form_bookmark_label)}},
|
||||
"isRequired": true,
|
||||
"errorMessage": "{{Resources.bookmarks_form_bookmark_required}}"
|
||||
"errorMessage": {{EncodeString(Resources.bookmarks_form_bookmark_required)}},
|
||||
"placeholder": {{EncodeString(Resources.bookmarks_form_bookmark_placeholder)}}
|
||||
},
|
||||
{
|
||||
"type": "Input.Text",
|
||||
"style": "text",
|
||||
"id": "name",
|
||||
"label": "{{Resources.bookmarks_form_name_label}}",
|
||||
"value": {{JsonSerializer.Serialize(name, BookmarkSerializationContext.Default.String)}},
|
||||
"isRequired": false,
|
||||
"errorMessage": "{{Resources.bookmarks_form_name_required}}"
|
||||
"label": {{EncodeString(Resources.bookmarks_form_name_label)}},
|
||||
"value": {{EncodeString(name)}},
|
||||
"isRequired": false
|
||||
},
|
||||
{
|
||||
"type": "RichTextBlock",
|
||||
"inlines": [
|
||||
{
|
||||
"type": "TextRun",
|
||||
"text": {{EncodeString(Resources.bookmarks_form_hint_text1)}},
|
||||
"isSubtle": true,
|
||||
"size": "Small"
|
||||
},
|
||||
{
|
||||
"type": "TextRun",
|
||||
"text": " ",
|
||||
"isSubtle": true,
|
||||
"size": "Small"
|
||||
},
|
||||
{
|
||||
"type": "TextRun",
|
||||
"text": {{EncodeString(Resources.bookmarks_form_hint_text2)}},
|
||||
"fontType": "Monospace",
|
||||
"size": "Small"
|
||||
},
|
||||
{
|
||||
"type": "TextRun",
|
||||
"text": " ",
|
||||
"isSubtle": true,
|
||||
"size": "Small"
|
||||
},
|
||||
{
|
||||
"type": "TextRun",
|
||||
"text": {{EncodeString(Resources.bookmarks_form_hint_text3)}},
|
||||
"isSubtle": true,
|
||||
"size": "Small"
|
||||
},
|
||||
{
|
||||
"type": "TextRun",
|
||||
"text": " ",
|
||||
"isSubtle": true,
|
||||
"size": "Small"
|
||||
},
|
||||
{
|
||||
"type": "TextRun",
|
||||
"text": {{EncodeString(Resources.bookmarks_form_hint_text4)}},
|
||||
"fontType": "Monospace",
|
||||
"size": "Small"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"actions": [
|
||||
{
|
||||
"type": "Action.Submit",
|
||||
"title": "{{Resources.bookmarks_form_save}}",
|
||||
"title": {{EncodeString(Resources.bookmarks_form_save)}},
|
||||
"data": {
|
||||
"name": "name",
|
||||
"bookmark": "bookmark"
|
||||
@@ -59,6 +106,8 @@ internal sealed partial class AddBookmarkForm : FormContent
|
||||
""";
|
||||
}
|
||||
|
||||
private static string EncodeString(string s) => JsonSerializer.Serialize(s, BookmarkSerializationContext.Default.String);
|
||||
|
||||
public override CommandResult SubmitForm(string payload)
|
||||
{
|
||||
var formInput = JsonNode.Parse(payload);
|
||||
|
||||
Reference in New Issue
Block a user