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
blockedBy[]
blocking[]
closedAtDec 9, 2025, 4:27 PM

Enhance MonacoEditor validation and LivePreview language mapping

Closed v11.17.0 enhancementai
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 added the enhancement label on Dec 9, 2025, 4:13 PM
tobiu added the ai label on Dec 9, 2025, 4:14 PM
tobiu assigned to @tobiu on Dec 9, 2025, 4:17 PM
tobiu referenced in commit 77a96d8 - "Enhance MonacoEditor validation and LivePreview language mapping #8070" on Dec 9, 2025, 4:25 PM
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.

tobiu closed this issue on Dec 9, 2025, 4:27 PM