chore: upgrade @blocknote/* to 0.51, op-blocknote-extensions to 0.1.0 (FEASIBILITY)

Feasibility-study draft showing the openproject-side consumer changes
that go with op-blocknote-extensions v0.1.0 (opf/op-blocknote-extensions
PRs #133 and #134, not yet merged):

frontend
- @blocknote/{core,mantine,react}: ^0.44.2 → ^0.51.0
- op-blocknote-extensions: v0.0.26 → v0.1.0 (URL not live yet)
- OpBlockNoteEditor.tsx: BlockNote 0.51 tightened CollaborationOptions —
  omit the whole `collaboration` block when no hocuspocusProvider is
  wired up; cast the provider at the boundary because Hocuspocus's
  `awareness: Awareness | null` doesn't match BlockNote's
  `Awareness | undefined`.

hocuspocus (extensions/op-blocknote-hocuspocus)
- @blocknote/server-util: ^0.44.2 → ^0.51.0
- @blocknote/core (dev): ^0.44.2 → ^0.51.0
- op-blocknote-extensions: v0.0.18 → v0.1.0
- openProjectApi.ts: import the static specs from the new
  `op-blocknote-extensions/server` subpath (keeps @blocknote/react out
  of Node); align schema key with the post-refactor block type
  ("openProjectWorkPackage" → "openProjectWorkPackageBlock"); register
  the inline static spec so inline work-package chips survive the
  markdown export.

Lockfiles intentionally not regenerated: the v0.1.0 GitHub URL doesn't
resolve yet. Reviewers should treat this PR as a feasibility study, not
a mergeable artefact.

Refs: https://community.openproject.org/wp/74654

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Wieland Lindenthal
2026-05-22 11:44:56 +02:00
committed by Judith Roth
parent 9993792dbf
commit aeb5e34ea1
4 changed files with 31 additions and 23 deletions
@@ -23,14 +23,14 @@
"node": ">=22.18"
},
"dependencies": {
"@blocknote/server-util": "^0.44.2",
"@blocknote/server-util": "^0.51.0",
"@hocuspocus/extension-logger": "^3.4.4",
"@hocuspocus/server": "^3.4.0",
"op-blocknote-extensions": "https://github.com/opf/op-blocknote-extensions/releases/download/v0.0.18/op-blocknote-extensions-0.0.18.tgz",
"op-blocknote-extensions": "https://github.com/opf/op-blocknote-extensions/releases/download/v0.1.0/op-blocknote-extensions-0.1.0.tgz",
"tsx": "^4.21.0"
},
"devDependencies": {
"@blocknote/core": "^0.44.2",
"@blocknote/core": "^0.51.0",
"@eslint/js": "^9.35.0",
"@eslint/json": "^1.2.0",
"@stylistic/eslint-plugin": "^5.3.1",
@@ -2,7 +2,10 @@ import { BlockNoteSchema } from "@blocknote/core";
import { ServerBlockNoteEditor } from "@blocknote/server-util";
import type { beforeHandleMessagePayload, onAuthenticatePayload, onLoadDocumentPayload, onStoreDocumentPayload, onTokenSyncPayload } from "@hocuspocus/server";
import { Extension } from "@hocuspocus/server";
import { openProjectWorkPackageStaticBlockSpec } from "op-blocknote-extensions";
import {
openProjectWorkPackageStaticBlockSpec,
openProjectWorkPackageStaticInlineSpec,
} from "op-blocknote-extensions/server";
import * as Y from "yjs";
import { TokenExpired, TokenExpiryMissing, unauthorized } from "../closeEvents";
import { decryptAndValidateToken } from "../services/tokenValidationService";
@@ -11,7 +14,10 @@ import { fetchResource } from "../services/resourceService";
export const editorSchema = BlockNoteSchema.create().extend({
blockSpecs: {
"openProjectWorkPackage": openProjectWorkPackageStaticBlockSpec(),
openProjectWorkPackageBlock: openProjectWorkPackageStaticBlockSpec(),
},
inlineContentSpecs: {
openProjectWorkPackageInline: openProjectWorkPackageStaticInlineSpec,
},
});
+4 -4
View File
@@ -75,9 +75,9 @@
"@appsignal/javascript": "^1.6.1",
"@appsignal/plugin-breadcrumbs-console": "^1.1.37",
"@appsignal/plugin-breadcrumbs-network": "^1.1.24",
"@blocknote/core": "^0.44.2",
"@blocknote/mantine": "^0.44.2",
"@blocknote/react": "^0.44.2",
"@blocknote/core": "^0.51.0",
"@blocknote/mantine": "^0.51.0",
"@blocknote/react": "^0.51.0",
"@braintree/sanitize-url": "^7.1.1",
"@datorama/akita": "^8.0.1",
"@floating-ui/dom": "^1.2.1",
@@ -158,7 +158,7 @@
"ng2-dragula": "^6.0.0",
"ngx-cookie-service": "^21.1.0",
"observable-array": "0.0.4",
"op-blocknote-extensions": "https://github.com/opf/op-blocknote-extensions/releases/download/v0.0.26/op-blocknote-extensions-0.0.26.tgz",
"op-blocknote-extensions": "https://github.com/opf/op-blocknote-extensions/releases/download/v0.1.0/op-blocknote-extensions-0.1.0.tgz",
"openapi-explorer": "^2.4.793",
"pako": "^2.0.3",
"qr-creator": "^1.0.0",
@@ -96,22 +96,24 @@ export function OpBlockNoteEditor({
}, [openProjectUrl, localeString]);
const editorParams = useMemo<Partial<BlockNoteEditorOptions<typeof schema.blockSchema, typeof schema.inlineContentSchema, typeof schema.styleSchema>>>(() => {
const baseCollaboration = {
fragment: doc.getXmlFragment('document-store'),
user: {
name: activeUser.username,
color: hocuspocusProvider ? generateRandomColor() : '#333333',
...(hocuspocusProvider && { id: activeUser.id }),
} as unknown as CollaborativeUser,
};
return {
schema,
collaboration: {
...baseCollaboration,
provider: hocuspocusProvider ?? null,
...(hocuspocusProvider && { showCursorLabels: 'activity' as const }),
},
// BlockNote 0.51 tightened `collaboration.provider` to a non-null shape
// and `awareness: Awareness | undefined` (vs Hocuspocus's
// `Awareness | null`). Omit the whole `collaboration` block when no
// provider is wired up; cast the provider at the boundary otherwise.
...(hocuspocusProvider && {
collaboration: {
fragment: doc.getXmlFragment('document-store'),
user: {
name: activeUser.username,
color: generateRandomColor(),
id: activeUser.id,
} as unknown as CollaborativeUser,
provider: hocuspocusProvider as unknown as { awareness?:NonNullable<HocuspocusProvider['awareness']> },
showCursorLabels: 'activity' as const,
},
}),
dictionary: localeDictionary,
...(attachmentsEnabled && { uploadFile }),
// When external link capture is enabled, intercept clicks on external