我使用TextAngular的一个网站,我正在建设,到目前为止,它是伟大的工作,除了两件事。
text-align: center不起作用。text-align: right Doest不工作。现在,我发现了几个类似的问题,但没有完全符合我的。我找到了这个https://github.com/fraywing/textAngular/issues/46,但它的按钮甚至没有出现。我的纽扣出现了,只是它们的工作方式不正常。我还找到了这个https://github.com/fraywing/textAngular/issues/82,它更接近正在发生的事情,但仍然不完全是这样。
让我详细介绍一下正在发生的事情。
我有两个textAngular输入框,它们都使用相同的工具栏,这个工具栏显示所有可用的选项。当我输入一个输入字段时,它将复制到第二个输入字段(最多150个字符,这是一个摘要),所有的样式按钮都可以工作,如h1-p按钮、粗体工作、下划线工作、引号甚至工作。当我使用文本对齐按钮时,它似乎可以工作,在输入字段中,它会像它应该的那样对齐到右边或中心。然而,在上传到服务器时,它没有保留样式,一开始我以为它正在剥离样式,就像上面提到的其中一个链接所提到的那样,但是样式化甚至没有达到那么远。
工具栏中的一个选项是查看裸露的html,因此if将生成所有的p标记以及未出现的内容。当按下这个按钮时,它会显示除了文本对齐以外的所有内容。这是进一步证实了我的第二个输入字段与我的第一个字段不对齐,所以如果我使用文本对齐右按钮,它将似乎工作在第一个输入框,但不会做在第二个框。
这是我写的表格:
<form name="form-post" ng-submit="save()">
<div>
<input placeholder="Title" class="margin-bottom" name="title" ng-model="post.title">
</div>
<p>Cover Image</p>
<input type="file" name="photo" accept="image/*" file-upload file=photo>
<p>Maximum file size is 1MB.</p>
<text-angular-toolbar name="toolbar"></text-angular-toolbar>
<text-angular placeholder="Blog content" name="body" ng-model="post.body" ta-target-toolbars='toolbar' mdp-post></text-angular>
<text-angular placeholder="Blog Summary" ta-target-toolbars='toolbar' class="margin-bottom margin-top" name="truncBody" ng-model="post.truncBody" mdp-post style="min-height: 30px"></text-angular>
</br>
<button type="submit" class="button-pink">Post</button>
<button class="button-pink" ui-sref="base.blog">Cancel</button>
</form>和我的控制器
app.controller('postBlogCtrl', ['$scope', '$location', 'Messages', 'blogFactory',
function($scope, $location, Messages, blogFactory) {
$scope.post = {};
$scope.post.body = "";
$scope.date = new Date();
$scope.save = function() {
var post = new FormData();
post.append("title", $scope.post.title);
post.append("photo", $scope.photo);
post.append("body", $scope.post.body);
post.append("truncBody", $scope.post.truncBody);
var thingsLeft= [];
function pushIf(array) {
for (var i = 1; i < arguments.length; i += 2)
if (arguments[i]) array.push(arguments[i + 1]);
}
pushIf(thingsLeft,
!$scope.post.title, " Title",
!$scope.photo, " Cover Image",
!$scope.post.body, " Body",
!$scope.post.truncBody, " Summary"
);
if(thingsLeft.length > 0){
Messages.error("Please fill out all fields. Fields left:" + thingsLeft);
return;
}else{
blogFactory.postBlog()
.post(post, {}, {'Content-Type': undefined}).then(function(response) {
$location.path('/');
});
}
};
}]);我很确定这就是所有需要的逻辑,如果你需要更多的代码,请告诉我。但有什么主意吗?
发布于 2015-01-06 19:30:53
这个问题和问题中的一个链接是一样的,因为我没有使用textAngulal-saniize.js,这是我的问题的一个几乎完全重复的问题,文本角的创建者已经回答了这个问题。https://github.com/fraywing/textAngular/issues/210
https://stackoverflow.com/questions/27805407
复制相似问题