0

I'm implementing a custom image uploader iin Textangular that upload/retrieve images from Dropbox using the Dropbox Chooser. It works, and the image is inserted into the text, but I cannot resize it.

Normally if you hover on images than you'll see a pop-up like menu with options to resize the image. This is not happening.

The code should be pretty simple, but I cannot find where the issues is.

// custom button in textAngular
$provide.decorator('taOptions', ['taRegisterTool', '$delegate', function(taRegisterTool, taOptions){                
    var that;
    // options for the dropbox choser
    var options = {
        // Required. Called when a user selects an item in the Chooser.
        success: function(files) {
            that.$editor().wrapSelection('insertImage', files[0].link);
        },
        linkType: "direct", // or "direct"      
        extensions: ['images'],
    };
    taRegisterTool('DropboxChooser', {
        iconclass: "fa fa-picture-o",
        action: function(){
            // makes the editor available outside
            that = this;
            // launches the dropbox chooser
            Dropbox.choose(options);                
        }
    });
    // add the button to the default toolbar definition
    taOptions.toolbar[1].push('DropboxChooser');
    return taOptions;
}]);

Any idea?

Daniel Beck
  • 20,653
  • 5
  • 38
  • 53
segolas.zoso
  • 317
  • 1
  • 3
  • 10

1 Answers1

1

I fixed it.

so looking at the original code we can see that in the insertImage snippet we have the following:

taRegisterTool('insertImage', {
        iconclass: 'fa fa-picture-o',
        tooltiptext: taTranslations.insertImage.tooltip,
        action: function(){
            //bla bla bla );
            }
        }, // here comes the interesting part
        onElementSelect: {
            element: 'img',
            action: taToolFunctions.imgOnSelectAction
        }
    });

so what we have to do is import taToolFunctions and we can do the same:

$provide.decorator('taOptions', ['taRegisterTool', 'taToolFunctions', '$delegate', function(taRegisterTool, taToolFunctions, taOptions){
segolas.zoso
  • 317
  • 1
  • 3
  • 10