1

At the moment there are two tabs in the post editor Visual and HTML.

Is there a hook that allows for another tab to be added?

If so, what is it?

Additional info:

So, let's say the content of the post is an address.

The additional tab will contain the form for the person to fill in. When the post is updated, the person's answers will be stored as the post content. (pre-formatted with a template created by me)

4

2 回答 2

2

不,没有钩子可以做到这一点。但请注意,这两个选项卡(HTML 和 Visual)的处理方式与 TinyMce 的其余按钮(可以通过选项设置)不同。视觉和 HTML 选项卡甚至可以放置在编辑器旁边,并使用 JavaScript 控制以在编辑器上产生相同的效果(将其视图从 HTML 切换到文本,反之亦然)。

于 2012-12-11T00:30:30.957 回答
0

这是 HTML 和 Visual 控件控制编辑器视图的方式:

            $('a.toggleVisual').click(
                function() {
                    tinyMCE.execCommand('mceAddControl', false, id);
                }
            );

            $('a.toggleHTML').click(
                function() {
                    tinyMCE.execCommand('mceRemoveControl', false, id);
                }
            );

        });

您会看到,这两个视图之间的区别基本上只是添加或删除控件以保留原始 HTML 视图或对其进行转换。但是您可以在旁边添加一个按钮。这是我自己用来显示标签的代码:

 <p align="right"><a class="button toggleVisual">Visual</a><a class="button toggleHTML">HTML</a></p><textarea rows="10" class="foo" id="editorid" name="editorname" style="width:100%%;">Text area content</textarea>

所以你可以像这样添加另一个标签:

<p align="right"><a class="button toggleTemplate">Your Template Tab</a><a class="button toggleVisual">Visual</a><a class="button toggleHTML">HTML</a></p><textarea rows="10" class="foo" id="editorid" name="editorname" style="width:100%%;">Text area content</textarea>

然后绑定到click事件以显示另一个视图,由您自己的例程生成...

于 2012-12-11T02:31:47.483 回答