diff --git a/packages/flow-client/src/app/redux/modules/node/node.logic.spec.ts b/packages/flow-client/src/app/redux/modules/node/node.logic.spec.ts index 5810fa0..0f50698 100644 --- a/packages/flow-client/src/app/redux/modules/node/node.logic.spec.ts +++ b/packages/flow-client/src/app/redux/modules/node/node.logic.spec.ts @@ -96,6 +96,42 @@ describe('NodeLogic', () => { }) ); }); + + it('updates editor templates from script tags with type text/x-red correctly', async () => { + const nodeScriptsData = ` + + `; + const nodeLogic = new NodeLogic(); + await nodeLogic.setNodeScripts(nodeScriptsData)(mockDispatch); + + expect(mockDispatch).toHaveBeenCalledWith( + nodeActions.updateOne({ + id: 'x-red-test-node', + changes: { + editorTemplate: '
X-Red Help Template
' }, + }) + ); + }); }); describe('applyConfigDefaults', () => { diff --git a/packages/flow-client/src/app/redux/modules/node/node.logic.ts b/packages/flow-client/src/app/redux/modules/node/node.logic.ts index 1fcd775..ce27470 100644 --- a/packages/flow-client/src/app/redux/modules/node/node.logic.ts +++ b/packages/flow-client/src/app/redux/modules/node/node.logic.ts @@ -39,7 +39,7 @@ export class NodeLogic { // Process text/html script tags for editor templates doc.querySelectorAll( - 'script[type="text/html"][data-template-name]' + 'script[type="text/html"][data-template-name], script[type="text/x-red"][data-template-name]' ).forEach(script => { // eslint-disable-next-line @typescript-eslint/no-non-null-assertion const nodeName = script.getAttribute('data-template-name')!; @@ -54,7 +54,7 @@ export class NodeLogic { // Process text/html script tags for help templates doc.querySelectorAll( - 'script[type="text/html"][data-help-name]' + 'script[type="text/html"][data-help-name], script[type="text/x-red"][data-help-name]' ).forEach(script => { // eslint-disable-next-line @typescript-eslint/no-non-null-assertion const nodeName = script.getAttribute('data-help-name')!;