UNPKG

dldiscuss

Version:

#### 介绍 {**以下是 Gitee 平台说明,您可以替换此简介** Gitee 是 OSCHINA 推出的基于 Git 的代码托管平台(同时支持 SVN)。专为开发者提供稳定、高效、安全的云端软件开发协作平台 无论是个人、团队、或是企业,都能够用 Gitee 实现代码托管、项目管理、协作开发。企业项目请看 [https://gitee.com/enterprises](https://gitee.com/enterprises)}

63 lines (60 loc) 1.78 kB
tinymce.PluginManager.add('reference', function (editor, url) { // var openDialog = function () { // return editor.windowManager.open({ // title: '这里是弹窗标题', // body: { // type: 'panel', // items: [ // { // type: 'input', // name: 'title', // label: 'Title' // } // ] // }, // buttons: [ // { // type: 'cancel', // text: 'Close' // }, // { // type: 'submit', // text: 'Save', // primary: true // } // ], // onSubmit: function (api) { // var data = api.getData(); // // 将输入框内容插入到内容区光标位置 // editor.insertContent('插入的文字是: ' + data.title); // api.close(); // } // }); // }; // 注册一个工具栏按钮名称 editor.ui.registry.addButton('reference', { text: '引用', onAction: function () { editor.insertContent("<button id='' style='background:#409EFF;'>请选择引用数据</button>"); // openDialog(); } }); // 注册一个菜单项名称 menu/menubar editor.ui.registry.addMenuItem('reference', { text: '引用', onAction: function () { const now = new Date().getTime() editor.insertContent(`<button id='${now}' class='data-button' contenteditable='false'>请选择引用数据</button>`); // openDialog(); } }); return { getMetadata: function () { return { //插件名和链接会显示在“帮助”→“插件”→“已安装的插件”中 name: "reference plugin",//插件名称 url: "http://referenceplugindocsurl.com", //作者网址 }; } }; });