Browse Source

Fixed content creation.

pull/380/head
Sebastian Stehle 7 years ago
parent
commit
5d13d0e97a
  1. 2
      src/Squidex/Areas/Api/Controllers/Contents/ContentsController.cs
  2. 9
      src/Squidex/Areas/Api/Controllers/Contents/Models/ContentDto.cs
  3. 10
      src/Squidex/app/framework/angular/forms/tag-editor.component.ts

2
src/Squidex/Areas/Api/Controllers/Contents/ContentsController.cs

@ -442,7 +442,7 @@ namespace Squidex.Areas.Api.Controllers.Contents
var context = await CommandBus.PublishAsync(command);
var result = context.Result<IEnrichedContentEntity>();
var response = ContentDto.FromContent(null, result, this);
var response = ContentDto.FromContent(Context, result, this);
return response;
}

9
src/Squidex/Areas/Api/Controllers/Contents/Models/ContentDto.cs

@ -153,11 +153,14 @@ namespace Squidex.Areas.Api.Controllers.Contents.Models
AddDeleteLink("delete", controller.Url<ContentsController>(x => nameof(x.DeleteContent), values));
}
foreach (var next in content.Nexts)
if (content.Nexts != null)
{
if (controller.HasPermission(Helper.StatusPermission(app, schema, next.Status)))
foreach (var next in content.Nexts)
{
AddPutLink($"status/{next.Status}", controller.Url<ContentsController>(x => nameof(x.PutContentStatus), values), next.Color);
if (controller.HasPermission(Helper.StatusPermission(app, schema, next.Status)))
{
AddPutLink($"status/{next.Status}", controller.Url<ContentsController>(x => nameof(x.PutContentStatus), values), next.Color);
}
}
}

10
src/Squidex/app/framework/angular/forms/tag-editor.component.ts

@ -221,6 +221,10 @@ export class TagEditorComponent extends StatefulControlComponent<State, any[]> i
return;
}
if (!this.inputElement.nativeElement) {
return;
}
if (!canvas) {
canvas = document.createElement('canvas');
}
@ -231,13 +235,13 @@ export class TagEditorComponent extends StatefulControlComponent<State, any[]> i
if (ctx) {
ctx.font = CACHED_FONT;
const text = this.inputElement.nativeElement.value;
const textKey = `${text}§${this.placeholder}§${ctx.font}`;
const textValue = this.inputElement.nativeElement.value;
const textKey = `${textValue}§${this.placeholder}§${ctx.font}`;
let width = CACHED_SIZES[textKey];
if (!width) {
const widthText = ctx.measureText(text).width;
const widthText = ctx.measureText(textValue).width;
const widthPlaceholder = ctx.measureText(this.placeholder).width;
width = Math.max(widthText, widthPlaceholder);

Loading…
Cancel
Save