@kedataindo/docflow-plugins 0.0.31 → 0.0.33

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/index.d.cts CHANGED
@@ -5,6 +5,8 @@ import { Extension, Node, Editor, Mark } from '@tiptap/core';
5
5
  import { CiteEngine } from './citations.cjs';
6
6
  export { CSL_LOCALE_EN_US, CSL_STYLES, CitationAttrs, CitationCluster, CitationMode, CiteEngineOptions, CslStyleInfo, DEFAULT_CSL_STYLE, buildCitationNodes, nextCitationId, sanitizeCiteprocHtml } from './citations.cjs';
7
7
  import { PluginKey } from '@tiptap/pm/state';
8
+ import { Fragment } from '@tiptap/pm/model';
9
+ import { EditorView } from '@tiptap/pm/view';
8
10
 
9
11
  declare function getCitationEngine(editor: Editor): CiteEngine | null;
10
12
  /**
@@ -174,6 +176,46 @@ declare module '@tiptap/core' {
174
176
  declare const AIExtension: Extension<any, any>;
175
177
  declare const aiPlugin: _kedata_indonesia_docflow_core.DocsEditorPlugin;
176
178
 
179
+ /**
180
+ * Parse a markdown string into a ProseMirror `Fragment` using the editor's
181
+ * live schema.
182
+ *
183
+ * - `inline: false` keeps BLOCK structure (tables, lists, headings) — for the
184
+ * chat sidebar Insert, where a streamed answer may contain a table.
185
+ * - `inline: true` unwraps the leading paragraph so the result is inline
186
+ * content — for the inline `/ai` transform, which replaces an in-paragraph
187
+ * selection range.
188
+ *
189
+ * Returns `null` when the `tiptap-markdown` `Markdown` extension isn't
190
+ * registered; callers MUST fall back to `schema.text(md)` to keep the
191
+ * pre-markdown behavior.
192
+ */
193
+ declare function markdownToFragment(editor: Editor, markdown: string, opts: {
194
+ inline: boolean;
195
+ }): Fragment | null;
196
+ /**
197
+ * Insert BLOCK markdown at the range `[from, to)` in ONE dispatch, dispatching
198
+ * directly on `view` (NOT via `editor.commands`) so the Markdown extension's
199
+ * forced-inline `insertContentAt` override is bypassed and a table survives.
200
+ *
201
+ * Mirrors TipTap's native `insertContentAt` for HTML strings:
202
+ * 1. parse markdown → HTML → schema Fragment (block-preserving),
203
+ * 2. if the range is collapsed inside an EMPTY paragraph AND the fragment is
204
+ * all block nodes, expand the range by one on each side so the empty
205
+ * paragraph is REPLACED by the block content (no nested-in-paragraph
206
+ * block, no leftover empty line),
207
+ * 3. plain-text fast path keeps current marks (rare for markdown, but
208
+ * matches `insertText` semantics for pure-prose turns),
209
+ * 4. `tr.replaceWith` (ProseMirror's `replaceStep` splits the parent as
210
+ * needed so a block fits at an inline position),
211
+ * 5. move the selection to the end of the inserted content.
212
+ *
213
+ * Falls back to `tr.insertText(md, from, to)` when the Markdown extension
214
+ * isn't registered — preserving the pre-markdown plain-text Insert so the
215
+ * feature degrades gracefully.
216
+ */
217
+ declare function insertMarkdownBlock(editor: Editor, view: EditorView, from: number, to: number, markdown: string): void;
218
+
177
219
  /**
178
220
  * Phase 9 P9-4 — comment plugin.
179
221
  *
@@ -225,6 +267,13 @@ declare const CommentMark: Mark<any, any>;
225
267
  */
226
268
  declare const commentPlugin: DocsEditorPlugin;
227
269
 
270
+ declare const DateChipNode: Node<any, any>;
271
+ declare const PeopleChipNode: Node<any, any>;
272
+ declare const FileChipNode: Node<any, any>;
273
+ declare const DropdownChipNode: Node<any, any>;
274
+ declare const LocationChipNode: Node<any, any>;
275
+ declare const smartElementsPlugin: _kedata_indonesia_docflow_core.DocsEditorPlugin;
276
+
228
277
  /**
229
278
  * Bibliography — a fully derived block. It stores NOTHING (no attrs): the
230
279
  * node view renders the engine's citeproc-sorted entries and repaints on
@@ -257,4 +306,4 @@ declare const slashMenuPlugin: _kedata_indonesia_docflow_core.DocsEditorPlugin;
257
306
 
258
307
  declare const defaultPlugins: _kedata_indonesia_docflow_core.DocsEditorPlugin[];
259
308
 
260
- export { AIExtension, type AIPreviewState, BibliographyNode, CitationEngineExtension, CitationNode, CiteEngine, type CommentMarkAttrs, CommentMark as CommentMarkExtension, FootnoteNode, PageBreak, type PlaceholderPluginOptions, SlashMenuExtension, TocEntryNode, TocNode, TocPageNumNode, aiPlugin, aiPluginKey, alignmentPlugin, blockquotePlugin, citationPlugin, codeBlockPlugin, collectHeadings, commentPlugin, createPlaceholderPlugin, defaultPlugins, fontSizePlugin, footnotePlugin, formattingPlugin, getAIPreview, getCitationEngine, headingsPlugin, highlightPlugin, imagePlugin, linkPlugin, listsPlugin, onSlashStateChange, pageBreakPlugin, placeholderPlugin, regenerateToc, registerSlashCommands, slashMenuPlugin, slashState, tablePlugin, textColorPlugin, tocPlugin };
309
+ export { AIExtension, type AIPreviewState, BibliographyNode, CitationEngineExtension, CitationNode, CiteEngine, type CommentMarkAttrs, CommentMark as CommentMarkExtension, DateChipNode, DropdownChipNode, FileChipNode, FootnoteNode, LocationChipNode, PageBreak, PeopleChipNode, type PlaceholderPluginOptions, SlashMenuExtension, TocEntryNode, TocNode, TocPageNumNode, aiPlugin, aiPluginKey, alignmentPlugin, blockquotePlugin, citationPlugin, codeBlockPlugin, collectHeadings, commentPlugin, createPlaceholderPlugin, defaultPlugins, fontSizePlugin, footnotePlugin, formattingPlugin, getAIPreview, getCitationEngine, headingsPlugin, highlightPlugin, imagePlugin, insertMarkdownBlock, linkPlugin, listsPlugin, markdownToFragment, onSlashStateChange, pageBreakPlugin, placeholderPlugin, regenerateToc, registerSlashCommands, slashMenuPlugin, slashState, smartElementsPlugin, tablePlugin, textColorPlugin, tocPlugin };
package/dist/index.d.ts CHANGED
@@ -5,6 +5,8 @@ import { Extension, Node, Editor, Mark } from '@tiptap/core';
5
5
  import { CiteEngine } from './citations.js';
6
6
  export { CSL_LOCALE_EN_US, CSL_STYLES, CitationAttrs, CitationCluster, CitationMode, CiteEngineOptions, CslStyleInfo, DEFAULT_CSL_STYLE, buildCitationNodes, nextCitationId, sanitizeCiteprocHtml } from './citations.js';
7
7
  import { PluginKey } from '@tiptap/pm/state';
8
+ import { Fragment } from '@tiptap/pm/model';
9
+ import { EditorView } from '@tiptap/pm/view';
8
10
 
9
11
  declare function getCitationEngine(editor: Editor): CiteEngine | null;
10
12
  /**
@@ -174,6 +176,46 @@ declare module '@tiptap/core' {
174
176
  declare const AIExtension: Extension<any, any>;
175
177
  declare const aiPlugin: _kedata_indonesia_docflow_core.DocsEditorPlugin;
176
178
 
179
+ /**
180
+ * Parse a markdown string into a ProseMirror `Fragment` using the editor's
181
+ * live schema.
182
+ *
183
+ * - `inline: false` keeps BLOCK structure (tables, lists, headings) — for the
184
+ * chat sidebar Insert, where a streamed answer may contain a table.
185
+ * - `inline: true` unwraps the leading paragraph so the result is inline
186
+ * content — for the inline `/ai` transform, which replaces an in-paragraph
187
+ * selection range.
188
+ *
189
+ * Returns `null` when the `tiptap-markdown` `Markdown` extension isn't
190
+ * registered; callers MUST fall back to `schema.text(md)` to keep the
191
+ * pre-markdown behavior.
192
+ */
193
+ declare function markdownToFragment(editor: Editor, markdown: string, opts: {
194
+ inline: boolean;
195
+ }): Fragment | null;
196
+ /**
197
+ * Insert BLOCK markdown at the range `[from, to)` in ONE dispatch, dispatching
198
+ * directly on `view` (NOT via `editor.commands`) so the Markdown extension's
199
+ * forced-inline `insertContentAt` override is bypassed and a table survives.
200
+ *
201
+ * Mirrors TipTap's native `insertContentAt` for HTML strings:
202
+ * 1. parse markdown → HTML → schema Fragment (block-preserving),
203
+ * 2. if the range is collapsed inside an EMPTY paragraph AND the fragment is
204
+ * all block nodes, expand the range by one on each side so the empty
205
+ * paragraph is REPLACED by the block content (no nested-in-paragraph
206
+ * block, no leftover empty line),
207
+ * 3. plain-text fast path keeps current marks (rare for markdown, but
208
+ * matches `insertText` semantics for pure-prose turns),
209
+ * 4. `tr.replaceWith` (ProseMirror's `replaceStep` splits the parent as
210
+ * needed so a block fits at an inline position),
211
+ * 5. move the selection to the end of the inserted content.
212
+ *
213
+ * Falls back to `tr.insertText(md, from, to)` when the Markdown extension
214
+ * isn't registered — preserving the pre-markdown plain-text Insert so the
215
+ * feature degrades gracefully.
216
+ */
217
+ declare function insertMarkdownBlock(editor: Editor, view: EditorView, from: number, to: number, markdown: string): void;
218
+
177
219
  /**
178
220
  * Phase 9 P9-4 — comment plugin.
179
221
  *
@@ -225,6 +267,13 @@ declare const CommentMark: Mark<any, any>;
225
267
  */
226
268
  declare const commentPlugin: DocsEditorPlugin;
227
269
 
270
+ declare const DateChipNode: Node<any, any>;
271
+ declare const PeopleChipNode: Node<any, any>;
272
+ declare const FileChipNode: Node<any, any>;
273
+ declare const DropdownChipNode: Node<any, any>;
274
+ declare const LocationChipNode: Node<any, any>;
275
+ declare const smartElementsPlugin: _kedata_indonesia_docflow_core.DocsEditorPlugin;
276
+
228
277
  /**
229
278
  * Bibliography — a fully derived block. It stores NOTHING (no attrs): the
230
279
  * node view renders the engine's citeproc-sorted entries and repaints on
@@ -257,4 +306,4 @@ declare const slashMenuPlugin: _kedata_indonesia_docflow_core.DocsEditorPlugin;
257
306
 
258
307
  declare const defaultPlugins: _kedata_indonesia_docflow_core.DocsEditorPlugin[];
259
308
 
260
- export { AIExtension, type AIPreviewState, BibliographyNode, CitationEngineExtension, CitationNode, CiteEngine, type CommentMarkAttrs, CommentMark as CommentMarkExtension, FootnoteNode, PageBreak, type PlaceholderPluginOptions, SlashMenuExtension, TocEntryNode, TocNode, TocPageNumNode, aiPlugin, aiPluginKey, alignmentPlugin, blockquotePlugin, citationPlugin, codeBlockPlugin, collectHeadings, commentPlugin, createPlaceholderPlugin, defaultPlugins, fontSizePlugin, footnotePlugin, formattingPlugin, getAIPreview, getCitationEngine, headingsPlugin, highlightPlugin, imagePlugin, linkPlugin, listsPlugin, onSlashStateChange, pageBreakPlugin, placeholderPlugin, regenerateToc, registerSlashCommands, slashMenuPlugin, slashState, tablePlugin, textColorPlugin, tocPlugin };
309
+ export { AIExtension, type AIPreviewState, BibliographyNode, CitationEngineExtension, CitationNode, CiteEngine, type CommentMarkAttrs, CommentMark as CommentMarkExtension, DateChipNode, DropdownChipNode, FileChipNode, FootnoteNode, LocationChipNode, PageBreak, PeopleChipNode, type PlaceholderPluginOptions, SlashMenuExtension, TocEntryNode, TocNode, TocPageNumNode, aiPlugin, aiPluginKey, alignmentPlugin, blockquotePlugin, citationPlugin, codeBlockPlugin, collectHeadings, commentPlugin, createPlaceholderPlugin, defaultPlugins, fontSizePlugin, footnotePlugin, formattingPlugin, getAIPreview, getCitationEngine, headingsPlugin, highlightPlugin, imagePlugin, insertMarkdownBlock, linkPlugin, listsPlugin, markdownToFragment, onSlashStateChange, pageBreakPlugin, placeholderPlugin, regenerateToc, registerSlashCommands, slashMenuPlugin, slashState, smartElementsPlugin, tablePlugin, textColorPlugin, tocPlugin };