Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ep_clear_formatting

Package Overview
Dependencies
Maintainers
1
Versions
20
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 0.0.1 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);
});
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc