Skip to content

ddnlink/ddn-hub-editor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DDN Hub Editor

这是 amis-editor-demo 的克隆版本,并针对 DDN Hub 进行了简单优化。原始的样式,你可以访问:https://aisuda.github.io/amis-editor-demo/demo-6.11.0/index.html

本地运行这个项目

  1. npm i 安装依赖
  2. npm run dev 等编译完成后本地打开页面看效果。

在 React 项目中直接使用 amis-editor

npm i amis-editor

使用 方法

import {Editor} from 'amis-editor';


render() {
  return (
    <Editor
      {...props}
    />
  )
}

属性说明:

  • value: any 值,amis 的 json 配置。
  • onChange: (value: any) => void。 当编辑器修改的时候会触发。
  • preview?: boolean 是否为预览状态。
  • autoFocus?: boolean 是否自动聚焦第一个可编辑的组件。
  • plugins 插件类集合

这里重点修改的是

  1. 重构 Editor.tsx ,将 id 参数扩展到 uuid , 接收地址仍然是 http://domwin.com/editor/index.html#/editor/:id

  2. 修改编译配置,直接打包构建,就能将代码放入 ddn-hub 项目中(具体是 public 文件夹)。

注意:确保目标程序,在调用之前,就能将 schema 保存到 uuid 为键的 localStorege 中。

amis-editor-demo 简介

感谢 amis-editor-demo,详细的开发文档,请参考: ./docs/development-guide.md

amis 可视化编辑器, 在线体验:https://aisuda.github.io/amis-editor-demo

About

Amis Editor for DDN Hub

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 8