TinyMCE从iframe体内添加div [英] TinyMCE add div around in the body from the iframe

查看:74
本文介绍了TinyMCE从iframe体内添加div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用TinyMCE.文本区域创建了小型编辑器.然后,微小代码创建iframe,在该iframe中是编辑器.这样正常吗!

I use the TinyMCE. The textarea create the tiny-editor. And the tiny-code create the iframe and in this iframe is the editor. So is it normal!

但是现在我希望在iframe主体中的编辑器周围有一个div.是否可以解决我的问题?

But now I want a div around the editor, in the body of the iframe. Is there an option to solve my problem?

在此处输入图片描述

推荐答案

我试图做点事情

tinymce.init({
  selector: "#mytextarea",
  tinymce options: ... ,

  toolbar: "add_div",

  setup: function(editor) {

    editor.ui.registry.addButton("add_div", {
    text: "Add Div",
    icon: "plus", // look editor-icon-identifiers page
      onAction: function() {
        var element = tinymce.activeEditor.dom.select("#tinymce");
        var content = element[0].innerHTML;
        element[0].innerHTML = "<div>"+content+"</div>";
      }
    }); // close registry.addButton

  }, // close setup function

}); // close tinymce.init

这篇关于TinyMCE从iframe体内添加div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆