TextAngular 不分配文本对齐
TextAngular not assigning text-alignment
我正在为我正在构建的网站使用 TextAngular,到目前为止它运行良好,除了两件事。
text-align: center
无效。
text-align: right
无效。
现在,我发现了几个与此类似的问题,但没有一个与我的完全匹配。我发现了这个 https://github.com/fraywing/textAngular/issues/46 but it is for the buttons not even showing up. My buttons show up, they just don't work the way they are supposed to. I also found this https://github.com/fraywing/textAngular/issues/82 并且它更接近正在发生的事情,但仍然不完全是。
让我详细介绍一下是怎么回事。
我有两个textAngular输入框,它们都使用同一个工具栏,这个工具栏显示了所有可用的选项。当我输入其中一个输入字段时,它会复制到第二个输入字段(最多 150 个字符,这是一个摘要),所有样式按钮都起作用,例如 h1-p 按钮、粗体、下划线,报价甚至工作。当我使用文本对齐按钮时,它 似乎 起作用,在输入字段中它会像它应该的那样向右或居中对齐。然而,在上传到服务器后,它并没有保留样式,起初我以为它像上面提到的链接之一那样剥离了样式,但是,样式甚至没有 that远。
工具栏中的一个选项是查看裸 html,因此如果将所有 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('/');
});
}
};
}]);
我很确定这就是所需的全部逻辑,如果您需要更多代码,请告诉我。
但是,是的,有什么想法吗?
所以它与问题中的一个链接是同一个问题,它正在剥离样式,因为我没有使用 textAngular-sanitize.js,这是我的问题的几乎完全相同的副本由文本的创建者回答-angular。 https://github.com/fraywing/textAngular/issues/210
我正在为我正在构建的网站使用 TextAngular,到目前为止它运行良好,除了两件事。
text-align: center
无效。text-align: right
无效。
现在,我发现了几个与此类似的问题,但没有一个与我的完全匹配。我发现了这个 https://github.com/fraywing/textAngular/issues/46 but it is for the buttons not even showing up. My buttons show up, they just don't work the way they are supposed to. I also found this https://github.com/fraywing/textAngular/issues/82 并且它更接近正在发生的事情,但仍然不完全是。
让我详细介绍一下是怎么回事。
我有两个textAngular输入框,它们都使用同一个工具栏,这个工具栏显示了所有可用的选项。当我输入其中一个输入字段时,它会复制到第二个输入字段(最多 150 个字符,这是一个摘要),所有样式按钮都起作用,例如 h1-p 按钮、粗体、下划线,报价甚至工作。当我使用文本对齐按钮时,它 似乎 起作用,在输入字段中它会像它应该的那样向右或居中对齐。然而,在上传到服务器后,它并没有保留样式,起初我以为它像上面提到的链接之一那样剥离了样式,但是,样式甚至没有 that远。
工具栏中的一个选项是查看裸 html,因此如果将所有 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('/');
});
}
};
}]);
我很确定这就是所需的全部逻辑,如果您需要更多代码,请告诉我。 但是,是的,有什么想法吗?
所以它与问题中的一个链接是同一个问题,它正在剥离样式,因为我没有使用 textAngular-sanitize.js,这是我的问题的几乎完全相同的副本由文本的创建者回答-angular。 https://github.com/fraywing/textAngular/issues/210