mirror of
https://github.com/amitwh/markdown-converter.git
synced 2026-08-02 18:10:18 +05:30
feat: enhanced status bar with word count, char count, line/col, encoding
- Restructured status bar into left/right sections with separators - Added character count, cursor line/column position, encoding, and language mode indicators - Added cursor position tracking via CodeMirror onUpdate callback - Added file path display that updates on tab switch - Simplified word count display for cleaner status bar layout
This commit is contained in:
@@ -43,6 +43,7 @@ const { oneDark } = require('@codemirror/theme-one-dark');
|
||||
* @param {Object} options
|
||||
* @param {string} options.content - initial document content (default '')
|
||||
* @param {Function} options.onChange - called with new content string on every doc change
|
||||
* @param {Function} options.onUpdate - called with the EditorView on every update (selection, doc change, etc.)
|
||||
* @param {boolean} options.isDark - apply oneDark theme when true (default false)
|
||||
* @param {boolean} options.showLineNumbers - show line-number gutter (default true)
|
||||
* @returns {EditorView} the created editor view
|
||||
@@ -51,6 +52,7 @@ function createEditor(parentElement, options = {}) {
|
||||
const {
|
||||
content = '',
|
||||
onChange = () => {},
|
||||
onUpdate = null,
|
||||
isDark = false,
|
||||
showLineNumbers = true,
|
||||
} = options;
|
||||
@@ -76,6 +78,9 @@ function createEditor(parentElement, options = {}) {
|
||||
if (update.docChanged) {
|
||||
onChange(update.state.doc.toString());
|
||||
}
|
||||
if (onUpdate && (update.docChanged || update.selectionSet)) {
|
||||
onUpdate(update.view);
|
||||
}
|
||||
}),
|
||||
EditorView.lineWrapping,
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user