jitword 协同文档3.2发布:打造浏览器中最强word编辑器

体验地址:https://jitword.com
Github:https://github.com/jitOffice/jitword-sdk










// 在 /core/extensions/ 下创建组件export const MyCustomNode = Node.create({name: 'myCustomNode',addOptions() {return {name: 'myCustomNode',desc: '我的自定义组件',slash: true,command: ({ editor, range }) => {// 插入组件的逻辑editor.chain().focus().insertContent({type: 'myCustomNode',attrs: { data: '{}' }}).run();}};},addAttributes() {return {data: {default: '{}',parseHTML: element => element.getAttribute('data-config'),renderHTML: attributes => ({'data-config': attributes.data})}};},addNodeView() {return ({ node, HTMLAttributes, getPos, editor }) => {// 创建 DOM 元素const dom = document.createElement('div');dom.className = 'my-custom-component';// 渲染组件内容this.renderComponent(dom, node.attrs.data);return {dom,update: (updatedNode) => {if (updatedNode.attrs.data !== node.attrs.data) {this.renderComponent(dom, updatedNode.attrs.data);}return true;},destroy: () => {// 清理资源}};};}});
后续我们还会持续迭代,未来的3个月,我们架构师团队会继续打造更智能化,自动化的文档 OS,同时满足更多文档编辑的使用场景。
体验地址:https://jitword.com
Github:https://github.com/jitOffice/jitword-sdk
夜雨聆风