search

Ckeditor&Ckfinder

Jun 13, 2016 pm 12:20 PM
ckeditorconfigjquerynbsptextarea

在线编辑器Ckeditor (1)

在线编辑器

在线编辑器也称之为所见即所得编辑器,是一种常见的html源码编辑器。

所见即所得:用户在输入的时候,不论是格式和是样式都能被系统原封不动的保存,最后在查看的时候,可以按照用户输入的原来的结构进行输出。

在线编辑器分类

市面上比较常见的在线编辑器有很多,FCKeditor(在线编辑器+Ajax浏览器端服务器文件管理器,免费的),Ckeditor(Content and Knowledge,在线编辑器与服务器端文件管理器分离,在线编辑器免费,服务器端文件管理器收费(CKfinder)),百度旗下Ueditor,Kindeditor

在线编辑器作用

在线编辑器就是所见即所得。

作用

  1. 方便操作,提高用户体验
  2. 简化操作
  3. 提高内容的兼容性

Ckeditor&Ckfinder

Ckeditor的历史比较悠久,被国内外web项目广泛的应用。

基本所有的在在线编辑器都差不多,无外乎就是插件的多少(功能),操作手册

 

为什么要使用Ckeditor?

  1. 被广泛应用
  2. Ckeditor非常成熟(市场或者产品)
  3. Ckeditor兼容性比较好(所有的在线编辑器都是js编写的)

 

Ckeditor安装

将获取到的Ckeditor解压后放到对应的项目位置就可以使用。

  1. 获取Ckeditor编辑器。http://www.ckeditor.com

basic:基本,功能较少

standard:标准,常用功能都有

full:完整,拥有全部功能

下载下来:

2 解压到指定目录

3 将Ckeditor文件夹放到需要使用的项目位置

Ckeditor目录结构

使用Ckeditor

当前能够编辑html源码的表单元素:textarea

因此,在线编辑器的使用都是要基于textarea元素

1 加载Ckeditor的js文件。/ckeditor/ckeditor.js

2 界面中必须要有一个textarea元素。

3 将textarea替换成对应的Ckeditor编辑器

a) 最简方式:在textarea标签中增加一个class属性,值为Ckeditor

textarea元素必须要有id或者name属性其中一个

b)         标准方式:使用Ckeditor提供的类CKEDITOR,以及其替换方法replace

myck1可以是id的值,也可以是name属性的值

c)         高级方式:使用jQuery进行textarea替换

要先加载jQuery.js

加载CKEDITOR对jQuery提供的接口文件jquery.js。/ckeditor/adapters/jquery.js

使用jQuery语法,替换textarea元素

配置(定制)Ckeditor

Ckeditor提供了三种配置方式

  1. 修改系统提供的配置文件config.js

修改配置文件

效果

特点:项目中所有的Ckeditor都会受config.js的影响。

2 自定义配置文件,形式与系统配置文件config.js一致

新建一个用户配置文件,配置文件的格式与config.js格式完全一致

修改配置选项

 

在需要使用客户化的配置文件的Ckeditor实例中加载客户化的配置文件。

注意:

         使用基础版的方式加载Ckeditor,没有办法进行客户化配置文件使用

         只有标准版和jquery版可以使用

特点:只有加载了客户化配置文件的Ckeditor实例会受影响,其他的不受影响。(该方式使用的比较多)

 

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
The Continued Use of PHP: Reasons for Its EnduranceThe Continued Use of PHP: Reasons for Its EnduranceApr 19, 2025 am 12:23 AM

What’s still popular is the ease of use, flexibility and a strong ecosystem. 1) Ease of use and simple syntax make it the first choice for beginners. 2) Closely integrated with web development, excellent interaction with HTTP requests and database. 3) The huge ecosystem provides a wealth of tools and libraries. 4) Active community and open source nature adapts them to new needs and technology trends.

PHP and Python: Exploring Their Similarities and DifferencesPHP and Python: Exploring Their Similarities and DifferencesApr 19, 2025 am 12:21 AM

PHP and Python are both high-level programming languages ​​that are widely used in web development, data processing and automation tasks. 1.PHP is often used to build dynamic websites and content management systems, while Python is often used to build web frameworks and data science. 2.PHP uses echo to output content, Python uses print. 3. Both support object-oriented programming, but the syntax and keywords are different. 4. PHP supports weak type conversion, while Python is more stringent. 5. PHP performance optimization includes using OPcache and asynchronous programming, while Python uses cProfile and asynchronous programming.

PHP and Python: Different Paradigms ExplainedPHP and Python: Different Paradigms ExplainedApr 18, 2025 am 12:26 AM

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

PHP and Python: A Deep Dive into Their HistoryPHP and Python: A Deep Dive into Their HistoryApr 18, 2025 am 12:25 AM

PHP originated in 1994 and was developed by RasmusLerdorf. It was originally used to track website visitors and gradually evolved into a server-side scripting language and was widely used in web development. Python was developed by Guidovan Rossum in the late 1980s and was first released in 1991. It emphasizes code readability and simplicity, and is suitable for scientific computing, data analysis and other fields.

Choosing Between PHP and Python: A GuideChoosing Between PHP and Python: A GuideApr 18, 2025 am 12:24 AM

PHP is suitable for web development and rapid prototyping, and Python is suitable for data science and machine learning. 1.PHP is used for dynamic web development, with simple syntax and suitable for rapid development. 2. Python has concise syntax, is suitable for multiple fields, and has a strong library ecosystem.

PHP and Frameworks: Modernizing the LanguagePHP and Frameworks: Modernizing the LanguageApr 18, 2025 am 12:14 AM

PHP remains important in the modernization process because it supports a large number of websites and applications and adapts to development needs through frameworks. 1.PHP7 improves performance and introduces new features. 2. Modern frameworks such as Laravel, Symfony and CodeIgniter simplify development and improve code quality. 3. Performance optimization and best practices further improve application efficiency.

PHP's Impact: Web Development and BeyondPHP's Impact: Web Development and BeyondApr 18, 2025 am 12:10 AM

PHPhassignificantlyimpactedwebdevelopmentandextendsbeyondit.1)ItpowersmajorplatformslikeWordPressandexcelsindatabaseinteractions.2)PHP'sadaptabilityallowsittoscaleforlargeapplicationsusingframeworkslikeLaravel.3)Beyondweb,PHPisusedincommand-linescrip

How does PHP type hinting work, including scalar types, return types, union types, and nullable types?How does PHP type hinting work, including scalar types, return types, union types, and nullable types?Apr 17, 2025 am 12:25 AM

PHP type prompts to improve code quality and readability. 1) Scalar type tips: Since PHP7.0, basic data types are allowed to be specified in function parameters, such as int, float, etc. 2) Return type prompt: Ensure the consistency of the function return value type. 3) Union type prompt: Since PHP8.0, multiple types are allowed to be specified in function parameters or return values. 4) Nullable type prompt: Allows to include null values ​​and handle functions that may return null values.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

Atom editor mac version download

Atom editor mac version download

The most popular open source editor