diff --git a/client/src/features/StartScreen/StartScreen.js b/client/src/features/StartScreen/StartScreen.js index a5811eead..bd0e56cc3 100644 --- a/client/src/features/StartScreen/StartScreen.js +++ b/client/src/features/StartScreen/StartScreen.js @@ -1,7 +1,7 @@ import React, { useState } from 'react' import { useLocation } from 'wouter' -import { useNewSpellMutation, useGetSpellsQuery } from '../../state/spells' +import { useSaveSpellMutation, useGetSpellsQuery } from '../../state/spells' import { useDB } from '../../contexts/DatabaseProvider' import { useTabManager } from '../../contexts/TabManagerProvider' import AllProjects from './components/AllProjects' @@ -16,7 +16,7 @@ const StartScreen = ({ createNew, allProjects }) => { const { openTab } = useTabManager() const [, setLocation] = useLocation() - const [newSpell] = useNewSpellMutation() + const [saveSpell] = useSaveSpellMutation() const { data: spells } = useGetSpellsQuery() const onReaderLoad = async event => { @@ -26,7 +26,7 @@ const StartScreen = ({ createNew, allProjects }) => { try { spell = await models.spells.getSpell(spellData.name) } catch (error) { - spell = await newSpell(spellData) + spell = await saveSpell(spellData) } // Load modules from the spell if (spellData?.modules && spellData.modules.length > 0) diff --git a/client/src/features/Thoth/components/DataControls/Input.jsx b/client/src/features/Thoth/components/DataControls/Input.jsx index ad1963687..f7c53f37c 100644 --- a/client/src/features/Thoth/components/DataControls/Input.jsx +++ b/client/src/features/Thoth/components/DataControls/Input.jsx @@ -8,8 +8,9 @@ const Input = ({ control, updateData, initialValue }) => { const onChange = e => { setValue(e.target.value) + const value = e.target.value === '\\n' ? '\n' : e.target.value updateData({ - [dataKey]: e.target.value, + [dataKey]: value, }) } diff --git a/core/src/components/StringProcessor.ts b/core/src/components/StringProcessor.ts index 7e5f48d51..08982764b 100644 --- a/core/src/components/StringProcessor.ts +++ b/core/src/components/StringProcessor.ts @@ -2,7 +2,7 @@ import Rete from 'rete' import { NodeData, ThothNode, ThothWorkerInputs } from '../../types' import { CodeControl } from '../dataControls/CodeControl' -import { OutputGeneratorControl } from '../dataControls/OutputGenerator' +import { SocketGeneratorControl } from '../dataControls/SocketGenerator' import { stringSocket, triggerSocket } from '../sockets' import { ThothComponent } from '../thoth-component' const info = `The String Processor component take s astring as an input and allows you to write a function in the text editor to parse that string in whatever way you need. You can define any number of outputs which you can pass the result of your parsing out through. @@ -36,16 +36,11 @@ export class StringProcessor extends ThothComponent { const triggerOut = new Rete.Output('trigger', 'Trigger', triggerSocket) // Inspector controls - const outputGenerator = new OutputGeneratorControl({ + const outputGenerator = new SocketGeneratorControl({ socketType: 'stringSocket', - taskType: 'output', - ignored: [ - { - name: 'trigger', - socketType: 'triggerSocket', - taskType: 'option', - }, - ], + connectionType: 'output', + ignored: ['trigger'], + name: 'Output Sockets', }) const codeControl = new CodeControl({