pilotmoon / PopClip-Extensions

Source code for extensions in the official PopClip Extensions directory.

Home Page:https://www.popclip.app/extensions/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to customize brackets extension

mindstudy opened this issue · comments

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.

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.