tencent cloud

Tencent Cloud Super App as a Service

Release Notes and Announcements
Announcement: Tencent Cloud Mini Program Platform Renamed to Tencent Cloud Super App as a Service on January 2, 2025
Console Updates
Android SDK Updates
iOS SDK Updates
Flutter SDK Updates
IDE Updates
Base Library Updates
Product Introduction
Overview
Strengths
Use Cases
Purchase Guide
Billing Overview
Pay-As-You-Go Billing
Renewal Guide
Service Suspension Instructions
Getting Started
Plan Management
Overview
Console Account Management
Storage Configuration
Acceleration Configuration
Branding Configurations
Platform Features
Console Login
Users and Permission System
Mini Program Management
Mini Game Management
Superapp Management
Commercialization
Platform Management
User Management
Team Management
Operations Management
Security Center
Code Integration Guide
Getting Demo and SDK
Android
iOS
Flutter
Superapp Server
GUID Generation Rules
Mini Program Development Guide
Mini Program Introduction and Development Environment
Mini Program Code Composition
Guide
Framework
Components
API
Server Backend
JS SDK
Base Library
IDE Operation Instructions
Mini Game Development Guide
Guide
API
Server Backend
Practice Tutorial
Mini Program Login Practical Tutorial
Mini Program Subscription Message Practical Tutorial
Payment Practical Tutorial
Ad Integration Practical Tutorial
Mini Game Subscription Message Practical Tutorial
API Documentation
History
Introduction
API Category
Making API Requests
Operation Management APIs
User Management APIs
Team Management APIs
Sensitive API-Related APIs
Role Management APIs
Platform Management APIs
Other Console APIs
Mini Program or Mini Game APIs
Management-Sensitive APIs
Global Domain Management APIs
Superapp APIs
Data Types
Agreements
Service Level Agreement
Data Processing and Security Agreement
SDK Privacy Policy Module
SDK Data Processing and Security Agreement Module

Rich Text

PDF
Focus Mode
Font Size
Last updated: 2026-03-24 16:58:21

EditorContext

Feature Description: An EditorContext instance can be obtained through wx.createSelectorQuery. The EditorContext is bound to an editor component through an id, thereby manipulating the corresponding editor component.

.blur

This method is used via EditorContext.blur(Object object).
Feature Description: The editor loses focus, concurrently retracting the keyboard.
Parameter and Description: Object
Attribute
Type
Default value
Required
Description
success
function
-
No
Callback Function of Successful Interface Call
fail
function
-
No
Callback Function of Failing Interface Call
complete
function
-
No
Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations)

.clear

This method is used via EditorContext.clear(Object object)
Feature Description: Empties the content of the editor.
Parameter and Description: Object.
Attribute
Type
Default value
Required
Description
success
function
-
No
Callback Function of Successful Interface Call
fail
function
-
No
Callback Function of Failing Interface Call
complete
function
-
No
Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations)

.format

This method is used via EditorContext.format(string name, string value).
Feature Description: Modifies the style.
Parameter and Description:
string name, the attribute;
string value, value.
A list of styles that support the setting:
name
value
bold
-
italic
-
underline
-
strike
-
ins
-
script
sub / super
header
H1 / H2 / h3 / H4 / h5 / H6
align
left / center / right / justify
direction
rtl
indent
-1 / +1
list
ordered / bullet / check
color
hex color
backgroundColor
hex color
margin/marginTop/marginBottom/marginLeft/marginRight
css style
padding/paddingTop/paddingBottom/paddingLeft/paddingRight
css style
font/fontSize/fontStyle/fontVariant/fontWeight/fontFamily
css style
lineHeight
css style
letterSpacing
css style
textDecoration
css style
textIndent
css style
wordWrap
css style
wordBreak
css style
whiteSpace
css style
Setting a style on a selection that has already been styled removes the style. css style represents the allowed values specified in css.

.getContents

This method is used via EditorContext.getContents().
Feature Description: Gets the content of the editor.
Parameter and Description: Object.

.getSelectionText

This method is used via EditorContext.getSelectionText(Object object).
Feature Description: Gets the plain text content within the selected area of the editor. When the editor loses focus or a section is not selected, the returned content is empty.
Parameter and Description: Object.
Attribute
Type
Default value
Required
Description
success
function
-
No
Callback Function of Successful Interface Call
fail
function
-
No
Callback Function of Failing Interface Call
complete
function
-
No
Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations)
object.success callback function
Arguments Object.res
Attribute
Type
Description
text
string
Plain text content

.insertDivider

This method is used via EditorContext.insertDivider(Object object)
Feature Description: Inserts a divider.
Parameter and Description: Object.
Attribute
Type
Default value
Required
Description
success
function
-
No
Callback Function of Successful Interface Call
fail
function
-
No
Callback Function of Failing Interface Call
complete
function
-
No
Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations)

.insertlmage

This method is used via EditorContext.insertlmage(Object object).
Feature Description: Inserts an image.
When the address is a temporary file, the HTML format content of the editor obtained adds the attribute data-local to the tag, and the data-local field is added to the image attributes attribute in the delta format content, which is the address of the temporary file passed in.
Developers can opt to upload images to the server during the submission phase, replacing them once the network address is obtained. For HTML content, the src value should be replaced, while for delta content, the insert {image: abc} value should be substituted.
Parameter and Description: Object.
Attribute
Type
Default value
Required
Description
src
string
-
Yes
Image address, only http(s), base64, temp files are supported, with a size limit of 5MB
nowrap
boolean
false
No
Whether to automatically line feed after inserting a picture, default line feed
alt
string
-
No
Alternative text when images cannot be displayed, with a size limit of 5MB
width
string
-
No
Image width (pixels/percentage)
height
string
-
No
Image height (pixels/percentage)
extClass
string
-
No
Class name added to the image img tag, with a size limit of 5MB
data
Object
-
No
data is serialized as name=value;name1=value2 and hooked to the attribute data-custom.
success
function
-
No
Callback Function of Successful Interface Call
fail
function
-
No
Callback Function of Failing Interface Call
complete
function
-
No
Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations)
Sample code
this.editorCtx.insertImage({
src: 'xx',
width: '100px',
height: '50px',
extClass: className
})

.insertText

This method is used via EditorContext.insertText(Object object).
Feature Description: Overwrites the current selected area, setting a segment of text.
Parameter and Description: Object.
Attribute
Type
Default value
Required
Description
text
string
-
No
Text Content, with a size limit of 5MB
success
function
-
No
Callback Function of Successful Interface Call
fail
function
-
No
Callback Function of Failing Interface Call
complete
function
-
No
Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations)

.redo

This method is used via EditorContext.redo(Object object).
Feature Description: Restoration.
Parameter and Description: Object.
Attribute
Type
Default value
Required
Description
success
function
-
No
Callback Function of Successful Interface Call
fail
function
-
No
Callback Function of Failing Interface Call
complete
function
-
No
Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations)

.removeFormat

This method is used via EditorContext.removeFormat(Object object).
Feature Description: Clears the style of the current selected area.
Parameter and Description: Object.
Attribute
Type
Default value
Required
Description
success
function
-
No
Callback Function of Successful Interface Call
fail
function
-
No
Callback Function of Failing Interface Call
complete
function
-
No
Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations)

.scrolllntoView

This method is used via EditorContext.scrollIntoView().
Feature Description: Enables the editor cursor to scroll within the visible area of the window.

.setContents

This method is used via EditorContext.setContents(Object object).
Feature Description: Initializes the editor content. When both html and delta exist, only delta takes effect.
Parameter and Description: Object.
Attribute
Type
Default value
Required
Description
html
string
-
No
HTML content with tags, with a size limit of 5MB
delta
Object
-
No
A delta object representing the content
success
function
-
No
Callback Function of Successful Interface Call
fail
function
-
No
Callback Function of Failing Interface Call
complete
function
-
No
Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations)

.undo

This method is used via EditorContext.undo(Object object).
Feature Description: Undo.
Parameter and Description: Object.
Attribute
Type
Default value
Required
Description
success
function
-
No
Callback Function of Successful Interface Call
fail
function
-
No
Callback Function of Failing Interface Call
complete
function
-
No
Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations)

Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback