mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 02:36:19 +02:00
[NewUtility]Advanced Paste (#23)
Advanced Paste V1 implementation --------- Co-authored-by: Stefan Markovic <stefan@janeasystems.com> Co-authored-by: Niels Laute <niels.laute@live.nl> Co-authored-by: Jordi Adoumie <98557455+joadoumie@users.noreply.github.com> Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com> Co-authored-by: Jaime Bernardo <jaime@janeasystems.com>
This commit is contained in:
committed by
Jaime Bernardo
parent
c601a3e3e2
commit
483f7aa464
@@ -0,0 +1,49 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using Settings.UI.Library.Attributes;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
{
|
||||
public class AdvancedPasteProperties
|
||||
{
|
||||
public static readonly HotkeySettings DefaultAdvancedPasteUIShortcut = new HotkeySettings(true, false, false, true, 0x56); // Win+Shift+V
|
||||
|
||||
public static readonly HotkeySettings DefaultPasteAsPlainTextShortcut = new HotkeySettings(true, true, true, false, 0x56); // Ctrl+Win+Alt+V
|
||||
|
||||
public AdvancedPasteProperties()
|
||||
{
|
||||
AdvancedPasteUIShortcut = DefaultAdvancedPasteUIShortcut;
|
||||
PasteAsPlainTextShortcut = DefaultPasteAsPlainTextShortcut;
|
||||
PasteAsMarkdownShortcut = new();
|
||||
PasteAsJsonShortcut = new();
|
||||
ShowCustomPreview = true;
|
||||
SendPasteKeyCombination = true;
|
||||
}
|
||||
|
||||
[JsonConverter(typeof(BoolPropertyJsonConverter))]
|
||||
public bool ShowCustomPreview { get; set; }
|
||||
|
||||
[JsonConverter(typeof(BoolPropertyJsonConverter))]
|
||||
[CmdConfigureIgnore]
|
||||
public bool SendPasteKeyCombination { get; set; }
|
||||
|
||||
[JsonPropertyName("advanced-paste-ui-hotkey")]
|
||||
public HotkeySettings AdvancedPasteUIShortcut { get; set; }
|
||||
|
||||
[JsonPropertyName("paste-as-plain-hotkey")]
|
||||
public HotkeySettings PasteAsPlainTextShortcut { get; set; }
|
||||
|
||||
[JsonPropertyName("paste-as-markdown-hotkey")]
|
||||
public HotkeySettings PasteAsMarkdownShortcut { get; set; }
|
||||
|
||||
[JsonPropertyName("paste-as-json-hotkey")]
|
||||
public HotkeySettings PasteAsJsonShortcut { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
=> JsonSerializer.Serialize(this);
|
||||
}
|
||||
}
|
||||
@@ -9,9 +9,9 @@ using Microsoft.PowerToys.Settings.UI.Library.Interfaces;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
{
|
||||
public class PastePlainSettings : BasePTModuleSettings, ISettingsConfig
|
||||
public class AdvancedPasteSettings : BasePTModuleSettings, ISettingsConfig
|
||||
{
|
||||
public const string ModuleName = "PastePlain";
|
||||
public const string ModuleName = "AdvancedPaste";
|
||||
|
||||
private static readonly JsonSerializerOptions _serializerOptions = new JsonSerializerOptions
|
||||
{
|
||||
@@ -19,11 +19,11 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
};
|
||||
|
||||
[JsonPropertyName("properties")]
|
||||
public PastePlainProperties Properties { get; set; }
|
||||
public AdvancedPasteProperties Properties { get; set; }
|
||||
|
||||
public PastePlainSettings()
|
||||
public AdvancedPasteSettings()
|
||||
{
|
||||
Properties = new PastePlainProperties();
|
||||
Properties = new AdvancedPasteProperties();
|
||||
Version = "1";
|
||||
Name = ModuleName;
|
||||
}
|
||||
@@ -330,18 +330,18 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
}
|
||||
}
|
||||
|
||||
private bool pastePlain = true;
|
||||
private bool advancedPaste = true;
|
||||
|
||||
[JsonPropertyName("PastePlain")]
|
||||
public bool PastePlain
|
||||
[JsonPropertyName("AdvancedPaste")]
|
||||
public bool AdvancedPaste
|
||||
{
|
||||
get => pastePlain;
|
||||
get => advancedPaste;
|
||||
set
|
||||
{
|
||||
if (pastePlain != value)
|
||||
if (advancedPaste != value)
|
||||
{
|
||||
LogTelemetryEvent(value);
|
||||
pastePlain = value;
|
||||
advancedPaste = value;
|
||||
NotifyChange();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Text.Json;
|
||||
using Settings.UI.Library.Attributes;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
{
|
||||
public class PastePlainProperties
|
||||
{
|
||||
[CmdConfigureIgnore]
|
||||
public HotkeySettings DefaultActivationShortcut => new HotkeySettings(true, true, true, false, 0x56); // Ctrl+Win+Alt+V
|
||||
|
||||
public PastePlainProperties()
|
||||
{
|
||||
ActivationShortcut = DefaultActivationShortcut;
|
||||
}
|
||||
|
||||
public HotkeySettings ActivationShortcut { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
=> JsonSerializer.Serialize(this);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user