Editors

Editors are pages used to edit elements in the project. They're connected to a Creator and Element Type. This gives you the option to create custom editors and new content in Nexo Ma

Registration (main.js)

api.nexomaker.registerEditorType(editorId, componentPath, metadata)

Location: Call this in your expansion's main.js init() function.

Registers a custom editor component that can be used to edit specific element types.

Parameters

Parameter
Type
Required
Description

editorId

string

Yes

Unique identifier for this editor

componentPath

string

Yes

Absolute path to .jsx file (use __dirname + '/path/file.jsx')

metadata

object

No

Additional metadata about the editor

Metadata Object

Property
Type
Description

label

string

Display name for the editor

description

string

Brief description of what this editor does

Returns

void

Example (main.js)

module.exports.init = async () => {
  // Register the custom editor
  api.nexomaker.registerEditorType(
    'armor_editor',
    __dirname + '/editors/ArmorEditor.jsx',  // Use __dirname + string concatenation (NOT path.join)
    {
      label: 'Armor Editor',
      description: 'Edit armor pieces with custom stats'
    }
  );
};

Mapping Types to Editors (main.js)

api.nexomaker.setEditorForType(elementType, editorId)

Location: Call this in your expansion's main.js init() function.

Maps an element type to use your custom editor instead of the default editor.

Parameters

Parameter
Type
Description

elementType

string

The element type ID (e.g., 'armor', 'weapon')

editorId

string

The editor ID you registered

Example (main.js)


Editor Component Structure (.jsx file)

Function Signature

Important:

  • Use export default function (NOT module.exports)

  • All hooks are passed as props, NOT imported

  • No import statements allowed

Item Data

Content Management


Best Practices

1. No Imports - Use Props

2. Always Show Loading States

3. Handle Missing Data Gracefully

4. Validate Before Saving

5. Provide User Feedback

6. Use Scoped Logging

7. Update Content Array After Save


Advanced Patterns

Auto-Save

Multi-Section Form

Undo/Redo Support


Debugging

Check itemData Structure

Verify Save Calls


Last updated