📄 editor.cs
字号:
//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
// Copyright (c) Telligent Systems Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
//How can we validate an unknown child control?
namespace CommunityServer.Controls
{
/// <summary>
/// Summary description for Editor.
/// </summary>
[ValidationPropertyAttribute("Text")]
public class Editor : Control, INamingContainer
{
public Editor()
{
}
private Control childControl = null;
private ITextEditor iText = null;
protected override void OnInit(EventArgs e)
{
Create();
base.OnInit (e);
}
private bool isCreated = false;
private void Create()
{
if(!isCreated)
{
string[] roles = (Roles != null) ? Roles.Split(';') : null;
iText = TextEditorLoader.Instance(Context, roles);
childControl = (Control)iText;
childControl.ID = "Editor";
this.Controls.Add(childControl);
isCreated = true;
}
}
public bool IsRichTextCapable
{
get
{
Create();
return iText.IsRichTextCapable;
}
}
public Unit Height
{
set
{
Create();
iText.Height = value;
}
}
public Unit Width
{
set
{
Create();
iText.Width = value;
}
}
public int Rows
{
set
{
Create();
iText.Rows = value;
}
}
public int Columns
{
set
{
Create();
iText.Columns = value;
}
}
public string StyleName
{
set
{
Create();
iText.StyleName = value;
}
}
private string _roles;
public string Roles
{
get{return _roles;}
set{_roles = value;}
}
public override ControlCollection Controls
{
get
{
EnsureChildControls();
return base.Controls;
}
}
/// <summary>
/// Property EnableHtmlModeEditing (bool)
/// </summary>
public bool EnableHtmlModeEditing
{
get
{
Create();
return iText.EnableHtmlModeEditing; }
set
{ Create();
iText.EnableHtmlModeEditing = value; }
}
public string Text
{
get
{
Create();
return iText.Text;
}
set
{ Create();
iText.Text = value;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -