1. #1
    Sencha User
    Join Date
    Jul 2011
    Location
    France
    Posts
    13
    Vote Rating
    0
    skha is on a distinguished road

      0  

    Question Problem - Add upload file button to an html Editor

    Problem - Add upload file button to an html Editor


    Hello every one,
    As explained in the title, i want to add the possibility to upload images in a directory and add the html code of my image in the text.
    I trie this example but the button is not visible.
    Code:
    Ext.onReady(function (){
        Ext.ns('Ext.ux.form.HtmlEditor');
    
        var w = new Ext.Window({
            width: 860,
            layout: 'fit',
            items: [
                    {  
                    fieldLabel: 'Description',  
                    name: 'description',  
                    value: 'bwah bwah',  
                    anchor: '100%',  
                    id:'monHtmlEditor',
                    xtype: "htmleditor",  
                    height: 400,  
                    listeners:{
                        afterrender:function(){                        
                            this.getToolbar().addItem(
                                [
                                    {
                                        xtype: 'form',
                                        id: 'monForm',
                                        url: 'php/webServiceProjet.php?upload=1',
                                        border: false,
                                        fileUpload: true,
                                        items:[
                                            {
                                                xtype: 'fileuploadfield',
                                                id: 'monFileUpload',
                                                name: 'monFileUpload',
                                                buttonOnly: true,
                                                hideLabel: true,
                                                buttonText: '',
                                                tooltip: 'monFileUpload',
                                                buttonCfg: {
                                                    iconCls: 'bo'
                                                }
                                                
                                                /*
                                                    xtype: 'button',
                                                    iconCls: 'bo', //your iconCls here
                                                    handler: function(){
                                                        alert('eee');
                                                        //this.cmp.insertAtCursor('<hr>');
                                                    },
                                                    scope: this,
                                                    tooltip: 'horizontal ruler',
                                                    overflowText: 'horizontal ruler'
                                                */
                                            }                                        
                                        ]
                                    }
                                ]    
                            )
                        }
                    } 
                }            
            ]
        });    
        w.show();    
    });
    i think i can't add a form in my toolbar.

    is there a solution to upload images via the htmlEditor?

    Thank you in advance for your replies.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,577
    Vote Rating
    814
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    You can add your own tool to the editor.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Jul 2011
    Location
    France
    Posts
    13
    Vote Rating
    0
    skha is on a distinguished road

      0  

    Default


    Thank you for your replay.
    could you please give me an axample?
    i added a button this way:
    Code:
    this.cmp.getToolbar().addButton([{
                iconCls: 'bo', 
                handler: function(){
                    this.cmp.insertAtCursor('<img src="./img/test.png');
                },
                scope: this,
                tooltip: 'horizontal ruler',
                overflowText: 'horizontal ruler'
            }]);
    I can add an image to my text, but what i want is to display a pop-up to select a document.

    thank you again.