Skip to content

Commit c98f48b

Browse files
committed
Merge branch 'develop' of github.com:Harbour-Enterprises/SuperDoc into develop
2 parents 31068d1 + 5e944d2 commit c98f48b

5 files changed

Lines changed: 35 additions & 4 deletions

File tree

packages/super-editor/src/components/toolbar/defaultItems.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ export const makeDefaultItems = ({
654654
const overflow = useToolbarItem({
655655
type: 'overflow',
656656
name: 'overflow',
657-
command: 'toggleOverflow',
657+
command: null,
658658
icon: toolbarIcons.overflow,
659659
active: false,
660660
disabled: false,

packages/super-editor/src/core/super-converter/exporter.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { EditorState } from 'prosemirror-state';
44
import { SuperConverter } from './SuperConverter.js';
55
import {
66
emuToPixels,
7+
getTextIndentExportValue,
78
inchesToTwips,
89
linesToTwips,
910
pixelsToEightPoints,
@@ -280,7 +281,7 @@ function generateParagraphProperties(node) {
280281
if (hanging || hanging === 0) attributes['w:hanging'] = pixelsToTwips(hanging);
281282

282283
if (textIndent && !attributes['w:left']) {
283-
attributes['w:left'] = inchesToTwips(textIndent);
284+
attributes['w:left'] = getTextIndentExportValue(textIndent);
284285
}
285286

286287
const indentElement = {
@@ -292,7 +293,7 @@ function generateParagraphProperties(node) {
292293
const indentElement = {
293294
name: 'w:ind',
294295
attributes: {
295-
'w:left': inchesToTwips(textIndent),
296+
'w:left': getTextIndentExportValue(textIndent),
296297
},
297298
};
298299
pPrElements.push(indentElement);

packages/super-editor/src/core/super-converter/helpers.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,22 @@ function ptToTwips(pt) {
8484
return pt * 20;
8585
}
8686

87+
/**
88+
* Get the export value for text indent
89+
* @param {string|number} indent - The text indent value to export
90+
* @returns {number} - The export value in twips
91+
*/
92+
const getTextIndentExportValue = (indent) => {
93+
const [value, unit] = parseSizeUnit(indent);
94+
const functionsMap = {
95+
pt: ptToTwips,
96+
in: inchesToTwips,
97+
};
98+
99+
const exportValue = functionsMap[unit] ? functionsMap[unit](value) : pixelsToTwips(value);
100+
return exportValue;
101+
};
102+
87103
const getArrayBufferFromUrl = async (input, isHeadless) => {
88104
// Check if it's a full URL or blob/file/data URI
89105
const isLikelyUrl = /^https?:|^blob:|^file:|^data:/i.test(input);
@@ -230,4 +246,5 @@ export {
230246
getLineHeightValueString,
231247
deobfuscateFont,
232248
hasSomeParentWithClass,
249+
getTextIndentExportValue,
233250
};
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { getTextIndentExportValue } from '../../core/super-converter/helpers.js';
2+
3+
describe('Export helpers', () => {
4+
it('getTextIndentExportValue returns correct value for every case', () => {
5+
const pxValue = getTextIndentExportValue('20');
6+
const inchValue = getTextIndentExportValue('2in');
7+
const ptValue = getTextIndentExportValue('20pt');
8+
9+
expect(pxValue).toBe(300);
10+
expect(inchValue).toBe(2880);
11+
expect(ptValue).toBe(400);
12+
});
13+
});

packages/superdoc/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@harbour-enterprises/superdoc",
33
"type": "module",
4-
"version": "0.15.15-next.2",
4+
"version": "0.15.15-next.5",
55
"license": "AGPL-3.0",
66
"readme": "../../README.md",
77
"files": [

0 commit comments

Comments
 (0)