Log In Sign Up
HomeExamplesEditor Library: Additional Data Sources, Events, and Methods Demo Examples

Editor Library: Additional Data Sources, Events, and Methods Demo Examples

Category: Examples
The Editor rich text editor supports HTML editing, unlike textarea which only handles plain text, and provides multiple shortcut operations.

Plain Text Value

If the initial content is plain text, you can use the value parameter instead of content.

Node Content

The content parameter can accept a DOM node.

Asynchronous Content

The content parameter can accept an asynchronous URL.

Data Content

The content parameter can accept object or array format data, in which case tplStr and tplEng are required for parsing.

Special Data Content

If the content parameter is passed an object, it would normally be treated as data. However, if it contains the REQRETRY property, it will be treated as a parameter for getContent and the request will be initiated again.

Deferred Content Loading

If the content to be loaded during initialization is large, you can set the deferred:true parameter to prevent content loading during initialization. The content will only load when the mask element is clicked.

Feature Presets

The feature parameter can set specific button combinations with the following options:

Custom Tools

The header.children parameter is used to customize tool buttons. When using this parameter, the feature parameter will be ignored.

Source Mode

By default, initialization displays in HTML editor mode. To initialize in source mode, set the parameter mode:'source'. You can switch back to HTML editor by clicking the "Source/Editor" button.

Disabled State

There are two ways to set disabled state:

Borders

To integrate this editor with other components, you may need to set border styles that match other sections. The appear parameter can modify border styles with the following properties:

Form Integration

By default, the editor serves as an assignment tool and cannot be part of form input controls. However, if the name parameter is set, the editor's source textarea control will become part of the form.

Operational Methods

This module provides several useful operational methods:

Pre-Paste Handler Function

By default, pasted content includes HTML tags. To further process clipboard content, use the b4Paste function.

Event Listeners

In addition to standard events like ready, initiate, initiated, destroy, this module provides several useful event listeners:

Data Caching

Setting the storName parameter enables data caching, requiring this value to be unique. The core method for implementing caching is updateCache, while clearCache can be used to clear the cache.

New Launch: 20% Off All Products

Unlock all examples and development resources