问题
There is a question here on stack overflow that answers PART of my question (see link) https://stackoverflow.com/a/17431971/2461910
Unfortunately, this solution is cumbersome, because it always encodes/decodes the ENTIRE current document.
My question is: How can I change the JavaScript in that solution to only modify whatever text is SELECTED in the current document?
I tried using Editor.currentView.selected
, but that throws an error when the script runs. If only I could find a document describing what all functions objects and properties are visible to the jN plugin. I suppose that's a topic for another question. Oh well.
回答1:
For URL Decode in Notepad++ : Use the built-in MIME Tools plugin. It comes with the default Notepad++ installation.
Notepad++ url Decode / Encode with MIME Tools screenshot
回答2:
Arg. So often we find that just as we had given up, we were on the verge of finding our own answer. So it was in this case. To answer both my curiosities expressed above:
1) A list of the objects and their members that are part of the jN pugin can be found on that project's home page here: http://jn-npp-plugin.googlecode.com/svn/wiki/API/api.xml
2) To access the SELECTED text in the current document view, use Editor.currentView.selection
, not Editor.currentView.selected
.
The only question this leaves is how to make the encoded/decoded text REMAIN selected after the conversion. The linked document above provides no method or property for selecting/deselecting text--only for getting/setting what text is already selected, and it gets un-selected upon setting/changing it.
来源:https://stackoverflow.com/questions/26147645/how-to-url-encode-decode-selected-text-in-notepad