Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add export PDF shortcut #3376

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
31 changes: 16 additions & 15 deletions docs/KEYBINDINGS_LINUX.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,22 @@ MarkText key bindings for Linux. Please see [general key bindings](KEYBINDINGS.m

#### File menu

| Id | Default | Description |
|:------------------- | --------------------------------------------- | ------------------------------------- |
| `file.new-window` | <kbd>Ctrl</kbd>+<kbd>N</kbd> | New window |
| `file.new-tab` | <kbd>Ctrl</kbd>+<kbd>T</kbd> | New tab |
| `file.open-file` | <kbd>Ctrl</kbd>+<kbd>O</kbd> | Open markdown file |
| `file.open-folder` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>O</kbd> | Open folder |
| `file.save` | <kbd>Ctrl</kbd>+<kbd>S</kbd> | Save |
| `file.save-as` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>S</kbd> | Save as... |
| `file.move-file` | - | Move current file to another location |
| `file.rename-file` | - | Rename current file |
| `file.print` | - | Print current tab |
| `file.preferences` | <kbd>Ctrl</kbd>+<kbd>,</kbd> | Open settings window |
| `file.close-tab` | <kbd>Ctrl</kbd>+<kbd>W</kbd> | Close tab |
| `file.close-window` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>W</kbd> | Close window |
| `file.quit` | <kbd>Ctrl</kbd>+<kbd>Q</kbd> | Quit MarkText |
| Id | Default | Description |
|:---------------------- | --------------------------------------------- | ------------------------------------- |
| `file.new-window` | <kbd>Ctrl</kbd>+<kbd>N</kbd> | New window |
| `file.new-tab` | <kbd>Ctrl</kbd>+<kbd>T</kbd> | New tab |
| `file.open-file` | <kbd>Ctrl</kbd>+<kbd>O</kbd> | Open markdown file |
| `file.open-folder` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>O</kbd> | Open folder |
| `file.save` | <kbd>Ctrl</kbd>+<kbd>S</kbd> | Save |
| `file.save-as` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>S</kbd> | Save as... |
| `file.export-file.pdf` | <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>E</kbd> | Export file as PDF |
| `file.move-file` | - | Move current file to another location |
| `file.rename-file` | - | Rename current file |
| `file.print` | - | Print current tab |
| `file.preferences` | <kbd>Ctrl</kbd>+<kbd>,</kbd> | Open settings window |
| `file.close-tab` | <kbd>Ctrl</kbd>+<kbd>W</kbd> | Close tab |
| `file.close-window` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>W</kbd> | Close window |
| `file.quit` | <kbd>Ctrl</kbd>+<kbd>Q</kbd> | Quit MarkText |

#### Edit menu

Expand Down
27 changes: 14 additions & 13 deletions docs/KEYBINDINGS_OSX.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,20 @@ MarkText key bindings for macOS. Please see [general key bindings](KEYBINDINGS.m

#### File menu

| Id | Default | Description |
|:------------------- | ------------------------------------------------ | ------------------------------------- |
| `file.new-window` | <kbd>Command</kbd>+<kbd>N</kbd> | New window |
| `file.new-tab` | <kbd>Command</kbd>+<kbd>T</kbd> | New tab |
| `file.open-file` | <kbd>Command</kbd>+<kbd>O</kbd> | Open markdown file |
| `file.open-folder` | <kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>O</kbd> | Open folder |
| `file.save` | <kbd>Command</kbd>+<kbd>S</kbd> | Save |
| `file.save-as` | <kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>S</kbd> | Save as... |
| `file.move-file` | - | Move current file to another location |
| `file.rename-file` | - | Rename current file |
| `file.print` | - | Print current tab |
| `file.close-tab` | <kbd>Command</kbd>+<kbd>W</kbd> | Close tab |
| `file.close-window` | <kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>W</kbd> | Close window |
| Id | Default | Description |
|:---------------------- | ------------------------------------------------ | ------------------------------------- |
| `file.new-window` | <kbd>Command</kbd>+<kbd>N</kbd> | New window |
| `file.new-tab` | <kbd>Command</kbd>+<kbd>T</kbd> | New tab |
| `file.open-file` | <kbd>Command</kbd>+<kbd>O</kbd> | Open markdown file |
| `file.open-folder` | <kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>O</kbd> | Open folder |
| `file.save` | <kbd>Command</kbd>+<kbd>S</kbd> | Save |
| `file.save-as` | <kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>S</kbd> | Save as... |
| `file.export-file.pdf` | <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>E</kbd> | Export file as PDF |
| `file.move-file` | - | Move current file to another location |
| `file.rename-file` | - | Rename current file |
| `file.print` | - | Print current tab |
| `file.close-tab` | <kbd>Command</kbd>+<kbd>W</kbd> | Close tab |
| `file.close-window` | <kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>W</kbd> | Close window |

#### Edit menu

Expand Down
31 changes: 16 additions & 15 deletions docs/KEYBINDINGS_WINDOWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,22 @@ MarkText key bindings for Windows. Please see [general key bindings](KEYBINDINGS

#### File menu

| Id | Default | Description |
|:------------------- | --------------------------------------------- | ------------------------------------- |
| `file.new-window` | <kbd>Ctrl</kbd>+<kbd>N</kbd> | New window |
| `file.new-tab` | <kbd>Ctrl</kbd>+<kbd>T</kbd> | New tab |
| `file.open-file` | <kbd>Ctrl</kbd>+<kbd>O</kbd> | Open markdown file |
| `file.open-folder` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>O</kbd> | Open folder |
| `file.save` | <kbd>Ctrl</kbd>+<kbd>S</kbd> | Save |
| `file.save-as` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>S</kbd> | Save as... |
| `file.move-file` | - | Move current file to another location |
| `file.rename-file` | - | Rename current file |
| `file.print` | - | Print current tab |
| `file.preferences` | <kbd>Ctrl</kbd>+<kbd>,</kbd> | Open settings window |
| `file.close-tab` | <kbd>Ctrl</kbd>+<kbd>W</kbd> | Close tab |
| `file.close-window` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>W</kbd> | Close window |
| `file.quit` | <kbd>Ctrl</kbd>+<kbd>Q</kbd> | Quit MarkText |
| Id | Default | Description |
|:---------------------- | --------------------------------------------- | ------------------------------------- |
| `file.new-window` | <kbd>Ctrl</kbd>+<kbd>N</kbd> | New window |
| `file.new-tab` | <kbd>Ctrl</kbd>+<kbd>T</kbd> | New tab |
| `file.open-file` | <kbd>Ctrl</kbd>+<kbd>O</kbd> | Open markdown file |
| `file.open-folder` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>O</kbd> | Open folder |
| `file.save` | <kbd>Ctrl</kbd>+<kbd>S</kbd> | Save |
| `file.save-as` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>S</kbd> | Save as... |
| `file.export-file.pdf` | <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>E</kbd> | Export file as PDF |
| `file.move-file` | - | Move current file to another location |
| `file.rename-file` | - | Rename current file |
| `file.print` | - | Print current tab |
| `file.preferences` | <kbd>Ctrl</kbd>+<kbd>,</kbd> | Open settings window |
| `file.close-tab` | <kbd>Ctrl</kbd>+<kbd>W</kbd> | Close tab |
| `file.close-window` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>W</kbd> | Close window |
| `file.quit` | <kbd>Ctrl</kbd>+<kbd>Q</kbd> | Quit MarkText |

#### Edit menu

Expand Down
1 change: 1 addition & 0 deletions src/common/commands/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const COMMANDS = Object.freeze({
FILE_RENAME_FILE: 'file.rename-file',
FILE_SAVE: 'file.save',
FILE_SAVE_AS: 'file.save-as',
FILE_EXPORT_FILE_PDF: 'file.export-file.pdf',
// FILE_TOGGLE_AUTO_SAVE: 'file.toggle-auto-save',

FORMAT_CLEAR_FORMAT: 'format.clear-format',
Expand Down
3 changes: 3 additions & 0 deletions src/main/keyboard/keybindingsDarwin.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ export default new Map([
['file.close-window', 'Command+Shift+W'],
['file.quit', 'Command+Q'],

// File > Export submenu
['file.export-file.pdf', 'Ctrl+Alt+E'],

// Edit menu
['edit.undo', 'Command+Z'],
['edit.redo', 'Command+Shift+Z'],
Expand Down
3 changes: 3 additions & 0 deletions src/main/keyboard/keybindingsLinux.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ export default new Map([
['file.close-window', 'Ctrl+Shift+W'],
['file.quit', 'Ctrl+Q'],

// File > Export submenu
['file.export-file.pdf', 'Ctrl+Alt+E'],

// Edit menu
['edit.undo', 'Ctrl+Z'],
['edit.redo', 'Ctrl+Shift+Z'],
Expand Down
3 changes: 3 additions & 0 deletions src/main/keyboard/keybindingsWindows.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ export default new Map([
['file.close-window', 'Ctrl+Shift+W'],
['file.quit', 'Ctrl+Q'],

// File > Export submenu
['file.export-file.pdf', 'Ctrl+Alt+E'],

// Edit menu
['edit.undo', 'Ctrl+Z'],
['edit.redo', 'Ctrl+Shift+Z'],
Expand Down
7 changes: 7 additions & 0 deletions src/main/menu/actions/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,12 @@ export const saveAs = win => {
}
}

export const exportPDF = win => {
if (win && win.webContents) {
exportFile(win, 'pdf')
}
}

export const autoSave = (menuItem, browserWindow) => {
const { checked } = menuItem
ipcMain.emit('set-user-preference', { autoSave: checked })
Expand Down Expand Up @@ -620,4 +626,5 @@ export const loadFileCommands = commandManager => {
commandManager.add(COMMANDS.FILE_RENAME_FILE, rename)
commandManager.add(COMMANDS.FILE_SAVE, save)
commandManager.add(COMMANDS.FILE_SAVE_AS, saveAs)
commandManager.add(COMMANDS.FILE_EXPORT_FILE_PDF, exportPDF)
}
1 change: 1 addition & 0 deletions src/main/menu/templates/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ export default function (keybindings, userPreference, recentlyUsedFiles) {
}
}, {
label: 'PDF',
accelerator: keybindings.getAccelerator('file.export-file.pdf'),
click (menuItem, browserWindow) {
actions.exportFile(browserWindow, 'pdf')
}
Expand Down
1 change: 1 addition & 0 deletions src/renderer/commands/descriptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ const commandDescriptions = Object.freeze({
'file.toggle-auto-save': 'File: Toggle Auto Save',
'file.import-file': 'File: Import...',
'file.export-file': 'File: Export...',
'file.export-file.pdf': 'File: Export as PDF...',
'file.zoom': 'Window: Zoom...',
'file.check-update': 'MarkText: Check for Updates...',
'paragraph.reset-paragraph': 'Paragraph: Transform into Paragraph',
Expand Down