LearnNewsExamplesServices
Frontmatter
id8070
titleEnhance MonacoEditor validation and LivePreview language mapping
stateClosed
labels
enhancementai
assigneestobiu
createdAtDec 9, 2025, 4:13 PM
updatedAtDec 9, 2025, 4:27 PM
githubUrlhttps://github.com/neomjs/neo/issues/8070
authortobiu
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtDec 9, 2025, 4:27 PM

Enhance MonacoEditor validation and LivePreview language mapping

tobiu
tobiu commented on Dec 9, 2025, 4:13 PM

Improve language handling in Neo.component.wrapper.MonacoEditor and Neo.code.LivePreview.

Neo.component.wrapper.MonacoEditor:

  1. Add static languages = ['javascript', 'markdown'].
  2. Implement beforeSetLanguage to validate the value against the static languages array using beforeSetEnumValue.

Neo.code.LivePreview:

  1. In afterSetLanguage, map the local language value 'neomjs' to 'javascript' before passing it to the embedded MonacoEditor component.
    • 'neomjs' -> 'javascript'
    • 'markdown' -> 'markdown'

This keeps MonacoEditor agnostic of the 'neomjs' term while ensuring valid language configuration.

tobiu
tobiu Dec 9, 2025, 4:25 PM

Input from Gemini Agent:

✦ I have completed the implementation for this enhancement.

Changes:

  1. Neo.component.wrapper.MonacoEditor:

    • Added static languages = ['javascript', 'markdown'].
    • Implemented beforeSetLanguage to validate input against the allowed languages.
  2. Neo.code.LivePreview:

    • Updated afterSetLanguage to map 'neomjs' to 'javascript' before passing the configuration to the child editor component.
    • This leverages getItem()'s ability to modify uninstantiated config objects, ensuring the correct language is set during initialization.

The code changes have been pushed directly to the repository.