pilotmoon / PopClip-Extensions

Source code for extensions in the official PopClip Extensions directory.
https://www.popclip.app/extensions/
MIT License
1.92k stars 440 forks source link

How to customize brackets extension #1178

Closed mindstudy closed 2 years ago

mindstudy commented 2 years ago

I am a user of backlink notes (Roamresearch). In the course of my writing, it is often necessary to select some words to add double squares, brackets or curly braces before and after.

now, I solved the problem by modify the MarkdownTool extension. Roam.popclipext.zip

========== old info

I downloaded the Brackets extension. It works well but a single character does't meet the need for doubles. So I tried to modify some codes in Config.js with a little knowledge of JS:

replaced popclip.pasteText(style[0] + selection.text + style[style.length - 1]);

with: popclip.pasteText(style[0] + style[0] + selection.text + style[style.length - 1] + style[style.length - 1]);

and I also modified the "identifier" in Config.json and Config.plist to avoid the signature problem.

The modified Brackets.popclipext can be installed. It appeared on the extension panel of the menu bar and the setting for four choice is normal. But, when a word is selected in the text editor, the square or bracket icon does't appear on the floating PopClip bar.

pilotmoon commented 2 years ago

The code you pasted looks correct actually, so I'm not sure what was going wrong. Anyway, glad you have got something working. Reopen this if you want to pursue the original code.