Socket
Socket
Sign inDemoInstall

@gaoding/editor-sdk

Package Overview
Dependencies
Maintainers
22
Versions
92
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gaoding/editor-sdk

稿定编辑器对外 SDK


Version published
Weekly downloads
7
decreased by-22.22%
Maintainers
22
Weekly downloads
 
Created
Source

editor-sdk

稿定编辑器对外 SDK

安装

npm i @gaoding/editor-sdk
# or
yarn add @gaoding/editor-sdk

npm 使用方式

import { GdEditorSdk } from '@gaoding/editor-sdk';

const sdk = new GdEditorSdk({
    onUpload(blob) {
        // 直接展示
        const url = window.URL.createObjectURL(blob);
        const img = document.createElement('img');
        img.src = url;
        document.body.append(img);

        // 上传的例子
        const form = new FormData();
        form.append('file', blob, 'gaoding.jpg');
        axios.post('url', form, { headers: { 'Content-Type': 'multipart/form-data' } })
            .then(res => {
                alert('上传成功');
            })
            .catch(error => {
                alert(error.message);
            })
    }
})

sdk.open({ filter: 'xinmeiti' });

API

interface IConfig {
    /**
     *
     * 编辑器下载,或选择预览图时触发
     * @param {Blob} blob
     * @returns {*}
     * @memberof IConfig
     */
    onUpload(blob: Blob): any;
    /**
     * 自定义iFrame样式
     *
     * @type {{[k: string]: string}}
     * @memberof IConfig
     */
    style?: {
        [k: string]: string;
    };
}
export declare class GdEditorSdk {
    constructor(config: IConfig);
    /**
     * 打开iframe 弹窗
     *
     * @param {{ filter: string }} options
     * @param options.filter 筛选项
     * @memberof GdEditorSdk
     */
    open(options: {
        filter: string;
        ext: {
            [k: string]: string;
        };
    }): void;
    /**
     * 关闭弹窗
     *
     * @memberof GdEditorSdk
     */
    close(): void;
}

FAQs

Package last updated on 26 Dec 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc