Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integrate Ckeditor into Property View (#199)
* enhancement (property view): integrate ckeditor into property view * refactor (viewer): handle XML validation in text value as XML comp. * tests (viewer): adapt tests since XML values are editable now * feature (viewer): convert CKEditor XML to Knora XML on validation * feature (viewer): convert CKEditor XML to Knora XML on validation * feature (viewer): convert CKEditor XML to Knora XML on validation * feature (viewer): move xml conversion in comp. * feature (viewer): treat XML text values as read-only values if the do not use the standard mapping * feature (viewer): different read-modes for XML text values depending on mapping * tests (viewer): add test cases for ReadTextValueAsXML with different mappings * tests (viewer): add test cases for ReadTextValueAsXML with different mappings * fix (add-value): add xml value directive to add value template * refactor (viewer): adapt message * css (xml value): override default margin for paragraphs Co-authored-by: Tobias Schweizer <t.schweizer@unibas.ch> Co-authored-by: Tobias Schweizer <tobiasschweizer@users.noreply.github.com>
- Loading branch information
1 parent
29f259d
commit 2835864
Showing
14 changed files
with
221 additions
and
172 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 29 additions & 17 deletions
46
...sp-ui/src/lib/viewer/values/text-value/text-value-as-xml/text-value-as-xml.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,30 @@ | ||
<div *ngIf="editor; else noConfig" [formGroup]="form"> | ||
<ckeditor formControlName="xmlValue" [config]="editorConfig" [editor]="editor"></ckeditor> | ||
<mat-form-field class="large-field value-component-comment"> | ||
<textarea matInput | ||
cdkTextareaAutosize | ||
cdkAutosizeMinRows="1" | ||
cdkAutosizeMaxRows="6" | ||
[formControlName]="'comment'" | ||
class="comment" | ||
placeholder="Comment" | ||
type="text" | ||
spellcheck="false"> | ||
</textarea> | ||
</mat-form-field> | ||
</div> | ||
<ng-template #noConfig> | ||
No mapping or apt configuration was provided for "xmlTransform" in the app's configuration object. | ||
<span *ngIf="mode === 'read'; else showForm" class="read-mode-view"> | ||
<div *ngIf="this.displayValue?.mapping === standardMapping; else sourceMode" class="rm-value" [innerHTML]="valueFormControl.value"></div> | ||
<ng-template #sourceMode> | ||
<span class="rm-value">{{displayValue?.xml}}</span> | ||
</ng-template> | ||
<span class="rm-comment" *ngIf="shouldShowComment">{{commentFormControl.value}}</span> | ||
</span> | ||
<ng-template #showForm> | ||
<div *ngIf="editor; else noConfig" [formGroup]="form"> | ||
<span [formGroup]="form"> | ||
<ckeditor [formControlName]="'xmlValue'" [config]="editorConfig" [editor]="editor"></ckeditor> | ||
<mat-form-field class="large-field value-component-comment"> | ||
<textarea matInput | ||
cdkTextareaAutosize | ||
cdkAutosizeMinRows="1" | ||
cdkAutosizeMaxRows="6" | ||
[formControlName]="'comment'" | ||
class="comment" | ||
placeholder="Comment" | ||
type="text" | ||
spellcheck="false"> | ||
</textarea> | ||
</mat-form-field> | ||
</span> | ||
</div> | ||
<ng-template #noConfig> | ||
No class was provided for CKEditor. | ||
</ng-template> | ||
</ng-template> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,9 @@ | |
::ng-deep .ck-content code { | ||
font-family: monospace; | ||
} | ||
|
||
.rm-value { | ||
::ng-deep p { | ||
margin: 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.