Skip to content

Commit

Permalink
chore(web): remove temp editor metadata wrappers
Browse files Browse the repository at this point in the history
  • Loading branch information
hejtful committed Feb 11, 2025
1 parent d3c0318 commit 8f5affa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 34 deletions.
15 changes: 2 additions & 13 deletions apps/web/src/components/entity/entity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,17 +112,6 @@ export function Entity({ data }: EntityProps) {
}

function renderContent(document: EntityData['content']) {
// TODO: Temporarily mock editorMetadata, remove after migration run
const tempDocument = {
id: '',
type: 'https://serlo.org/editor',
variant: 'serlo-org',
domainOrigin: 'serlo.org',
version: 2,
editorVersion: '0.22.0',
dateModified: new Date().toISOString(),
document,
}
const isExercise =
document &&
!Array.isArray(document) &&
Expand All @@ -134,10 +123,10 @@ export function Entity({ data }: EntityProps) {
isInExerciseGroup: false,
}}
>
<EditorRenderer document={tempDocument} />
<EditorRenderer document={document} />
</ExerciseContext.Provider>
) : (
<EditorRenderer document={tempDocument} />
<EditorRenderer document={document} />
)

if (data.schemaData?.setContentAsSection) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,29 +100,9 @@ export function convertEditorResponseToState(
): StorageFormat {
stack.push({ id: uuid.id, type: entityType })

// TODO: Temporarily mock editorMetadata, remove after migration run
const tempContent = wrapInMockEditorMetadata(content)

function wrapInMockEditorMetadata(content: string): string {
const parsedContent = parseStaticString(content)
return JSON.stringify({
id: '',
type: 'https://serlo.org/editor',
variant: 'serlo-org',
domainOrigin: 'serlo.org',
version: 2,
editorVersion: '0.22.0',
dateModified: new Date().toISOString(),
document: parsedContent ?? {
plugin: EditorPluginType.Rows,
state: {},
},
})
}

const { editorMetadata, templateContent } = unwrapEditorContent(
entityType,
tempContent
content
)

if (uuid.__typename === UuidType.Video) {
Expand Down

0 comments on commit 8f5affa

Please sign in to comment.