javascript - 更新 TinyMce 模板插件
问题描述
我正在尝试通过单击按钮来过滤模板,我有三个模板列表,我希望每个按钮都在模板中显示这些列表之一。
我的尝试:
self.wysiwygConfig = {
plugins: ['... template ...'],
toolbar: '... | template | spellchecker | buttonA buttonB buttonC',
setup: function (editor) {
editor.ui.registry.addButton('buttonA', {
text: 'A',
onAction: function () {
//filter the list
//doesn't work
self.wysiwygConfig.templates = [];
//also this doean't work
UserFilterTemplates = [];
//open the modal
$('.tox-tbtn[title="Insert template"]').trigger("click");
}
});
/* same for buttonB && buttonC */
},
templates: UserFilterTemplates.map(item => ({ title: item.Title, description: item.Description, content: item.Template }))
};
有没有办法过滤或重新初始化模板?
解决方案
推荐阅读
- python - 如何在 Python 中创建一个类范围的可操作变量?
- javascript - 如何清空移位的堆栈?
- python - 如何将连续变量转换为分类变量?
- swift - 将多张图片作为附件发送
- ffmpeg - 如何使用 stunnel 配置 nginx 以接受不同 FB Live Streams 的参数或使用 FFMPEG 的 rtmps
- java - 在正则表达式中允许电子邮件之间的空格
- reactjs - 使用 Apache2 路由 React 页面的问题
- r - 如何根据两个变量的频率为时间演化生成可理解的可视化图
- bash - bash:在活动窗口标题中显示简单的正弦动画
- azure-active-directory - Azure AD 混合联接和本地 MFA 服务器的问题