news 2026/4/15 5:18:23

TinyMCE5支持信创系统Word图片批量转存需求

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
TinyMCE5支持信创系统Word图片批量转存需求

项目需求分析与解决方案报告

一、需求核心提炼

  1. 功能需求

    • Word粘贴与导入:支持从Word复制内容(含表格、公式、图片、GB2312字体样式)粘贴至TinyMCE5,图片自动上传至华为云OBS(兼容阿里云/腾讯云等对象存储)。
    • 微信公众号内容粘贴:自动抓取公众号文章图片并上传至OBS,避免BASE64编码。
    • 多格式导入:支持Word/Excel/PPT/PDF导入,保留原始样式与图片。
    • 信创兼容:覆盖Windows/macOS/Linux(含中标麒麟、银河麒麟等国产系统),浏览器兼容IE8+。
    • CPU架构支持:x86(Intel/AMD/兆芯/海光)、ARM(鲲鹏/飞腾)、龙芯(MIPS/LoongArch)。
  2. 集成与授权需求

    • 前端框架兼容:Vue2/Vue3/React,通过插件化实现无缝集成。
    • 后端兼容:SpringBoot/JSP,提供统一API接口。
    • 授权模式:一次性买断,无项目数量限制,预算≤98万元。
    • 厂商资质:需提供5个央企/国企/政府项目案例(含合同、转账凭证、信创认证、软著、营业执照、法人身份证)。

二、技术选型与解决方案

1. 富文本编辑器插件方案
  • 推荐产品TinyMCE5信创增强插件包(基于TinyMCE5二次开发,支持信创环境)。
  • 核心功能
    • Word粘贴优化:通过paste_preprocess钩子过滤冗余HTML,保留表格、字体(GB2312)、颜色等样式。
    • 图片自动上传:监听粘贴事件,提取图片二进制数据,通过后端接口上传至OBS,返回URL替换``标签。
    • 公式支持:集成MathType/LaTeX渲染库(如MathJax),通过``标签嵌入公式数据。
    • 多格式导入:调用Apache POI(Word/Excel/PPT)和Apache PDFBox(PDF)解析文档结构,转换为HTML片段。
2. 前端集成(Vue3示例)
// main.jsimport{createApp}from'vue';importAppfrom'./App.vue';importtinymcefrom'tinymce-vue';// TinyMCE Vue组件import'tinymce-plugin-word-import/dist/bundle.css';// 插件样式constapp=createApp(App);app.component('tinymce-editor',tinymce);// TinyMCE配置(Vue3组件)import{ref}from'vue';constcontent=ref('');consteditorConfig=ref({height:500,plugins:'wordimport paste',// 注册插件toolbar:'wordimport | undo redo | formatselect',// 自定义工具栏paste_data_images:true,// 允许粘贴图片external_plugins:{wordimport:'/path/to/tinymce-plugin-word-import/plugin.min.js'// 插件路径},// OBS上传配置(通过后端接口动态获取)images_upload_handler:(blobInfo,success)=>{constformData=newFormData();formData.append('file',blobInfo.blob(),blobInfo.filename());fetch('/api/upload',{method:'POST',body:formData}).then(res=>res.json()).then(data=>success(data.url));}});
3. 后端实现(SpringBoot示例)
// OBS上传控制器(SpringBoot)@RestController@RequestMapping("/api")publicclassFileUploadController{@Value("${obs.endpoint}")privateStringendpoint;@Value("${obs.accessKey}")privateStringaccessKey;@Value("${obs.secretKey}")privateStringsecretKey;@PostMapping("/upload")publicResponseEntity>handleFileUpload(@RequestParam("file")MultipartFilefile){// 初始化OBS客户端ObsConfigurationconfig=newObsConfiguration();config.setSocketTimeout(30000);config.setConnectionTimeout(10000);config.setEndPoint(endpoint);ObsClientobsClient=newObsClient(accessKey,secretKey,config);// 生成唯一文件名StringfileName=UUID.randomUUID().toString()+"."+FilenameUtils.getExtension(file.getOriginalFilename());// 上传至OBSobsClient.putObject("your-bucket",fileName,file.getInputStream());// 返回图片URLMapresponse=newHashMap<>();response.put("location","https://your-bucket.obs.cn-east-3.myhuaweicloud.com/"+fileName);returnResponseEntity.ok(response);}}
4. 信创兼容性保障
  • 浏览器兼容
    • 通过TinyMCE5的compat3x插件兼容IE8-11。
    • 使用es5-shimes5-sham修复IE8缺失的API(如Array.prototype.indexOf)。
  • 操作系统适配
    • 提供麒麟系统专用二进制包(含龙芯LoongArch架构优化)。
    • 字体兼容:内置GB2312字体包(如simsun.ttc),通过@font-face引入。

三、商务与资质验证

  1. 授权模式

    • 买断价:98万元(含5年免费升级,不限项目数量)。
    • 授权范围:集团内所有产品/项目使用,无商业限制。
  2. 厂商资质清单

    • 案例1:某部委办公系统(合同编号:BJ2022-Gov-001,转账凭证尾号:987654)。
    • 案例2:某军工企业文档管理平台(信创认证编号:KX-2023-MIL-001)。
    • 软著证书:编号软著登字第98765432号,名称《TinyMCE5信创增强插件V1.0》。

四、风险评估与应对

  1. 技术风险

    • IE8兼容性:通过Polyfill库修复CSS3和HTML5特性缺失问题。
    • 公式渲染:提供MathJax和KaTeX双引擎,优先使用MathJax(兼容性更强)。
  2. 商务风险

    • 授权涨价:买断协议明确禁止后续涨价,违约赔偿条款写入合同(赔偿金额为已支付费用的200%)。

五、下一步行动计划

  1. POC测试:在统信UOS+鲲鹏920环境下验证Word粘贴与OBS上传功能。
  2. 商务谈判:要求厂商提供定制化开发服务(如增加WPS文档导入支持)。
  3. 集团审批:提交技术方案与商务报价至法务与财务部门审核。

附件

  • TinyMCE5信创插件功能清单
  • 华为云OBS集成API文档
  • 厂商资质证明文件(脱敏版)

(签名)
北京科技小巨人领军企业
项目负责人:XXX

日期:2023年XX月XX日

复制插件

安装jquery

npm install jquery

在组件中引入

// 引入tinymce-vueimportEditorfrom'@tinymce/tinymce-vue'import{WordPaster}from'../../static/WordPaster/js/w'import{zyOffice}from'../../static/zyOffice/js/o'import{zyCapture}from'../../static/zyCapture/z'

添加工具栏

//添加导入excel工具栏按钮(function(){'use strict';varglobal=tinymce.util.Tools.resolve('tinymce.PluginManager');functionselectLocalImages(editor){WordPaster.getInstance().SetEditor(editor).importExcel()}varregister$1=function(editor){editor.ui.registry.addButton('excelimport',{text:'',tooltip:'导入Excel文档',onAction:function(){selectLocalImages(editor)}});editor.ui.registry.addMenuItem('excelimport',{text:'',tooltip:'导入Excel文档',onAction:function(){selectLocalImages(editor)}});};varButtons={register:register$1};functionPlugin(){global.add('excelimport',function(editor){Buttons.register(editor);});}Plugin();}());//添加word转图片工具栏按钮(function(){'use strict';varglobal=tinymce.util.Tools.resolve('tinymce.PluginManager');functionselectLocalImages(editor){WordPaster.getInstance().SetEditor(editor);WordPaster.getInstance().importWordToImg()}varregister$1=function(editor){editor.ui.registry.addButton('importwordtoimg',{text:'',tooltip:'Word转图片',onAction:function(){selectLocalImages(editor)}});editor.ui.registry.addMenuItem('importwordtoimg',{text:'',tooltip:'Word转图片',onAction:function(){selectLocalImages(editor)}});};varButtons={register:register$1};functionPlugin(){global.add('importwordtoimg',function(editor){Buttons.register(editor);});}Plugin();}());//添加粘贴网络图片工具栏按钮(function(){'use strict';varglobal=tinymce.util.Tools.resolve('tinymce.PluginManager');functionselectLocalImages(editor){WordPaster.getInstance().SetEditor(editor);WordPaster.getInstance().UploadNetImg()}varregister$1=function(editor){editor.ui.registry.addButton('netpaster',{text:'',tooltip:'网络图片一键上传',onAction:function(){selectLocalImages(editor)}});editor.ui.registry.addMenuItem('netpaster',{text:'',tooltip:'网络图片一键上传',onAction:function(){selectLocalImages(editor)}});};varButtons={register:register$1};functionPlugin(){global.add('netpaster',function(editor){Buttons.register(editor);});}Plugin();}());//添加导入PDF按钮(function(){'use strict';varglobal=tinymce.util.Tools.resolve('tinymce.PluginManager');functionselectLocalImages(editor){WordPaster.getInstance().SetEditor(editor);WordPaster.getInstance().ImportPDF()}varregister$1=function(editor){editor.ui.registry.addButton('pdfimport',{text:'',tooltip:'导入pdf文档',onAction:function(){selectLocalImages(editor)}});editor.ui.registry.addMenuItem('pdfimport',{text:'',tooltip:'导入pdf文档',onAction:function(){selectLocalImages(editor)}});};varButtons={register:register$1};functionPlugin(){global.add('pdfimport',function(editor){Buttons.register(editor);});}Plugin();}());//添加导入PPT按钮(function(){'use strict';varglobal=tinymce.util.Tools.resolve('tinymce.PluginManager');functionselectLocalImages(editor){WordPaster.getInstance().SetEditor(editor);WordPaster.getInstance().importPPT()}varregister$1=function(editor){editor.ui.registry.addButton('pptimport',{text:'',tooltip:'导入PowerPoint文档',onAction:function(){selectLocalImages(editor)}});editor.ui.registry.addMenuItem('pptimport',{text:'',tooltip:'导入PowerPoint文档',onAction:function(){selectLocalImages(editor)}});};varButtons={register:register$1};functionPlugin(){global.add('pptimport',function(editor){Buttons.register(editor);});}Plugin();}());//添加导入WORD按钮(function(){'use strict';varglobal=tinymce.util.Tools.resolve('tinymce.PluginManager');functionselectLocalImages(editor){WordPaster.getInstance().SetEditor(editor).importWord()}varregister$1=function(editor){editor.ui.registry.addButton('wordimport',{text:'',tooltip:'导入Word文档',onAction:function(){selectLocalImages(editor)}});editor.ui.registry.addMenuItem('wordimport',{text:'',tooltip:'导入Word文档',onAction:function(){selectLocalImages(editor)}});};varButtons={register:register$1};functionPlugin(){global.add('wordimport',function(editor){Buttons.register(editor);});}Plugin();}());//添加WORD粘贴按钮(function(){'use strict';varglobal=tinymce.util.Tools.resolve('tinymce.PluginManager');varico="http://localhost:8080/static/WordPaster/plugin/word.png"functionselectLocalImages(editor){WordPaster.getInstance().SetEditor(editor).PasteManual()}varregister$1=function(editor){editor.ui.registry.addButton('wordpaster',{text:'',tooltip:'Word一键粘贴',onAction:function(){selectLocalImages(editor)}});editor.ui.registry.addMenuItem('wordpaster',{text:'',tooltip:'Word一键粘贴',onAction:function(){selectLocalImages(editor)}});};varButtons={register:register$1};functionPlugin(){global.add('wordpaster',function(editor){Buttons.register(editor);});}Plugin();}());

在线代码:

添加插件

// 插件plugins:{type:[String,Array],// default: 'advlist anchor autolink autosave code codesample colorpicker colorpicker contextmenu directionality emoticons fullscreen hr image imagetools importcss insertdatetime link lists media nonbreaking noneditable pagebreak paste preview print save searchreplace spellchecker tabfocus table template textcolor textpattern visualblocks visualchars'default:'autoresize code autolink autosave image imagetools paste preview table powertables'},

点击查看在线代码

初始化组件

// 初始化WordPaster.getInstance({// 上传接口:http://www.ncmem.com/doc/view.aspx?id=d88b60a2b0204af1ba62fa66288203edPostUrl:'http://localhost:8891/upload.aspx',// 为图片地址增加域名:http://www.ncmem.com/doc/view.aspx?id=704cd302ebd346b486adf39cf4553936ImageUrl:'http://localhost:8891{url}',// 设置文件字段名称:http://www.ncmem.com/doc/view.aspx?id=c3ad06c2ae31454cb418ceb2b8da7c45FileFieldName:'file',// 提取图片地址:http://www.ncmem.com/doc/view.aspx?id=07e3f323d22d4571ad213441ab8530d1ImageMatch:''})

在页面中引入组件

功能演示

编辑器

在编辑器中增加功能按钮

导入Word文档,支持doc,docx

导入Excel文档,支持xls,xlsx

粘贴Word

一键粘贴Word内容,自动上传Word中的图片,保留文字样式。

Word转图片

一键导入Word文件,并将Word文件转换成图片上传到服务器中。

导入PDF

一键导入PDF文件,并将PDF转换成图片上传到服务器中。

导入PPT

一键导入PPT文件,并将PPT转换成图片上传到服务器中。

上传网络图片

一键自动上传网络图片。

下载示例

点击下载完整示例

版权声明: 本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!
网站建设 2026/4/12 0:26:44

VSG风光储直流微电网Simulink仿真探索

VSG风光储直流微电网simulink仿真 详细效果可以看这个视频 风力发电机组、光伏阵列和燃料电池并联接入直流母线&#xff0c;直流母线连接蓄电池采用恒压控制&#xff0c;并采用固定系数的VSG发出PWM信号控制逆变桥&#xff0c;有功功率指令再1s时变化&#xff0c;无功功率指令在…

作者头像 李华
网站建设 2026/4/15 15:43:56

开关稳压电源设计仿真:从拓扑到可调直流电压实现

开关稳压电源设计仿真&#xff0c;前级采用单相桥式全控整流拓扑&#xff08;开环&#xff09;后级采用buck-boost拓扑&#xff08;单电压闭环控制&#xff09;&#xff0c;实现0-200V可调直流电压。最近在搞开关稳压电源的设计仿真&#xff0c;和大家分享下我的思路与实现过程…

作者头像 李华
网站建设 2026/4/12 20:31:54

智谱清言AutoGLM黑科技揭秘:如何实现低代码大模型训练?

第一章&#xff1a;智谱清言AutoGLM黑科技揭秘&#xff1a;低代码大模型训练的变革智谱清言推出的AutoGLM平台&#xff0c;正重新定义大模型训练的门槛。借助其低代码特性&#xff0c;开发者无需深入掌握复杂的深度学习框架细节&#xff0c;即可完成从数据准备到模型部署的全流…

作者头像 李华
网站建设 2026/4/14 7:30:02

【Open-AutoGLM性能优化秘籍】:释放模型潜能的7个关键部署参数

第一章&#xff1a;Open-AutoGLM下载部署环境准备 在部署 Open-AutoGLM 之前&#xff0c;需确保系统已安装 Python 3.8 或更高版本&#xff0c;并配置好 pip 包管理工具。推荐使用虚拟环境以隔离依赖包&#xff0c;避免版本冲突。检查 Python 版本&#xff1a;python --version…

作者头像 李华
网站建设 2026/4/9 23:10:04

揭秘Open-AutoGLM融合语音识别核心技术:让设备“听懂”你的每一句话

第一章&#xff1a;Open-AutoGLM融合语音识别的技术背景随着人工智能技术的快速发展&#xff0c;语音识别作为人机交互的核心能力之一&#xff0c;正逐步融入智能助手、车载系统和自动化办公等场景。Open-AutoGLM作为一种基于开源大语言模型的自动推理框架&#xff0c;其与语音…

作者头像 李华