Assemblies: UX improvements around foreign file imports (#6159)
* WIP: Add point-and-click Import for geometry Will eventually fix #6120 Right now the whole loop is there but the codemod doesn't work yet * Better pathToNOde, log on non-working cm dispatch call * Add workaround to updateModelingState not working * Back to updateModelingState with a skip flag * Better todo * Change working from Import to Insert, cleanups * Sister command in kclCommands to populate file options * Improve path selector * Unsure: move importAstMod to kclCommands onSubmit 😶 * Add e2e test * Clean up for review * Add native file menu entry and test * No await yo lint said so * WIP: UX improvements around foreign file imports Fixes #6152 * @lrev-Dev's suggestion to remove a comment Co-authored-by: Kurt Hutten <k.hutten@protonmail.ch> * Update to scene.settled(cmdBar) * Add partNNN default name for alias * Lint * Lint * Fix unit tests * Add sad path insert test Thanks @Irev-Dev for the suggestion * Add step insert test * Lint * Add test for second foreign import thru file tree click * Add default value for local name alias * Aligning tests * Fix tests * Add padding for filenames starting with a digit --------- Co-authored-by: Kurt Hutten <k.hutten@protonmail.ch>
This commit is contained in:
@ -17,12 +17,14 @@ import {
|
||||
EXECUTION_TYPE_REAL,
|
||||
FILE_EXT,
|
||||
} from '@src/lib/constants'
|
||||
import { getPathFilenameInVariableCase } from '@src/lib/desktop'
|
||||
import { isDesktop } from '@src/lib/isDesktop'
|
||||
import { copyFileShareLink } from '@src/lib/links'
|
||||
import { baseUnitsUnion } from '@src/lib/settings/settingsTypes'
|
||||
import { codeManager, editorManager, kclManager } from '@src/lib/singletons'
|
||||
import { err, reportRejection } from '@src/lib/trap'
|
||||
import type { IndexLoaderData } from '@src/lib/types'
|
||||
import type { CommandBarContext } from '@src/machines/commandBarMachine'
|
||||
import { IS_NIGHTLY_OR_DEBUG } from '@src/routes/utils'
|
||||
|
||||
interface OnSubmitProps {
|
||||
@ -122,6 +124,14 @@ export function kclCommands(commandProps: KclCommandConfig): Command[] {
|
||||
localName: {
|
||||
inputType: 'string',
|
||||
required: true,
|
||||
defaultValue: (context: CommandBarContext) => {
|
||||
if (!context.argumentsToSubmit['path']) {
|
||||
return
|
||||
}
|
||||
|
||||
const path = context.argumentsToSubmit['path'] as string
|
||||
return getPathFilenameInVariableCase(path)
|
||||
},
|
||||
},
|
||||
},
|
||||
onSubmit: (data) => {
|
||||
|
Reference in New Issue
Block a user