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

稿定编辑器 SDK 接入说明

稿定编辑器 SDK 是对稿定能力的封装,以实现对设计服务的无缝对接,目前支持以下服务:

  • 平面编辑器
  • 图片编辑器
  • TODO: H5编辑器
  • TODO: 打通用户登录, 请联系定制

NPM 包参见:@gaoding/editor-sdk

平面编辑器

  1. 海量创意模板快速生成
  2. 支持指定数十种主流模板场景类目 (https://gaoding.com/templates)

图片编辑器

  • 1. 图片剪裁功能
  • 2. 图片增强、图片滤镜效果
  • 3. 图片添加水印、添加相框、添加文字
  • 4. 海量创意素材(文字、贴纸、边框、水印...)
  • 5. 马赛克、涂鸦

在接入前,要做什么?

请先与我们联系(邮箱:bd@gaoding.com), 我们需要合作方提供企业以及接入域名等信息, 以便我们安排专人接待,为合作方预设一些关键数据,如: APPID模板类目ID

对接与调试

如合作方已经依本文档的定义实现了接口,我们需要合作方提供接入的域名信息,并记录到稿定的系统中,然后,由专人负责与合作方对接调试

安装

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

npm 使用方式

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

const gdEditorSDK = new GdEditorSdk({
    // 区分编辑器类型 (图片编辑器、平面编辑器、H5编辑器)
    appId: '由SDK方提供',
    // onUpload 执行后,是否自动关闭弹窗,默认为 true
    autoClose: true,
    // 完成按钮文案默认“完成”
    buttonText: '完成',
    
    // 完成编辑器下载时触发
    onCompleted({ blob, workId, sourceId }) {
        // 直接展示
        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);
            })
    },
    // 自定义iFrame样式
    style: {}
});

// 打开弹窗
gdEditorSDK.open({
    ext: {
        // 指定海报模板类目(图片、简历、GIF、LOGO、海报、表情头像、文章配图、适配封面。。。)
        // ps: 使用场景为平面编辑器, 分类 ID 由 SDK方提供
        third_cate_id: '',
        // 指定编辑器底图
        // ps: 使用场景为图片编辑器,需开放 CORS 跨域能力
        image: 'https://st-gdx.dancf.com/materials/115030/shots/20190830-155521-WWU47.png'
    }
});
// 关闭弹窗
gdEditorSDK.close();

FAQs

Package last updated on 19 Mar 2020

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