导航菜单
首页 >  <img> HTML  > EditorContext.insertImage(Object object)

EditorContext.insertImage(Object object)

# EditorContext.insertImage(Object object)

Start from base library version 2.7.0. Please remaining backward compatible.

with Promise style call: Not supported

Mini Program plugin: Support

Insert picture.

When the address is a temporary file, the contents of the editor html format obtained in the <img> Tag Add Properties data-local,delta Pictures in Format Content attributes Attribute increase data-local Field, which is the temporary file address that was passed in.

The developer can choose to upload the image to the server during the submission phase, obtain the network address and replace it. Replace the html content with the <img> of src Value, for the delta Content should be replaced insert { image: abc } Value.

# parameter # Object object attribute type Default values Required Introductions src string yes Image address, support only http(s), base64, cloud pictures(2.8.0), provisional documents(2.8.3)。 old string no Alternate text when the image cannot be displayed width string no Image width (pixels/Percentage) height string no Picture height (pixels/Percentage) extClass string no Add to the picture img Class name on tag data Object no data Is serialized to be name=valuename1=value2 The format of the hanging property data-custom on success function no Interface calls the successful callback function fail function no Interface calls failed callback functions complete function no Callback function at the end of an interface call (both successful and unsuccessful calls are executed)# sample code this.editorCtx.insertImage({ src: 'xx', width: '100px', height: '50px', extClass: className})

相关推荐: