Add the possibility to set markdown editor placeholder and disabled s… #785
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request enhances the editor input components in the panel by improving support for disabled and read-only states, adding placeholder functionality, and refining styling for better accessibility and user experience. The changes span TypeScript, SCSS, and dependency updates, focusing on making both Markdown and CodeMirror editors more robust and user-friendly.
Editor functionality and accessibility improvements:
Both the Markdown and CodeMirror editors now properly support
disabledandreadOnlystates, ensuring the editors become non-editable and update their UI accordingly. The toolbar toggle button and menu items also reflect the disabled state. (panel/src/ts/components/inputs/editor-input.ts[1] [2] [3] [4];panel/src/ts/components/inputs/editor/code/view.ts[5] [6] [7];panel/src/ts/components/inputs/editor/markdown/menu.ts[8] [9];panel/src/ts/components/inputs/editor/markdown/view.ts[10] [11] [12]Placeholders are now supported in both Markdown and CodeMirror editors, improving usability when the input is empty. For Markdown, a custom ProseMirror plugin displays the placeholder. (
panel/src/ts/components/inputs/editor-input.ts[1] [2];panel/src/ts/components/inputs/editor/code/view.ts[3] [4];panel/src/ts/components/inputs/editor/markdown/placeholder.ts[5];panel/src/ts/components/inputs/editor/markdown/view.ts[6] [7]Styling and user interface:
panel/src/scss/components/forms/_forms-editor.scss[1] [2] [3] [4]Code quality and maintainability:
panel/src/ts/components/inputs/editor-input.tspanel/src/ts/components/inputs/editor-input.tsL68-R68)Dependencies:
@codemirror/stateas a dependency to support the new editor features. (panel/package.json[1]panel/pnpm-lock.yaml[2]