microsoft / microsoft/monaco-editor

[Feature Request]Support replace the decoration with customized dom element

Open
#4,722 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature-request
Dominant language
JavaScript
Stars
46.8k
Forks
4.1k
Avg merge
17h 58m
Merged PRs (30d)
1

Description

Context
  • This issue is not a bug report. (please use a different template for reporting a bug)
  • This issue is not a duplicate of an existing issue. (please use the search to find existing issues)
Description

The current decoration API only allows to customized CSS for the ranged content.
It would be great to have a way to replace the decoration with customized Dom element, so what user sees is different from the real text content.
Current I am moving from CodeMirror to Monaco. For CodeMirror it allows to replace a range of text with customized dom using markText method like markText(start, end, { replacedWith: XXX}). replacedWith options could be a customized dom element.
I have not find a proper way to do that in Monaco.

Thanks!

Monaco Editor Playground Link

No response

Monaco Editor Playground Code

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file, test, or playground entry point is provided. Start by reviewing Monaco's decoration API and comparing it with CodeMirror's markText and replacedWith behavior. Done would be a supported way to render a customized DOM element in place of a text range, with documented usage and validation.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.