@using GreenTree.Nachtragsmanagement.Web.Extensions

@model GreenTree.Nachtragsmanagement.Web.Models.Misc.HelpPageDataModel

@Html.DevExpress().HtmlEditor(t =>
{
	t.Name = "devHelpPageHtmlContentEditor";
	t.Width = new Unit(100, UnitType.Percentage);
	t.Height = new Unit(400, UnitType.Pixel);

	t.SettingsHtmlEditing.AllowHTML5MediaElements = true;
	t.SettingsHtmlEditing.AllowEditFullDocument = true;
	t.SettingsHtmlEditing.EnterMode = DevExpress.Web.ASPxHtmlEditor.HtmlEditorEnterMode.Default;

	t.SettingsDialogs.InsertImageDialog.SettingsImageUpload.ValidationSettings.Assign(
		GreenTree.Nachtragsmanagement.Web.Controllers.MiscController.ImageUploadValidationSettings);
	t.SettingsDialogs.InsertImageDialog.SettingsImageUpload.UploadCallbackRouteValues = new { Controller = "Misc", Action = "UploadProcessingImageUpload" };

	t.CallbackRouteValues = new { Controller = "Misc", Action = "PartialHtmlEditor" };

	t.Toolbars.Add(toolbar =>
	{
		toolbar.Items.Add(
			new DevExpress.Web.ASPxHtmlEditor.ToolbarCutButton(),
			new DevExpress.Web.ASPxHtmlEditor.ToolbarCopyButton(),
			new DevExpress.Web.ASPxHtmlEditor.ToolbarPasteButton(),
			new DevExpress.Web.ASPxHtmlEditor.ToolbarPasteFromWordButton(),
			new DevExpress.Web.ASPxHtmlEditor.ToolbarUndoButton() { BeginGroup = true },
			new DevExpress.Web.ASPxHtmlEditor.ToolbarRedoButton(),
			new DevExpress.Web.ASPxHtmlEditor.ToolbarRemoveFormatButton() { BeginGroup = true },
			new DevExpress.Web.ASPxHtmlEditor.ToolbarSuperscriptButton() { BeginGroup = true },
			new DevExpress.Web.ASPxHtmlEditor.ToolbarSubscriptButton(),
			new DevExpress.Web.ASPxHtmlEditor.ToolbarInsertOrderedListButton() { BeginGroup = true },
			new DevExpress.Web.ASPxHtmlEditor.ToolbarInsertUnorderedListButton(),
			new DevExpress.Web.ASPxHtmlEditor.ToolbarIndentButton() { BeginGroup = true },
			new DevExpress.Web.ASPxHtmlEditor.ToolbarOutdentButton(),
			new DevExpress.Web.ASPxHtmlEditor.ToolbarInsertLinkDialogButton() { BeginGroup = true },
			new DevExpress.Web.ASPxHtmlEditor.ToolbarUnlinkButton(),
			new DevExpress.Web.ASPxHtmlEditor.ToolbarInsertImageDialogButton(),
			new DevExpress.Web.ASPxHtmlEditor.ToolbarTableOperationsDropDownButton() { BeginGroup = true },
			new DevExpress.Web.ASPxHtmlEditor.ToolbarFindAndReplaceDialogButton() { BeginGroup = true },
			new DevExpress.Web.ASPxHtmlEditor.ToolbarFullscreenButton() { BeginGroup = true });

		if (Model.Id != -1)
		{
			toolbar.Items.Add<DevExpress.Web.ASPxHtmlEditor.CustomToolbarButton>(c =>
			{
				c.ViewStyle = DevExpress.Web.ASPxHtmlEditor.ViewStyle.Image;
				c.BeginGroup = true;
				c.CommandName = "save";
				c.ToolTip = "Speichern";
				c.Image.Url = Url.Content("~/Content/Images/save-16.png");
				c.Image.UrlDisabled = Url.Content("~/Content/Images/save-16-disable.png");
				c.Image.UrlHottracked = Url.Content("~/Content/Images/save-16-contrast.png");
			});
		}

		toolbar.Items.Add<DevExpress.Web.ASPxHtmlEditor.CustomToolbarButton>(c =>
		{
			c.ViewStyle = DevExpress.Web.ASPxHtmlEditor.ViewStyle.Image;
			c.BeginGroup = Model.Id == -1;
			c.CommandName = "saveAs";
			c.ToolTip = "Speichern als";
			c.Image.Url = Url.Content("~/Content/Images/saveAs-16.png");
			c.Image.UrlDisabled = Url.Content("~/Content/Images/saveAs-16-disable.png");
			c.Image.UrlHottracked = Url.Content("~/Content/Images/saveAs-16-contrast.png");
		});
	});
	t.Toolbars.Add(DevExpress.Web.ASPxHtmlEditor.HtmlEditorToolbar.CreateStandardToolbar2());
	t.ClientSideEvents.CustomCommand = "function (s, e) { onHtmlToolbarCustomCommand(e); }";
}).Bind(Model.Content).GetHtml()