YUI Library Examples: Rich Text Editor (beta): Editor inside a Tabview Control

Rich Text Editor (beta): Editor inside a Tabview Control

This example demonstrates how to render an Editor inside of a TabView Control.

Setting up the HTML

First we will begin by adding a simple div to the page with the id of e_tabs.

Setting up the TabView Javascript

Next we need to create the TabView control.

Now let's add some tabs

Now that we have created the Tabview control, we can add some tabs.

Note that we are saving a reference to the tab containing the Editor's textarea in the variable called editorTab

Rendering the Editor

Now that we have a place for the Editor to live, we can now render it.

Handling the switching of tabs

This is the important part of this example. The Rich Text Editor will not behave properly if it is rendered or toggled in a container that has been set to display none.

This behaviour can be fixed by calling the Editor method show. The show method will attempt to fix the Editor when it is in this state.

So, we will add an Event listener to the Tabview's activeTabChange event and call the Editor's show method when we change to the Editor's tab.

Full Example Javascript Source

Copyright © 2008 Yahoo! Inc. All rights reserved.

Privacy Policy - Terms of Service - Copyright Policy - Job Openings