Browse Source

Content item fix.

pull/431/head
Sebastian Stehle 6 years ago
parent
commit
cb964b02cf
  1. 2
      src/Squidex/app/features/content/shared/array-editor.component.html
  2. 4
      src/Squidex/app/features/content/shared/array-editor.component.ts
  3. 2
      src/Squidex/app/features/content/shared/array-item.component.html
  4. 4
      src/Squidex/app/features/content/shared/array-item.component.ts
  5. 14
      src/Squidex/app/features/schemas/pages/schema/field.component.scss
  6. 2
      src/Squidex/app/shared/components/rich-editor.component.html
  7. 4
      src/Squidex/app/shared/components/rich-editor.component.ts
  8. 2
      src/Squidex/app/shared/state/contents.state.ts

2
src/Squidex/app/features/content/shared/array-editor.component.html

@ -3,7 +3,7 @@
[cdkDropListDisabled]="false"
[cdkDropListData]="arrayControl.controls"
(cdkDropListDropped)="sort($event)">
<div *ngFor="let itemForm of arrayControl.controls; let i = index"
<div *ngFor="let itemForm of arrayControl.controls; let i = index; trackBy:trackByControl"
class="table-drag item"
cdkDrag
cdkDragLockAxis="y">

4
src/Squidex/app/features/content/shared/array-editor.component.ts

@ -84,4 +84,8 @@ export class ArrayEditorComponent {
this.arrayControl.setControl(i, controls[i]);
}
}
public trackByControl(index: number, control: AbstractControl) {
return control;
}
}

2
src/Squidex/app/features/content/shared/array-item.component.html

@ -43,7 +43,7 @@
</div>
<div class="card-body" [class.hidden]="isHidden">
<div class="form-group" *ngFor="let fieldControl of fieldControls">
<div class="form-group" *ngFor="let fieldControl of fieldControls; trackBy: trackByField">
<sqx-field-editor
[form]="form"
[formContext]="formContext"

4
src/Squidex/app/features/content/shared/array-item.component.ts

@ -173,4 +173,8 @@ export class ArrayItemComponent implements OnChanges, OnDestroy {
public emitMoveBottom() {
this.move.emit(99999);
}
public trackByField(index: number, control: FieldControl) {
return control.field.name;
}
}

14
src/Squidex/app/features/schemas/pages/schema/field.component.scss

@ -38,10 +38,6 @@ $padding: 1rem;
}
}
.field {
position: relative;
}
.nested-fields {
padding: $padding;
padding-left: 2 * $padding;
@ -57,7 +53,7 @@ $padding: 1rem;
}
&-add {
border: 1px dashed $field-line;
border: 2px dashed $field-line;
position: relative;
padding: 1rem;
}
@ -65,19 +61,23 @@ $padding: 1rem;
&-line-v {
@include absolute($padding, auto, 3 * $padding + .25rem, $padding);
border: 0;
border-left: 1px dashed $field-line;
border-left: 2px dashed $field-line;
width: 2px;
}
&-line-h {
@include absolute(-2px, auto, 50%, -$padding);
border: 0;
border-bottom: 1px dashed $field-line;
border-bottom: 2px dashed $field-line;
width: $padding - .25rem;
}
}
.field {
& {
position: relative;
}
&-icon {
margin-right: 1rem;
color: $color-border-dark;

2
src/Squidex/app/shared/components/rich-editor.component.html

@ -1,5 +1,5 @@
<div class="drop-container" (sqxDropFile)="insertFiles($event)" [onlyImages]="true">
<div class="editor" #editor>Loading editor...</div>
<div class="editor" #editor></div>
</div>
<ng-container *sqxModal="assetsDialog">

4
src/Squidex/app/shared/components/rich-editor.component.ts

@ -66,7 +66,7 @@ export class RichEditorComponent extends StatefulControlComponent<undefined, str
public ngOnDestroy() {
clearTimeout(this.tinyInitTimer);
if (tinymce && this.editor) {
if (this.tinyEditor) {
tinymce.remove(this.editor);
}
}
@ -74,7 +74,7 @@ export class RichEditorComponent extends StatefulControlComponent<undefined, str
public ngAfterViewInit() {
const self = this;
this.resourceLoader.loadScript('https://cdnjs.cloudflare.com/ajax/libs/tinymce/4.9.3/tinymce.min.js').then(() => {
this.resourceLoader.loadScript('https://cdnjs.cloudflare.com/ajax/libs/tinymce/4.9.4/tinymce.min.js').then(() => {
tinymce.init(self.getEditorOptions());
});
}

2
src/Squidex/app/shared/state/contents.state.ts

@ -56,7 +56,7 @@ interface Snapshot {
}
function sameContent(lhs: ContentDto, rhs?: ContentDto): boolean {
return lhs === rhs || (!!lhs && !!rhs && lhs.id === rhs.id && lhs.version === rhs.version);
return lhs === rhs || (!!lhs && !!rhs && lhs.id === rhs.id && lhs.version.eq(lhs.version));
}
export abstract class ContentsStateBase extends State<Snapshot> {

Loading…
Cancel
Save