Explorar el Código

compdfkit(win) - 修改文字编辑快捷键选中文字逻辑

liyuxuan hace 1 año
padre
commit
a34f41fa49

+ 10 - 6
Demo/Examples/ContentEditor/MainWindow.xaml.cs

@@ -570,6 +570,10 @@ namespace ContentEditor
                 editCommand.PopupMenu.Items.Add(new MenuItem() { Header = "Cut", Command = ApplicationCommands.Cut, CommandTarget = (UIElement)sender });
                 editCommand.PopupMenu.Items.Add(new MenuItem() { Header = "Delete", Command = ApplicationCommands.Delete, CommandTarget = (UIElement)sender });
                 editCommand.PopupMenu.Items.Add(new MenuItem() { Header = "Paste", Command = ApplicationCommands.Paste, CommandTarget = (UIElement)sender });
+                if (editCommand.TextAreaCopied)
+                {
+                    editCommand.PopupMenu.Items.Add(new MenuItem() { Header = "Paste And Match Style", Command = CustomCommands.PasteMatchStyle, CommandTarget = (UIElement)sender });
+                }
             }
             else
             {
@@ -1176,25 +1180,25 @@ namespace ContentEditor
             {
                 if (e.Key == Key.Left)
                 {
-                    pdfViewControl.PDFView.JumpEditingLoction(CEditingLocation.CEditingLoadTypePreCharPlace, false);
+                    pdfViewControl.PDFView.JumpEditingLoction(CEditingLocation.CEditingLoadTypePreCharPlace, true);
                     e.Handled = true;
                 }
 
                 if (e.Key == Key.Right)
                 {
-                    pdfViewControl.PDFView.JumpEditingLoction(CEditingLocation.CEditingLoadTypeNextCharPlace, false);
+                    pdfViewControl.PDFView.JumpEditingLoction(CEditingLocation.CEditingLoadTypeNextCharPlace, true);
                     e.Handled = true;
                 }
 
                 if (e.Key == Key.Up)
                 {
-                    pdfViewControl.PDFView.JumpEditingLoction(CEditingLocation.CEditingLoadTypeUpCharPlace, false);
+                    pdfViewControl.PDFView.JumpEditingLoction(CEditingLocation.CEditingLoadTypeUpCharPlace, true);
                     e.Handled = true;
                 }
 
                 if (e.Key == Key.Down)
                 {
-                    pdfViewControl.PDFView.JumpEditingLoction(CEditingLocation.CEditingLoadTypeDownCharPlace, false);
+                    pdfViewControl.PDFView.JumpEditingLoction(CEditingLocation.CEditingLoadTypeDownCharPlace, true);
                     e.Handled = true;
                 }
             }
@@ -1203,13 +1207,13 @@ namespace ContentEditor
             {
                 if (e.SystemKey == Key.Up)
                 {
-                    pdfViewControl.PDFView.JumpEditingLoction(CEditingLocation.CEditingLocationLineBegin, false);
+                    pdfViewControl.PDFView.JumpEditingLoction(CEditingLocation.CEditingLocationLineBegin, true);
                     e.Handled = true;
                 }
 
                 if (e.SystemKey == Key.Down)
                 {
-                    pdfViewControl.PDFView.JumpEditingLoction(CEditingLocation.CEditingLoadTypeLineEnd, false);
+                    pdfViewControl.PDFView.JumpEditingLoction(CEditingLocation.CEditingLoadTypeLineEnd, true);
                     e.Handled = true;
                 }
             }

+ 24 - 20
Demo/Examples/PDFViewer/MainPage.xaml.cs

@@ -16,13 +16,13 @@ using System.Diagnostics;
 using System.Drawing;
 using System.IO;
 using System.Linq;
-using System.Runtime.CompilerServices; 
+using System.Runtime.CompilerServices;
 using System.Windows;
 using System.Windows.Controls;
-using System.Windows.Controls.Primitives; 
+using System.Windows.Controls.Primitives;
 using System.Windows.Input;
 using System.Windows.Media;
-using System.Windows.Media.Imaging; 
+using System.Windows.Media.Imaging;
 using Path = System.IO.Path;
 using Point = System.Windows.Point;
 
@@ -271,7 +271,7 @@ namespace PDFViewer
                 imageEditControl.InitWithPDFViewer(pdfViewControl.PDFView);
                 imageEditControl.SetPDFImageEditData(lastPDFEditEvent);
                 pdfEditControl = imageEditControl as UIElement;
-                PropertyContainer.Child = pdfEditControl; 
+                PropertyContainer.Child = pdfEditControl;
             }
         }
 
@@ -326,7 +326,7 @@ namespace PDFViewer
                     pdfViewControl.PDFView?.SetPDFEditCreateType(CPDFEditType.EditText);
                     pdfViewControl.PDFView?.SetMouseMode(MouseModes.PDFEdit);
                     pdfViewControl.PDFView?.ReloadDocument();
-                   
+
                     pdfViewControl.PDFView?.SetPDFEditParam(createParam);
                     if (textEditControl == null)
                     {
@@ -376,7 +376,7 @@ namespace PDFViewer
                     RightPanelButton.IsChecked = false;
                     if (PropertyContainer.Child != null && !(bool)ViewSettingBtn.IsChecked)
                     {
-                        ExpandRightPropertyPanel(null, Visibility.Collapsed); 
+                        ExpandRightPropertyPanel(null, Visibility.Collapsed);
                     }
                     pdfViewControl.PDFView?.SetPDFEditCreateType(CPDFEditType.EditImage);
                     pdfViewControl.PDFView?.AddPDFEditImage(openFileDialog.FileName);
@@ -775,6 +775,10 @@ namespace PDFViewer
                 editCommand.PopupMenu.Items.Add(new MenuItem() { Header = "Cut", Command = ApplicationCommands.Cut, CommandTarget = (UIElement)sender });
                 editCommand.PopupMenu.Items.Add(new MenuItem() { Header = "Delete", Command = ApplicationCommands.Delete, CommandTarget = (UIElement)sender });
                 editCommand.PopupMenu.Items.Add(new MenuItem() { Header = "Paste", Command = ApplicationCommands.Paste, CommandTarget = (UIElement)sender });
+                if (editCommand.TextAreaCopied)
+                {
+                    editCommand.PopupMenu.Items.Add(new MenuItem() { Header = "Paste And Match Style", Command = CustomCommands.PasteMatchStyle, CommandTarget = (UIElement)sender });
+                }
             }
             else
             {
@@ -1167,7 +1171,7 @@ namespace PDFViewer
             {
                 RightPanelButton.IsChecked = false;
             }
-        } 
+        }
 
         private void RightPanelButton_Click(object sender, RoutedEventArgs e)
         {
@@ -1191,8 +1195,8 @@ namespace PDFViewer
         {
             if ((bool)ViewSettingBtn.IsChecked)
             {
-                ViewSettingBtn.IsChecked= false;
-                RightPanelButton.IsChecked= true;
+                ViewSettingBtn.IsChecked = false;
+                RightPanelButton.IsChecked = true;
             }
             PropertyContainer.Child = pdfAnnotationControl;
             pdfAnnotationControl.SetAnnotEventData(e);
@@ -1260,7 +1264,7 @@ namespace PDFViewer
                             textEditControl = new PDFTextEditControl();
                         }
                         textEditControl.SetPDFTextEditData(pdfTextCreateParam);
-                        PropertyContainer.Child = textEditControl;  
+                        PropertyContainer.Child = textEditControl;
 
                     }
                 }
@@ -1412,25 +1416,25 @@ namespace PDFViewer
             {
                 if (e.Key == Key.Left)
                 {
-                    pdfViewControl.PDFView.JumpEditingLoction(CEditingLocation.CEditingLoadTypePreCharPlace, false);
+                    pdfViewControl.PDFView.JumpEditingLoction(CEditingLocation.CEditingLoadTypePreCharPlace, true);
                     e.Handled = true;
                 }
 
                 if (e.Key == Key.Right)
                 {
-                    pdfViewControl.PDFView.JumpEditingLoction(CEditingLocation.CEditingLoadTypeNextCharPlace, false);
+                    pdfViewControl.PDFView.JumpEditingLoction(CEditingLocation.CEditingLoadTypeNextCharPlace, true);
                     e.Handled = true;
                 }
 
                 if (e.Key == Key.Up)
                 {
-                    pdfViewControl.PDFView.JumpEditingLoction(CEditingLocation.CEditingLoadTypeUpCharPlace, false);
+                    pdfViewControl.PDFView.JumpEditingLoction(CEditingLocation.CEditingLoadTypeUpCharPlace, true);
                     e.Handled = true;
                 }
 
                 if (e.Key == Key.Down)
                 {
-                    pdfViewControl.PDFView.JumpEditingLoction(CEditingLocation.CEditingLoadTypeDownCharPlace, false);
+                    pdfViewControl.PDFView.JumpEditingLoction(CEditingLocation.CEditingLoadTypeDownCharPlace, true);
                     e.Handled = true;
                 }
             }
@@ -1439,13 +1443,13 @@ namespace PDFViewer
             {
                 if (e.SystemKey == Key.Up)
                 {
-                    pdfViewControl.PDFView.JumpEditingLoction(CEditingLocation.CEditingLocationLineBegin, false);
+                    pdfViewControl.PDFView.JumpEditingLoction(CEditingLocation.CEditingLocationLineBegin, true);
                     e.Handled = true;
                 }
 
                 if (e.SystemKey == Key.Down)
                 {
-                    pdfViewControl.PDFView.JumpEditingLoction(CEditingLocation.CEditingLoadTypeLineEnd, false);
+                    pdfViewControl.PDFView.JumpEditingLoction(CEditingLocation.CEditingLoadTypeLineEnd, true);
                     e.Handled = true;
                 }
             }
@@ -1747,9 +1751,9 @@ namespace PDFViewer
 
         private void CommandBinding_Executed_ControlRightPanel(object sender, ExecutedRoutedEventArgs e)
         {
-            RightPanelButton.IsChecked = !RightPanelButton.IsChecked; 
+            RightPanelButton.IsChecked = !RightPanelButton.IsChecked;
             ControlRightPanel();
-        } 
+        }
 
         private void CommandBinding_Executed_Bookmark(object sender, ExecutedRoutedEventArgs e)
         {
@@ -1803,7 +1807,7 @@ namespace PDFViewer
             ViewSettingBtn.IsChecked = !ViewSettingBtn.IsChecked;
             ShowViewSettings();
         }
-         
+
         private void CommandBinding_Executed_DocumentInfo(object sender, ExecutedRoutedEventArgs e)
         {
             if (PopupBorder.Visibility != Visibility.Visible)
@@ -1814,7 +1818,7 @@ namespace PDFViewer
                 PopupBorder.Visibility = Visibility.Visible;
             }
             else
-            { 
+            {
                 FileInfoUI.Visibility = Visibility.Collapsed;
                 PopupBorder.Visibility = Visibility.Collapsed;
             }

BIN
Demo/Examples/packages/ComPDFKit.NetFramework.1.9.0/build/x64/ComPDFKit.dll


BIN
Demo/Examples/packages/ComPDFKit.NetFramework.1.9.0/lib/ComPDFKit.Viewer.dll