@scrider/formatter 1.3.7 → 1.4.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 +8 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -2
- package/dist/index.d.ts +5 -2
- package/dist/index.js +8 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1294,17 +1294,20 @@ declare function cloneDelta(delta: Delta): Delta;
|
|
|
1294
1294
|
|
|
1295
1295
|
/**
|
|
1296
1296
|
* Document-level HTML presentation for deltaToHtml (clipboard, export).
|
|
1297
|
-
* Not stored in Delta — mirrors editor Settings (line spacing,
|
|
1297
|
+
* Not stored in Delta — mirrors editor Settings (line spacing, indents).
|
|
1298
1298
|
*/
|
|
1299
1299
|
interface DocumentPresentation {
|
|
1300
1300
|
/** Line spacing multiplier, e.g. 1.5 */
|
|
1301
1301
|
lineSpacing?: number;
|
|
1302
|
-
/** First-line indent in
|
|
1302
|
+
/** First-line indent in cm on `<p>` and `<li>` (wrapped / soft-break lines unchanged). */
|
|
1303
1303
|
textIndentCm?: number;
|
|
1304
|
+
/** Extra left padding on top-level `<ul>`/`<ol>` — shifts marker + text as a block. */
|
|
1305
|
+
listBlockIndentCm?: number;
|
|
1304
1306
|
}
|
|
1305
1307
|
interface ResolvedDocumentPresentation {
|
|
1306
1308
|
lineSpacing: number | undefined;
|
|
1307
1309
|
textIndentCm: number | undefined;
|
|
1310
|
+
listBlockIndentCm: number | undefined;
|
|
1308
1311
|
}
|
|
1309
1312
|
declare function resolveDocumentPresentation(presentation?: DocumentPresentation): ResolvedDocumentPresentation | undefined;
|
|
1310
1313
|
declare function documentPresentationStyleParts(tag: string, resolved: ResolvedDocumentPresentation | undefined): string[];
|
package/dist/index.d.ts
CHANGED
|
@@ -1294,17 +1294,20 @@ declare function cloneDelta(delta: Delta): Delta;
|
|
|
1294
1294
|
|
|
1295
1295
|
/**
|
|
1296
1296
|
* Document-level HTML presentation for deltaToHtml (clipboard, export).
|
|
1297
|
-
* Not stored in Delta — mirrors editor Settings (line spacing,
|
|
1297
|
+
* Not stored in Delta — mirrors editor Settings (line spacing, indents).
|
|
1298
1298
|
*/
|
|
1299
1299
|
interface DocumentPresentation {
|
|
1300
1300
|
/** Line spacing multiplier, e.g. 1.5 */
|
|
1301
1301
|
lineSpacing?: number;
|
|
1302
|
-
/** First-line indent in
|
|
1302
|
+
/** First-line indent in cm on `<p>` and `<li>` (wrapped / soft-break lines unchanged). */
|
|
1303
1303
|
textIndentCm?: number;
|
|
1304
|
+
/** Extra left padding on top-level `<ul>`/`<ol>` — shifts marker + text as a block. */
|
|
1305
|
+
listBlockIndentCm?: number;
|
|
1304
1306
|
}
|
|
1305
1307
|
interface ResolvedDocumentPresentation {
|
|
1306
1308
|
lineSpacing: number | undefined;
|
|
1307
1309
|
textIndentCm: number | undefined;
|
|
1310
|
+
listBlockIndentCm: number | undefined;
|
|
1308
1311
|
}
|
|
1309
1312
|
declare function resolveDocumentPresentation(presentation?: DocumentPresentation): ResolvedDocumentPresentation | undefined;
|
|
1310
1313
|
declare function documentPresentationStyleParts(tag: string, resolved: ResolvedDocumentPresentation | undefined): string[];
|
package/dist/index.js
CHANGED
|
@@ -2498,14 +2498,17 @@ function resolveDocumentPresentation(presentation) {
|
|
|
2498
2498
|
if (!presentation) return void 0;
|
|
2499
2499
|
const lineSpacing = typeof presentation.lineSpacing === "number" && presentation.lineSpacing > 0 ? presentation.lineSpacing : void 0;
|
|
2500
2500
|
const textIndentCm = typeof presentation.textIndentCm === "number" && presentation.textIndentCm > 0 ? presentation.textIndentCm : void 0;
|
|
2501
|
-
|
|
2502
|
-
|
|
2501
|
+
const listBlockIndentCm = typeof presentation.listBlockIndentCm === "number" && presentation.listBlockIndentCm > 0 ? presentation.listBlockIndentCm : void 0;
|
|
2502
|
+
if (lineSpacing === void 0 && textIndentCm === void 0 && listBlockIndentCm === void 0) {
|
|
2503
|
+
return void 0;
|
|
2504
|
+
}
|
|
2505
|
+
return { lineSpacing, textIndentCm, listBlockIndentCm };
|
|
2503
2506
|
}
|
|
2504
2507
|
var LINE_HEIGHT_TAGS = /* @__PURE__ */ new Set(["p", "li", "blockquote"]);
|
|
2505
|
-
var TEXT_INDENT_TAGS = /* @__PURE__ */ new Set(["p"]);
|
|
2508
|
+
var TEXT_INDENT_TAGS = /* @__PURE__ */ new Set(["p", "li"]);
|
|
2506
2509
|
function documentPresentationListWrapperStyleParts(resolved) {
|
|
2507
|
-
if (!resolved?.
|
|
2508
|
-
return [`padding-left:calc(1.5em + ${resolved.
|
|
2510
|
+
if (!resolved?.listBlockIndentCm) return [];
|
|
2511
|
+
return [`padding-left:calc(1.5em + ${resolved.listBlockIndentCm}cm)`];
|
|
2509
2512
|
}
|
|
2510
2513
|
function documentPresentationStyleParts(tag, resolved) {
|
|
2511
2514
|
if (!resolved) return [];
|