File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
frontend/src/state-providers Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -62,9 +62,16 @@ export function createPortfolioState(editor: Editor) {
62
62
}
63
63
} ) ;
64
64
editor . subscriptions . subscribeJsMessage ( TriggerOpenDocument , async ( ) => {
65
- const extension = editor . handle . fileExtension ( ) ;
66
- const data = await upload ( "." + extension , "text" ) ;
67
- editor . handle . openDocumentFile ( data . filename , data . content ) ;
65
+ const suffix = "." + editor . handle . fileExtension ( ) ;
66
+ const data = await upload ( suffix , "text" ) ;
67
+
68
+ // Use filename as document name, removing the extension if it exists
69
+ var documentName = data . filename ;
70
+ if ( documentName . endsWith ( suffix ) ) {
71
+ documentName = documentName . slice ( 0 , - suffix . length ) ;
72
+ }
73
+
74
+ editor . handle . openDocumentFile ( documentName , data . content ) ;
68
75
} ) ;
69
76
editor . subscriptions . subscribeJsMessage ( TriggerImport , async ( ) => {
70
77
const data = await upload ( "image/*" , "both" ) ;
You can’t perform that action at this time.
0 commit comments