Release v1.2.0: Major feature additions

- Add PowerPoint export (PPTX/ODP) with slide-level formatting
- Add comprehensive document conversion menu with import/export
- Add interactive table creation helper in markdown editor
- Update documentation with all new features and version history
- Improve menu organization for better user experience

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-09-01 19:54:19 +05:30
co-authored by Claude
parent a6da95b057
commit b0a96f680a
5 changed files with 208 additions and 12 deletions
+9
View File
@@ -59,6 +59,15 @@
<path d="M15 21c3 0 7-1 7-8V5c0-1.25-.757-2.017-2-2h-4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2h.75c0 2.25.25 4-2.75 4v3c0 1 0 1 1 1z"></path>
</svg>
</button>
<button id="btn-table" title="Insert Table">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect>
<line x1="3" y1="9" x2="21" y2="9"></line>
<line x1="3" y1="15" x2="21" y2="15"></line>
<line x1="9" y1="3" x2="9" y2="21"></line>
<line x1="15" y1="3" x2="15" y2="21"></line>
</svg>
</button>
<div class="toolbar-separator"></div>
<button id="btn-preview-toggle" title="Toggle Preview">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
+101
View File
@@ -87,6 +87,9 @@ function createMenu() {
{ label: 'ODT', click: () => exportFile('odt') },
{ label: 'EPUB', click: () => exportFile('epub') },
{ type: 'separator' },
{ label: 'PowerPoint (PPTX)', click: () => exportFile('pptx') },
{ label: 'OpenDocument Presentation (ODP)', click: () => exportFile('odp') },
{ type: 'separator' },
{ label: 'Excel (XLSX)', click: () => exportSpreadsheet('xlsx') },
{ label: 'Excel Legacy (XLS)', click: () => exportSpreadsheet('xls') },
{ label: 'OpenDocument Spreadsheet (ODS)', click: () => exportSpreadsheet('ods') }
@@ -112,6 +115,32 @@ function createMenu() {
{ label: 'Select All', accelerator: 'CmdOrCtrl+A', role: 'selectAll' }
]
},
{
label: 'Convert',
submenu: [
{
label: 'Import Document...',
accelerator: 'CmdOrCtrl+I',
click: importDocument
},
{ type: 'separator' },
{
label: 'Convert Current File',
submenu: [
{ label: 'To Markdown', click: () => convertToFormat('md') },
{ label: 'To HTML', click: () => convertToFormat('html') },
{ label: 'To PDF', click: () => convertToFormat('pdf') },
{ label: 'To DOCX', click: () => convertToFormat('docx') },
{ label: 'To LaTeX', click: () => convertToFormat('latex') },
{ label: 'To RTF', click: () => convertToFormat('rtf') },
{ label: 'To ODT', click: () => convertToFormat('odt') },
{ label: 'To EPUB', click: () => convertToFormat('epub') },
{ label: 'To PPTX', click: () => convertToFormat('pptx') },
{ label: 'To ODP', click: () => convertToFormat('odp') }
]
}
]
},
{
label: 'View',
submenu: [
@@ -238,6 +267,78 @@ function exportSpreadsheet(format) {
mainWindow.webContents.send('get-content-for-spreadsheet', format);
}
function importDocument() {
const files = dialog.showOpenDialogSync(mainWindow, {
properties: ['openFile'],
filters: [
{ name: 'Documents', extensions: ['docx', 'odt', 'rtf', 'html', 'tex', 'epub', 'pdf'] },
{ name: 'Presentations', extensions: ['pptx', 'odp'] },
{ name: 'All Files', extensions: ['*'] }
]
});
if (files && files[0]) {
const inputFile = files[0];
const outputFile = inputFile.replace(/\.[^/.]+$/, '.md');
// Convert to markdown using pandoc
const pandocCmd = `pandoc "${inputFile}" -t markdown -o "${outputFile}"`;
exec(pandocCmd, (error, stdout, stderr) => {
if (error) {
dialog.showErrorBox('Import Error', `Failed to import: ${error.message}\n\nMake sure Pandoc is installed.`);
} else {
// Open the converted markdown file
currentFile = outputFile;
const content = fs.readFileSync(outputFile, 'utf-8');
mainWindow.webContents.send('file-opened', { path: outputFile, content });
dialog.showMessageBox(mainWindow, {
type: 'info',
title: 'Import Complete',
message: `Document imported successfully as ${outputFile}`,
buttons: ['OK']
});
}
});
}
}
function convertToFormat(format) {
if (!currentFile) {
dialog.showErrorBox('Error', 'Please save or open a file first');
return;
}
const outputFile = dialog.showSaveDialogSync(mainWindow, {
defaultPath: currentFile.replace(/\.[^/.]+$/, `.${format}`),
filters: [
{ name: format.toUpperCase(), extensions: [format] }
]
});
if (outputFile) {
// For presentations, add slide level for better conversion
let pandocCmd = `pandoc "${currentFile}" -o "${outputFile}"`;
if (format === 'pptx' || format === 'odp') {
pandocCmd = `pandoc "${currentFile}" --slide-level=2 -o "${outputFile}"`;
}
exec(pandocCmd, (error, stdout, stderr) => {
if (error) {
dialog.showErrorBox('Conversion Error', `Failed to convert: ${error.message}\n\nMake sure Pandoc is installed.`);
} else {
dialog.showMessageBox(mainWindow, {
type: 'info',
title: 'Conversion Complete',
message: `File converted successfully to ${outputFile}`,
buttons: ['OK']
});
}
});
}
}
function setTheme(theme) {
store.set('theme', theme);
mainWindow.webContents.send('theme-changed', theme);
+56
View File
@@ -60,8 +60,64 @@ document.getElementById('btn-link').addEventListener('click', () => insertMarkdo
document.getElementById('btn-code').addEventListener('click', () => insertMarkdown('`', '`'));
document.getElementById('btn-list').addEventListener('click', () => insertMarkdown('- ', ''));
document.getElementById('btn-quote').addEventListener('click', () => insertMarkdown('> ', ''));
document.getElementById('btn-table').addEventListener('click', insertTable);
document.getElementById('btn-preview-toggle').addEventListener('click', togglePreview);
// Table insertion function
function insertTable() {
const rows = prompt('Number of rows:', '3');
const cols = prompt('Number of columns:', '3');
if (!rows || !cols) return;
const numRows = parseInt(rows);
const numCols = parseInt(cols);
if (isNaN(numRows) || isNaN(numCols) || numRows < 1 || numCols < 1) {
alert('Please enter valid numbers for rows and columns');
return;
}
let table = '\n';
// Header row
table += '|';
for (let j = 0; j < numCols; j++) {
table += ` Header ${j + 1} |`;
}
table += '\n';
// Separator row
table += '|';
for (let j = 0; j < numCols; j++) {
table += ' --- |';
}
table += '\n';
// Data rows
for (let i = 0; i < numRows; i++) {
table += '|';
for (let j = 0; j < numCols; j++) {
table += ` Cell ${i + 1}-${j + 1} |`;
}
table += '\n';
}
table += '\n';
// Insert table at cursor position
const start = editor.selectionStart;
const end = editor.selectionEnd;
editor.value = editor.value.substring(0, start) + table + editor.value.substring(end);
// Set cursor after the table
editor.selectionStart = editor.selectionEnd = start + table.length;
editor.focus();
// Trigger input event
editor.dispatchEvent(new Event('input'));
}
// Markdown insertion helper
function insertMarkdown(before, after) {
const start = editor.selectionStart;