
Security News
Opengrep Adds Apex Support and New Rule Controls in Latest Updates
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.
medium-editor-auto-style-extension
Advanced tools
AutoStyle is an extension for the Medium Editor.
Version 2.0.0 is not backwards compatible.
AutoStyleExtension for Medium Editor allows auto-styling of words. The auto-styling is defined by a configuration object, which gets passed to the constructur.
In detail:
Try out the live example.
npm install medium-editor
npm install medium-editor-auto-style-extension
index.js
MediumEditor = require('medium-editor');
AutoStyleExtension = require('medium-editor-auto-style-extension');
index.html
<script type="text/javascript" src="<path>/medium-editor.js"></script>
<script type="text/javascript" src="<path>/auto-style.js"></script>
<style type="text/css">
.combine-class-one {
border: 2px dotted green;
}
.combine-class-two {
background-color:gold;
}
</style>
<div class="editable">CömbineStyleAndClass, CombineStyles, CombineClasses, gräy gräyx, oraNGE oraNGEX, ÖÖÖ</div>
<script type="text/javascript">
var editor = new MediumEditor('.editable', {
extensions: {
'auto-highlight': new AutoStyleExtension({
config: {
sectionA: {
matchcase: false,
wordsonly: false,
class: 'combine-class-one',
style: 'color:red;',
words: ['CömbineStyleAndClass']
},
sectionB: {
matchcase: false,
wordsonly: false,
style: 'background-color:#aaa;',
words: ['gräy']
},
sectionC: {
matchcase: true,
wordsonly: true,
style: 'background-color:orange;',
words: ['oraNGE']
},
sectionD: {
matchcase: true,
wordsonly: true,
class: 'combine-class-one',
words: ['CombineClasses']
},
sectionE: {
matchcase: true,
wordsonly: true,
class: 'combine-class-two',
words: ['CombineClasses']
},
sectionF: {
matchcase: true,
wordsonly: true,
style: 'border: 2px dotted green;',
words: ['CombineStyles']
},
sectionG: {
matchcase: true,
wordsonly: true,
style: 'background-color:gold;',
words: ['CombineStyles']
},
sectionH: {
matchcase: false,
wordsonly: false,
style: 'background-color:silver;',
words: ['ÖÖÖ']
}
}
})
}
});
</script>
Additional methods allow manipulation of sections during runtime
getConfig: function() {
...
},
setConfig: function(config) {
...
},
removeConfigSection: function(sectionName) {
...
},
setConfigSection: function(sectionName, sectionObject) {
...
},
// Applies all config styles to the text.
// Useful for triggering via external code.
applyStyles: function() {
...
}
Changing the configuration does not cause re-evaluation of the content implicitly. Call the function applyStyles()
manually to re-evaluate the style of the content.
var extension = editor.getExtensionByName('auto-style');
extension.setConfigSection('your-section-name', {
matchcase: false,
wordsonly: true,
//class: 'a-class',
style: 'color:red;',
words: ['some','red','words']
});
extension.applyStyles();
2.0.0
extension.applyStyles()
to apply configuration modification made during runtime1.1.0
1.0.0
This implementation is based on the inbuild AutoLink plugin of Medium Editor.
FAQs
AutoStyle is an extension for the Medium Editor.
The npm package medium-editor-auto-style-extension receives a total of 12 weekly downloads. As such, medium-editor-auto-style-extension popularity was classified as not popular.
We found that medium-editor-auto-style-extension demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.