Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TINY-11468: Updated everything to v7 #86

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# top-most EditorConfig file
root = true

[*]
insert_final_newline = true
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
end_of_line = lf
16 changes: 16 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
name: Bug report
about: Create a bug report to help us improve
title: ''
labels: ''
assignees: ''

---

**What is the current behavior?**

**Please provide the steps to reproduce and if possible a minimal demo of the problem by forking the repo and updating the demo app.**

**What is the expected behavior?**

**Which versions of TinyMCE, and which browser / OS are affected by this issue? Did this work in previous versions of TinyMCE or `tinymce-blazor`?**
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: Feature request
about: Suggest a feature for this project
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is.

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
5 changes: 5 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
**Before submitting a pull request** please do the following:

1. Fork [the repository](https://github.com/tinymce/tinymce-blazor) and create your branch from `master`
2. Ensure that the build works: `dotnet build`
3. Make sure to sign the CLA.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*/obj/*
*/bin/*
*/*.sln
**/lib
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

## 2.0.0 - 2024-10-31

### Added
- New `LicenseKey` property to be used with self hosted TinyMCE.

### Changed
- Default cloud channel to '7'.
- Dropped support for .NET 5 and 6 in favor of 8 since they are out of service more details can be found at https://dotnet.microsoft.com/en-us/platform/support/policy/dotnet-core

### Fixed
- Custom ClassName would not be used if the component was not rendered inside an EditForm. Patch contributed by Kamil Kuklinski.

Expand Down
14 changes: 14 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,17 @@ This demo will re-compile the blazor editor component and has various demos for
$ dotnet watch --project TinyMCE.BlazorDemoApp
```

### Msbuild actions

#### Cleans all build artifacts on all projects

```
$ dotnet clean
```

#### Builds all projects

```
$ dotnet build
```

8 changes: 4 additions & 4 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
standardProperties()

tinyPods.custom([
[ name: 'dotnet', image: 'mcr.microsoft.com/dotnet/sdk:6.0' ]
[ name: 'dotnet', image: 'mcr.microsoft.com/dotnet/sdk:8.0' ]
]) {
container('dotnet') {
stage("build") {
echo "Building Blazor component"
exec('dotnet build TinyMCE.Blazor')
echo "Building Blazor component and demo app"
exec('dotnet build')
}

stage("test") {
Expand All @@ -24,4 +24,4 @@ tinyPods.custom([
}
}
}
}
}
34 changes: 22 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

This package is a wrapper around [TinyMCE](https://github.com/tinymce/tinymce) to facilitate its use in Blazor applications.

* If you need detailed documentation on TinyMCE, see: [TinyMCE Documentation](https://www.tiny.cloud/docs/tinymce/6/).
* For the TinyMCE Blazor Quick Start, see: [TinyMCE Documentation - Blazor Integration](https://www.tiny.cloud/docs/tinymce/6/blazor-cloud/).
* For the TinyMCE Blazor Technical Reference, see: [TinyMCE Documentation - TinyMCE Blazor Technical Reference](https://www.tiny.cloud/docs/tinymce/6/blazor-ref/).
* If you need detailed documentation on TinyMCE, see: [TinyMCE Documentation](https://www.tiny.cloud/docs/tinymce/7/).
* For the TinyMCE Blazor Quick Start, see: [TinyMCE Documentation - Blazor Integration](https://www.tiny.cloud/docs/tinymce/7/blazor-cloud/).
* For the TinyMCE Blazor Technical Reference, see: [TinyMCE Documentation - TinyMCE Blazor Technical Reference](https://www.tiny.cloud/docs/tinymce/7/blazor-ref/).

### Issues

Expand All @@ -32,8 +32,6 @@ Install the TinyMCE Blazor integration

Verify by checking the `ItemGroup` references in `BlazorApp.csproj`

For dotnet 5 projects, add the `tinymce-blazor.js` script to your `Pages/_Host.cshtml` scripts. This step can be skipped for dotnet 6 projects.

```
<script src="_framework/blazor.server.js"></script>
<script src="_content/TinyMCE.Blazor/tinymce-blazor.js"></script>
Expand Down Expand Up @@ -76,12 +74,13 @@ The editor component accepts the following properties:
<Editor
Id="uuid"
Inline=false
CloudChannel="5"
CloudChannel="7"
Value=""
Disable=false
JsConfSrc="<path_to_jsObj>"
Conf="@yourConf"
ApiKey="your-api-key"
LicenseKey="your-license-key"
ClassName="tinymce-wrapper"
/>
```
Expand Down Expand Up @@ -116,6 +115,17 @@ Type: string
/>
```

#### LicenseKey

Specifies the [license key](https://www.tiny.cloud/docs/tinymce/7/license-key/) to be used with TinyMCE. This option does not need to be specified if you are using TinyMCE cloud.

##### Example using LicenseKey
```
<Editor
LicenseKey="your-license-key"
/>
```

#### Id

Specified an Id for the editor. Used for retrieving the editor instance using the `tinymce.get('ID')` method.
Expand Down Expand Up @@ -237,7 +247,7 @@ The `@bind-Value` directive can be used to create a two-way data binding.

##### Enable Form Validation

When the Editor is used part of a form inside an `EditForm`, specifying `Field` directive will enable form validation behaviours like Blazor's build in form components.
When the Editor is used part of a form inside an `EditForm`, specifying `Field` directive will enable form validation behaviours like Blazor's build in form components.

By default the Editor trigger validation when `onchange` event fires. You can change the trigger to `oninput` by specifying `ValidateOnInput` to `true`.

Expand All @@ -247,13 +257,13 @@ By default the Editor trigger validation when `onchange` event fires. You can ch
<DataAnnotationsValidator />
<p>
<label>Content</label>
<Editor Field="() => Model.Content"
@bind-Value="Model.Content"

<Editor Field="() => Model.Content"
@bind-Value="Model.Content"
ValidationOnInput="@true"/>

<ValidationMessage For="() => Model.Content" />
</p>
</p>
</EditForm>

@code {
Expand All @@ -270,4 +280,4 @@ By default the Editor trigger validation when `onchange` event fires. You can ch

#### Binding Text output

Starting from v0.0.4 you can use the `@bind-Text` property to hook the text output of the editor into a variable
Starting from v0.0.4 you can use the `@bind-Text` property to hook the text output of the editor into a variable
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

## Reporting a Vulnerability

For details on how to report security issues to Tiny, refer to the [Reporting TinyMCE security issues documentation](https://www.tiny.cloud/docs/tinymce/6/security/#reportingtinymcesecurityissues).
For details on how to report security issues to Tiny, refer to the [Reporting TinyMCE security issues documentation](https://www.tiny.cloud/docs/tinymce/7/security/#reportingtinymcesecurityissues).
24 changes: 16 additions & 8 deletions TinyMCE.Blazor/Editor.razor
Original file line number Diff line number Diff line change
Expand Up @@ -44,21 +44,26 @@
JSRuntime.InvokeVoidAsync("tinymceBlazorWrapper.insertContent", Id, content, args);
}

[CascadingParameter] public EditContext EditContext { get; set; }
#nullable enable
[CascadingParameter] public EditContext? EditContext { get; set; }
[Parameter] public Expression<Func<string>>? Field { get; set; }
[Parameter] public bool ValidateOnInput { get; set; } = false;
[Parameter] public string ClassName { get; set; } = "tinymce-wrapper";
[Parameter] public string Id { get; set; } = System.Guid.NewGuid().ToString();
[Parameter] public bool Inline { get; set; } = false;
[Parameter] public string ApiKey { get; set; } = "no-api-key";
[Parameter] public string CloudChannel { get; set; } = "6";
[Parameter] public string ScriptSrc { get; set; }
[Parameter] public string InitialValue { get; set; }
[Parameter] public string JsConfSrc { get; set; }
[Parameter] public string? LicenseKey { get; set; }
[Parameter] public string CloudChannel { get; set; } = "7";
[Parameter] public string? ScriptSrc { get; set; }
[Parameter] public string? InitialValue { get; set; }
[Parameter] public string? JsConfSrc { get; set; }
[Parameter] public string ModelEvents { get; set; } = "change input undo redo";
[Parameter] public Dictionary<string, object> Conf { get; set; } = new Dictionary<string, object>();
[Parameter(CaptureUnmatchedValues = true)] public Dictionary<string, object> AdditionalAttributes { get; set; } = new Dictionary<string, object>();
[Parameter] public EventCallback<string> ValueChanged { get; set; }
#nullable restore

#pragma warning disable BL0007
[Parameter]
public string Value
{
Expand All @@ -74,16 +79,13 @@
}
}

[Parameter] public EventCallback<string> ValueChanged { get; set; }

[Parameter]
public string Text
{
get => _text;
set {}
}

[Parameter] public EventCallback<string> TextChanged { get; set; }

[Parameter]
public bool Disable
Expand All @@ -99,6 +101,9 @@
}
}
}
#pragma warning restore BL0007

[Parameter] public EventCallback<string> TextChanged { get; set; }

[JSInvokable("GetValue")]
public Task<string> ReturnValue()
Expand Down Expand Up @@ -249,6 +254,9 @@
if (firstRender)
{
blazorConf = new Dictionary<string, object>();
if (this.LicenseKey != null) {
blazorConf.Add("licenseKey", this.LicenseKey);
}
blazorConf.Add("inline", Inline);
string tinySrc = ScriptSrc != null ? ScriptSrc : $"https://cdn.tiny.cloud/1/{ApiKey}/tinymce/{CloudChannel}/tinymce.min.js";
blazorConf.Add("src", tinySrc);
Expand Down
15 changes: 7 additions & 8 deletions TinyMCE.Blazor/TinyMCE.Blazor.csproj
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<PackageId>TinyMCE.Blazor</PackageId>
<Version>1.0.4</Version>
<Version>2.0.0</Version>
<Authors>Tiny</Authors>
<Company>Tiny</Company>
<PackageTags>TinyMCE;RTE;Blazor;Component;Rich;Text;Editor;rich-text-editor</PackageTags>
<Description>This package is an official wrapper around TinyMCE to facilitate its use in Blazor applications. TinyMCE is a rich text editing platform and the most advanced WYSIWYG HTML editor designed to simplify website content creation.</Description>
<TargetFrameworks>net5.0;net6.0</TargetFrameworks>
<TargetFrameworks>net8.0</TargetFrameworks>
<RazorLangVersion>3.0</RazorLangVersion>
<RepositoryUrl>https://github.com/tinymce/tinymce-blazor</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageIcon>tiny-icon.png</PackageIcon>
<PackageReleaseNotes>$([System.IO.File]::ReadAllText("$(MSBuildProjectDirectory)/../CHANGELOG.md"))</PackageReleaseNotes>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="5.0.4" Condition="'$(TargetFramework)' == 'net5.0'" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="6.0.0" Condition="'$(TargetFramework)' == 'net6.0'" />
<None Include="../LICENSE.txt" pack="true" PackagePath="" />
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0.0" Condition="'$(TargetFramework)' == 'net8.0'" />
<None Include="../LICENSE.txt" pack="true" PackagePath="" />
<None Include="../README.md" pack="true" PackagePath="" />
<None Include="../tiny-icon.png" Pack="true" PackagePath="" />
</ItemGroup>

</Project>
5 changes: 4 additions & 1 deletion TinyMCE.Blazor/wwwroot/TinyMce.Blazor.lib.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ window.tinymceBlazorWrapper = {
return (jsConf !== undefined && typeof jsConf === 'object') ? jsConf : {};
};
const tinyConf = { ...getJsObj(blazorConf.jsConf), ...blazorConf.conf };
if (blazorConf.licenseKey) {
tinyConf.license_key = blazorConf.licenseKey;
}
tinyConf.inline = blazorConf.inline;
tinyConf.readonly = blazorConf.disabled;
tinyConf.target = el;
Expand Down Expand Up @@ -173,4 +176,4 @@ window.tinymceBlazorWrapper = {
getTiny().get(id).remove();
}
}
}
}
Loading