Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
styleit-api
Advanced tools
Readme
npm i styleit-api --save
import StyleIt from 'styleit-api';
Mode | Description |
---|---|
Toggle | Style elements with on/off functionality, like bold,underline,italic |
Extend | Only extends the currect style, font-size, color, backgorund |
import StyleIt from 'styleit-api';
const styleIt = new StyleIt("editor-id");
1cont MODES = styleIt.MODES;
const underline =()=> styleIt.execCmd('text-decoration', 'underline', Modes.Toggle);
const bold =()=> styleIt.execCmd('font-weight', 'bold', MODES.Toggle);
import StyleIt from 'styleit-api';
const styleIt = new StyleIt("editor-id");
cont MODES = styleIt.MODES;
const changeColor =(color)=> styleIt.execCmd('color', color, MODES.Extend);
const changeSize =(size)=> styleIt.execCmd('font-size', size, MODES.Extend);
The textAlign, padding, margin, line-height and more property sets the horizontal alignment of text in a block level element. It must be used on a block level element (p, div, etc.)
import StyleIt from 'styleit-api';
const styleIt = new StyleIt("editor-id");
const MODES = styleIt.MODES;
const changeAlign =(align)=> styleIt.execCmd('text-align', align, MODES.Extend,{
target:'block'
});
import StyleIt from 'styleit-api';
const styleIt = new StyleIt("editor-id");
styleIt.on("inspect",(collectedStyles) => {
// do something with the styles..
})
Adds an HTML block-level element around the line containing the current selection.
Tag Name |
---|
H1 |
H2 |
H3 |
H4 |
H5 |
H6 |
P |
PRE |
ADDRESS |
import StyleIt from 'styleit-api';
const styleIt = new StyleIt("editor-id");
const toggleClass = (tagName)=> styleIt.formatBlock(tagName);
Tag Name |
---|
B |
STRONG |
MARK |
EM |
I |
S |
STRIKE |
DEL |
U |
SUB |
SUP |
SMALL |
SUB |
import StyleIt from 'styleit-api';
const styleIt = new StyleIt("editor-id");
styleIt.toggleWith("strong");
The Css Class API lets you create a Css class with your pre-made rules. You can pass this class to a StyleIt object and use it as a markup just like underline or bold.
import StyleIt from 'styleit-api';
const styleIt = new StyleIt("editor-id");
const toggleClass = (name)=> styleIt.toggleClass(name);
import StyleIt from 'styleit-api';
const styleIt = new StyleIt("editor-id");
const createLink = () => styleIt.link({
href:'styleIt.com',
protocol:'https'
target:'_blank'
});
import StyleIt from 'styleit-api';
const styleIt = new StyleIt("editor-id");
styleIt.on("inspectLink",(props) => {
// {href,protocl,target,element}
})
import StyleIt from 'styleit-api';
const styleIt = new StyleIt("editor-id");
const contentAsJson = styleIt.save();
import StyleIt from 'styleit-api';
const styleIt = new StyleIt("editor-id");
styleIt.load(contentAsJson);
Will remove all StyleIt functionality.
import StyleIt from 'styleit-api';
const styleIt = new StyleIt("editor-id");
styleIt.destroy();
All contributions are super welcome!
FAQs
StyleIt is a simple text editor API built for Developers.
The npm package styleit-api receives a total of 43 weekly downloads. As such, styleit-api popularity was classified as not popular.
We found that styleit-api 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.