From 2b786a9a1451abc543db9b70ffd882706b5c4395 Mon Sep 17 00:00:00 2001 From: Reversean Date: Thu, 2 Jul 2026 15:43:34 +0300 Subject: [PATCH 1/2] refactor(paragraph): extract paragraph block tool into standalone package MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move the built-in Paragraph block tool out of core into its own publishable package, @editorjs/paragraph, versioned independently like sdk, model and dom-adapters. The source has no relative imports into core internals, so this is a plain relocation — core now depends on it as a workspace package. --- .github/workflows/paragraph.yml | 27 +++++++++++++++++ README.md | 1 + package.json | 3 +- packages/core/package.json | 1 + packages/core/src/index.ts | 3 +- packages/core/src/tools/internal/index.ts | 1 - packages/core/tsconfig.build.json | 3 ++ packages/core/tsconfig.json | 3 ++ packages/tools/paragraph/.gitignore | 24 +++++++++++++++ packages/tools/paragraph/README.md | 3 ++ packages/tools/paragraph/eslint.config.mjs | 27 +++++++++++++++++ packages/tools/paragraph/package.json | 30 +++++++++++++++++++ .../paragraph/src}/index.ts | 0 packages/tools/paragraph/tsconfig.build.json | 16 ++++++++++ packages/tools/paragraph/tsconfig.eslint.json | 14 +++++++++ packages/tools/paragraph/tsconfig.json | 30 +++++++++++++++++++ yarn.lock | 18 +++++++++++ 17 files changed, 201 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/paragraph.yml create mode 100644 packages/tools/paragraph/.gitignore create mode 100644 packages/tools/paragraph/README.md create mode 100644 packages/tools/paragraph/eslint.config.mjs create mode 100644 packages/tools/paragraph/package.json rename packages/{core/src/tools/internal/block-tools/paragraph => tools/paragraph/src}/index.ts (100%) create mode 100644 packages/tools/paragraph/tsconfig.build.json create mode 100644 packages/tools/paragraph/tsconfig.eslint.json create mode 100644 packages/tools/paragraph/tsconfig.json diff --git a/.github/workflows/paragraph.yml b/.github/workflows/paragraph.yml new file mode 100644 index 00000000..ea1e794b --- /dev/null +++ b/.github/workflows/paragraph.yml @@ -0,0 +1,27 @@ +name: Paragraph check +on: + pull_request: + merge_group: + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + - name: Run ESLint check + uses: ./.github/actions/lint + with: + package-name: '@editorjs/paragraph' + + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + - name: Build the package + uses: ./.github/actions/build + with: + package-name: '@editorjs/paragraph' diff --git a/README.md b/README.md index 638161fc..df6c578e 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ A model-driven, collaboration-ready Editor.js engine split into focused packages | [`@editorjs/dom-adapters`](packages/dom-adapters) | Binds model nodes to DOM inputs (`DOMBlockToolAdapter`, `CaretAdapter`, `FormattingAdapter`) | | [`@editorjs/collaboration-manager`](packages/collaboration-manager) | Operational transformation, batching, undo/redo, OT WebSocket client | | [`@editorjs/core`](packages/core) | Orchestrator — IoC container, plugin/tool lifecycle, `EditorAPI` | +| [`@editorjs/paragraph`](packages/tools/paragraph) | Built-in Paragraph block tool | | [`@editorjs/ui`](packages/ui) | Default UI shell (`EditorjsUI`, `BlocksUI`, `Toolbar`, `InlineToolbar`, `Toolbox`) | | [`@editorjs/ot-server`](packages/ot-server) | Standalone WebSocket OT server (`OTServer`, `DocumentManager`) | | [`playground`](packages/playground) | Vite dev sandbox for manual testing | diff --git a/package.json b/package.json index c20fc2f2..2ce74175 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,8 @@ "private": true, "packageManager": "yarn@4.0.1", "workspaces": [ - "packages/*" + "packages/*", + "packages/tools/*" ], "scripts": { "build": "yarn workspaces foreach -At run build", diff --git a/packages/core/package.json b/packages/core/package.json index 8fd20590..9743e1b0 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -45,6 +45,7 @@ "@editorjs/editorjs": "^2.30.5", "@editorjs/helpers": "^1.2.2", "@editorjs/model": "workspace:^", + "@editorjs/paragraph": "workspace:^", "@editorjs/sdk": "workspace:^", "inversify": "^8.1.0", "reflect-metadata": "^0.2.2" diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 7febcdd1..02cacae5 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -19,7 +19,8 @@ import ToolsManager from './tools/ToolsManager.js'; import type { CoreConfigValidated, CoreConfig, EditorjsPluginConstructor, BlockTuneConstructor, ToolConstructable, EditorjsAdapterPluginConstructor } from '@editorjs/sdk'; import { EditorAPI } from './api/index.js'; import { generateId } from './utils/uid.js'; -import { Paragraph, BoldInlineTool, LinkInlineTool, ItalicInlineTool } from './tools/internal'; +import { Paragraph } from '@editorjs/paragraph'; +import { BoldInlineTool, LinkInlineTool, ItalicInlineTool } from './tools/internal'; import { ShortcutsPlugin } from './plugins/ShortcutsPlugin.js'; import { DOMAdapters } from '@editorjs/dom-adapters'; import { BlocksManager } from './components/BlockManager.js'; diff --git a/packages/core/src/tools/internal/index.ts b/packages/core/src/tools/internal/index.ts index 21b0d643..f7b4d143 100644 --- a/packages/core/src/tools/internal/index.ts +++ b/packages/core/src/tools/internal/index.ts @@ -1,4 +1,3 @@ -export * from './block-tools/paragraph/index.js'; export * from './inline-tools/bold/index.js'; export * from './inline-tools/italic/index.js'; export * from './inline-tools/link/index.js'; diff --git a/packages/core/tsconfig.build.json b/packages/core/tsconfig.build.json index cffb4e3e..df3df6e2 100644 --- a/packages/core/tsconfig.build.json +++ b/packages/core/tsconfig.build.json @@ -15,6 +15,9 @@ }, { "path": "../collaboration-manager/tsconfig.build.json" + }, + { + "path": "../tools/paragraph/tsconfig.build.json" } ] } diff --git a/packages/core/tsconfig.json b/packages/core/tsconfig.json index a215aea1..65da1372 100644 --- a/packages/core/tsconfig.json +++ b/packages/core/tsconfig.json @@ -34,6 +34,9 @@ }, { "path": "../collaboration-manager/tsconfig.build.json" + }, + { + "path": "../tools/paragraph/tsconfig.build.json" } ] } diff --git a/packages/tools/paragraph/.gitignore b/packages/tools/paragraph/.gitignore new file mode 100644 index 00000000..854a697d --- /dev/null +++ b/packages/tools/paragraph/.gitignore @@ -0,0 +1,24 @@ +.yarn/* +!.yarn/patches +!.yarn/plugins +!.yarn/releases +!.yarn/sdks +!.yarn/versions + +# Swap the comments on the following lines if you don't wish to use zero-installs +# Documentation here: https://yarnpkg.com/features/zero-installs +#!.yarn/cache +#.pnp.* + +# IDE +.idea/* + +node_modules/* +dist/* + +# tests +coverage/ +reports/ + +# stryker temp files +.stryker-tmp diff --git a/packages/tools/paragraph/README.md b/packages/tools/paragraph/README.md new file mode 100644 index 00000000..0f6fd2a3 --- /dev/null +++ b/packages/tools/paragraph/README.md @@ -0,0 +1,3 @@ +# Paragraph + +Built-in Editor.js Block Tool for editing plain text paragraphs. diff --git a/packages/tools/paragraph/eslint.config.mjs b/packages/tools/paragraph/eslint.config.mjs new file mode 100644 index 00000000..d27b0622 --- /dev/null +++ b/packages/tools/paragraph/eslint.config.mjs @@ -0,0 +1,27 @@ +import CodeX from 'eslint-config-codex'; + +export default [ + ...CodeX, + { + languageOptions: { + parserOptions: { + project: './tsconfig.eslint.json', + tsconfigRootDir: import.meta.dirname, + sourceType: 'module', + }, + }, + rules: { + 'n/no-unpublished-import': ['error', { + allowModules: [ + 'eslint-config-codex', + ], + ignoreTypeImport: true, + }], + 'n/no-missing-import': 'off', + 'n/no-unsupported-features/node-builtins': ['error', { + version: '>=24.0.0', + ignores: [], + }], + }, + }, +]; diff --git a/packages/tools/paragraph/package.json b/packages/tools/paragraph/package.json new file mode 100644 index 00000000..24c27d7e --- /dev/null +++ b/packages/tools/paragraph/package.json @@ -0,0 +1,30 @@ +{ + "name": "@editorjs/paragraph", + "version": "0.0.0", + "packageManager": "yarn@4.0.1", + "main": "dist/index.js", + "types": "dist/index.d.ts", + "type": "module", + "scripts": { + "build": "yarn clear && tsc --build tsconfig.build.json", + "build:declaration": "yarn build --emitDeclarationOnly", + "lint": "eslint", + "lint:ci": "yarn lint --max-warnings 0", + "lint:fix": "yarn lint --fix", + "clear": "rm -rf dist && rm -f tsconfig.build.tsbuildinfo && rm -f tsconfig.tsbuildinfo" + }, + "devDependencies": { + "@types/eslint": "^9.6.1", + "@types/node": "^22.10.2", + "eslint": "^9.24.0", + "eslint-config-codex": "^2.0.3", + "eslint-plugin-import": "^2.31.0", + "typescript": "^5.5.4" + }, + "dependencies": { + "@codexteam/icons": "^0.3.3", + "@editorjs/dom-adapters": "workspace:^", + "@editorjs/editorjs": "^2.30.5", + "@editorjs/sdk": "workspace:^" + } +} diff --git a/packages/core/src/tools/internal/block-tools/paragraph/index.ts b/packages/tools/paragraph/src/index.ts similarity index 100% rename from packages/core/src/tools/internal/block-tools/paragraph/index.ts rename to packages/tools/paragraph/src/index.ts diff --git a/packages/tools/paragraph/tsconfig.build.json b/packages/tools/paragraph/tsconfig.build.json new file mode 100644 index 00000000..cc3d7a77 --- /dev/null +++ b/packages/tools/paragraph/tsconfig.build.json @@ -0,0 +1,16 @@ +{ + "extends": "./tsconfig.json", + "exclude": [ + "node_modules/**/*", + "dist/**/*", + "**/*.spec.ts" + ], + "references": [ + { + "path": "../../sdk/tsconfig.build.json" + }, + { + "path": "../../dom-adapters/tsconfig.build.json" + } + ] +} diff --git a/packages/tools/paragraph/tsconfig.eslint.json b/packages/tools/paragraph/tsconfig.eslint.json new file mode 100644 index 00000000..49c276af --- /dev/null +++ b/packages/tools/paragraph/tsconfig.eslint.json @@ -0,0 +1,14 @@ +{ + "compilerOptions": { + "types": ["node"], + }, + "extends": "./tsconfig.json", + "include": [ + "src/**/*", + "eslint.config.mjs", + ], + "exclude": [ + "dist/**/*", + "node_modules/**/*", + ] +} diff --git a/packages/tools/paragraph/tsconfig.json b/packages/tools/paragraph/tsconfig.json new file mode 100644 index 00000000..80b289f8 --- /dev/null +++ b/packages/tools/paragraph/tsconfig.json @@ -0,0 +1,30 @@ +{ + "compilerOptions": { + "composite": true, + "target": "esnext", + "module": "esnext", + "moduleResolution": "bundler", + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "strict": true, + "skipLibCheck": true, + "rootDir": "src", + "outDir": "dist", + "declaration": true, + "declarationMap": true, + "sourceMap": true + }, + "include": ["src/**/*"], + "exclude": [ + "node_modules/**/*", + "dist/**/*" + ], + "references": [ + { + "path": "../../sdk/tsconfig.build.json" + }, + { + "path": "../../dom-adapters/tsconfig.build.json" + } + ] +} diff --git a/yarn.lock b/yarn.lock index 922d02d5..4d09f6eb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2293,6 +2293,7 @@ __metadata: "@editorjs/editorjs": "npm:^2.30.5" "@editorjs/helpers": "npm:^1.2.2" "@editorjs/model": "workspace:^" + "@editorjs/paragraph": "workspace:^" "@editorjs/sdk": "workspace:^" "@jest/globals": "npm:^29.7.0" "@stryker-mutator/core": "npm:^7.0.2" @@ -2479,6 +2480,23 @@ __metadata: languageName: unknown linkType: soft +"@editorjs/paragraph@workspace:^, @editorjs/paragraph@workspace:packages/tools/paragraph": + version: 0.0.0-use.local + resolution: "@editorjs/paragraph@workspace:packages/tools/paragraph" + dependencies: + "@codexteam/icons": "npm:^0.3.3" + "@editorjs/dom-adapters": "workspace:^" + "@editorjs/editorjs": "npm:^2.30.5" + "@editorjs/sdk": "workspace:^" + "@types/eslint": "npm:^9.6.1" + "@types/node": "npm:^22.10.2" + eslint: "npm:^9.24.0" + eslint-config-codex: "npm:^2.0.3" + eslint-plugin-import: "npm:^2.31.0" + typescript: "npm:^5.5.4" + languageName: unknown + linkType: soft + "@editorjs/sdk@workspace:^, @editorjs/sdk@workspace:packages/sdk": version: 0.0.0-use.local resolution: "@editorjs/sdk@workspace:packages/sdk" From 2fe2dfe47eb5168f97a61fc02333da6ef826895d Mon Sep 17 00:00:00 2001 From: Reversean Date: Mon, 6 Jul 2026 23:10:37 +0300 Subject: [PATCH 2/2] docs: moved paragraph tool table entry into separate section in README --- README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index df6c578e..41b5c2ba 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,8 @@ A model-driven, collaboration-ready Editor.js engine split into focused packages ## Packages +### Base packages + | Package | Description | |---|---| | [`@editorjs/model-types`](packages/model-types) | Shared low-level types and base event classes used internally by `model` and `sdk` only — not intended for direct use by other packages or tools | @@ -22,11 +24,16 @@ A model-driven, collaboration-ready Editor.js engine split into focused packages | [`@editorjs/dom-adapters`](packages/dom-adapters) | Binds model nodes to DOM inputs (`DOMBlockToolAdapter`, `CaretAdapter`, `FormattingAdapter`) | | [`@editorjs/collaboration-manager`](packages/collaboration-manager) | Operational transformation, batching, undo/redo, OT WebSocket client | | [`@editorjs/core`](packages/core) | Orchestrator — IoC container, plugin/tool lifecycle, `EditorAPI` | -| [`@editorjs/paragraph`](packages/tools/paragraph) | Built-in Paragraph block tool | | [`@editorjs/ui`](packages/ui) | Default UI shell (`EditorjsUI`, `BlocksUI`, `Toolbar`, `InlineToolbar`, `Toolbox`) | | [`@editorjs/ot-server`](packages/ot-server) | Standalone WebSocket OT server (`OTServer`, `DocumentManager`) | | [`playground`](packages/playground) | Vite dev sandbox for manual testing | +### Tools/Plugins + +| Package | Description | +|---|---| +| [`@editorjs/paragraph`](packages/tools/paragraph) | Built-in Paragraph block tool | + ## Documentation In-depth architecture, flow, and API docs live in [`docs/`](docs/README.md).