Results 1 to 4 of 4

Thread: Initial value for HtmlEditor contains an unwanted character

  1. #1

    Default Initial value for HtmlEditor contains an unwanted character

    Initial value for HtmlEditor contains an unwanted character named 'ZERO WIDTH SPACE'.
    Sample code tested on FireFox and Chrome
    Code:
    import com.extjs.gxt.ui.client.event.ComponentEvent;
    import com.extjs.gxt.ui.client.event.SelectionListener;
    import com.extjs.gxt.ui.client.widget.Info;
    import com.extjs.gxt.ui.client.widget.TabItem;
    import com.extjs.gxt.ui.client.widget.TabPanel;
    import com.extjs.gxt.ui.client.widget.Viewport;
    import com.extjs.gxt.ui.client.widget.button.Button;
    import com.extjs.gxt.ui.client.widget.form.HtmlEditor;
    import com.extjs.gxt.ui.client.widget.layout.FitLayout;
    import com.google.gwt.core.client.EntryPoint;
    import com.google.gwt.user.client.ui.RootPanel;
    
    public class TestHtmlEditor implements EntryPoint {
    
    	@Override
    	public void onModuleLoad() {
    		
    		Viewport viewport = new Viewport();
    		viewport.setLayout(new FitLayout());
    		viewport.add(createGUI());
    		RootPanel.get().add(viewport);
    
    	}
    	
    	private TabPanel createGUI() {
    		TabPanel tabPanel = new TabPanel();
    	    
    		
    		tabPanel.add(createPage());
    		return tabPanel;
    	}
    
    	private TabItem createPage() {
    		TabItem page = new TabItem();
    		page.setText("Page with HTML Editor");
    		final HtmlEditor editor = new HtmlEditor();
            page.add(editor);
    		Button btn = new Button("Get value");
    		btn.addSelectionListener(new SelectionListener() {
    			@Override
    			public void componentSelected(ComponentEvent ce) {
    				String text = editor.getValue();
    				char c = text.charAt(text.length()-1);
    				int i = (int)c;
    				if(i == 8203) {
    					Info.display("Bug ?", "Last char in text contains ZERO WIDTH SPACE");
    				}
    			}
    			
    		});
            page.add(btn);
    		return page;
    	}
    	
    }

  2. #2
    Sencha Premium Member
    Join Date
    Sep 2007
    Posts
    13,976

    Default

    This is not a bug. This was needed so that htmleditor shows the cursor when you initially click into it.

  3. #3
    Sencha Premium Member
    Join Date
    Sep 2007
    Posts
    13,976

    Default

    In the meantime this got fixed within GWT directly http://groups.google.com/group/googl...4cb9b8f5745146

    This was only fixed in GWT 2.0.X we cannot remove it yet.

    If you use GWT 2.0.X you can add

    editor.setValue("");

    to your code.

  4. #4

    Default

    Thanks for your quick answer

Similar Threads

  1. Simple HtmlEditor character counter plugin
    By FKilloran in forum Ext 2.x: User Extensions and Plugins
    Replies: 6
    Last Post: 17 May 2012, 1:50 AM
  2. HtmlEditor contains unwanted character
    By bartolomiew in forum Ext 2.x: Bugs
    Replies: 0
    Last Post: 30 Sep 2010, 11:49 PM
  3. gxt2.1.0: gxt-all.css contains unwanted # character
    By dfitzhenry in forum Sencha GXT Q&A
    Replies: 0
    Last Post: 1 Dec 2009, 4:39 PM
  4. regarding to add character count function in htmleditor
    By aomadevelopers in forum Sencha Ext JS Q&A
    Replies: 3
    Last Post: 7 Oct 2009, 9:30 PM
  5. HtmlEditor initial enabling help
    By MoShAn480 in forum Ext 1.x: Help & Discussion
    Replies: 5
    Last Post: 4 Jan 2008, 8:48 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •