Merge pull request #5577 from zyhfish/task/radzen-text-editor
implement radzen text editor.
This commit is contained in:
@ -20,6 +20,7 @@ using Microsoft.AspNetCore.HttpOverrides;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Localization;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using Oqtane.Extensions;
|
||||
@ -32,6 +33,7 @@ using Oqtane.Repository;
|
||||
using Oqtane.Security;
|
||||
using Oqtane.Services;
|
||||
using Oqtane.Shared;
|
||||
using Radzen;
|
||||
|
||||
namespace Microsoft.Extensions.DependencyInjection
|
||||
{
|
||||
@ -193,7 +195,7 @@ namespace Microsoft.Extensions.DependencyInjection
|
||||
services.AddScoped<Oqtane.Shared.SiteState>();
|
||||
services.AddScoped<IInstallationService, InstallationService>();
|
||||
services.AddScoped<IModuleDefinitionService, ModuleDefinitionService>();
|
||||
services.AddScoped<IThemeService, ThemeService>();
|
||||
services.AddScoped<IThemeService, Oqtane.Services.ThemeService>();
|
||||
services.AddScoped<IAliasService, AliasService>();
|
||||
services.AddScoped<ITenantService, TenantService>();
|
||||
services.AddScoped<IPageService, PageService>();
|
||||
@ -208,7 +210,7 @@ namespace Microsoft.Extensions.DependencyInjection
|
||||
services.AddScoped<ILogService, LogService>();
|
||||
services.AddScoped<IJobService, JobService>();
|
||||
services.AddScoped<IJobLogService, JobLogService>();
|
||||
services.AddScoped<INotificationService, NotificationService>();
|
||||
services.AddScoped<INotificationService, Oqtane.Services.NotificationService>();
|
||||
services.AddScoped<IFolderService, FolderService>();
|
||||
services.AddScoped<IFileService, FileService>();
|
||||
services.AddScoped<ISiteTemplateService, SiteTemplateService>();
|
||||
@ -230,6 +232,12 @@ namespace Microsoft.Extensions.DependencyInjection
|
||||
// providers
|
||||
services.AddScoped<ITextEditor, Oqtane.Modules.Controls.QuillJSTextEditor>();
|
||||
services.AddScoped<ITextEditor, Oqtane.Modules.Controls.TextAreaTextEditor>();
|
||||
services.AddScoped<ITextEditor, Oqtane.Modules.Controls.RadzenTextEditor>();
|
||||
|
||||
services.AddRadzenComponents();
|
||||
|
||||
var localizer = services.BuildServiceProvider().GetService<IStringLocalizer<Oqtane.Modules.Controls.RadzenTextEditor>>();
|
||||
Oqtane.Modules.Controls.RadzenEditorDefinitions.Localizer = localizer;
|
||||
|
||||
return services;
|
||||
}
|
||||
|
@ -0,0 +1,22 @@
|
||||
.rz-text-editor {
|
||||
outline: none !important;
|
||||
}
|
||||
|
||||
.rz-html-editor-dropdown-items,
|
||||
.rz-popup,
|
||||
.rz-editor-dialog-wrapper {
|
||||
z-index: 9999 !important;
|
||||
}
|
||||
|
||||
.rz-html-editor-dropdown-items .rz-html-editor-dropdown-item,
|
||||
.rz-html-editor-dropdown-items .rz-html-editor-dropdown-item > * {
|
||||
color: var(--rz-editor-button-color);
|
||||
}
|
||||
.rz-text-editor .rz-html-editor-dropdown .rz-html-editor-dropdown-value,
|
||||
.rz-text-editor .rz-html-editor-dropdown .rz-html-editor-dropdown-trigger,
|
||||
.rz-text-editor .rz-html-editor-colorpicker .rz-html-editor-color {
|
||||
color: var(--rz-editor-button-color);
|
||||
}
|
||||
.rz-text-editor .rz-colorpicker.rz-state-disabled {
|
||||
border: none !important;
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
var Oqtane = Oqtane || {};
|
||||
|
||||
Oqtane.RadzenTextEditor = {
|
||||
initialize: function (editor) {
|
||||
if (typeof Radzen.openPopup === "function" && Radzen.openPopup !== Oqtane.RadzenTextEditor.openPopup) {
|
||||
Oqtane.RadzenTextEditor.radzenOpenPopup = Radzen.openPopup;
|
||||
Radzen.openPopup = Oqtane.RadzenTextEditor.openPopup;
|
||||
}
|
||||
},
|
||||
openPopup: function () {
|
||||
Oqtane.RadzenTextEditor.radzenOpenPopup.apply(this, arguments);
|
||||
var id = arguments[1];
|
||||
var popup = document.getElementById(id);
|
||||
if (popup) {
|
||||
Oqtane.RadzenTextEditor.updateButtonStyles(popup);
|
||||
}
|
||||
},
|
||||
setBackgroundColor: function (editor, color) {
|
||||
editor.getElementsByClassName("rz-html-editor-content")[0].style.backgroundColor = color;
|
||||
},
|
||||
updateDialogLayout: function (editor) {
|
||||
var dialogs = editor.parentElement.getElementsByClassName('rz-dialog-wrapper');
|
||||
for (var dialog of dialogs) {
|
||||
document.body.appendChild(dialog);
|
||||
dialog.classList.add('rz-editor-dialog-wrapper', 'text-dark');
|
||||
|
||||
this.updateButtonStyles(dialog);
|
||||
}
|
||||
},
|
||||
updateButtonStyles: function (parent) {
|
||||
var primaryBtns = parent.getElementsByClassName('rz-primary');
|
||||
if (primaryBtns) {
|
||||
for (var btn of primaryBtns) {
|
||||
btn.classList.remove('rz-button', 'rz-primary');
|
||||
btn.classList.add('btn', 'btn-primary');
|
||||
}
|
||||
}
|
||||
|
||||
var secondaryBtns = parent.getElementsByClassName('rz-secondary');
|
||||
if (secondaryBtns) {
|
||||
for (var btn of secondaryBtns) {
|
||||
btn.classList.remove('rz-button', 'rz-secondary');
|
||||
btn.classList.add('btn', 'btn-secondary');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user