Commit 733699b1 authored by rhenck's avatar rhenck
Browse files

Fix some things

parent fb5bd9cc
......@@ -20,16 +20,16 @@
"@angular/router": "~13.3.0",
"@ngx-translate/core": "^13.0.0",
"@ngx-translate/http-loader": "^6.0.0",
"@tiptap/core": "^2.0.0-beta.163",
"@tiptap/core": "^2.0.0-beta.175",
"@tiptap/extension-blockquote": "^2.0.0-beta.26",
"@tiptap/extension-bubble-menu": "^2.0.0-beta.54",
"@tiptap/extension-bubble-menu": "^2.0.0-beta.56",
"@tiptap/extension-bullet-list": "^2.0.0-beta.26",
"@tiptap/extension-color": "^2.0.0-beta.9",
"@tiptap/extension-floating-menu": "^2.0.0-beta.49",
"@tiptap/extension-floating-menu": "^2.0.0-beta.51",
"@tiptap/extension-font-family": "^2.0.0-beta.21",
"@tiptap/extension-heading": "^2.0.0-beta.25",
"@tiptap/extension-highlight": "^2.0.0-beta.32",
"@tiptap/extension-image": "^2.0.0-beta.24",
"@tiptap/extension-heading": "^2.0.0-beta.26",
"@tiptap/extension-highlight": "^2.0.0-beta.33",
"@tiptap/extension-image": "^2.0.0-beta.27",
"@tiptap/extension-list-item": "^2.0.0-beta.20",
"@tiptap/extension-ordered-list": "^2.0.0-beta.27",
"@tiptap/extension-paragraph": "^2.0.0-beta.23",
......@@ -38,8 +38,8 @@
"@tiptap/extension-superscript": "^2.0.0-beta.10",
"@tiptap/extension-text-align": "^2.0.0-beta.29",
"@tiptap/extension-text-style": "^2.0.0-beta.23",
"@tiptap/extension-underline": "^2.0.0-beta.22",
"@tiptap/starter-kit": "2.0.0-beta.171",
"@tiptap/extension-underline": "^2.0.0-beta.23",
"@tiptap/starter-kit": "2.0.0-beta.184",
"ngx-tiptap": "^3.0.4",
"prosemirror-state": "^1.3.4",
"rxjs": "~6.6.7",
......@@ -2752,9 +2752,9 @@
}
},
"node_modules/@tiptap/core": {
"version": "2.0.0-beta.174",
"resolved": "https://registry.npmjs.org/@tiptap/core/-/core-2.0.0-beta.174.tgz",
"integrity": "sha512-APQDto40PdvagG1HTwkKlieQS4Vp6GXNe7qgV1Qo2QCgJCLyxc/fXCTghtrOx0CQb+9JT7fjSLZxbSyUFXjx7Q==",
"version": "2.0.0-beta.175",
"resolved": "https://registry.npmjs.org/@tiptap/core/-/core-2.0.0-beta.175.tgz",
"integrity": "sha512-dDf+2GtifskNLysn49kaCIz0o5hf6VDZ8J7jSQAfoPDEkEkfw9OKhWrR7NzWW6J34CSJreFDRiWkGt8Qz283Vg==",
"dependencies": {
"@types/prosemirror-commands": "^1.0.4",
"@types/prosemirror-keymap": "^1.0.4",
......@@ -2801,9 +2801,9 @@
}
},
"node_modules/@tiptap/extension-bubble-menu": {
"version": "2.0.0-beta.55",
"resolved": "https://registry.npmjs.org/@tiptap/extension-bubble-menu/-/extension-bubble-menu-2.0.0-beta.55.tgz",
"integrity": "sha512-v32/QnwwRbepdbrho8mTYru1/XNW/rJi3Mjrgo3rrIs67R86aEPmhmdzD3QEQUJhAJkduuwdw8zElmVWqIJQ9w==",
"version": "2.0.0-beta.56",
"resolved": "https://registry.npmjs.org/@tiptap/extension-bubble-menu/-/extension-bubble-menu-2.0.0-beta.56.tgz",
"integrity": "sha512-nZozwauICdaNPmDPrSn1JFd/9/2rLtK8i2vBOcqxWHObVROvu8ZlJspnrJv23vS6P7/ZO3e/QLVHpnn+1yVq3g==",
"dependencies": {
"prosemirror-state": "^1.3.4",
"prosemirror-view": "^1.23.6",
......@@ -2898,9 +2898,9 @@
}
},
"node_modules/@tiptap/extension-floating-menu": {
"version": "2.0.0-beta.50",
"resolved": "https://registry.npmjs.org/@tiptap/extension-floating-menu/-/extension-floating-menu-2.0.0-beta.50.tgz",
"integrity": "sha512-aQu1HtthMIYEPylr6kzioLxMiObLbcgwx9xZzF03KwNnkjQLbjZOeJX2RwSYVpiVgtfPBGOm3N/br6NSYec4yQ==",
"version": "2.0.0-beta.51",
"resolved": "https://registry.npmjs.org/@tiptap/extension-floating-menu/-/extension-floating-menu-2.0.0-beta.51.tgz",
"integrity": "sha512-rEe7jADK9xr2n2LJsrGEN3Dz7sEGC1JT/7AdTdaZBxQRQvwxTjomqYGrt+LnX+v0MYggh6swMzj7upJosnKbBg==",
"dependencies": {
"prosemirror-state": "^1.3.4",
"prosemirror-view": "^1.23.6",
......@@ -3155,24 +3155,24 @@
}
},
"node_modules/@tiptap/starter-kit": {
"version": "2.0.0-beta.171",
"resolved": "https://registry.npmjs.org/@tiptap/starter-kit/-/starter-kit-2.0.0-beta.171.tgz",
"integrity": "sha512-ifgaPMsKinFDWQ03beMCPpdtcbYSCD4QXMMjdzHlGi2cDZQP6/s3IYpBVZ5kMBAX2x81QAgNjgy2BJ2PaGzsbw==",
"version": "2.0.0-beta.184",
"resolved": "https://registry.npmjs.org/@tiptap/starter-kit/-/starter-kit-2.0.0-beta.184.tgz",
"integrity": "sha512-FgF94i5RQzXiGAIkaubnXEaYwJfiZRbMPZcmarwNo8IyqPnLT34Q1yjw/qZ3nv7rDehWV5l/zenbrrNtPYVCkA==",
"dependencies": {
"@tiptap/core": "^2.0.0-beta.163",
"@tiptap/core": "^2.0.0-beta.175",
"@tiptap/extension-blockquote": "^2.0.0-beta.26",
"@tiptap/extension-bold": "^2.0.0-beta.25",
"@tiptap/extension-bold": "^2.0.0-beta.26",
"@tiptap/extension-bullet-list": "^2.0.0-beta.26",
"@tiptap/extension-code": "^2.0.0-beta.26",
"@tiptap/extension-code-block": "^2.0.0-beta.35",
"@tiptap/extension-code-block": "^2.0.0-beta.37",
"@tiptap/extension-document": "^2.0.0-beta.15",
"@tiptap/extension-dropcursor": "^2.0.0-beta.25",
"@tiptap/extension-gapcursor": "^2.0.0-beta.34",
"@tiptap/extension-hard-break": "^2.0.0-beta.30",
"@tiptap/extension-heading": "^2.0.0-beta.25",
"@tiptap/extension-heading": "^2.0.0-beta.26",
"@tiptap/extension-history": "^2.0.0-beta.21",
"@tiptap/extension-horizontal-rule": "^2.0.0-beta.30",
"@tiptap/extension-italic": "^2.0.0-beta.25",
"@tiptap/extension-horizontal-rule": "^2.0.0-beta.31",
"@tiptap/extension-italic": "^2.0.0-beta.26",
"@tiptap/extension-list-item": "^2.0.0-beta.20",
"@tiptap/extension-ordered-list": "^2.0.0-beta.27",
"@tiptap/extension-paragraph": "^2.0.0-beta.23",
......@@ -17523,9 +17523,9 @@
"dev": true
},
"@tiptap/core": {
"version": "2.0.0-beta.174",
"resolved": "https://registry.npmjs.org/@tiptap/core/-/core-2.0.0-beta.174.tgz",
"integrity": "sha512-APQDto40PdvagG1HTwkKlieQS4Vp6GXNe7qgV1Qo2QCgJCLyxc/fXCTghtrOx0CQb+9JT7fjSLZxbSyUFXjx7Q==",
"version": "2.0.0-beta.175",
"resolved": "https://registry.npmjs.org/@tiptap/core/-/core-2.0.0-beta.175.tgz",
"integrity": "sha512-dDf+2GtifskNLysn49kaCIz0o5hf6VDZ8J7jSQAfoPDEkEkfw9OKhWrR7NzWW6J34CSJreFDRiWkGt8Qz283Vg==",
"requires": {
"@types/prosemirror-commands": "^1.0.4",
"@types/prosemirror-keymap": "^1.0.4",
......@@ -17556,9 +17556,9 @@
"requires": {}
},
"@tiptap/extension-bubble-menu": {
"version": "2.0.0-beta.55",
"resolved": "https://registry.npmjs.org/@tiptap/extension-bubble-menu/-/extension-bubble-menu-2.0.0-beta.55.tgz",
"integrity": "sha512-v32/QnwwRbepdbrho8mTYru1/XNW/rJi3Mjrgo3rrIs67R86aEPmhmdzD3QEQUJhAJkduuwdw8zElmVWqIJQ9w==",
"version": "2.0.0-beta.56",
"resolved": "https://registry.npmjs.org/@tiptap/extension-bubble-menu/-/extension-bubble-menu-2.0.0-beta.56.tgz",
"integrity": "sha512-nZozwauICdaNPmDPrSn1JFd/9/2rLtK8i2vBOcqxWHObVROvu8ZlJspnrJv23vS6P7/ZO3e/QLVHpnn+1yVq3g==",
"requires": {
"prosemirror-state": "^1.3.4",
"prosemirror-view": "^1.23.6",
......@@ -17607,9 +17607,9 @@
}
},
"@tiptap/extension-floating-menu": {
"version": "2.0.0-beta.50",
"resolved": "https://registry.npmjs.org/@tiptap/extension-floating-menu/-/extension-floating-menu-2.0.0-beta.50.tgz",
"integrity": "sha512-aQu1HtthMIYEPylr6kzioLxMiObLbcgwx9xZzF03KwNnkjQLbjZOeJX2RwSYVpiVgtfPBGOm3N/br6NSYec4yQ==",
"version": "2.0.0-beta.51",
"resolved": "https://registry.npmjs.org/@tiptap/extension-floating-menu/-/extension-floating-menu-2.0.0-beta.51.tgz",
"integrity": "sha512-rEe7jADK9xr2n2LJsrGEN3Dz7sEGC1JT/7AdTdaZBxQRQvwxTjomqYGrt+LnX+v0MYggh6swMzj7upJosnKbBg==",
"requires": {
"prosemirror-state": "^1.3.4",
"prosemirror-view": "^1.23.6",
......@@ -17739,24 +17739,24 @@
"requires": {}
},
"@tiptap/starter-kit": {
"version": "2.0.0-beta.171",
"resolved": "https://registry.npmjs.org/@tiptap/starter-kit/-/starter-kit-2.0.0-beta.171.tgz",
"integrity": "sha512-ifgaPMsKinFDWQ03beMCPpdtcbYSCD4QXMMjdzHlGi2cDZQP6/s3IYpBVZ5kMBAX2x81QAgNjgy2BJ2PaGzsbw==",
"version": "2.0.0-beta.184",
"resolved": "https://registry.npmjs.org/@tiptap/starter-kit/-/starter-kit-2.0.0-beta.184.tgz",
"integrity": "sha512-FgF94i5RQzXiGAIkaubnXEaYwJfiZRbMPZcmarwNo8IyqPnLT34Q1yjw/qZ3nv7rDehWV5l/zenbrrNtPYVCkA==",
"requires": {
"@tiptap/core": "^2.0.0-beta.163",
"@tiptap/core": "^2.0.0-beta.175",
"@tiptap/extension-blockquote": "^2.0.0-beta.26",
"@tiptap/extension-bold": "^2.0.0-beta.25",
"@tiptap/extension-bold": "^2.0.0-beta.26",
"@tiptap/extension-bullet-list": "^2.0.0-beta.26",
"@tiptap/extension-code": "^2.0.0-beta.26",
"@tiptap/extension-code-block": "^2.0.0-beta.35",
"@tiptap/extension-code-block": "^2.0.0-beta.37",
"@tiptap/extension-document": "^2.0.0-beta.15",
"@tiptap/extension-dropcursor": "^2.0.0-beta.25",
"@tiptap/extension-gapcursor": "^2.0.0-beta.34",
"@tiptap/extension-hard-break": "^2.0.0-beta.30",
"@tiptap/extension-heading": "^2.0.0-beta.25",
"@tiptap/extension-heading": "^2.0.0-beta.26",
"@tiptap/extension-history": "^2.0.0-beta.21",
"@tiptap/extension-horizontal-rule": "^2.0.0-beta.30",
"@tiptap/extension-italic": "^2.0.0-beta.25",
"@tiptap/extension-horizontal-rule": "^2.0.0-beta.31",
"@tiptap/extension-italic": "^2.0.0-beta.26",
"@tiptap/extension-list-item": "^2.0.0-beta.20",
"@tiptap/extension-ordered-list": "^2.0.0-beta.27",
"@tiptap/extension-paragraph": "^2.0.0-beta.23",
......@@ -11,7 +11,7 @@ import { ClozeElement } from 'common/models/elements/compound-elements/cloze/clo
@Component({
selector: 'aspect-cloze',
template: `
<ng-container *ngIf="!elementModel.document"> TODO
<ng-container *ngIf="elementModel.document.content.length < 1">
Kein Dokument vorhanden
</ng-container>
<div [style.width.%]="100"
......
......@@ -32,7 +32,7 @@ export class ClozeElement extends CompoundElement implements PositionedUIElement
private initDocument(element: Partial<ClozeElement>): ClozeDocument {
return {
...element.document,
content: element.document?.content
content: element.document?.content ? element.document.content
.map((paragraph: ClozeDocumentParagraph) => ({
...paragraph,
content: paragraph.content
......@@ -51,7 +51,7 @@ export class ClozeElement extends CompoundElement implements PositionedUIElement
...paraPart
}
))
}))
})) : []
} as ClozeDocument;
}
......
......@@ -202,8 +202,8 @@ export class UnitService {
}
private duplicateElement(element: UIElement): UIElement {
const newElement = JSON.parse(JSON.stringify(element));
newElement.id = this.idService.getNewID(element.type);
const newElement = ElementFactory
.createElement(element.type, { ...element, id: this.idService.getNewID(element.type) });
if (newElement.position) {
newElement.position.xPosition += 10;
newElement.position.yPosition += 10;
......
import {
Component, EventEmitter, Input, Output, ViewEncapsulation,
Component, EventEmitter, Input, Output,
AfterViewInit, Injector
} from '@angular/core';
import { Editor } from '@tiptap/core';
......@@ -45,42 +45,48 @@ export class RichTextEditorComponent implements AfterViewInit {
bulletListStyle: string = 'disc';
orderedListStyle: string = 'decimal';
editor = new Editor({
extensions: [StarterKit, Underline, Superscript, Subscript,
TextStyle, Color,
Highlight.configure({
multicolor: true
}),
TextAlign.configure({
types: ['paragraph', 'heading']
}),
Indent.configure({
types: ['listItem', 'paragraph'],
minLevel: 0,
maxLevel: 4
}),
Heading.configure({
levels: [1, 2, 3, 4]
}),
ParagraphExtension,
FontSize,
BulletListExtension,
OrderedListExtension,
HangingIndent,
Image.configure({
inline: true,
HTMLAttributes: {
style: 'display: inline-block; height: 1em; vertical-align: middle'
}
}),
Blockquote,
ToggleButtonComponentExtension(this.injector),
DropListComponentExtension(this.injector),
TextFieldComponentExtension(this.injector)
]
});
constructor(private injector: Injector) { }
defaultExtensions = [StarterKit, Underline, Superscript, Subscript,
TextStyle, Color,
Highlight.configure({
multicolor: true
}),
TextAlign.configure({
types: ['paragraph', 'heading']
}),
Indent.configure({
types: ['listItem', 'paragraph'],
minLevel: 0,
maxLevel: 4
}),
Heading.configure({
levels: [1, 2, 3, 4]
}),
ParagraphExtension,
FontSize,
BulletListExtension,
OrderedListExtension,
HangingIndent,
Image.configure({
inline: true,
HTMLAttributes: {
style: 'display: inline-block; height: 1em; vertical-align: middle'
}
}),
Blockquote
];
editor: Editor;
constructor(private injector: Injector) {
const activeExtensions = this.defaultExtensions;
if (this.clozeMode) {
activeExtensions.push(ToggleButtonComponentExtension(this.injector));
activeExtensions.push(DropListComponentExtension(this.injector));
activeExtensions.push(TextFieldComponentExtension(this.injector));
}
this.editor = new Editor({ extensions: activeExtensions });
}
ngAfterViewInit(): void {
this.editor.commands.focus();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment