0

Dropbox Chooser を使用して Dropbox から画像をアップロード/取得するカスタム画像アップローダ iin Textangular を実装しています。機能し、画像がテキストに挿入されますが、サイズを変更できません。

通常、画像にカーソルを合わせると、ポップアップのようなメニューが表示され、画像のサイズを変更するオプションが表示されます。これは起こっていません。

コードは非常に単純なはずですが、どこに問題があるのか​​ わかりません。

// 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;
}]);

何か案が?

4

1 に答える 1

1

それを私が直した。

元のコードを見ると、insertImage スニペットには次のように記述されていることがわかります。

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
        }
    });

そのため、必要なことは、taToolFunctions をインポートすることであり、同じことができます。

$provide.decorator('taOptions', ['taRegisterTool', 'taToolFunctions', '$delegate', function(taRegisterTool, taToolFunctions, taOptions){
于 2016-05-25T13:28:33.127 に答える