Five-great / tinymce-plugins

This is tinymce plugins
249 stars 81 forks source link

importWord 样式丢失 #27

Closed zyyv closed 2 years ago

zyyv commented 2 years ago

导入word文档,样式丢失。该如何设置呢

Air-37 commented 2 years ago

你好,可以请教下importword插件具体怎么在项目中使用嘛

zyyv commented 2 years ago

你好,可以请教下importword插件具体怎么在项目中使用嘛

npm i @npkg/tinymce-plugins -D 然后

...
require('tinymce/plugins/xxx')
// 引入这个
require('@npkg/tinymce-plugins/importword')

然后 toolbar --> 添加 importword

应该就可以了,如果你的文档中有图片,你还可以自定义上传方法,上传到自己的云上面。 但是我感觉最大的问题是,样式丢失很麻烦

Five-great commented 2 years ago

样式丢失 暂时 纯前端没办法 , 想尽可能保证样式不丢失 只能文件传去后端 处理了返回html

zyyv commented 2 years ago

谢谢你的回复。目前我暂时也没解决问题,但干掉了提出问题的人。

Five-great commented 2 years ago

可以的 有个转换不错 (https://aconvert.com)保留了大部分样式, 我尝试对接API ,但也需要后台代理去做 就是有点过于慢 一般都会对文章进行重新排版 主要保留dom 结构 基本是ok 的 ,当然最好后端自己服务器转换, 速度可控