File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 ,
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { EditorState } from 'prosemirror-state';
44import { SuperConverter } from './SuperConverter.js' ;
55import {
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 ) ;
Original file line number Diff line number Diff 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+
87103const getArrayBufferFromUrl = async ( input , isHeadless ) => {
88104 // Check if it's a full URL or blob/file/data URI
89105 const isLikelyUrl = / ^ h t t p s ? : | ^ b l o b : | ^ f i l e : | ^ d a t a : / i. test ( input ) ;
@@ -230,4 +246,5 @@ export {
230246 getLineHeightValueString ,
231247 deobfuscateFont ,
232248 hasSomeParentWithClass ,
249+ getTextIndentExportValue ,
233250} ;
Original file line number Diff line number Diff line change 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+ } ) ;
Original file line number Diff line number Diff line change 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" : [
You can’t perform that action at this time.
0 commit comments