Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use CuteEditor in .NET 6

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains how to use CuteEditor in. NET6. Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's take you to learn how to use CuteEditor in. NET6!

1. CuteEditor configuration: 1. Put the following files into bin under the root directory of your site (these can be found under CuteEditor6.0/bin)

CuteEditor.dll,

CuteEditor.ImageEditor.dll (EditorImage added in 6.0),

CuteEditor.lic,

NetSpell.SpellChecker.dll

Note: (Files with the ".dic" extension are dictionaries saved as plain text files.) Copy everything in CuteEditor6.0/bin folder to bin in the root directory of your site.

Copy the CuteSoft_Client folder to the root directory of the project

CuteSoft_Client contains the CuteEditor folder and example.css, which holds data such as control images, files, etc. example.css specifies the editor style. (Under 2.0, getfilethub.aspx in dialog folder may be deleted)

Note:FilesPath is used to set the corresponding directory, for example: FilesPath="~/admin/CuteSoft_Client/CuteEditor/"

3, Create Uploads folder in root directory as root directory for uploading pictures and attachments 4, Add CuteEditor.dll to toolbox

First right-click in the blank of the toolbox and select "Add Option" to add a name to the tab: CuteEditor. Right-click in the tab, select Select Item, and select the DLL file to be added from the tab of. NET Frameword Component in the pop-up dialog box.

5. CuteEditor attribute settings (assuming that the current page is under the root directory)

1)AutoConfigure is set to simple, that is, select the simplest interface display mode

2)EditorWysiwygModecss is set to CuteSoft_Client/example.cs, and the example.css file needs to be placed in this directory.

3)FilesPath set to CuteSoft_Client/CuteEditor, set the path of CuteEditor directory

6. The call code of the control is as follows:

If you drag and drop it from the toolbox to the page as in step 4, this code will be generated automatically and you don't need to add it manually.

2. Basic Attributes:

EditorWysiwygModeCss

ThemeType : Set style

AutoConfigure : Select whether the function is simple or complex

Text : Set default content when loading

MaxHTMLLength : Set maximum length

BreakElement : Default "Enter" produces what HTML

URLType : No difference found

ResizeMode : Automatic Length (several forms of length setting)

ReadOnly : Is it read-only?

CustomCulture : Set language type china to zh-cn

EditCompleteDocument : Sets whether the HTML page code is complete (i.e. includes html headers)

AllowPasteHtml : Allow pasting HTML code

EnableContextMenu : Does the right-click menu appear in text?

3. Configuration in CuteEditor folder:

1) Control tool bar display: Set in CuteSoft_Client/CuteEditor/Configuration/AutoConfigure

2) Right click control display: CuteSoft_Client/CuteEditor/Configuration/ContextMenuMode settings

3) Setting permissions: CuteSoft_Client/CuteEditor/Configuration/Security

For example, to set attribute limits such as the size of various components, such as controlling the size of uploaded files, you can modify the "Default.config" file in the "Security" folder in CuteSoft_Client/CuteEditor/Configuration/Security.

true //Limit upload image size false //If the uploaded file already exists, overwrite it true //Rename to Time true //whether to automatically adjust the upload image 1024 //Maximum width of uploaded images 768 //Minimum width of uploaded image 1000 //maximum number of uploaded image files 100 //maximum number of uploaded media files 100 //Maximum number of Flash files uploaded 10000 //maximum file size 1000 //template maximum ~/uploads //image file upload path ~/uploads //Media file upload path ~/uploads //Flash file upload path ~/templates //template path ~/uploads //File library path 102400 //Image folder maximum 102400 //media folder maximum 102400 //Flash folder maximum 102400 //Maximum number of document folders 102400 //template folder maximum 80 //Minimum width 80 //minimum height 5 //Minimum number of columns 3 //Minimum number of rows true //Allow uploads true //Allow modification true //Allow renaming true //Allow deletion true //Allow copying true //Allow movement true //Allow folder creation true //Allow folder deletion //filter (set) image file format here .jpg .jpeg .gif .png //Filter (set) media file formats here .avi .mpg .mpeg .mp3 //filter (set) document file format here .txt .doc .pdf .zip .rar .avi .mpg .mpeg .swf .jpg .jpeg .gif .png .htm

4) Settings Tool Bar Button Specific Function: CuteSoft_Client/CuteEditor/Configuration/Shared Settings

5) Settings Tool Bar Button Specific Function: CuteSoft_Client/CuteEditor/Configuration/Shared Settings

6) Setting language: CuteSoft_Client/CuteEditor/Configuration/Languages

7) Add font: CuteSoft_Client/CuteEditor/Configuration/Shared/Common.config

CuteEditor can be changed everywhere, because its overall idea is to use the touchpad, and the specific embodiment is written in the configuration file. Users modify the configuration file or it provides attributes can achieve their own functions!

4. Server-side control of CuteEditor 1) Set default text of editor: Editor1.Text = "Default Text"; //server-side method var editor = document.getElementById (''); //JavaScript method var editorText = editor.getHTML();2) Modify the upload directory of the file: Editor1.SetSecurityGalleryPath("~/uploads/jpg");

Modify the total size of uploaded files (Flash as an example): Editor1.SetSecurityMaxFlashFolderSize(1000);

Modify the size of a single uploaded file (take Flash as an example): Editor1.SetSecurityMaxFlashSize(kb); //KB is the default unit

3) Multi-user folders

Since uploaded files are placed in the uploads folder, you can create an uploaded folder for each user through program control. The code is as follows:

using System.IO; string username = Session["username"].ToString() ; fullPath = Server.MapPath("uploads\\") + username; if (! Directory.Exists(fullPath)) { Directory.CreateDirectory(fullPath); } Editor1.SetSecurityGalleryPath("~/uploads/" + username); V. CuteEditor adds Chinese font

You can modify the file CuteSoft_Client\CuteEditor\Configuration\Shared\Common.config to add fonts.

The main thing to note is that the file is encoded in XML

FangSong_GB2312KaiTi_GB2312

To display Chinese fonts in CuteEditor, you need to "internationalize" the Chinese font name, that is, change the Chinese font name to English name,

For example, change "Song" to "Simsun","bold" to "Simhei", etc., the following is a partial font comparison list:

English Name Localized Name

SimSun

SimHei blackbody

FangSong_GB2312 FangSong_GB2312

KaiTi_GB2312 Regular font_GB2312

YouYuan YouYuan

ST. Song

STZhongsong中文中Song

STKaiti Chinese Regular Script

STFangsong

STXihei Chinese Fine Black

STLiti Chinese Official Script

STXingkai Chinese script

STXinwei中文新Wei

STHupo Chinese Amber

STCaiyun中文Colorful Cloud

FZYaoTi Founder Yao Ti

FZShuTi Founder Shuti

NSimSun

LiSu Lishu

At this point, I believe that everyone has a deeper understanding of "how to use CuteEditor in. NET6," so let's actually operate it! Here is the website, more related content can enter the relevant channels for inquiry, pay attention to us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report