import Vnmf from '../../index'
declare module '../../index' {
/** `EditorContext` Example,Through `Vnmf.createSelectorQuery` Fetch。
* `EditorContext` Through `id` With one. `editor` Component binding,Operation corresponds to `editor` Component。
* @supported weapp
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.html
*/
interface EditorContext {
/** The editor has lost focus.,And close the keyboard at same time.。
* @supported weapp
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.blur.html
*/
blur(option?: EditorContext.BlurOption): void
/** Empty Editor Contents
* @supported weapp
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.clear.html
*/
clear(option?: EditorContext.ClearOption): void
/** Modify Styles
*
* ****
*
* ## List of styles to support settings
* | 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 |
*
* Constituency Settings for already applied styles cancel。css style Organisation css Permissible values specified。
* @supported weapp
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.format.html
*/
format(
/** Properties */
name: string,
/** Value */
value?: string,
): void
/** Fetch Editor Contents
* @supported weapp
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.getContents.html
*/
getContents(option?: EditorContext.GetContentsOption): void
/** Get plain text content from the selected area of editor。When the editor loses focus or does not select a segment,Return content to empty。
* @supported weapp
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.getSelectionText.html
*/
getSelectionText(option?: EditorContext.getSelectionText.Option): void
/** Inserting Partition Lines
* @supported weapp
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.insertDivider.html
*/
insertDivider(option?: EditorContext.InsertDividerOption): void
/** Insert Picture。
*
* When the address is a temporary file,Fetched EditorhtmlFormatting Contents `
` Tab Add Properties data-local,delta Pictures in Formatting Contents attributes Properties Add data-local Fields,This value is an incoming temporary file address。
*
* Developer can choose to upload pictures the server at submission stage,Replace with web address when you get it。Replace withhtmlThe content should be replaced. `
` It's... it's... src Value,Yeah. delta The content should be replaced. `insert { image: abc }` Value。
* @supported weapp
* @example
* ```tsx
* this.editorCtx.insertImage({
* src: 'xx',
* width: '100px',
* height: '50px',
* extClass: className
* })
* ```
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.insertImage.html
*/
insertImage(option: EditorContext.InsertImageOption): void
/** Overwrite the current selection,Set a text
* @supported weapp
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.insertText.html
*/
insertText(option: EditorContext.InsertTextOption): void
/** Restore
* @supported weapp
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.redo.html
*/
redo(option?: EditorContext.RedoOption): void
/** Clear the style of current selection
* @supported weapp
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.removeFormat.html
*/
removeFormat(option?: EditorContext.RemoveFormatOption): void
/** Enables the editor cursor to scroll window view area。
* @supported weapp
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.scrollIntoView.html
*/
scrollIntoView(): void
/** Initialize Editor Contents,htmlanddelta♪ And when there's only onedeltaEntry into force
* @supported weapp
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.setContents.html
*/
setContents(option: EditorContext.SetContentsOption): void
/** Undo
* @supported weapp
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.undo.html
*/
undo(option?: EditorContext.UndoOption): void
}
namespace EditorContext {
interface BlurOption {
/** Interface call to the end of echo function(Call successfully、Any failure will be enforced.) */
complete?: (res: VnmfGeneral.CallbackResult) => void
/** Interface call failed echo function */
fail?: (res: VnmfGeneral.CallbackResult) => void
/** Interface calls a successful echo function */
success?: (res: VnmfGeneral.CallbackResult) => void
}
interface ClearOption {
/** Interface call to the end of echo function(Call successfully、Any failure will be enforced.) */
complete?: (res: VnmfGeneral.CallbackResult) => void
/** Interface call failed echo function */
fail?: (res: VnmfGeneral.CallbackResult) => void
/** Interface calls a successful echo function */
success?: (res: VnmfGeneral.CallbackResult) => void
}
interface GetContentsOption {
/** Interface call to the end of echo function(Call successfully、Any failure will be enforced.) */
complete?: (res: VnmfGeneral.CallbackResult) => void
/** Interface call failed echo function */
fail?: (res: VnmfGeneral.CallbackResult) => void
/** Interface calls a successful echo function */
success?: (res: VnmfGeneral.CallbackResult) => void
}
namespace getSelectionText {
interface Option {
/** Interface call to the end of echo function(Call successfully、Any failure will be enforced.) */
complete?: (res: VnmfGeneral.CallbackResult) => void
/** Interface call failed echo function */
fail?: (res: VnmfGeneral.CallbackResult) => void
/** Interface calls a successful echo function */
success?: (res: SuccessCallbackResult) => void
}
interface SuccessCallbackResult extends VnmfGeneral.CallbackResult {
/** Pure Text Contents */
text: string
}
}
interface InsertDividerOption {
/** Interface call to the end of echo function(Call successfully、Any failure will be enforced.) */
complete?: (res: VnmfGeneral.CallbackResult) => void
/** Interface call failed echo function */
fail?: (res: VnmfGeneral.CallbackResult) => void
/** Interface calls a successful echo function */
success?: (res: VnmfGeneral.CallbackResult) => void
}
interface InsertImageOption {
/** Picture Address,Support only http(s)、base64、Cloud Pictures(2.8.0)、Provisional Document(2.8.3)。 */
src: string
/** Alternative text when the image cannot be displayed */
alt?: string
/** Interface call to the end of echo function(Call successfully、Any failure will be enforced.) */
complete?: (res: VnmfGeneral.CallbackResult) => void
/** data Sequenced To name=value;name1=value2 Formatting Properties data-custom Let's go. */
data?: VnmfGeneral.IAnyObject
/** Add to Picture img Classname on Tab */
extClass?: string
/** Interface call failed echo function */
fail?: (res: VnmfGeneral.CallbackResult) => void
/** Picture height (pixels/Percentage) */
height?: string
/** Interface calls a successful echo function */
success?: (res: VnmfGeneral.CallbackResult) => void
/** Picture Width(pixels/Percentage) */
width?: string
}
interface InsertTextOption {
/** Interface call to the end of echo function(Call successfully、Any failure will be enforced.) */
complete?: (res: VnmfGeneral.CallbackResult) => void
/** Interface call failed echo function */
fail?: (res: VnmfGeneral.CallbackResult) => void
/** Interface calls a successful echo function */
success?: (res: VnmfGeneral.CallbackResult) => void
/** Text Contents */
text?: string
}
interface RedoOption {
/** Interface call to the end of echo function(Call successfully、Any failure will be enforced.) */
complete?: (res: VnmfGeneral.CallbackResult) => void
/** Interface call failed echo function */
fail?: (res: VnmfGeneral.CallbackResult) => void
/** Interface calls a successful echo function */
success?: (res: VnmfGeneral.CallbackResult) => void
}
interface RemoveFormatOption {
/** Interface call to the end of echo function(Call successfully、Any failure will be enforced.) */
complete?: (res: VnmfGeneral.CallbackResult) => void
/** Interface call failed echo function */
fail?: (res: VnmfGeneral.CallbackResult) => void
/** Interface calls a successful echo function */
success?: (res: VnmfGeneral.CallbackResult) => void
}
interface SetContentsOption {
/** Interface call to the end of echo function(Call successfully、Any failure will be enforced.) */
complete?: (res: VnmfGeneral.CallbackResult) => void
/** _Other OrganiserdeltaObject */
delta?: VnmfGeneral.IAnyObject
/** Interface call failed echo function */
fail?: (res: VnmfGeneral.CallbackResult) => void
/** LabeledHTMLContents */
html?: string
/** Interface calls a successful echo function */
success?: (res: VnmfGeneral.CallbackResult) => void
}
interface UndoOption {
/** Interface call to the end of echo function(Call successfully、Any failure will be enforced.) */
complete?: (res: VnmfGeneral.CallbackResult) => void
/** Interface call failed echo function */
fail?: (res: VnmfGeneral.CallbackResult) => void
/** Interface calls a successful echo function */
success?: (res: VnmfGeneral.CallbackResult) => void
}
}
}