Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions VB/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System">
<section name="DevExpress.LookAndFeel.Design.AppSettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<applicationSettings>
<DevExpress.LookAndFeel.Design.AppSettings>
<setting name="DefaultAppSkin" serializeAs="String">
<value>Skin/WXI</value>
</setting>
<setting name="DefaultPalette" serializeAs="String">
<value></value>
</setting>
<setting name="TouchUI" serializeAs="String">
<value></value>
</setting>
<setting name="CompactUI" serializeAs="String">
<value></value>
</setting>
<setting name="TouchScaleFactor" serializeAs="String">
<value></value>
</setting>
<setting name="DirectX" serializeAs="String">
<value></value>
</setting>
<setting name="RegisterUserSkins" serializeAs="String">
<value></value>
</setting>
<setting name="RegisterBonusSkins" serializeAs="String">
<value></value>
</setting>
<setting name="FontBehavior" serializeAs="String">
<value></value>
</setting>
<setting name="DefaultAppFont" serializeAs="String">
<value></value>
</setting>
<setting name="DPIAwarenessMode" serializeAs="String">
<value>PerMonitorV2</value>
</setting>
<setting name="CustomPaletteCollection" serializeAs="Xml">
<value />
</setting>
</DevExpress.LookAndFeel.Design.AppSettings>
</applicationSettings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup>
</configuration>
25 changes: 25 additions & 0 deletions VB/DXHtmlEditor.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.8.34511.84
MinimumVisualStudioVersion = 10.0.40219.1
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "DXHtmlEditor", "DXHtmlEditor.vbproj", "{2A9B94DA-5442-43D0-A6A7-17C724D1E947}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2A9B94DA-5442-43D0-A6A7-17C724D1E947}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2A9B94DA-5442-43D0-A6A7-17C724D1E947}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2A9B94DA-5442-43D0-A6A7-17C724D1E947}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2A9B94DA-5442-43D0-A6A7-17C724D1E947}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {BFB39E5B-0BE8-416E-A378-3E2C5BB1EE0C}
EndGlobalSection
EndGlobal
109 changes: 109 additions & 0 deletions VB/DXHtmlEditor.vbproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<OptionInfer>On</OptionInfer>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{2A9B94DA-5442-43D0-A6A7-17C724D1E947}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>
</RootNamespace>
<AssemblyName>DXHtmlEditor</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG,TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="DevExpress.Data.Desktop.v23.2, Version=23.2.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.Data.v23.2, Version=23.2.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.Drawing.v23.2, Version=23.2.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.Printing.v23.2.Core, Version=23.2.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.Sparkline.v23.2.Core, Version=23.2.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.Utils.v23.2, Version=23.2.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.XtraBars.v23.2" />
<Reference Include="DevExpress.XtraEditors.v23.2, Version=23.2.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.XtraLayout.v23.2" />
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="DXHtmlEditor\DXHtmlEditorClient.vb" />
<Compile Include="DXHtmlEditor\DXHtmlEditorWebView.vb">
<SubType>Component</SubType>
</Compile>
<Compile Include="DXHtmlEditor\IDXHtmlEditorAPI.vb" />
<Compile Include="MainForm.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="MainForm.Designer.vb">
<DependentUpon>MainForm.vb</DependentUpon>
</Compile>
<Compile Include="Program.vb" />
<Compile Include="Properties\AssemblyInfo.vb" />
<EmbeddedResource Include="MainForm.resx">
<DependentUpon>MainForm.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
<SubType>Designer</SubType>
<CustomToolNamespace>DXHtmlEditor.Properties</CustomToolNamespace>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="DXHtmlEditor\Assets\index.html" />
<EmbeddedResource Include="DXHtmlEditor\Assets\index.js" />
<EmbeddedResource Include="DXHtmlEditor\Assets\styles.css" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Web.WebView2">
<Version>1.0.2277.86</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
</Project>
19 changes: 19 additions & 0 deletions VB/DXHtmlEditor/Assets/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>DevExtreme Demo</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>window.jQuery || document.write(decodeURIComponent('%3Cscript src="js/jquery.min.js"%3E%3C/script%3E'))</script>
<link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/23.2.4/css/$ThemeName$" />
<script src="https://unpkg.com/devextreme-quill@1.6.4/dist/dx-quill.min.js"></script>
<script src="https://cdn3.devexpress.com/jslib/23.2.4/js/dx.all.js"></script>
<link rel="stylesheet" type="text/css" href="styles.css" />
<script src="index.js"></script>
</head>
<body class="dx-viewport">
<div class="html-editor"></div>
</body>
</html>
71 changes: 71 additions & 0 deletions VB/DXHtmlEditor/Assets/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
$(() => {
htmlEditor = $('.html-editor').dxHtmlEditor({
height: '100vh',
//value: markup,
imageUpload: {
tabs: ['file', 'url'],
fileUploadMode: 'base64',
},
toolbar: {
items: [
'undo', 'redo', 'separator',
{
name: 'size',
acceptedValues: ['8pt', '10pt', '12pt', '14pt', '18pt', '24pt', '36pt'],
options: { inputAttr: { 'aria-label': 'Font size' } },
},
{
name: 'font',
acceptedValues: ['Arial', 'Courier New', 'Georgia', 'Impact', 'Lucida Console', 'Tahoma', 'Times New Roman', 'Verdana'],
options: { inputAttr: { 'aria-label': 'Font family' } },
},
'separator', 'bold', 'italic', 'strike', 'underline', 'separator',
'alignLeft', 'alignCenter', 'alignRight', 'alignJustify', 'separator',
'orderedList', 'bulletList', 'separator',
{
name: 'header',
acceptedValues: [false, 1, 2, 3, 4, 5],
options: { inputAttr: { 'aria-label': 'Header' } },
}, 'separator',
'color', 'background', 'separator',
'link', 'image', 'separator',
'clear', 'codeBlock', 'blockquote', 'separator',
'insertTable', 'deleteTable',
'insertRowAbove', 'insertRowBelow', 'deleteRow',
'insertColumnLeft', 'insertColumnRight', 'deleteColumn',
],
},
mediaResizing: {
enabled: true,
},
onInitialized: function (e) {
window.chrome.webview.postMessage("Loaded");
},
onValueChanged: function (e) {
window.chrome.webview.postMessage("HtmlChanged");
}
}).dxHtmlEditor('instance');
});
function getHtmlBase64() {
const base64 = htmlEditor.getQuillInstance().getSemanticHTML();
return utf8_to_b64(base64);
}
function setHtmlFromBase64(htmlBase64) {
const html = b64_to_utf8(htmlBase64);
htmlEditor.getQuillInstance().clipboard.dangerouslyPasteHTML(html);
}
function undo() {
// https://js.devexpress.com/jQuery/Documentation/ApiReference/UI_Components/dxHtmlEditor/Methods/#undo
htmlEditor.undo();
}
function redo() {
// https://js.devexpress.com/jQuery/Documentation/ApiReference/UI_Components/dxHtmlEditor/Methods/#redo
htmlEditor.redo();
}
//https://developer.mozilla.org/en-US/docs/Web/API/btoa#unicode_strings
function utf8_to_b64(str) {
return window.btoa(unescape(encodeURIComponent(str)));
}
function b64_to_utf8(str) {
return decodeURIComponent(escape(window.atob(str)));
}
43 changes: 43 additions & 0 deletions VB/DXHtmlEditor/Assets/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
.dx-htmleditor-content img {
vertical-align: middle;
padding-right: 10px;
}

body, html {
margin: 0;
padding: 0;
}

* {
box-sizing: border-box;
}

.dx-htmleditor-content table {
width: 100%;
}

/* initial margin */
body.dx-view-port {
padding: unset;
}

/* initial border */
.dx-htmleditor.dx-htmleditor-outlined {
box-shadow: unset;
}

/* border when the component is active or focused */
.dx-htmleditor.dx-htmleditor-outlined.dx-state-active, .dx-htmleditor.dx-htmleditor-outlined.dx-state-focused {
box-shadow: unset;
border-color: unset;
}

/* main border */
.dx-htmleditor {
border: unset;
}

/* 1px border between toolbar and content */
.dx-htmleditor .dx-htmleditor-toolbar-wrapper:first-child {
border-bottom: unset;
}
Loading