From 6c750b2c8c27f2287d0e5bba7ed63901e1e5b891 Mon Sep 17 00:00:00 2001 From: Vitomir Budimir Date: Thu, 9 Jan 2025 17:09:55 +0100 Subject: [PATCH] refactor: export static-is-empty as part of Editor package --- apps/web/__tests__/editor/text-static-is-empty.ts | 5 +---- apps/web/src/components/entity/entity.tsx | 7 +++++-- .../src/fetcher/meta-data/get-article-meta-description.ts | 2 +- packages/editor/src/package/index.ts | 1 + packages/editor/src/package/static-is-plugin-empty.ts | 2 ++ 5 files changed, 10 insertions(+), 7 deletions(-) create mode 100644 packages/editor/src/package/static-is-plugin-empty.ts diff --git a/apps/web/__tests__/editor/text-static-is-empty.ts b/apps/web/__tests__/editor/text-static-is-empty.ts index 83d1339069..e33d10e9e6 100644 --- a/apps/web/__tests__/editor/text-static-is-empty.ts +++ b/apps/web/__tests__/editor/text-static-is-empty.ts @@ -1,7 +1,4 @@ -import { - isEmptyCustomText, - isEmptyDescendant, -} from '@editor/plugins/text/utils/static-is-empty' +import { isEmptyCustomText, isEmptyDescendant } from '@editor/package' const text = { text: 'abc123' } const emptyText = { text: '' } diff --git a/apps/web/src/components/entity/entity.tsx b/apps/web/src/components/entity/entity.tsx index 8ad9b9315e..e5f7e50bd2 100644 --- a/apps/web/src/components/entity/entity.tsx +++ b/apps/web/src/components/entity/entity.tsx @@ -1,5 +1,8 @@ -import { EditorPluginType, isArticleDocument } from '@editor/package' -import { isEmptyArticle } from '@editor/plugins/article/utils/static-is-empty' +import { + EditorPluginType, + isArticleDocument, + isEmptyArticle, +} from '@editor/package' import { faExclamationCircle, faGraduationCap, diff --git a/apps/web/src/fetcher/meta-data/get-article-meta-description.ts b/apps/web/src/fetcher/meta-data/get-article-meta-description.ts index 6cce716c45..1636d637ad 100644 --- a/apps/web/src/fetcher/meta-data/get-article-meta-description.ts +++ b/apps/web/src/fetcher/meta-data/get-article-meta-description.ts @@ -1,9 +1,9 @@ import { isArticleIntroductionDocument, isArticleDocument, + isEmptyTextDocument, } 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' /** diff --git a/packages/editor/src/package/index.ts b/packages/editor/src/package/index.ts index ac1d1909cf..34556d744f 100644 --- a/packages/editor/src/package/index.ts +++ b/packages/editor/src/package/index.ts @@ -25,6 +25,7 @@ export { EditorPluginType } from '@editor/types/editor-plugin-type' * Plugin state helpers and types */ export * from '@editor/types/plugin-type-guards' +export * from './static-is-plugin-empty' /** * Exported for serlo.org diff --git a/packages/editor/src/package/static-is-plugin-empty.ts b/packages/editor/src/package/static-is-plugin-empty.ts new file mode 100644 index 0000000000..13bf1cb0db --- /dev/null +++ b/packages/editor/src/package/static-is-plugin-empty.ts @@ -0,0 +1,2 @@ +export * from '@editor/plugins/text/utils/static-is-empty' +export * from '@editor/plugins/article/utils/static-is-empty'