Skip to content

Commit 9df114e

Browse files
committed
refactor(paragraph): extract paragraph block tool into standalone package
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.
1 parent 4987d0a commit 9df114e

17 files changed

Lines changed: 200 additions & 3 deletions

File tree

.github/workflows/paragraph.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Paragraph check
2+
on:
3+
pull_request:
4+
merge_group:
5+
6+
concurrency:
7+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
8+
cancel-in-progress: true
9+
10+
jobs:
11+
lint:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v6
15+
- name: Run ESLint check
16+
uses: ./.github/actions/lint
17+
with:
18+
package-name: '@editorjs/paragraph'
19+
20+
build:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v6
24+
- name: Build the package
25+
uses: ./.github/actions/build
26+
with:
27+
package-name: '@editorjs/paragraph'

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ A model-driven, collaboration-ready Editor.js engine split into focused packages
2222
| [`@editorjs/dom-adapters`](packages/dom-adapters) | Binds model nodes to DOM inputs (`DOMBlockToolAdapter`, `CaretAdapter`, `FormattingAdapter`) |
2323
| [`@editorjs/collaboration-manager`](packages/collaboration-manager) | Operational transformation, batching, undo/redo, OT WebSocket client |
2424
| [`@editorjs/core`](packages/core) | Orchestrator — IoC container, plugin/tool lifecycle, `EditorAPI` |
25+
| [`@editorjs/paragraph`](packages/tools/paragraph) | Built-in Paragraph block tool |
2526
| [`@editorjs/ui`](packages/ui) | Default UI shell (`EditorjsUI`, `BlocksUI`, `Toolbar`, `InlineToolbar`, `Toolbox`) |
2627
| [`@editorjs/ot-server`](packages/ot-server) | Standalone WebSocket OT server (`OTServer`, `DocumentManager`) |
2728
| [`playground`](packages/playground) | Vite dev sandbox for manual testing |

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"private": true,
55
"packageManager": "yarn@4.0.1",
66
"workspaces": [
7-
"packages/*"
7+
"packages/*",
8+
"packages/tools/*"
89
],
910
"scripts": {
1011
"build": "yarn workspaces foreach -At run build",

packages/core/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
"@editorjs/editorjs": "^2.30.5",
4646
"@editorjs/helpers": "^1.2.2",
4747
"@editorjs/model": "workspace:^",
48+
"@editorjs/paragraph": "workspace:^",
4849
"@editorjs/sdk": "workspace:^",
4950
"inversify": "^8.1.0",
5051
"reflect-metadata": "^0.2.2"

packages/core/src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ import ToolsManager from './tools/ToolsManager.js';
1919
import type { CoreConfigValidated, CoreConfig, EditorjsPluginConstructor, BlockTuneConstructor, ToolConstructable, EditorjsAdapterPluginConstructor } from '@editorjs/sdk';
2020
import { EditorAPI } from './api/index.js';
2121
import { generateId } from './utils/uid.js';
22-
import { Paragraph, BoldInlineTool, LinkInlineTool, ItalicInlineTool } from './tools/internal';
22+
import { Paragraph } from '@editorjs/paragraph';
23+
import { BoldInlineTool, LinkInlineTool, ItalicInlineTool } from './tools/internal';
2324
import { ShortcutsPlugin } from './plugins/ShortcutsPlugin.js';
2425
import { DOMAdapters } from '@editorjs/dom-adapters';
2526
import { BlocksManager } from './components/BlockManager.js';
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
export * from './block-tools/paragraph/index.js';
21
export * from './inline-tools/bold/index.js';
32
export * from './inline-tools/italic/index.js';
43
export * from './inline-tools/link/index.js';

packages/core/tsconfig.build.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
},
1616
{
1717
"path": "../collaboration-manager/tsconfig.build.json"
18+
},
19+
{
20+
"path": "../tools/paragraph/tsconfig.build.json"
1821
}
1922
]
2023
}

packages/core/tsconfig.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@
3434
},
3535
{
3636
"path": "../collaboration-manager/tsconfig.build.json"
37+
},
38+
{
39+
"path": "../tools/paragraph/tsconfig.build.json"
3740
}
3841
]
3942
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
.yarn/*
2+
!.yarn/patches
3+
!.yarn/plugins
4+
!.yarn/releases
5+
!.yarn/sdks
6+
!.yarn/versions
7+
8+
# Swap the comments on the following lines if you don't wish to use zero-installs
9+
# Documentation here: https://yarnpkg.com/features/zero-installs
10+
#!.yarn/cache
11+
#.pnp.*
12+
13+
# IDE
14+
.idea/*
15+
16+
node_modules/*
17+
dist/*
18+
19+
# tests
20+
coverage/
21+
reports/
22+
23+
# stryker temp files
24+
.stryker-tmp

packages/tools/paragraph/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Paragraph
2+
3+
Built-in Editor.js Block Tool for editing plain text paragraphs.

0 commit comments

Comments
 (0)