├── .gitignore
├── README.md
├── SmithHtmlEditor.Demo
├── App.xaml
├── App.xaml.cs
├── BindingTestWindow.xaml
├── BindingTestWindow.xaml.cs
├── MainWindow.xaml
├── MainWindow.xaml.cs
├── Resources
│ ├── Resource.Designer.cs
│ └── Resource.resx
└── SmithHtmlEditor.Demo.csproj
├── SmithHtmlEditor.sln
├── SmithHtmlEditor
├── Extensions
│ ├── ColorExtension.cs
│ ├── FrameworkElementExtension.cs
│ ├── HtmlEditingExtension.cs
│ └── HtmlExtension.cs
├── Features
│ ├── AttachedBehaviors.cs
│ ├── HtmlEditingCommands.cs
│ └── ValueConverter.cs
├── Models
│ ├── Enum.cs
│ ├── FontSize.cs
│ ├── HtmlDocument.cs
│ ├── HtmlObject.cs
│ ├── OptionObject.cs
│ └── WordCounter.cs
├── Resources
│ ├── Images
│ │ ├── ZoomIn.png
│ │ ├── ZoomOut.png
│ │ ├── bold.png
│ │ ├── browser.png
│ │ ├── center.png
│ │ ├── code.png
│ │ ├── copy.png
│ │ ├── cut.png
│ │ ├── del.png
│ │ ├── erase.png
│ │ ├── error.png
│ │ ├── find.png
│ │ ├── fontcolor.png
│ │ ├── goto.png
│ │ ├── help.png
│ │ ├── htmlcode.png
│ │ ├── hyperlink.png
│ │ ├── image.png
│ │ ├── indent.png
│ │ ├── italic.png
│ │ ├── left.png
│ │ ├── linecolor.png
│ │ ├── listbullets.png
│ │ ├── listnumbered.png
│ │ ├── new.png
│ │ ├── open.png
│ │ ├── outdent.png
│ │ ├── paste.png
│ │ ├── print.png
│ │ ├── prop.png
│ │ ├── redo.png
│ │ ├── refresh.png
│ │ ├── replace.png
│ │ ├── right.png
│ │ ├── save.png
│ │ ├── saveas.png
│ │ ├── spelling.png
│ │ ├── stretch.png
│ │ ├── subscript.png
│ │ ├── superscript.png
│ │ ├── table.png
│ │ ├── underline.png
│ │ ├── undo.png
│ │ └── window.png
│ ├── UiText.Designer.cs
│ ├── UiText.en-US.resx
│ ├── UiText.hu-HU.resx
│ ├── UiText.resx
│ └── UiText.zh-CN.resx
├── SmithHtmlEditor.csproj
├── Views
│ ├── ColorPicker.xaml
│ ├── ColorPicker.xaml.cs
│ ├── HtmlEditor.xaml
│ ├── HtmlEditor.xaml.cs
│ ├── HyperlinkDialog.xaml
│ ├── HyperlinkDialog.xaml.cs
│ ├── ImageDialog.xaml
│ ├── ImageDialog.xaml.cs
│ ├── TableDialog.xaml
│ └── TableDialog.xaml.cs
├── obj
│ └── wappublish
│ │ ├── win-x64
│ │ ├── SmithHtmlEditor.csproj.nuget.cache
│ │ ├── SmithHtmlEditor.csproj.nuget.dgspec.json
│ │ ├── SmithHtmlEditor.csproj.nuget.g.props
│ │ ├── SmithHtmlEditor.csproj.nuget.g.targets
│ │ └── project.assets.json
│ │ └── win-x86
│ │ ├── SmithHtmlEditor.csproj.nuget.cache
│ │ ├── SmithHtmlEditor.csproj.nuget.dgspec.json
│ │ ├── SmithHtmlEditor.csproj.nuget.g.props
│ │ ├── SmithHtmlEditor.csproj.nuget.g.targets
│ │ └── project.assets.json
├── smithhtmleditor.config.xml
└── smithhtmleditor.stylesheet.css
└── clean.bat
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 | ##
4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
5 |
6 | Releases/*.apk
7 | Releases/*.ipa
8 | Softwares/
9 | Databases/
10 |
11 | # User-specific files
12 | *.suo
13 | *.user
14 | *.userosscache
15 | *.sln.docstates
16 |
17 | # User-specific files (MonoDevelop/Xamarin Studio)
18 | *.userprefs
19 |
20 | # Build results
21 | [Dd]ebug/
22 | [Dd]ebugPublic/
23 | [Rr]elease/
24 | x64/
25 | x86/
26 | bld/
27 | [Bb]in/
28 | [Oo]bj/
29 | [Ll]og/
30 |
31 | # Visual Studio 2015/2017 cache/options directory
32 | .vs/
33 | # Uncomment if you have tasks that create the project's static files in wwwroot
34 | #wwwroot/
35 |
36 | # Visual Studio 2017 auto generated files
37 | Generated\ Files/
38 |
39 | # MSTest test Results
40 | [Tt]est[Rr]esult*/
41 | [Bb]uild[Ll]og.*
42 |
43 | # NUNIT
44 | *.VisualState.xml
45 | TestResult.xml
46 |
47 | # Build Results of an ATL Project
48 | [Dd]ebugPS/
49 | [Rr]eleasePS/
50 | dlldata.c
51 |
52 | # Benchmark Results
53 | BenchmarkDotNet.Artifacts/
54 |
55 | # .NET Core
56 | project.lock.json
57 | project.fragment.lock.json
58 | artifacts/
59 | **/Properties/launchSettings.json
60 |
61 | # StyleCop
62 | StyleCopReport.xml
63 |
64 | # Files built by Visual Studio
65 | *_i.c
66 | *_p.c
67 | *_i.h
68 | *.ilk
69 | *.meta
70 | *.obj
71 | *.iobj
72 | *.pch
73 | *.pdb
74 | *.ipdb
75 | *.pgc
76 | *.pgd
77 | *.rsp
78 | *.sbr
79 | *.tlb
80 | *.tli
81 | *.tlh
82 | *.tmp
83 | *.tmp_proj
84 | *.log
85 | *.vspscc
86 | *.vssscc
87 | .builds
88 | *.pidb
89 | *.svclog
90 | *.scc
91 |
92 | # Chutzpah Test files
93 | _Chutzpah*
94 |
95 | # Visual C++ cache files
96 | ipch/
97 | *.aps
98 | *.ncb
99 | *.opendb
100 | *.opensdf
101 | *.sdf
102 | *.cachefile
103 | *.VC.db
104 | *.VC.VC.opendb
105 |
106 | # Visual Studio profiler
107 | *.psess
108 | *.vsp
109 | *.vspx
110 | *.sap
111 |
112 | # Visual Studio Trace Files
113 | *.e2e
114 |
115 | # TFS 2012 Local Workspace
116 | $tf/
117 |
118 | # Guidance Automation Toolkit
119 | *.gpState
120 |
121 | # ReSharper is a .NET coding add-in
122 | _ReSharper*/
123 | *.[Rr]e[Ss]harper
124 | *.DotSettings.user
125 |
126 | # JustCode is a .NET coding add-in
127 | .JustCode
128 |
129 | # TeamCity is a build add-in
130 | _TeamCity*
131 |
132 | # DotCover is a Code Coverage Tool
133 | *.dotCover
134 |
135 | # AxoCover is a Code Coverage Tool
136 | .axoCover/*
137 | !.axoCover/settings.json
138 |
139 | # Visual Studio code coverage results
140 | *.coverage
141 | *.coveragexml
142 |
143 | # NCrunch
144 | _NCrunch_*
145 | .*crunch*.local.xml
146 | nCrunchTemp_*
147 |
148 | # MightyMoose
149 | *.mm.*
150 | AutoTest.Net/
151 |
152 | # Web workbench (sass)
153 | .sass-cache/
154 |
155 | # Installshield output folder
156 | [Ee]xpress/
157 |
158 | # DocProject is a documentation generator add-in
159 | DocProject/buildhelp/
160 | DocProject/Help/*.HxT
161 | DocProject/Help/*.HxC
162 | DocProject/Help/*.hhc
163 | DocProject/Help/*.hhk
164 | DocProject/Help/*.hhp
165 | DocProject/Help/Html2
166 | DocProject/Help/html
167 |
168 | # Click-Once directory
169 | publish/
170 |
171 | # Publish Web Output
172 | *.[Pp]ublish.xml
173 | *.azurePubxml
174 | # Note: Comment the next line if you want to checkin your web deploy settings,
175 | # but database connection strings (with potential passwords) will be unencrypted
176 | *.pubxml
177 | *.publishproj
178 |
179 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
180 | # checkin your Azure Web App publish settings, but sensitive information contained
181 | # in these scripts will be unencrypted
182 | PublishScripts/
183 |
184 | # NuGet Packages
185 | *.nupkg
186 | # The packages folder can be ignored because of Package Restore
187 | **/[Pp]ackages/*
188 | # except build/, which is used as an MSBuild target.
189 | !**/[Pp]ackages/build/
190 | # Uncomment if necessary however generally it will be regenerated when needed
191 | #!**/[Pp]ackages/repositories.config
192 | # NuGet v3's project.json files produces more ignorable files
193 | *.nuget.props
194 | *.nuget.targets
195 |
196 | # Microsoft Azure Build Output
197 | csx/
198 | *.build.csdef
199 |
200 | # Microsoft Azure Emulator
201 | ecf/
202 | rcf/
203 |
204 | # Windows Store app package directories and files
205 | AppPackages/
206 | BundleArtifacts/
207 | Package.StoreAssociation.xml
208 | _pkginfo.txt
209 | *.appx
210 |
211 | # Visual Studio cache files
212 | # files ending in .cache can be ignored
213 | *.[Cc]ache
214 | # but keep track of directories ending in .cache
215 | !*.[Cc]ache/
216 |
217 | # Others
218 | ClientBin/
219 | ~$*
220 | *~
221 | *.dbmdl
222 | *.dbproj.schemaview
223 | *.jfm
224 | *.pfx
225 | *.publishsettings
226 | orleans.codegen.cs
227 |
228 | # Including strong name files can present a security risk
229 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
230 | #*.snk
231 |
232 | # Since there are multiple workflows, uncomment next line to ignore bower_components
233 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
234 | #bower_components/
235 |
236 | # RIA/Silverlight projects
237 | Generated_Code/
238 |
239 | # Backup & report files from converting an old project file
240 | # to a newer Visual Studio version. Backup files are not needed,
241 | # because we have git ;-)
242 | _UpgradeReport_Files/
243 | Backup*/
244 | UpgradeLog*.XML
245 | UpgradeLog*.htm
246 | ServiceFabricBackup/
247 | *.rptproj.bak
248 |
249 | # SQL Server files
250 | *.mdf
251 | *.ldf
252 | *.ndf
253 |
254 | # Business Intelligence projects
255 | *.rdl.data
256 | *.bim.layout
257 | *.bim_*.settings
258 | *.rptproj.rsuser
259 |
260 | # Microsoft Fakes
261 | FakesAssemblies/
262 |
263 | # GhostDoc plugin setting file
264 | *.GhostDoc.xml
265 |
266 | # Node.js Tools for Visual Studio
267 | .ntvs_analysis.dat
268 | node_modules/
269 |
270 | # Visual Studio 6 build log
271 | *.plg
272 |
273 | # Visual Studio 6 workspace options file
274 | *.opt
275 |
276 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
277 | *.vbw
278 |
279 | # Visual Studio LightSwitch build output
280 | **/*.HTMLClient/GeneratedArtifacts
281 | **/*.DesktopClient/GeneratedArtifacts
282 | **/*.DesktopClient/ModelManifest.xml
283 | **/*.Server/GeneratedArtifacts
284 | **/*.Server/ModelManifest.xml
285 | _Pvt_Extensions
286 |
287 | # Paket dependency manager
288 | .paket/paket.exe
289 | paket-files/
290 |
291 | # FAKE - F# Make
292 | .fake/
293 |
294 | # JetBrains Rider
295 | .idea/
296 | *.sln.iml
297 |
298 | # CodeRush
299 | .cr/
300 |
301 | # Python Tools for Visual Studio (PTVS)
302 | __pycache__/
303 | *.pyc
304 |
305 | # Cake - Uncomment if you are using it
306 | # tools/**
307 | # !tools/packages.config
308 |
309 | # Tabs Studio
310 | *.tss
311 |
312 | # Telerik's JustMock configuration file
313 | *.jmconfig
314 |
315 | # BizTalk build output
316 | *.btp.cs
317 | *.btm.cs
318 | *.odx.cs
319 | *.xsd.cs
320 |
321 | # OpenCover UI analysis results
322 | OpenCover/
323 |
324 | # Azure Stream Analytics local run output
325 | ASALocalRun/
326 |
327 | # MSBuild Binary and Structured Log
328 | *.binlog
329 |
330 | # NVidia Nsight GPU debugger configuration file
331 | *.nvuser
332 |
333 | # MFractors (Xamarin productivity tool) working folder
334 | .mfractor/
335 | /Source/LMA.Android/Resources/Resource.designer.cs
336 | /Dependences/XAML to HTML Conversion Demo.zip
337 | /Dependences/smithhtmleditor.zip
338 | /Scripts/nuget/Nuget API key.txt
339 | /Scripts/nuget/publish.bat
340 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # wpf-html-editor #
2 |
3 |
4 |
5 | WYSIWYG rich text editor which enables writing content directly inside of wpf applications.
6 |
7 | Read more on html editor
8 |
9 | 
10 |
11 | ## Installation ##
12 | Click here to get html editor related DLL. Download DLL from this link and add reference of this DLL into your WPF application.
13 |
14 | ## Steps ##
15 |
16 |
17 | 1. Add below assembly in your XAML page like below:
18 |
19 | xmlns:smith="clr-namespace:Smith.WPF.HtmlEditor;assembly=Smith.WPF.HtmlEditor"
20 |
21 | 2. Insert editor using assembly name in your XAML page like below:
22 |
23 |
24 |
25 |
26 | ## Let us know! ##
27 | I’d be really happy if you sent us links to your projects where you use our component. Just send an email to [adambarath@msn.com](mailto:adambarath@msn.com "adambarath@msn.com") and do let us know if you have any questions or suggestion regarding wpf.
28 | Skype: @adambarath
29 |
30 | ## Updates ##
31 |
32 | 2020/05/06
33 | 1. extend target frameworks to netcoreapp3.0;netcoreapp3.1;net461;net462;net47;net471;net472;net48
34 | 2. add pre-build event to do dotnet restore. Issue description at https://stackoverflow.com/questions/48440223/assets-file-project-assets-json-not-found-run-a-nuget-package-restore
35 |
36 | 2019/10/31
37 | 1. update to NetCore 3.0
38 |
39 | 2011/05/02
40 | 1. Add a dependency property named BindingContent to support binding html content to the editor. This property raise update notification via the StatusTextChanged event of the webbrowser control. A new window named BindingTestWindow in SmithHtmlEditor.Demo show how this property works.
41 | 2. A stylesheet is load from the file "smithhtmleditor.stylesheet.css" to set the default style of the editing document when the control is initializing. This can help us to set how the document looks.
42 | 3. Use the xml file "smithhtmleditor.config.xml" to setup the fonts used in the control. So we can configurate the fonts we need.
43 | 4. Update the appearance of the editor under source mode.
44 |
45 | 2011/01/23
46 | 1. Add HtmlDocument class and HtmlDocument.Range class for document editing instead of directly operating IHTMLDocument2 interface and System.Windows.Forms.HtmlDocument object.
47 | 2. Update HtmlEditingExtension class to extension methods for HtmlDocument object. And some methods were moved into HtmlDocument class.
48 | 3. Fix a bug in HtmlEditor.WordCount property.
49 | 4. Update the HtmlEditor.ContentText property as a get-only property.
50 | 5. The HtmlEditor.Document property is changed from type System.Windows.Forms.HtmlDocument to Smith.WPF.HtmlEditor.HtmlDocument.
51 | 6. Add editing methods for HtmlEditor class.
52 | 7. Add DocumentReady event for HtmlEditor class. This event will be raised after the document is ready to use. And it provides a way to load initial content to editor. See the demo.
53 | 8. Add DocumentStateChanged event for HtmlEditor class to notify the change of document state.
54 |
55 | 2010/11/20
56 | Upgraded the word counting algorithm and fixed a bug in color selecting.
57 |
58 | 2010/10/19
59 | Globlization and localization feature is added into this version.
60 |
61 | 2010/10/17
62 | It is a preview version for test and provides basic functions for common use.
63 |
64 |
65 | ## License ##
66 |
67 | MIT License
68 |
69 | Permission is hereby granted, free of charge, to any person obtaining a copy
70 | of this software and associated documentation files (the "Software"), to deal
71 | in the Software without restriction, including without limitation the rights
72 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
73 | copies of the Software, and to permit persons to whom the Software is
74 | furnished to do so, subject to the following conditions:
75 |
76 | The above copyright notice and this permission notice shall be included in all
77 | copies or substantial portions of the Software.
78 |
79 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
80 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
81 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
82 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
83 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
84 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
85 | SOFTWARE.
86 |
--------------------------------------------------------------------------------
/SmithHtmlEditor.Demo/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/SmithHtmlEditor.Demo/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Windows;
7 | using System.Globalization;
8 | using System.Threading;
9 | using System.Windows.Markup;
10 |
11 | namespace Smith.WPF.HtmlEditor.Demo
12 | {
13 | ///
14 | /// App.xaml 的交互逻辑
15 | ///
16 | public partial class App : Application
17 | {
18 | protected override void OnStartup(StartupEventArgs e)
19 | {
20 | CultureInfo culture = null;
21 |
22 | if (culture != null)
23 | {
24 | Thread.CurrentThread.CurrentCulture = culture;
25 | Thread.CurrentThread.CurrentUICulture = culture;
26 | }
27 |
28 | FrameworkElement.LanguageProperty.OverrideMetadata(
29 | typeof(FrameworkElement), new FrameworkPropertyMetadata(
30 | XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag)));
31 |
32 | base.OnStartup(e);
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/SmithHtmlEditor.Demo/BindingTestWindow.xaml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 |
12 |
13 |
15 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/SmithHtmlEditor.Demo/BindingTestWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows;
6 | using System.Windows.Controls;
7 | using System.Windows.Data;
8 | using System.Windows.Documents;
9 | using System.Windows.Input;
10 | using System.Windows.Media;
11 | using System.Windows.Media.Imaging;
12 | using System.Windows.Shapes;
13 |
14 | namespace Smith.WPF.HtmlEditor.Demo
15 | {
16 | ///
17 | /// BindingTestWindow.xaml 的交互逻辑
18 | ///
19 | public partial class BindingTestWindow : Window
20 | {
21 | public BindingTestWindow()
22 | {
23 | InitializeComponent();
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/SmithHtmlEditor.Demo/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
19 |
23 |
24 |
25 |
29 |
30 |
32 |
35 |
38 |
41 |
42 |
43 |
44 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/SmithHtmlEditor.Demo/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows;
3 | using System.Windows.Threading;
4 |
5 | namespace Smith.WPF.HtmlEditor.Demo
6 | {
7 | ///
8 | /// MainWindow.xaml 的交互逻辑
9 | ///
10 | public partial class MainWindow : Window
11 | {
12 | DispatcherTimer wordCountTimer;
13 |
14 | public MainWindow()
15 | {
16 | InitializeComponent();
17 | InitEvents();
18 | InitTimer();
19 | }
20 |
21 | void InitEvents()
22 | {
23 | this.Loaded += new RoutedEventHandler(MainWindow_Loaded);
24 | this.Unloaded += new RoutedEventHandler(MainWindow_Unloaded);
25 | Editor.DocumentReady += new RoutedEventHandler(Editor_DocumentReady);
26 | GetHtmlButton.Click += new RoutedEventHandler(GetHtmlButton_Click);
27 | GetTextButton.Click += new RoutedEventHandler(GetTextButton_Click);
28 | BindingTestButton.Click += new RoutedEventHandler(BindingTestButton_Click);
29 | }
30 |
31 | void BindingTestButton_Click(object sender, RoutedEventArgs e)
32 | {
33 | BindingTestWindow w = new BindingTestWindow();
34 | w.WindowStartupLocation = WindowStartupLocation.CenterOwner;
35 | w.Owner = this;
36 | w.ShowDialog();
37 | }
38 |
39 | void Editor_DocumentReady(object sender, RoutedEventArgs e)
40 | {
41 | // Always load initial content for editor in DocumentReady event
42 | Editor.ContentHtml = "
Smith Html Editor
http://smithhtmleditor.codeplex.com/
";
43 | }
44 |
45 | void GetTextButton_Click(object sender, RoutedEventArgs e)
46 | {
47 | MessageBox.Show(Editor.ContentText);
48 | }
49 |
50 | void GetHtmlButton_Click(object sender, RoutedEventArgs e)
51 | {
52 | MessageBox.Show(Editor.ContentHtml);
53 | }
54 |
55 | void MainWindow_Loaded(object sender, RoutedEventArgs e)
56 | {
57 | wordCountTimer.Start();
58 | }
59 |
60 | void MainWindow_Unloaded(object sender, RoutedEventArgs e)
61 | {
62 | wordCountTimer.Stop();
63 | }
64 |
65 | void InitTimer()
66 | {
67 | wordCountTimer = new DispatcherTimer();
68 | wordCountTimer.Interval = TimeSpan.FromMilliseconds(500);
69 | wordCountTimer.Tick += new EventHandler(wordCountTimer_Tick);
70 | }
71 |
72 | void wordCountTimer_Tick(object sender, EventArgs e)
73 | {
74 | WordCountText.Content = Editor.WordCount;
75 | }
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/SmithHtmlEditor.Demo/Resources/Resource.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace SmithHtmlEditor.Demo.Resources {
12 | using System;
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | public class Resource {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resource() {
33 | }
34 |
35 | ///
36 | /// Returns the cached ResourceManager instance used by this class.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | public static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SmithHtmlEditor.Demo.Resources.Resource", typeof(Resource).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Overrides the current thread's CurrentUICulture property for all
51 | /// resource lookups using this strongly typed resource class.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | public static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 |
63 | ///
64 | /// Looks up a localized string similar to Get HTML.
65 | ///
66 | public static string Button_GetHtml {
67 | get {
68 | return ResourceManager.GetString("Button_GetHtml", resourceCulture);
69 | }
70 | }
71 |
72 | ///
73 | /// Looks up a localized string similar to Get Text.
74 | ///
75 | public static string Button_GetText {
76 | get {
77 | return ResourceManager.GetString("Button_GetText", resourceCulture);
78 | }
79 | }
80 |
81 | ///
82 | /// Looks up a localized string similar to Word Count: .
83 | ///
84 | public static string Label_WordCount {
85 | get {
86 | return ResourceManager.GetString("Label_WordCount", resourceCulture);
87 | }
88 | }
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/SmithHtmlEditor.Demo/Resources/Resource.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | Get HTML
122 |
123 |
124 | Get Text
125 |
126 |
127 | Word Count:
128 |
129 |
--------------------------------------------------------------------------------
/SmithHtmlEditor.Demo/SmithHtmlEditor.Demo.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | WinExe
4 | netcoreapp3.0
5 | true
6 | win-x86
7 | true
8 | true
9 |
10 |
11 |
12 | x86
13 |
14 |
15 |
16 |
17 | 3050f1c5-98b5-11cf-bb82-00aa00bdce0b
18 | 4
19 | 0
20 | tlbimp
21 | 0
22 | false
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | Resource.resx
33 | True
34 | True
35 |
36 |
37 | PublicResXFileCodeGenerator
38 | Resource.Designer.cs
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/SmithHtmlEditor.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.30011.22
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_Core", "_Core", "{13A72214-F515-4A3B-A326-97D515EF988A}"
7 | EndProject
8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test", "Test", "{E48D935A-0EDC-4A36-8B3F-042D0FF35A00}"
9 | EndProject
10 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SmithHtmlEditor", "SmithHtmlEditor\SmithHtmlEditor.csproj", "{F7BF772A-2646-4EFF-BD6C-FA8A48BD7340}"
11 | EndProject
12 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SmithHtmlEditor.Demo", "SmithHtmlEditor.Demo\SmithHtmlEditor.Demo.csproj", "{DBCE0725-B05D-4262-9173-32EAE4E36E0A}"
13 | EndProject
14 | Global
15 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
16 | Debug|Any CPU = Debug|Any CPU
17 | Release|Any CPU = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
20 | {F7BF772A-2646-4EFF-BD6C-FA8A48BD7340}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21 | {F7BF772A-2646-4EFF-BD6C-FA8A48BD7340}.Debug|Any CPU.Build.0 = Debug|Any CPU
22 | {F7BF772A-2646-4EFF-BD6C-FA8A48BD7340}.Release|Any CPU.ActiveCfg = Release|Any CPU
23 | {F7BF772A-2646-4EFF-BD6C-FA8A48BD7340}.Release|Any CPU.Build.0 = Release|Any CPU
24 | {DBCE0725-B05D-4262-9173-32EAE4E36E0A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
25 | {DBCE0725-B05D-4262-9173-32EAE4E36E0A}.Debug|Any CPU.Build.0 = Debug|Any CPU
26 | {DBCE0725-B05D-4262-9173-32EAE4E36E0A}.Release|Any CPU.ActiveCfg = Release|Any CPU
27 | {DBCE0725-B05D-4262-9173-32EAE4E36E0A}.Release|Any CPU.Build.0 = Release|Any CPU
28 | EndGlobalSection
29 | GlobalSection(SolutionProperties) = preSolution
30 | HideSolutionNode = FALSE
31 | EndGlobalSection
32 | GlobalSection(NestedProjects) = preSolution
33 | {F7BF772A-2646-4EFF-BD6C-FA8A48BD7340} = {13A72214-F515-4A3B-A326-97D515EF988A}
34 | {DBCE0725-B05D-4262-9173-32EAE4E36E0A} = {E48D935A-0EDC-4A36-8B3F-042D0FF35A00}
35 | EndGlobalSection
36 | GlobalSection(ExtensibilityGlobals) = postSolution
37 | SolutionGuid = {0DF8BBA1-1A19-4601-A90A-22AF96E7B137}
38 | EndGlobalSection
39 | EndGlobal
40 |
--------------------------------------------------------------------------------
/SmithHtmlEditor/Extensions/ColorExtension.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Smith.WPF.HtmlEditor
4 | {
5 | ///
6 | /// 提供 System.Drawing.Color 和 System.Windows.Media.Color 之间的转换方法。
7 | /// To provide methods to handle convertion between System.Drawing.Color and System.Windows.Media.Color.
8 | ///
9 | internal static class ColorExtension
10 | {
11 | ///
12 | /// 将 System.Drawing.Color 转换到 System.Windows.Media.Color。
13 | /// Convert System.Drawing.Color to System.Windows.Media.Color.
14 | ///
15 | public static System.Windows.Media.Color ColorConvert(this System.Drawing.Color color)
16 | {
17 | return System.Windows.Media.Color.FromArgb(color.A, color.R, color.G, color.B);
18 | }
19 |
20 | ///
21 | /// 将 System.Windows.Media.Color 转换到 System.Drawing.Color。
22 | /// Convert System.Windows.Media.Color to System.Drawing.Color.
23 | ///
24 | public static System.Drawing.Color ColorConvert(this System.Windows.Media.Color color)
25 | {
26 | return System.Drawing.Color.FromArgb(color.A, color.R, color.G, color.B);
27 | }
28 |
29 | ///
30 | /// 判断 System.Drawing.Color 和 System.Windows.Media.Color 是否表示相同的颜色。
31 | ///
32 | public static bool ColorEqual(this System.Drawing.Color drawingColor, System.Windows.Media.Color mediaColor)
33 | {
34 | return (drawingColor.A == mediaColor.A &&
35 | drawingColor.R == mediaColor.R &&
36 | drawingColor.G == mediaColor.G &&
37 | drawingColor.B == mediaColor.B);
38 | }
39 |
40 | ///
41 | /// 判断 System.Windows.Media.Color 和 System.Drawing.Color 是否表示相同的颜色。
42 | ///
43 | public static bool ColorEqual(this System.Windows.Media.Color mediaColor, System.Drawing.Color drawingColor)
44 | {
45 | return (drawingColor.A == mediaColor.A &&
46 | drawingColor.R == mediaColor.R &&
47 | drawingColor.G == mediaColor.G &&
48 | drawingColor.B == mediaColor.B);
49 | }
50 |
51 | ///
52 | /// 将表达式转换到 System.Windows.Media.Color。
53 | /// Convert an expression to System.Windows.Media.Color.
54 | ///
55 | public static System.Windows.Media.Color ConvertToColor(string value)
56 | {
57 | return (System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString(value);
58 | //int r = 0, g = 0, b = 0;
59 | //if (value.StartsWith("#"))
60 | //{
61 | // int v = Convert.ToInt32(value.Substring(1), 16);
62 | // r = (v >> 16) & 255; g = (v >> 8) & 255; b = v & 255;
63 | //}
64 | //return System.Windows.Media.Color.FromRgb(Convert.ToByte(r), Convert.ToByte(g), Convert.ToByte(b));
65 | }
66 |
67 | public static readonly System.Windows.Media.Color DefaultBackColor = System.Windows.SystemColors.WindowColor;
68 |
69 | public static readonly System.Windows.Media.Color DefaultForeColor = System.Windows.SystemColors.WindowTextColor;
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/SmithHtmlEditor/Extensions/FrameworkElementExtension.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | namespace Smith.WPF.HtmlEditor
4 | {
5 | internal static class FrameworkElementExtension
6 | {
7 | ///
8 | /// Get the window container of framework element.
9 | ///
10 | public static Window GetParentWindow(this FrameworkElement element)
11 | {
12 | DependencyObject dp = element;
13 | while (dp != null)
14 | {
15 | DependencyObject tp = LogicalTreeHelper.GetParent(dp);
16 | if (tp is Window) return tp as Window;
17 | else dp = tp;
18 | }
19 | return null;
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/SmithHtmlEditor/Extensions/HtmlExtension.cs:
--------------------------------------------------------------------------------
1 | using System.Text.RegularExpressions;
2 | namespace Smith.WPF.HtmlEditor
3 | {
4 | internal static class HtmlExtension
5 | {
6 | ///
7 | /// Perform html encoding.
8 | ///
9 | public static string HtmlEncoding(this string value)
10 | {
11 | if (!string.IsNullOrEmpty(value))
12 | {
13 | value = value.Replace("<", "<");
14 | value = value.Replace(">", ">");
15 | value = value.Replace(" ", " ");
16 | value = value.Replace("\"", """);
17 | value = value.Replace("\'", "'");
18 | value = value.Replace("&", "&");
19 | return value;
20 | }
21 | return string.Empty;
22 | }
23 |
24 | ///
25 | /// Perform html decoding.
26 | ///
27 | public static string HtmlDecoding(this string value)
28 | {
29 | if (!string.IsNullOrEmpty(value))
30 | {
31 | value = value.Replace("<", "<");
32 | value = value.Replace(">", ">");
33 | value = value.Replace(" ", " ");
34 | value = value.Replace(""", "\"");
35 | value = value.Replace("'", "\'");
36 | value = value.Replace("&", "&");
37 | return value;
38 | }
39 | return string.Empty;
40 | }
41 |
42 | ///
43 | /// Filter all html tags.
44 | ///
45 | public static string FilterAllTags(this string value)
46 | {
47 | Regex match = new Regex("<[^>]+>");
48 | return match.Replace(value, string.Empty);
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/SmithHtmlEditor/Features/AttachedBehaviors.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Text;
3 | using System.Windows;
4 | using System.Windows.Controls;
5 | using System.Windows.Input;
6 |
7 | namespace Smith.WPF.HtmlEditor
8 | {
9 | internal static class PositiveIntegerInput
10 | {
11 | public static readonly DependencyProperty EnableProperty =
12 | DependencyProperty.RegisterAttached("Enable",
13 | typeof(bool), typeof(PositiveIntegerInput), new FrameworkPropertyMetadata(false, OnEnableChanged));
14 |
15 | public static bool GetEnable(DependencyObject obj)
16 | {
17 | return (bool)obj.GetValue(EnableProperty);
18 | }
19 |
20 | public static void SetEnable(DependencyObject obj, bool value)
21 | {
22 | obj.SetValue(EnableProperty, value);
23 | }
24 |
25 | static KeyEventHandler keyDownEventHandler = new KeyEventHandler(HandleKeyDown);
26 | static TextCompositionEventHandler textInputEventHandler = new TextCompositionEventHandler(HandleTextInput);
27 | static RoutedEventHandler lostFocusEventHandler = new RoutedEventHandler(HandleLostFocus);
28 |
29 | static void OnEnableChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
30 | {
31 | TextBox textbox = sender as TextBox;
32 | if (textbox != null && e.NewValue is bool)
33 | {
34 | if ((bool)e.NewValue)
35 | {
36 | textbox.AddHandler(TextBox.PreviewKeyDownEvent, keyDownEventHandler);
37 | textbox.AddHandler(TextBox.PreviewTextInputEvent, textInputEventHandler);
38 | textbox.AddHandler(TextBox.LostFocusEvent, lostFocusEventHandler);
39 | DataObject.AddPastingHandler(textbox, HandlePasting);
40 | }
41 | else
42 | {
43 | textbox.RemoveHandler(TextBox.PreviewKeyDownEvent, keyDownEventHandler);
44 | textbox.RemoveHandler(TextBox.PreviewTextInputEvent, textInputEventHandler);
45 | textbox.RemoveHandler(TextBox.LostFocusEvent, lostFocusEventHandler);
46 | DataObject.RemovePastingHandler(textbox, HandlePasting);
47 | }
48 | }
49 | }
50 |
51 | ///
52 | /// 响应粘贴事件
53 | ///
54 | static void HandlePasting(object sender, DataObjectPastingEventArgs e)
55 | {
56 | string content = e.DataObject.GetData(typeof(string)) as string;
57 | HandleInput((TextBox)sender, content);
58 | e.CancelCommand();
59 | e.Handled = true;
60 | }
61 |
62 | ///
63 | /// 响应失去焦点事件
64 | ///
65 | static void HandleLostFocus(object sender, RoutedEventArgs e)
66 | {
67 | TextBox tb = sender as TextBox;
68 | if (tb != null) tb.GetBindingExpression(TextBox.TextProperty).UpdateTarget();
69 | }
70 |
71 | ///
72 | /// 响应文本输入事件
73 | ///
74 | static void HandleTextInput(object sender, TextCompositionEventArgs e)
75 | {
76 | e.Handled = true;
77 | HandleInput((TextBox)sender, e.Text);
78 | }
79 |
80 | ///
81 | /// 响应键盘按键事件
82 | ///
83 | static void HandleKeyDown(object sender, KeyEventArgs e)
84 | {
85 | if (e.Key == Key.Space)
86 | {
87 | e.Handled = true;
88 | }
89 | else if (e.Key == Key.Back)
90 | {
91 | e.Handled = true;
92 | HandleBackspaceKeyInput((TextBox)sender);
93 | }
94 | else if (e.Key == Key.Delete)
95 | {
96 | e.Handled = true;
97 | HandleDeleteKeyInput((TextBox)sender);
98 | }
99 | }
100 |
101 | ///
102 | /// 处理文本输入
103 | ///
104 | static void HandleInput(TextBox textBox, string inputValue)
105 | {
106 | inputValue = inputValue.Trim();
107 | if (string.IsNullOrEmpty(inputValue)) return;
108 |
109 | int caret = textBox.CaretIndex;
110 | StringBuilder xb = new StringBuilder(textBox.Text);
111 | if (textBox.SelectionLength > 0)
112 | {
113 | xb.Remove(textBox.SelectionStart, textBox.SelectionLength);
114 | caret = textBox.SelectionStart;
115 | }
116 | xb.Insert(caret, inputValue);
117 | string sign = xb.ToString();
118 | if (ValidChanges(sign))
119 | {
120 | textBox.Text = sign;
121 | textBox.CaretIndex = caret + inputValue.Length;
122 | }
123 | }
124 |
125 | ///
126 | /// 处理退格键输入
127 | ///
128 | static void HandleBackspaceKeyInput(TextBox textBox)
129 | {
130 | if (textBox.SelectionLength > 0)
131 | {
132 | int caret = textBox.SelectionStart;
133 | string sign = textBox.Text.Remove(textBox.SelectionStart, textBox.SelectionLength);
134 | if (ValidChanges(sign))
135 | {
136 | textBox.Text = sign;
137 | textBox.CaretIndex = caret;
138 | }
139 | }
140 | else if (textBox.CaretIndex > 0)
141 | {
142 | int caret = textBox.CaretIndex;
143 | string sign = textBox.Text.Remove(caret - 1, 1);
144 | if (ValidChanges(sign))
145 | {
146 | textBox.Text = sign;
147 | textBox.CaretIndex = caret - 1;
148 | }
149 | }
150 | }
151 |
152 | ///
153 | /// 处理删除键操作
154 | ///
155 | static void HandleDeleteKeyInput(TextBox textBox)
156 | {
157 | if (textBox.SelectionLength > 0)
158 | {
159 | int caret = textBox.SelectionStart;
160 | string sign = textBox.Text.Remove(textBox.SelectionStart, textBox.SelectionLength);
161 | if (ValidChanges(sign))
162 | {
163 | textBox.Text = sign;
164 | textBox.CaretIndex = caret;
165 | }
166 | }
167 | else
168 | {
169 | int caret = textBox.CaretIndex;
170 | string sign = textBox.Text.Remove(caret, 1);
171 | if (ValidChanges(sign))
172 | {
173 | textBox.Text = sign;
174 | textBox.CaretIndex = caret;
175 | }
176 | }
177 | }
178 |
179 | ///
180 | /// 检验输入是否有效
181 | ///
182 | static bool ValidChanges(string value)
183 | {
184 | int val;
185 | return Int32.TryParse(value, out val);
186 | }
187 | }
188 |
189 | internal static class ScrollViewContentDragable
190 | {
191 | public static readonly DependencyProperty EnableProperty =
192 | DependencyProperty.RegisterAttached("Enable",
193 | typeof(bool), typeof(ScrollViewContentDragable), new FrameworkPropertyMetadata(false, OnEnableChanged));
194 |
195 | public static bool GetEnable(DependencyObject obj)
196 | {
197 | return (bool)obj.GetValue(EnableProperty);
198 | }
199 |
200 | public static void SetEnable(DependencyObject obj, bool value)
201 | {
202 | obj.SetValue(EnableProperty, value);
203 | }
204 |
205 | static readonly DependencyProperty StartPointProperty =
206 | DependencyProperty.RegisterAttached("StartPoint",
207 | typeof(Point), typeof(ScrollViewContentDragable), new FrameworkPropertyMetadata(new Point(0, 0)));
208 |
209 | static Point GetStartPoint(DependencyObject obj)
210 | {
211 | return (Point)obj.GetValue(StartPointProperty);
212 | }
213 |
214 | static void SetStartPoint(DependencyObject obj, Point value)
215 | {
216 | obj.SetValue(StartPointProperty, value);
217 | }
218 |
219 | static void OnEnableChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
220 | {
221 | ScrollViewer scrollviewer = sender as ScrollViewer;
222 | if (scrollviewer != null && e.NewValue is bool &&
223 | scrollviewer.Content != null && scrollviewer.Content is FrameworkElement)
224 | {
225 | FrameworkElement fe = scrollviewer.Content as FrameworkElement;
226 | if ((bool)e.NewValue)
227 | {
228 | SetStartPoint(scrollviewer, new Point(-1, -1));
229 | fe.AddHandler(FrameworkElement.PreviewMouseDownEvent, mouseButtonDownHandle);
230 | fe.AddHandler(FrameworkElement.PreviewMouseUpEvent, mouseButtonUpHandle);
231 | fe.AddHandler(FrameworkElement.PreviewMouseMoveEvent, mouseMoveHandle);
232 | }
233 | else
234 | {
235 | fe.RemoveHandler(FrameworkElement.PreviewMouseDownEvent, mouseButtonDownHandle);
236 | fe.RemoveHandler(FrameworkElement.PreviewMouseUpEvent, mouseButtonUpHandle);
237 | fe.RemoveHandler(FrameworkElement.PreviewMouseMoveEvent, mouseMoveHandle);
238 | }
239 | }
240 | }
241 |
242 | static void HandleContentMouseMove(object sender, MouseEventArgs e)
243 | {
244 | FrameworkElement fe = sender as FrameworkElement;
245 | if (fe == null) return;
246 |
247 | ScrollViewer sc = fe.Parent as ScrollViewer;
248 | if (sc == null) return;
249 |
250 | Point sp = GetStartPoint(sc);
251 | if (sp.X > 0 && sp.Y > 0)
252 | {
253 | Point p = e.GetPosition(sc);
254 | double dtX = p.X - sp.X;
255 | double dtY = p.Y - sp.Y;
256 | sc.ScrollToHorizontalOffset(sc.ContentHorizontalOffset - dtX);
257 | sc.ScrollToVerticalOffset(sc.ContentVerticalOffset - dtY);
258 | SetStartPoint(sc, new Point(p.X, p.Y));
259 | }
260 | }
261 |
262 | static void HandleContentMouseDown(object sender, MouseButtonEventArgs e)
263 | {
264 | FrameworkElement fe = sender as FrameworkElement;
265 | if (fe == null) return;
266 |
267 | ScrollViewer sc = fe.Parent as ScrollViewer;
268 | if (sc == null) return;
269 |
270 | SetStartPoint(sc, e.GetPosition(sc));
271 | }
272 |
273 | static void HandleContentMouseUp(object sender, MouseButtonEventArgs e)
274 | {
275 | FrameworkElement fe = sender as FrameworkElement;
276 | if (fe == null) return;
277 |
278 | ScrollViewer sc = fe.Parent as ScrollViewer;
279 | if (sc == null) return;
280 |
281 | SetStartPoint(sc, new Point(-1, -1));
282 | }
283 |
284 | static MouseButtonEventHandler mouseButtonDownHandle = new MouseButtonEventHandler(HandleContentMouseDown);
285 | static MouseButtonEventHandler mouseButtonUpHandle = new MouseButtonEventHandler(HandleContentMouseUp);
286 | static MouseEventHandler mouseMoveHandle = new MouseEventHandler(HandleContentMouseMove);
287 | }
288 | }
289 |
--------------------------------------------------------------------------------
/SmithHtmlEditor/Features/HtmlEditingCommands.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Input;
2 |
3 | namespace Smith.WPF.HtmlEditor
4 | {
5 | public static class HtmlEditingCommands
6 | {
7 | #region 文本编辑命令
8 |
9 | ///
10 | /// 撤销命令
11 | ///
12 | public static RoutedUICommand Undo { get { return _undo; } }
13 |
14 | ///
15 | /// 重做命令
16 | ///
17 | public static RoutedUICommand Redo { get { return _redo; } }
18 |
19 | ///
20 | /// 剪切命令
21 | ///
22 | public static RoutedUICommand Cut { get { return _cut; } }
23 |
24 | ///
25 | /// 复制命令
26 | ///
27 | public static RoutedUICommand Copy { get { return _copy; } }
28 |
29 | ///
30 | /// 粘贴命令
31 | ///
32 | public static RoutedUICommand Paste { get { return _paste; } }
33 |
34 | ///
35 | /// 删除命令
36 | ///
37 | public static RoutedUICommand Delete { get { return _delete; } }
38 |
39 | ///
40 | /// 全选命令
41 | ///
42 | public static RoutedUICommand SelectAll { get { return _selectAll; } }
43 |
44 | #endregion
45 |
46 | #region 文本样式命令
47 |
48 | ///
49 | /// 设置粗体命令
50 | ///
51 | public static RoutedUICommand Bold { get { return _bold; } }
52 |
53 | ///
54 | /// 设置斜体命令
55 | ///
56 | public static RoutedUICommand Italic { get { return _italic; } }
57 |
58 | ///
59 | /// 设置下划线命令
60 | ///
61 | public static RoutedUICommand Underline { get { return _underline; } }
62 |
63 | ///
64 | /// 设置下标命令
65 | ///
66 | public static RoutedUICommand Subscript { get { return _subscript; } }
67 |
68 | ///
69 | /// 设置上标命令
70 | ///
71 | public static RoutedUICommand Superscript { get { return _superscript; } }
72 |
73 | ///
74 | /// 清除样式命令
75 | ///
76 | public static RoutedUICommand ClearStyle { get { return _clearStyle; } }
77 |
78 | #endregion
79 |
80 | #region 文本格式命令
81 |
82 | ///
83 | /// 增加缩进命令
84 | ///
85 | public static RoutedUICommand Indent { get { return _indent; } }
86 |
87 | ///
88 | /// 减少缩进命令
89 | ///
90 | public static RoutedUICommand Outdent { get { return _outdent; } }
91 |
92 | ///
93 | /// 无序列表命令
94 | ///
95 | public static RoutedUICommand BubbledList { get { return _bubbledList; } }
96 |
97 | ///
98 | /// 有序列表命令
99 | ///
100 | public static RoutedUICommand NumericList { get { return _numericList; } }
101 |
102 | ///
103 | /// 左对齐命令
104 | ///
105 | public static RoutedUICommand JustifyLeft { get { return _justifyLeft; } }
106 |
107 | ///
108 | /// 右对齐命令
109 | ///
110 | public static RoutedUICommand JustifyRight { get { return _justifyRight; } }
111 |
112 | ///
113 | /// 中间对齐命令
114 | ///
115 | public static RoutedUICommand JustifyCenter { get { return _justifyCenter; } }
116 |
117 | ///
118 | /// 两端对齐命令
119 | ///
120 | public static RoutedUICommand JustifyFull { get { return _justifyFull; } }
121 |
122 | #endregion
123 |
124 | #region 插入对象命令
125 |
126 | ///
127 | /// 插入超链接命令
128 | ///
129 | public static RoutedUICommand InsertHyperlink { get { return _insertHyperlink; } }
130 |
131 | ///
132 | /// 插入图像命令
133 | ///
134 | public static RoutedUICommand InsertImage { get { return _insertImage; } }
135 |
136 | ///
137 | /// 插入表格命令
138 | ///
139 | public static RoutedUICommand InsertTable { get { return _insertTable; } }
140 |
141 | ///
142 | /// 插入代码段命令
143 | ///
144 | public static RoutedUICommand InsertCodeBlock { get { return _insertCodeBlock; } }
145 |
146 | ///
147 | /// 插入换行符命令
148 | ///
149 | public static RoutedUICommand InsertLineBreak { get { return _insertLineBreak; } }
150 |
151 | ///
152 | /// 插入段落命令
153 | ///
154 | public static RoutedUICommand InsertParagraph { get { return _insertParagraph; } }
155 |
156 | #endregion
157 |
158 | #region 非公开字段
159 |
160 | static RoutedUICommand _undo = new RoutedUICommand();
161 | static RoutedUICommand _redo = new RoutedUICommand();
162 | static RoutedUICommand _cut = new RoutedUICommand();
163 | static RoutedUICommand _copy = new RoutedUICommand();
164 | static RoutedUICommand _paste = new RoutedUICommand();
165 | static RoutedUICommand _delete = new RoutedUICommand();
166 | static RoutedUICommand _selectAll = new RoutedUICommand();
167 |
168 | static RoutedUICommand _bold = new RoutedUICommand();
169 | static RoutedUICommand _italic = new RoutedUICommand();
170 | static RoutedUICommand _underline = new RoutedUICommand();
171 | static RoutedUICommand _subscript = new RoutedUICommand();
172 | static RoutedUICommand _superscript = new RoutedUICommand();
173 | static RoutedUICommand _clearStyle = new RoutedUICommand();
174 |
175 | static RoutedUICommand _indent = new RoutedUICommand();
176 | static RoutedUICommand _outdent = new RoutedUICommand();
177 | static RoutedUICommand _bubbledList = new RoutedUICommand();
178 | static RoutedUICommand _numericList = new RoutedUICommand();
179 | static RoutedUICommand _justifyLeft = new RoutedUICommand();
180 | static RoutedUICommand _justifyRight = new RoutedUICommand();
181 | static RoutedUICommand _justifyCenter = new RoutedUICommand();
182 | static RoutedUICommand _justifyFull = new RoutedUICommand();
183 |
184 | static RoutedUICommand _insertHyperlink = new RoutedUICommand();
185 | static RoutedUICommand _insertImage = new RoutedUICommand();
186 | static RoutedUICommand _insertTable = new RoutedUICommand();
187 | static RoutedUICommand _insertCodeBlock = new RoutedUICommand();
188 | static RoutedUICommand _insertLineBreak = new RoutedUICommand();
189 | static RoutedUICommand _insertParagraph = new RoutedUICommand();
190 |
191 | #endregion
192 | }
193 | }
194 |
--------------------------------------------------------------------------------
/SmithHtmlEditor/Features/ValueConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows;
3 | using System.Windows.Data;
4 | using System.Windows.Media;
5 |
6 | namespace Smith.WPF.HtmlEditor
7 | {
8 | [ValueConversion(typeof(object), typeof(bool))]
9 | internal class ObjectToBooleanConverter : IValueConverter
10 | {
11 | public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
12 | {
13 | return value != null;
14 | }
15 |
16 | public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
17 | {
18 | throw new NotImplementedException();
19 | }
20 | }
21 |
22 | [ValueConversion(typeof(string), typeof(bool))]
23 | internal class StringToBooleanConverter : IValueConverter
24 | {
25 | public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
26 | {
27 | return !string.IsNullOrEmpty((string)value);
28 | }
29 |
30 | public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
31 | {
32 | throw new NotImplementedException();
33 | }
34 | }
35 |
36 | [ValueConversion(typeof(object), typeof(Visibility))]
37 | internal class ObjectToVisibilityConverter : IValueConverter
38 | {
39 | public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
40 | {
41 | return value != null ? Visibility.Visible : Visibility.Hidden;
42 | }
43 |
44 | public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
45 | {
46 | throw new NotImplementedException();
47 | }
48 | }
49 |
50 | [ValueConversion(typeof(object), typeof(Visibility))]
51 | internal class ReversedObjectToVisibilityConverter : IValueConverter
52 | {
53 | public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
54 | {
55 | return value != null ? Visibility.Hidden : Visibility.Visible;
56 | }
57 |
58 | public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
59 | {
60 | throw new NotImplementedException();
61 | }
62 | }
63 |
64 | [ValueConversion(typeof(Color), typeof(Brush))]
65 | internal class ColorToBrushConverter : IValueConverter
66 | {
67 | public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
68 | {
69 | return new SolidColorBrush((Color)value);
70 | }
71 |
72 | public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
73 | {
74 | throw new NotImplementedException();
75 | }
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/SmithHtmlEditor/Models/Enum.cs:
--------------------------------------------------------------------------------
1 | namespace Smith.WPF.HtmlEditor
2 | {
3 | public enum HtmlDocumentState
4 | {
5 | Uninitialized,
6 | Loading,
7 | Loaded,
8 | Interactive,
9 | Complete
10 | }
11 |
12 | public enum EditMode
13 | {
14 | Visual,
15 | Source
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/SmithHtmlEditor/Models/FontSize.cs:
--------------------------------------------------------------------------------
1 | namespace Smith.WPF.HtmlEditor
2 | {
3 | public sealed class FontSize
4 | {
5 | public int Key { get; set; }
6 | public double Size { get; set; }
7 | public string Text { get; set; }
8 |
9 | public static readonly FontSize NO = new FontSize { Size = 0 };
10 | public static readonly FontSize XXSmall = new FontSize { Key = 1, Size = 8.5, Text = "8pt" };
11 | public static readonly FontSize XSmall = new FontSize { Key = 2, Size = 10.5, Text = "10pt" };
12 | public static readonly FontSize Small = new FontSize { Key = 3, Size = 12, Text = "12pt" };
13 | public static readonly FontSize Middle = new FontSize { Key = 4, Size = 14, Text = "14pt" };
14 | public static readonly FontSize Large = new FontSize { Key = 5, Size = 18, Text = "18pt" };
15 | public static readonly FontSize XLarge = new FontSize { Key = 6, Size = 24, Text = "24pt" };
16 | public static readonly FontSize XXLarge = new FontSize { Key = 7, Size = 36, Text = "36pt" };
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/SmithHtmlEditor/Models/HtmlObject.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.ComponentModel;
6 | using System.Windows.Media.Imaging;
7 |
8 | namespace Smith.WPF.HtmlEditor
9 | {
10 | public class HtmlObject : INotifyPropertyChanged
11 | {
12 | #region INotifyPropertyChanged 成员
13 |
14 | public event PropertyChangedEventHandler PropertyChanged;
15 |
16 | protected virtual void RaisePropertyChanged(string propertyName)
17 | {
18 | if (PropertyChanged != null)
19 | PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
20 | }
21 |
22 | #endregion
23 | }
24 |
25 | public class HyperlinkObject : HtmlObject
26 | {
27 | public string URL
28 | {
29 | get { return fdURL; }
30 | set
31 | {
32 | fdURL = value;
33 | RaisePropertyChanged("URL");
34 | }
35 | }
36 |
37 | public string Text
38 | {
39 | get { return fdText; }
40 | set
41 | {
42 | fdText = value;
43 | RaisePropertyChanged("Text");
44 | }
45 | }
46 |
47 | string fdText;
48 | string fdURL;
49 | }
50 |
51 | public class ImageObject : HtmlObject
52 | {
53 | public int Width
54 | {
55 | get { return fdWidth; }
56 | set
57 | {
58 | fdWidth = value;
59 | RaisePropertyChanged("Width");
60 | }
61 | }
62 |
63 | public int Height
64 | {
65 | get { return fdHeight; }
66 | set
67 | {
68 | fdHeight = value;
69 | RaisePropertyChanged("Height");
70 | }
71 | }
72 |
73 | public int OriginalWidth
74 | {
75 | get { return fdOriginalWidth; }
76 | set
77 | {
78 | fdOriginalWidth = value;
79 | RaisePropertyChanged("OriginalWidth");
80 | }
81 | }
82 |
83 | public int OriginalHeight
84 | {
85 | get { return fdOriginalHeight; }
86 | set
87 | {
88 | fdOriginalHeight = value;
89 | RaisePropertyChanged("OriginalHeight");
90 | }
91 | }
92 |
93 | public int HorizontalSpace
94 | {
95 | get { return fdHorizontalSpace; }
96 | set
97 | {
98 | fdHorizontalSpace = value;
99 | RaisePropertyChanged("HorizontalSpace");
100 | }
101 | }
102 |
103 | public int VerticalSpace
104 | {
105 | get { return fdVerticalSpace; }
106 | set
107 | {
108 | fdVerticalSpace = value;
109 | RaisePropertyChanged("VerticalSpace");
110 | }
111 | }
112 |
113 | public int BorderSize
114 | {
115 | get { return fdBorderSize; }
116 | set
117 | {
118 | fdBorderSize = value;
119 | RaisePropertyChanged("BorderSize");
120 | }
121 | }
122 |
123 | public ImageAlignment Alignment
124 | {
125 | get { return fdAlignment; }
126 | set
127 | {
128 | fdAlignment = value;
129 | RaisePropertyChanged("Alignment");
130 | }
131 | }
132 |
133 | public string TitleText
134 | {
135 | get { return fdTitleText; }
136 | set
137 | {
138 | fdTitleText = value;
139 | RaisePropertyChanged("Title");
140 | }
141 | }
142 |
143 | public string AltText
144 | {
145 | get { return fdAltText; }
146 | set
147 | {
148 | fdAltText = value;
149 | RaisePropertyChanged("AlternativeText");
150 | }
151 | }
152 |
153 | public string LinkUrl
154 | {
155 | get { return fdLinkUrl; }
156 | set
157 | {
158 | fdLinkUrl = value;
159 | RaisePropertyChanged("LinkUrl");
160 | }
161 | }
162 |
163 | public string ImageUrl
164 | {
165 | get { return fdImageUrl; }
166 | set
167 | {
168 | fdImageUrl = value;
169 | RaisePropertyChanged("ImageUrl");
170 | }
171 | }
172 |
173 | public BitmapImage Image
174 | {
175 | get { return fdImage; }
176 | set
177 | {
178 | fdImage = value;
179 | RaisePropertyChanged("Image");
180 | }
181 | }
182 |
183 | #region 字段
184 |
185 | BitmapImage fdImage;
186 | ImageAlignment fdAlignment;
187 | string fdImageUrl;
188 | string fdLinkUrl;
189 | string fdAltText;
190 | string fdTitleText;
191 | int fdBorderSize;
192 | int fdVerticalSpace;
193 | int fdHorizontalSpace;
194 | int fdOriginalHeight;
195 | int fdOriginalWidth;
196 | int fdHeight;
197 | int fdWidth;
198 |
199 | #endregion
200 | }
201 |
202 | public class TableObject : HtmlObject
203 | {
204 | public int Columns
205 | {
206 | get { return fdColumns; }
207 | set
208 | {
209 | if (value <= 0) value = 1;
210 | fdColumns = value;
211 | RaisePropertyChanged("Columns");
212 | }
213 | }
214 |
215 | public int Rows
216 | {
217 | get { return fdRows; }
218 | set
219 | {
220 | if (value <= 0) value = 1;
221 | fdRows = value;
222 | RaisePropertyChanged("Rows");
223 | }
224 | }
225 |
226 | public int Width
227 | {
228 | get { return fdWidth; }
229 | set
230 | {
231 | fdWidth = value;
232 | RaisePropertyChanged("Width");
233 | }
234 | }
235 |
236 | public int Height
237 | {
238 | get { return fdHeight; }
239 | set
240 | {
241 | fdHeight = value;
242 | RaisePropertyChanged("Height");
243 | }
244 | }
245 |
246 | public int Spacing
247 | {
248 | get { return fdSpacing; }
249 | set
250 | {
251 | fdSpacing = value;
252 | RaisePropertyChanged("Spacing");
253 | }
254 | }
255 |
256 | public int Padding
257 | {
258 | get { return fdPadding; }
259 | set
260 | {
261 | fdPadding = value;
262 | RaisePropertyChanged("Padding");
263 | }
264 | }
265 |
266 | public int Border
267 | {
268 | get { return fdBorder; }
269 | set
270 | {
271 | fdBorder = value;
272 | RaisePropertyChanged("Border");
273 | }
274 | }
275 |
276 | public string Title
277 | {
278 | get { return fdTitle; }
279 | set
280 | {
281 | fdTitle = value;
282 | RaisePropertyChanged("Title");
283 | }
284 | }
285 |
286 | public Unit WidthUnit
287 | {
288 | get { return fdWidthUnit; }
289 | set
290 | {
291 | fdWidthUnit = value;
292 | RaisePropertyChanged("WidthUnit");
293 | }
294 | }
295 |
296 | public Unit HeightUnit
297 | {
298 | get { return fdHeightUnit; }
299 | set
300 | {
301 | fdHeightUnit = value;
302 | RaisePropertyChanged("HeightUnit");
303 | }
304 | }
305 |
306 | public Unit SpacingUnit
307 | {
308 | get { return fdSpacingUnit; }
309 | set
310 | {
311 | fdSpacingUnit = value;
312 | RaisePropertyChanged("SpacingUnit");
313 | }
314 | }
315 |
316 | public Unit PaddingUnit
317 | {
318 | get { return fdPaddingUnit; }
319 | set
320 | {
321 | fdPaddingUnit = value;
322 | RaisePropertyChanged("PaddingUnit");
323 | }
324 | }
325 |
326 | public TableHeaderOption HeaderOption
327 | {
328 | get { return fdHeaderOption; }
329 | set
330 | {
331 | fdHeaderOption = value;
332 | RaisePropertyChanged("HeaderOption");
333 | }
334 | }
335 |
336 | public TableAlignment Alignment
337 | {
338 | get { return fdAlignment; }
339 | set
340 | {
341 | fdAlignment = value;
342 | RaisePropertyChanged("Alignment");
343 | }
344 | }
345 |
346 | TableAlignment fdAlignment;
347 | TableHeaderOption fdHeaderOption;
348 | Unit fdPaddingUnit;
349 | Unit fdSpacingUnit;
350 | Unit fdHeightUnit;
351 | Unit fdWidthUnit;
352 | string fdTitle;
353 | int fdBorder;
354 | int fdPadding;
355 | int fdSpacing;
356 | int fdHeight;
357 | int fdWidth;
358 | int fdRows;
359 | int fdColumns;
360 | }
361 | }
362 |
--------------------------------------------------------------------------------
/SmithHtmlEditor/Models/OptionObject.cs:
--------------------------------------------------------------------------------
1 | namespace Smith.WPF.HtmlEditor
2 | {
3 | public class OptionObject
4 | {
5 | public string Text { get; protected set; }
6 | public string Value { get; protected set; }
7 | }
8 |
9 | public class ImageAlignment : OptionObject
10 | {
11 | protected ImageAlignment() { }
12 |
13 | public static readonly ImageAlignment Default =
14 | new ImageAlignment { Text = Resources.UiText.Align_Default, Value = "" };
15 |
16 | public static readonly ImageAlignment Left =
17 | new ImageAlignment { Text = Resources.UiText.Align_Left, Value = "left" };
18 |
19 | public static readonly ImageAlignment Right =
20 | new ImageAlignment { Text = Resources.UiText.Align_Right, Value = "right" };
21 |
22 | public static readonly ImageAlignment Top =
23 | new ImageAlignment { Text = Resources.UiText.Align_Top, Value = "top" };
24 |
25 | public static readonly ImageAlignment Center =
26 | new ImageAlignment { Text = Resources.UiText.Align_Center, Value = "center" };
27 |
28 | public static readonly ImageAlignment Bottom =
29 | new ImageAlignment { Text = Resources.UiText.Align_Bottom, Value = "bottom" };
30 | }
31 |
32 | public class TableHeaderOption : OptionObject
33 | {
34 | protected TableHeaderOption() { }
35 |
36 | public static readonly TableHeaderOption Default =
37 | new TableHeaderOption { Text = Resources.UiText.Header_Default, Value = "Default" };
38 |
39 | public static readonly TableHeaderOption FirstRow =
40 | new TableHeaderOption { Text = Resources.UiText.Header_FirstRow, Value = "FirstRow" };
41 |
42 | public static readonly TableHeaderOption FirstColumn =
43 | new TableHeaderOption { Text = Resources.UiText.Header_FirstColumn, Value = "FirstColumn" };
44 |
45 | public static readonly TableHeaderOption FirstRowAndColumn =
46 | new TableHeaderOption { Text = Resources.UiText.Header_FirstRowAndColumn, Value = "FirstRowAndColumn" };
47 | }
48 |
49 | public class TableAlignment : OptionObject
50 | {
51 | protected TableAlignment() { }
52 |
53 | public static readonly TableAlignment Default =
54 | new TableAlignment { Text = Resources.UiText.Align_Default, Value = "" };
55 |
56 | public static readonly TableAlignment Center =
57 | new TableAlignment { Text = Resources.UiText.Align_Center, Value = "center" };
58 |
59 | public static readonly TableAlignment Left =
60 | new TableAlignment { Text = Resources.UiText.Align_Left, Value = "left" };
61 |
62 | public static readonly TableAlignment Right =
63 | new TableAlignment { Text = Resources.UiText.Align_Right, Value = "right" };
64 | }
65 |
66 | public class Unit : OptionObject
67 | {
68 | protected Unit() { }
69 |
70 | public static readonly Unit Pixel = new Unit { Text = "px", Value = "px" };
71 | public static readonly Unit Percentage = new Unit { Text = "%", Value = "%" };
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/SmithHtmlEditor/Models/WordCounter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Globalization;
6 | using System.Text.RegularExpressions;
7 |
8 | namespace Smith.WPF.HtmlEditor
9 | {
10 | internal abstract class WordCounter
11 | {
12 | public abstract int Count(string text);
13 |
14 | public static WordCounter Create(CultureInfo culture)
15 | {
16 | string tag = culture.IetfLanguageTag.ToLower();
17 |
18 | switch (tag)
19 | {
20 | case "zh-cn": return new ChineseWordCounter();
21 | default: return new EnglishWordCounter();
22 | }
23 | }
24 |
25 | public static WordCounter Create()
26 | {
27 | return Create(CultureInfo.CurrentCulture);
28 | }
29 | }
30 |
31 | internal class EnglishWordCounter : WordCounter
32 | {
33 | static readonly string pattern = @"[\S]+";
34 |
35 | public override int Count(string text)
36 | {
37 | if (string.IsNullOrEmpty(text))
38 | {
39 | return 0;
40 | }
41 |
42 | MatchCollection collection = Regex.Matches(text, pattern);
43 | return collection.Count;
44 | }
45 | }
46 |
47 | internal class ChineseWordCounter : WordCounter
48 | {
49 | public override int Count(string text)
50 | {
51 | if (string.IsNullOrEmpty(text))
52 | {
53 | return 0;
54 | }
55 |
56 | var sec = Regex.Split(text, @"\s");
57 | int count = 0;
58 | foreach (var si in sec)
59 | {
60 | int ci = Regex.Matches(si, @"[\u0000-\u00ff]+").Count;
61 | foreach (var c in si)
62 | if ((int)c > 0x00FF) ci++;
63 | count += ci;
64 | }
65 | return count;
66 | }
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/SmithHtmlEditor/Resources/Images/ZoomIn.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adambarath/SmithHtmlEditor/129709ecc0c2ec6318053bed8c312b793e6cbaab/SmithHtmlEditor/Resources/Images/ZoomIn.png
--------------------------------------------------------------------------------
/SmithHtmlEditor/Resources/Images/ZoomOut.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adambarath/SmithHtmlEditor/129709ecc0c2ec6318053bed8c312b793e6cbaab/SmithHtmlEditor/Resources/Images/ZoomOut.png
--------------------------------------------------------------------------------
/SmithHtmlEditor/Resources/Images/bold.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adambarath/SmithHtmlEditor/129709ecc0c2ec6318053bed8c312b793e6cbaab/SmithHtmlEditor/Resources/Images/bold.png
--------------------------------------------------------------------------------
/SmithHtmlEditor/Resources/Images/browser.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adambarath/SmithHtmlEditor/129709ecc0c2ec6318053bed8c312b793e6cbaab/SmithHtmlEditor/Resources/Images/browser.png
--------------------------------------------------------------------------------
/SmithHtmlEditor/Resources/Images/center.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adambarath/SmithHtmlEditor/129709ecc0c2ec6318053bed8c312b793e6cbaab/SmithHtmlEditor/Resources/Images/center.png
--------------------------------------------------------------------------------
/SmithHtmlEditor/Resources/Images/code.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adambarath/SmithHtmlEditor/129709ecc0c2ec6318053bed8c312b793e6cbaab/SmithHtmlEditor/Resources/Images/code.png
--------------------------------------------------------------------------------
/SmithHtmlEditor/Resources/Images/copy.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adambarath/SmithHtmlEditor/129709ecc0c2ec6318053bed8c312b793e6cbaab/SmithHtmlEditor/Resources/Images/copy.png
--------------------------------------------------------------------------------
/SmithHtmlEditor/Resources/Images/cut.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adambarath/SmithHtmlEditor/129709ecc0c2ec6318053bed8c312b793e6cbaab/SmithHtmlEditor/Resources/Images/cut.png
--------------------------------------------------------------------------------
/SmithHtmlEditor/Resources/Images/del.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adambarath/SmithHtmlEditor/129709ecc0c2ec6318053bed8c312b793e6cbaab/SmithHtmlEditor/Resources/Images/del.png
--------------------------------------------------------------------------------
/SmithHtmlEditor/Resources/Images/erase.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adambarath/SmithHtmlEditor/129709ecc0c2ec6318053bed8c312b793e6cbaab/SmithHtmlEditor/Resources/Images/erase.png
--------------------------------------------------------------------------------
/SmithHtmlEditor/Resources/Images/error.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adambarath/SmithHtmlEditor/129709ecc0c2ec6318053bed8c312b793e6cbaab/SmithHtmlEditor/Resources/Images/error.png
--------------------------------------------------------------------------------
/SmithHtmlEditor/Resources/Images/find.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adambarath/SmithHtmlEditor/129709ecc0c2ec6318053bed8c312b793e6cbaab/SmithHtmlEditor/Resources/Images/find.png
--------------------------------------------------------------------------------
/SmithHtmlEditor/Resources/Images/fontcolor.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adambarath/SmithHtmlEditor/129709ecc0c2ec6318053bed8c312b793e6cbaab/SmithHtmlEditor/Resources/Images/fontcolor.png
--------------------------------------------------------------------------------
/SmithHtmlEditor/Resources/Images/goto.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adambarath/SmithHtmlEditor/129709ecc0c2ec6318053bed8c312b793e6cbaab/SmithHtmlEditor/Resources/Images/goto.png
--------------------------------------------------------------------------------
/SmithHtmlEditor/Resources/Images/help.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adambarath/SmithHtmlEditor/129709ecc0c2ec6318053bed8c312b793e6cbaab/SmithHtmlEditor/Resources/Images/help.png
--------------------------------------------------------------------------------
/SmithHtmlEditor/Resources/Images/htmlcode.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adambarath/SmithHtmlEditor/129709ecc0c2ec6318053bed8c312b793e6cbaab/SmithHtmlEditor/Resources/Images/htmlcode.png
--------------------------------------------------------------------------------
/SmithHtmlEditor/Resources/Images/hyperlink.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adambarath/SmithHtmlEditor/129709ecc0c2ec6318053bed8c312b793e6cbaab/SmithHtmlEditor/Resources/Images/hyperlink.png
--------------------------------------------------------------------------------
/SmithHtmlEditor/Resources/Images/image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adambarath/SmithHtmlEditor/129709ecc0c2ec6318053bed8c312b793e6cbaab/SmithHtmlEditor/Resources/Images/image.png
--------------------------------------------------------------------------------
/SmithHtmlEditor/Resources/Images/indent.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adambarath/SmithHtmlEditor/129709ecc0c2ec6318053bed8c312b793e6cbaab/SmithHtmlEditor/Resources/Images/indent.png
--------------------------------------------------------------------------------
/SmithHtmlEditor/Resources/Images/italic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adambarath/SmithHtmlEditor/129709ecc0c2ec6318053bed8c312b793e6cbaab/SmithHtmlEditor/Resources/Images/italic.png
--------------------------------------------------------------------------------
/SmithHtmlEditor/Resources/Images/left.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adambarath/SmithHtmlEditor/129709ecc0c2ec6318053bed8c312b793e6cbaab/SmithHtmlEditor/Resources/Images/left.png
--------------------------------------------------------------------------------
/SmithHtmlEditor/Resources/Images/linecolor.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adambarath/SmithHtmlEditor/129709ecc0c2ec6318053bed8c312b793e6cbaab/SmithHtmlEditor/Resources/Images/linecolor.png
--------------------------------------------------------------------------------
/SmithHtmlEditor/Resources/Images/listbullets.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adambarath/SmithHtmlEditor/129709ecc0c2ec6318053bed8c312b793e6cbaab/SmithHtmlEditor/Resources/Images/listbullets.png
--------------------------------------------------------------------------------
/SmithHtmlEditor/Resources/Images/listnumbered.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adambarath/SmithHtmlEditor/129709ecc0c2ec6318053bed8c312b793e6cbaab/SmithHtmlEditor/Resources/Images/listnumbered.png
--------------------------------------------------------------------------------
/SmithHtmlEditor/Resources/Images/new.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adambarath/SmithHtmlEditor/129709ecc0c2ec6318053bed8c312b793e6cbaab/SmithHtmlEditor/Resources/Images/new.png
--------------------------------------------------------------------------------
/SmithHtmlEditor/Resources/Images/open.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adambarath/SmithHtmlEditor/129709ecc0c2ec6318053bed8c312b793e6cbaab/SmithHtmlEditor/Resources/Images/open.png
--------------------------------------------------------------------------------
/SmithHtmlEditor/Resources/Images/outdent.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adambarath/SmithHtmlEditor/129709ecc0c2ec6318053bed8c312b793e6cbaab/SmithHtmlEditor/Resources/Images/outdent.png
--------------------------------------------------------------------------------
/SmithHtmlEditor/Resources/Images/paste.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adambarath/SmithHtmlEditor/129709ecc0c2ec6318053bed8c312b793e6cbaab/SmithHtmlEditor/Resources/Images/paste.png
--------------------------------------------------------------------------------
/SmithHtmlEditor/Resources/Images/print.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adambarath/SmithHtmlEditor/129709ecc0c2ec6318053bed8c312b793e6cbaab/SmithHtmlEditor/Resources/Images/print.png
--------------------------------------------------------------------------------
/SmithHtmlEditor/Resources/Images/prop.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adambarath/SmithHtmlEditor/129709ecc0c2ec6318053bed8c312b793e6cbaab/SmithHtmlEditor/Resources/Images/prop.png
--------------------------------------------------------------------------------
/SmithHtmlEditor/Resources/Images/redo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adambarath/SmithHtmlEditor/129709ecc0c2ec6318053bed8c312b793e6cbaab/SmithHtmlEditor/Resources/Images/redo.png
--------------------------------------------------------------------------------
/SmithHtmlEditor/Resources/Images/refresh.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adambarath/SmithHtmlEditor/129709ecc0c2ec6318053bed8c312b793e6cbaab/SmithHtmlEditor/Resources/Images/refresh.png
--------------------------------------------------------------------------------
/SmithHtmlEditor/Resources/Images/replace.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adambarath/SmithHtmlEditor/129709ecc0c2ec6318053bed8c312b793e6cbaab/SmithHtmlEditor/Resources/Images/replace.png
--------------------------------------------------------------------------------
/SmithHtmlEditor/Resources/Images/right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adambarath/SmithHtmlEditor/129709ecc0c2ec6318053bed8c312b793e6cbaab/SmithHtmlEditor/Resources/Images/right.png
--------------------------------------------------------------------------------
/SmithHtmlEditor/Resources/Images/save.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adambarath/SmithHtmlEditor/129709ecc0c2ec6318053bed8c312b793e6cbaab/SmithHtmlEditor/Resources/Images/save.png
--------------------------------------------------------------------------------
/SmithHtmlEditor/Resources/Images/saveas.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adambarath/SmithHtmlEditor/129709ecc0c2ec6318053bed8c312b793e6cbaab/SmithHtmlEditor/Resources/Images/saveas.png
--------------------------------------------------------------------------------
/SmithHtmlEditor/Resources/Images/spelling.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adambarath/SmithHtmlEditor/129709ecc0c2ec6318053bed8c312b793e6cbaab/SmithHtmlEditor/Resources/Images/spelling.png
--------------------------------------------------------------------------------
/SmithHtmlEditor/Resources/Images/stretch.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adambarath/SmithHtmlEditor/129709ecc0c2ec6318053bed8c312b793e6cbaab/SmithHtmlEditor/Resources/Images/stretch.png
--------------------------------------------------------------------------------
/SmithHtmlEditor/Resources/Images/subscript.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adambarath/SmithHtmlEditor/129709ecc0c2ec6318053bed8c312b793e6cbaab/SmithHtmlEditor/Resources/Images/subscript.png
--------------------------------------------------------------------------------
/SmithHtmlEditor/Resources/Images/superscript.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adambarath/SmithHtmlEditor/129709ecc0c2ec6318053bed8c312b793e6cbaab/SmithHtmlEditor/Resources/Images/superscript.png
--------------------------------------------------------------------------------
/SmithHtmlEditor/Resources/Images/table.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adambarath/SmithHtmlEditor/129709ecc0c2ec6318053bed8c312b793e6cbaab/SmithHtmlEditor/Resources/Images/table.png
--------------------------------------------------------------------------------
/SmithHtmlEditor/Resources/Images/underline.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adambarath/SmithHtmlEditor/129709ecc0c2ec6318053bed8c312b793e6cbaab/SmithHtmlEditor/Resources/Images/underline.png
--------------------------------------------------------------------------------
/SmithHtmlEditor/Resources/Images/undo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adambarath/SmithHtmlEditor/129709ecc0c2ec6318053bed8c312b793e6cbaab/SmithHtmlEditor/Resources/Images/undo.png
--------------------------------------------------------------------------------
/SmithHtmlEditor/Resources/Images/window.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adambarath/SmithHtmlEditor/129709ecc0c2ec6318053bed8c312b793e6cbaab/SmithHtmlEditor/Resources/Images/window.png
--------------------------------------------------------------------------------
/SmithHtmlEditor/Resources/UiText.en-US.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | Bottom
122 |
123 |
124 | Center
125 |
126 |
127 | Default
128 |
129 |
130 | Left
131 |
132 |
133 | Right
134 |
135 |
136 | Top
137 |
138 |
139 | Bold
140 |
141 |
142 | Browse
143 |
144 |
145 | Bulleted List
146 |
147 |
148 | Cancel
149 |
150 |
151 | Clear Style
152 |
153 |
154 | Code Mode
155 |
156 |
157 | Font Color
158 |
159 |
160 | Indent
161 |
162 |
163 | Insert Hyperlink
164 |
165 |
166 | Insert Image
167 |
168 |
169 | Insert Table
170 |
171 |
172 | Italic
173 |
174 |
175 | Justify Center
176 |
177 |
178 | Justify Full
179 |
180 |
181 | Justify Left
182 |
183 |
184 | Justify Right
185 |
186 |
187 | Line Color
188 |
189 |
190 | Numbered List
191 |
192 |
193 | OK
194 |
195 |
196 | Outdent
197 |
198 |
199 | Refresh
200 |
201 |
202 | Subscript
203 |
204 |
205 | Superscript
206 |
207 |
208 | Underline
209 |
210 |
211 | Zoom In
212 |
213 |
214 | Zoom Out
215 |
216 |
217 | Copy
218 |
219 |
220 | Cut
221 |
222 |
223 | Delete
224 |
225 |
226 | Paste
227 |
228 |
229 | Redo
230 |
231 |
232 | Select All
233 |
234 |
235 | Undo
236 |
237 |
238 | Default
239 |
240 |
241 | First Column
242 |
243 |
244 | First Row
245 |
246 |
247 | First Row And Column
248 |
249 |
250 | Alt Text
251 |
252 |
253 | Border
254 |
255 |
256 | Columns
257 |
258 |
259 | H Space
260 |
261 |
262 | Alignment
263 |
264 |
265 | Height
266 |
267 |
268 | Title
269 |
270 |
271 | Width
272 |
273 |
274 | Link to
275 |
276 |
277 | No Preview
278 |
279 |
280 | Padding
281 |
282 |
283 | Rows
284 |
285 |
286 | Spacing
287 |
288 |
289 | Alignment
290 |
291 |
292 | Border
293 |
294 |
295 | Header
296 |
297 |
298 | Height
299 |
300 |
301 | Title
302 |
303 |
304 | Width
305 |
306 |
307 | Text
308 |
309 |
310 | URL
311 |
312 |
313 | V Space
314 |
315 |
316 | Insert Hyperlink
317 |
318 |
319 | Insert Image
320 |
321 |
322 | Insert Table
323 |
324 |
--------------------------------------------------------------------------------
/SmithHtmlEditor/Resources/UiText.hu-HU.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | Bottom
122 |
123 |
124 | Center
125 |
126 |
127 | Default
128 |
129 |
130 | Left
131 |
132 |
133 | Right
134 |
135 |
136 | Top
137 |
138 |
139 | Bold
140 |
141 |
142 | Browse
143 |
144 |
145 | Bulleted List
146 |
147 |
148 | Cancel
149 |
150 |
151 | Clear Style
152 |
153 |
154 | Code Mode
155 |
156 |
157 | Font Color
158 |
159 |
160 | Indent
161 |
162 |
163 | Insert Hyperlink
164 |
165 |
166 | Insert Image
167 |
168 |
169 | Insert Table
170 |
171 |
172 | Italic
173 |
174 |
175 | Justify Center
176 |
177 |
178 | Justify Full
179 |
180 |
181 | Justify Left
182 |
183 |
184 | Justify Right
185 |
186 |
187 | Line Color
188 |
189 |
190 | Numbered List
191 |
192 |
193 | OK
194 |
195 |
196 | Outdent
197 |
198 |
199 | Refresh
200 |
201 |
202 | Subscript
203 |
204 |
205 | Superscript
206 |
207 |
208 | Underline
209 |
210 |
211 | Zoom In
212 |
213 |
214 | Zoom Out
215 |
216 |
217 | Copy
218 |
219 |
220 | Cut
221 |
222 |
223 | Delete
224 |
225 |
226 | Paste
227 |
228 |
229 | Redo
230 |
231 |
232 | Select All
233 |
234 |
235 | Undo
236 |
237 |
238 | Default
239 |
240 |
241 | First Column
242 |
243 |
244 | First Row
245 |
246 |
247 | First Row And Column
248 |
249 |
250 | Alt Text
251 |
252 |
253 | Border
254 |
255 |
256 | Columns
257 |
258 |
259 | H Space
260 |
261 |
262 | Alignment
263 |
264 |
265 | Height
266 |
267 |
268 | Title
269 |
270 |
271 | Width
272 |
273 |
274 | Link to
275 |
276 |
277 | No Preview
278 |
279 |
280 | Padding
281 |
282 |
283 | Rows
284 |
285 |
286 | Spacing
287 |
288 |
289 | Alignment
290 |
291 |
292 | Border
293 |
294 |
295 | Header
296 |
297 |
298 | Height
299 |
300 |
301 | Title
302 |
303 |
304 | Width
305 |
306 |
307 | Text
308 |
309 |
310 | URL
311 |
312 |
313 | V Space
314 |
315 |
316 | Hiperhivatkozás beszúrása
317 |
318 |
319 | Kép beszúrása
320 |
321 |
322 | Táblázat beszúrása
323 |
324 |
--------------------------------------------------------------------------------
/SmithHtmlEditor/Resources/UiText.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | Bottom
122 |
123 |
124 | Center
125 |
126 |
127 | Default
128 |
129 |
130 | Left
131 |
132 |
133 | Right
134 |
135 |
136 | Top
137 |
138 |
139 | Bold
140 |
141 |
142 | Browse
143 |
144 |
145 | Bulleted List
146 |
147 |
148 | Cancel
149 |
150 |
151 | Clear Style
152 |
153 |
154 | Code Mode
155 |
156 |
157 | Font Color
158 |
159 |
160 | Indent
161 |
162 |
163 | Insert Hyperlink
164 |
165 |
166 | Insert Image
167 |
168 |
169 | Insert Table
170 |
171 |
172 | Italic
173 |
174 |
175 | Justify Center
176 |
177 |
178 | Justify Full
179 |
180 |
181 | Justify Left
182 |
183 |
184 | Justify Right
185 |
186 |
187 | Line Color
188 |
189 |
190 | Numbered List
191 |
192 |
193 | OK
194 |
195 |
196 | Outdent
197 |
198 |
199 | Refresh
200 |
201 |
202 | Subscript
203 |
204 |
205 | Superscript
206 |
207 |
208 | Underline
209 |
210 |
211 | Zoom In
212 |
213 |
214 | Zoom Out
215 |
216 |
217 | Copy
218 |
219 |
220 | Cut
221 |
222 |
223 | Delete
224 |
225 |
226 | Paste
227 |
228 |
229 | Redo
230 |
231 |
232 | Select All
233 |
234 |
235 | Undo
236 |
237 |
238 | Default
239 |
240 |
241 | First Column
242 |
243 |
244 | First Row
245 |
246 |
247 | First Row And Column
248 |
249 |
250 | Alt Text
251 |
252 |
253 | Border
254 |
255 |
256 | Columns
257 |
258 |
259 | H Space
260 |
261 |
262 | Alignment
263 |
264 |
265 | Height
266 |
267 |
268 | Title
269 |
270 |
271 | Width
272 |
273 |
274 | Link to
275 |
276 |
277 | No Preview
278 |
279 |
280 | Padding
281 |
282 |
283 | Rows
284 |
285 |
286 | Spacing
287 |
288 |
289 | Alignment
290 |
291 |
292 | Border
293 |
294 |
295 | Header
296 |
297 |
298 | Height
299 |
300 |
301 | Title
302 |
303 |
304 | Width
305 |
306 |
307 | Text
308 |
309 |
310 | URL
311 |
312 |
313 | V Space
314 |
315 |
316 | Insert Hyperlink
317 |
318 |
319 | Insert Image
320 |
321 |
322 | Insert Table
323 |
324 |
--------------------------------------------------------------------------------
/SmithHtmlEditor/Resources/UiText.zh-CN.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | 底端对齐
122 |
123 |
124 | 中间对齐
125 |
126 |
127 | 默认
128 |
129 |
130 | 左对齐
131 |
132 |
133 | 右对齐
134 |
135 |
136 | 顶端对齐
137 |
138 |
139 | 粗体
140 |
141 |
142 | 浏览
143 |
144 |
145 | 无序列表
146 |
147 |
148 | 取消
149 |
150 |
151 | 清除样式
152 |
153 |
154 | 源码模式
155 |
156 |
157 | 文字颜色
158 |
159 |
160 | 增加缩进
161 |
162 |
163 | 插入超链接
164 |
165 |
166 | 插入图像
167 |
168 |
169 | 插入表格
170 |
171 |
172 | 斜体
173 |
174 |
175 | 居中对齐
176 |
177 |
178 | 两端对齐
179 |
180 |
181 | 左对齐
182 |
183 |
184 | 右对齐
185 |
186 |
187 | 背景颜色
188 |
189 |
190 | 有序列表
191 |
192 |
193 | 确定
194 |
195 |
196 | 减少缩进
197 |
198 |
199 | 刷新
200 |
201 |
202 | 下标
203 |
204 |
205 | 上标
206 |
207 |
208 | 下划线
209 |
210 |
211 | 放大
212 |
213 |
214 | 缩小
215 |
216 |
217 | 复制
218 |
219 |
220 | 剪切
221 |
222 |
223 | 删除
224 |
225 |
226 | 粘贴
227 |
228 |
229 | 重复
230 |
231 |
232 | 全选
233 |
234 |
235 | 撤销
236 |
237 |
238 | 默认
239 |
240 |
241 | 首列
242 |
243 |
244 | 首行
245 |
246 |
247 | 首行和首列
248 |
249 |
250 | 替换文本
251 |
252 |
253 | 边框大小
254 |
255 |
256 | 列数
257 |
258 |
259 | 水平间距
260 |
261 |
262 | 对齐方式
263 |
264 |
265 | 图像高度
266 |
267 |
268 | 提示文本
269 |
270 |
271 | 图像宽度
272 |
273 |
274 | 链接地址
275 |
276 |
277 | 无预览
278 |
279 |
280 | 边距
281 |
282 |
283 | 行数
284 |
285 |
286 | 间隔
287 |
288 |
289 | 对齐
290 |
291 |
292 | 边框
293 |
294 |
295 | 表头
296 |
297 |
298 | 高度
299 |
300 |
301 | 标题
302 |
303 |
304 | 宽度
305 |
306 |
307 | 显示文本
308 |
309 |
310 | 链接地址
311 |
312 |
313 | 垂直间距
314 |
315 |
316 | 插入超链接
317 |
318 |
319 | 插入图像
320 |
321 |
322 | 插入表格
323 |
324 |
--------------------------------------------------------------------------------
/SmithHtmlEditor/SmithHtmlEditor.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | true
5 | true
6 | netcoreapp3.0;netcoreapp3.1;net461;net462;net47;net471;net472;net48
7 | win-x86
8 |
9 | Smith.WPF.HtmlEditor
10 | Smith.WPF.HtmlEditor
11 | BRUPPER Gp.
12 | adambarath
13 | WYSIWYG rich text editor which enables writing content directly inside of wpf applications.
14 | John Smith - https://archive.codeplex.com/?p=smithhtmleditor
15 | https://github.com/adambarath/SmithHtmlEditor
16 | https://github.com/adambarath/SmithHtmlEditor
17 | Smith.WPF.HtmlEditor HtmlEditor WPF
18 |
19 | 2020/05/06
20 | 1. extend target frameworks to netcoreapp3.0;netcoreapp3.1;net461;net462;net47;net471;net472;net48
21 | 2. add pre-build event to do dotnet restore. Issue description at https://stackoverflow.com/questions/48440223/assets-file-project-assets-json-not-found-run-a-nuget-package-restore
22 |
23 | 2019/10/31
24 | update to NetCore 3.0
25 |
26 | false
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 | 3050f1c5-98b5-11cf-bb82-00aa00bdce0b
37 | 4
38 | 0
39 | tlbimp
40 | 0
41 | false
42 | true
43 | false
44 |
45 |
46 |
47 |
48 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 | PreserveNewest
154 |
155 |
156 | PreserveNewest
157 |
158 |
159 |
160 |
161 |
162 | UiText.resx
163 | True
164 | True
165 |
166 |
167 | PublicResXFileCodeGenerator
168 | UiText.Designer.cs
169 |
170 |
171 |
172 |
--------------------------------------------------------------------------------
/SmithHtmlEditor/Views/ColorPicker.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
13 |
19 |
20 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/SmithHtmlEditor/Views/ColorPicker.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows;
6 | using System.Windows.Controls;
7 | using System.Windows.Data;
8 | using System.Windows.Documents;
9 | using System.Windows.Input;
10 | using System.Windows.Media;
11 | using System.Windows.Media.Imaging;
12 | using System.Windows.Navigation;
13 | using System.Windows.Shapes;
14 | using System.Collections.ObjectModel;
15 |
16 | namespace Smith.WPF.HtmlEditor
17 | {
18 | ///
19 | /// ColorPicker.xaml 的交互逻辑
20 | ///
21 | public partial class ColorPicker : UserControl
22 | {
23 | public ColorPicker()
24 | {
25 | InitializeComponent();
26 | InitColors();
27 | }
28 |
29 | public event EventHandler> SelectedColorChanged;
30 |
31 | public Color SelectedColor
32 | {
33 | get { return (Color)GetValue(SelectedColorProperty); }
34 | set { SetValue(SelectedColorProperty, value); }
35 | }
36 |
37 | public static readonly DependencyProperty SelectedColorProperty =
38 | DependencyProperty.Register("SelectedColor", typeof(Color), typeof(ColorPicker),
39 | new UIPropertyMetadata(Colors.Transparent, new PropertyChangedCallback(OnSelectedColorPropertyChanged)));
40 |
41 | static void OnSelectedColorPropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
42 | {
43 | ColorPicker control = sender as ColorPicker;
44 | if (control != null && control.SelectedColorChanged != null && control.IsRaiseColorChangedEvent)
45 | control.SelectedColorChanged(control, PropertyChangedEventArgs.Create((Color)e.NewValue, (Color)e.OldValue));
46 | }
47 |
48 | public void Reset()
49 | {
50 | IsRaiseColorChangedEvent = false;
51 | StandardColors.SelectedItem = null;
52 | SelectedColor = Color.FromRgb(0x01, 0x01, 0x01);
53 | IsRaiseColorChangedEvent = true;
54 | }
55 |
56 | void InitColors()
57 | {
58 | List ls = new List()
59 | {
60 | Color.FromRgb(0x00, 0x00, 0x00), Color.FromRgb(0x99, 0x33, 0x00),
61 | Color.FromRgb(0x33, 0x33, 0x00), Color.FromRgb(0x00, 0x33, 0x00),
62 | Color.FromRgb(0x00, 0x33, 0x66), Color.FromRgb(0x00, 0x00, 0x80),
63 | Color.FromRgb(0x33, 0x33, 0x99), Color.FromRgb(0x33, 0x33, 0x33),
64 |
65 | Color.FromRgb(0x80, 0x00, 0x00), Color.FromRgb(0xff, 0x66, 0x00),
66 | Color.FromRgb(0x80, 0x80, 0x00), Color.FromRgb(0x00, 0x80, 0x00),
67 | Color.FromRgb(0x00, 0x80, 0x80), Color.FromRgb(0x00, 0x00, 0xff),
68 | Color.FromRgb(0x66, 0x66, 0x99), Color.FromRgb(0x80, 0x80, 0x80),
69 |
70 | Color.FromRgb(0xff, 0x00, 0x00), Color.FromRgb(0xff, 0x99, 0x00),
71 | Color.FromRgb(0x99, 0xcc, 0x00), Color.FromRgb(0x33, 0x99, 0x66),
72 | Color.FromRgb(0x33, 0xcc, 0xcc), Color.FromRgb(0x33, 0x66, 0xff),
73 | Color.FromRgb(0x80, 0x00, 0x80), Color.FromRgb(0x99, 0x99, 0x99),
74 |
75 | Color.FromRgb(0xff, 0x00, 0xff), Color.FromRgb(0xff, 0xcc, 0x00),
76 | Color.FromRgb(0xff, 0xff, 0x00), Color.FromRgb(0x00, 0xff, 0x00),
77 | Color.FromRgb(0x00, 0xff, 0xff), Color.FromRgb(0x00, 0xcc, 0xff),
78 | Color.FromRgb(0x99, 0x33, 0x66), Color.FromRgb(0xc0, 0xc0, 0xc0),
79 |
80 | Color.FromRgb(0xff, 0x99, 0xcc), Color.FromRgb(0xff, 0xcc, 0x99),
81 | Color.FromRgb(0xff, 0xff, 0x99), Color.FromRgb(0x00, 0xff, 0x00),
82 | Color.FromRgb(0xcc, 0xff, 0xcc), Color.FromRgb(0x99, 0xcc, 0xff),
83 | Color.FromRgb(0xcc, 0x99, 0xff), Color.FromRgb(0xff, 0xff, 0xff)
84 | };
85 | StandardColors.ItemsSource = new ReadOnlyCollection(ls);
86 | }
87 |
88 | void HandleSelect(object sender, MouseButtonEventArgs e)
89 | {
90 | ListBoxItem item = sender as ListBoxItem;
91 | if (item != null) SelectedColor = (Color)item.Content;
92 | }
93 |
94 | bool IsRaiseColorChangedEvent = true;
95 | }
96 |
97 | public class PropertyChangedEventArgs : EventArgs
98 | {
99 | private PropertyChangedEventArgs() { }
100 |
101 | public T NewValue { get; private set; }
102 | public T OldValue { get; private set; }
103 |
104 | public static PropertyChangedEventArgs Create(T newValue, T oldValue)
105 | {
106 | return new PropertyChangedEventArgs() { NewValue = newValue, OldValue = oldValue };
107 | }
108 | }
109 | }
110 |
--------------------------------------------------------------------------------
/SmithHtmlEditor/Views/HyperlinkDialog.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
13 |
16 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/SmithHtmlEditor/Views/HyperlinkDialog.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows;
6 | using System.Windows.Controls;
7 | using System.Windows.Data;
8 | using System.Windows.Documents;
9 | using System.Windows.Input;
10 | using System.Windows.Media;
11 | using System.Windows.Media.Imaging;
12 | using System.Windows.Shapes;
13 | using System.Windows.Markup;
14 | using System.Globalization;
15 |
16 | namespace Smith.WPF.HtmlEditor
17 | {
18 | ///
19 | /// HyperlinkDialog.xaml 的交互逻辑
20 | ///
21 | public partial class HyperlinkDialog : Window
22 | {
23 | HyperlinkObject bindingContext;
24 |
25 | public HyperlinkDialog()
26 | {
27 | InitializeComponent();
28 |
29 | Model = new HyperlinkObject
30 | {
31 | URL = "http://"
32 | };
33 | OkayButton.Click += new RoutedEventHandler(OkayButton_Click);
34 | CancelButton.Click += new RoutedEventHandler(CancelButton_Click);
35 | }
36 |
37 | public HyperlinkObject Model
38 | {
39 | get { return bindingContext; }
40 | set
41 | {
42 | bindingContext = value;
43 | this.DataContext = bindingContext;
44 | }
45 | }
46 |
47 | void CancelButton_Click(object sender, RoutedEventArgs e)
48 | {
49 | e.Handled = true;
50 | this.Close();
51 | }
52 |
53 | void OkayButton_Click(object sender, RoutedEventArgs e)
54 | {
55 | e.Handled = true;
56 | if (System.Windows.Interop.ComponentDispatcher.IsThreadModal) this.DialogResult = true;
57 | this.Close();
58 | }
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/SmithHtmlEditor/Views/ImageDialog.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
14 |
20 |
25 |
28 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
54 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
109 |
111 |
113 |
115 |
117 |
118 |
119 |
120 |
122 |
124 |
126 |
127 |
128 |
129 |
130 |
131 |
134 |
136 |
137 |
138 |
141 |
144 |
147 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
--------------------------------------------------------------------------------
/SmithHtmlEditor/Views/ImageDialog.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows;
6 | using System.Windows.Controls;
7 | using System.Windows.Data;
8 | using System.Windows.Documents;
9 | using System.Windows.Input;
10 | using System.Windows.Media;
11 | using System.Windows.Media.Imaging;
12 | using System.Windows.Shapes;
13 | using System.Net;
14 | using System.ComponentModel;
15 | using System.Collections.ObjectModel;
16 | using System.IO;
17 |
18 | namespace Smith.WPF.HtmlEditor
19 | {
20 | ///
21 | /// ImageDialog.xaml 的交互逻辑
22 | ///
23 | public partial class ImageDialog : Window
24 | {
25 | ImageObject bindingContext;
26 |
27 | public ImageDialog()
28 | {
29 | InitializeComponent();
30 | InitAlignmentItems();
31 | InitBindingContext();
32 | InitEvents();
33 | }
34 |
35 | public ImageObject Model
36 | {
37 | get { return bindingContext; }
38 | private set
39 | {
40 | bindingContext = value;
41 | DataContext = bindingContext;
42 | }
43 | }
44 |
45 | void InitBindingContext()
46 | {
47 | Model = new ImageObject
48 | {
49 | ImageUrl = "http://",
50 | Alignment = ImageAlignment.Default
51 | };
52 | }
53 |
54 | void InitAlignmentItems()
55 | {
56 | List ls = new List();
57 | ls.Add(ImageAlignment.Default);
58 | ls.Add(ImageAlignment.Left);
59 | ls.Add(ImageAlignment.Right);
60 | ls.Add(ImageAlignment.Top);
61 | ls.Add(ImageAlignment.Center);
62 | ls.Add(ImageAlignment.Bottom);
63 | ImageAlignmentSelection.ItemsSource = new ReadOnlyCollection(ls);
64 | ImageAlignmentSelection.DisplayMemberPath = "Text";
65 | }
66 |
67 | void InitEvents()
68 | {
69 | RefreshButton.Click += new RoutedEventHandler(RefreshButton_Click);
70 | BrowseButton.Click += new RoutedEventHandler(BrowseButton_Click);
71 | ResizeSlider.ValueChanged += new RoutedPropertyChangedEventHandler(ResizeSlider_ValueChanged);
72 | ZoomInButton.Click += new RoutedEventHandler(ZoomInButton_Click);
73 | ZoomOutButton.Click += new RoutedEventHandler(ZoomOutButton_Click);
74 | OkayButton.Click += new RoutedEventHandler(OkayButton_Click);
75 | CancelButton.Click += new RoutedEventHandler(CancelButton_Click);
76 |
77 | ScrollViewContentDragable.SetEnable(PreviewScroll, true);
78 | }
79 |
80 | void CancelButton_Click(object sender, RoutedEventArgs e)
81 | {
82 | e.Handled = true;
83 | this.Close();
84 | }
85 |
86 | void OkayButton_Click(object sender, RoutedEventArgs e)
87 | {
88 | e.Handled = true;
89 | if (System.Windows.Interop.ComponentDispatcher.IsThreadModal) this.DialogResult = true;
90 | this.Close();
91 | }
92 |
93 | void ZoomOutButton_Click(object sender, RoutedEventArgs e)
94 | {
95 | double val = ResizeSlider.Value - 10;
96 | if (val < 0) val = 1;
97 | ResizeSlider.Value = val;
98 | }
99 |
100 | void ZoomInButton_Click(object sender, RoutedEventArgs e)
101 | {
102 | double val = ResizeSlider.Value + 10;
103 | if (val > 200) val = 200;
104 | ResizeSlider.Value = val;
105 | }
106 |
107 | void ResizeSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs e)
108 | {
109 | double p = e.NewValue / 100;
110 | bindingContext.Width = Convert.ToInt32(Math.Round(p * bindingContext.OriginalWidth));
111 | bindingContext.Height = Convert.ToInt32(Math.Round(p * bindingContext.OriginalHeight));
112 | }
113 |
114 | void BrowseButton_Click(object sender, RoutedEventArgs e)
115 | {
116 | using (System.Windows.Forms.OpenFileDialog dialog =
117 | new System.Windows.Forms.OpenFileDialog())
118 | {
119 | dialog.Filter = "所有格式|*.jpg;*.jpeg;*.png;*gif|JPEG|*.jpg;*.jpeg|PNG|*.png|GIF|*.gif";
120 | dialog.FilterIndex = 0;
121 | if (System.Windows.Forms.DialogResult.OK == dialog.ShowDialog())
122 | {
123 | UrlText.Text = dialog.FileName;
124 | LoadImage(dialog.FileName);
125 | }
126 | }
127 | }
128 |
129 | void RefreshButton_Click(object sender, RoutedEventArgs e)
130 | {
131 | if(!string.IsNullOrEmpty(UrlText.Text)) LoadImageAsyn(UrlText.Text);
132 | }
133 |
134 | ///
135 | /// 加载图像,用于加载本地图像
136 | ///
137 | void LoadImage(string uri)
138 | {
139 | StatusPrompt.Content = "正在加载";
140 | PreviewImage.Source = null;
141 | bindingContext.Image = null;
142 |
143 | // 加载图像
144 | Uri u = new Uri(uri, UriKind.RelativeOrAbsolute);
145 | BitmapImage img = new BitmapImage(u);
146 | PreviewImage.Source = img;
147 |
148 | // 更新绑定上下文
149 | bindingContext.ImageUrl = u.ToString();
150 | bindingContext.Image = img;
151 | bindingContext.OriginalWidth = img.PixelWidth;
152 | bindingContext.OriginalHeight = img.PixelHeight;
153 |
154 | ResizeSlider.Value = 100;
155 | ScrollToCenter();
156 | }
157 |
158 | ///
159 | /// 异步加载图像,用于加载网络上的图像
160 | ///
161 | void LoadImageAsyn(string uri)
162 | {
163 | StatusPrompt.Content = "正在下载";
164 | PreviewImage.Source = null;
165 | bindingContext.Image = null;
166 | TopContentArea.IsEnabled = false;
167 |
168 | // 异步下载图像
169 | Uri u = new Uri(uri, UriKind.RelativeOrAbsolute);
170 | BitmapImage img = new BitmapImage(u);
171 | img.DownloadCompleted += new EventHandler(ImageDownloadCompleted);
172 | img.DownloadFailed += new EventHandler(ImageDownloadFailed);
173 | }
174 |
175 | ///
176 | /// 图像下载完成时调用
177 | ///
178 | void ImageDownloadCompleted(object sender, EventArgs e)
179 | {
180 | // 异步下载图像完成
181 | StatusPrompt.Content = "下载完成";
182 | TopContentArea.IsEnabled = true;
183 | BitmapImage img = (BitmapImage)sender;
184 | PreviewImage.Source = img;
185 |
186 | // 更新绑定上下文
187 | bindingContext.ImageUrl = img.UriSource.ToString();
188 | bindingContext.Image = img;
189 | bindingContext.OriginalWidth = img.PixelWidth;
190 | bindingContext.OriginalHeight = img.PixelHeight;
191 |
192 | ResizeSlider.Value = 100;
193 | ScrollToCenter();
194 | }
195 |
196 | ///
197 | /// 图像下载失败时调用
198 | ///
199 | void ImageDownloadFailed(object sender, ExceptionEventArgs e)
200 | {
201 | // 异步下载图像失败
202 | StatusPrompt.Content = "无法加载图像";
203 | TopContentArea.IsEnabled = true;
204 |
205 | // 更新绑定上下文
206 | bindingContext.Image = null;
207 | bindingContext.Width = 0;
208 | bindingContext.Height = 0;
209 | bindingContext.OriginalWidth = 0;
210 | bindingContext.OriginalHeight = 0;
211 | }
212 |
213 | void ScrollToCenter()
214 | {
215 | if (PreviewImage.Width > PreviewScroll.ViewportWidth)
216 | {
217 | PreviewScroll.ScrollToHorizontalOffset((PreviewImage.Width - PreviewScroll.ViewportWidth) / 2);
218 | }
219 |
220 | if (PreviewImage.Height > PreviewScroll.ViewportHeight)
221 | {
222 | PreviewScroll.ScrollToVerticalOffset((PreviewImage.Height - PreviewScroll.ViewportHeight) / 2);
223 | }
224 | }
225 | }
226 | }
227 |
--------------------------------------------------------------------------------
/SmithHtmlEditor/Views/TableDialog.xaml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
13 |
16 |
20 |
24 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
--------------------------------------------------------------------------------
/SmithHtmlEditor/Views/TableDialog.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows;
6 | using System.Windows.Controls;
7 | using System.Windows.Data;
8 | using System.Windows.Documents;
9 | using System.Windows.Input;
10 | using System.Windows.Media;
11 | using System.Windows.Media.Imaging;
12 | using System.Windows.Shapes;
13 | using System.Collections.ObjectModel;
14 |
15 | namespace Smith.WPF.HtmlEditor
16 | {
17 | ///
18 | /// TableDialog.xaml 的交互逻辑
19 | ///
20 | public partial class TableDialog : Window
21 | {
22 | TableObject bindingContext;
23 | ReadOnlyCollection unitOptions;
24 | ReadOnlyCollection headerOptions;
25 | ReadOnlyCollection alignmentOptions;
26 |
27 | public TableDialog()
28 | {
29 | InitializeComponent();
30 | InitUnitOptions();
31 | InitHeaderOptions();
32 | InitAlignmentOptions();
33 | InitEvents();
34 | InitBindingContext();
35 | }
36 |
37 | public TableObject Model
38 | {
39 | get { return bindingContext; }
40 | private set
41 | {
42 | bindingContext = value;
43 | this.DataContext = bindingContext;
44 | }
45 | }
46 |
47 | void InitUnitOptions()
48 | {
49 | List ls = new List { Unit.Pixel, Unit.Percentage };
50 | unitOptions = new ReadOnlyCollection(ls);
51 |
52 | WidthUnitSelection.ItemsSource = ls;
53 | HeightUnitSelection.ItemsSource = ls;
54 | SpaceUnitSelection.ItemsSource = ls;
55 | PaddingUnitSelection.ItemsSource = ls;
56 | }
57 |
58 | void InitHeaderOptions()
59 | {
60 | List ls = new List
61 | {
62 | TableHeaderOption.Default,
63 | TableHeaderOption.FirstRow,
64 | TableHeaderOption.FirstColumn,
65 | TableHeaderOption.FirstRowAndColumn
66 | };
67 | headerOptions = new ReadOnlyCollection(ls);
68 | HeaderSelection.ItemsSource = headerOptions;
69 | }
70 |
71 | void InitAlignmentOptions()
72 | {
73 | List ls = new List()
74 | {
75 | TableAlignment.Default,
76 | TableAlignment.Left,
77 | TableAlignment.Right,
78 | TableAlignment.Center
79 | };
80 | alignmentOptions = new ReadOnlyCollection(ls);
81 | AlignmentSelection.ItemsSource = alignmentOptions;
82 | }
83 |
84 | void InitBindingContext()
85 | {
86 | Model = new TableObject
87 | {
88 | Columns = 5,
89 | Rows = 3,
90 | Border = 1,
91 | Width = 100,
92 | Height = 100,
93 | WidthUnit = Unit.Percentage,
94 | HeightUnit = Unit.Pixel,
95 | SpacingUnit = Unit.Pixel,
96 | PaddingUnit = Unit.Pixel,
97 | HeaderOption = TableHeaderOption.Default,
98 | Alignment = TableAlignment.Default
99 | };
100 | }
101 |
102 | void InitEvents()
103 | {
104 | OkayButton.Click += new RoutedEventHandler(OkayButton_Click);
105 | CancelButton.Click += new RoutedEventHandler(CancelButton_Click);
106 | }
107 |
108 | void CancelButton_Click(object sender, RoutedEventArgs e)
109 | {
110 | e.Handled = true;
111 | this.Close();
112 | }
113 |
114 | void OkayButton_Click(object sender, RoutedEventArgs e)
115 | {
116 | e.Handled = true;
117 | if (System.Windows.Interop.ComponentDispatcher.IsThreadModal) this.DialogResult = true;
118 | this.Close();
119 | }
120 | }
121 | }
122 |
--------------------------------------------------------------------------------
/SmithHtmlEditor/obj/wappublish/win-x64/SmithHtmlEditor.csproj.nuget.cache:
--------------------------------------------------------------------------------
1 | {
2 | "version": 1,
3 | "dgSpecHash": "KmnAJ/5afu/PnJRVQW/Pf9pt/0giry9PVE3ZOHnGG0qy6kDNLLjPgKWDkfZaYblpW+flkhazOcKMHBUuju7PhA==",
4 | "success": true
5 | }
--------------------------------------------------------------------------------
/SmithHtmlEditor/obj/wappublish/win-x64/SmithHtmlEditor.csproj.nuget.dgspec.json:
--------------------------------------------------------------------------------
1 | {
2 | "format": 1,
3 | "restore": {
4 | "C:\\Work\\Brupper\\SiEnergy\\Dependences\\smithhtmleditor\\SmithHtmlEditor\\SmithHtmlEditor.csproj": {}
5 | },
6 | "projects": {
7 | "C:\\Work\\Brupper\\SiEnergy\\Dependences\\smithhtmleditor\\SmithHtmlEditor\\SmithHtmlEditor.csproj": {
8 | "version": "1.0.0",
9 | "restore": {
10 | "projectUniqueName": "C:\\Work\\Brupper\\SiEnergy\\Dependences\\smithhtmleditor\\SmithHtmlEditor\\SmithHtmlEditor.csproj",
11 | "projectName": "Smith.WPF.HtmlEditor",
12 | "projectPath": "C:\\Work\\Brupper\\SiEnergy\\Dependences\\smithhtmleditor\\SmithHtmlEditor\\SmithHtmlEditor.csproj",
13 | "packagesPath": "C:\\Users\\adamb\\.nuget\\packages\\",
14 | "outputPath": "C:\\Work\\Brupper\\SiEnergy\\Dependences\\smithhtmleditor\\SmithHtmlEditor\\obj\\",
15 | "projectStyle": "PackageReference",
16 | "crossTargeting": true,
17 | "fallbackFolders": [
18 | "C:\\Microsoft\\Xamarin\\NuGet\\"
19 | ],
20 | "configFilePaths": [
21 | "C:\\Users\\adamb\\AppData\\Roaming\\NuGet\\NuGet.Config",
22 | "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config",
23 | "C:\\Program Files (x86)\\NuGet\\Config\\Xamarin.Offline.config"
24 | ],
25 | "originalTargetFrameworks": [
26 | "net461",
27 | "net462",
28 | "net47",
29 | "net471",
30 | "net472",
31 | "net48",
32 | "netcoreapp3.0",
33 | "netcoreapp3.1"
34 | ],
35 | "sources": {
36 | "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
37 | "https://api.nuget.org/v3/index.json": {},
38 | },
39 | "frameworks": {
40 | "netcoreapp3.0": {
41 | "projectReferences": {}
42 | },
43 | "netcoreapp3.1": {
44 | "projectReferences": {}
45 | },
46 | "net461": {
47 | "projectReferences": {}
48 | },
49 | "net462": {
50 | "projectReferences": {}
51 | },
52 | "net47": {
53 | "projectReferences": {}
54 | },
55 | "net471": {
56 | "projectReferences": {}
57 | },
58 | "net472": {
59 | "projectReferences": {}
60 | },
61 | "net48": {
62 | "projectReferences": {}
63 | }
64 | },
65 | "warningProperties": {
66 | "warnAsError": [
67 | "NU1605"
68 | ]
69 | }
70 | },
71 | "frameworks": {
72 | "netcoreapp3.0": {
73 | "imports": [
74 | "net461",
75 | "net462",
76 | "net47",
77 | "net471",
78 | "net472",
79 | "net48"
80 | ],
81 | "assetTargetFallback": true,
82 | "warn": true,
83 | "frameworkReferences": {
84 | "Microsoft.NETCore.App": {
85 | "privateAssets": "all"
86 | },
87 | "Microsoft.WindowsDesktop.App": {
88 | "privateAssets": "none"
89 | }
90 | },
91 | "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.201\\RuntimeIdentifierGraph.json"
92 | },
93 | "netcoreapp3.1": {
94 | "imports": [
95 | "net461",
96 | "net462",
97 | "net47",
98 | "net471",
99 | "net472",
100 | "net48"
101 | ],
102 | "assetTargetFallback": true,
103 | "warn": true,
104 | "frameworkReferences": {
105 | "Microsoft.NETCore.App": {
106 | "privateAssets": "all"
107 | },
108 | "Microsoft.WindowsDesktop.App": {
109 | "privateAssets": "none"
110 | }
111 | },
112 | "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.201\\RuntimeIdentifierGraph.json"
113 | },
114 | "net461": {
115 | "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.201\\RuntimeIdentifierGraph.json"
116 | },
117 | "net462": {
118 | "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.201\\RuntimeIdentifierGraph.json"
119 | },
120 | "net47": {
121 | "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.201\\RuntimeIdentifierGraph.json"
122 | },
123 | "net471": {
124 | "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.201\\RuntimeIdentifierGraph.json"
125 | },
126 | "net472": {
127 | "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.201\\RuntimeIdentifierGraph.json"
128 | },
129 | "net48": {
130 | "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.201\\RuntimeIdentifierGraph.json"
131 | }
132 | },
133 | "runtimes": {
134 | "win-x86": {
135 | "#import": []
136 | }
137 | }
138 | }
139 | }
140 | }
--------------------------------------------------------------------------------
/SmithHtmlEditor/obj/wappublish/win-x64/SmithHtmlEditor.csproj.nuget.g.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | True
5 | NuGet
6 | $(MSBuildThisFileDirectory)project.assets.json
7 | $(UserProfile)\.nuget\packages\
8 | C:\Users\adamb\.nuget\packages\;C:\Microsoft\Xamarin\NuGet\
9 | PackageReference
10 | 5.5.0
11 |
12 |
13 | $(MSBuildAllProjects);$(MSBuildThisFileFullPath)
14 |
15 |
--------------------------------------------------------------------------------
/SmithHtmlEditor/obj/wappublish/win-x64/SmithHtmlEditor.csproj.nuget.g.targets:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | $(MSBuildAllProjects);$(MSBuildThisFileFullPath)
5 |
6 |
--------------------------------------------------------------------------------
/SmithHtmlEditor/obj/wappublish/win-x64/project.assets.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": 3,
3 | "targets": {
4 | ".NETCoreApp,Version=v3.0": {},
5 | ".NETCoreApp,Version=v3.0/win-x86": {},
6 | ".NETCoreApp,Version=v3.1": {},
7 | ".NETCoreApp,Version=v3.1/win-x86": {},
8 | ".NETFramework,Version=v4.6.1": {},
9 | ".NETFramework,Version=v4.6.1/win-x86": {},
10 | ".NETFramework,Version=v4.6.2": {},
11 | ".NETFramework,Version=v4.6.2/win-x86": {},
12 | ".NETFramework,Version=v4.7": {},
13 | ".NETFramework,Version=v4.7/win-x86": {},
14 | ".NETFramework,Version=v4.7.1": {},
15 | ".NETFramework,Version=v4.7.1/win-x86": {},
16 | ".NETFramework,Version=v4.7.2": {},
17 | ".NETFramework,Version=v4.7.2/win-x86": {},
18 | ".NETFramework,Version=v4.8": {},
19 | ".NETFramework,Version=v4.8/win-x86": {}
20 | },
21 | "libraries": {},
22 | "projectFileDependencyGroups": {
23 | ".NETCoreApp,Version=v3.0": [],
24 | ".NETCoreApp,Version=v3.1": [],
25 | ".NETFramework,Version=v4.6.1": [],
26 | ".NETFramework,Version=v4.6.2": [],
27 | ".NETFramework,Version=v4.7": [],
28 | ".NETFramework,Version=v4.7.1": [],
29 | ".NETFramework,Version=v4.7.2": [],
30 | ".NETFramework,Version=v4.8": []
31 | },
32 | "packageFolders": {
33 | "C:\\Users\\adamb\\.nuget\\packages\\": {},
34 | "C:\\Microsoft\\Xamarin\\NuGet\\": {}
35 | },
36 | "project": {
37 | "version": "1.0.0",
38 | "restore": {
39 | "projectUniqueName": "C:\\Work\\Brupper\\SiEnergy\\Dependences\\smithhtmleditor\\SmithHtmlEditor\\SmithHtmlEditor.csproj",
40 | "projectName": "Smith.WPF.HtmlEditor",
41 | "projectPath": "C:\\Work\\Brupper\\SiEnergy\\Dependences\\smithhtmleditor\\SmithHtmlEditor\\SmithHtmlEditor.csproj",
42 | "packagesPath": "C:\\Users\\adamb\\.nuget\\packages\\",
43 | "outputPath": "C:\\Work\\Brupper\\SiEnergy\\Dependences\\smithhtmleditor\\SmithHtmlEditor\\obj\\",
44 | "projectStyle": "PackageReference",
45 | "crossTargeting": true,
46 | "fallbackFolders": [
47 | "C:\\Microsoft\\Xamarin\\NuGet\\"
48 | ],
49 | "configFilePaths": [
50 | "C:\\Users\\adamb\\AppData\\Roaming\\NuGet\\NuGet.Config",
51 | "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config",
52 | "C:\\Program Files (x86)\\NuGet\\Config\\Xamarin.Offline.config"
53 | ],
54 | "originalTargetFrameworks": [
55 | "net461",
56 | "net462",
57 | "net47",
58 | "net471",
59 | "net472",
60 | "net48",
61 | "netcoreapp3.0",
62 | "netcoreapp3.1"
63 | ],
64 | "sources": {
65 | "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
66 | "https://api.nuget.org/v3/index.json": {},
67 | },
68 | "frameworks": {
69 | "netcoreapp3.0": {
70 | "projectReferences": {}
71 | },
72 | "netcoreapp3.1": {
73 | "projectReferences": {}
74 | },
75 | "net461": {
76 | "projectReferences": {}
77 | },
78 | "net462": {
79 | "projectReferences": {}
80 | },
81 | "net47": {
82 | "projectReferences": {}
83 | },
84 | "net471": {
85 | "projectReferences": {}
86 | },
87 | "net472": {
88 | "projectReferences": {}
89 | },
90 | "net48": {
91 | "projectReferences": {}
92 | }
93 | },
94 | "warningProperties": {
95 | "warnAsError": [
96 | "NU1605"
97 | ]
98 | }
99 | },
100 | "frameworks": {
101 | "netcoreapp3.0": {
102 | "imports": [
103 | "net461",
104 | "net462",
105 | "net47",
106 | "net471",
107 | "net472",
108 | "net48"
109 | ],
110 | "assetTargetFallback": true,
111 | "warn": true,
112 | "frameworkReferences": {
113 | "Microsoft.NETCore.App": {
114 | "privateAssets": "all"
115 | },
116 | "Microsoft.WindowsDesktop.App": {
117 | "privateAssets": "none"
118 | }
119 | },
120 | "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.201\\RuntimeIdentifierGraph.json"
121 | },
122 | "netcoreapp3.1": {
123 | "imports": [
124 | "net461",
125 | "net462",
126 | "net47",
127 | "net471",
128 | "net472",
129 | "net48"
130 | ],
131 | "assetTargetFallback": true,
132 | "warn": true,
133 | "frameworkReferences": {
134 | "Microsoft.NETCore.App": {
135 | "privateAssets": "all"
136 | },
137 | "Microsoft.WindowsDesktop.App": {
138 | "privateAssets": "none"
139 | }
140 | },
141 | "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.201\\RuntimeIdentifierGraph.json"
142 | },
143 | "net461": {
144 | "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.201\\RuntimeIdentifierGraph.json"
145 | },
146 | "net462": {
147 | "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.201\\RuntimeIdentifierGraph.json"
148 | },
149 | "net47": {
150 | "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.201\\RuntimeIdentifierGraph.json"
151 | },
152 | "net471": {
153 | "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.201\\RuntimeIdentifierGraph.json"
154 | },
155 | "net472": {
156 | "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.201\\RuntimeIdentifierGraph.json"
157 | },
158 | "net48": {
159 | "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.201\\RuntimeIdentifierGraph.json"
160 | }
161 | },
162 | "runtimes": {
163 | "win-x86": {
164 | "#import": []
165 | }
166 | }
167 | }
168 | }
--------------------------------------------------------------------------------
/SmithHtmlEditor/obj/wappublish/win-x86/SmithHtmlEditor.csproj.nuget.cache:
--------------------------------------------------------------------------------
1 | {
2 | "version": 1,
3 | "dgSpecHash": "KmnAJ/5afu/PnJRVQW/Pf9pt/0giry9PVE3ZOHnGG0qy6kDNLLjPgKWDkfZaYblpW+flkhazOcKMHBUuju7PhA==",
4 | "success": true
5 | }
--------------------------------------------------------------------------------
/SmithHtmlEditor/obj/wappublish/win-x86/SmithHtmlEditor.csproj.nuget.dgspec.json:
--------------------------------------------------------------------------------
1 | {
2 | "format": 1,
3 | "restore": {
4 | "C:\\Work\\Brupper\\SiEnergy\\Dependences\\smithhtmleditor\\SmithHtmlEditor\\SmithHtmlEditor.csproj": {}
5 | },
6 | "projects": {
7 | "C:\\Work\\Brupper\\SiEnergy\\Dependences\\smithhtmleditor\\SmithHtmlEditor\\SmithHtmlEditor.csproj": {
8 | "version": "1.0.0",
9 | "restore": {
10 | "projectUniqueName": "C:\\Work\\Brupper\\SiEnergy\\Dependences\\smithhtmleditor\\SmithHtmlEditor\\SmithHtmlEditor.csproj",
11 | "projectName": "Smith.WPF.HtmlEditor",
12 | "projectPath": "C:\\Work\\Brupper\\SiEnergy\\Dependences\\smithhtmleditor\\SmithHtmlEditor\\SmithHtmlEditor.csproj",
13 | "packagesPath": "C:\\Users\\adamb\\.nuget\\packages\\",
14 | "outputPath": "C:\\Work\\Brupper\\SiEnergy\\Dependences\\smithhtmleditor\\SmithHtmlEditor\\obj\\",
15 | "projectStyle": "PackageReference",
16 | "crossTargeting": true,
17 | "fallbackFolders": [
18 | "C:\\Microsoft\\Xamarin\\NuGet\\"
19 | ],
20 | "configFilePaths": [
21 | "C:\\Users\\adamb\\AppData\\Roaming\\NuGet\\NuGet.Config",
22 | "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config",
23 | "C:\\Program Files (x86)\\NuGet\\Config\\Xamarin.Offline.config"
24 | ],
25 | "originalTargetFrameworks": [
26 | "net461",
27 | "net462",
28 | "net47",
29 | "net471",
30 | "net472",
31 | "net48",
32 | "netcoreapp3.0",
33 | "netcoreapp3.1"
34 | ],
35 | "sources": {
36 | "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
37 | "https://api.nuget.org/v3/index.json": {},
38 | },
39 | "frameworks": {
40 | "netcoreapp3.0": {
41 | "projectReferences": {}
42 | },
43 | "netcoreapp3.1": {
44 | "projectReferences": {}
45 | },
46 | "net461": {
47 | "projectReferences": {}
48 | },
49 | "net462": {
50 | "projectReferences": {}
51 | },
52 | "net47": {
53 | "projectReferences": {}
54 | },
55 | "net471": {
56 | "projectReferences": {}
57 | },
58 | "net472": {
59 | "projectReferences": {}
60 | },
61 | "net48": {
62 | "projectReferences": {}
63 | }
64 | },
65 | "warningProperties": {
66 | "warnAsError": [
67 | "NU1605"
68 | ]
69 | }
70 | },
71 | "frameworks": {
72 | "netcoreapp3.0": {
73 | "imports": [
74 | "net461",
75 | "net462",
76 | "net47",
77 | "net471",
78 | "net472",
79 | "net48"
80 | ],
81 | "assetTargetFallback": true,
82 | "warn": true,
83 | "frameworkReferences": {
84 | "Microsoft.NETCore.App": {
85 | "privateAssets": "all"
86 | },
87 | "Microsoft.WindowsDesktop.App": {
88 | "privateAssets": "none"
89 | }
90 | },
91 | "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.201\\RuntimeIdentifierGraph.json"
92 | },
93 | "netcoreapp3.1": {
94 | "imports": [
95 | "net461",
96 | "net462",
97 | "net47",
98 | "net471",
99 | "net472",
100 | "net48"
101 | ],
102 | "assetTargetFallback": true,
103 | "warn": true,
104 | "frameworkReferences": {
105 | "Microsoft.NETCore.App": {
106 | "privateAssets": "all"
107 | },
108 | "Microsoft.WindowsDesktop.App": {
109 | "privateAssets": "none"
110 | }
111 | },
112 | "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.201\\RuntimeIdentifierGraph.json"
113 | },
114 | "net461": {
115 | "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.201\\RuntimeIdentifierGraph.json"
116 | },
117 | "net462": {
118 | "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.201\\RuntimeIdentifierGraph.json"
119 | },
120 | "net47": {
121 | "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.201\\RuntimeIdentifierGraph.json"
122 | },
123 | "net471": {
124 | "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.201\\RuntimeIdentifierGraph.json"
125 | },
126 | "net472": {
127 | "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.201\\RuntimeIdentifierGraph.json"
128 | },
129 | "net48": {
130 | "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.201\\RuntimeIdentifierGraph.json"
131 | }
132 | },
133 | "runtimes": {
134 | "win-x86": {
135 | "#import": []
136 | }
137 | }
138 | }
139 | }
140 | }
--------------------------------------------------------------------------------
/SmithHtmlEditor/obj/wappublish/win-x86/SmithHtmlEditor.csproj.nuget.g.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | True
5 | NuGet
6 | $(MSBuildThisFileDirectory)project.assets.json
7 | $(UserProfile)\.nuget\packages\
8 | C:\Users\adamb\.nuget\packages\;C:\Microsoft\Xamarin\NuGet\
9 | PackageReference
10 | 5.5.0
11 |
12 |
13 | $(MSBuildAllProjects);$(MSBuildThisFileFullPath)
14 |
15 |
--------------------------------------------------------------------------------
/SmithHtmlEditor/obj/wappublish/win-x86/SmithHtmlEditor.csproj.nuget.g.targets:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | $(MSBuildAllProjects);$(MSBuildThisFileFullPath)
5 |
6 |
--------------------------------------------------------------------------------
/SmithHtmlEditor/obj/wappublish/win-x86/project.assets.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": 3,
3 | "targets": {
4 | ".NETCoreApp,Version=v3.0": {},
5 | ".NETCoreApp,Version=v3.0/win-x86": {},
6 | ".NETCoreApp,Version=v3.1": {},
7 | ".NETCoreApp,Version=v3.1/win-x86": {},
8 | ".NETFramework,Version=v4.6.1": {},
9 | ".NETFramework,Version=v4.6.1/win-x86": {},
10 | ".NETFramework,Version=v4.6.2": {},
11 | ".NETFramework,Version=v4.6.2/win-x86": {},
12 | ".NETFramework,Version=v4.7": {},
13 | ".NETFramework,Version=v4.7/win-x86": {},
14 | ".NETFramework,Version=v4.7.1": {},
15 | ".NETFramework,Version=v4.7.1/win-x86": {},
16 | ".NETFramework,Version=v4.7.2": {},
17 | ".NETFramework,Version=v4.7.2/win-x86": {},
18 | ".NETFramework,Version=v4.8": {},
19 | ".NETFramework,Version=v4.8/win-x86": {}
20 | },
21 | "libraries": {},
22 | "projectFileDependencyGroups": {
23 | ".NETCoreApp,Version=v3.0": [],
24 | ".NETCoreApp,Version=v3.1": [],
25 | ".NETFramework,Version=v4.6.1": [],
26 | ".NETFramework,Version=v4.6.2": [],
27 | ".NETFramework,Version=v4.7": [],
28 | ".NETFramework,Version=v4.7.1": [],
29 | ".NETFramework,Version=v4.7.2": [],
30 | ".NETFramework,Version=v4.8": []
31 | },
32 | "packageFolders": {
33 | "C:\\Users\\adamb\\.nuget\\packages\\": {},
34 | "C:\\Microsoft\\Xamarin\\NuGet\\": {}
35 | },
36 | "project": {
37 | "version": "1.0.0",
38 | "restore": {
39 | "projectUniqueName": "C:\\Work\\Brupper\\SiEnergy\\Dependences\\smithhtmleditor\\SmithHtmlEditor\\SmithHtmlEditor.csproj",
40 | "projectName": "Smith.WPF.HtmlEditor",
41 | "projectPath": "C:\\Work\\Brupper\\SiEnergy\\Dependences\\smithhtmleditor\\SmithHtmlEditor\\SmithHtmlEditor.csproj",
42 | "packagesPath": "C:\\Users\\adamb\\.nuget\\packages\\",
43 | "outputPath": "C:\\Work\\Brupper\\SiEnergy\\Dependences\\smithhtmleditor\\SmithHtmlEditor\\obj\\",
44 | "projectStyle": "PackageReference",
45 | "crossTargeting": true,
46 | "fallbackFolders": [
47 | "C:\\Microsoft\\Xamarin\\NuGet\\"
48 | ],
49 | "configFilePaths": [
50 | "C:\\Users\\adamb\\AppData\\Roaming\\NuGet\\NuGet.Config",
51 | "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config",
52 | "C:\\Program Files (x86)\\NuGet\\Config\\Xamarin.Offline.config"
53 | ],
54 | "originalTargetFrameworks": [
55 | "net461",
56 | "net462",
57 | "net47",
58 | "net471",
59 | "net472",
60 | "net48",
61 | "netcoreapp3.0",
62 | "netcoreapp3.1"
63 | ],
64 | "sources": {
65 | "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
66 | "https://api.nuget.org/v3/index.json": {},
67 | },
68 | "frameworks": {
69 | "netcoreapp3.0": {
70 | "projectReferences": {}
71 | },
72 | "netcoreapp3.1": {
73 | "projectReferences": {}
74 | },
75 | "net461": {
76 | "projectReferences": {}
77 | },
78 | "net462": {
79 | "projectReferences": {}
80 | },
81 | "net47": {
82 | "projectReferences": {}
83 | },
84 | "net471": {
85 | "projectReferences": {}
86 | },
87 | "net472": {
88 | "projectReferences": {}
89 | },
90 | "net48": {
91 | "projectReferences": {}
92 | }
93 | },
94 | "warningProperties": {
95 | "warnAsError": [
96 | "NU1605"
97 | ]
98 | }
99 | },
100 | "frameworks": {
101 | "netcoreapp3.0": {
102 | "imports": [
103 | "net461",
104 | "net462",
105 | "net47",
106 | "net471",
107 | "net472",
108 | "net48"
109 | ],
110 | "assetTargetFallback": true,
111 | "warn": true,
112 | "frameworkReferences": {
113 | "Microsoft.NETCore.App": {
114 | "privateAssets": "all"
115 | },
116 | "Microsoft.WindowsDesktop.App": {
117 | "privateAssets": "none"
118 | }
119 | },
120 | "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.201\\RuntimeIdentifierGraph.json"
121 | },
122 | "netcoreapp3.1": {
123 | "imports": [
124 | "net461",
125 | "net462",
126 | "net47",
127 | "net471",
128 | "net472",
129 | "net48"
130 | ],
131 | "assetTargetFallback": true,
132 | "warn": true,
133 | "frameworkReferences": {
134 | "Microsoft.NETCore.App": {
135 | "privateAssets": "all"
136 | },
137 | "Microsoft.WindowsDesktop.App": {
138 | "privateAssets": "none"
139 | }
140 | },
141 | "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.201\\RuntimeIdentifierGraph.json"
142 | },
143 | "net461": {
144 | "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.201\\RuntimeIdentifierGraph.json"
145 | },
146 | "net462": {
147 | "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.201\\RuntimeIdentifierGraph.json"
148 | },
149 | "net47": {
150 | "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.201\\RuntimeIdentifierGraph.json"
151 | },
152 | "net471": {
153 | "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.201\\RuntimeIdentifierGraph.json"
154 | },
155 | "net472": {
156 | "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.201\\RuntimeIdentifierGraph.json"
157 | },
158 | "net48": {
159 | "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.201\\RuntimeIdentifierGraph.json"
160 | }
161 | },
162 | "runtimes": {
163 | "win-x86": {
164 | "#import": []
165 | }
166 | }
167 | }
168 | }
--------------------------------------------------------------------------------
/SmithHtmlEditor/smithhtmleditor.config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/SmithHtmlEditor/smithhtmleditor.stylesheet.css:
--------------------------------------------------------------------------------
1 | body
2 | {
3 | font-family: Segoe UI;
4 | font-size: 10pt;
5 | line-height: 10pt;
6 | }
7 | p
8 | {
9 | line-height: 10pt;
10 | padding:3pt;
11 | margin:0;
12 | }
13 | ul li
14 | {
15 | line-height: 16px;
16 | }
17 | ol li
18 | {
19 | line-height: 16px;
20 | }
--------------------------------------------------------------------------------
/clean.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 | @echo Deleting all BIN and OBJ folders...
3 | for /d /r . %%d in (bin,obj) do @if exist "%%d" rd /s/q "%%d"
4 | @echo BIN and OBJ folders successfully deleted :)
5 |
6 | rd /s /q ".vs"
7 | @echo .vs folder successfully deleted :) Close the window.
8 |
9 | pause > nul
--------------------------------------------------------------------------------