Skip to content

feat: Enhance NgxMarkdownEditor with customizable styles and improved functionality#1

Merged
RockyCott merged 3 commits intomainfrom
chrone/md_v0.0.7
Nov 11, 2025
Merged

feat: Enhance NgxMarkdownEditor with customizable styles and improved functionality#1
RockyCott merged 3 commits intomainfrom
chrone/md_v0.0.7

Conversation

@RockyCott
Copy link
Copy Markdown
Owner

  • Updated NgxMarkdownPreviewComponent to support default styles and custom CSS classes.
  • Refactored markdown-textarea component to use input signals for readonly state.
  • Improved popover component template for better readability and maintainability.
  • Modified default editor configuration to include useDefaultStyles and customStylesClass properties.
  • Adjusted markdown-editor component to utilize new configuration options and signals for state management.
  • Added public methods to markdown-editor for getting, setting, and clearing markdown content.
  • Enhanced internal configuration handling to merge defaults with user-defined settings.
  • Updated styles in markdown-editor component to reflect new default styling options.

… functionality

- Updated NgxMarkdownPreviewComponent to support default styles and custom CSS classes.
- Refactored markdown-textarea component to use input signals for readonly state.
- Improved popover component template for better readability and maintainability.
- Modified default editor configuration to include useDefaultStyles and customStylesClass properties.
- Adjusted markdown-editor component to utilize new configuration options and signals for state management.
- Added public methods to markdown-editor for getting, setting, and clearing markdown content.
- Enhanced internal configuration handling to merge defaults with user-defined settings.
- Updated styles in markdown-editor component to reflect new default styling options.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances the NgxMarkdownEditor with customizable styling capabilities and improved state management using Angular signals. The changes allow users to control whether default styles are applied and provide custom CSS classes for further customization.

Key changes:

  • Added useDefaultStyles and customStylesClass configuration options for customizable styling
  • Refactored internal state management to use signals (isSyncing, internalConfig)
  • Added public API methods for programmatic control (getMarkdown(), setMarkdown(), clear(), insertAtCursor())

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 21 comments.

Show a summary per file
File Description
config.interface.ts Added new config properties for style customization
markdown-editor.component.ts Refactored to use signals for state, added public API methods, implemented style class binding
markdown-editor.component.scss Added conditional default styles and updated host selector
markdown-editor.component.html Updated to use signal accessors for config
default-editor-config.ts Added default values for new style configuration options
popover.component.html Modernized template using @for instead of *ngFor
markdown-textarea.component.ts Simplified readonly input signal declaration
preview.component.ts Added style customization support and public scroll methods
preview-theme.scss Expanded and organized default theme styles with comprehensive coverage
package.json Version bump to 0.0.8
CHANGELOG.md Documented new features

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

[showPreview]="this.internalConfig.showPreview"
[syncScroll]="this.internalConfig.showToolbar"
[showPreview]="this.internalConfig().showPreview"
[syncScroll]="this.internalConfig().showToolbar"
Copy link

Copilot AI Nov 11, 2025

Choose a reason for hiding this comment

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

The syncScroll input is incorrectly bound to showToolbar. This should be bound to this.internalConfig().syncScroll instead.

Suggested change
[syncScroll]="this.internalConfig().showToolbar"
[syncScroll]="this.internalConfig().syncScroll"

Copilot uses AI. Check for mistakes.
Comment on lines +217 to 223
const mergedConfig: Required<MarkdownEditorConfig> = {
...DEFAULT_EDITOR_CONFIG,
...this.config(),
showPreview: this.showPreviewInput() ?? true,
syncScroll: this.syncScrollInput() ?? true,
showToolbar: this.showToolbarInput() ?? true,
...this.config(),
};
Copy link

Copilot AI Nov 11, 2025

Choose a reason for hiding this comment

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

The merge order may cause user-provided config values to be overridden by input signals. User config should be spread after DEFAULT_EDITOR_CONFIG but before individual input signals to allow inputs to take precedence: { ...DEFAULT_EDITOR_CONFIG, ...this.config(), showPreview: this.showPreviewInput() ?? true, ... }

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

@copilot open a new pull request to apply changes based on this feedback

@@ -1,5 +1,15 @@
# Changelog

## [0.1.2] - 2025-11-10
Copy link

Copilot AI Nov 11, 2025

Choose a reason for hiding this comment

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

Version mismatch: The CHANGELOG shows version 0.1.2, but package.json indicates version 0.0.8. These versions should be consistent.

Suggested change
## [0.1.2] - 2025-11-10
## [0.0.8] - 2025-11-10

Copilot uses AI. Check for mistakes.
color: var(--color-on-surface, #1c1b1f);
font-size: 1rem;
line-height: 1.6;
// Este archivo contiene los estilos por defecto del tema Markdown
Copy link

Copilot AI Nov 11, 2025

Choose a reason for hiding this comment

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

Comments should be in English for consistency with the rest of the codebase. Translation: 'This file contains the default Markdown theme styles'

Suggested change
// Este archivo contiene los estilos por defecto del tema Markdown
// This file contains the default Markdown theme styles

Copilot uses AI. Check for mistakes.
font-size: 1rem;
line-height: 1.6;
// Este archivo contiene los estilos por defecto del tema Markdown
// Los desarrolladores pueden NO importar este archivo y usar su propio tema
Copy link

Copilot AI Nov 11, 2025

Choose a reason for hiding this comment

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

Comments should be in English for consistency with the rest of the codebase. Translation: 'Developers can choose not to import this file and use their own theme'

Suggested change
// Los desarrolladores pueden NO importar este archivo y usar su propio tema
// Developers can choose not to import this file and use their own theme

Copilot uses AI. Check for mistakes.
margin-bottom: 0.5rem;
}

/* Abreviaciones */
Copy link

Copilot AI Nov 11, 2025

Choose a reason for hiding this comment

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

Comments should be in English for consistency with the rest of the codebase. Translation: 'Abbreviations'

Suggested change
/* Abreviaciones */
/* Abbreviations */

Copilot uses AI. Check for mistakes.
border-bottom: none;
}

/* Marcado de texto */
Copy link

Copilot AI Nov 11, 2025

Choose a reason for hiding this comment

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

Comments should be in English for consistency with the rest of the codebase. Translation: 'Text highlighting'

Suggested change
/* Marcado de texto */
/* Text highlighting */

Copilot uses AI. Check for mistakes.
border-radius: 2px;
}

/* Texto pequeño */
Copy link

Copilot AI Nov 11, 2025

Choose a reason for hiding this comment

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

Comments should be in English for consistency with the rest of the codebase. Translation: 'Small text'

Suggested change
/* Texto pequeño */
/* Small text */

Copilot uses AI. Check for mistakes.
font-size: 0.875em;
}

/* Superíndice y subíndice */
Copy link

Copilot AI Nov 11, 2025

Choose a reason for hiding this comment

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

Comments should be in English for consistency with the rest of the codebase. Translation: 'Superscript and subscript'

Suggested change
/* Superíndice y subíndice */
/* Superscript and subscript */

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown

Copilot AI commented Nov 11, 2025

@RockyCott I've opened a new pull request, #2, to work on those changes. Once the pull request is ready, I'll request review from you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants