@pilotiq/tiptap 3.1.1 → 3.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/PlainTextEditor.d.ts +91 -0
- package/dist/PlainTextEditor.d.ts.map +1 -0
- package/dist/PlainTextEditor.js +157 -0
- package/dist/PlainTextEditor.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/react/CollabTextRenderer.d.ts +26 -0
- package/dist/react/CollabTextRenderer.d.ts.map +1 -0
- package/dist/react/CollabTextRenderer.js +149 -0
- package/dist/react/CollabTextRenderer.js.map +1 -0
- package/dist/react/TiptapEditor.d.ts.map +1 -1
- package/dist/react/TiptapEditor.js +134 -5
- package/dist/react/TiptapEditor.js.map +1 -1
- package/dist/register.d.ts.map +1 -1
- package/dist/register.js +8 -1
- package/dist/register.js.map +1 -1
- package/package.json +3 -2
- package/src/PlainTextEditor.test.ts +158 -0
- package/src/PlainTextEditor.ts +229 -0
- package/src/index.ts +6 -0
- package/src/react/CollabTextRenderer.tsx +165 -0
- package/src/react/TiptapEditor.tsx +155 -7
- package/src/register.ts +8 -1
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plain-text editor factory — Tiptap editor config tuned to behave like a
|
|
3
|
+
* native `<input>` (single-line) or `<textarea>` (multi-line), with no marks
|
|
4
|
+
* and a Document schema restricted to paragraph(s) of inline text.
|
|
5
|
+
*
|
|
6
|
+
* Built for `@pilotiq/pilotiq`'s collab-text-field path: when collab is on,
|
|
7
|
+
* the renderer mounts a Tiptap editor instead of a native input so y-prosemirror
|
|
8
|
+
* can anchor selections to Yjs `RelativePosition` items (positional identity).
|
|
9
|
+
* This avoids the cursor-jump + concurrent-insert races inherent to the
|
|
10
|
+
* `Y.Text` + manual `computeDelta` + heuristic `preserveCursor` path.
|
|
11
|
+
*
|
|
12
|
+
* Pure config — no React. Caller passes the returned object to `useEditor` or
|
|
13
|
+
* `new Editor(...)`. Caller is also responsible for passing in the collab
|
|
14
|
+
* extension list (typically `Collaboration` + `CollaborationCursor` from the
|
|
15
|
+
* pilotiq collab adapter); we never import `@tiptap/extension-collaboration`
|
|
16
|
+
* directly so the open-core package stays free of collab peer deps.
|
|
17
|
+
*/
|
|
18
|
+
import { type AnyExtension, type EditorOptions, type Editor } from '@tiptap/core';
|
|
19
|
+
export interface PlainTextEditorOptions {
|
|
20
|
+
/** If true, allow multiple paragraphs (textarea-like). Default `false` (input-like). */
|
|
21
|
+
multiline?: boolean;
|
|
22
|
+
/** Placeholder text shown while the editor is empty. */
|
|
23
|
+
placeholder?: string;
|
|
24
|
+
/** Editable / disabled state. Default `true`. */
|
|
25
|
+
editable?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Initial textual content. Ignored when a Collaboration extension is passed
|
|
28
|
+
* via `extensions` — Collaboration takes ownership of the document and seeds
|
|
29
|
+
* from the Yjs fragment instead. Use the caller's own first-load seed (see
|
|
30
|
+
* `@pilotiq/tiptap` README) when collab is on.
|
|
31
|
+
*/
|
|
32
|
+
content?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Extra extensions to merge into the editor — typically the Collaboration +
|
|
35
|
+
* CollaborationCursor pair from the pilotiq collab adapter. Pass `[]` (or
|
|
36
|
+
* omit) for the non-collab path.
|
|
37
|
+
*/
|
|
38
|
+
extensions?: AnyExtension[];
|
|
39
|
+
/**
|
|
40
|
+
* Called on every editor update with the editor's plain-text value (blocks
|
|
41
|
+
* joined by `'\n'`). Use this to mirror the value into form-state for
|
|
42
|
+
* submission via a hidden `<input>`.
|
|
43
|
+
*/
|
|
44
|
+
onUpdate?: (text: string, editor: Editor) => void;
|
|
45
|
+
/**
|
|
46
|
+
* Single-line Enter handler. Return `true` to suppress the default blur
|
|
47
|
+
* behavior. When omitted, Enter simply blurs the editor.
|
|
48
|
+
*/
|
|
49
|
+
onSubmit?: (editor: Editor) => boolean | void;
|
|
50
|
+
/**
|
|
51
|
+
* DOM attributes for the editor's contenteditable wrapper — typically
|
|
52
|
+
* `{ class: '…tailwind classes…' }` to style the editor like the native
|
|
53
|
+
* `<input>` / `<textarea>` it replaces.
|
|
54
|
+
*/
|
|
55
|
+
editorAttributes?: Record<string, string>;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Read the editor's current value as plain text, with paragraphs joined by
|
|
59
|
+
* `'\n'`. Mirrors the behavior of `<textarea>.value`.
|
|
60
|
+
*/
|
|
61
|
+
export declare function plainTextOf(editor: Editor): string;
|
|
62
|
+
/**
|
|
63
|
+
* Convert a plain-text string into a Tiptap JSON doc that satisfies the
|
|
64
|
+
* plain-text schema. Multi-line input splits on `'\n'` into separate
|
|
65
|
+
* paragraphs; single-line strips any embedded newlines into a single run.
|
|
66
|
+
* Exported for tests — pure, no editor instance required.
|
|
67
|
+
*/
|
|
68
|
+
export declare function plainTextToDoc(text: string, multiline: boolean): {
|
|
69
|
+
type: 'doc';
|
|
70
|
+
content: Array<{
|
|
71
|
+
type: 'paragraph';
|
|
72
|
+
content?: Array<{
|
|
73
|
+
type: 'text';
|
|
74
|
+
text: string;
|
|
75
|
+
}>;
|
|
76
|
+
}>;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Build the Tiptap editor config for a plain-text field. Pass the returned
|
|
80
|
+
* object to `useEditor` (React) or `new Editor(...)` (vanilla).
|
|
81
|
+
*
|
|
82
|
+
* The editor schema is deliberately minimal:
|
|
83
|
+
* - `doc` → `paragraph` (single-line) or `paragraph+` (multi-line)
|
|
84
|
+
* - `paragraph` → `inline*`
|
|
85
|
+
* - `text` (inline)
|
|
86
|
+
*
|
|
87
|
+
* No marks, no input rules, no list items, no code blocks — just text. Pasted
|
|
88
|
+
* rich content is stripped to plain text by ProseMirror's schema enforcement.
|
|
89
|
+
*/
|
|
90
|
+
export declare function createPlainTextEditor(options?: PlainTextEditorOptions): Partial<EditorOptions>;
|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AC,CAAA;CACvF,CAmBA;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,aAAa,CAAC,CA2CxB"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plain-text editor factory — Tiptap editor config tuned to behave like a
|
|
3
|
+
* native `<input>` (single-line) or `<textarea>` (multi-line), with no marks
|
|
4
|
+
* and a Document schema restricted to paragraph(s) of inline text.
|
|
5
|
+
*
|
|
6
|
+
* Built for `@pilotiq/pilotiq`'s collab-text-field path: when collab is on,
|
|
7
|
+
* the renderer mounts a Tiptap editor instead of a native input so y-prosemirror
|
|
8
|
+
* can anchor selections to Yjs `RelativePosition` items (positional identity).
|
|
9
|
+
* This avoids the cursor-jump + concurrent-insert races inherent to the
|
|
10
|
+
* `Y.Text` + manual `computeDelta` + heuristic `preserveCursor` path.
|
|
11
|
+
*
|
|
12
|
+
* Pure config — no React. Caller passes the returned object to `useEditor` or
|
|
13
|
+
* `new Editor(...)`. Caller is also responsible for passing in the collab
|
|
14
|
+
* extension list (typically `Collaboration` + `CollaborationCursor` from the
|
|
15
|
+
* pilotiq collab adapter); we never import `@tiptap/extension-collaboration`
|
|
16
|
+
* directly so the open-core package stays free of collab peer deps.
|
|
17
|
+
*/
|
|
18
|
+
import { Node, Extension, mergeAttributes, } from '@tiptap/core';
|
|
19
|
+
import Placeholder from '@tiptap/extension-placeholder';
|
|
20
|
+
/** Block separator used by `getText` — newline matches `<textarea>.value`. */
|
|
21
|
+
const BLOCK_SEPARATOR = '\n';
|
|
22
|
+
/**
|
|
23
|
+
* Bare paragraph block — the only block the plain-text schema permits.
|
|
24
|
+
* No options, no input rules, no toggles. `inline*` content lets any inline
|
|
25
|
+
* node (today just `text`) appear inside.
|
|
26
|
+
*/
|
|
27
|
+
const PlainTextParagraph = Node.create({
|
|
28
|
+
name: 'paragraph',
|
|
29
|
+
group: 'block',
|
|
30
|
+
content: 'inline*',
|
|
31
|
+
priority: 1000,
|
|
32
|
+
parseHTML() {
|
|
33
|
+
return [{ tag: 'p' }];
|
|
34
|
+
},
|
|
35
|
+
renderHTML({ HTMLAttributes }) {
|
|
36
|
+
return ['p', mergeAttributes(HTMLAttributes), 0];
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
/** The text node — Tiptap requires this to be defined explicitly. */
|
|
40
|
+
const PlainTextText = Node.create({
|
|
41
|
+
name: 'text',
|
|
42
|
+
group: 'inline',
|
|
43
|
+
});
|
|
44
|
+
/**
|
|
45
|
+
* Build a Document node with content restricted to either a single paragraph
|
|
46
|
+
* (single-line mode) or one-or-more paragraphs (multi-line mode). The schema
|
|
47
|
+
* itself blocks paste of incompatible content — ProseMirror will coerce or
|
|
48
|
+
* reject non-matching nodes at parse time.
|
|
49
|
+
*/
|
|
50
|
+
function makePlainTextDocument(multiline) {
|
|
51
|
+
return Node.create({
|
|
52
|
+
name: 'doc',
|
|
53
|
+
topNode: true,
|
|
54
|
+
content: multiline ? 'paragraph+' : 'paragraph',
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Single-line Enter handler. Tiptap's default `Enter` keymap splits the
|
|
59
|
+
* paragraph — meaningless when the schema only allows exactly one — so we
|
|
60
|
+
* intercept and either delegate to `onSubmit` (caller-supplied) or blur.
|
|
61
|
+
*
|
|
62
|
+
* Filament's plain-text fields blur on Enter; matching that default.
|
|
63
|
+
*/
|
|
64
|
+
function makeSingleLineKeymap(onSubmit) {
|
|
65
|
+
return Extension.create({
|
|
66
|
+
name: 'plainTextSingleLineKeymap',
|
|
67
|
+
addKeyboardShortcuts() {
|
|
68
|
+
const handleEnter = () => {
|
|
69
|
+
const handled = onSubmit?.(this.editor);
|
|
70
|
+
if (handled === true)
|
|
71
|
+
return true;
|
|
72
|
+
this.editor.commands.blur();
|
|
73
|
+
return true;
|
|
74
|
+
};
|
|
75
|
+
return {
|
|
76
|
+
Enter: handleEnter,
|
|
77
|
+
'Mod-Enter': () => true,
|
|
78
|
+
'Shift-Enter': () => true,
|
|
79
|
+
};
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Read the editor's current value as plain text, with paragraphs joined by
|
|
85
|
+
* `'\n'`. Mirrors the behavior of `<textarea>.value`.
|
|
86
|
+
*/
|
|
87
|
+
export function plainTextOf(editor) {
|
|
88
|
+
return editor.getText({ blockSeparator: BLOCK_SEPARATOR });
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Convert a plain-text string into a Tiptap JSON doc that satisfies the
|
|
92
|
+
* plain-text schema. Multi-line input splits on `'\n'` into separate
|
|
93
|
+
* paragraphs; single-line strips any embedded newlines into a single run.
|
|
94
|
+
* Exported for tests — pure, no editor instance required.
|
|
95
|
+
*/
|
|
96
|
+
export function plainTextToDoc(text, multiline) {
|
|
97
|
+
if (!multiline) {
|
|
98
|
+
const flat = text.replace(/\r?\n/g, '');
|
|
99
|
+
return {
|
|
100
|
+
type: 'doc',
|
|
101
|
+
content: [
|
|
102
|
+
flat ? { type: 'paragraph', content: [{ type: 'text', text: flat }] }
|
|
103
|
+
: { type: 'paragraph' },
|
|
104
|
+
],
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
const lines = text.split(/\r?\n/);
|
|
108
|
+
return {
|
|
109
|
+
type: 'doc',
|
|
110
|
+
content: lines.map((line) => line ? { type: 'paragraph', content: [{ type: 'text', text: line }] }
|
|
111
|
+
: { type: 'paragraph' }),
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Build the Tiptap editor config for a plain-text field. Pass the returned
|
|
116
|
+
* object to `useEditor` (React) or `new Editor(...)` (vanilla).
|
|
117
|
+
*
|
|
118
|
+
* The editor schema is deliberately minimal:
|
|
119
|
+
* - `doc` → `paragraph` (single-line) or `paragraph+` (multi-line)
|
|
120
|
+
* - `paragraph` → `inline*`
|
|
121
|
+
* - `text` (inline)
|
|
122
|
+
*
|
|
123
|
+
* No marks, no input rules, no list items, no code blocks — just text. Pasted
|
|
124
|
+
* rich content is stripped to plain text by ProseMirror's schema enforcement.
|
|
125
|
+
*/
|
|
126
|
+
export function createPlainTextEditor(options = {}) {
|
|
127
|
+
const { multiline = false, placeholder, editable = true, content = '', extensions = [], onUpdate, onSubmit, editorAttributes, } = options;
|
|
128
|
+
const schema = [
|
|
129
|
+
makePlainTextDocument(multiline),
|
|
130
|
+
PlainTextParagraph,
|
|
131
|
+
PlainTextText,
|
|
132
|
+
];
|
|
133
|
+
const behavior = [];
|
|
134
|
+
if (!multiline)
|
|
135
|
+
behavior.push(makeSingleLineKeymap(onSubmit));
|
|
136
|
+
if (placeholder !== undefined) {
|
|
137
|
+
behavior.push(Placeholder.configure({ placeholder }));
|
|
138
|
+
}
|
|
139
|
+
const allExtensions = [...schema, ...behavior, ...extensions];
|
|
140
|
+
// When Collaboration owns the doc, an explicit `content` would race the
|
|
141
|
+
// Yjs sync. Caller is responsible for omitting `content` in that case; we
|
|
142
|
+
// pass it through verbatim either way.
|
|
143
|
+
const initialContent = content ? plainTextToDoc(content, multiline) : '';
|
|
144
|
+
const config = {
|
|
145
|
+
editable,
|
|
146
|
+
extensions: allExtensions,
|
|
147
|
+
content: initialContent,
|
|
148
|
+
};
|
|
149
|
+
if (onUpdate) {
|
|
150
|
+
config.onUpdate = ({ editor }) => onUpdate(plainTextOf(editor), editor);
|
|
151
|
+
}
|
|
152
|
+
if (editorAttributes) {
|
|
153
|
+
config.editorProps = { attributes: editorAttributes };
|
|
154
|
+
}
|
|
155
|
+
return config;
|
|
156
|
+
}
|
|
157
|
+
//# sourceMappingURL=PlainTextEditor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlainTextEditor.js","sourceRoot":"","sources":["../src/PlainTextEditor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EACL,IAAI,EACJ,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vD,CAAC;IACD,OAAO,MAAM,CAAA;AACf,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export { RichTextField, DEFAULT_TOOLBAR_GROUPS, DEFAULT_TEXT_COLORS, DEFAULT_HIG
|
|
|
2
2
|
export { Block, type BlockMeta } from './Block.js';
|
|
3
3
|
export { MentionProvider, type MentionItem, type MentionProviderMeta, } from './MentionProvider.js';
|
|
4
4
|
export { registerTiptap } from './register.js';
|
|
5
|
+
export { createPlainTextEditor, plainTextOf, plainTextToDoc, type PlainTextEditorOptions, } from './PlainTextEditor.js';
|
|
5
6
|
export { tiptap } from './plugin.js';
|
|
6
7
|
export { TiptapEditor } from './react/TiptapEditor.js';
|
|
7
8
|
export { AiSuggestionExtension, aiSuggestionPluginKey, upsertSuggestion, upsertSuggestions, removeSuggestion, remapSuggestions, sortForApproveAll, clampPos, type AiSuggestion, type AiSuggestionExtensionOptions, } from './extensions/AiSuggestionExtension.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,sBAAsB,EACtB,mBAAmB,EACnB,wBAAwB,EACxB,KAAK,WAAW,EAChB,KAAK,4BAA4B,EACjC,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,aAAa,GACnB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,KAAK,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAA;AAClD,OAAO,EACL,eAAe,EACf,KAAK,WAAW,EAChB,KAAK,mBAAmB,GACzB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AACtD,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O,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAA;AACxE,OAAO,EACL,oBAAoB,EACpB,eAAe,EACf,KAAK,qBAAqB,EAC1B,KAAK,UAAU,EACf,KAAK,UAAU,GAChB,MAAM,aAAa,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -2,6 +2,7 @@ export { RichTextField, DEFAULT_TOOLBAR_GROUPS, DEFAULT_TEXT_COLORS, DEFAULT_HIG
|
|
|
2
2
|
export { Block } from './Block.js';
|
|
3
3
|
export { MentionProvider, } from './MentionProvider.js';
|
|
4
4
|
export { registerTiptap } from './register.js';
|
|
5
|
+
export { createPlainTextEditor, plainTextOf, plainTextToDoc, } from './PlainTextEditor.js';
|
|
5
6
|
export { tiptap } from './plugin.js';
|
|
6
7
|
export { TiptapEditor } from './react/TiptapEditor.js';
|
|
7
8
|
export { AiSuggestionExtension, aiSuggestionPluginKey, upsertSuggestion, upsertSuggestions, removeSuggestion, remapSuggestions, sortForApproveAll, clampPos, } from './extensions/AiSuggestionExtension.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,sBAAsB,EACtB,mBAAmB,EACnB,wBAAwB,GAOzB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,KAAK,EAAkB,MAAM,YAAY,CAAA;AAClD,OAAO,EACL,eAAe,GAGhB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AACtD,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,QAAQ,GAGT,MAAM,uCAAuC,CAAA;AAC9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAA;AACxE,OAAO,EACL,oBAAoB,EACpB,eAAe,GAIhB,MAAM,aAAa,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,sBAAsB,EACtB,mBAAmB,EACnB,wBAAwB,GAOzB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,KAAK,EAAkB,MAAM,YAAY,CAAA;AAClD,OAAO,EACL,eAAe,GAGhB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EACL,qBAAqB,EACrB,WAAW,EACX,cAAc,GAEf,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AACtD,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,QAAQ,GAGT,MAAM,uCAAuC,CAAA;AAC9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAA;AACxE,OAAO,EACL,oBAAoB,EACpB,eAAe,GAIhB,MAAM,aAAa,CAAA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type CollabTextRendererProps } from '@pilotiq/pilotiq/react';
|
|
2
|
+
/**
|
|
3
|
+
* Tiptap-backed plain-text editor for pilotiq's `TextField` / `TextareaField`
|
|
4
|
+
* / similar single-line / multi-line text fields when collab is on.
|
|
5
|
+
*
|
|
6
|
+
* Lifts the cursor-bookkeeping burden off the field renderer: y-prosemirror
|
|
7
|
+
* anchors selections to `Yjs.RelativePosition` items, so concurrent and
|
|
8
|
+
* mid-word remote edits translate the local cursor correctly without any
|
|
9
|
+
* heuristic. Replaces the legacy `Y.Text` + `computeDelta` + `preserveCursor`
|
|
10
|
+
* path documented in `docs/plans/text-fields-tiptap-backed-collab.md`.
|
|
11
|
+
*
|
|
12
|
+
* Mount conditions (enforced upstream by `TextLikeInput`):
|
|
13
|
+
* - A `<RecordCollabRoom>` is mounted up-tree (`useCollabRoom() !== null`).
|
|
14
|
+
* - A collab extension factory was registered (`getCollabExtensions() !== null`).
|
|
15
|
+
* - The field hasn't opted out via `.collab(false)`.
|
|
16
|
+
* - The field is not masked (`.mask(pattern)`).
|
|
17
|
+
* - The field is top-level (not a Repeater / Builder row leaf).
|
|
18
|
+
*
|
|
19
|
+
* If either the room or the factory disappears at runtime (e.g. the plugin
|
|
20
|
+
* was never installed), we still render an editor — it's just a non-collab
|
|
21
|
+
* plain Tiptap. That's a regression vs `<input>` ergonomically but never
|
|
22
|
+
* crashes; in practice the upstream gate prevents this branch from mounting
|
|
23
|
+
* when collab isn't wired.
|
|
24
|
+
*/
|
|
25
|
+
export declare function CollabTextRenderer({ name, multiline, defaultValue, placeholder, disabled, onChange, onBlur, onSubmit, className, editorAttributes, }: CollabTextRendererProps): React.ReactElement;
|
|
26
|
+
//# sourceMappingURL=CollabTextRenderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CollabTextRenderer.d.ts","sourceRoot":"","sources":["../../src/react/CollabTextRenderer.tsx"],"names":[],"mappings":"AAGA,OAAO,EAGL,KAAK,uBAAuB,EAC7B,MAAM,wBAAwB,CAAA;AAG/B;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,IAAI,EACJ,SAAS,EACT,YAAY,EACZ,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,SAAS,EACT,gBAAgB,GACjB,EAAE,uBAAuB,GAAG,KAAK,CAAC,YAAY,CAwH9C"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
3
|
+
import { useEditor, EditorContent } from '@tiptap/react';
|
|
4
|
+
import { useCollabRoom, getCollabExtensions, } from '@pilotiq/pilotiq/react';
|
|
5
|
+
import { createPlainTextEditor, plainTextOf, plainTextToDoc } from '../PlainTextEditor.js';
|
|
6
|
+
/**
|
|
7
|
+
* Tiptap-backed plain-text editor for pilotiq's `TextField` / `TextareaField`
|
|
8
|
+
* / similar single-line / multi-line text fields when collab is on.
|
|
9
|
+
*
|
|
10
|
+
* Lifts the cursor-bookkeeping burden off the field renderer: y-prosemirror
|
|
11
|
+
* anchors selections to `Yjs.RelativePosition` items, so concurrent and
|
|
12
|
+
* mid-word remote edits translate the local cursor correctly without any
|
|
13
|
+
* heuristic. Replaces the legacy `Y.Text` + `computeDelta` + `preserveCursor`
|
|
14
|
+
* path documented in `docs/plans/text-fields-tiptap-backed-collab.md`.
|
|
15
|
+
*
|
|
16
|
+
* Mount conditions (enforced upstream by `TextLikeInput`):
|
|
17
|
+
* - A `<RecordCollabRoom>` is mounted up-tree (`useCollabRoom() !== null`).
|
|
18
|
+
* - A collab extension factory was registered (`getCollabExtensions() !== null`).
|
|
19
|
+
* - The field hasn't opted out via `.collab(false)`.
|
|
20
|
+
* - The field is not masked (`.mask(pattern)`).
|
|
21
|
+
* - The field is top-level (not a Repeater / Builder row leaf).
|
|
22
|
+
*
|
|
23
|
+
* If either the room or the factory disappears at runtime (e.g. the plugin
|
|
24
|
+
* was never installed), we still render an editor — it's just a non-collab
|
|
25
|
+
* plain Tiptap. That's a regression vs `<input>` ergonomically but never
|
|
26
|
+
* crashes; in practice the upstream gate prevents this branch from mounting
|
|
27
|
+
* when collab isn't wired.
|
|
28
|
+
*/
|
|
29
|
+
export function CollabTextRenderer({ name, multiline, defaultValue, placeholder, disabled, onChange, onBlur, onSubmit, className, editorAttributes, }) {
|
|
30
|
+
const room = useCollabRoom();
|
|
31
|
+
const factory = getCollabExtensions();
|
|
32
|
+
const collabActive = !!(room && factory);
|
|
33
|
+
// Built once per editor mount. The factory closes over the room's `ydoc`
|
|
34
|
+
// + `provider` and the field name to produce a `Collaboration` (and
|
|
35
|
+
// optional `CollaborationCursor`) extension targeting the field's
|
|
36
|
+
// `Y.XmlFragment`. Re-running on every render would tear down the editor.
|
|
37
|
+
const collabExtensions = useMemo(() => {
|
|
38
|
+
if (!collabActive || !room || !factory)
|
|
39
|
+
return [];
|
|
40
|
+
return factory({
|
|
41
|
+
ydoc: room.ydoc,
|
|
42
|
+
provider: room.provider,
|
|
43
|
+
fieldName: name,
|
|
44
|
+
...(room.user ? { user: room.user } : {}),
|
|
45
|
+
});
|
|
46
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
47
|
+
}, [collabActive]);
|
|
48
|
+
const editor = useEditor(createPlainTextEditor({
|
|
49
|
+
multiline,
|
|
50
|
+
...(placeholder !== undefined ? { placeholder } : {}),
|
|
51
|
+
editable: !disabled,
|
|
52
|
+
// When Collaboration owns the doc, omit `content` so the editor
|
|
53
|
+
// doesn't race the y-prosemirror sync. The post-`synced` effect below
|
|
54
|
+
// seeds the fragment on first connect when it's still empty. When
|
|
55
|
+
// collab is off, seed from defaultValue directly.
|
|
56
|
+
content: collabActive ? '' : defaultValue,
|
|
57
|
+
extensions: collabExtensions,
|
|
58
|
+
onUpdate: (text) => onChange(text),
|
|
59
|
+
...(onSubmit ? { onSubmit: () => { onSubmit(); return false; } } : {}),
|
|
60
|
+
...(className || editorAttributes
|
|
61
|
+
? {
|
|
62
|
+
editorAttributes: {
|
|
63
|
+
...(editorAttributes ?? {}),
|
|
64
|
+
...(className ? { class: className } : {}),
|
|
65
|
+
},
|
|
66
|
+
}
|
|
67
|
+
: {}),
|
|
68
|
+
}),
|
|
69
|
+
// Re-mount when collab toggles. Other props (multiline, name, etc) are
|
|
70
|
+
// stable per mount under the upstream gate.
|
|
71
|
+
[collabActive]);
|
|
72
|
+
// Mirror the editor's editable state with the prop. `useEditor` snapshots
|
|
73
|
+
// `editable` at first call, so we update it imperatively on changes.
|
|
74
|
+
useEffect(() => {
|
|
75
|
+
if (!editor)
|
|
76
|
+
return;
|
|
77
|
+
editor.setEditable(!disabled);
|
|
78
|
+
}, [editor, disabled]);
|
|
79
|
+
// First-load seed when collab is active. Collaboration starts the editor
|
|
80
|
+
// empty regardless of `defaultValue`; once the provider syncs the room
|
|
81
|
+
// state from the server we check whether the field's `Y.XmlFragment`
|
|
82
|
+
// was ever written. Empty + we have an initial value = first session for
|
|
83
|
+
// this record — push the SSR-rendered default into the editor once.
|
|
84
|
+
//
|
|
85
|
+
// Race caveat: two peers simultaneously mounting against a brand-new
|
|
86
|
+
// record (both seeing `fragment.length === 0`) can both seed and produce
|
|
87
|
+
// duplicated text. Same window as `TiptapEditor`'s rich-text seed path.
|
|
88
|
+
// Acceptable for now; can be tightened later via a deterministic
|
|
89
|
+
// first-writer election or a server-side seed handoff.
|
|
90
|
+
const [hasSeeded, setHasSeeded] = useState(false);
|
|
91
|
+
useEffect(() => {
|
|
92
|
+
if (!editor || !collabActive || !room || hasSeeded)
|
|
93
|
+
return;
|
|
94
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
95
|
+
const ydoc = room.ydoc;
|
|
96
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
97
|
+
const provider = room.provider;
|
|
98
|
+
if (!ydoc || !provider)
|
|
99
|
+
return;
|
|
100
|
+
const trySeed = () => {
|
|
101
|
+
try {
|
|
102
|
+
const fragment = ydoc.getXmlFragment(name);
|
|
103
|
+
if (fragment && fragment.length === 0 && defaultValue) {
|
|
104
|
+
editor.commands.setContent(plainTextToDoc(defaultValue, multiline));
|
|
105
|
+
}
|
|
106
|
+
setHasSeeded(true);
|
|
107
|
+
}
|
|
108
|
+
catch {
|
|
109
|
+
setHasSeeded(true);
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
if (provider.synced) {
|
|
113
|
+
trySeed();
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
provider.once('synced', trySeed);
|
|
117
|
+
return () => {
|
|
118
|
+
try {
|
|
119
|
+
provider.off?.('synced', trySeed);
|
|
120
|
+
}
|
|
121
|
+
catch { /* ignore */ }
|
|
122
|
+
};
|
|
123
|
+
// Seed once per editor instance — keyed remount above resets `hasSeeded`.
|
|
124
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
125
|
+
}, [editor, collabActive, room]);
|
|
126
|
+
// Bubble the editor's blur event up to the host. Tiptap exposes this via
|
|
127
|
+
// `editor.on('blur', ...)`. The simpler `onBlur` prop on `EditorContent`
|
|
128
|
+
// fires on the DOM node, but selection inside contenteditable can land on
|
|
129
|
+
// child nodes; the Tiptap event is the canonical "editor lost focus".
|
|
130
|
+
useEffect(() => {
|
|
131
|
+
if (!editor)
|
|
132
|
+
return;
|
|
133
|
+
const handler = () => onBlur();
|
|
134
|
+
editor.on('blur', handler);
|
|
135
|
+
return () => { editor.off('blur', handler); };
|
|
136
|
+
}, [editor, onBlur]);
|
|
137
|
+
// Best-effort getText safety net — onUpdate should fire on every
|
|
138
|
+
// y-prosemirror sync, but if a remote update somehow doesn't trigger
|
|
139
|
+
// `onUpdate`, the wrapper's hidden input goes stale. Re-emit on every
|
|
140
|
+
// editor render tick. No-op when text matches the last emit.
|
|
141
|
+
useEffect(() => {
|
|
142
|
+
if (!editor)
|
|
143
|
+
return;
|
|
144
|
+
onChange(plainTextOf(editor));
|
|
145
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
146
|
+
}, [editor]);
|
|
147
|
+
return _jsx(EditorContent, { editor: editor });
|
|
148
|
+
}
|
|
149
|
+
//# sourceMappingURL=CollabTextRenderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CollabTextRenderer.js","sourceRoot":"","sources":["../../src/react/CollabTextRenderer.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,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EAAyE;IACzE,yEAAyE;IACzE,0EAA0E;IAC1E,sEAAsE;IACtE,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,MAAM;YAAE,OAAM;QACnB,MAAM,OAAO,GAAG,GAAS,EAAE,CAAC,MAAM,EAAE,CAAA;QACpC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;QAC1B,OAAO,GAAG,EAAE,GAAG,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA,CAAC,CAAC,CAAA;IAC9C,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;IAEpB,iEAAiE;IACjE,qEAAqE;IACrE,sEAAsE;IACtE,6DAA6D;IAC7D,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,MAAM;YAAE,OAAM;QACnB,QAAQ,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAA;QAC7B,uDAAuD;IACzD,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAA;IAEZ,OAAO,KAAC,aAAa,IAAC,MAAM,EAAE,MAAM,GAAI,CAAA;AAC1C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TiptapEditor.d.ts","sourceRoot":"","sources":["../../src/react/TiptapEditor.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"TiptapEditor.d.ts","sourceRoot":"","sources":["../../src/react/TiptapEditor.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EACV,kBAAkB,EAGnB,MAAM,wBAAwB,CAAA;AA0B/B;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,kBAAkB,2CAqBrD"}
|