🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

ep_clear_formatting

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ep_clear_formatting - npm Package Compare versions

Comparing version

to
0.0.2

2

package.json
{
"name": "ep_clear_formatting",
"version": "0.0.1",
"version": "0.0.2",
"keywords": ["clear", "formatting"],

@@ -5,0 +5,0 @@ "description": "Clear formatting on a selection, this plugin requires the file menu",

exports.postAceInit = function(hook, context){
$('#clearFormatting').click(function(){
context.ace.callWithAce(function(ace){
var rep = ace.ace_getRep();
var rep = ace.ace_getRep(); // get the current user selection
var isSelection = (rep.selStart[0] !== rep.selEnd[0] || rep.selStart[1] !== rep.selEnd[1]);
if(!isSelection) return false; // No point proceeding if no selection..
// note this is just bodged together, we need to query the documentattributemanager probably to find out
// which attributes exist...
ace.ace_setAttributeOnSelection("bold", false);
ace.ace_setAttributeOnSelection("italic", false);
ace.ace_setAttributeOnSelection("underline", false);
ace.ace_setAttributeOnSelection("strikethrough", false);
ace.ace_setAttributeOnSelection("fontcolor", false);
ace.ace_setAttributeOnSelection("color", false);
ace.ace_setAttributeOnSelection("subscript", false);
ace.ace_setAttributeOnSelection("superscript", false);
var attrs = rep.apool.attribToNum; // get the attributes on this document
$.each(attrs, function(k, v){ // for each attribute
var attr = k.split(",")[0]; // get the name of the attribute
if(attr !== "author"){ // if its not an author attribute
ace.ace_setAttributeOnSelection(attr, false); // set the attribute to false
}
});
},'clearFormatting' , true);
});
}