diff --git a/Packaging/BuildPackage.ps1 b/Packaging/BuildPackage.ps1 index 5eab393..b1a7837 100644 --- a/Packaging/BuildPackage.ps1 +++ b/Packaging/BuildPackage.ps1 @@ -3,7 +3,6 @@ $CurrentDir = Split-Path $MyInvocation.MyCommand.Path $RootDir = Split-Path -Path $CurrentDir -Parent -$UtilitiesDir = "$RootDir\Utilities" $DistDir = "$RootDir\dist" $SrcDir = "$RootDir\src" $SolutionFile = "$SrcDir\Dawoe.OEmbedPickerPropertyEditor.sln" @@ -16,13 +15,6 @@ if(Test-Path -Path $DistDir) Write-Host "Preparing solution" -#Prepare build -. $UtilitiesDir\Prepare.ps1 - -Prepare-Solution -CurrentDir $UtilitiesDir -Configuration 'Release' - -$buildFolder = Join-Path -Path $RootDir -ChildPath 'build'; - Write-Host "Create nuget packages" if(-Not([string]::IsNullOrEmpty($versionSuffix))) @@ -31,59 +23,9 @@ if(-Not([string]::IsNullOrEmpty($versionSuffix))) { $VersionSuffix = "$VersionSuffix-$env:APPVEYOR_BUILD_NUMBER" } - dotnet pack $SolutionFile -c Release -o $DistDir --version-suffix $VersionSuffix --no-build + dotnet pack $SolutionFile -c Release -o $DistDir --version-suffix $VersionSuffix } else { - dotnet pack $SolutionFile -c Release -o $DistDir --no-build -} - -Write-Host "Getting version for package" - -#Get version number -$buildPropsXml = New-Object System.Xml.XmlDocument -$buildPropsXml.Load("$SrcDir\Directory.Build.props") - -$version = Select-XML -xml $buildPropsXml -XPath '(//VersionPrefix)[1]' - -if(-Not([string]::IsNullOrEmpty($versionSuffix))) -{ - $version = "$version-$VersionSuffix" -} - -Write-Host "Assembling Umbraco Package" - -$umbFolder = Join-Path -Path $buildFolder -ChildPath "__umb"; -if (!(Test-Path -Path $umbFolder)) {New-Item -Path $umbFolder -Type Directory;} - -$umbracoManifest = Join-Path -Path $CurrentDir -ChildPath "manifest-umbraco.xml"; -$umbracoPackageXml = [xml](Get-Content $umbracoManifest); -$umbracoPackageXml.umbPackage.info.package.version = "$($version)"; - -$filesXml = $umbracoPackageXml.CreateElement("files"); - -$assetFiles = Get-ChildItem -Path $buildFolder -File -Recurse; -foreach($assetFile in $assetFiles){ - - $hash = Get-FileHash -Path $assetFile.FullName -Algorithm MD5; - $guid = $hash.Hash.ToLower() + $assetFile.Extension; - $orgPath = "~" + $assetFile.Directory.FullName.Replace($buildFolder, "").Replace("\", "/"); - - $fileXml = $umbracoPackageXml.CreateElement("file"); - $fileXml.set_InnerXML("${guid}${orgPath}$($assetFile.Name)"); - $filesXml.AppendChild($fileXml); - - Copy-Item -Path $assetFile.FullName -Destination "${umbFolder}\${guid}"; -} - -$umbracoPackageXml.umbPackage.ReplaceChild($filesXml, $umbracoPackageXml.SelectSingleNode("/umbPackage/files")) | Out-Null; -$umbracoPackageXml.Save("${umbFolder}\package.xml"); - -Write-Host "Creating Umbraco Package zip file" - -Compress-Archive -Path "${umbFolder}\*" -DestinationPath "${DistDir}\Dawoe.OEmbedPickerPropertyEditor_$version.zip" -Force; - - -# Tidy up folders -Write-Host "Cleaning up" -Remove-Item -Recurse -Force $buildFolder; \ No newline at end of file + dotnet pack $SolutionFile -c Release -o $DistDir +} \ No newline at end of file diff --git a/Packaging/manifest-umbraco.xml b/Packaging/manifest-umbraco.xml deleted file mode 100644 index 672eac8..0000000 --- a/Packaging/manifest-umbraco.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - Dawoe.OEmbedPickerPropertyEditor - - MIT license - https://github.com/dawoe/OEmbed-Picker-Property-Editor - - 8 - 1 - 0 - - https://raw.githubusercontent.com/dawoe/OEmbed-Picker-Property-Editor/develop/Images/icon.png - - - Dave Woestenborghs - https://github.com/dawoe/ - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/README.md b/README.md index 3e6349f..47647dd 100644 --- a/README.md +++ b/README.md @@ -48,25 +48,25 @@ The package comes with a property value convertor for easy use in your views. Th For a single embed : ``` - @using Dawoe.OEmbedPickerPropertyEditor.Models; + @using Dawoe.OEmbedPickerPropertyEditor.Core.Models; @Model.Value("propalias").EmbedCode ``` For multiple embeds : ``` - @using Dawoe.OEmbedPickerPropertyEditor.Models; + @using Dawoe.OEmbedPickerPropertyEditor.Core.Models; @foreach(var item in Model.Value>("propalias")) {
@item.EmbedCode
} ``` -When you only need the source url of the iframe in the embed code you can do the following from version 5.1.0 +When you only need the source url of the iframe in the embed code you can do the following ``` -@using Dawoe.OEmbedPickerPropertyEditor.Models -@using Dawoe.OEmbedPickerPropertyEditor.Extensions +@using Dawoe.OEmbedPickerPropertyEditor.Core.Models +@using Dawoe.OEmbedPickerPropertyEditor.Core.Extensions @Model.Value("propAlias").GetEmbedSrc() ``` @@ -75,6 +75,12 @@ When you only need the source url of the iframe in the embed code you can do the ## Changelog +### 10.0.0 + +- Support for Umbraco 10 +- Converted UI project to razor class library +- Breaking change : Moved classes in Dawoe.OEmbedPropertyEditor namespace to Dawoe.OEmbedPropertyEditor.Core namespace. + ### 5.1.0 - Fix for deserializing property value when editor was a different property editor previously. Thanks to @bjarnef for the PR (#23) @@ -128,16 +134,17 @@ This is can be a potentially breaking changes because the models will be generat ### 1.0.0 - Initial release +## Setting up a test site +The repository only contains the package code and not test website. However a test site can be set up by running the script SetupTestSite.ps1 from the Utilities folder. -## Contact +For starting the test site you can run StartTestSite.ps1 -Feel free to contact me on twitter : [@dawoe21](https://twitter.com/dawoe21) +To deploy new changes made in the source code you can run UpdateTestSite.ps1. +## Contact -## Support this package ## +Feel free to contact me on twitter : [@dawoe21](https://twitter.com/dawoe21) -If you like this package and use it in your website, consider becoming a patreon to support ongoing maintenance -[https://www.patreon.com/dawoe](https://t.co/TBsvTMnOLB) diff --git a/Utilities/Compile.ps1 b/Utilities/Compile.ps1 deleted file mode 100644 index ecdbc79..0000000 --- a/Utilities/Compile.ps1 +++ /dev/null @@ -1,29 +0,0 @@ -function Compile-Solution { - [CmdletBinding()] - param( - [Parameter()] - [string] $RootDir, - - [Parameter()] - [string] $Configuration = 'Debug' - ) - - $projectDir = "$RootDir\src\Dawoe.OEmbedPickerPropertyEditor" - $solution= "$RootDir\src\Dawoe.OEmbedPickerPropertyEditor.sln" - $ToolsDir = "$RootDir\tools" - - # Build the VS project - Write-Host 'Cleaning Visual Studio solution.'; - - if(Test-Path -Path "$projectDir\obj") - { - Remove-Item -Recurse -Force "$projectDir\obj"; - } - & dotnet clean $solution; - - Write-Host 'Compiling Visual Studio solution.'; - & dotnet build $solution --configuration $Configuration - if (-NOT $?) { - throw 'The dotnet CLI returned an error code.'; - } -} \ No newline at end of file diff --git a/Utilities/CreateNugetPackages.ps1 b/Utilities/CreateNugetPackages.ps1 new file mode 100644 index 0000000..3c24259 --- /dev/null +++ b/Utilities/CreateNugetPackages.ps1 @@ -0,0 +1,15 @@ +Write-Host "Create nuget packages" + +$directoryBuildProps = [xml](Get-Content -Path "$SourceDir\Directory.Build.props"); +$version = $directoryBuildProps.Project.PropertyGroup.VersionPrefix; +Write-Host "Package version: $version"; + +$dateTime = get-date -Format "ddMMyyyyHHmmss" + +Write-Host "Version suffix $dateTime" + +dotnet pack $SourceDir\$PackageName.sln -c Debug -o $TestSitesFolder\nuget --version-suffix "$dateTime" + +cd "$TestSitesFolder\$TestProjectName" + +dotnet add package $PackageName -v "$($version)-$dateTime".trim() \ No newline at end of file diff --git a/Utilities/Prepare.ps1 b/Utilities/Prepare.ps1 deleted file mode 100644 index e125042..0000000 --- a/Utilities/Prepare.ps1 +++ /dev/null @@ -1,32 +0,0 @@ -function Prepare-Solution { - [CmdletBinding()] - param( - [Parameter()] - [string] $CurrentDir, - - [Parameter()] - [string] $Configuration = 'Debug' - ) - - $RootDir = Split-Path -Path $CurrentDir -Parent - $buildFolder = Join-Path -Path $RootDir -ChildPath 'build'; - - #Compile solution - . $CurrentDir\Compile.ps1 - - Compile-Solution -RootDir $RootDir -Configuration $Configuration - - #Clean build folder - if (Test-Path -Path $buildFolder) {Remove-Item -Recurse -Force $buildFolder} - - New-Item -Path $buildFolder -Type Directory - - # Copy DLL to build folder - $binFolder = Join-Path -Path $buildFolder -ChildPath "bin"; - if (!(Test-Path -Path $binFolder)) {New-Item -Path $binFolder -Type Directory;} - - Copy-Item -Path "${RootDir}\src\Dawoe.OEmbedPickerPropertyEditor\bin\${Configuration}\net472\Dawoe*" -Destination $binFolder; - - #Copy UI to build folder - Copy-Item -Path "${RootDir}\src\Dawoe.OEmbedPickerPropertyEditor.UI\App_Plugins\" -Destination $buildFolder -Recurse -Force -} \ No newline at end of file diff --git a/Utilities/SetupTestSite.ps1 b/Utilities/SetupTestSite.ps1 index 00f71ba..027449e 100644 --- a/Utilities/SetupTestSite.ps1 +++ b/Utilities/SetupTestSite.ps1 @@ -1,110 +1,61 @@ -function Create-V8-Site { +function Create-Test-Site { [CmdletBinding()] param( [Parameter()] - [string] $RootDir, - + [string] $Destination, + [Parameter()] - [string] $Destination, + [string] $ProjectName, [Parameter()] - [string] $DownloadUrl = 'https://our.umbraco.com/ReleaseDownload?id=276831' - ) - - $DownloadDir = "$RootDir\downloads" - $ZipFile = "$DownloadDir\umbraco8.zip" - - if (Test-Path -Path $DownloadDir) { - Remove-Item -LiteralPath $DownloadDir -Force -Recurse - } - - Write-Host "Creating download directory" - - New-Item -Path $RootDir -Name "downloads" -ItemType "directory" - - Write-Host "Downloading Umbraco 8.1.0 to $ZipFile" - - Invoke-WebRequest -Uri $DownloadUrl -OutFile $ZipFile - - Write-Host "Extracting downloaded zip file to $Destination" - - Expand-Archive -LiteralPath $ZipFile -DestinationPath "$Destination\v8" -Force - - Write-Host "Cleaning up downloaded files" - - Remove-Item -LiteralPath $DownloadDir -Force -Recurse -} - -function Create-V9-Site { - [CmdletBinding()] - param( - [Parameter()] - [string] $Destination + [string] $CmsVersion ) $CurrentDir = Get-Location Write-Host $CurrentDir - Write-Host "Installing Umbraco 9 templates" - dotnet new --install Umbraco.Templates::9.0.0 + Write-Host "Installing Umbraco templates" + dotnet new --install Umbraco.Templates - Write-Host "Creating Umbraco 9 site" + Write-Host "Creating Umbraco site" cd $Destination - dotnet new umbraco --SqlCe -n v9 + dotnet new umbraco -n $ProjectName --development-database-type SQLite --version $CmsVersion - cd "$Destination\v9" + cd "$Destination\$ProjectName" - dotnet add package Umbraco.TheStarterKit --version 9.0.0 --source https://api.nuget.org/v3/index.json + dotnet add package Umbraco.TheStarterKit --version $CmsVersion --source https://api.nuget.org/v3/index.json dotnet build # load project file xml $xml = New-Object System.Xml.XmlDocument - $xml.Load("$Destination\v9\v9.csproj") + $xml.Load("$Destination\$ProjectName\$ProjectName.csproj") $propertyGroup = Select-XML -Xml $xml -XPath '//PropertyGroup[1]' $newNode = $xml.CreateElement('RestoreAdditionalProjectSources') $newNode.InnerText = '../Nuget' $propertyGroup.Node.AppendChild($newNode) - $xml.Save("$Destination\v9\v9.csproj") + $xml.Save("$Destination\$ProjectName\$ProjectName.csproj") cd $CurrentDir } $CurrentDir = Split-Path $MyInvocation.MyCommand.Path -$RootDir = Split-Path -Path $CurrentDir -Parent -$Destination= "$RootDir\testsites" +. $CurrentDir\Variables.ps1 Write-Host "Cleaning up existing test site" -if (Test-Path -Path $Destination) { - Remove-Item -LiteralPath $Destination -Force -Recurse +if (Test-Path -Path $TestSitesFolder) { + Remove-Item -LiteralPath $TestSitesFolder -Force -Recurse } -New-Item -Path $RootDir -Name "testsites" -ItemType "directory" - -Create-V8-Site -RootDir $RootDir -Destination $Destination - -Create-V9-Site $Destination - -. $CurrentDir\Compile.ps1 - -Compile-Solution -RootDir $RootDir -Configuration Debug - - -Write-Host "Create nuget packages" - -$dateTime = get-date -Format "ddMMyyyyHHmmss" - -Write-Host "Version suffix $dateTime" - -dotnet pack $RootDir\src\Dawoe.OEmbedPickerPropertyEditor.sln -c Debug -o $Destination\nuget --version-suffix "$dateTime" --no-build +New-Item -Path $RootDir -Name $TestSitesFolderName -ItemType "directory" -cd "$Destination\v9" +Create-Test-Site $TestSitesFolder $TestProjectName $UmbracoVersion -dotnet add package Dawoe.OEmbedPickerPropertyEditor -v 5.1.0-$dateTime --no-restore +Invoke-Expression "$CurrentDir\CreateNugetPackages.ps1" dotnet build diff --git a/Utilities/StartTestSite.ps1 b/Utilities/StartTestSite.ps1 new file mode 100644 index 0000000..41f322b --- /dev/null +++ b/Utilities/StartTestSite.ps1 @@ -0,0 +1,5 @@ +$CurrentDir = Split-Path $MyInvocation.MyCommand.Path +. $CurrentDir\Variables.ps1 + + +dotnet watch run --no-restore --project "$TestSitesFolder\$TestProjectName" \ No newline at end of file diff --git a/Utilities/StartTestSiteV8.ps1 b/Utilities/StartTestSiteV8.ps1 deleted file mode 100644 index 3fd6fa0..0000000 --- a/Utilities/StartTestSiteV8.ps1 +++ /dev/null @@ -1,19 +0,0 @@ -$CurrentDir = Split-Path $MyInvocation.MyCommand.Path -$RootDir = Split-Path -Path $CurrentDir -Parent -$SiteDir= "$RootDir\testsites\v8" -$solutionDir = "$RootDir\src" - -write-host $CurrentDir - -Write-Host "Starting IIS Express website" - -Start-process "C:\Program Files\IIS Express\iisexpress.exe" -ArgumentList "/port:8100 /path:$siteDir" -WindowStyle Hidden -Start-Sleep -m 1000 - -Write-Host "IIS Express website started" - -Write-Host "Open website in browser" - -Start "http://localhost:8100" - -Write-Host "Press Q to stop" \ No newline at end of file diff --git a/Utilities/StartTestSiteV9.ps1 b/Utilities/StartTestSiteV9.ps1 deleted file mode 100644 index 7f1421c..0000000 --- a/Utilities/StartTestSiteV9.ps1 +++ /dev/null @@ -1,7 +0,0 @@ -$CurrentDir = Split-Path $MyInvocation.MyCommand.Path -$RootDir = Split-Path -Path $CurrentDir -Parent -$SiteDir= "$RootDir\testsites\v9" - - - -dotnet watch run --no-restore --project $SiteDir \ No newline at end of file diff --git a/Utilities/UpdateTestSites.ps1 b/Utilities/UpdateTestSites.ps1 index d62ba96..84e71e0 100644 --- a/Utilities/UpdateTestSites.ps1 +++ b/Utilities/UpdateTestSites.ps1 @@ -1,30 +1,8 @@ $CurrentDir = Split-Path $MyInvocation.MyCommand.Path +. $CurrentDir\Variables.ps1 -#Prepare update -. $CurrentDir\Prepare.ps1 +Invoke-Expression "$CurrentDir\CreateNugetPackages.ps1" -Prepare-Solution -CurrentDir $CurrentDir - -$RootDir = Split-Path -Path $CurrentDir -Parent -$buildFolder = Join-Path -Path $RootDir -ChildPath 'build'; - -#Copy App_Plugins folder -Copy-Item -Path "$buildFolder\App_Plugins" -Destination "$RootDir\testsites\v8" -Recurse -Force - -#Copy bin folder -Copy-Item -Path "$buildFolder\bin\*.*" -Destination "$RootDir\testsites\v8\bin" -Force - -Write-Host "Create nuget packages" - -$dateTime = get-date -Format "ddMMyyyyHHmmss" - -Write-Host "Version suffix $dateTime" - -dotnet pack $RootDir\src\Dawoe.OEmbedPickerPropertyEditor.sln -c Debug -o $RootDir\testsites\nuget --version-suffix "$dateTime" --no-build - -cd "$RootDir\testsites\v9" - -dotnet add package Dawoe.OEmbedPickerPropertyEditor -v 5.1.0-$dateTime --no-restore dotnet build cd $CurrentDir \ No newline at end of file diff --git a/Utilities/Variables.ps1 b/Utilities/Variables.ps1 new file mode 100644 index 0000000..0a0ec4a --- /dev/null +++ b/Utilities/Variables.ps1 @@ -0,0 +1,7 @@ +$RootDir = Split-Path -Path $CurrentDir -Parent +$TestSitesFolderName = "testsites" +$TestSitesFolder = "$RootDir\$TestSitesFolderName" +$TestProjectName = "OEmbedPickerSite" +$PackageName = "Dawoe.OEmbedPickerPropertyEditor" +$SourceDir = "$RootDir\src" +$UmbracoVersion = "10.0.0" \ No newline at end of file diff --git a/appveyor.yml b/appveyor.yml index 730fca6..b95fbcc 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,7 +1,7 @@ -image: Visual Studio 2019 +image: Visual Studio 2022 # Version format -version: 5.1.0.{build} +version: 10.0.0.{build} branches: only: @@ -17,8 +17,6 @@ build_script: artifacts: - path: dist\*.nupkg - - path: dist\*.zip - deploy: @@ -35,7 +33,7 @@ deploy: - provider: GitHub auth_token: secure: 2NNEN9lVF0/cA40PZrm64BMMK34Y26A8xK22eUdWcN/7Nn5KyyRH2+THumy91tcV - artifact: /.*\.zip/ # upload all Zip packages to release assets + artifact: /.*\.nupkg/ # upload all nget packages to release assets draft: false prerelease: false on: diff --git a/src/Dawoe.OEmbedPickerPropertyEditor.Core/Configuration/OEmbedPickerConfiguration.cs b/src/Dawoe.OEmbedPickerPropertyEditor.Core/Configuration/OEmbedPickerConfiguration.cs index c785f22..b39bb43 100644 --- a/src/Dawoe.OEmbedPickerPropertyEditor.Core/Configuration/OEmbedPickerConfiguration.cs +++ b/src/Dawoe.OEmbedPickerPropertyEditor.Core/Configuration/OEmbedPickerConfiguration.cs @@ -2,13 +2,9 @@ // Copyright (c) Dave Woestenborghs and contributors. Licensed under the MIT License. See LICENSE in the project root for license information. // -#if NET472 -using Umbraco.Core.PropertyEditors; -#else using Umbraco.Cms.Core.PropertyEditors; -#endif -namespace Dawoe.OEmbedPickerPropertyEditor.Configuration +namespace Dawoe.OEmbedPickerPropertyEditor.Core.Configuration { /// /// Represents the configuration for the OEmbed picker. diff --git a/src/Dawoe.OEmbedPickerPropertyEditor.Core/Configuration/OEmbedPickerConfigurationEditor.cs b/src/Dawoe.OEmbedPickerPropertyEditor.Core/Configuration/OEmbedPickerConfigurationEditor.cs index 7df2cc3..cf4b335 100644 --- a/src/Dawoe.OEmbedPickerPropertyEditor.Core/Configuration/OEmbedPickerConfigurationEditor.cs +++ b/src/Dawoe.OEmbedPickerPropertyEditor.Core/Configuration/OEmbedPickerConfigurationEditor.cs @@ -2,30 +2,26 @@ // Copyright (c) Dave Woestenborghs and contributors. Licensed under the MIT License. See LICENSE in the project root for license information. // -#if NET472 -using Umbraco.Core.PropertyEditors; -#else using Umbraco.Cms.Core.IO; using Umbraco.Cms.Core.PropertyEditors; -#endif +using Umbraco.Cms.Core.Services; -namespace Dawoe.OEmbedPickerPropertyEditor.Configuration +namespace Dawoe.OEmbedPickerPropertyEditor.Core.Configuration { /// /// Represents the configuration editor for the OEmbed picker. /// public class OEmbedPickerConfigurationEditor : ConfigurationEditor { -#if NETCOREAPP /// /// Initializes a new instance of the class. /// - /// A IO Helper. - public OEmbedPickerConfigurationEditor(IIOHelper ioHelper) - : base(ioHelper) + /// A + /// A . + public OEmbedPickerConfigurationEditor(IIOHelper ioHelper, IEditorConfigurationParser editorConfigurationParser) + : base(ioHelper, editorConfigurationParser) { } -#endif /// /// Gets the default configuration object. diff --git a/src/Dawoe.OEmbedPickerPropertyEditor.Core/Configuration/OEmbedPickerDataEditor.cs b/src/Dawoe.OEmbedPickerPropertyEditor.Core/Configuration/OEmbedPickerDataEditor.cs index dbef28f..c569301 100644 --- a/src/Dawoe.OEmbedPickerPropertyEditor.Core/Configuration/OEmbedPickerDataEditor.cs +++ b/src/Dawoe.OEmbedPickerPropertyEditor.Core/Configuration/OEmbedPickerDataEditor.cs @@ -2,15 +2,11 @@ // Copyright (c) Dave Woestenborghs and contributors. Licensed under the MIT License. See LICENSE in the project root for license information. // -#if NET472 -using Umbraco.Core.Logging; -using Umbraco.Core.PropertyEditors; -#else using Umbraco.Cms.Core.IO; using Umbraco.Cms.Core.PropertyEditors; -#endif +using Umbraco.Cms.Core.Services; -namespace Dawoe.OEmbedPickerPropertyEditor.Configuration +namespace Dawoe.OEmbedPickerPropertyEditor.Core.Configuration { /// /// Represents the OEmbed picker data editor. @@ -18,33 +14,23 @@ namespace Dawoe.OEmbedPickerPropertyEditor.Configuration [DataEditor(Constants.DataEditorAlias, "OEmbed Picker", "~/App_Plugins/Dawoe.OEmbedPickerPropertyEditor/views/editor.html", ValueType = "JSON", Group = "pickers", Icon = "icon-tv")] public class OEmbedPickerDataEditor : DataEditor { -#if NET472 - /// - /// Initializes a new instance of the class. - /// - /// - /// The logger. - /// - public OEmbedPickerDataEditor(ILogger logger) - : base(logger) - { - } - - /// - protected override IConfigurationEditor CreateConfigurationEditor() => new OEmbedPickerConfigurationEditor(); -#else private readonly IIOHelper ioHelper; + private readonly IEditorConfigurationParser editorConfigurationParser; /// /// Initializes a new instance of the class. /// - /// A data value editor factory - /// A IO helper. - public OEmbedPickerDataEditor(IDataValueEditorFactory dataValueEditorFactory, IIOHelper ioHelper) - : base(dataValueEditorFactory) => this.ioHelper = ioHelper; + /// A . + /// A . + /// A . + public OEmbedPickerDataEditor(IDataValueEditorFactory dataValueEditorFactory, IIOHelper ioHelper, IEditorConfigurationParser editorConfigurationParser) + : base(dataValueEditorFactory) + { + this.ioHelper = ioHelper; + this.editorConfigurationParser = editorConfigurationParser; + } /// - protected override IConfigurationEditor CreateConfigurationEditor() => new OEmbedPickerConfigurationEditor(this.ioHelper); -#endif + protected override IConfigurationEditor CreateConfigurationEditor() => new OEmbedPickerConfigurationEditor(this.ioHelper, this.editorConfigurationParser); } } diff --git a/src/Dawoe.OEmbedPickerPropertyEditor.Core/Constants.cs b/src/Dawoe.OEmbedPickerPropertyEditor.Core/Constants.cs index a5360ef..fe75a3f 100644 --- a/src/Dawoe.OEmbedPickerPropertyEditor.Core/Constants.cs +++ b/src/Dawoe.OEmbedPickerPropertyEditor.Core/Constants.cs @@ -2,7 +2,7 @@ // Copyright (c) Dave Woestenborghs and contributors. Licensed under the MIT License. See LICENSE in the project root for license information. // -namespace Dawoe.OEmbedPickerPropertyEditor +namespace Dawoe.OEmbedPickerPropertyEditor.Core { /// /// A object defining all constants used in the project. diff --git a/src/Dawoe.OEmbedPickerPropertyEditor.Core/Dawoe.OEmbedPickerPropertyEditor.Core.csproj b/src/Dawoe.OEmbedPickerPropertyEditor.Core/Dawoe.OEmbedPickerPropertyEditor.Core.csproj index fb590b5..2ea9c86 100644 --- a/src/Dawoe.OEmbedPickerPropertyEditor.Core/Dawoe.OEmbedPickerPropertyEditor.Core.csproj +++ b/src/Dawoe.OEmbedPickerPropertyEditor.Core/Dawoe.OEmbedPickerPropertyEditor.Core.csproj @@ -1,18 +1,7 @@ - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/Dawoe.OEmbedPickerPropertyEditor.Core/Extensions/OEmbedItemExtensions.cs b/src/Dawoe.OEmbedPickerPropertyEditor.Core/Extensions/OEmbedItemExtensions.cs index 9a43e02..e94badc 100644 --- a/src/Dawoe.OEmbedPickerPropertyEditor.Core/Extensions/OEmbedItemExtensions.cs +++ b/src/Dawoe.OEmbedPickerPropertyEditor.Core/Extensions/OEmbedItemExtensions.cs @@ -3,9 +3,9 @@ // using System.Text.RegularExpressions; -using Dawoe.OEmbedPickerPropertyEditor.Models; +using Dawoe.OEmbedPickerPropertyEditor.Core.Models; -namespace Dawoe.OEmbedPickerPropertyEditor.Extensions +namespace Dawoe.OEmbedPickerPropertyEditor.Core.Extensions { /// /// Represents the extension methods for the . diff --git a/src/Dawoe.OEmbedPickerPropertyEditor.Core/Models/OEmbedItem.cs b/src/Dawoe.OEmbedPickerPropertyEditor.Core/Models/OEmbedItem.cs index c841957..2fbf67c 100644 --- a/src/Dawoe.OEmbedPickerPropertyEditor.Core/Models/OEmbedItem.cs +++ b/src/Dawoe.OEmbedPickerPropertyEditor.Core/Models/OEmbedItem.cs @@ -2,14 +2,10 @@ // Copyright (c) Dave Woestenborghs and contributors. Licensed under the MIT License. See LICENSE in the project root for license information. // -#if NET472 -using System.Web; -#else using Microsoft.AspNetCore.Html; -#endif using Newtonsoft.Json; -namespace Dawoe.OEmbedPickerPropertyEditor.Models +namespace Dawoe.OEmbedPickerPropertyEditor.Core.Models { /// /// Represents a item picked in the editor. @@ -38,11 +34,7 @@ public class OEmbedItem /// Gets the embed code. /// [JsonIgnore] -#if NET472 - public IHtmlString EmbedCode => new HtmlString(this.Preview); -#else public IHtmlContent EmbedCode => new HtmlString(this.Preview); -#endif /// /// Gets or sets the preview. diff --git a/src/Dawoe.OEmbedPickerPropertyEditor.Core/ValueConverters/OEmbedPickerValueConverter.cs b/src/Dawoe.OEmbedPickerPropertyEditor.Core/ValueConverters/OEmbedPickerValueConverter.cs index 7935c70..4855248 100644 --- a/src/Dawoe.OEmbedPickerPropertyEditor.Core/ValueConverters/OEmbedPickerValueConverter.cs +++ b/src/Dawoe.OEmbedPickerPropertyEditor.Core/ValueConverters/OEmbedPickerValueConverter.cs @@ -6,21 +6,14 @@ using System.Collections; using System.Collections.Generic; using System.Linq; -using Dawoe.OEmbedPickerPropertyEditor.Configuration; -using Dawoe.OEmbedPickerPropertyEditor.Models; +using Dawoe.OEmbedPickerPropertyEditor.Core.Configuration; +using Dawoe.OEmbedPickerPropertyEditor.Core.Models; using Newtonsoft.Json; -using Umbraco.Core; - -#if NET472 -using Umbraco.Core.Models.PublishedContent; -using Umbraco.Core.PropertyEditors; -#else using Umbraco.Cms.Core.Models.PublishedContent; using Umbraco.Cms.Core.PropertyEditors; using Umbraco.Extensions; -#endif -namespace Dawoe.OEmbedPickerPropertyEditor.ValueConverters +namespace Dawoe.OEmbedPickerPropertyEditor.Core.ValueConverters { /// /// Represents a the property value converter for the OEmbed picker. diff --git a/src/Dawoe.OEmbedPickerPropertyEditor.UI/App_Plugins/Dawoe.OEmbedPickerPropertyEditor/package.manifest b/src/Dawoe.OEmbedPickerPropertyEditor.UI/App_Plugins/Dawoe.OEmbedPickerPropertyEditor/package.manifest deleted file mode 100644 index e67c3bb..0000000 --- a/src/Dawoe.OEmbedPickerPropertyEditor.UI/App_Plugins/Dawoe.OEmbedPickerPropertyEditor/package.manifest +++ /dev/null @@ -1,9 +0,0 @@ -{ - "$schema": "http://json.schemastore.org/package.manifest", - "javascript": [ - "~/App_Plugins/Dawoe.OEmbedPickerPropertyEditor/scripts/editor.controller.js" - ], - "css": [ - "~/App_Plugins/Dawoe.OEmbedPickerPropertyEditor/css/editor.styles.css" - ] -} \ No newline at end of file diff --git a/src/Dawoe.OEmbedPickerPropertyEditor.UI/App_Plugins/Dawoe.OEmbedPickerPropertyEditor/views/editor.html b/src/Dawoe.OEmbedPickerPropertyEditor.UI/App_Plugins/Dawoe.OEmbedPickerPropertyEditor/views/editor.html deleted file mode 100644 index 1ff0b43..0000000 --- a/src/Dawoe.OEmbedPickerPropertyEditor.UI/App_Plugins/Dawoe.OEmbedPickerPropertyEditor/views/editor.html +++ /dev/null @@ -1,28 +0,0 @@ -
- -
-
-
- -
-
- -
-
- - -
-
-
-
- -
- -
-
\ No newline at end of file diff --git a/src/Dawoe.OEmbedPickerPropertyEditor.UI/Dawoe.OEmbedPickerPropertyEditor.UI.csproj b/src/Dawoe.OEmbedPickerPropertyEditor.UI/Dawoe.OEmbedPickerPropertyEditor.UI.csproj index 7d550f6..4dab3a3 100644 --- a/src/Dawoe.OEmbedPickerPropertyEditor.UI/Dawoe.OEmbedPickerPropertyEditor.UI.csproj +++ b/src/Dawoe.OEmbedPickerPropertyEditor.UI/Dawoe.OEmbedPickerPropertyEditor.UI.csproj @@ -1,14 +1,13 @@ - + + + + App_Plugins/Dawoe.OEmbedPickerPropertyEditor + - - true - Always - - - True - buildTransitive - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + - \ No newline at end of file diff --git a/src/Dawoe.OEmbedPickerPropertyEditor.UI/PackageManifestComposer.cs b/src/Dawoe.OEmbedPickerPropertyEditor.UI/PackageManifestComposer.cs new file mode 100644 index 0000000..b7d8868 --- /dev/null +++ b/src/Dawoe.OEmbedPickerPropertyEditor.UI/PackageManifestComposer.cs @@ -0,0 +1,18 @@ +// +// Copyright (c) Dave Woestenborghs and contributors. Licensed under the MIT License. See LICENSE in the project root for license information. +// + +using Umbraco.Cms.Core.Composing; +using Umbraco.Cms.Core.DependencyInjection; + +namespace Dawoe.OEmbedPickerPropertyEditor.UI +{ + /// + /// Represents a to register the package manifest. + /// + internal class PackageManifestComposer : IComposer + { + /// + public void Compose(IUmbracoBuilder builder) => builder.ManifestFilters().Append(); + } +} diff --git a/src/Dawoe.OEmbedPickerPropertyEditor.UI/PackageManifestFilter.cs b/src/Dawoe.OEmbedPickerPropertyEditor.UI/PackageManifestFilter.cs new file mode 100644 index 0000000..625c1e3 --- /dev/null +++ b/src/Dawoe.OEmbedPickerPropertyEditor.UI/PackageManifestFilter.cs @@ -0,0 +1,30 @@ +// +// Copyright (c) Dave Woestenborghs and contributors. Licensed under the MIT License. See LICENSE in the project root for license information. +// + +using System.Collections.Generic; +using Umbraco.Cms.Core.Manifest; + +namespace Dawoe.OEmbedPickerPropertyEditor.UI +{ + /// + /// Represents a to register back office assets. + /// + internal class PackageManifestFilter : IManifestFilter + { + /// + public void Filter(List manifests) => + manifests.Add(new() + { + PackageName = "Dawoe.OEmbedPickerPropertyEditor", + Scripts = new[] + { + "/App_Plugins/Dawoe.OEmbedPickerPropertyEditor/scripts/editor.controller.js", + }, + Stylesheets = new[] + { + "/App_Plugins/Dawoe.OEmbedPickerPropertyEditor/css/editor.styles.css", + }, + }); + } +} diff --git a/src/Dawoe.OEmbedPickerPropertyEditor.UI/build/Dawoe.OEmbedPickerPropertyEditor.UI.targets b/src/Dawoe.OEmbedPickerPropertyEditor.UI/build/Dawoe.OEmbedPickerPropertyEditor.UI.targets deleted file mode 100644 index 7769e83..0000000 --- a/src/Dawoe.OEmbedPickerPropertyEditor.UI/build/Dawoe.OEmbedPickerPropertyEditor.UI.targets +++ /dev/null @@ -1,26 +0,0 @@ - - - - $(MSBuildThisFileDirectory)..\content\App_Plugins\Dawoe.OEmbedPickerPropertyEditor\**\*.* - - - - - - - - - - - - - - - - - - - diff --git a/src/Dawoe.OEmbedPickerPropertyEditor.UI/App_Plugins/Dawoe.OEmbedPickerPropertyEditor/css/editor.styles.css b/src/Dawoe.OEmbedPickerPropertyEditor.UI/wwwroot/css/editor.styles.css similarity index 100% rename from src/Dawoe.OEmbedPickerPropertyEditor.UI/App_Plugins/Dawoe.OEmbedPickerPropertyEditor/css/editor.styles.css rename to src/Dawoe.OEmbedPickerPropertyEditor.UI/wwwroot/css/editor.styles.css diff --git a/src/Dawoe.OEmbedPickerPropertyEditor.UI/App_Plugins/Dawoe.OEmbedPickerPropertyEditor/scripts/editor.controller.js b/src/Dawoe.OEmbedPickerPropertyEditor.UI/wwwroot/scripts/editor.controller.js similarity index 100% rename from src/Dawoe.OEmbedPickerPropertyEditor.UI/App_Plugins/Dawoe.OEmbedPickerPropertyEditor/scripts/editor.controller.js rename to src/Dawoe.OEmbedPickerPropertyEditor.UI/wwwroot/scripts/editor.controller.js diff --git a/src/Dawoe.OEmbedPickerPropertyEditor.UI/wwwroot/views/editor.html b/src/Dawoe.OEmbedPickerPropertyEditor.UI/wwwroot/views/editor.html new file mode 100644 index 0000000..27a93f4 --- /dev/null +++ b/src/Dawoe.OEmbedPickerPropertyEditor.UI/wwwroot/views/editor.html @@ -0,0 +1,28 @@ +
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+ +
+ +
+
diff --git a/src/Dawoe.OEmbedPickerPropertyEditor.sln b/src/Dawoe.OEmbedPickerPropertyEditor.sln index e695ff3..3d16e5b 100644 --- a/src/Dawoe.OEmbedPickerPropertyEditor.sln +++ b/src/Dawoe.OEmbedPickerPropertyEditor.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.31229.75 +# Visual Studio Version 17 +VisualStudioVersion = 17.2.32616.157 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dawoe.OEmbedPickerPropertyEditor.UI", "Dawoe.OEmbedPickerPropertyEditor.UI\Dawoe.OEmbedPickerPropertyEditor.UI.csproj", "{209C4CE7-6A8B-4773-AD86-D7B22199C980}" EndProject @@ -16,20 +16,19 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Utilities", "Utilities", "{45071A92-DB5C-4CEF-BAF5-8E428FBD5F27}" ProjectSection(SolutionItems) = preProject - ..\Utilities\Compile.ps1 = ..\Utilities\Compile.ps1 - ..\Utilities\Prepare.ps1 = ..\Utilities\Prepare.ps1 + ..\Utilities\CreateNugetPackages.ps1 = ..\Utilities\CreateNugetPackages.ps1 ..\Utilities\SetupTestSite.ps1 = ..\Utilities\SetupTestSite.ps1 - ..\Utilities\StartTestSiteV8.ps1 = ..\Utilities\StartTestSiteV8.ps1 - ..\Utilities\StartTestSiteV9.ps1 = ..\Utilities\StartTestSiteV9.ps1 + ..\Utilities\StartTestSite.ps1 = ..\Utilities\StartTestSite.ps1 ..\Utilities\UpdateTestSites.ps1 = ..\Utilities\UpdateTestSites.ps1 + ..\Utilities\Variables.ps1 = ..\Utilities\Variables.ps1 EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dawoe.OEmbedPickerPropertyEditor", "Dawoe.OEmbedPickerPropertyEditor\Dawoe.OEmbedPickerPropertyEditor.csproj", "{4EDE7985-3AFB-40F7-9196-F1DB0CC7A35E}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Packaging", "Packaging", "{FBB35EC3-7739-4EF4-ACE3-C30BE2DA722C}" ProjectSection(SolutionItems) = preProject + ..\appveyor.yml = ..\appveyor.yml ..\Packaging\BuildPackage.ps1 = ..\Packaging\BuildPackage.ps1 - ..\Packaging\manifest-umbraco.xml = ..\Packaging\manifest-umbraco.xml EndProjectSection EndProject Global diff --git a/src/Dawoe.OEmbedPickerPropertyEditor/Dawoe.OEmbedPickerPropertyEditor.csproj b/src/Dawoe.OEmbedPickerPropertyEditor/Dawoe.OEmbedPickerPropertyEditor.csproj index 05635aa..3a8d03d 100644 --- a/src/Dawoe.OEmbedPickerPropertyEditor/Dawoe.OEmbedPickerPropertyEditor.csproj +++ b/src/Dawoe.OEmbedPickerPropertyEditor/Dawoe.OEmbedPickerPropertyEditor.csproj @@ -1,9 +1,6 @@ - - - \ No newline at end of file diff --git a/src/Directory.Build.props b/src/Directory.Build.props index bb1aaa4..fffef3d 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -1,18 +1,19 @@ - net472;net5 + net6 - - + + + - - - + + + Dave Woestenborghs Dawoe.OEmbedPickerPropertyEditor @@ -26,9 +27,9 @@ git Copyright © Dave Woestenborghs and contributors. MIT - 5.1.0 - 5.1.0 - 5.1.0 + 10.0.0 + 10.0.0 + 10.0.0