@scrider/formatter 1.1.0 → 1.3.0
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/README.md +31 -2
- package/dist/index.cjs +183 -31
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +146 -3
- package/dist/index.d.ts +146 -3
- package/dist/index.js +179 -31
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { AttributeMap, Op, Delta } from '@scrider/delta';
|
|
1
|
+
import { AttributeMap, Op, Delta, InsertOp } from '@scrider/delta';
|
|
2
2
|
export * from '@scrider/delta';
|
|
3
|
+
export { InsertOp as ContentOp } from '@scrider/delta';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* DOM Adapter Interface
|
|
@@ -1038,6 +1039,27 @@ declare const formulaFormat: Format<string>;
|
|
|
1038
1039
|
*/
|
|
1039
1040
|
declare const imageFormat: Format<string>;
|
|
1040
1041
|
|
|
1042
|
+
/**
|
|
1043
|
+
* Soft Line Break embed format
|
|
1044
|
+
*
|
|
1045
|
+
* Represents a "Shift+Enter" style line break that does NOT split the
|
|
1046
|
+
* containing block (paragraph, list item, table cell, etc.). This is the
|
|
1047
|
+
* Delta-level analogue of HTML `<br>` used as an inline line break and
|
|
1048
|
+
* of the GFM "hard break" Markdown construct (two trailing spaces + `\n`).
|
|
1049
|
+
*
|
|
1050
|
+
* Delta: `{ insert: { softBreak: true } }`
|
|
1051
|
+
* HTML: `<br data-scrider-embed>` (with the explicit marker so that
|
|
1052
|
+
* round-trip parsing can distinguish a soft break from the
|
|
1053
|
+
* placeholder `<br>` that appears inside an empty paragraph)
|
|
1054
|
+
* Markdown: ` \n` (default GFM hard break) or inline `<br>` (configurable
|
|
1055
|
+
* via `softBreakStyle` option on `deltaToMarkdown`)
|
|
1056
|
+
*
|
|
1057
|
+
* Value is always `true` — the embed has no additional data.
|
|
1058
|
+
*
|
|
1059
|
+
* @see {@link https://github.github.com/gfm/#hard-line-breaks GFM hard line break}
|
|
1060
|
+
*/
|
|
1061
|
+
declare const softBreakFormat: Format<boolean>;
|
|
1062
|
+
|
|
1041
1063
|
/**
|
|
1042
1064
|
* Video embed format
|
|
1043
1065
|
*
|
|
@@ -1556,6 +1578,34 @@ interface DeltaToMarkdownOptions {
|
|
|
1556
1578
|
* `render()` is used as HTML fallback in Markdown.
|
|
1557
1579
|
*/
|
|
1558
1580
|
registry?: Registry;
|
|
1581
|
+
/**
|
|
1582
|
+
* Rendering style for `{ softBreak: true }` embeds (Phase 7 Part 0).
|
|
1583
|
+
*
|
|
1584
|
+
* - `'spaces'` (default): GFM-canonical hard break — two trailing spaces
|
|
1585
|
+
* followed by `\n` (`" \n"`). Round-trips losslessly through remark.
|
|
1586
|
+
* - `'html'`: inline `<br>` tag. Slightly more visible in source view
|
|
1587
|
+
* and immune to editor whitespace trimming. Recommended for the
|
|
1588
|
+
* LFM (LLM-Flavored Markdown) flavour exposed by the editor's
|
|
1589
|
+
* "source" toggle.
|
|
1590
|
+
*
|
|
1591
|
+
* Does not affect how soft breaks are rendered inside table cells —
|
|
1592
|
+
* those always use inline `<br>` because GFM tables forbid raw `\n`.
|
|
1593
|
+
*
|
|
1594
|
+
* @default 'spaces'
|
|
1595
|
+
*/
|
|
1596
|
+
softBreakStyle?: 'spaces' | 'html';
|
|
1597
|
+
/**
|
|
1598
|
+
* Strip trailing newlines from the final output.
|
|
1599
|
+
*
|
|
1600
|
+
* Useful when serialising a single block (e.g. one table for inline
|
|
1601
|
+
* editing) where the GFM padding (blank line after a table, trailing
|
|
1602
|
+
* paragraph newline, etc.) is not wanted. The internal structure of the
|
|
1603
|
+
* markdown is unaffected — only trailing `\n+` at the very end of the
|
|
1604
|
+
* returned string is removed.
|
|
1605
|
+
*
|
|
1606
|
+
* @default false
|
|
1607
|
+
*/
|
|
1608
|
+
trimTrailingNewlines?: boolean;
|
|
1559
1609
|
}
|
|
1560
1610
|
/**
|
|
1561
1611
|
* Convert Delta to Markdown
|
|
@@ -1661,9 +1711,39 @@ interface ParserContext {
|
|
|
1661
1711
|
pushNewline(attrs?: AttributeMap): void;
|
|
1662
1712
|
}
|
|
1663
1713
|
/**
|
|
1664
|
-
* Check if remark is available
|
|
1714
|
+
* Check if remark is available for synchronous use.
|
|
1715
|
+
*
|
|
1716
|
+
* Returns true if either:
|
|
1717
|
+
* - remark modules have been preloaded (via {@link preloadRemark} or a prior
|
|
1718
|
+
* `markdownToDelta` / `markdownToDeltaSync` call), OR
|
|
1719
|
+
* - CommonJS `require()` is available and can resolve `unified` and
|
|
1720
|
+
* `remark-parse` (Node.js without ESM-only mode).
|
|
1721
|
+
*
|
|
1722
|
+
* In browser ESM environments where `require` is undefined, this returns
|
|
1723
|
+
* `false` until {@link preloadRemark} has been awaited at least once.
|
|
1665
1724
|
*/
|
|
1666
1725
|
declare function isRemarkAvailable(): boolean;
|
|
1726
|
+
/**
|
|
1727
|
+
* Preload remark modules (`unified`, `remark-parse`, `remark-gfm`, optionally
|
|
1728
|
+
* `remark-math`) asynchronously. After this resolves successfully, the
|
|
1729
|
+
* synchronous {@link markdownToDeltaSync} is usable in environments where
|
|
1730
|
+
* `require()` is not available (e.g. browser ESM).
|
|
1731
|
+
*
|
|
1732
|
+
* Safe to call multiple times: subsequent calls short-circuit if modules are
|
|
1733
|
+
* already loaded.
|
|
1734
|
+
*
|
|
1735
|
+
* @returns `true` if mandatory modules (`unified`, `remark-parse`,
|
|
1736
|
+
* `remark-gfm`) are now loaded; `false` if any required module is missing.
|
|
1737
|
+
* The function never throws — callers can branch on the boolean for
|
|
1738
|
+
* graceful degradation.
|
|
1739
|
+
*
|
|
1740
|
+
* @example
|
|
1741
|
+
* // On editor mount:
|
|
1742
|
+
* useEffect(() => {
|
|
1743
|
+
* preloadRemark();
|
|
1744
|
+
* }, []);
|
|
1745
|
+
*/
|
|
1746
|
+
declare function preloadRemark(): Promise<boolean>;
|
|
1667
1747
|
/**
|
|
1668
1748
|
* Convert Markdown to Delta (async)
|
|
1669
1749
|
*/
|
|
@@ -1673,4 +1753,67 @@ declare function markdownToDelta(markdown: string, options?: MarkdownToDeltaOpti
|
|
|
1673
1753
|
*/
|
|
1674
1754
|
declare function markdownToDeltaSync(markdown: string, options?: MarkdownToDeltaOptions): Delta;
|
|
1675
1755
|
|
|
1676
|
-
|
|
1756
|
+
/**
|
|
1757
|
+
* Simple-table region detection in flat Delta.
|
|
1758
|
+
*
|
|
1759
|
+
* Helpers for callers (e.g. editors that need to find the boundaries of a
|
|
1760
|
+
* markdown-style table within a Delta op stream — for example to enter
|
|
1761
|
+
* "edit as markdown source" mode on double-click of a rendered table cell).
|
|
1762
|
+
*
|
|
1763
|
+
* A simple-table region is a contiguous run of ops that ends, for each cell,
|
|
1764
|
+
* with a `\n`-op carrying the `table-row` attribute (the standard format
|
|
1765
|
+
* produced by {@link markdownToDelta} for GFM tables and consumed by
|
|
1766
|
+
* {@link deltaToMarkdown}).
|
|
1767
|
+
*/
|
|
1768
|
+
|
|
1769
|
+
/**
|
|
1770
|
+
* Detected boundaries of a simple-table region.
|
|
1771
|
+
*/
|
|
1772
|
+
interface TableRegion {
|
|
1773
|
+
/** Inclusive start index in the original ops array. */
|
|
1774
|
+
startOpIdx: number;
|
|
1775
|
+
/**
|
|
1776
|
+
* Inclusive end index — always points at the last `\n`-op of the table
|
|
1777
|
+
* (the terminator of the last cell of the last row).
|
|
1778
|
+
*/
|
|
1779
|
+
endOpIdx: number;
|
|
1780
|
+
/** Slice of the original ops array covering the region. */
|
|
1781
|
+
ops: InsertOp[];
|
|
1782
|
+
}
|
|
1783
|
+
/**
|
|
1784
|
+
* Predicate: this op is a `\n`-op that terminates a simple-table cell
|
|
1785
|
+
* (i.e. it carries a `table-row` attribute).
|
|
1786
|
+
*/
|
|
1787
|
+
declare function isTableNewlineOp(op: Op | undefined): boolean;
|
|
1788
|
+
/**
|
|
1789
|
+
* Find the boundaries of the simple-table region containing the given hint
|
|
1790
|
+
* op index. The hint may be:
|
|
1791
|
+
* - an inline op inside a cell,
|
|
1792
|
+
* - the cell-terminating `\n`-op itself,
|
|
1793
|
+
* - any op between two table newlines.
|
|
1794
|
+
*
|
|
1795
|
+
* The function walks **forward** from the hint to find the nearest `\n`-op:
|
|
1796
|
+
* if it does not carry a `table-row` attribute, the hint is not inside a
|
|
1797
|
+
* table and `null` is returned. Otherwise the algorithm extends the region
|
|
1798
|
+
* forward through contiguous table newlines and backward to the op just
|
|
1799
|
+
* after the previous non-table `\n`-op (or the start of the array).
|
|
1800
|
+
*
|
|
1801
|
+
* @param ops - The full ops array (e.g. `delta.ops`).
|
|
1802
|
+
* @param hintOpIdx - Any op index known or guessed to be within a table.
|
|
1803
|
+
* @returns The detected region, or `null` if `hintOpIdx` is out of range or
|
|
1804
|
+
* not within any simple-table region.
|
|
1805
|
+
*
|
|
1806
|
+
* @example
|
|
1807
|
+
* // After hit-testing a `<td>` element to a Delta op index:
|
|
1808
|
+
* const region = extractTableRegion(state.delta.ops, hitOpIdx);
|
|
1809
|
+
* if (region) {
|
|
1810
|
+
* const md = deltaToMarkdown(new Delta(region.ops), {
|
|
1811
|
+
* trimTrailingNewlines: true,
|
|
1812
|
+
* });
|
|
1813
|
+
* // replace ops in [region.startOpIdx, region.endOpIdx] with a single
|
|
1814
|
+
* // { insert: md + '\n' } op to enter source-edit mode
|
|
1815
|
+
* }
|
|
1816
|
+
*/
|
|
1817
|
+
declare function extractTableRegion(ops: readonly Op[], hintOpIdx: number): TableRegion | null;
|
|
1818
|
+
|
|
1819
|
+
export { ALERT_TYPES, type AlertBlockData, type AlertType, type AlignType, BOX_FLOAT_VALUES, BOX_OVERFLOW_VALUES, type BlockContext, type BlockHandler, BlockHandlerRegistry, type BlockRenderOptions, type BoxBlockData, type BoxFloat, type BoxOpAttributes, type BoxOverflow, BrowserDOMAdapter, type CellAlign, type CellData, type ColumnsBlockData, type DOMAdapter, type DOMDocument, type DOMDocumentFragment, type DOMElement, type DOMNode, type DOMNodeList, type DeltaToHtmlOptions, type DeltaToMarkdownOptions, type FootnotesBlockData, type Format, type FormatDefinition, type FormatMatchResult, type FormatScope, type HtmlToDeltaOptions, type ListType, type MarkdownToDeltaOptions, NODE_TYPE, NodeDOMAdapter, Registry, type SanitizeOptions, type TableBlockData, type TableColAlignType, type TableRegion, alertBlockHandler, alignFormat, backgroundFormat, blockFormat, blockquoteFormat, boldFormat, boxBlockHandler, browserAdapter, cloneDelta, codeBlockFormat, codeFormat, colorFormat, columnsBlockHandler, createDefaultBlockHandlers, createDefaultRegistry, defaultBlockFormats, defaultEmbedFormats, defaultFormats, defaultInlineFormats, deltaToHtml, deltaToMarkdown, dividerFormat, escapeHtml, extractBoxOpAttributes, extractTableRegion, fontFormat, footnoteRefFormat, footnotesBlockHandler, formulaFormat, getAdapter, getNamedColors, headerFormat, headerIdFormat, htmlToDelta, imageFormat, indentFormat, isAdapterAvailable, isElement, isRemarkAvailable, isTableNewlineOp, isTextNode, isValidColor, isValidHexColor, italicFormat, kbdFormat, linkFormat, listFormat, markFormat, markdownToDelta, markdownToDeltaSync, nodeAdapter, normalizeDelta, preloadRemark, sanitizeDelta, sizeFormat, slugify, slugifyWithDedup, softBreakFormat, strikeFormat, subscriptFormat, superscriptFormat, tableBlockHandler, tableColAlignFormat, tableColFormat, tableHeaderFormat, tableRowFormat, toHexColor, underlineFormat, unescapeHtml, validateDelta, videoFormat };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { AttributeMap, Op, Delta } from '@scrider/delta';
|
|
1
|
+
import { AttributeMap, Op, Delta, InsertOp } from '@scrider/delta';
|
|
2
2
|
export * from '@scrider/delta';
|
|
3
|
+
export { InsertOp as ContentOp } from '@scrider/delta';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* DOM Adapter Interface
|
|
@@ -1038,6 +1039,27 @@ declare const formulaFormat: Format<string>;
|
|
|
1038
1039
|
*/
|
|
1039
1040
|
declare const imageFormat: Format<string>;
|
|
1040
1041
|
|
|
1042
|
+
/**
|
|
1043
|
+
* Soft Line Break embed format
|
|
1044
|
+
*
|
|
1045
|
+
* Represents a "Shift+Enter" style line break that does NOT split the
|
|
1046
|
+
* containing block (paragraph, list item, table cell, etc.). This is the
|
|
1047
|
+
* Delta-level analogue of HTML `<br>` used as an inline line break and
|
|
1048
|
+
* of the GFM "hard break" Markdown construct (two trailing spaces + `\n`).
|
|
1049
|
+
*
|
|
1050
|
+
* Delta: `{ insert: { softBreak: true } }`
|
|
1051
|
+
* HTML: `<br data-scrider-embed>` (with the explicit marker so that
|
|
1052
|
+
* round-trip parsing can distinguish a soft break from the
|
|
1053
|
+
* placeholder `<br>` that appears inside an empty paragraph)
|
|
1054
|
+
* Markdown: ` \n` (default GFM hard break) or inline `<br>` (configurable
|
|
1055
|
+
* via `softBreakStyle` option on `deltaToMarkdown`)
|
|
1056
|
+
*
|
|
1057
|
+
* Value is always `true` — the embed has no additional data.
|
|
1058
|
+
*
|
|
1059
|
+
* @see {@link https://github.github.com/gfm/#hard-line-breaks GFM hard line break}
|
|
1060
|
+
*/
|
|
1061
|
+
declare const softBreakFormat: Format<boolean>;
|
|
1062
|
+
|
|
1041
1063
|
/**
|
|
1042
1064
|
* Video embed format
|
|
1043
1065
|
*
|
|
@@ -1556,6 +1578,34 @@ interface DeltaToMarkdownOptions {
|
|
|
1556
1578
|
* `render()` is used as HTML fallback in Markdown.
|
|
1557
1579
|
*/
|
|
1558
1580
|
registry?: Registry;
|
|
1581
|
+
/**
|
|
1582
|
+
* Rendering style for `{ softBreak: true }` embeds (Phase 7 Part 0).
|
|
1583
|
+
*
|
|
1584
|
+
* - `'spaces'` (default): GFM-canonical hard break — two trailing spaces
|
|
1585
|
+
* followed by `\n` (`" \n"`). Round-trips losslessly through remark.
|
|
1586
|
+
* - `'html'`: inline `<br>` tag. Slightly more visible in source view
|
|
1587
|
+
* and immune to editor whitespace trimming. Recommended for the
|
|
1588
|
+
* LFM (LLM-Flavored Markdown) flavour exposed by the editor's
|
|
1589
|
+
* "source" toggle.
|
|
1590
|
+
*
|
|
1591
|
+
* Does not affect how soft breaks are rendered inside table cells —
|
|
1592
|
+
* those always use inline `<br>` because GFM tables forbid raw `\n`.
|
|
1593
|
+
*
|
|
1594
|
+
* @default 'spaces'
|
|
1595
|
+
*/
|
|
1596
|
+
softBreakStyle?: 'spaces' | 'html';
|
|
1597
|
+
/**
|
|
1598
|
+
* Strip trailing newlines from the final output.
|
|
1599
|
+
*
|
|
1600
|
+
* Useful when serialising a single block (e.g. one table for inline
|
|
1601
|
+
* editing) where the GFM padding (blank line after a table, trailing
|
|
1602
|
+
* paragraph newline, etc.) is not wanted. The internal structure of the
|
|
1603
|
+
* markdown is unaffected — only trailing `\n+` at the very end of the
|
|
1604
|
+
* returned string is removed.
|
|
1605
|
+
*
|
|
1606
|
+
* @default false
|
|
1607
|
+
*/
|
|
1608
|
+
trimTrailingNewlines?: boolean;
|
|
1559
1609
|
}
|
|
1560
1610
|
/**
|
|
1561
1611
|
* Convert Delta to Markdown
|
|
@@ -1661,9 +1711,39 @@ interface ParserContext {
|
|
|
1661
1711
|
pushNewline(attrs?: AttributeMap): void;
|
|
1662
1712
|
}
|
|
1663
1713
|
/**
|
|
1664
|
-
* Check if remark is available
|
|
1714
|
+
* Check if remark is available for synchronous use.
|
|
1715
|
+
*
|
|
1716
|
+
* Returns true if either:
|
|
1717
|
+
* - remark modules have been preloaded (via {@link preloadRemark} or a prior
|
|
1718
|
+
* `markdownToDelta` / `markdownToDeltaSync` call), OR
|
|
1719
|
+
* - CommonJS `require()` is available and can resolve `unified` and
|
|
1720
|
+
* `remark-parse` (Node.js without ESM-only mode).
|
|
1721
|
+
*
|
|
1722
|
+
* In browser ESM environments where `require` is undefined, this returns
|
|
1723
|
+
* `false` until {@link preloadRemark} has been awaited at least once.
|
|
1665
1724
|
*/
|
|
1666
1725
|
declare function isRemarkAvailable(): boolean;
|
|
1726
|
+
/**
|
|
1727
|
+
* Preload remark modules (`unified`, `remark-parse`, `remark-gfm`, optionally
|
|
1728
|
+
* `remark-math`) asynchronously. After this resolves successfully, the
|
|
1729
|
+
* synchronous {@link markdownToDeltaSync} is usable in environments where
|
|
1730
|
+
* `require()` is not available (e.g. browser ESM).
|
|
1731
|
+
*
|
|
1732
|
+
* Safe to call multiple times: subsequent calls short-circuit if modules are
|
|
1733
|
+
* already loaded.
|
|
1734
|
+
*
|
|
1735
|
+
* @returns `true` if mandatory modules (`unified`, `remark-parse`,
|
|
1736
|
+
* `remark-gfm`) are now loaded; `false` if any required module is missing.
|
|
1737
|
+
* The function never throws — callers can branch on the boolean for
|
|
1738
|
+
* graceful degradation.
|
|
1739
|
+
*
|
|
1740
|
+
* @example
|
|
1741
|
+
* // On editor mount:
|
|
1742
|
+
* useEffect(() => {
|
|
1743
|
+
* preloadRemark();
|
|
1744
|
+
* }, []);
|
|
1745
|
+
*/
|
|
1746
|
+
declare function preloadRemark(): Promise<boolean>;
|
|
1667
1747
|
/**
|
|
1668
1748
|
* Convert Markdown to Delta (async)
|
|
1669
1749
|
*/
|
|
@@ -1673,4 +1753,67 @@ declare function markdownToDelta(markdown: string, options?: MarkdownToDeltaOpti
|
|
|
1673
1753
|
*/
|
|
1674
1754
|
declare function markdownToDeltaSync(markdown: string, options?: MarkdownToDeltaOptions): Delta;
|
|
1675
1755
|
|
|
1676
|
-
|
|
1756
|
+
/**
|
|
1757
|
+
* Simple-table region detection in flat Delta.
|
|
1758
|
+
*
|
|
1759
|
+
* Helpers for callers (e.g. editors that need to find the boundaries of a
|
|
1760
|
+
* markdown-style table within a Delta op stream — for example to enter
|
|
1761
|
+
* "edit as markdown source" mode on double-click of a rendered table cell).
|
|
1762
|
+
*
|
|
1763
|
+
* A simple-table region is a contiguous run of ops that ends, for each cell,
|
|
1764
|
+
* with a `\n`-op carrying the `table-row` attribute (the standard format
|
|
1765
|
+
* produced by {@link markdownToDelta} for GFM tables and consumed by
|
|
1766
|
+
* {@link deltaToMarkdown}).
|
|
1767
|
+
*/
|
|
1768
|
+
|
|
1769
|
+
/**
|
|
1770
|
+
* Detected boundaries of a simple-table region.
|
|
1771
|
+
*/
|
|
1772
|
+
interface TableRegion {
|
|
1773
|
+
/** Inclusive start index in the original ops array. */
|
|
1774
|
+
startOpIdx: number;
|
|
1775
|
+
/**
|
|
1776
|
+
* Inclusive end index — always points at the last `\n`-op of the table
|
|
1777
|
+
* (the terminator of the last cell of the last row).
|
|
1778
|
+
*/
|
|
1779
|
+
endOpIdx: number;
|
|
1780
|
+
/** Slice of the original ops array covering the region. */
|
|
1781
|
+
ops: InsertOp[];
|
|
1782
|
+
}
|
|
1783
|
+
/**
|
|
1784
|
+
* Predicate: this op is a `\n`-op that terminates a simple-table cell
|
|
1785
|
+
* (i.e. it carries a `table-row` attribute).
|
|
1786
|
+
*/
|
|
1787
|
+
declare function isTableNewlineOp(op: Op | undefined): boolean;
|
|
1788
|
+
/**
|
|
1789
|
+
* Find the boundaries of the simple-table region containing the given hint
|
|
1790
|
+
* op index. The hint may be:
|
|
1791
|
+
* - an inline op inside a cell,
|
|
1792
|
+
* - the cell-terminating `\n`-op itself,
|
|
1793
|
+
* - any op between two table newlines.
|
|
1794
|
+
*
|
|
1795
|
+
* The function walks **forward** from the hint to find the nearest `\n`-op:
|
|
1796
|
+
* if it does not carry a `table-row` attribute, the hint is not inside a
|
|
1797
|
+
* table and `null` is returned. Otherwise the algorithm extends the region
|
|
1798
|
+
* forward through contiguous table newlines and backward to the op just
|
|
1799
|
+
* after the previous non-table `\n`-op (or the start of the array).
|
|
1800
|
+
*
|
|
1801
|
+
* @param ops - The full ops array (e.g. `delta.ops`).
|
|
1802
|
+
* @param hintOpIdx - Any op index known or guessed to be within a table.
|
|
1803
|
+
* @returns The detected region, or `null` if `hintOpIdx` is out of range or
|
|
1804
|
+
* not within any simple-table region.
|
|
1805
|
+
*
|
|
1806
|
+
* @example
|
|
1807
|
+
* // After hit-testing a `<td>` element to a Delta op index:
|
|
1808
|
+
* const region = extractTableRegion(state.delta.ops, hitOpIdx);
|
|
1809
|
+
* if (region) {
|
|
1810
|
+
* const md = deltaToMarkdown(new Delta(region.ops), {
|
|
1811
|
+
* trimTrailingNewlines: true,
|
|
1812
|
+
* });
|
|
1813
|
+
* // replace ops in [region.startOpIdx, region.endOpIdx] with a single
|
|
1814
|
+
* // { insert: md + '\n' } op to enter source-edit mode
|
|
1815
|
+
* }
|
|
1816
|
+
*/
|
|
1817
|
+
declare function extractTableRegion(ops: readonly Op[], hintOpIdx: number): TableRegion | null;
|
|
1818
|
+
|
|
1819
|
+
export { ALERT_TYPES, type AlertBlockData, type AlertType, type AlignType, BOX_FLOAT_VALUES, BOX_OVERFLOW_VALUES, type BlockContext, type BlockHandler, BlockHandlerRegistry, type BlockRenderOptions, type BoxBlockData, type BoxFloat, type BoxOpAttributes, type BoxOverflow, BrowserDOMAdapter, type CellAlign, type CellData, type ColumnsBlockData, type DOMAdapter, type DOMDocument, type DOMDocumentFragment, type DOMElement, type DOMNode, type DOMNodeList, type DeltaToHtmlOptions, type DeltaToMarkdownOptions, type FootnotesBlockData, type Format, type FormatDefinition, type FormatMatchResult, type FormatScope, type HtmlToDeltaOptions, type ListType, type MarkdownToDeltaOptions, NODE_TYPE, NodeDOMAdapter, Registry, type SanitizeOptions, type TableBlockData, type TableColAlignType, type TableRegion, alertBlockHandler, alignFormat, backgroundFormat, blockFormat, blockquoteFormat, boldFormat, boxBlockHandler, browserAdapter, cloneDelta, codeBlockFormat, codeFormat, colorFormat, columnsBlockHandler, createDefaultBlockHandlers, createDefaultRegistry, defaultBlockFormats, defaultEmbedFormats, defaultFormats, defaultInlineFormats, deltaToHtml, deltaToMarkdown, dividerFormat, escapeHtml, extractBoxOpAttributes, extractTableRegion, fontFormat, footnoteRefFormat, footnotesBlockHandler, formulaFormat, getAdapter, getNamedColors, headerFormat, headerIdFormat, htmlToDelta, imageFormat, indentFormat, isAdapterAvailable, isElement, isRemarkAvailable, isTableNewlineOp, isTextNode, isValidColor, isValidHexColor, italicFormat, kbdFormat, linkFormat, listFormat, markFormat, markdownToDelta, markdownToDeltaSync, nodeAdapter, normalizeDelta, preloadRemark, sanitizeDelta, sizeFormat, slugify, slugifyWithDedup, softBreakFormat, strikeFormat, subscriptFormat, superscriptFormat, tableBlockHandler, tableColAlignFormat, tableColFormat, tableHeaderFormat, tableRowFormat, toHexColor, underlineFormat, unescapeHtml, validateDelta, videoFormat };
|