无法在 textAngular 中调整图像大小
Can't resize image in textAngular
我正在 Textangular 中实现一个自定义图像上传器,使用 Dropbox Chooser upload/retrieve 来自 Dropbox 的图像。它有效,图像插入到文本中,但我无法调整它的大小。
通常情况下,如果您将鼠标悬停在图片上,您会看到一个类似弹出菜单的菜单,其中包含用于调整图片大小的选项。这没有发生。
代码应该很简单,但我找不到问题所在。
// 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;
}]);
有什么想法吗?
我修好了。
所以查看原始 code 我们可以看到在 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){
我正在 Textangular 中实现一个自定义图像上传器,使用 Dropbox Chooser upload/retrieve 来自 Dropbox 的图像。它有效,图像插入到文本中,但我无法调整它的大小。
通常情况下,如果您将鼠标悬停在图片上,您会看到一个类似弹出菜单的菜单,其中包含用于调整图片大小的选项。这没有发生。
代码应该很简单,但我找不到问题所在。
// 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;
}]);
有什么想法吗?
我修好了。
所以查看原始 code 我们可以看到在 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){