@scrider/formatter 1.9.1 → 1.10.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/dist/index.cjs +38 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +55 -2
- package/dist/index.d.ts +55 -2
- package/dist/index.js +33 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1427,8 +1427,12 @@ declare const SCRIDER_LINE_HEIGHT_KEY = "scrider-line-height";
|
|
|
1427
1427
|
declare const SCRIDER_MARGIN_AFTER_KEY = "scrider-margin-after";
|
|
1428
1428
|
/** Space before plain paragraph (`margin-top`) on `\n` (Settings Apply). */
|
|
1429
1429
|
declare const SCRIDER_MARGIN_BEFORE_KEY = "scrider-margin-before";
|
|
1430
|
+
/** Per-paragraph first-line indent stored on `\n` (Word paste, Settings Apply). */
|
|
1431
|
+
declare const SCRIDER_TEXT_INDENT_KEY = "scrider-text-indent";
|
|
1430
1432
|
/** Block tags that receive line spacing (not headings). */
|
|
1431
1433
|
declare const LINE_HEIGHT_BLOCK_TAGS: Set<string>;
|
|
1434
|
+
/** Block tags that receive first-line indent (plain `<p>` only). */
|
|
1435
|
+
declare const TEXT_INDENT_BLOCK_TAGS: Set<string>;
|
|
1432
1436
|
/** Block tags that receive paragraph spacing after (plain `<p>` only). */
|
|
1433
1437
|
declare const PARAGRAPH_SPACING_BLOCK_TAGS: Set<string>;
|
|
1434
1438
|
/**
|
|
@@ -1440,6 +1444,14 @@ declare function parseScriderLineHeightMultiplier(value: string): number | undef
|
|
|
1440
1444
|
* Line-height for a block tag: `scrider-line-height` on the line → documentPresentation → none.
|
|
1441
1445
|
*/
|
|
1442
1446
|
declare function blockLineHeightStyleParts(tag: string, blockAttributes: AttributeMap | undefined, resolved: ResolvedDocumentPresentation | undefined): string[];
|
|
1447
|
+
/**
|
|
1448
|
+
* First-line indent for a plain `<p>`: `scrider-text-indent` on the line (baked,
|
|
1449
|
+
* e.g. Word paste) → documentPresentation `textIndentCm` → none.
|
|
1450
|
+
*
|
|
1451
|
+
* The block attr wins over the document default (mirrors line-height / margin
|
|
1452
|
+
* resolution). The raw block value is a CSS length string (e.g. `1.25cm`).
|
|
1453
|
+
*/
|
|
1454
|
+
declare function blockTextIndentStyleParts(tag: string, blockAttributes: AttributeMap | undefined, resolved: ResolvedDocumentPresentation | undefined): string[];
|
|
1443
1455
|
/**
|
|
1444
1456
|
* Parse paragraph margin in em from Delta / inline CSS (`0.5em`, `0.5`).
|
|
1445
1457
|
*/
|
|
@@ -1501,10 +1513,21 @@ declare function resolveDocumentPresentation(presentation?: DocumentPresentation
|
|
|
1501
1513
|
* can fall back cleanly.
|
|
1502
1514
|
*/
|
|
1503
1515
|
declare function documentMetadataToPresentation(metadata: ScriderDocumentMetadata | undefined): DocumentPresentation | undefined;
|
|
1504
|
-
/**
|
|
1516
|
+
/**
|
|
1517
|
+
* Document-level first-line indent only (no per-block attr).
|
|
1518
|
+
*
|
|
1519
|
+
* @deprecated Superseded by {@link blockTextIndentStyleParts}, which resolves the
|
|
1520
|
+
* per-block `scrider-text-indent` attr with the document default as fallback and
|
|
1521
|
+
* is what {@link blockPresentationStyleParts} now uses. Kept exported for
|
|
1522
|
+
* backward compatibility; output is unchanged for document-only callers.
|
|
1523
|
+
*/
|
|
1505
1524
|
declare function documentPresentationStyleParts(tag: string, resolved: ResolvedDocumentPresentation | undefined): string[];
|
|
1506
1525
|
/**
|
|
1507
1526
|
* All block presentation styles for deltaToHtml: Delta attrs, then document defaults.
|
|
1527
|
+
*
|
|
1528
|
+
* First-line indent now resolves per-block: baked `scrider-text-indent` wins over
|
|
1529
|
+
* the document `textIndentCm` default (previously the per-block attr was dropped
|
|
1530
|
+
* on export). Output for document-only paragraphs is unchanged.
|
|
1508
1531
|
*/
|
|
1509
1532
|
declare function blockPresentationStyleParts(tag: string, blockAttributes: AttributeMap | undefined, resolved: ResolvedDocumentPresentation | undefined): string[];
|
|
1510
1533
|
|
|
@@ -1654,6 +1677,36 @@ interface DeltaToHtmlOptions {
|
|
|
1654
1677
|
* ```
|
|
1655
1678
|
*/
|
|
1656
1679
|
declare function deltaToHtml(delta: Delta, options?: DeltaToHtmlOptions): string;
|
|
1680
|
+
/**
|
|
1681
|
+
* Rendering profile: how a Delta is turned into markup.
|
|
1682
|
+
*
|
|
1683
|
+
* - `export`: full fidelity for clipboard / Office / HTML export. Document-level
|
|
1684
|
+
* presentation (line/paragraph spacing, first-line/list indent) and table
|
|
1685
|
+
* presentation are projected to inline CSS so the markup is self-contained.
|
|
1686
|
+
* - `editor`: markup for the editor's contenteditable surface. Document-level
|
|
1687
|
+
* presentation and table presentation are intentionally dropped — the editor
|
|
1688
|
+
* applies them live via CSS custom properties on the container, so inline
|
|
1689
|
+
* copies would double-apply and fight the Settings panel. Per-block baked
|
|
1690
|
+
* attributes (`scrider-line-height`, `scrider-margin-*`, `scrider-text-indent`)
|
|
1691
|
+
* still render, since they are part of the document content.
|
|
1692
|
+
*/
|
|
1693
|
+
type RenderProfile = 'export' | 'editor';
|
|
1694
|
+
/**
|
|
1695
|
+
* Render a Delta with an explicit {@link RenderProfile}.
|
|
1696
|
+
*
|
|
1697
|
+
* Thin dispatcher over {@link deltaToHtml} (the export core). See
|
|
1698
|
+
* {@link RenderProfile} for how the profiles differ.
|
|
1699
|
+
*/
|
|
1700
|
+
declare function renderDelta(delta: Delta, profile: RenderProfile, options?: DeltaToHtmlOptions): string;
|
|
1701
|
+
/**
|
|
1702
|
+
* Render a Delta for the editor's contenteditable surface (`editor` profile).
|
|
1703
|
+
*
|
|
1704
|
+
* Equivalent to `renderDelta(delta, 'editor', options)`. Document-level and table
|
|
1705
|
+
* presentation are dropped (applied live via CSS vars); the built-in `softBreak`
|
|
1706
|
+
* renderer already emits `<br data-scrider-embed>`, so the editor needs no
|
|
1707
|
+
* embed-renderer override.
|
|
1708
|
+
*/
|
|
1709
|
+
declare function deltaToDom(delta: Delta, options?: DeltaToHtmlOptions): string;
|
|
1657
1710
|
|
|
1658
1711
|
/**
|
|
1659
1712
|
* HTML → Delta Conversion
|
|
@@ -2151,4 +2204,4 @@ declare function collectAdjacentTableLines<T extends {
|
|
|
2151
2204
|
*/
|
|
2152
2205
|
declare function extractTableRegion(ops: readonly Op[], hintOpIdx: number): TableRegion | null;
|
|
2153
2206
|
|
|
2154
|
-
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 CellHorizontalAlign, type CellVerticalAlign, type ColumnsBlockData, type DOMAdapter, type DOMDocument, type DOMDocumentFragment, type DOMElement, type DOMNode, type DOMNodeList, type DeltaToHtmlOptions, type DeltaToMarkdownOptions, type DocumentPresentation, type EmbedIsolationOptions, type FootnotesBlockData, type Format, type FormatDefinition, type FormatMatchResult, type FormatRenderContext, type FormatScope, type HtmlToDeltaOptions, LINE_HEIGHT_BLOCK_TAGS, type ListType, type MarkdownToDeltaOptions, NODE_TYPE, NodeDOMAdapter, PARAGRAPH_SPACING_BLOCK_TAGS, Registry, type ResolvedDocumentPresentation, type ResolvedTablePresentation, SCRIDER_LINE_HEIGHT_KEY, SCRIDER_MARGIN_AFTER_KEY, SCRIDER_MARGIN_BEFORE_KEY, type SanitizeOptions, type ScriderDocumentMetadata, type TableBlockData, type TableBlockFloat, type TableCellAlign, type TableCellCoords, type TableColAlignType, type TablePresentation, type TableRegion, alertBlockHandler, alignFormat, backgroundFormat, blockFormat, blockLineHeightStyleParts, blockMarginAfterStyleParts, blockMarginBeforeStyleParts, blockParagraphMarginStyleParts, blockPresentationStyleParts, blockquoteFormat, boldFormat, boxBlockHandler, browserAdapter, cloneDelta, codeBlockFormat, codeFormat, codeWidgetFormat, collectAdjacentTableLines, colorFormat, columnsBlockHandler, createDefaultBlockHandlers, createDefaultRegistry, defaultBlockFormats, defaultEmbedFormats, defaultFormats, defaultInlineFormats, deltaToHtml, deltaToMarkdown, dividerFormat, documentMetadataToPresentation, documentPresentationStyleParts, escapeHtml, extractBoxOpAttributes, extractTableRegion, fontFormat, footnoteRefFormat, footnotesBlockHandler, formulaFormat, getAdapter, getNamedColors, headerFormat, headerIdFormat, htmlToDelta, imageFormat, indentFormat, isAdapterAvailable, isAdjacentSimpleTableGridBoundary, isElement, isRemarkAvailable, isTableNewlineOp, isTextNode, isValidColor, isValidHexColor, isZebraBodyRow, italicFormat, kbdFormat, linkFormat, listFormat, markFormat, markdownToDelta, markdownToDeltaSync, nodeAdapter, normalizeDelta, parseScriderLineHeightMultiplier, parseScriderMarginAfterEm, parseScriderMarginBeforeEm, parseScriderMarginEm, preloadRemark, resolveDocumentPresentation, resolveTablePresentation, sanitizeDelta, sizeFormat, slugify, slugifyWithDedup, softBreakFormat, strikeFormat, subscriptFormat, superscriptFormat, tableBlockHandler, tableCellCoordsFromAttributes, tableCellCoordsFromOp, tableColAlignFormat, tableColFormat, tableHeaderFormat, tableRowFormat, toCodeWidgetEmbedUrl, toHexColor, underlineFormat, unescapeHtml, validateDelta, videoFormat };
|
|
2207
|
+
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 CellHorizontalAlign, type CellVerticalAlign, type ColumnsBlockData, type DOMAdapter, type DOMDocument, type DOMDocumentFragment, type DOMElement, type DOMNode, type DOMNodeList, type DeltaToHtmlOptions, type DeltaToMarkdownOptions, type DocumentPresentation, type EmbedIsolationOptions, type FootnotesBlockData, type Format, type FormatDefinition, type FormatMatchResult, type FormatRenderContext, type FormatScope, type HtmlToDeltaOptions, LINE_HEIGHT_BLOCK_TAGS, type ListType, type MarkdownToDeltaOptions, NODE_TYPE, NodeDOMAdapter, PARAGRAPH_SPACING_BLOCK_TAGS, Registry, type RenderProfile, type ResolvedDocumentPresentation, type ResolvedTablePresentation, SCRIDER_LINE_HEIGHT_KEY, SCRIDER_MARGIN_AFTER_KEY, SCRIDER_MARGIN_BEFORE_KEY, SCRIDER_TEXT_INDENT_KEY, type SanitizeOptions, type ScriderDocumentMetadata, TEXT_INDENT_BLOCK_TAGS, type TableBlockData, type TableBlockFloat, type TableCellAlign, type TableCellCoords, type TableColAlignType, type TablePresentation, type TableRegion, alertBlockHandler, alignFormat, backgroundFormat, blockFormat, blockLineHeightStyleParts, blockMarginAfterStyleParts, blockMarginBeforeStyleParts, blockParagraphMarginStyleParts, blockPresentationStyleParts, blockTextIndentStyleParts, blockquoteFormat, boldFormat, boxBlockHandler, browserAdapter, cloneDelta, codeBlockFormat, codeFormat, codeWidgetFormat, collectAdjacentTableLines, colorFormat, columnsBlockHandler, createDefaultBlockHandlers, createDefaultRegistry, defaultBlockFormats, defaultEmbedFormats, defaultFormats, defaultInlineFormats, deltaToDom, deltaToHtml, deltaToMarkdown, dividerFormat, documentMetadataToPresentation, documentPresentationStyleParts, escapeHtml, extractBoxOpAttributes, extractTableRegion, fontFormat, footnoteRefFormat, footnotesBlockHandler, formulaFormat, getAdapter, getNamedColors, headerFormat, headerIdFormat, htmlToDelta, imageFormat, indentFormat, isAdapterAvailable, isAdjacentSimpleTableGridBoundary, isElement, isRemarkAvailable, isTableNewlineOp, isTextNode, isValidColor, isValidHexColor, isZebraBodyRow, italicFormat, kbdFormat, linkFormat, listFormat, markFormat, markdownToDelta, markdownToDeltaSync, nodeAdapter, normalizeDelta, parseScriderLineHeightMultiplier, parseScriderMarginAfterEm, parseScriderMarginBeforeEm, parseScriderMarginEm, preloadRemark, renderDelta, resolveDocumentPresentation, resolveTablePresentation, sanitizeDelta, sizeFormat, slugify, slugifyWithDedup, softBreakFormat, strikeFormat, subscriptFormat, superscriptFormat, tableBlockHandler, tableCellCoordsFromAttributes, tableCellCoordsFromOp, tableColAlignFormat, tableColFormat, tableHeaderFormat, tableRowFormat, toCodeWidgetEmbedUrl, toHexColor, underlineFormat, unescapeHtml, validateDelta, videoFormat };
|
package/dist/index.d.ts
CHANGED
|
@@ -1427,8 +1427,12 @@ declare const SCRIDER_LINE_HEIGHT_KEY = "scrider-line-height";
|
|
|
1427
1427
|
declare const SCRIDER_MARGIN_AFTER_KEY = "scrider-margin-after";
|
|
1428
1428
|
/** Space before plain paragraph (`margin-top`) on `\n` (Settings Apply). */
|
|
1429
1429
|
declare const SCRIDER_MARGIN_BEFORE_KEY = "scrider-margin-before";
|
|
1430
|
+
/** Per-paragraph first-line indent stored on `\n` (Word paste, Settings Apply). */
|
|
1431
|
+
declare const SCRIDER_TEXT_INDENT_KEY = "scrider-text-indent";
|
|
1430
1432
|
/** Block tags that receive line spacing (not headings). */
|
|
1431
1433
|
declare const LINE_HEIGHT_BLOCK_TAGS: Set<string>;
|
|
1434
|
+
/** Block tags that receive first-line indent (plain `<p>` only). */
|
|
1435
|
+
declare const TEXT_INDENT_BLOCK_TAGS: Set<string>;
|
|
1432
1436
|
/** Block tags that receive paragraph spacing after (plain `<p>` only). */
|
|
1433
1437
|
declare const PARAGRAPH_SPACING_BLOCK_TAGS: Set<string>;
|
|
1434
1438
|
/**
|
|
@@ -1440,6 +1444,14 @@ declare function parseScriderLineHeightMultiplier(value: string): number | undef
|
|
|
1440
1444
|
* Line-height for a block tag: `scrider-line-height` on the line → documentPresentation → none.
|
|
1441
1445
|
*/
|
|
1442
1446
|
declare function blockLineHeightStyleParts(tag: string, blockAttributes: AttributeMap | undefined, resolved: ResolvedDocumentPresentation | undefined): string[];
|
|
1447
|
+
/**
|
|
1448
|
+
* First-line indent for a plain `<p>`: `scrider-text-indent` on the line (baked,
|
|
1449
|
+
* e.g. Word paste) → documentPresentation `textIndentCm` → none.
|
|
1450
|
+
*
|
|
1451
|
+
* The block attr wins over the document default (mirrors line-height / margin
|
|
1452
|
+
* resolution). The raw block value is a CSS length string (e.g. `1.25cm`).
|
|
1453
|
+
*/
|
|
1454
|
+
declare function blockTextIndentStyleParts(tag: string, blockAttributes: AttributeMap | undefined, resolved: ResolvedDocumentPresentation | undefined): string[];
|
|
1443
1455
|
/**
|
|
1444
1456
|
* Parse paragraph margin in em from Delta / inline CSS (`0.5em`, `0.5`).
|
|
1445
1457
|
*/
|
|
@@ -1501,10 +1513,21 @@ declare function resolveDocumentPresentation(presentation?: DocumentPresentation
|
|
|
1501
1513
|
* can fall back cleanly.
|
|
1502
1514
|
*/
|
|
1503
1515
|
declare function documentMetadataToPresentation(metadata: ScriderDocumentMetadata | undefined): DocumentPresentation | undefined;
|
|
1504
|
-
/**
|
|
1516
|
+
/**
|
|
1517
|
+
* Document-level first-line indent only (no per-block attr).
|
|
1518
|
+
*
|
|
1519
|
+
* @deprecated Superseded by {@link blockTextIndentStyleParts}, which resolves the
|
|
1520
|
+
* per-block `scrider-text-indent` attr with the document default as fallback and
|
|
1521
|
+
* is what {@link blockPresentationStyleParts} now uses. Kept exported for
|
|
1522
|
+
* backward compatibility; output is unchanged for document-only callers.
|
|
1523
|
+
*/
|
|
1505
1524
|
declare function documentPresentationStyleParts(tag: string, resolved: ResolvedDocumentPresentation | undefined): string[];
|
|
1506
1525
|
/**
|
|
1507
1526
|
* All block presentation styles for deltaToHtml: Delta attrs, then document defaults.
|
|
1527
|
+
*
|
|
1528
|
+
* First-line indent now resolves per-block: baked `scrider-text-indent` wins over
|
|
1529
|
+
* the document `textIndentCm` default (previously the per-block attr was dropped
|
|
1530
|
+
* on export). Output for document-only paragraphs is unchanged.
|
|
1508
1531
|
*/
|
|
1509
1532
|
declare function blockPresentationStyleParts(tag: string, blockAttributes: AttributeMap | undefined, resolved: ResolvedDocumentPresentation | undefined): string[];
|
|
1510
1533
|
|
|
@@ -1654,6 +1677,36 @@ interface DeltaToHtmlOptions {
|
|
|
1654
1677
|
* ```
|
|
1655
1678
|
*/
|
|
1656
1679
|
declare function deltaToHtml(delta: Delta, options?: DeltaToHtmlOptions): string;
|
|
1680
|
+
/**
|
|
1681
|
+
* Rendering profile: how a Delta is turned into markup.
|
|
1682
|
+
*
|
|
1683
|
+
* - `export`: full fidelity for clipboard / Office / HTML export. Document-level
|
|
1684
|
+
* presentation (line/paragraph spacing, first-line/list indent) and table
|
|
1685
|
+
* presentation are projected to inline CSS so the markup is self-contained.
|
|
1686
|
+
* - `editor`: markup for the editor's contenteditable surface. Document-level
|
|
1687
|
+
* presentation and table presentation are intentionally dropped — the editor
|
|
1688
|
+
* applies them live via CSS custom properties on the container, so inline
|
|
1689
|
+
* copies would double-apply and fight the Settings panel. Per-block baked
|
|
1690
|
+
* attributes (`scrider-line-height`, `scrider-margin-*`, `scrider-text-indent`)
|
|
1691
|
+
* still render, since they are part of the document content.
|
|
1692
|
+
*/
|
|
1693
|
+
type RenderProfile = 'export' | 'editor';
|
|
1694
|
+
/**
|
|
1695
|
+
* Render a Delta with an explicit {@link RenderProfile}.
|
|
1696
|
+
*
|
|
1697
|
+
* Thin dispatcher over {@link deltaToHtml} (the export core). See
|
|
1698
|
+
* {@link RenderProfile} for how the profiles differ.
|
|
1699
|
+
*/
|
|
1700
|
+
declare function renderDelta(delta: Delta, profile: RenderProfile, options?: DeltaToHtmlOptions): string;
|
|
1701
|
+
/**
|
|
1702
|
+
* Render a Delta for the editor's contenteditable surface (`editor` profile).
|
|
1703
|
+
*
|
|
1704
|
+
* Equivalent to `renderDelta(delta, 'editor', options)`. Document-level and table
|
|
1705
|
+
* presentation are dropped (applied live via CSS vars); the built-in `softBreak`
|
|
1706
|
+
* renderer already emits `<br data-scrider-embed>`, so the editor needs no
|
|
1707
|
+
* embed-renderer override.
|
|
1708
|
+
*/
|
|
1709
|
+
declare function deltaToDom(delta: Delta, options?: DeltaToHtmlOptions): string;
|
|
1657
1710
|
|
|
1658
1711
|
/**
|
|
1659
1712
|
* HTML → Delta Conversion
|
|
@@ -2151,4 +2204,4 @@ declare function collectAdjacentTableLines<T extends {
|
|
|
2151
2204
|
*/
|
|
2152
2205
|
declare function extractTableRegion(ops: readonly Op[], hintOpIdx: number): TableRegion | null;
|
|
2153
2206
|
|
|
2154
|
-
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 CellHorizontalAlign, type CellVerticalAlign, type ColumnsBlockData, type DOMAdapter, type DOMDocument, type DOMDocumentFragment, type DOMElement, type DOMNode, type DOMNodeList, type DeltaToHtmlOptions, type DeltaToMarkdownOptions, type DocumentPresentation, type EmbedIsolationOptions, type FootnotesBlockData, type Format, type FormatDefinition, type FormatMatchResult, type FormatRenderContext, type FormatScope, type HtmlToDeltaOptions, LINE_HEIGHT_BLOCK_TAGS, type ListType, type MarkdownToDeltaOptions, NODE_TYPE, NodeDOMAdapter, PARAGRAPH_SPACING_BLOCK_TAGS, Registry, type ResolvedDocumentPresentation, type ResolvedTablePresentation, SCRIDER_LINE_HEIGHT_KEY, SCRIDER_MARGIN_AFTER_KEY, SCRIDER_MARGIN_BEFORE_KEY, type SanitizeOptions, type ScriderDocumentMetadata, type TableBlockData, type TableBlockFloat, type TableCellAlign, type TableCellCoords, type TableColAlignType, type TablePresentation, type TableRegion, alertBlockHandler, alignFormat, backgroundFormat, blockFormat, blockLineHeightStyleParts, blockMarginAfterStyleParts, blockMarginBeforeStyleParts, blockParagraphMarginStyleParts, blockPresentationStyleParts, blockquoteFormat, boldFormat, boxBlockHandler, browserAdapter, cloneDelta, codeBlockFormat, codeFormat, codeWidgetFormat, collectAdjacentTableLines, colorFormat, columnsBlockHandler, createDefaultBlockHandlers, createDefaultRegistry, defaultBlockFormats, defaultEmbedFormats, defaultFormats, defaultInlineFormats, deltaToHtml, deltaToMarkdown, dividerFormat, documentMetadataToPresentation, documentPresentationStyleParts, escapeHtml, extractBoxOpAttributes, extractTableRegion, fontFormat, footnoteRefFormat, footnotesBlockHandler, formulaFormat, getAdapter, getNamedColors, headerFormat, headerIdFormat, htmlToDelta, imageFormat, indentFormat, isAdapterAvailable, isAdjacentSimpleTableGridBoundary, isElement, isRemarkAvailable, isTableNewlineOp, isTextNode, isValidColor, isValidHexColor, isZebraBodyRow, italicFormat, kbdFormat, linkFormat, listFormat, markFormat, markdownToDelta, markdownToDeltaSync, nodeAdapter, normalizeDelta, parseScriderLineHeightMultiplier, parseScriderMarginAfterEm, parseScriderMarginBeforeEm, parseScriderMarginEm, preloadRemark, resolveDocumentPresentation, resolveTablePresentation, sanitizeDelta, sizeFormat, slugify, slugifyWithDedup, softBreakFormat, strikeFormat, subscriptFormat, superscriptFormat, tableBlockHandler, tableCellCoordsFromAttributes, tableCellCoordsFromOp, tableColAlignFormat, tableColFormat, tableHeaderFormat, tableRowFormat, toCodeWidgetEmbedUrl, toHexColor, underlineFormat, unescapeHtml, validateDelta, videoFormat };
|
|
2207
|
+
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 CellHorizontalAlign, type CellVerticalAlign, type ColumnsBlockData, type DOMAdapter, type DOMDocument, type DOMDocumentFragment, type DOMElement, type DOMNode, type DOMNodeList, type DeltaToHtmlOptions, type DeltaToMarkdownOptions, type DocumentPresentation, type EmbedIsolationOptions, type FootnotesBlockData, type Format, type FormatDefinition, type FormatMatchResult, type FormatRenderContext, type FormatScope, type HtmlToDeltaOptions, LINE_HEIGHT_BLOCK_TAGS, type ListType, type MarkdownToDeltaOptions, NODE_TYPE, NodeDOMAdapter, PARAGRAPH_SPACING_BLOCK_TAGS, Registry, type RenderProfile, type ResolvedDocumentPresentation, type ResolvedTablePresentation, SCRIDER_LINE_HEIGHT_KEY, SCRIDER_MARGIN_AFTER_KEY, SCRIDER_MARGIN_BEFORE_KEY, SCRIDER_TEXT_INDENT_KEY, type SanitizeOptions, type ScriderDocumentMetadata, TEXT_INDENT_BLOCK_TAGS, type TableBlockData, type TableBlockFloat, type TableCellAlign, type TableCellCoords, type TableColAlignType, type TablePresentation, type TableRegion, alertBlockHandler, alignFormat, backgroundFormat, blockFormat, blockLineHeightStyleParts, blockMarginAfterStyleParts, blockMarginBeforeStyleParts, blockParagraphMarginStyleParts, blockPresentationStyleParts, blockTextIndentStyleParts, blockquoteFormat, boldFormat, boxBlockHandler, browserAdapter, cloneDelta, codeBlockFormat, codeFormat, codeWidgetFormat, collectAdjacentTableLines, colorFormat, columnsBlockHandler, createDefaultBlockHandlers, createDefaultRegistry, defaultBlockFormats, defaultEmbedFormats, defaultFormats, defaultInlineFormats, deltaToDom, deltaToHtml, deltaToMarkdown, dividerFormat, documentMetadataToPresentation, documentPresentationStyleParts, escapeHtml, extractBoxOpAttributes, extractTableRegion, fontFormat, footnoteRefFormat, footnotesBlockHandler, formulaFormat, getAdapter, getNamedColors, headerFormat, headerIdFormat, htmlToDelta, imageFormat, indentFormat, isAdapterAvailable, isAdjacentSimpleTableGridBoundary, isElement, isRemarkAvailable, isTableNewlineOp, isTextNode, isValidColor, isValidHexColor, isZebraBodyRow, italicFormat, kbdFormat, linkFormat, listFormat, markFormat, markdownToDelta, markdownToDeltaSync, nodeAdapter, normalizeDelta, parseScriderLineHeightMultiplier, parseScriderMarginAfterEm, parseScriderMarginBeforeEm, parseScriderMarginEm, preloadRemark, renderDelta, resolveDocumentPresentation, resolveTablePresentation, sanitizeDelta, sizeFormat, slugify, slugifyWithDedup, softBreakFormat, strikeFormat, subscriptFormat, superscriptFormat, tableBlockHandler, tableCellCoordsFromAttributes, tableCellCoordsFromOp, tableColAlignFormat, tableColFormat, tableHeaderFormat, tableRowFormat, toCodeWidgetEmbedUrl, toHexColor, underlineFormat, unescapeHtml, validateDelta, videoFormat };
|
package/dist/index.js
CHANGED
|
@@ -2999,7 +2999,9 @@ function slugifyWithDedup(text, usedSlugs) {
|
|
|
2999
2999
|
var SCRIDER_LINE_HEIGHT_KEY = "scrider-line-height";
|
|
3000
3000
|
var SCRIDER_MARGIN_AFTER_KEY = "scrider-margin-after";
|
|
3001
3001
|
var SCRIDER_MARGIN_BEFORE_KEY = "scrider-margin-before";
|
|
3002
|
+
var SCRIDER_TEXT_INDENT_KEY = "scrider-text-indent";
|
|
3002
3003
|
var LINE_HEIGHT_BLOCK_TAGS = /* @__PURE__ */ new Set(["p", "li", "blockquote"]);
|
|
3004
|
+
var TEXT_INDENT_BLOCK_TAGS = /* @__PURE__ */ new Set(["p"]);
|
|
3003
3005
|
var PARAGRAPH_SPACING_BLOCK_TAGS = /* @__PURE__ */ new Set(["p"]);
|
|
3004
3006
|
function parseScriderLineHeightMultiplier(value) {
|
|
3005
3007
|
const trimmed = value.trim();
|
|
@@ -3029,6 +3031,18 @@ function blockLineHeightStyleParts(tag, blockAttributes, resolved) {
|
|
|
3029
3031
|
}
|
|
3030
3032
|
return [];
|
|
3031
3033
|
}
|
|
3034
|
+
function blockTextIndentStyleParts(tag, blockAttributes, resolved) {
|
|
3035
|
+
if (!TEXT_INDENT_BLOCK_TAGS.has(tag)) return [];
|
|
3036
|
+
const raw = blockAttributes?.[SCRIDER_TEXT_INDENT_KEY];
|
|
3037
|
+
if (typeof raw === "string") {
|
|
3038
|
+
const trimmed = raw.trim();
|
|
3039
|
+
if (trimmed) return [`text-indent:${trimmed}`];
|
|
3040
|
+
}
|
|
3041
|
+
if (resolved?.textIndentCm !== void 0) {
|
|
3042
|
+
return [`text-indent:${resolved.textIndentCm}cm`];
|
|
3043
|
+
}
|
|
3044
|
+
return [];
|
|
3045
|
+
}
|
|
3032
3046
|
function parseScriderMarginEm(value) {
|
|
3033
3047
|
const trimmed = value.trim();
|
|
3034
3048
|
if (!trimmed) return void 0;
|
|
@@ -3153,7 +3167,7 @@ function blockPresentationStyleParts(tag, blockAttributes, resolved) {
|
|
|
3153
3167
|
return [
|
|
3154
3168
|
...blockLineHeightStyleParts(tag, blockAttributes, resolved),
|
|
3155
3169
|
...blockParagraphMarginStyleParts(tag, blockAttributes, resolved),
|
|
3156
|
-
...
|
|
3170
|
+
...blockTextIndentStyleParts(tag, blockAttributes, resolved)
|
|
3157
3171
|
];
|
|
3158
3172
|
}
|
|
3159
3173
|
function joinStyleParts(parts) {
|
|
@@ -3437,6 +3451,19 @@ function deltaToHtml(delta, options = {}) {
|
|
|
3437
3451
|
}
|
|
3438
3452
|
return html;
|
|
3439
3453
|
}
|
|
3454
|
+
function stripPresentationForEditor(options) {
|
|
3455
|
+
const rest = { ...options };
|
|
3456
|
+
delete rest.documentPresentation;
|
|
3457
|
+
delete rest.documentMetadata;
|
|
3458
|
+
delete rest.tablePresentation;
|
|
3459
|
+
return rest;
|
|
3460
|
+
}
|
|
3461
|
+
function renderDelta(delta, profile, options = {}) {
|
|
3462
|
+
return profile === "editor" ? deltaToHtml(delta, stripPresentationForEditor(options)) : deltaToHtml(delta, options);
|
|
3463
|
+
}
|
|
3464
|
+
function deltaToDom(delta, options = {}) {
|
|
3465
|
+
return renderDelta(delta, "editor", options);
|
|
3466
|
+
}
|
|
3440
3467
|
function getIndent(level) {
|
|
3441
3468
|
return " ".repeat(level);
|
|
3442
3469
|
}
|
|
@@ -6074,6 +6101,8 @@ export {
|
|
|
6074
6101
|
SCRIDER_LINE_HEIGHT_KEY,
|
|
6075
6102
|
SCRIDER_MARGIN_AFTER_KEY,
|
|
6076
6103
|
SCRIDER_MARGIN_BEFORE_KEY,
|
|
6104
|
+
SCRIDER_TEXT_INDENT_KEY,
|
|
6105
|
+
TEXT_INDENT_BLOCK_TAGS,
|
|
6077
6106
|
alertBlockHandler,
|
|
6078
6107
|
alignFormat,
|
|
6079
6108
|
backgroundFormat,
|
|
@@ -6083,6 +6112,7 @@ export {
|
|
|
6083
6112
|
blockMarginBeforeStyleParts,
|
|
6084
6113
|
blockParagraphMarginStyleParts,
|
|
6085
6114
|
blockPresentationStyleParts,
|
|
6115
|
+
blockTextIndentStyleParts,
|
|
6086
6116
|
blockquoteFormat,
|
|
6087
6117
|
boldFormat,
|
|
6088
6118
|
boxBlockHandler,
|
|
@@ -6100,6 +6130,7 @@ export {
|
|
|
6100
6130
|
defaultEmbedFormats,
|
|
6101
6131
|
defaultFormats,
|
|
6102
6132
|
defaultInlineFormats,
|
|
6133
|
+
deltaToDom,
|
|
6103
6134
|
deltaToHtml,
|
|
6104
6135
|
deltaToMarkdown,
|
|
6105
6136
|
dividerFormat,
|
|
@@ -6142,6 +6173,7 @@ export {
|
|
|
6142
6173
|
parseScriderMarginBeforeEm,
|
|
6143
6174
|
parseScriderMarginEm,
|
|
6144
6175
|
preloadRemark,
|
|
6176
|
+
renderDelta,
|
|
6145
6177
|
resolveDocumentPresentation,
|
|
6146
6178
|
resolveTablePresentation,
|
|
6147
6179
|
sanitizeDelta,
|