Ok, Just Do It!

This commit is contained in:
Vitaliy
2017-02-18 00:15:59 +03:00
parent f0913f9873
commit 5c46ef7b7f
122 changed files with 1712 additions and 2177 deletions

View File

@@ -0,0 +1,163 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\CefSharp.WinForms.53.0.1\build\CefSharp.WinForms.props" Condition="Exists('..\packages\CefSharp.WinForms.53.0.1\build\CefSharp.WinForms.props')" />
<Import Project="..\packages\CefSharp.Common.53.0.1\build\CefSharp.Common.props" Condition="Exists('..\packages\CefSharp.Common.53.0.1\build\CefSharp.Common.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{556DD6D9-E5EE-4161-9653-5134FCE99946}</ProjectGuid>
<OutputType>library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BrightSharp.Toolkit.Extra</RootNamespace>
<AssemblyName>BrightSharp.Toolkit.Extra</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>..\build.extra\x64\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>..\build.extra\x64\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>..\build.extra\x86\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>..\build.extra\x86\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="UIAutomationProvider" />
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="WindowsFormsIntegration" />
</ItemGroup>
<ItemGroup>
<Page Include="CKEditor.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="DesignTimeConfig.cs" />
<Compile Include="CKEditor.xaml.cs">
<DependentUpon>CKEditor.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Include="LocalSchemeHandlerFactory.cs" />
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="packages.config">
<SubType>Designer</SubType>
</None>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<AppDesigner Include="Properties\" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\HtmlEditor.html" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\cef.redist.x64.3.2785.1486\build\cef.redist.x64.targets" Condition="Exists('..\packages\cef.redist.x64.3.2785.1486\build\cef.redist.x64.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\cef.redist.x64.3.2785.1486\build\cef.redist.x64.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\cef.redist.x64.3.2785.1486\build\cef.redist.x64.targets'))" />
<Error Condition="!Exists('..\packages\cef.redist.x86.3.2785.1486\build\cef.redist.x86.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\cef.redist.x86.3.2785.1486\build\cef.redist.x86.targets'))" />
<Error Condition="!Exists('..\packages\CefSharp.Common.53.0.1\build\CefSharp.Common.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\CefSharp.Common.53.0.1\build\CefSharp.Common.props'))" />
<Error Condition="!Exists('..\packages\CefSharp.Common.53.0.1\build\CefSharp.Common.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\CefSharp.Common.53.0.1\build\CefSharp.Common.targets'))" />
<Error Condition="!Exists('..\packages\CefSharp.WinForms.53.0.1\build\CefSharp.WinForms.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\CefSharp.WinForms.53.0.1\build\CefSharp.WinForms.props'))" />
<Error Condition="!Exists('..\packages\CefSharp.WinForms.53.0.1\build\CefSharp.WinForms.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\CefSharp.WinForms.53.0.1\build\CefSharp.WinForms.targets'))" />
</Target>
<Import Project="..\packages\cef.redist.x86.3.2785.1486\build\cef.redist.x86.targets" Condition="Exists('..\packages\cef.redist.x86.3.2785.1486\build\cef.redist.x86.targets')" />
<Import Project="..\packages\CefSharp.Common.53.0.1\build\CefSharp.Common.targets" Condition="Exists('..\packages\CefSharp.Common.53.0.1\build\CefSharp.Common.targets')" />
<Import Project="..\packages\CefSharp.WinForms.53.0.1\build\CefSharp.WinForms.targets" Condition="Exists('..\packages\CefSharp.WinForms.53.0.1\build\CefSharp.WinForms.targets')" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -0,0 +1,14 @@
<UserControl x:Class="BrightSharp.Toolkit.Extra.CKEditor"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<UserControl.Template>
<ControlTemplate TargetType="UserControl">
<WindowsFormsHost x:Name="PART_Host">
</WindowsFormsHost>
</ControlTemplate>
</UserControl.Template>
</UserControl>

View File

@@ -0,0 +1,282 @@
using System;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Threading;
using System.Web.Script.Serialization;
using System.Windows;
using System.Windows.Forms.Integration;
using System.Windows.Threading;
using CefSharp;
using CefSharp.WinForms;
namespace BrightSharp.Toolkit.Extra
{
public partial class CKEditor
{
internal ChromiumWebBrowser Browser;
private CKEditorObjectForScripting _objectForScripting;
public static void InitializeCef(bool useCache = true, bool reinit = false)
{
Dispatcher.CurrentDispatcher.ShutdownStarted += (s, e) => Cef.Shutdown();
if (!reinit && Cef.IsInitialized) return;
CefSettings settings;
if (useCache)
{
var cacheDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
"cefCache");
Directory.CreateDirectory(cacheDir);
settings = new CefSettings
{
CachePath = cacheDir
};
}
else
{
settings = new CefSettings();
}
settings.RegisterScheme(new CefCustomScheme
{
SchemeName = "local",
SchemeHandlerFactory = new FolderSchemeHandlerFactory(Environment.CurrentDirectory)
});
Cef.Initialize(settings);
}
private static void InitializeDesignTimeDirectory()
{
if (DesignerProperties.GetIsInDesignMode(new DependencyObject()))
{
Environment.CurrentDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
var nugetPackages = DesignTimeConfig.GetNugetPackagesDirectory();
if (!Directory.Exists(nugetPackages)) return;
var prefix = IntPtr.Size == 4 ? "x86" : "x64";
var allDirectoriesToCopy = Directory.GetDirectories(nugetPackages, "cef.redist.*")
.Union(Directory.GetDirectories(nugetPackages, "CefSharp.*"))
.SelectMany(d => Directory.GetDirectories(d, prefix, SearchOption.AllDirectories));
foreach (var dirForCopy in allDirectoriesToCopy)
{
foreach (var file in Directory.GetFiles(dirForCopy))
{
try { File.Copy(file, Path.Combine(Environment.CurrentDirectory, Path.GetFileName(file)), false); }
catch (Exception) { }
}
foreach (var file in Directory.GetFiles(Directory.GetParent(dirForCopy).FullName))
{
try { File.Copy(file, Path.Combine(Environment.CurrentDirectory, Path.GetFileName(file)), false); }
catch (Exception) { }
}
}
}
}
static CKEditor()
{
InitializeDesignTimeDirectory();
if (!File.Exists("CefSharp.Core.dll"))
return;
InitializeCef();
}
public CKEditor()
{
InitializeComponent();
}
public override void OnApplyTemplate()
{
if (!File.Exists("CefSharp.dll"))
return;
var host = (WindowsFormsHost)Template.FindName("PART_Host", this);
host.Child = Browser = new ChromiumWebBrowser("about:blank");
_objectForScripting = new CKEditorObjectForScripting(this);
Browser.KeyboardHandler = new FixKeyboardHandler();
Browser.IsBrowserInitializedChanged += (s, e) =>
{
if (e.IsBrowserInitialized)
RefreshState();
};
base.OnApplyTemplate();
}
public void RefreshState()
{
if (Browser != null && Browser.IsBrowserInitialized)
{
Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() =>
{
var docContent = BuildDocContent();
Browser.LoadString(docContent, "about:blank");
}));
UpdateDevToolsState();
}
}
protected override void OnContentChanged(object oldContent, object newContent)
{
if (Browser != null && _objectForScripting != null && (string)newContent != _objectForScripting.NewData)
{
//This is not from js
Browser.EvaluateScriptAsync($"setData(`{newContent}`)").Wait(TimeSpan.FromSeconds(2));
}
base.OnContentChanged(oldContent, newContent);
}
public string PackageType
{
get { return (string)GetValue(PackageTypeProperty); }
set { SetValue(PackageTypeProperty, value); }
}
public static readonly DependencyProperty PackageTypeProperty =
DependencyProperty.Register("PackageType", typeof(string), typeof(CKEditor), new PropertyMetadata("standard", UpdatePackageType));
private static void UpdatePackageType(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var editor = (CKEditor)d;
editor.RefreshState();
}
public bool ShowDevTools
{
get { return (bool)GetValue(ShowDevToolsProperty); }
set { SetValue(ShowDevToolsProperty, value); }
}
public static readonly DependencyProperty ShowDevToolsProperty =
DependencyProperty.Register("ShowDevTools", typeof(bool), typeof(CKEditor), new PropertyMetadata(false, ShowDevToolsChanged));
private static void ShowDevToolsChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var editor = (CKEditor)d;
editor.UpdateDevToolsState();
}
private void UpdateDevToolsState()
{
if (Browser != null && Browser.IsBrowserInitialized)
{
Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() =>
{
if (ShowDevTools)
Browser.ShowDevTools();
else
Browser.CloseDevTools();
}));
}
}
private string BuildDocContent()
{
var docContent = Properties.Resources.HtmlEditor;
if (EditorConfiguration != null)
{
EditorConfiguration.Optimize(PackageType);
docContent = docContent.Replace("$$CONFIG",
new JavaScriptSerializer().Serialize(EditorConfiguration));
docContent = docContent.Replace("$$PACKAGE", PackageType);
}
docContent = docContent.Replace("$$CONTENT", (Content ?? "").ToString());
return docContent;
}
public CKEditorConfig EditorConfiguration
{
get { return (CKEditorConfig)GetValue(EditorConfigurationProperty); }
set { SetValue(EditorConfigurationProperty, value); }
}
public static readonly DependencyProperty EditorConfigurationProperty =
DependencyProperty.Register("EditorConfiguration", typeof(CKEditorConfig), typeof(CKEditor), new PropertyMetadata(new CKEditorConfig()));
}
[SuppressMessage("ReSharper", "InconsistentNaming")]
public class CKEditorConfig
{
public string[] contentsCss { get; set; }
public string language { get; set; } = Thread.CurrentThread.CurrentUICulture.Name;
public string removeButtons { get; set; } =
"Save,Print,Preview,Maximize,ShowBlocks,Paste,PasteText,PasteFromWord";
public string extraAllowedContent { get; set; } = "span;ul;li;table;td;style;*[id];*(*);*{*}";
public string removePlugins { get; set; } = "resize";
public void Optimize(string packageType)
{
if (string.Equals("basic", packageType, StringComparison.InvariantCultureIgnoreCase))
{
//TODO Basic configuration has many problems.
//TODO Need think do we need it, or can we use Standard package as Basic to emulate Basic (from CKE) ?
}
}
}
internal class CKEditorObjectForScripting
{
private CKEditor _editor;
internal string NewData;
public CKEditorObjectForScripting(CKEditor editor)
{
_editor = editor;
_editor.Browser.RegisterJsObject("$$OBJ", this);
}
[SuppressMessage("ReSharper", "UnusedMember.Global")]
public void SetupContent(string newData)
{
NewData = newData;
_editor.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() => _editor.Content = NewData));
}
}
public class CKEditorDesignTimeSettings
{
public static string DesignTimeCefBinariesDirectory { get; set; }
}
class FixKeyboardHandler : IKeyboardHandler
{
public bool OnPreKeyEvent(IWebBrowser browserControl, IBrowser browser, KeyType type, int windowsKeyCode, int nativeKeyCode,
CefEventFlags modifiers, bool isSystemKey, ref bool isKeyboardShortcut)
{
//F10, Alt
if (windowsKeyCode == 0x79 || windowsKeyCode == 0x12)
{
return true;
}
return false;
}
public bool OnKeyEvent(IWebBrowser browserControl, IBrowser browser, KeyType type, int windowsKeyCode, int nativeKeyCode,
CefEventFlags modifiers, bool isSystemKey)
{
if (windowsKeyCode == 0x79 || windowsKeyCode == 0x12)
{
return true;
}
return false;
}
}
}

View File

@@ -0,0 +1,31 @@
using System.IO;
using Microsoft.Win32;
namespace BrightSharp.Toolkit.Extra
{
public static class DesignTimeConfig
{
public static void SetNugetPackagesDirectory(string nugetDir)
{
if (Directory.Exists(nugetDir))
{
Registry.CurrentUser.CreateSubKey(@"SOFTWARE\Brightsharp").SetValue("NUGET_PACKAGES", nugetDir);
}
}
public static void DesignTimeUnRegisterNugetPackages()
{
Registry.CurrentUser.CreateSubKey(@"SOFTWARE\Brightsharp").SetValue("NUGET_PACKAGES", null);
}
internal static string GetNugetPackagesDirectory()
{
var regKey = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\Brightsharp");
if (regKey != null)
{
var regValue = regKey.GetValue("NUGET_PACKAGES");
return (regValue ?? string.Empty).ToString();
}
return null;
}
}
}

View File

@@ -0,0 +1,73 @@
using CefSharp;
using System;
using System.IO;
using System.Net;
namespace BrightSharp.Toolkit.Extra
{
public class FolderSchemeHandlerFactory : ISchemeHandlerFactory
{
private string rootFolder;
private string defaultPage;
private string schemeName;
private string hostName;
public FolderSchemeHandlerFactory(string rootFolder, string schemeName = null, string hostName = null, string defaultPage = "index.html")
{
this.rootFolder = Path.GetFullPath(rootFolder);
this.defaultPage = defaultPage;
this.schemeName = schemeName;
this.hostName = hostName;
if (!Directory.Exists(this.rootFolder))
{
throw new DirectoryNotFoundException(this.rootFolder);
}
}
IResourceHandler ISchemeHandlerFactory.Create(IBrowser browser, IFrame frame, string schemeName, IRequest request)
{
if (this.schemeName != null && !schemeName.Equals(this.schemeName, StringComparison.OrdinalIgnoreCase))
{
var invalidSchemeName = ResourceHandler.FromString(string.Format("SchemeName {0} does not match the expected SchemeName of {1}.", schemeName, this.schemeName));
invalidSchemeName.StatusCode = (int)HttpStatusCode.NotFound;
return invalidSchemeName;
}
var uri = new Uri(request.Url);
if (hostName != null && !uri.Host.Equals(hostName, StringComparison.OrdinalIgnoreCase))
{
var invalidHostName = ResourceHandler.FromString(string.Format("HostName {0} does not match the expected HostName of {1}.", uri.Host, hostName));
invalidHostName.StatusCode = (int)HttpStatusCode.NotFound;
return invalidHostName;
}
//Get the absolute path and remove the leading slash
var asbolutePath = uri.Host + uri.AbsolutePath;
if (string.IsNullOrEmpty(asbolutePath))
{
asbolutePath = defaultPage;
}
var filePath = Path.GetFullPath(Path.Combine(rootFolder, asbolutePath));
//Check the file requested is within the specified path and that the file exists
if (filePath.StartsWith(rootFolder, StringComparison.OrdinalIgnoreCase) && File.Exists(filePath))
{
var fileExtension = Path.GetExtension(filePath);
var mimeType = ResourceHandler.GetMimeType(fileExtension);
return ResourceHandler.FromFilePath(filePath, mimeType);
}
var fileNotFoundResourceHandler = ResourceHandler.FromString("File Not Found - " + filePath);
fileNotFoundResourceHandler.StatusCode = (int)HttpStatusCode.NotFound;
return fileNotFoundResourceHandler;
}
}
}

View File

@@ -0,0 +1,55 @@
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("BrightSharp.Toolkit.Extra")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BrightSharp.Toolkit.Extra")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly:ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,88 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace BrightSharp.Toolkit.Extra.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("BrightSharp.Toolkit.Extra.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to &lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
///&lt;head&gt;
/// &lt;meta charset=&quot;utf-8&quot; /&gt;
/// &lt;script src=&quot;https://cdn.ckeditor.com/4.6.0/standard/ckeditor.js&quot;&gt;&lt;/script&gt;
///&lt;/head&gt;
///&lt;body&gt;
/// &lt;div id=&quot;editor&quot;&gt;
/// $$CONTENT
/// &lt;/div&gt;
/// &lt;script&gt;
/// CKEDITOR.editorConfig = function (config) {
/// config.scayt_autoStartup = false;
/// config.removePlugins = &apos;resize,scayt&apos;;
/// config.disableNativeSpellChecker = false;
/// }
/// CKEDITOR.on(&apos;instanceReady&apos;,
/// [rest of string was truncated]&quot;;.
/// </summary>
internal static string HtmlEditor {
get {
return ResourceManager.GetString("HtmlEditor", resourceCulture);
}
}
}
}

View File

@@ -0,0 +1,124 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="HtmlEditor" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\resources\htmleditor.html;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>
</root>

View File

@@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace BrightSharp.Toolkit.Extra.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}

View File

@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

View File

@@ -0,0 +1,33 @@
<html>
<head>
<meta charset="utf-8" />
<script src="https://cdn.ckeditor.com/4.6.0/$$PACKAGE/ckeditor.js"></script>
</head>
<body>
<div id="editor">$$CONTENT</div>
<script>
(function (ckeditor, config) {
var lockChanges = false;
// Add override CSS styles for inside editable contents area.
ckeditor.addCss('.cke_editable { font-size: 14px; } @media screen and (max-device-width: 767px) and (-webkit-min-device-pixel-ratio:0) { .cke_editable { font-size: 16px !important; } }');
ckeditor.on('instanceReady',
function (evt) {
evt.editor.execCommand('maximize');
});
var editor = ckeditor.replace('editor', config);
editor.on("change",
function () {
if (!lockChanges)
window.$$OBJ.setupContent(editor.getData());
});
window.setData = function (newData) {
lockChanges = true;
editor.setData(newData);
lockChanges = false;
};
})(CKEDITOR, $$CONFIG);
</script>
</body>
</html>

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="cef.redist.x64" version="3.2785.1486" targetFramework="net452" />
<package id="cef.redist.x86" version="3.2785.1486" targetFramework="net452" />
<package id="CefSharp.Common" version="53.0.1" targetFramework="net452" />
<package id="CefSharp.WinForms" version="53.0.1" targetFramework="net452" />
</packages>