diff --git a/extensions/Brackets.popclipextz b/extensions/Brackets.popclipextz index dbf96aa4..655a34d7 100644 Binary files a/extensions/Brackets.popclipextz and b/extensions/Brackets.popclipextz differ diff --git a/extensions/Quotes.popclipextz b/extensions/Quotes.popclipextz index 2867b068..b7ce2298 100644 Binary files a/extensions/Quotes.popclipextz and b/extensions/Quotes.popclipextz differ diff --git a/source/Brackets.popclipext/Config.js b/source/Brackets.popclipext/Config.js deleted file mode 100644 index ab1628d3..00000000 --- a/source/Brackets.popclipext/Config.js +++ /dev/null @@ -1,40 +0,0 @@ -"use strict"; -define(function () { - const styles = [ - '(round)', - '[square]', - '{curly}', - '' - ]; - function makeIcon(index) { - return ['brackets-round.png', 'brackets-square.png', 'brackets-curly.png', 'brackets-angle.png'][index]; - } - function makeIdentifier(index) { - return `style-${index}`; - } - const extension = { - options: styles.map((style, index) => { - return { - identifier: makeIdentifier(index), - label: style, - type: 'boolean', - icon: makeIcon(index), - defaultValue: !(index > 0) - }; - }), - actions(selection, options) { - if (selection.text.length > 0) { - return styles.filter((style, index) => options[makeIdentifier(index)]).map((style, index) => { - return { - title: styles[index], - icon: makeIcon(index), - code: (selection) => { - popclip.pasteText(style[0] + selection.text + style[2]); - } - }; - }); - } - } - }; - return extension; -}); diff --git a/source/Brackets.popclipext/Config.json b/source/Brackets.popclipext/Config.json index e0492355..dd92a160 100644 --- a/source/Brackets.popclipext/Config.json +++ b/source/Brackets.popclipext/Config.json @@ -3,6 +3,7 @@ "identifier" : "com.pilotmoon.popclip.extension.brackets", "name" : "Brackets", "icon" : "brackets-round.png", - "popclipVersion" : 3749, - "entitlements": ["dynamic"] + "popclipVersion" : 4225, + "entitlements": ["dynamic"], + "module": "brackets.ts" } \ No newline at end of file diff --git a/source/Brackets.popclipext/Config.ts b/source/Brackets.popclipext/Config.ts deleted file mode 100644 index 01125295..00000000 --- a/source/Brackets.popclipext/Config.ts +++ /dev/null @@ -1,39 +0,0 @@ -define(function () { - const styles = [ - '(round)', - '[square]', - '{curly}', - '' - ] - function makeIcon (index: number): string { - return ['brackets-round.png', 'brackets-square.png', 'brackets-curly.png', 'brackets-angle.png'][index] - } - function makeIdentifier (index: number): string { - return `style-${index}` - } - const extension: Extension = { - options: styles.map((style, index) => { - return { - identifier: makeIdentifier(index), - label: style, - type: 'boolean', - icon: makeIcon(index), - defaultValue: !(index > 0) - } - }), - actions (selection, options) { - if (selection.text.length > 0) { - return styles.filter((style, index) => options[makeIdentifier(index)]).map((style, index) => { - return { - title: styles[index], - icon: makeIcon(index), - code: (selection) => { - popclip.pasteText(style[0] + selection.text + style[2]) - } - } - }) - } - } - } - return extension -}) diff --git a/source/Brackets.popclipext/brackets.ts b/source/Brackets.popclipext/brackets.ts new file mode 100644 index 00000000..2bb862a1 --- /dev/null +++ b/source/Brackets.popclipext/brackets.ts @@ -0,0 +1,45 @@ +const styles = [ + "(round)", + "[square]", + "{curly}", + "", +]; + +function makeIcon(index: number): string { + return [ + "brackets-round.png", + "brackets-square.png", + "brackets-curly.png", + "brackets-angle.png", + ][index]; +} + +function makeIdentifier(index: number): string { + return `style-${index}`; +} + +defineExtension({ + options: styles.map((style, index) => { + return { + identifier: makeIdentifier(index), + label: style, + type: "boolean", + icon: makeIcon(index), + defaultValue: !(index > 0), + }; + }), + actions: function (selection, options) { + if (selection.text.length > 0) { + return styles.filter((style, index) => options[makeIdentifier(index)]) + .map((style, index) => { + return { + title: styles[index], + icon: makeIcon(index), + code: (selection) => { + popclip.pasteText(style[0] + selection.text + style[2]); + }, + }; + }); + } + } +}); diff --git a/source/Quotes.popclipext/Config.js b/source/Quotes.popclipext/Config.js deleted file mode 100644 index ecfdbf6d..00000000 --- a/source/Quotes.popclipext/Config.js +++ /dev/null @@ -1,51 +0,0 @@ -"use strict"; -define(function () { - // the possible quotes styles - const styles = [ - '“…”', - '‘…’', - '"…"', - "'…'", - '`…`', - '«…»', - '‹…›', - '»…«', - '›…‹', - '「…」', - '『…』', - '„…“', - '‚…‘' - ]; - // generate square icon - function makeIcon(style) { - return `[[${style[0]}${style[2]}]]`; - } - function makeIdentifier(index) { - return `style-${index}`; - } - const extension = { - options: styles.map((style, index) => { - return { - identifier: makeIdentifier(index), - label: style, - type: 'boolean', - icon: makeIcon(style), - defaultValue: !(index > 0) - }; - }), - actions(selection, options) { - if (selection.text.length > 0) { - return styles.filter((style, index) => options[makeIdentifier(index)]).map((style, index) => { - return { - title: styles[index], - icon: makeIcon(style), - code: (selection) => { - popclip.pasteText(style[0] + selection.text + style[2]); - } - }; - }); - } - } - }; - return extension; -}); diff --git a/source/Quotes.popclipext/Config.json b/source/Quotes.popclipext/Config.json index 1e1a85c4..8416fccf 100644 --- a/source/Quotes.popclipext/Config.json +++ b/source/Quotes.popclipext/Config.json @@ -3,6 +3,7 @@ "identifier" : "com.pilotmoon.popclip.extension.quotes", "name" : "Quotes", "icon" : "quotes.png", - "popclipVersion" : 3749, - "note" : "Updated 12 Oct 2021: Added backticks" + "popclipVersion" : 4225, + "entitlements" : ["dynamic"], + "module" : "quotes.ts" } \ No newline at end of file diff --git a/source/Quotes.popclipext/Config.ts b/source/Quotes.popclipext/Config.ts deleted file mode 100644 index b10a8e61..00000000 --- a/source/Quotes.popclipext/Config.ts +++ /dev/null @@ -1,54 +0,0 @@ -define(function () { - // the possible quotes styles - const styles = [ - '“…”', - '‘…’', - '"…"', - "'…'", - '`…`', - '«…»', - '‹…›', - '»…«', - '›…‹', - '「…」', - '『…』', - '„…“', - '‚…‘' - ] - - // generate square icon - function makeIcon (style: string): string { - return `[[${style[0]}${style[2]}]]` - } - - function makeIdentifier (index: number): string { - return `style-${index}` - } - - const extension: Extension = { - options: styles.map((style, index) => { - return { - identifier: makeIdentifier(index), - label: style, - type: 'boolean', - icon: makeIcon(style), - defaultValue: !(index > 0) - } - }), - actions (selection, options) { - if (selection.text.length > 0) { - return styles.filter((style, index) => options[makeIdentifier(index)]).map((style, index) => { - return { - title: styles[index], - icon: makeIcon(style), - code: (selection) => { - popclip.pasteText(style[0] + selection.text + style[2]) - } - } - }) - } - } - } - - return extension -}) diff --git a/source/Quotes.popclipext/quotes.ts b/source/Quotes.popclipext/quotes.ts new file mode 100644 index 00000000..936f2ef7 --- /dev/null +++ b/source/Quotes.popclipext/quotes.ts @@ -0,0 +1,53 @@ +// the possible quotes styles +const styles = [ + "“…”", + "‘…’", + '"…"', + "'…'", + "`…`", + "«…»", + "‹…›", + "»…«", + "›…‹", + "「…」", + "『…』", + "„…“", + "‚…‘", +]; + +// generate square icon +function makeIcon(style: string): string { + return `[[${style[0]}${style[2]}]]`; +} + +function makeIdentifier(index: number): string { + return `style-${index}`; +} + +const extension: Extension = { + options: styles.map((style, index) => { + return { + identifier: makeIdentifier(index), + label: style, + type: "boolean", + icon: makeIcon(style), + defaultValue: !(index > 0), + }; + }), + actions(selection, options) { + if (selection.text.length > 0) { + return styles.filter((style, index) => options[makeIdentifier(index)]) + .map((style, index) => { + return { + title: styles[index], + icon: makeIcon(style), + code: (selection) => { + popclip.pasteText(style[0] + selection.text + style[2]); + }, + }; + }); + } + }, +}; + +export default extension;