updated to v1.7

This commit is contained in:
Dan Remollino
2023-03-24 01:25:15 -04:00
parent 98cb2a5f96
commit c423ee1ee0
4 changed files with 45 additions and 7 deletions

View File

@ -1,3 +1,6 @@
## Version 1.7
- added 'Preview All Installed FIGlet Fonts' to Extensions menu
## Version 1.6.4
- updated README.md

View File

@ -6,6 +6,7 @@
- configure FIGlet text output options
- auto comment converted text; supported syntaxes: CSS, HTML, Javascript, PHP, Typescript, and SCSS
- prepend/append new lines to converted text
- generate a custom preview of all installed FIGlet fonts
# Requirements
@ -20,4 +21,4 @@ FIGlet Text will add a 'Convert Selection to FIGlet' menu item to the Editor men
# Planned Features
- additional fonts
- all installed fonts preview
- borders

View File

@ -112,8 +112,8 @@ nova.commands.register('figletTextEditor', editor => {
if (prependNewLines > 0) figletTextArr = Array.of(`${'\n'.repeat(prependNewLines)}`).concat(figletTextArr)
if (appendNewLines > 0) figletTextArr = figletTextArr.concat(Array.of(`${'\n'.repeat(appendNewLines)}`))
// indent subsequent lines after the line
// with an initial indented selection
// indent subsequent lines after the first if
// the line with the selection was indented
if (!indentRange.empty) {
figletTextArr = figletTextArr.map((line, index) => {
if (index === 0) {
@ -160,3 +160,32 @@ nova.config.onDidChange('figlet_text.font', (newValue, oldValue) => {
nova.config.onDidChange('figlet_text.previewText', (newValue, oldValue) => {
nova.commands.invoke('figletTextFontPreview')
})
// preview all installed FIGlet fonts in an editor
nova.commands.register('figletTextFontPreviewAll', workspace => {
let message = 'Enter a custom preview text. Leave blank to use the font name for each font preview text output.'
let options = {label: 'Preview Text', placeholder: 'Use Font Name', prompt: 'Generate Previews'}
workspace.showInputPanel(message, options, value => {
if (typeof value !== 'undefined') {
const process = new Process('/usr/bin/env', {args: ['showfigfonts', value]})
let preview = ''
process.onStdout(line => {
preview += line
})
process.onDidExit(status => {
if (status === 0) {
workspace.openFile(nova.fs.tempdir + '/FIGlet Text | All Fonts Preview.txt')
.then(editor => {
editor.edit(e => { e.insert(0, preview) })
editor.scrollToPosition(0)
})
}
})
process.start()
}
})
})

View File

@ -3,14 +3,14 @@
"name": "FIGlet Text",
"organization": "Dan Remollino",
"description": "Convert selected text to FIGlet. Great for adding readable text to the Minimap, creating l33t text headers, and organizing files.",
"version": "1.6.4",
"version": "1.7",
"categories": ["commands", "formatters"],
"entitlements": {
"clipboard": false,
"process": true,
"requests": false,
"filesystem": false
"filesystem": "readwrite"
},
"main": "main.js",
@ -25,7 +25,6 @@
"key": "figlet_text.font",
"title": "Font",
"description": "The FIGlet font to use when converting text.",
"link": "http://www.figlet.org/examples.html",
"type": "enum",
"radio": false,
"values": [
@ -190,7 +189,7 @@
{
"key": "figlet_text.preview",
"title": "Preview",
"description": "Admittedly, this isn't the ideal preview as Nova uses a non-monospaced font for the Preview textbox above. Use the (?) link in the Font selection preference above to open the FIGlet examples webpage in an external browser, or copy the text above and paste it into an editor window.",
"description": "Admittedly, this isn't the ideal preview as Nova uses a non-monospaced output for the Preview textbox above. Use the Extensions -> Preview All Installed FIGlet Fonts menu item to generate an accurate, custom text FIGlet font preview document.",
"type": "text"
}
]
@ -284,6 +283,12 @@
"shortcut": "ctrl-opt-cmd-f",
"when": "editorHasSelection"
}
],
"extensions": [
{
"title": "Preview All Installed FIGlet Fonts",
"command": "figletTextFontPreviewAll"
}
]
},