Skip to content

Commit

Permalink
refactor: export plugin type guards as part of Editor package
Browse files Browse the repository at this point in the history
  • Loading branch information
hejtful committed Jan 9, 2025
1 parent 2351f0f commit 8180607
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 18 deletions.
3 changes: 1 addition & 2 deletions apps/web/src/components/entity/entity.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { EditorPluginType } from '@editor/package'
import { EditorPluginType, isArticleDocument } from '@editor/package'
import { isEmptyArticle } from '@editor/plugins/article/utils/static-is-empty'
import { isArticleDocument } from '@editor/types/plugin-type-guards'
import {
faExclamationCircle,
faGraduationCap,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import { isMultimediaDocument, isRowsDocument } from '@editor/package'
import { extractStringFromTextDocument } from '@editor/plugins/text/utils/static-extract-text'
import {
AnyEditorDocument,
EditorExerciseDocument,
EditorExerciseGroupDocument,
EditorRowsDocument,
} from '@editor/types/editor-plugins'
import {
isMultimediaDocument,
isRowsDocument,
} from '@editor/types/plugin-type-guards'

import { InstanceData } from '@/data-types'
import { getTranslatedType } from '@/helper/get-translated-type'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { extractStringFromTextDocument } from '@editor/plugins/text/utils/static-extract-text'
import { isEmptyTextDocument } from '@editor/plugins/text/utils/static-is-empty'
import { AnyEditorDocument } from '@editor/types/editor-plugins'
import {
isArticleIntroductionDocument,
isArticleDocument,
} from '@editor/types/plugin-type-guards'
} from '@editor/package'
import { extractStringFromTextDocument } from '@editor/plugins/text/utils/static-extract-text'
import { isEmptyTextDocument } from '@editor/plugins/text/utils/static-is-empty'
import { AnyEditorDocument } from '@editor/types/editor-plugins'

/**
* special metaDescription for articles extracted from the introduction text
Expand Down
5 changes: 1 addition & 4 deletions apps/web/src/fetcher/meta-data/get-meta-description.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import { isRowsDocument, isTextDocument } from '@editor/package'
import { extractStringFromTextDocument } from '@editor/plugins/text/utils/static-extract-text'
import { getChildrenOfStaticDocument } from '@editor/static-renderer/helper/get-children-of-static-document'
import { AnyEditorDocument } from '@editor/types/editor-plugins'
import {
isRowsDocument,
isTextDocument,
} from '@editor/types/plugin-type-guards'

export function getMetaDescription(
content?: AnyEditorDocument
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { getChildrenOfStaticDocument } from '@editor/static-renderer/helper/get-children-of-static-document'
import { AnyEditorDocument } from '@editor/types/editor-plugins'
import {
isImageDocument,
isSolutionDocument,
isTextDocument,
} from '@editor/types/plugin-type-guards'
} from '@editor/package'
import { getChildrenOfStaticDocument } from '@editor/static-renderer/helper/get-children-of-static-document'
import { AnyEditorDocument } from '@editor/types/editor-plugins'
import request from 'graphql-request'
import type { Descendant } from 'slate'

Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/pages/taxonomy/term/sort/entities/[id].tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isSolutionDocument } from '@editor/types/plugin-type-guards'
import { isSolutionDocument } from '@editor/package'
import { faGripLines, faTools } from '@fortawesome/free-solid-svg-icons'
import { DragDropContext, Draggable, Droppable } from '@hello-pangea/dnd'
import { arrayMoveImmutable } from 'array-move'
Expand Down
5 changes: 5 additions & 0 deletions packages/editor/src/package/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ export { type PluginMenuType as Plugin } from '@editor/plugins/rows/utils/plugin

export { EditorPluginType } from '@editor/types/editor-plugin-type'

/**
* Plugin state helpers and types
*/
export * from '@editor/types/plugin-type-guards'

/**
* Exported for serlo.org
*/
Expand Down

0 comments on commit 8180607

Please sign in to comment.