mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 03:37:59 +01: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:
2
.github/actions/spell-check/expect.txt
vendored
2
.github/actions/spell-check/expect.txt
vendored
@@ -750,7 +750,7 @@ INITDIALOG
|
||||
INITGUID
|
||||
INITTOLOGFONTSTRUCT
|
||||
INLINEPREFIX
|
||||
Inlines
|
||||
inlines
|
||||
INPC
|
||||
inproc
|
||||
INPUTHARDWARE
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Microsoft.CmdPal.Ext.Bookmarks.Properties {
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "18.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
public class Resources {
|
||||
@@ -177,6 +177,15 @@ namespace Microsoft.CmdPal.Ext.Bookmarks.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Enter URL or file path, you can use {placeholders}, e.g. https://www.bing.com/search?q={Query}.
|
||||
/// </summary>
|
||||
public static string bookmarks_form_bookmark_placeholder {
|
||||
get {
|
||||
return ResourceManager.GetString("bookmarks_form_bookmark_placeholder", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to URL or file path is required.
|
||||
/// </summary>
|
||||
@@ -187,7 +196,44 @@ namespace Microsoft.CmdPal.Ext.Bookmarks.Properties {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Name.
|
||||
/// Looks up a localized string similar to You can add placeholders to bookmarks, and Command Palette will prompt you to enter their values when you open the bookmark.
|
||||
///A placeholder looks like this:.
|
||||
/// </summary>
|
||||
public static string bookmarks_form_hint_text1 {
|
||||
get {
|
||||
return ResourceManager.GetString("bookmarks_form_hint_text1", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to {placeholder}.
|
||||
/// </summary>
|
||||
public static string bookmarks_form_hint_text2 {
|
||||
get {
|
||||
return ResourceManager.GetString("bookmarks_form_hint_text2", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to — for example:.
|
||||
/// </summary>
|
||||
public static string bookmarks_form_hint_text3 {
|
||||
get {
|
||||
return ResourceManager.GetString("bookmarks_form_hint_text3", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to https://www.bing.com/search?q={Query}.
|
||||
/// </summary>
|
||||
public static string bookmarks_form_hint_text4 {
|
||||
get {
|
||||
return ResourceManager.GetString("bookmarks_form_hint_text4", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Name (optional).
|
||||
/// </summary>
|
||||
public static string bookmarks_form_name_label {
|
||||
get {
|
||||
|
||||
@@ -140,7 +140,7 @@
|
||||
<comment>"Terminal" should be the localized name of the Windows Terminal</comment>
|
||||
</data>
|
||||
<data name="bookmarks_form_name_label" xml:space="preserve">
|
||||
<value>Name</value>
|
||||
<value>Name (optional)</value>
|
||||
</data>
|
||||
<data name="bookmarks_form_save" xml:space="preserve">
|
||||
<value>Save</value>
|
||||
@@ -185,4 +185,20 @@
|
||||
<data name="bookmark_toast_failed_open_text" xml:space="preserve">
|
||||
<value>Failed to open {0}</value>
|
||||
</data>
|
||||
<data name="bookmarks_form_hint_text1" xml:space="preserve">
|
||||
<value>You can add placeholders to bookmarks, and Command Palette will prompt you to enter their values when you open the bookmark.
|
||||
A placeholder looks like this:</value>
|
||||
</data>
|
||||
<data name="bookmarks_form_hint_text2" xml:space="preserve">
|
||||
<value>{placeholder}</value>
|
||||
</data>
|
||||
<data name="bookmarks_form_hint_text3" xml:space="preserve">
|
||||
<value>— for example:</value>
|
||||
</data>
|
||||
<data name="bookmarks_form_hint_text4" xml:space="preserve">
|
||||
<value>https://www.bing.com/search?q={Query}</value>
|
||||
</data>
|
||||
<data name="bookmarks_form_bookmark_placeholder" xml:space="preserve">
|
||||
<value>Enter URL or file path, you can use {placeholders}, e.g. https://www.bing.com/search?q={Query}</value>
|
||||
</data>
|
||||
</root>
|
||||
Reference in New Issue
Block a user