动态生成的Word preSS所见即所得的编辑器(wp_editor)显示不正常不正常、编辑器、所见即所得、动态

2023-09-11 01:01:52 作者:释然

我有一个词preSS管理页面上2 HTML所见即所得的编辑器。两者都使用WP_EDITOR()函数。第一个是硬codeD插入页面:

I have 2 html wysiwyg editors on a wordpress admin page. Both use WP_EDITOR() function. The first one is hard coded into the page:

<form name="form1" id="form1" method="post" action="" style="display:block;">
  <p>
    <!-- editor here -->
    <?php
       wp_editor( 'CONTENT WILL APPEAR HERE!', 'addsometxt', array('textarea_name'=>'create_txt','textarea_rows'=>10,'wpautop'=>false));
    ?>
  </p>
  <p>
   <input name="save" type="submit" class="button-primary" id="save" style="margin:5px;" value="Save Input" /></p>
</form>

第二个是动态地使用AJAX调用(wp_ajax_和$。员额)PHP函数生成的。我已经测试Ajax调用,并知道它的工作原理;因此,为简单起见,这里的PHP函数:

The second one is generated dynamically with a PHP function using an AJAX call (wp_ajax_ and $.post). I've test the ajax call and know it works; so, for brevity, here's the php function:

<?php
function display_editor2() {
// grab data from database (data_from_db) and display in editor
  wp_editor( $row->data_from_db, 'editsometxt', array('textarea_name'=>'edit_txt','textarea_rows'=>10,'wpautop'=>false));

} 
?>

的问题是,即使第二编辑器显示;它丢失了所有的工具栏按钮。请参阅下面的插图图像。任何人都知道谁解决这一问题?

The problem is that even though the 2nd editor is displaying; it's missing all the tool bar buttons. See image below for illustration. Anyone know who to fix this?

推荐答案

我有同样的问题。

当我添加了code &LT; PHP wp_footer(); ?&GT; 在我的footer.php,它的工作原理

When I add the code <?php wp_footer(); ?> in my footer.php, it works.