Skip to content

Fix placeholder in monaco editor dissapear when value is set#217828

Merged
paulinashakirova merged 3 commits intoelastic:mainfrom
paulinashakirova:monaco-editor-placeholder
Apr 17, 2025
Merged

Fix placeholder in monaco editor dissapear when value is set#217828
paulinashakirova merged 3 commits intoelastic:mainfrom
paulinashakirova:monaco-editor-placeholder

Conversation

@paulinashakirova
Copy link
Contributor

@paulinashakirova paulinashakirova commented Apr 10, 2025

@paulinashakirova paulinashakirova added release_note:fix Team:SharedUX Platform AppEx-SharedUX (formerly Global Experience) t// backport:prev-minor labels Apr 10, 2025
@paulinashakirova paulinashakirova self-assigned this Apr 10, 2025
// Mounts editor inside constructor
_placeholderWidget.current = new PlaceholderWidget(placeholder, euiTheme, _editor);
if (!placeholder || !_editor) return;
const model = _editor.getModel();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be nice to extract his effect into a separate hook (fine if it is the same file)

usePlaceholder(placeholder, euiTheme, _editor)

also doesn't seem there is a need for _placeholderWidget.current and it could be just local variable

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds great!

@paulinashakirova paulinashakirova marked this pull request as ready for review April 16, 2025 13:24
@paulinashakirova paulinashakirova requested a review from a team as a code owner April 16, 2025 13:24
@elasticmachine
Copy link
Contributor

Pinging @elastic/appex-sharedux (Team:SharedUX)

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

cc @paulinashakirova

Copy link
Contributor

@Dosant Dosant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@paulinashakirova paulinashakirova merged commit ea3dead into elastic:main Apr 17, 2025
10 checks passed
@paulinashakirova paulinashakirova deleted the monaco-editor-placeholder branch April 17, 2025 12:49
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 9.0

https://github.com/elastic/kibana/actions/runs/14516030656

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Apr 17, 2025
…#217828)

## Summary

This PR fixes [[Bug] Setting text in the placeholder property does not
clear when value is set with onChange
action](elastic#149882) issue.

(cherry picked from commit ea3dead)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
9.0

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Apr 17, 2025
…217828) (#218562)

# Backport

This will backport the following commits from `main` to `9.0`:
- [Fix placeholder in monaco editor dissapear when value is set
(#217828)](#217828)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Paulina
Shakirova","email":"paulina.shakirova@elastic.co"},"sourceCommit":{"committedDate":"2025-04-17T12:49:05Z","message":"Fix
placeholder in monaco editor dissapear when value is set (#217828)\n\n##
Summary\n\nThis PR fixes [[Bug] Setting text in the placeholder property
does not\nclear when value is set with
onChange\naction](#149882)
issue.","sha":"ea3dead452cc9d5db9626237bb60cd5c509b08a9","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:SharedUX","backport:prev-minor","v9.1.0"],"title":"Fix
placeholder in monaco editor dissapear when value is
set","number":217828,"url":"https://github.com/elastic/kibana/pull/217828","mergeCommit":{"message":"Fix
placeholder in monaco editor dissapear when value is set (#217828)\n\n##
Summary\n\nThis PR fixes [[Bug] Setting text in the placeholder property
does not\nclear when value is set with
onChange\naction](#149882)
issue.","sha":"ea3dead452cc9d5db9626237bb60cd5c509b08a9"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/217828","number":217828,"mergeCommit":{"message":"Fix
placeholder in monaco editor dissapear when value is set (#217828)\n\n##
Summary\n\nThis PR fixes [[Bug] Setting text in the placeholder property
does not\nclear when value is set with
onChange\naction](#149882)
issue.","sha":"ea3dead452cc9d5db9626237bb60cd5c509b08a9"}}]}]
BACKPORT-->

Co-authored-by: Paulina Shakirova <paulina.shakirova@elastic.co>
davismcphee pushed a commit to davismcphee/kibana that referenced this pull request Apr 22, 2025
…#217828)

## Summary

This PR fixes [[Bug] Setting text in the placeholder property does not
clear when value is set with onChange
action](elastic#149882) issue.
akowalska622 pushed a commit to akowalska622/kibana that referenced this pull request May 29, 2025
…#217828)

## Summary

This PR fixes [[Bug] Setting text in the placeholder property does not
clear when value is set with onChange
action](elastic#149882) issue.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release_note:fix Team:SharedUX Platform AppEx-SharedUX (formerly Global Experience) t// v9.0.1 v9.1.0

4 participants