简体   繁体   English

如何通过TinyMCE对话框提交活动的tabPanel?

[英]How can I get the active tabPanel on submit with TinyMCE dialogs?

I am testing out TinyMCE multi-tab dialogs using the documentation here: https://www.tiny.cloud/docs/ui-components/dialog/ . 我正在使用以下文档来测试TinyMCE多选项卡对话框: https : //www.tiny.cloud/docs/ui-components/dialog/ I can switch between tabs just fine, and submit from any of the tabs, but is there a way to get the active tab at the time of submit? 我可以在各个标签之间切换,也可以从任何一个标签中提交,但是有没有一种方法可以在提交时获取活动标签?

I am able to access the data from the active tab on submit, but nothing in the documentation shows how to detect what tab was open when the form was submitted (unless I missed something). 我可以从提交时的活动选项卡访问数据,但是文档中没有任何内容显示如何检测提交表单时打开的选项卡(除非我错过了什么)。 Link to working fiddle: https://jsfiddle.net/byoung2/05ntx1ro/3/ 链接到工作提琴: https : //jsfiddle.net/byoung2/05ntx1ro/3/

onSubmit: function(api) {
  var data = api.getData();
  //Can I access the active tab here?

  tinymce.activeEditor.execCommand('mceInsertContent', false, `
                <span itemscope itemtype="https://schema.org/Organization"><a itemprop="url" href="${ data.url }"><strong itemprop="name">${ data.name }</strong></a></p>
  `);
  api.close();
}

Is there a method I can use in the submit handler that will tell me the name of the tab that was submitted? 我可以在提交处理程序中使用一种方法来告诉我所提交的标签页的名称吗?

Not the cleanest way, but this works 不是最干净的方法,但这可行

onTabChange: (dialogApi, details) => {
  currentTab = details.newTabName;
  console.log('changed',details.newTabName)
}

I'll just watch this and set a variable 我会看这个并设置一个变量

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM