Skip to content

Commit 33e1eb9

Browse files
authored
Add changelog, ESLint configuration, and version updates (#14)
1 parent 7af55ca commit 33e1eb9

File tree

18 files changed

+1026
-44
lines changed

18 files changed

+1026
-44
lines changed

CHANGELOG.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [1.0.0] - 2026-01-25
9+
10+
### Added
11+
12+
#### Core Editor (`@labbs/openblock-core`)
13+
- **Public ProseMirror API** - Full access to ProseMirror internals via `editor.pm.*`
14+
- **Block-based JSON document format** - Notion-like structure with full TypeScript support
15+
- **Schema System**
16+
- Block nodes: paragraph, heading (h1-h6), blockquote, callout, codeBlock, divider, bulletList, orderedList, listItem, checkList, checkListItem, columnList, column, table, tableRow, tableCell, tableHeader, image, embed
17+
- Mark types: bold, italic, underline, strikethrough, code, link, textColor, backgroundColor
18+
- **Plugin System**
19+
- Slash menu plugin (`/` command palette)
20+
- Bubble menu plugin (floating toolbar)
21+
- Drag & drop plugin for block reordering
22+
- Table plugin with row/column manipulation
23+
- Media menu plugin for image/video controls
24+
- Keyboard shortcuts plugin
25+
- Input rules for auto-formatting (markdown shortcuts)
26+
- Block ID management plugin
27+
- Checklist plugin
28+
- Multi-block selection plugin
29+
- **Table Commands** - addRowAfter, addRowBefore, deleteRow, addColumnAfter, addColumnBefore, deleteColumn, deleteTable, goToNextCell, goToPreviousCell
30+
- **Document Operations** - getDocument, setDocument, getBlock, insertBlocks, updateBlock, removeBlocks
31+
- **Text Formatting Commands** - toggleBold, toggleItalic, toggleUnderline, toggleStrikethrough, toggleCode, setTextColor, setBackgroundColor
32+
- **History Support** - Undo/redo via ProseMirror history
33+
- **CSS Auto-injection** - Automatic style injection with opt-out support
34+
35+
#### React Package (`@labbs/openblock-react`)
36+
- **Hooks**
37+
- `useOpenBlock` - Create and manage editor instances
38+
- `useEditorContent` - Subscribe to document changes
39+
- `useEditorSelection` - Track selection changes
40+
- `useEditorFocus` - Monitor focus state
41+
- `useCustomSlashMenuItems` - Generate menu items from custom blocks
42+
- **Components**
43+
- `OpenBlockView` - Main editor view component
44+
- `SlashMenu` - Command palette UI
45+
- `BubbleMenu` - Floating formatting toolbar
46+
- `TableHandles` - Row/column manipulation handles
47+
- `TableMenu` - Table cell operations menu
48+
- `MediaMenu` - Image/video controls
49+
- `ColorPicker` - Color selection UI
50+
- `LinkPopover` - Link editing popover
51+
- **Custom Blocks API** - `createReactBlockSpec` for creating React-based custom blocks
52+
- **Custom Block Hooks** - `useBlockEditor` and `useUpdateBlock` for custom block implementations
53+
54+
### Documentation
55+
- React integration guide
56+
- Custom blocks guide
57+
- Custom marks guide
58+
- Plugins guide
59+
- Styling and theming guide
60+
- Comprehensive README with API reference
61+
62+
---
63+
64+
## [0.0.1] - 2026-01-17
65+
66+
### Added
67+
- Initial project setup
68+
- Basic editor functionality
69+
- ProseMirror integration
70+
- React bindings foundation

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@
175175

176176
END OF TERMS AND CONDITIONS
177177

178-
Copyright 2025 OpenBlock Contributors
178+
Copyright 2026 OpenBlock Contributors
179179

180180
Licensed under the Apache License, Version 2.0 (the "License");
181181
you may not use this file except in compliance with the License.

eslint.config.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import eslint from '@eslint/js';
2+
import tseslint from 'typescript-eslint';
3+
import globals from 'globals';
4+
5+
export default tseslint.config(
6+
eslint.configs.recommended,
7+
...tseslint.configs.recommended,
8+
{
9+
languageOptions: {
10+
globals: {
11+
...globals.browser,
12+
...globals.node,
13+
},
14+
},
15+
},
16+
{
17+
rules: {
18+
'@typescript-eslint/no-unused-vars': ['error', {
19+
argsIgnorePattern: '^_',
20+
varsIgnorePattern: '^_',
21+
}],
22+
'@typescript-eslint/no-explicit-any': 'warn',
23+
'@typescript-eslint/explicit-function-return-type': 'off',
24+
'@typescript-eslint/explicit-module-boundary-types': 'off',
25+
'@typescript-eslint/no-non-null-assertion': 'warn',
26+
'no-console': ['warn', { allow: ['warn', 'error'] }],
27+
'prefer-const': 'error',
28+
'no-var': 'error',
29+
},
30+
},
31+
{
32+
ignores: [
33+
'**/dist/**',
34+
'**/node_modules/**',
35+
'**/*.js',
36+
'**/*.mjs',
37+
'**/*.cjs',
38+
],
39+
}
40+
);

examples/basic/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@labbs/openblock-example-basic",
3-
"version": "0.0.1",
3+
"version": "1.0.0",
44
"private": true,
55
"type": "module",
66
"scripts": {

package.json

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,40 @@
11
{
22
"name": "openblock",
3-
"version": "0.0.1",
3+
"version": "1.0.0",
44
"private": true,
5+
"type": "module",
56
"description": "A fully open-source, framework-agnostic rich text editor built on ProseMirror",
67
"license": "Apache-2.0",
7-
"author": "OpenBlock Contributors",
8+
"author": "Labbs",
89
"repository": {
910
"type": "git",
10-
"url": "https://github.com/openblock/openblock"
11+
"url": "https://github.com/Labbs/openblock.git"
1112
},
13+
"keywords": [
14+
"editor",
15+
"rich-text",
16+
"prosemirror",
17+
"block-editor",
18+
"wysiwyg",
19+
"notion-like",
20+
"react",
21+
"typescript",
22+
"text-editor",
23+
"markdown"
24+
],
1225
"scripts": {
1326
"build": "pnpm -r build",
1427
"dev": "pnpm -r --parallel dev",
15-
"lint": "pnpm -r lint",
28+
"lint": "eslint packages/*/src",
1629
"test": "pnpm -r test",
1730
"clean": "pnpm -r clean"
1831
},
1932
"devDependencies": {
20-
"typescript": "^5.7.2"
33+
"@eslint/js": "^9.39.2",
34+
"eslint": "^9.39.2",
35+
"globals": "^17.1.0",
36+
"typescript": "^5.7.2",
37+
"typescript-eslint": "^8.53.1"
2138
},
2239
"engines": {
2340
"node": ">=18.0.0",

packages/core/package.json

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@labbs/openblock-core",
3-
"version": "0.0.1",
3+
"version": "1.0.0",
44
"description": "Framework-agnostic core for OpenBlock editor",
55
"license": "Apache-2.0",
66
"type": "module",
@@ -18,6 +18,18 @@
1818
"files": [
1919
"dist"
2020
],
21+
"keywords": [
22+
"editor",
23+
"rich-text",
24+
"prosemirror",
25+
"block-editor",
26+
"wysiwyg",
27+
"notion-like",
28+
"typescript",
29+
"text-editor",
30+
"content-editor",
31+
"document-editor"
32+
],
2133
"scripts": {
2234
"build": "vite build && cp -r src/styles dist/",
2335
"dev": "vite build --watch",
@@ -55,5 +67,9 @@
5567
"type": "git",
5668
"url": "https://github.com/Labbs/openblock.git",
5769
"directory": "packages/core"
70+
},
71+
"homepage": "https://github.com/Labbs/openblock#readme",
72+
"bugs": {
73+
"url": "https://github.com/Labbs/openblock/issues"
5874
}
5975
}

packages/core/src/blocks/nodeToBlock.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,28 +62,31 @@ export function nodeToBlock(node: PMNode): Block {
6262
}
6363
// If there are nested lists or other blocks, add as children
6464
if (node.childCount > 1) {
65-
block.children = [];
65+
const children: Block[] = [];
6666
node.forEach((child, _offset, index) => {
6767
if (index > 0) {
68-
block.children!.push(nodeToBlock(child));
68+
children.push(nodeToBlock(child));
6969
}
7070
});
71+
block.children = children;
7172
}
7273
} else if (node.type.name === 'checkListItem') {
7374
// Check list items have inline content directly (not wrapped in paragraph)
7475
block.content = nodeContentToInline(node);
7576
} else if (node.type.name === 'tableCell' || node.type.name === 'tableHeader') {
7677
// Table cells: all block children become children
77-
block.children = [];
78+
const cellChildren: Block[] = [];
7879
node.forEach((child) => {
79-
block.children!.push(nodeToBlock(child));
80+
cellChildren.push(nodeToBlock(child));
8081
});
82+
block.children = cellChildren;
8183
} else {
8284
// Lists, tables, tableRows: all children become block children
83-
block.children = [];
85+
const blockChildren: Block[] = [];
8486
node.forEach((child) => {
85-
block.children!.push(nodeToBlock(child));
87+
blockChildren.push(nodeToBlock(child));
8688
});
89+
block.children = blockChildren;
8790
}
8891
return block;
8992
}

packages/core/src/editor/Editor.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -886,10 +886,12 @@ export class OpenBlockEditor {
886886
* ```
887887
*/
888888
on<K extends keyof EditorEvents>(event: K, handler: EventHandler<EditorEvents[K]>): () => void {
889-
if (!this._listeners.has(event)) {
890-
this._listeners.set(event, new Set());
889+
let listeners = this._listeners.get(event);
890+
if (!listeners) {
891+
listeners = new Set();
892+
this._listeners.set(event, listeners);
891893
}
892-
this._listeners.get(event)!.add(handler as EventHandler<unknown>);
894+
listeners.add(handler as EventHandler<unknown>);
893895
return () => this.off(event, handler);
894896
}
895897

packages/core/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/**
2-
* @openblock/core
2+
* @labbs/openblock-core
33
*
44
* A fully open-source, framework-agnostic rich text editor built on ProseMirror.
55
* All APIs are PUBLIC - this is a core principle of OpenBlock.
66
*
77
* @example
88
* ```typescript
9-
* import { OpenBlockEditor } from '@openblock/core';
9+
* import { OpenBlockEditor } from '@labbs/openblock-core';
1010
*
1111
* const editor = new OpenBlockEditor({
1212
* element: document.getElementById('editor'),

packages/core/src/plugins/dragDropPlugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ export function createDragDropPlugin(config: DragDropConfig = {}): Plugin {
276276
}
277277

278278
// Cache for block positions to avoid repeated doc.descendants calls
279-
let blockPosCache: Map<string, number> = new Map();
279+
const blockPosCache: Map<string, number> = new Map();
280280
let lastDocVersion: number = -1;
281281

282282
/**

0 commit comments

Comments
 (0)