샘플
@tiptap/core 3.11.0: Editor, Extension, Node
검증된 샘플 — npm @tiptap/core 3.11.0: Editor, Extension, Node. node 22 · linux debian/x64 · docker에서 contract를 실행해 통과했습니다: Editor instantiates headless with…
sha256:670254a8f0e10d1da7cff6127eb6d6e9cb2175be694073a288aa27fb79b63959
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
MIT-0
실행 증거
선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.
- 증거 기준
- 서명된 컨트랙트 통과
- 검증 영수증
- 1
- 빌드한 서명 키
- 1
선언된 환경
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
검증 실행 환경
| 환경 | 컨트랙트 | 단계 | 실행일 |
|---|---|---|---|
| node 22 · linux debian/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22@sha256:8a34c4ab3ea2… |
2026-09-13 |
케이스
HOW- 목표
- verify pkg:npm/%40tiptap/core@3.11.0
- 심벌
-
- Editor
- Extension
- Node
- Mark
- getSchema
- findChildren
- 환경
- node 22.23.2
- 생성일
- 2026-09-13T16:10:14Z
컨트랙트
- Editor instantiates headless with custom schema defining doc, paragraph, and text nodes
- Editor parses JSON doc content and retrieves plain text and JSON representation
- Editor executes commands to insert content and triggers update events
- Extension.create creates configurable extensions with storage and custom options
- Node.create and Mark.create define schema nodes and marks
- getSchema generates ProseMirror Schema from configured extensions
- findChildren helper locates matching nodes in editor document state
- Editor tracks isEmpty status and emits destroy lifecycle event on destroy
파일
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.mjs
- test/contract.mjs
소스
Clean-room public code sample — generation instructions
Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.
A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.
Goal: verify pkg:npm/%40tiptap/core@3.11.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/%40tiptap/core@3.11.0
Rules:
- One focused purpose; the smallest project that proves the goal.
- Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
- Pin every dependency with a lockfile so resolution is reproducible.
- No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
- No personal names, emails, company names, or project identifiers of any kind.
- No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
- Keep it under 200 files and 256KB packed.
{"case":{"caseId":"case:sha256:ae77259465445394a7175c45b51fb41009ed0cc3f4d7edc1d5d7be84602e2f84","contract":["Editor instantiates headless with custom schema defining doc, paragraph, and text nodes","Editor parses JSON doc content and retrieves plain text and JSON representation","Editor executes commands to insert content and triggers update events","Extension.create creates configurable extensions with storage and custom options","Node.create and Mark.create define schema nodes and marks","getSchema generates ProseMirror Schema from configured extensions","findChildren helper locates matching nodes in editor document state","Editor tracks isEmpty status and emits destroy lifecycle event on destroy"],"goal":"verify pkg:npm/%40tiptap/core@3.11.0","kind":"HOW","packages":["pkg:npm/%40tiptap/core@3.11.0"],"schemaVersion":1,"symbols":["Editor","Extension","Node","Mark","getSchema","findChildren"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","language":"javascript","libc":"glibc","libcVersion":"2.39","moduleSystem":"esm","os":"linux","osVersionBucket":"24","packageManager":"npm","packageManagerVersion":"10.9.8","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/%40tiptap/core@3.11.0"],"schemaVersion":1,"subject":"pkg:npm/%40tiptap/core@3.11.0","symbols":["Editor","Extension","Node","Mark","getSchema","findChildren"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-tiptap-core",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-tiptap-core",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"@tiptap/core": "3.11.0"
}
},
"node_modules/@tiptap/core": {
"version": "3.11.0",
"resolved": "https://registry.npmjs.org/@tiptap/core/-/core-3.11.0.tgz",
"integrity": "sha512-kmS7ZVpHm1EMnW1Wmft9H5ZLM7E0G0NGBx+aGEHGDcNxZBXD2ZUa76CuWjIhOGpwsPbELp684ZdpF2JWoNi4Dg==",
"license": "MIT",
"funding": {
"type": "github",
"url": "https://github.com/sponsors/ueberdosis"
},
"peerDependencies": {
"@tiptap/pm": "^3.11.0"
}
},
"node_modules/@tiptap/pm": {
"version": "3.31.3",
"resolved": "https://registry.npmjs.org/@tiptap/pm/-/pm-3.31.3.tgz",
"integrity": "sha512-sZime0SWsz/k62W2WvHx5Ig7G2h7kVhrrmnqy+wEgIHfDwEfOlelRjaWCiBCFlF7dxGUntJusCh9FxlLhni0Ag==",
"license": "MIT",
"peer": true,
"dependencies": {
"prosemirror-changeset": "^2.4.1",
"prosemirror-commands": "^1.7.1",
"prosemirror-dropcursor": "^1.8.2",
"prosemirror-gapcursor": "^1.4.1",
"prosemirror-history": "^1.5.0",
"prosemirror-inputrules": "^1.5.1",
"prosemirror-keymap": "^1.2.3",
"prosemirror-model": "^1.25.11",
"prosemirror-schema-list": "^1.5.1",
"prosemirror-state": "^1.4.4",
"prosemirror-tables": "^1.8.5",
"prosemirror-transform": "^1.12.0",
"prosemirror-view": "^1.42.3"
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/ueberdosis"
}
},
"node_modules/orderedmap": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/orderedmap/-/orderedmap-2.1.1.tgz",
"integrity": "sha512-TvAWxi0nDe1j/rtMcWcIj94+Ffe6n7zhow33h40SKxmsmozs6dz/e+EajymfoFcHd7sxNn8yHM8839uixMOV6g==",
"license": "MIT",
"peer": true
},
"node_modules/prosemirror-changeset": {
"version": "2.4.2",
"resolved": "https://registry.npmjs.org/prosemirror-changeset/-/prosemirror-changeset-2.4.2.tgz",
"integrity": "sha512-ViYrjMSg3YFiXwIhKaluu+/mi3Yrxt6AR8ri14ulTaGcZtXO1CThl7A2gv79qx5fQnOw8woKwyBU2u+9PVCm3w==",
"license": "MIT",
"peer": true,
"dependencies": {
"prosemirror-transform": "^1.0.0"
}
},
"node_modules/prosemirror-commands": {
"version": "1.7.2",
"resolved": "https://registry.npmjs.org/prosemirror-commands/-/prosemirror-commands-1.7.2.tgz",
"integrity": "sha512-q6Q6szxqdu9Xd6EcdKsqXghu5nQdZTpB4Q9yd04WRc7/jt763e/rT60Owh0L1GYY+T46o5rD+9lEN36dZS43tw==",
"license": "MIT",
"peer": true,
"dependencies": {
"prosemirror-model": "^1.0.0",
"prosemirror-state": "^1.0.0",
"prosemirror-transform": "^1.10.2"
}
},
"node_modules/prosemirror-dropcursor": {
"version": "1.8.3",
"resolved": "https://registry.npmjs.org/prosemirror-dropcursor/-/prosemirror-dropcursor-1.8.3.tgz",
"integrity": "sha512-FoYbsJR8gK+DGlqhNoE29Loa38eIZPzQRIb1VMaDNBoo4OLP6vVof/jR8qFY/6XvUd6Dhug8MDCHl2a/h8RTfQ==",
"license": "MIT",
"peer": true,
"dependencies": {
"prosemirror-state": "^1.0.0",
"prosemirror-transform": "^1.1.0",
"prosemirror-view": "^1.1.0"
}
},
"node_modules/prosemirror-gapcursor": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/prosemirror-gapcursor/-/prosemirror-gapcursor-1.4.1.tgz",
"integrity": "sha512-pMdYaEnjNMSwl11yjEGtgTmLkR08m/Vl+Jj443167p9eB3HVQKhYCc4gmHVDsLPODfZfjr/MmirsdyZziXbQKw==",
"license": "MIT",
"peer": true,
"dependencies": {
"prosemirror-keymap": "^1.0.0",
"prosemirror-model": "^1.0.0",
"prosemirror-state": "^1.0.0",
"prosemirror-view": "^1.0.0"
}
},
"node_modules/prosemirror-history": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/prosemirror-history/-/prosemirror-history-1.5.0.tgz",
"integrity": "sha512-zlzTiH01eKA55UAf1MEjtssJeHnGxO0j4K4Dpx+gnmX9n+SHNlDqI2oO1Kv1iPN5B1dm5fsljCfqKF9nFL6HRg==",
"license": "MIT",
"peer": true,
"dependencies": {
"prosemirror-state": "^1.2.2",
"prosemirror-transform": "^1.0.0",
"prosemirror-view": "^1.31.0",
"rope-sequence": "^1.3.0"
}
},
"node_modules/prosemirror-inputrules": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/prosemirror-inputrules/-/prosemirror-inputrules-1.5.1.tgz",
"integrity": "sha512-7wj4uMjKaXWAQ1CDgxNzNtR9AlsuwzHfdFH1ygEHA2KHF2DOEaXl1CJfNPAKCg9qNEh4rum975QLaCiQPyY6Fw==",
"license": "MIT",
"peer": true,
"dependencies": {
"prosemirror-state": "^1.0.0",
"prosemirror-transform": "^1.0.0"
}
},
"node_modules/prosemirror-keymap": {
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/prosemirror-keymap/-/prosemirror-keymap-1.2.3.tgz",
"integrity": "sha512-4HucRlpiLd1IPQQXNqeo81BGtkY8Ai5smHhKW9jjPKRc2wQIxksg7Hl1tTI2IfT2B/LgX6bfYvXxEpJl7aKYKw==",
"license": "MIT",
"peer": true,
"dependencies": {
"prosemirror-state": "^1.0.0",
"w3c-keyname": "^2.2.0"
}
},
"node_modules/prosemirror-model": {
"version": "1.25.11",
"resolved": "https://registry.npmjs.org/prosemirror-model/-/prosemirror-model-1.25.11.tgz",
"integrity": "sha512-QWg9RhnpLlogAmp3p96uEFrE5txQpFynd4vhBAELkwgOCWQs/X0yCzB3/hrHqiPwf91RG5KyWq6553zs9JqIOQ==",
"license": "MIT",
"peer": true,
"dependencies": {
"orderedmap": "^2.0.0"
}
},
"node_modules/prosemirror-schema-list": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/prosemirror-schema-list/-/prosemirror-schema-list-1.5.1.tgz",
"integrity": "sha512-927lFx/uwyQaGwJxLWCZRkjXG0p48KpMj6ueoYiu4JX05GGuGcgzAy62dfiV8eFZftgyBUvLx76RsMe20fJl+Q==",
"license": "MIT",
"peer": true,
"dependencies": {
"prosemirror-model": "^1.0.0",
"prosemirror-state": "^1.0.0",
"prosemirror-transform": "^1.7.3"
}
},
"node_modules/prosemirror-state": {
"version": "1.4.4",
"resolved": "https://registry.npmjs.org/prosemirror-state/-/prosemirror-state-1.4.4.tgz",
"integrity": "sha512-6jiYHH2CIGbCfnxdHbXZ12gySFY/fz/ulZE333G6bPqIZ4F+TXo9ifiR86nAHpWnfoNjOb3o5ESi7J8Uz1jXHw==",
"license": "MIT",
"peer": true,
"dependencies": {
"prosemirror-model": "^1.0.0",
"prosemirror-transform": "^1.0.0",
"prosemirror-view": "^1.27.0"
}
},
"node_modules/prosemirror-tables": {
"version": "1.8.5",
"resolved": "https://registry.npmjs.org/prosemirror-tables/-/prosemirror-tables-1.8.5.tgz",
"integrity": "sha512-V/0cDCsHKHe/tfWkeCmthNUcEp1IVO3p6vwN8XtwE9PZQLAZJigbw3QoraAdfJPir4NKJtNvOB8oYGKRl+t0Dw==",
"license": "MIT",
"peer": true,
"dependencies": {
"prosemirror-keymap": "^1.2.3",
"prosemirror-model": "^1.25.4",
"prosemirror-state": "^1.4.4",
"prosemirror-transform": "^1.10.5",
"prosemirror-view": "^1.41.4"
}
},
"node_modules/prosemirror-transform": {
"version": "1.12.1",
"resolved": "https://registry.npmjs.org/prosemirror-transform/-/prosemirror-transform-1.12.1.tgz",
"integrity": "sha512-t4F5615FycnCqsX7ShTUs8+jfnwcf46kuFRvSl/3qFx2QTZ4DjgowesLHQXcFP7G//TjesqZG3WtgL7vdyVJyA==",
"license": "MIT",
"peer": true,
"dependencies": {
"prosemirror-model": "^1.21.0"
}
},
"node_modules/prosemirror-view": {
"version": "1.42.3",
"resolved": "https://registry.npmjs.org/prosemirror-view/-/prosemirror-view-1.42.3.tgz",
"integrity": "sha512-oTN7EtH+CpwxU9NrwEYWd0UZ4JUx7l048l5A2Xppm4p/60isZYLnth9QVQmC3VRIvdrIWCxwZSd+Uz791G31/w==",
"license": "MIT",
"peer": true,
"dependencies": {
"prosemirror-model": "^1.25.8",
"prosemirror-state": "^1.0.0",
"prosemirror-transform": "^1.1.0"
}
},
"node_modules/rope-sequence": {
"version": "1.3.4",
"resolved": "https://registry.npmjs.org/rope-sequence/-/rope-sequence-1.3.4.tgz",
"integrity": "sha512-UT5EDe2cu2E/6O4igUr5PSFs23nvvukicWHx6GnOPlHAiiYbzNuCRQCuiUdHJQcqKalLKlrYJnjY0ySGsXNQXQ==",
"license": "MIT",
"peer": true
},
"node_modules/w3c-keyname": {
"version": "2.2.8",
"resolved": "https://registry.npmjs.org/w3c-keyname/-/w3c-keyname-2.2.8.tgz",
"integrity": "sha512-dpojBhNsCNN7T82Tm7k26A6G9ML3NkhDsnw9n/eoxSRlVBB4CEtIQ/KTCLI2Fwf3ataSXRhYFkQi3SlnFwPvPQ==",
"license": "MIT",
"peer": true
}
}
}
{
"name": "sample-tiptap-core",
"version": "1.0.0",
"description": "Clean-room verification sample for @tiptap/core",
"type": "module",
"private": true,
"license": "MIT-0",
"scripts": {
"test": "node test/contract.mjs"
},
"dependencies": {
"@tiptap/core": "3.11.0"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/%40tiptap/core@3.11.0",
"kind": "HOW",
"packages": [
"pkg:npm/%40tiptap/core@3.11.0"
]
}
import { Editor, Extension, Node, Mark, getSchema, findChildren } from '@tiptap/core';
/**
* Creates default schema nodes required for a minimal Tiptap editor.
* @returns {Array} List of core node definitions: doc, paragraph, text
*/
export function createBaseNodes() {
const Doc = Node.create({
name: 'doc',
topNode: true,
content: 'block+',
});
const Paragraph = Node.create({
name: 'paragraph',
group: 'block',
content: 'inline*',
});
const Text = Node.create({
name: 'text',
group: 'inline',
});
return [Doc, Paragraph, Text];
}
/**
* Instantiates a headless Tiptap Editor with base schema and optional extensions.
* @param {object} [options]
* @param {Array} [options.extensions] - Additional extensions, nodes, or marks
* @param {object} [options.content] - Initial JSON document structure
* @param {Function} [options.onUpdate] - Update callback
* @returns {Editor} Initialized Editor instance
*/
export function createHeadlessEditor(options = {}) {
const baseNodes = createBaseNodes();
const extensions = [...baseNodes, ...(options.extensions || [])];
return new Editor({
extensions,
content: options.content || {
type: 'doc',
content: [
{
type: 'paragraph',
content: [],
},
],
},
onUpdate: options.onUpdate,
});
}
/**
* Builds a ProseMirror Schema from extension definitions.
* @param {Array} extensions - Array of extensions, nodes, or marks
* @returns {object} Compiled ProseMirror Schema
*/
export function buildSchema(extensions = []) {
return getSchema([...createBaseNodes(), ...extensions]);
}
import assert from 'node:assert/strict';
import { Editor, Extension, Node, Mark, getSchema, findChildren } from '@tiptap/core';
import { createBaseNodes, createHeadlessEditor, buildSchema } from '../src/index.mjs';
// 1. Editor instantiates headless with custom schema defining doc, paragraph, and text nodes
{
const [Doc, Paragraph, Text] = createBaseNodes();
assert.equal(typeof Doc, 'object', 'Doc node must be defined');
assert.equal(typeof Paragraph, 'object', 'Paragraph node must be defined');
assert.equal(typeof Text, 'object', 'Text node must be defined');
const editor = createHeadlessEditor();
assert.ok(editor instanceof Editor, 'createHeadlessEditor must return an Editor instance');
assert.ok(editor.schema.nodes.doc, 'Schema must define doc node');
assert.ok(editor.schema.nodes.paragraph, 'Schema must define paragraph node');
assert.ok(editor.schema.nodes.text, 'Schema must define text node');
editor.destroy();
}
// 2. Editor parses JSON doc content and retrieves plain text and JSON representation
{
const initialContent = {
type: 'doc',
content: [
{
type: 'paragraph',
content: [{ type: 'text', text: 'Hello, Tiptap!' }],
},
],
};
const editor = createHeadlessEditor({ content: initialContent });
assert.equal(editor.getText(), 'Hello, Tiptap!', 'getText should match provided content');
const json = editor.getJSON();
assert.equal(json.type, 'doc', 'Root JSON type must be doc');
assert.equal(json.content[0].type, 'paragraph', 'First child must be paragraph');
assert.equal(json.content[0].content[0].text, 'Hello, Tiptap!', 'Text content must match');
editor.destroy();
}
// 3. Editor executes commands to insert content and triggers update events
{
let updateCalled = false;
const editor = createHeadlessEditor({
content: {
type: 'doc',
content: [
{
type: 'paragraph',
content: [{ type: 'text', text: 'Initial' }],
},
],
},
onUpdate: () => {
updateCalled = true;
},
});
assert.equal(editor.getText(), 'Initial');
const success = editor.commands.insertContent({
type: 'text',
text: ' appended',
});
assert.ok(success, 'insertContent command should succeed');
assert.ok(updateCalled, 'onUpdate callback should be triggered on content change');
assert.ok(editor.getText().includes('Initial'), 'Editor text should contain initial content');
assert.ok(editor.getText().includes('appended'), 'Editor text should contain appended content');
editor.destroy();
}
// 4. Extension.create creates configurable extensions with storage and custom options
{
const CustomExtension = Extension.create({
name: 'customConfig',
addOptions() {
return { enabled: false, maxItems: 10 };
},
addStorage() {
return { runCount: 0 };
},
addCommands() {
return {
incrementCount: () => () => {
this.storage.runCount += 1;
return true;
},
};
},
});
const configured = CustomExtension.configure({ enabled: true, maxItems: 25 });
assert.equal(configured.options.enabled, true, 'Configured option should override default');
assert.equal(configured.options.maxItems, 25, 'Configured maxItems should override default');
const editor = createHeadlessEditor({
extensions: [configured],
});
assert.ok(editor.storage.customConfig, 'Extension storage should be accessible');
assert.equal(editor.storage.customConfig.runCount, 0, 'Initial runCount should be 0');
editor.commands.incrementCount();
assert.equal(editor.storage.customConfig.runCount, 1, 'incrementCount command should increment storage');
editor.destroy();
}
// 5. Node.create and Mark.create define schema nodes and marks
{
const CustomNode = Node.create({
name: 'customBlock',
group: 'block',
content: 'inline*',
});
const BoldMark = Mark.create({
name: 'bold',
});
assert.equal(CustomNode.name, 'customBlock', 'Node name should be customBlock');
assert.equal(BoldMark.name, 'bold', 'Mark name should be bold');
const schema = buildSchema([CustomNode, BoldMark]);
assert.ok(schema.nodes.customBlock, 'Schema should include customBlock node');
assert.ok(schema.marks.bold, 'Schema should include bold mark');
}
// 6. getSchema generates ProseMirror Schema from configured extensions
{
const schema = buildSchema();
assert.ok(schema, 'getSchema should return a schema');
assert.ok(schema.nodes.doc, 'Generated schema should contain doc node');
assert.ok(schema.nodes.paragraph, 'Generated schema should contain paragraph node');
assert.ok(schema.nodes.text, 'Generated schema should contain text node');
}
// 7. findChildren helper locates matching nodes in editor document state
{
const editor = createHeadlessEditor({
content: {
type: 'doc',
content: [
{
type: 'paragraph',
content: [{ type: 'text', text: 'First paragraph' }],
},
{
type: 'paragraph',
content: [{ type: 'text', text: 'Second paragraph' }],
},
],
},
});
const matched = findChildren(editor.state.doc, (node) => node.type.name === 'paragraph');
assert.equal(matched.length, 2, 'findChildren should find 2 paragraph nodes');
assert.equal(matched[0].node.textContent, 'First paragraph');
assert.equal(matched[1].node.textContent, 'Second paragraph');
editor.destroy();
}
// 8. Editor tracks isEmpty status and emits destroy lifecycle event on destroy
{
let destroyedEventFired = false;
const emptyEditor = createHeadlessEditor();
assert.equal(emptyEditor.isEmpty, true, 'Editor with empty paragraph should be empty');
const contentEditor = createHeadlessEditor({
content: {
type: 'doc',
content: [{ type: 'paragraph', content: [{ type: 'text', text: 'Non-empty' }] }],
},
});
assert.equal(contentEditor.isEmpty, false, 'Editor with text should not be empty');
contentEditor.on('destroy', () => {
destroyedEventFired = true;
});
contentEditor.destroy();
assert.ok(destroyedEventFired, 'destroy() should fire destroy event');
emptyEditor.destroy();
}
console.log('All contract assertions passed.');
오리진 시더
익명