From 12b2b7ad4b22a1d27510103aedea25ea69ff39a9 Mon Sep 17 00:00:00 2001 From: Marvin Rode Date: Fri, 16 Jun 2023 09:37:14 +0200 Subject: [PATCH 01/19] Modified editor-page to use real editor --- package-lock.json | 31 +++++++ package.json | 2 + src/pages/H5PEditor.page.vue | 157 ++++++++++++++++++++++++--------- src/router/routes.ts | 2 +- src/router/vue-client-route.js | 1 + 5 files changed, 152 insertions(+), 41 deletions(-) diff --git a/package-lock.json b/package-lock.json index 95a16aa72c..5eb5ffb6ec 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,6 +15,7 @@ "axios": "^1.1.3", "dayjs": "^1.11.6", "flush-promises": "^1.0.2", + "iframe-resizer": "^4.3.6", "katex": "^0.12.0", "kjua": "^0.9.0", "mobile-drag-drop": "^3.0.0-rc.0", @@ -37,6 +38,7 @@ "devDependencies": { "@intlify/vue-i18n-loader": "^1.1.0", "@openapitools/openapi-generator-cli": "^2.5.2", + "@types/iframe-resizer": "^3.5.9", "@types/jest": "^27.0.1", "@types/object-hash": "^2.2.1", "@typescript-eslint/eslint-plugin": "^5.4.0", @@ -3432,6 +3434,12 @@ "@types/node": "*" } }, + "node_modules/@types/iframe-resizer": { + "version": "3.5.9", + "resolved": "https://registry.npmjs.org/@types/iframe-resizer/-/iframe-resizer-3.5.9.tgz", + "integrity": "sha512-RQUBI75F+uXruB95BFpC/8V8lPgJg4MQ6HxOCtAZYBB/h0FNCfrFfb4I+u2pZJIV7sKeszZbFqy1UnGeBMrvsA==", + "dev": true + }, "node_modules/@types/istanbul-lib-coverage": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz", @@ -10100,6 +10108,18 @@ } ] }, + "node_modules/iframe-resizer": { + "version": "4.3.6", + "resolved": "https://registry.npmjs.org/iframe-resizer/-/iframe-resizer-4.3.6.tgz", + "integrity": "sha512-wz0WodRIF6eP0oGQa5NIP1yrITAZ59ZJvVaVJqJRjaeCtfm461vy2C3us6CKx0e7pooqpIGLpVMSTzrfAjX9Sg==", + "engines": { + "node": ">=0.8.0" + }, + "funding": { + "type": "individual", + "url": "https://github.com/davidjbradshaw/iframe-resizer/blob/master/FUNDING.md" + } + }, "node_modules/ignore": { "version": "5.2.4", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", @@ -22362,6 +22382,12 @@ "@types/node": "*" } }, + "@types/iframe-resizer": { + "version": "3.5.9", + "resolved": "https://registry.npmjs.org/@types/iframe-resizer/-/iframe-resizer-3.5.9.tgz", + "integrity": "sha512-RQUBI75F+uXruB95BFpC/8V8lPgJg4MQ6HxOCtAZYBB/h0FNCfrFfb4I+u2pZJIV7sKeszZbFqy1UnGeBMrvsA==", + "dev": true + }, "@types/istanbul-lib-coverage": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz", @@ -27332,6 +27358,11 @@ "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", "dev": true }, + "iframe-resizer": { + "version": "4.3.6", + "resolved": "https://registry.npmjs.org/iframe-resizer/-/iframe-resizer-4.3.6.tgz", + "integrity": "sha512-wz0WodRIF6eP0oGQa5NIP1yrITAZ59ZJvVaVJqJRjaeCtfm461vy2C3us6CKx0e7pooqpIGLpVMSTzrfAjX9Sg==" + }, "ignore": { "version": "5.2.4", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", diff --git a/package.json b/package.json index f820b3cea4..262c7d9617 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "axios": "^1.1.3", "dayjs": "^1.11.6", "flush-promises": "^1.0.2", + "iframe-resizer": "^4.3.6", "katex": "^0.12.0", "kjua": "^0.9.0", "mobile-drag-drop": "^3.0.0-rc.0", @@ -46,6 +47,7 @@ "devDependencies": { "@intlify/vue-i18n-loader": "^1.1.0", "@openapitools/openapi-generator-cli": "^2.5.2", + "@types/iframe-resizer": "^3.5.9", "@types/jest": "^27.0.1", "@types/object-hash": "^2.2.1", "@typescript-eslint/eslint-plugin": "^5.4.0", diff --git a/src/pages/H5PEditor.page.vue b/src/pages/H5PEditor.page.vue index df11342592..a17460b1ba 100644 --- a/src/pages/H5PEditor.page.vue +++ b/src/pages/H5PEditor.page.vue @@ -1,62 +1,139 @@ +
+ + {{ mdiChevronLeft }} + {{ $t("pages.content.index.backToCourse") }} + - +
+ Cancel + Save + +
+ +
+
+
+ diff --git a/src/router/routes.ts b/src/router/routes.ts index c9287c15ee..a9b49fc7ac 100644 --- a/src/router/routes.ts +++ b/src/router/routes.ts @@ -288,7 +288,7 @@ export const routes: Array = [ //beforeEnter: createPermissionGuard(["H5P"]), }, { - path: `/h5p/editor/:id(${REGEX_H5P_ID})`, + path: `/h5p/editor/:id(${REGEX_H5P_ID})?`, component: () => import("../pages/H5PEditor.page.vue"), name: "h5pEditor", //beforeEnter: createPermissionGuard(["H5P"]), diff --git a/src/router/vue-client-route.js b/src/router/vue-client-route.js index ecfbb878a8..293db9b1a2 100644 --- a/src/router/vue-client-route.js +++ b/src/router/vue-client-route.js @@ -38,6 +38,7 @@ const vueRoutes = [ `^/rooms-overview/?$`, `^/rooms-list/?$`, `^/h5p/player/${h5pId}/?$`, + `^/h5p/editor/?$`, `^/h5p/editor/${h5pId}/?$`, `^/rooms/${mongoId}/?$`, `^/rooms/${mongoId}/board?$`, From 9808dc09730489331a7995a9fc9b6735bcc38ee0 Mon Sep 17 00:00:00 2001 From: Marvin Rode Date: Mon, 19 Jun 2023 08:28:22 +0200 Subject: [PATCH 02/19] Better error messages --- src/pages/H5PEditor.page.vue | 57 +++++++++++++++++++++++------------- 1 file changed, 36 insertions(+), 21 deletions(-) diff --git a/src/pages/H5PEditor.page.vue b/src/pages/H5PEditor.page.vue index a17460b1ba..226e990537 100644 --- a/src/pages/H5PEditor.page.vue +++ b/src/pages/H5PEditor.page.vue @@ -14,18 +14,17 @@
- Cancel - Save + Save
@@ -35,15 +34,18 @@ From 5260d4ee17fd58c952b851847abaa0f96ed275fc Mon Sep 17 00:00:00 2001 From: Marvin Rode Date: Mon, 19 Jun 2023 11:19:43 +0200 Subject: [PATCH 06/19] replace allowfullscreen attribute --- src/pages/H5PEditor.page.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/H5PEditor.page.vue b/src/pages/H5PEditor.page.vue index 0b40386f39..86b5d7a252 100644 --- a/src/pages/H5PEditor.page.vue +++ b/src/pages/H5PEditor.page.vue @@ -20,7 +20,7 @@ ref="iframe" :src="iframeSrc" class="editor-iframe" - allowfullscreen + allow="fullscreen" title="H5PEditor" v-on:valid-params="onValidParams" v-on:invalid-params="onInvalidParams" From e3996fdc8ed47c23d6854b80dd3fda4ab3068639 Mon Sep 17 00:00:00 2001 From: Marvin Rode Date: Mon, 19 Jun 2023 13:21:22 +0200 Subject: [PATCH 07/19] Update api types --- src/h5pEditorApi/v3/.openapi-generator/FILES | 1 + src/h5pEditorApi/v3/api/h5p-editor-api.ts | 762 +++++++++++++++++- src/h5pEditorApi/v3/models/index.ts | 1 + .../models/post-h5-pcontent-create-params.ts | 43 + 4 files changed, 794 insertions(+), 13 deletions(-) create mode 100644 src/h5pEditorApi/v3/models/post-h5-pcontent-create-params.ts diff --git a/src/h5pEditorApi/v3/.openapi-generator/FILES b/src/h5pEditorApi/v3/.openapi-generator/FILES index 166596ce48..21bf54ae72 100644 --- a/src/h5pEditorApi/v3/.openapi-generator/FILES +++ b/src/h5pEditorApi/v3/.openapi-generator/FILES @@ -9,3 +9,4 @@ git_push.sh index.ts models/api-validation-error.ts models/index.ts +models/post-h5-pcontent-create-params.ts diff --git a/src/h5pEditorApi/v3/api/h5p-editor-api.ts b/src/h5pEditorApi/v3/api/h5p-editor-api.ts index 413be00659..d0c501ce3b 100644 --- a/src/h5pEditorApi/v3/api/h5p-editor-api.ts +++ b/src/h5pEditorApi/v3/api/h5p-editor-api.ts @@ -22,20 +22,382 @@ import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObj import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base'; // @ts-ignore import { ApiValidationError } from '../models'; +// @ts-ignore +import { PostH5PContentCreateParams } from '../models'; /** * H5pEditorApi - axios parameter creator * @export */ export const H5pEditorApiAxiosParamCreator = function (configuration?: Configuration) { return { + /** + * + * @param {string} language + * @param {string} contentId + * @param {PostH5PContentCreateParams} postH5PContentCreateParams + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + h5PEditorControllerCreateOrSaveH5pContent: async (language: string, contentId: string, postH5PContentCreateParams: PostH5PContentCreateParams, options: any = {}): Promise => { + // verify required parameter 'language' is not null or undefined + assertParamExists('h5PEditorControllerCreateOrSaveH5pContent', 'language', language) + // verify required parameter 'contentId' is not null or undefined + assertParamExists('h5PEditorControllerCreateOrSaveH5pContent', 'contentId', contentId) + // verify required parameter 'postH5PContentCreateParams' is not null or undefined + assertParamExists('h5PEditorControllerCreateOrSaveH5pContent', 'postH5PContentCreateParams', postH5PContentCreateParams) + const localVarPath = `/h5p-editor/edit/{contentId}` + .replace(`{${"language"}}`, encodeURIComponent(String(language))) + .replace(`{${"contentId"}}`, encodeURIComponent(String(contentId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication bearer required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(postH5PContentCreateParams, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {string} language + * @param {string} contentId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + h5PEditorControllerDeleteH5pContent: async (language: string, contentId: string, options: any = {}): Promise => { + // verify required parameter 'language' is not null or undefined + assertParamExists('h5PEditorControllerDeleteH5pContent', 'language', language) + // verify required parameter 'contentId' is not null or undefined + assertParamExists('h5PEditorControllerDeleteH5pContent', 'contentId', contentId) + const localVarPath = `/h5p-editor/delete/{contentId}` + .replace(`{${"language"}}`, encodeURIComponent(String(language))) + .replace(`{${"contentId"}}`, encodeURIComponent(String(contentId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication bearer required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) + + + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + h5PEditorControllerGetAjax: async (options: any = {}): Promise => { + const localVarPath = `/h5p-editor/ajax`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication bearer required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) + + + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {string} id + * @param {string} file + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + h5PEditorControllerGetContentFile: async (id: string, file: string, options: any = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('h5PEditorControllerGetContentFile', 'id', id) + // verify required parameter 'file' is not null or undefined + assertParamExists('h5PEditorControllerGetContentFile', 'file', file) + const localVarPath = `/h5p-editor/content/{id}/{file}` + .replace(`{${"id"}}`, encodeURIComponent(String(id))) + .replace(`{${"file"}}`, encodeURIComponent(String(file))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication bearer required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) + + + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {string} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + h5PEditorControllerGetContentParameters: async (id: string, options: any = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('h5PEditorControllerGetContentParameters', 'id', id) + const localVarPath = `/h5p-editor/params/{id}` + .replace(`{${"id"}}`, encodeURIComponent(String(id))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication bearer required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) + + + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** * * @summary Return dummy HTML for testing * @param {*} [options] Override http request option. * @throws {RequiredError} */ - h5PEditorControllerGetEditor: async (options: any = {}): Promise => { - const localVarPath = `/h5p-editor/{contentId}/edit`; + h5PEditorControllerGetEditor: async (options: any = {}): Promise => { + const localVarPath = `/h5p-editor/{contentId}/edit`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication bearer required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) + + + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {string} language + * @param {string} contentId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + h5PEditorControllerGetH5PEditor: async (language: string, contentId: string, options: any = {}): Promise => { + // verify required parameter 'language' is not null or undefined + assertParamExists('h5PEditorControllerGetH5PEditor', 'language', language) + // verify required parameter 'contentId' is not null or undefined + assertParamExists('h5PEditorControllerGetH5PEditor', 'contentId', contentId) + const localVarPath = `/h5p-editor/edit/{contentId}` + .replace(`{${"language"}}`, encodeURIComponent(String(language))) + .replace(`{${"contentId"}}`, encodeURIComponent(String(contentId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication bearer required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) + + + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {string} ubername + * @param {string} file + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + h5PEditorControllerGetLibraryFile: async (ubername: string, file: string, options: any = {}): Promise => { + // verify required parameter 'ubername' is not null or undefined + assertParamExists('h5PEditorControllerGetLibraryFile', 'ubername', ubername) + // verify required parameter 'file' is not null or undefined + assertParamExists('h5PEditorControllerGetLibraryFile', 'file', file) + const localVarPath = `/h5p-editor/libraries/{ubername}/{file}` + .replace(`{${"ubername"}}`, encodeURIComponent(String(ubername))) + .replace(`{${"file"}}`, encodeURIComponent(String(file))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication bearer required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) + + + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Return dummy HTML for testing + * @param {string} language + * @param {string} contentId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + h5PEditorControllerGetPlayer: async (language: string, contentId: string, options: any = {}): Promise => { + // verify required parameter 'language' is not null or undefined + assertParamExists('h5PEditorControllerGetPlayer', 'language', language) + // verify required parameter 'contentId' is not null or undefined + assertParamExists('h5PEditorControllerGetPlayer', 'contentId', contentId) + const localVarPath = `/h5p-editor/play/{contentId}` + .replace(`{${"language"}}`, encodeURIComponent(String(language))) + .replace(`{${"contentId"}}`, encodeURIComponent(String(contentId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication bearer required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) + + + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {string} file + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + h5PEditorControllerGetTemporaryFile: async (file: string, options: any = {}): Promise => { + // verify required parameter 'file' is not null or undefined + assertParamExists('h5PEditorControllerGetTemporaryFile', 'file', file) + const localVarPath = `/h5p-editor/temp-files/{file}` + .replace(`{${"file"}}`, encodeURIComponent(String(file))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; @@ -64,12 +426,11 @@ export const H5pEditorApiAxiosParamCreator = function (configuration?: Configura }, /** * - * @summary Return dummy HTML for testing * @param {*} [options] Override http request option. * @throws {RequiredError} */ - h5PEditorControllerGetPlayer: async (options: any = {}): Promise => { - const localVarPath = `/h5p-editor/{contentId}/play`; + h5PEditorControllerPostAjax: async (options: any = {}): Promise => { + const localVarPath = `/h5p-editor/ajax`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; @@ -77,7 +438,7 @@ export const H5pEditorApiAxiosParamCreator = function (configuration?: Configura baseOptions = configuration.baseOptions; } - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; @@ -106,6 +467,59 @@ export const H5pEditorApiAxiosParamCreator = function (configuration?: Configura export const H5pEditorApiFp = function(configuration?: Configuration) { const localVarAxiosParamCreator = H5pEditorApiAxiosParamCreator(configuration) return { + /** + * + * @param {string} language + * @param {string} contentId + * @param {PostH5PContentCreateParams} postH5PContentCreateParams + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async h5PEditorControllerCreateOrSaveH5pContent(language: string, contentId: string, postH5PContentCreateParams: PostH5PContentCreateParams, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.h5PEditorControllerCreateOrSaveH5pContent(language, contentId, postH5PContentCreateParams, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @param {string} language + * @param {string} contentId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async h5PEditorControllerDeleteH5pContent(language: string, contentId: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.h5PEditorControllerDeleteH5pContent(language, contentId, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async h5PEditorControllerGetAjax(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.h5PEditorControllerGetAjax(options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @param {string} id + * @param {string} file + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async h5PEditorControllerGetContentFile(id: string, file: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.h5PEditorControllerGetContentFile(id, file, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @param {string} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async h5PEditorControllerGetContentParameters(id: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.h5PEditorControllerGetContentParameters(id, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, /** * * @summary Return dummy HTML for testing @@ -116,14 +530,57 @@ export const H5pEditorApiFp = function(configuration?: Configuration) { const localVarAxiosArgs = await localVarAxiosParamCreator.h5PEditorControllerGetEditor(options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, + /** + * + * @param {string} language + * @param {string} contentId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async h5PEditorControllerGetH5PEditor(language: string, contentId: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.h5PEditorControllerGetH5PEditor(language, contentId, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @param {string} ubername + * @param {string} file + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async h5PEditorControllerGetLibraryFile(ubername: string, file: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.h5PEditorControllerGetLibraryFile(ubername, file, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, /** * * @summary Return dummy HTML for testing + * @param {string} language + * @param {string} contentId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async h5PEditorControllerGetPlayer(language: string, contentId: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.h5PEditorControllerGetPlayer(language, contentId, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @param {string} file + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async h5PEditorControllerGetTemporaryFile(file: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.h5PEditorControllerGetTemporaryFile(file, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async h5PEditorControllerGetPlayer(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.h5PEditorControllerGetPlayer(options); + async h5PEditorControllerPostAjax(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.h5PEditorControllerPostAjax(options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, } @@ -136,6 +593,54 @@ export const H5pEditorApiFp = function(configuration?: Configuration) { export const H5pEditorApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { const localVarFp = H5pEditorApiFp(configuration) return { + /** + * + * @param {string} language + * @param {string} contentId + * @param {PostH5PContentCreateParams} postH5PContentCreateParams + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + h5PEditorControllerCreateOrSaveH5pContent(language: string, contentId: string, postH5PContentCreateParams: PostH5PContentCreateParams, options?: any): AxiosPromise { + return localVarFp.h5PEditorControllerCreateOrSaveH5pContent(language, contentId, postH5PContentCreateParams, options).then((request) => request(axios, basePath)); + }, + /** + * + * @param {string} language + * @param {string} contentId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + h5PEditorControllerDeleteH5pContent(language: string, contentId: string, options?: any): AxiosPromise { + return localVarFp.h5PEditorControllerDeleteH5pContent(language, contentId, options).then((request) => request(axios, basePath)); + }, + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + h5PEditorControllerGetAjax(options?: any): AxiosPromise { + return localVarFp.h5PEditorControllerGetAjax(options).then((request) => request(axios, basePath)); + }, + /** + * + * @param {string} id + * @param {string} file + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + h5PEditorControllerGetContentFile(id: string, file: string, options?: any): AxiosPromise { + return localVarFp.h5PEditorControllerGetContentFile(id, file, options).then((request) => request(axios, basePath)); + }, + /** + * + * @param {string} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + h5PEditorControllerGetContentParameters(id: string, options?: any): AxiosPromise { + return localVarFp.h5PEditorControllerGetContentParameters(id, options).then((request) => request(axios, basePath)); + }, /** * * @summary Return dummy HTML for testing @@ -145,14 +650,53 @@ export const H5pEditorApiFactory = function (configuration?: Configuration, base h5PEditorControllerGetEditor(options?: any): AxiosPromise { return localVarFp.h5PEditorControllerGetEditor(options).then((request) => request(axios, basePath)); }, + /** + * + * @param {string} language + * @param {string} contentId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + h5PEditorControllerGetH5PEditor(language: string, contentId: string, options?: any): AxiosPromise { + return localVarFp.h5PEditorControllerGetH5PEditor(language, contentId, options).then((request) => request(axios, basePath)); + }, + /** + * + * @param {string} ubername + * @param {string} file + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + h5PEditorControllerGetLibraryFile(ubername: string, file: string, options?: any): AxiosPromise { + return localVarFp.h5PEditorControllerGetLibraryFile(ubername, file, options).then((request) => request(axios, basePath)); + }, /** * * @summary Return dummy HTML for testing + * @param {string} language + * @param {string} contentId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + h5PEditorControllerGetPlayer(language: string, contentId: string, options?: any): AxiosPromise { + return localVarFp.h5PEditorControllerGetPlayer(language, contentId, options).then((request) => request(axios, basePath)); + }, + /** + * + * @param {string} file + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + h5PEditorControllerGetTemporaryFile(file: string, options?: any): AxiosPromise { + return localVarFp.h5PEditorControllerGetTemporaryFile(file, options).then((request) => request(axios, basePath)); + }, + /** + * * @param {*} [options] Override http request option. * @throws {RequiredError} */ - h5PEditorControllerGetPlayer(options?: any): AxiosPromise { - return localVarFp.h5PEditorControllerGetPlayer(options).then((request) => request(axios, basePath)); + h5PEditorControllerPostAjax(options?: any): AxiosPromise { + return localVarFp.h5PEditorControllerPostAjax(options).then((request) => request(axios, basePath)); }, }; }; @@ -163,6 +707,54 @@ export const H5pEditorApiFactory = function (configuration?: Configuration, base * @interface H5pEditorApi */ export interface H5pEditorApiInterface { + /** + * + * @param {string} language + * @param {string} contentId + * @param {PostH5PContentCreateParams} postH5PContentCreateParams + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof H5pEditorApiInterface + */ + h5PEditorControllerCreateOrSaveH5pContent(language: string, contentId: string, postH5PContentCreateParams: PostH5PContentCreateParams, options?: any): AxiosPromise; + + /** + * + * @param {string} language + * @param {string} contentId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof H5pEditorApiInterface + */ + h5PEditorControllerDeleteH5pContent(language: string, contentId: string, options?: any): AxiosPromise; + + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof H5pEditorApiInterface + */ + h5PEditorControllerGetAjax(options?: any): AxiosPromise; + + /** + * + * @param {string} id + * @param {string} file + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof H5pEditorApiInterface + */ + h5PEditorControllerGetContentFile(id: string, file: string, options?: any): AxiosPromise; + + /** + * + * @param {string} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof H5pEditorApiInterface + */ + h5PEditorControllerGetContentParameters(id: string, options?: any): AxiosPromise; + /** * * @summary Return dummy HTML for testing @@ -172,14 +764,53 @@ export interface H5pEditorApiInterface { */ h5PEditorControllerGetEditor(options?: any): AxiosPromise; + /** + * + * @param {string} language + * @param {string} contentId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof H5pEditorApiInterface + */ + h5PEditorControllerGetH5PEditor(language: string, contentId: string, options?: any): AxiosPromise; + + /** + * + * @param {string} ubername + * @param {string} file + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof H5pEditorApiInterface + */ + h5PEditorControllerGetLibraryFile(ubername: string, file: string, options?: any): AxiosPromise; + /** * * @summary Return dummy HTML for testing + * @param {string} language + * @param {string} contentId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof H5pEditorApiInterface + */ + h5PEditorControllerGetPlayer(language: string, contentId: string, options?: any): AxiosPromise; + + /** + * + * @param {string} file + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof H5pEditorApiInterface + */ + h5PEditorControllerGetTemporaryFile(file: string, options?: any): AxiosPromise; + + /** + * * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof H5pEditorApiInterface */ - h5PEditorControllerGetPlayer(options?: any): AxiosPromise; + h5PEditorControllerPostAjax(options?: any): AxiosPromise; } @@ -190,6 +821,64 @@ export interface H5pEditorApiInterface { * @extends {BaseAPI} */ export class H5pEditorApi extends BaseAPI implements H5pEditorApiInterface { + /** + * + * @param {string} language + * @param {string} contentId + * @param {PostH5PContentCreateParams} postH5PContentCreateParams + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof H5pEditorApi + */ + public h5PEditorControllerCreateOrSaveH5pContent(language: string, contentId: string, postH5PContentCreateParams: PostH5PContentCreateParams, options?: any) { + return H5pEditorApiFp(this.configuration).h5PEditorControllerCreateOrSaveH5pContent(language, contentId, postH5PContentCreateParams, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @param {string} language + * @param {string} contentId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof H5pEditorApi + */ + public h5PEditorControllerDeleteH5pContent(language: string, contentId: string, options?: any) { + return H5pEditorApiFp(this.configuration).h5PEditorControllerDeleteH5pContent(language, contentId, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof H5pEditorApi + */ + public h5PEditorControllerGetAjax(options?: any) { + return H5pEditorApiFp(this.configuration).h5PEditorControllerGetAjax(options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @param {string} id + * @param {string} file + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof H5pEditorApi + */ + public h5PEditorControllerGetContentFile(id: string, file: string, options?: any) { + return H5pEditorApiFp(this.configuration).h5PEditorControllerGetContentFile(id, file, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @param {string} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof H5pEditorApi + */ + public h5PEditorControllerGetContentParameters(id: string, options?: any) { + return H5pEditorApiFp(this.configuration).h5PEditorControllerGetContentParameters(id, options).then((request) => request(this.axios, this.basePath)); + } + /** * * @summary Return dummy HTML for testing @@ -201,14 +890,61 @@ export class H5pEditorApi extends BaseAPI implements H5pEditorApiInterface { return H5pEditorApiFp(this.configuration).h5PEditorControllerGetEditor(options).then((request) => request(this.axios, this.basePath)); } + /** + * + * @param {string} language + * @param {string} contentId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof H5pEditorApi + */ + public h5PEditorControllerGetH5PEditor(language: string, contentId: string, options?: any) { + return H5pEditorApiFp(this.configuration).h5PEditorControllerGetH5PEditor(language, contentId, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @param {string} ubername + * @param {string} file + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof H5pEditorApi + */ + public h5PEditorControllerGetLibraryFile(ubername: string, file: string, options?: any) { + return H5pEditorApiFp(this.configuration).h5PEditorControllerGetLibraryFile(ubername, file, options).then((request) => request(this.axios, this.basePath)); + } + /** * * @summary Return dummy HTML for testing + * @param {string} language + * @param {string} contentId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof H5pEditorApi + */ + public h5PEditorControllerGetPlayer(language: string, contentId: string, options?: any) { + return H5pEditorApiFp(this.configuration).h5PEditorControllerGetPlayer(language, contentId, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @param {string} file + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof H5pEditorApi + */ + public h5PEditorControllerGetTemporaryFile(file: string, options?: any) { + return H5pEditorApiFp(this.configuration).h5PEditorControllerGetTemporaryFile(file, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof H5pEditorApi */ - public h5PEditorControllerGetPlayer(options?: any) { - return H5pEditorApiFp(this.configuration).h5PEditorControllerGetPlayer(options).then((request) => request(this.axios, this.basePath)); + public h5PEditorControllerPostAjax(options?: any) { + return H5pEditorApiFp(this.configuration).h5PEditorControllerPostAjax(options).then((request) => request(this.axios, this.basePath)); } } diff --git a/src/h5pEditorApi/v3/models/index.ts b/src/h5pEditorApi/v3/models/index.ts index d2ae095ff9..d11e7f7b03 100644 --- a/src/h5pEditorApi/v3/models/index.ts +++ b/src/h5pEditorApi/v3/models/index.ts @@ -1 +1,2 @@ export * from './api-validation-error'; +export * from './post-h5-pcontent-create-params'; diff --git a/src/h5pEditorApi/v3/models/post-h5-pcontent-create-params.ts b/src/h5pEditorApi/v3/models/post-h5-pcontent-create-params.ts new file mode 100644 index 0000000000..d199876088 --- /dev/null +++ b/src/h5pEditorApi/v3/models/post-h5-pcontent-create-params.ts @@ -0,0 +1,43 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * HPI Schul-Cloud Server API + * This is v3 of HPI Schul-Cloud Server. Checkout /docs for v1. + * + * The version of the OpenAPI document: 3.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +/** + * + * @export + * @interface PostH5PContentCreateParams + */ +export interface PostH5PContentCreateParams { + /** + * + * @type {object} + * @memberof PostH5PContentCreateParams + */ + params: object; + /** + * + * @type {object} + * @memberof PostH5PContentCreateParams + */ + metadata: object; + /** + * + * @type {string} + * @memberof PostH5PContentCreateParams + */ + library: string; +} + + From 29dbceac3989bda02089432995a8e5c3e47de360 Mon Sep 17 00:00:00 2001 From: Marvin Rode Date: Fri, 23 Jun 2023 10:29:49 +0200 Subject: [PATCH 08/19] Use generated api --- src/h5pEditorApi/v3/.openapi-generator/FILES | 2 + src/h5pEditorApi/v3/api/h5p-editor-api.ts | 124 ++++++++++++++---- .../v3/models/h5-pcontent-metadata.ts | 37 ++++++ .../v3/models/h5-psave-response.ts | 38 ++++++ src/h5pEditorApi/v3/models/index.ts | 2 + src/pages/H5PEditor.page.vue | 68 ++++++---- 6 files changed, 223 insertions(+), 48 deletions(-) create mode 100644 src/h5pEditorApi/v3/models/h5-pcontent-metadata.ts create mode 100644 src/h5pEditorApi/v3/models/h5-psave-response.ts diff --git a/src/h5pEditorApi/v3/.openapi-generator/FILES b/src/h5pEditorApi/v3/.openapi-generator/FILES index 21bf54ae72..f3c95cbb25 100644 --- a/src/h5pEditorApi/v3/.openapi-generator/FILES +++ b/src/h5pEditorApi/v3/.openapi-generator/FILES @@ -8,5 +8,7 @@ configuration.ts git_push.sh index.ts models/api-validation-error.ts +models/h5-pcontent-metadata.ts +models/h5-psave-response.ts models/index.ts models/post-h5-pcontent-create-params.ts diff --git a/src/h5pEditorApi/v3/api/h5p-editor-api.ts b/src/h5pEditorApi/v3/api/h5p-editor-api.ts index d0c501ce3b..6124330897 100644 --- a/src/h5pEditorApi/v3/api/h5p-editor-api.ts +++ b/src/h5pEditorApi/v3/api/h5p-editor-api.ts @@ -23,6 +23,8 @@ import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } fr // @ts-ignore import { ApiValidationError } from '../models'; // @ts-ignore +import { H5PSaveResponse } from '../models'; +// @ts-ignore import { PostH5PContentCreateParams } from '../models'; /** * H5pEditorApi - axios parameter creator @@ -32,22 +34,14 @@ export const H5pEditorApiAxiosParamCreator = function (configuration?: Configura return { /** * - * @param {string} language - * @param {string} contentId * @param {PostH5PContentCreateParams} postH5PContentCreateParams * @param {*} [options] Override http request option. * @throws {RequiredError} */ - h5PEditorControllerCreateOrSaveH5pContent: async (language: string, contentId: string, postH5PContentCreateParams: PostH5PContentCreateParams, options: any = {}): Promise => { - // verify required parameter 'language' is not null or undefined - assertParamExists('h5PEditorControllerCreateOrSaveH5pContent', 'language', language) - // verify required parameter 'contentId' is not null or undefined - assertParamExists('h5PEditorControllerCreateOrSaveH5pContent', 'contentId', contentId) + h5PEditorControllerCreateH5pContent: async (postH5PContentCreateParams: PostH5PContentCreateParams, options: any = {}): Promise => { // verify required parameter 'postH5PContentCreateParams' is not null or undefined - assertParamExists('h5PEditorControllerCreateOrSaveH5pContent', 'postH5PContentCreateParams', postH5PContentCreateParams) - const localVarPath = `/h5p-editor/edit/{contentId}` - .replace(`{${"language"}}`, encodeURIComponent(String(language))) - .replace(`{${"contentId"}}`, encodeURIComponent(String(contentId))); + assertParamExists('h5PEditorControllerCreateH5pContent', 'postH5PContentCreateParams', postH5PContentCreateParams) + const localVarPath = `/h5p-editor/edit`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; @@ -452,6 +446,49 @@ export const H5pEditorApiAxiosParamCreator = function (configuration?: Configura let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {string} contentId + * @param {PostH5PContentCreateParams} postH5PContentCreateParams + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + h5PEditorControllerSaveH5pContent: async (contentId: string, postH5PContentCreateParams: PostH5PContentCreateParams, options: any = {}): Promise => { + // verify required parameter 'contentId' is not null or undefined + assertParamExists('h5PEditorControllerSaveH5pContent', 'contentId', contentId) + // verify required parameter 'postH5PContentCreateParams' is not null or undefined + assertParamExists('h5PEditorControllerSaveH5pContent', 'postH5PContentCreateParams', postH5PContentCreateParams) + const localVarPath = `/h5p-editor/edit/{contentId}` + .replace(`{${"contentId"}}`, encodeURIComponent(String(contentId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication bearer required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(postH5PContentCreateParams, localVarRequestOptions, configuration) + return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, @@ -469,14 +506,12 @@ export const H5pEditorApiFp = function(configuration?: Configuration) { return { /** * - * @param {string} language - * @param {string} contentId * @param {PostH5PContentCreateParams} postH5PContentCreateParams * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async h5PEditorControllerCreateOrSaveH5pContent(language: string, contentId: string, postH5PContentCreateParams: PostH5PContentCreateParams, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.h5PEditorControllerCreateOrSaveH5pContent(language, contentId, postH5PContentCreateParams, options); + async h5PEditorControllerCreateH5pContent(postH5PContentCreateParams: PostH5PContentCreateParams, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.h5PEditorControllerCreateH5pContent(postH5PContentCreateParams, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** @@ -583,6 +618,17 @@ export const H5pEditorApiFp = function(configuration?: Configuration) { const localVarAxiosArgs = await localVarAxiosParamCreator.h5PEditorControllerPostAjax(options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, + /** + * + * @param {string} contentId + * @param {PostH5PContentCreateParams} postH5PContentCreateParams + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async h5PEditorControllerSaveH5pContent(contentId: string, postH5PContentCreateParams: PostH5PContentCreateParams, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.h5PEditorControllerSaveH5pContent(contentId, postH5PContentCreateParams, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, } }; @@ -595,14 +641,12 @@ export const H5pEditorApiFactory = function (configuration?: Configuration, base return { /** * - * @param {string} language - * @param {string} contentId * @param {PostH5PContentCreateParams} postH5PContentCreateParams * @param {*} [options] Override http request option. * @throws {RequiredError} */ - h5PEditorControllerCreateOrSaveH5pContent(language: string, contentId: string, postH5PContentCreateParams: PostH5PContentCreateParams, options?: any): AxiosPromise { - return localVarFp.h5PEditorControllerCreateOrSaveH5pContent(language, contentId, postH5PContentCreateParams, options).then((request) => request(axios, basePath)); + h5PEditorControllerCreateH5pContent(postH5PContentCreateParams: PostH5PContentCreateParams, options?: any): AxiosPromise { + return localVarFp.h5PEditorControllerCreateH5pContent(postH5PContentCreateParams, options).then((request) => request(axios, basePath)); }, /** * @@ -698,6 +742,16 @@ export const H5pEditorApiFactory = function (configuration?: Configuration, base h5PEditorControllerPostAjax(options?: any): AxiosPromise { return localVarFp.h5PEditorControllerPostAjax(options).then((request) => request(axios, basePath)); }, + /** + * + * @param {string} contentId + * @param {PostH5PContentCreateParams} postH5PContentCreateParams + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + h5PEditorControllerSaveH5pContent(contentId: string, postH5PContentCreateParams: PostH5PContentCreateParams, options?: any): AxiosPromise { + return localVarFp.h5PEditorControllerSaveH5pContent(contentId, postH5PContentCreateParams, options).then((request) => request(axios, basePath)); + }, }; }; @@ -709,14 +763,12 @@ export const H5pEditorApiFactory = function (configuration?: Configuration, base export interface H5pEditorApiInterface { /** * - * @param {string} language - * @param {string} contentId * @param {PostH5PContentCreateParams} postH5PContentCreateParams * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof H5pEditorApiInterface */ - h5PEditorControllerCreateOrSaveH5pContent(language: string, contentId: string, postH5PContentCreateParams: PostH5PContentCreateParams, options?: any): AxiosPromise; + h5PEditorControllerCreateH5pContent(postH5PContentCreateParams: PostH5PContentCreateParams, options?: any): AxiosPromise; /** * @@ -812,6 +864,16 @@ export interface H5pEditorApiInterface { */ h5PEditorControllerPostAjax(options?: any): AxiosPromise; + /** + * + * @param {string} contentId + * @param {PostH5PContentCreateParams} postH5PContentCreateParams + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof H5pEditorApiInterface + */ + h5PEditorControllerSaveH5pContent(contentId: string, postH5PContentCreateParams: PostH5PContentCreateParams, options?: any): AxiosPromise; + } /** @@ -823,15 +885,13 @@ export interface H5pEditorApiInterface { export class H5pEditorApi extends BaseAPI implements H5pEditorApiInterface { /** * - * @param {string} language - * @param {string} contentId * @param {PostH5PContentCreateParams} postH5PContentCreateParams * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof H5pEditorApi */ - public h5PEditorControllerCreateOrSaveH5pContent(language: string, contentId: string, postH5PContentCreateParams: PostH5PContentCreateParams, options?: any) { - return H5pEditorApiFp(this.configuration).h5PEditorControllerCreateOrSaveH5pContent(language, contentId, postH5PContentCreateParams, options).then((request) => request(this.axios, this.basePath)); + public h5PEditorControllerCreateH5pContent(postH5PContentCreateParams: PostH5PContentCreateParams, options?: any) { + return H5pEditorApiFp(this.configuration).h5PEditorControllerCreateH5pContent(postH5PContentCreateParams, options).then((request) => request(this.axios, this.basePath)); } /** @@ -947,4 +1007,16 @@ export class H5pEditorApi extends BaseAPI implements H5pEditorApiInterface { public h5PEditorControllerPostAjax(options?: any) { return H5pEditorApiFp(this.configuration).h5PEditorControllerPostAjax(options).then((request) => request(this.axios, this.basePath)); } + + /** + * + * @param {string} contentId + * @param {PostH5PContentCreateParams} postH5PContentCreateParams + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof H5pEditorApi + */ + public h5PEditorControllerSaveH5pContent(contentId: string, postH5PContentCreateParams: PostH5PContentCreateParams, options?: any) { + return H5pEditorApiFp(this.configuration).h5PEditorControllerSaveH5pContent(contentId, postH5PContentCreateParams, options).then((request) => request(this.axios, this.basePath)); + } } diff --git a/src/h5pEditorApi/v3/models/h5-pcontent-metadata.ts b/src/h5pEditorApi/v3/models/h5-pcontent-metadata.ts new file mode 100644 index 0000000000..c378485618 --- /dev/null +++ b/src/h5pEditorApi/v3/models/h5-pcontent-metadata.ts @@ -0,0 +1,37 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * HPI Schul-Cloud Server API + * This is v3 of HPI Schul-Cloud Server. Checkout /docs for v1. + * + * The version of the OpenAPI document: 3.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +/** + * + * @export + * @interface H5PContentMetadata + */ +export interface H5PContentMetadata { + /** + * + * @type {string} + * @memberof H5PContentMetadata + */ + title: string; + /** + * + * @type {string} + * @memberof H5PContentMetadata + */ + mainLibrary: string; +} + + diff --git a/src/h5pEditorApi/v3/models/h5-psave-response.ts b/src/h5pEditorApi/v3/models/h5-psave-response.ts new file mode 100644 index 0000000000..0a03d5434d --- /dev/null +++ b/src/h5pEditorApi/v3/models/h5-psave-response.ts @@ -0,0 +1,38 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * HPI Schul-Cloud Server API + * This is v3 of HPI Schul-Cloud Server. Checkout /docs for v1. + * + * The version of the OpenAPI document: 3.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import { H5PContentMetadata } from './h5-pcontent-metadata'; + +/** + * + * @export + * @interface H5PSaveResponse + */ +export interface H5PSaveResponse { + /** + * + * @type {string} + * @memberof H5PSaveResponse + */ + id: string; + /** + * + * @type {H5PContentMetadata} + * @memberof H5PSaveResponse + */ + metadata: H5PContentMetadata; +} + + diff --git a/src/h5pEditorApi/v3/models/index.ts b/src/h5pEditorApi/v3/models/index.ts index d11e7f7b03..0ce919f52d 100644 --- a/src/h5pEditorApi/v3/models/index.ts +++ b/src/h5pEditorApi/v3/models/index.ts @@ -1,2 +1,4 @@ export * from './api-validation-error'; +export * from './h5-pcontent-metadata'; +export * from './h5-psave-response'; export * from './post-h5-pcontent-create-params'; diff --git a/src/pages/H5PEditor.page.vue b/src/pages/H5PEditor.page.vue index 86b5d7a252..c8b5c29e22 100644 --- a/src/pages/H5PEditor.page.vue +++ b/src/pages/H5PEditor.page.vue @@ -50,6 +50,8 @@ import { defineComponent, inject, ref } from "vue"; import VueI18n from "vue-i18n"; import { useRoute, useRouter } from "vue-router/composables"; +import { H5pEditorApiFactory } from "@/h5pEditorApi/v3"; + type IFrameResizerElement = { iFrameResizer?: { removeListeners: () => void } }; type ParamsValidEvent = CustomEvent; @@ -78,10 +80,14 @@ export default defineComponent({ const iframe = ref(); - const contentId = route.params?.id ?? ""; + const contentId = route.params?.id; const isInline = !!route.query?.inline; - const iframeSrc = `${window.location.origin}/api/v3/h5p-editor/edit/${contentId}`; + const iframeSrc = `${window.location.origin}/api/v3/h5p-editor/edit/${ + contentId ?? "" + }`; + + const h5pEditorApi = H5pEditorApiFactory(undefined, "/v3", $axios); function notifyParent(event: CustomEvent) { window.dispatchEvent(event); @@ -97,26 +103,44 @@ export default defineComponent({ async function onValidParams(event: ParamsValidEvent) { try { - const response = await $axios.post<{ - id: string; - metadata: { title: string; mainLibrary: string }; - }>(`/v3/h5p-editor/edit/${contentId}`, event.detail); - - const { - id, - metadata: { title, mainLibrary }, - } = response.data; - - notifyParent( - new CustomEvent("save-content", { - detail: { contentId: id, title, contentType: mainLibrary }, - }) - ); - - router.replace({ - path: `/h5p/editor/${id}`, - query: route.query, - }); + if (contentId) { + // Save content + const { data } = await h5pEditorApi.h5PEditorControllerSaveH5pContent( + contentId, + event.detail + ); + + notifyParent( + new CustomEvent("save-content", { + detail: { + contentId: data.id, + title: data.metadata.title, + contentType: data.metadata.mainLibrary, + }, + }) + ); + } else { + // Create content + const { data } = + await h5pEditorApi.h5PEditorControllerCreateH5pContent( + event.detail + ); + + notifyParent( + new CustomEvent("save-content", { + detail: { + contentId: data.id, + title: data.metadata.title, + contentType: data.metadata.mainLibrary, + }, + }) + ); + + router.replace({ + path: `/h5p/editor/${data.id}`, + query: route.query, + }); + } } catch (err) { notifierModule.show({ text: t("common.validation.invalid"), From cfaf003140f2b76c2df2f44f92cad64659b931a0 Mon Sep 17 00:00:00 2001 From: Marvin Rode Date: Mon, 26 Jun 2023 08:16:11 +0200 Subject: [PATCH 09/19] Revert layout changes --- src/layouts/legacyLoggedIn.vue | 2 +- src/layouts/loggedIn.layout.vue | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/layouts/legacyLoggedIn.vue b/src/layouts/legacyLoggedIn.vue index f6e52552b1..bd6322736d 100644 --- a/src/layouts/legacyLoggedIn.vue +++ b/src/layouts/legacyLoggedIn.vue @@ -145,7 +145,7 @@ export default { min-height: 100vh; &.inline { - grid-template-columns: 0 1fr; + display: inline; } @include breakpoint(tablet) { diff --git a/src/layouts/loggedIn.layout.vue b/src/layouts/loggedIn.layout.vue index 2e94d74fdb..11c3c8deb1 100644 --- a/src/layouts/loggedIn.layout.vue +++ b/src/layouts/loggedIn.layout.vue @@ -36,5 +36,12 @@ export default { grid-area: content; width: inherit; max-width: 100vw; + + @include breakpoint(tablet) { + max-width: calc(100vw - var(--sidebar-width-tablet)); + } + @include breakpoint(desktop) { + max-width: calc(100vw - var(--sidebar-width)); + } } From 947b65ed56961f7f915992616bbb9b72322de7be Mon Sep 17 00:00:00 2001 From: Marvin Rode Date: Mon, 26 Jun 2023 08:18:31 +0200 Subject: [PATCH 10/19] Revert layout changes --- src/layouts/loggedIn.layout.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/src/layouts/loggedIn.layout.vue b/src/layouts/loggedIn.layout.vue index 11c3c8deb1..662b80f4c7 100644 --- a/src/layouts/loggedIn.layout.vue +++ b/src/layouts/loggedIn.layout.vue @@ -40,6 +40,7 @@ export default { @include breakpoint(tablet) { max-width: calc(100vw - var(--sidebar-width-tablet)); } + @include breakpoint(desktop) { max-width: calc(100vw - var(--sidebar-width)); } From 08469722bb033956ebd1e9cce47ba2a15b8930b5 Mon Sep 17 00:00:00 2001 From: Marvin Rode Date: Tue, 27 Jun 2023 07:23:01 +0200 Subject: [PATCH 11/19] Get URL from API --- src/h5pEditorApi/v3/api/h5p-editor-api.ts | 24 ++++++++--------------- src/pages/H5PEditor.page.vue | 24 +++++++++++++++-------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/h5pEditorApi/v3/api/h5p-editor-api.ts b/src/h5pEditorApi/v3/api/h5p-editor-api.ts index 6124330897..cb8d33e653 100644 --- a/src/h5pEditorApi/v3/api/h5p-editor-api.ts +++ b/src/h5pEditorApi/v3/api/h5p-editor-api.ts @@ -259,18 +259,14 @@ export const H5pEditorApiAxiosParamCreator = function (configuration?: Configura }, /** * - * @param {string} language * @param {string} contentId * @param {*} [options] Override http request option. * @throws {RequiredError} */ - h5PEditorControllerGetH5PEditor: async (language: string, contentId: string, options: any = {}): Promise => { - // verify required parameter 'language' is not null or undefined - assertParamExists('h5PEditorControllerGetH5PEditor', 'language', language) + h5PEditorControllerGetH5PEditor: async (contentId: string, options: any = {}): Promise => { // verify required parameter 'contentId' is not null or undefined assertParamExists('h5PEditorControllerGetH5PEditor', 'contentId', contentId) const localVarPath = `/h5p-editor/edit/{contentId}` - .replace(`{${"language"}}`, encodeURIComponent(String(language))) .replace(`{${"contentId"}}`, encodeURIComponent(String(contentId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -567,13 +563,12 @@ export const H5pEditorApiFp = function(configuration?: Configuration) { }, /** * - * @param {string} language * @param {string} contentId * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async h5PEditorControllerGetH5PEditor(language: string, contentId: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.h5PEditorControllerGetH5PEditor(language, contentId, options); + async h5PEditorControllerGetH5PEditor(contentId: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.h5PEditorControllerGetH5PEditor(contentId, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** @@ -696,13 +691,12 @@ export const H5pEditorApiFactory = function (configuration?: Configuration, base }, /** * - * @param {string} language * @param {string} contentId * @param {*} [options] Override http request option. * @throws {RequiredError} */ - h5PEditorControllerGetH5PEditor(language: string, contentId: string, options?: any): AxiosPromise { - return localVarFp.h5PEditorControllerGetH5PEditor(language, contentId, options).then((request) => request(axios, basePath)); + h5PEditorControllerGetH5PEditor(contentId: string, options?: any): AxiosPromise { + return localVarFp.h5PEditorControllerGetH5PEditor(contentId, options).then((request) => request(axios, basePath)); }, /** * @@ -818,13 +812,12 @@ export interface H5pEditorApiInterface { /** * - * @param {string} language * @param {string} contentId * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof H5pEditorApiInterface */ - h5PEditorControllerGetH5PEditor(language: string, contentId: string, options?: any): AxiosPromise; + h5PEditorControllerGetH5PEditor(contentId: string, options?: any): AxiosPromise; /** * @@ -952,14 +945,13 @@ export class H5pEditorApi extends BaseAPI implements H5pEditorApiInterface { /** * - * @param {string} language * @param {string} contentId * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof H5pEditorApi */ - public h5PEditorControllerGetH5PEditor(language: string, contentId: string, options?: any) { - return H5pEditorApiFp(this.configuration).h5PEditorControllerGetH5PEditor(language, contentId, options).then((request) => request(this.axios, this.basePath)); + public h5PEditorControllerGetH5PEditor(contentId: string, options?: any) { + return H5pEditorApiFp(this.configuration).h5PEditorControllerGetH5PEditor(contentId, options).then((request) => request(this.axios, this.basePath)); } /** diff --git a/src/pages/H5PEditor.page.vue b/src/pages/H5PEditor.page.vue index c8b5c29e22..cb2ccd6411 100644 --- a/src/pages/H5PEditor.page.vue +++ b/src/pages/H5PEditor.page.vue @@ -14,7 +14,7 @@
-
+
- - {{ $t("common.actions.save") }} - -
-
- -
-
- + + + diff --git a/src/h5pEditorApi/v3/.openapi-generator/FILES b/src/h5pEditorApi/v3/.openapi-generator/FILES index f3c95cbb25..cc9a82c2cb 100644 --- a/src/h5pEditorApi/v3/.openapi-generator/FILES +++ b/src/h5pEditorApi/v3/.openapi-generator/FILES @@ -9,6 +9,8 @@ git_push.sh index.ts models/api-validation-error.ts models/h5-pcontent-metadata.ts +models/h5-peditor-model-content-response.ts +models/h5-peditor-model-response.ts models/h5-psave-response.ts models/index.ts models/post-h5-pcontent-create-params.ts diff --git a/src/h5pEditorApi/v3/api/h5p-editor-api.ts b/src/h5pEditorApi/v3/api/h5p-editor-api.ts index ecde9b528b..46cd006e85 100644 --- a/src/h5pEditorApi/v3/api/h5p-editor-api.ts +++ b/src/h5pEditorApi/v3/api/h5p-editor-api.ts @@ -23,6 +23,10 @@ import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } fr // @ts-ignore import { ApiValidationError } from '../models'; // @ts-ignore +import { H5PEditorModelContentResponse } from '../models'; +// @ts-ignore +import { H5PEditorModelResponse } from '../models'; +// @ts-ignore import { H5PSaveResponse } from '../models'; // @ts-ignore import { PostH5PContentCreateParams } from '../models'; @@ -214,40 +218,6 @@ export const H5pEditorApiAxiosParamCreator = function (configuration?: Configura - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Return dummy HTML for testing - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - h5PEditorControllerGetEditor: async (options: any = {}): Promise => { - const localVarPath = `/h5p-editor/{contentId}/edit`; - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - let baseOptions; - if (configuration) { - baseOptions = configuration.baseOptions; - } - - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication bearer required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration) - - - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -518,6 +488,40 @@ export const H5pEditorApiAxiosParamCreator = function (configuration?: Configura localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(postH5PContentCreateParams, localVarRequestOptions, configuration) + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary H5P tries to load the users last state; unsupported + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + h5PEditorControllerUserDataSink: async (options: any = {}): Promise => { + const localVarPath = `/h5p-editor/contentUserData/*`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication bearer required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) + + + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, @@ -584,23 +588,13 @@ export const H5pEditorApiFp = function(configuration?: Configuration) { const localVarAxiosArgs = await localVarAxiosParamCreator.h5PEditorControllerGetContentParameters(id, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, - /** - * - * @summary Return dummy HTML for testing - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async h5PEditorControllerGetEditor(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.h5PEditorControllerGetEditor(options); - return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); - }, /** * * @param {string} contentId * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async h5PEditorControllerGetH5PEditor(contentId: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async h5PEditorControllerGetH5PEditor(contentId: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.h5PEditorControllerGetH5PEditor(contentId, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -620,7 +614,7 @@ export const H5pEditorApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async h5PEditorControllerGetNewH5PEditor(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async h5PEditorControllerGetNewH5PEditor(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.h5PEditorControllerGetNewH5PEditor(options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -632,7 +626,7 @@ export const H5pEditorApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async h5PEditorControllerGetPlayer(language: string, contentId: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async h5PEditorControllerGetPlayer(language: string, contentId: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.h5PEditorControllerGetPlayer(language, contentId, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -666,6 +660,16 @@ export const H5pEditorApiFp = function(configuration?: Configuration) { const localVarAxiosArgs = await localVarAxiosParamCreator.h5PEditorControllerSaveH5pContent(contentId, postH5PContentCreateParams, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, + /** + * + * @summary H5P tries to load the users last state; unsupported + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async h5PEditorControllerUserDataSink(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.h5PEditorControllerUserDataSink(options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, } }; @@ -722,22 +726,13 @@ export const H5pEditorApiFactory = function (configuration?: Configuration, base h5PEditorControllerGetContentParameters(id: string, options?: any): AxiosPromise { return localVarFp.h5PEditorControllerGetContentParameters(id, options).then((request) => request(axios, basePath)); }, - /** - * - * @summary Return dummy HTML for testing - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - h5PEditorControllerGetEditor(options?: any): AxiosPromise { - return localVarFp.h5PEditorControllerGetEditor(options).then((request) => request(axios, basePath)); - }, /** * * @param {string} contentId * @param {*} [options] Override http request option. * @throws {RequiredError} */ - h5PEditorControllerGetH5PEditor(contentId: string, options?: any): AxiosPromise { + h5PEditorControllerGetH5PEditor(contentId: string, options?: any): AxiosPromise { return localVarFp.h5PEditorControllerGetH5PEditor(contentId, options).then((request) => request(axios, basePath)); }, /** @@ -755,7 +750,7 @@ export const H5pEditorApiFactory = function (configuration?: Configuration, base * @param {*} [options] Override http request option. * @throws {RequiredError} */ - h5PEditorControllerGetNewH5PEditor(options?: any): AxiosPromise { + h5PEditorControllerGetNewH5PEditor(options?: any): AxiosPromise { return localVarFp.h5PEditorControllerGetNewH5PEditor(options).then((request) => request(axios, basePath)); }, /** @@ -766,7 +761,7 @@ export const H5pEditorApiFactory = function (configuration?: Configuration, base * @param {*} [options] Override http request option. * @throws {RequiredError} */ - h5PEditorControllerGetPlayer(language: string, contentId: string, options?: any): AxiosPromise { + h5PEditorControllerGetPlayer(language: string, contentId: string, options?: any): AxiosPromise { return localVarFp.h5PEditorControllerGetPlayer(language, contentId, options).then((request) => request(axios, basePath)); }, /** @@ -796,6 +791,15 @@ export const H5pEditorApiFactory = function (configuration?: Configuration, base h5PEditorControllerSaveH5pContent(contentId: string, postH5PContentCreateParams: PostH5PContentCreateParams, options?: any): AxiosPromise { return localVarFp.h5PEditorControllerSaveH5pContent(contentId, postH5PContentCreateParams, options).then((request) => request(axios, basePath)); }, + /** + * + * @summary H5P tries to load the users last state; unsupported + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + h5PEditorControllerUserDataSink(options?: any): AxiosPromise { + return localVarFp.h5PEditorControllerUserDataSink(options).then((request) => request(axios, basePath)); + }, }; }; @@ -851,15 +855,6 @@ export interface H5pEditorApiInterface { */ h5PEditorControllerGetContentParameters(id: string, options?: any): AxiosPromise; - /** - * - * @summary Return dummy HTML for testing - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof H5pEditorApiInterface - */ - h5PEditorControllerGetEditor(options?: any): AxiosPromise; - /** * * @param {string} contentId @@ -867,7 +862,7 @@ export interface H5pEditorApiInterface { * @throws {RequiredError} * @memberof H5pEditorApiInterface */ - h5PEditorControllerGetH5PEditor(contentId: string, options?: any): AxiosPromise; + h5PEditorControllerGetH5PEditor(contentId: string, options?: any): AxiosPromise; /** * @@ -885,7 +880,7 @@ export interface H5pEditorApiInterface { * @throws {RequiredError} * @memberof H5pEditorApiInterface */ - h5PEditorControllerGetNewH5PEditor(options?: any): AxiosPromise; + h5PEditorControllerGetNewH5PEditor(options?: any): AxiosPromise; /** * @@ -896,7 +891,7 @@ export interface H5pEditorApiInterface { * @throws {RequiredError} * @memberof H5pEditorApiInterface */ - h5PEditorControllerGetPlayer(language: string, contentId: string, options?: any): AxiosPromise; + h5PEditorControllerGetPlayer(language: string, contentId: string, options?: any): AxiosPromise; /** * @@ -925,6 +920,15 @@ export interface H5pEditorApiInterface { */ h5PEditorControllerSaveH5pContent(contentId: string, postH5PContentCreateParams: PostH5PContentCreateParams, options?: any): AxiosPromise; + /** + * + * @summary H5P tries to load the users last state; unsupported + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof H5pEditorApiInterface + */ + h5PEditorControllerUserDataSink(options?: any): AxiosPromise; + } /** @@ -990,17 +994,6 @@ export class H5pEditorApi extends BaseAPI implements H5pEditorApiInterface { return H5pEditorApiFp(this.configuration).h5PEditorControllerGetContentParameters(id, options).then((request) => request(this.axios, this.basePath)); } - /** - * - * @summary Return dummy HTML for testing - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof H5pEditorApi - */ - public h5PEditorControllerGetEditor(options?: any) { - return H5pEditorApiFp(this.configuration).h5PEditorControllerGetEditor(options).then((request) => request(this.axios, this.basePath)); - } - /** * * @param {string} contentId @@ -1079,4 +1072,15 @@ export class H5pEditorApi extends BaseAPI implements H5pEditorApiInterface { public h5PEditorControllerSaveH5pContent(contentId: string, postH5PContentCreateParams: PostH5PContentCreateParams, options?: any) { return H5pEditorApiFp(this.configuration).h5PEditorControllerSaveH5pContent(contentId, postH5PContentCreateParams, options).then((request) => request(this.axios, this.basePath)); } + + /** + * + * @summary H5P tries to load the users last state; unsupported + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof H5pEditorApi + */ + public h5PEditorControllerUserDataSink(options?: any) { + return H5pEditorApiFp(this.configuration).h5PEditorControllerUserDataSink(options).then((request) => request(this.axios, this.basePath)); + } } diff --git a/src/h5pEditorApi/v3/models/h5-peditor-model-content-response.ts b/src/h5pEditorApi/v3/models/h5-peditor-model-content-response.ts new file mode 100644 index 0000000000..eeb06f0be7 --- /dev/null +++ b/src/h5pEditorApi/v3/models/h5-peditor-model-content-response.ts @@ -0,0 +1,61 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * HPI Schul-Cloud Server API + * This is v3 of HPI Schul-Cloud Server. Checkout /docs for v1. + * + * The version of the OpenAPI document: 3.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +/** + * + * @export + * @interface H5PEditorModelContentResponse + */ +export interface H5PEditorModelContentResponse { + /** + * + * @type {object} + * @memberof H5PEditorModelContentResponse + */ + integration: object; + /** + * + * @type {Array} + * @memberof H5PEditorModelContentResponse + */ + scripts: Array; + /** + * + * @type {Array} + * @memberof H5PEditorModelContentResponse + */ + styles: Array; + /** + * + * @type {string} + * @memberof H5PEditorModelContentResponse + */ + library: string; + /** + * + * @type {object} + * @memberof H5PEditorModelContentResponse + */ + metadata: object; + /** + * + * @type {object} + * @memberof H5PEditorModelContentResponse + */ + params: object; +} + + diff --git a/src/h5pEditorApi/v3/models/h5-peditor-model-response.ts b/src/h5pEditorApi/v3/models/h5-peditor-model-response.ts new file mode 100644 index 0000000000..cbb6f337e2 --- /dev/null +++ b/src/h5pEditorApi/v3/models/h5-peditor-model-response.ts @@ -0,0 +1,43 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * HPI Schul-Cloud Server API + * This is v3 of HPI Schul-Cloud Server. Checkout /docs for v1. + * + * The version of the OpenAPI document: 3.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +/** + * + * @export + * @interface H5PEditorModelResponse + */ +export interface H5PEditorModelResponse { + /** + * + * @type {object} + * @memberof H5PEditorModelResponse + */ + integration: object; + /** + * + * @type {Array} + * @memberof H5PEditorModelResponse + */ + scripts: Array; + /** + * + * @type {Array} + * @memberof H5PEditorModelResponse + */ + styles: Array; +} + + diff --git a/src/h5pEditorApi/v3/models/index.ts b/src/h5pEditorApi/v3/models/index.ts index 0ce919f52d..6cac259b4a 100644 --- a/src/h5pEditorApi/v3/models/index.ts +++ b/src/h5pEditorApi/v3/models/index.ts @@ -1,4 +1,6 @@ export * from './api-validation-error'; export * from './h5-pcontent-metadata'; +export * from './h5-peditor-model-content-response'; +export * from './h5-peditor-model-response'; export * from './h5-psave-response'; export * from './post-h5-pcontent-create-params'; diff --git a/src/pages/H5PEditor.page.vue b/src/pages/H5PEditor.page.vue index b7dd026908..61ef7928a0 100644 --- a/src/pages/H5PEditor.page.vue +++ b/src/pages/H5PEditor.page.vue @@ -1,25 +1,43 @@ @@ -156,7 +127,7 @@ export default defineComponent({ margin-top: var(--space-xl-3); } -.editor-iframe { +.editor { height: 100%; width: 100%; max-width: 960px; diff --git a/src/pages/H5PPlayer.page.vue b/src/pages/H5PPlayer.page.vue index e75ce00c64..ca6399822c 100644 --- a/src/pages/H5PPlayer.page.vue +++ b/src/pages/H5PPlayer.page.vue @@ -1,62 +1,70 @@ +
+ + {{ mdiChevronLeft }} + {{ $t("pages.content.index.backToCourse") }} + - +
+ +
+
+ From 5903cf6f990d92c1b3b3bd30190f0f26b7db2d83 Mon Sep 17 00:00:00 2001 From: Marvin Rode Date: Wed, 26 Jul 2023 15:43:59 +0200 Subject: [PATCH 14/19] remove iframe-resizer --- package-lock.json | 31 ------------------------------- package.json | 2 -- 2 files changed, 33 deletions(-) diff --git a/package-lock.json b/package-lock.json index a5a376f6da..ac5fcc6196 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,7 +16,6 @@ "axios": "^1.1.3", "dayjs": "^1.11.6", "flush-promises": "^1.0.2", - "iframe-resizer": "^4.3.6", "katex": "^0.12.0", "kjua": "^0.9.0", "mobile-drag-drop": "^3.0.0-rc.0", @@ -39,7 +38,6 @@ "devDependencies": { "@intlify/vue-i18n-loader": "^1.1.0", "@openapitools/openapi-generator-cli": "^2.5.2", - "@types/iframe-resizer": "^3.5.9", "@types/jest": "^27.0.1", "@types/object-hash": "^2.2.1", "@typescript-eslint/eslint-plugin": "^5.4.0", @@ -3444,12 +3442,6 @@ "@types/node": "*" } }, - "node_modules/@types/iframe-resizer": { - "version": "3.5.9", - "resolved": "https://registry.npmjs.org/@types/iframe-resizer/-/iframe-resizer-3.5.9.tgz", - "integrity": "sha512-RQUBI75F+uXruB95BFpC/8V8lPgJg4MQ6HxOCtAZYBB/h0FNCfrFfb4I+u2pZJIV7sKeszZbFqy1UnGeBMrvsA==", - "dev": true - }, "node_modules/@types/istanbul-lib-coverage": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz", @@ -10122,18 +10114,6 @@ } ] }, - "node_modules/iframe-resizer": { - "version": "4.3.6", - "resolved": "https://registry.npmjs.org/iframe-resizer/-/iframe-resizer-4.3.6.tgz", - "integrity": "sha512-wz0WodRIF6eP0oGQa5NIP1yrITAZ59ZJvVaVJqJRjaeCtfm461vy2C3us6CKx0e7pooqpIGLpVMSTzrfAjX9Sg==", - "engines": { - "node": ">=0.8.0" - }, - "funding": { - "type": "individual", - "url": "https://github.com/davidjbradshaw/iframe-resizer/blob/master/FUNDING.md" - } - }, "node_modules/ignore": { "version": "5.2.4", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", @@ -22405,12 +22385,6 @@ "@types/node": "*" } }, - "@types/iframe-resizer": { - "version": "3.5.9", - "resolved": "https://registry.npmjs.org/@types/iframe-resizer/-/iframe-resizer-3.5.9.tgz", - "integrity": "sha512-RQUBI75F+uXruB95BFpC/8V8lPgJg4MQ6HxOCtAZYBB/h0FNCfrFfb4I+u2pZJIV7sKeszZbFqy1UnGeBMrvsA==", - "dev": true - }, "@types/istanbul-lib-coverage": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz", @@ -27385,11 +27359,6 @@ "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", "dev": true }, - "iframe-resizer": { - "version": "4.3.6", - "resolved": "https://registry.npmjs.org/iframe-resizer/-/iframe-resizer-4.3.6.tgz", - "integrity": "sha512-wz0WodRIF6eP0oGQa5NIP1yrITAZ59ZJvVaVJqJRjaeCtfm461vy2C3us6CKx0e7pooqpIGLpVMSTzrfAjX9Sg==" - }, "ignore": { "version": "5.2.4", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", diff --git a/package.json b/package.json index f3e45a6c26..35a03cbb74 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,6 @@ "axios": "^1.1.3", "dayjs": "^1.11.6", "flush-promises": "^1.0.2", - "iframe-resizer": "^4.3.6", "katex": "^0.12.0", "kjua": "^0.9.0", "mobile-drag-drop": "^3.0.0-rc.0", @@ -48,7 +47,6 @@ "devDependencies": { "@intlify/vue-i18n-loader": "^1.1.0", "@openapitools/openapi-generator-cli": "^2.5.2", - "@types/iframe-resizer": "^3.5.9", "@types/jest": "^27.0.1", "@types/object-hash": "^2.2.1", "@typescript-eslint/eslint-plugin": "^5.4.0", From 4f1b638fd763504cdfc046277efa65e8fd705e5d Mon Sep 17 00:00:00 2001 From: Marvin Rode Date: Wed, 26 Jul 2023 16:27:33 +0200 Subject: [PATCH 15/19] redirect player to error page --- src/components/h5p/H5PPlayer.vue | 18 ++++++++++++------ src/pages/H5PPlayer.page.vue | 30 ++++++++++++++++++------------ 2 files changed, 30 insertions(+), 18 deletions(-) diff --git a/src/components/h5p/H5PPlayer.vue b/src/components/h5p/H5PPlayer.vue index bb5088df36..31883246af 100644 --- a/src/components/h5p/H5PPlayer.vue +++ b/src/components/h5p/H5PPlayer.vue @@ -34,18 +34,24 @@ export default defineComponent({ type: String, }, }, - setup() { + emits: ["load-error"], + setup(_props, { emit }) { const h5pPlayerRef = ref(); const playerInitialized = ref(false); const h5pEditorApi = H5pEditorApiFactory(undefined, "v3", $axios); const loadContent = async (id: string) => { - const { data } = await h5pEditorApi.h5PEditorControllerGetPlayer( - "de", - id - ); - return data; + try { + const { data } = await h5pEditorApi.h5PEditorControllerGetPlayer( + "de", + id + ); + return data; + } catch (err) { + emit("load-error", err); + throw err; + } }; watch(h5pPlayerRef, (editor) => { diff --git a/src/pages/H5PPlayer.page.vue b/src/pages/H5PPlayer.page.vue index ca6399822c..cd8f59eccc 100644 --- a/src/pages/H5PPlayer.page.vue +++ b/src/pages/H5PPlayer.page.vue @@ -14,18 +14,17 @@
- +