You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

inline-style-editor

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

inline-style-editor

Update CSS rules or add inline style to elements visualy

1.0.4
npmnpm
Version published
Weekly downloads
6
Maintainers
1
Weekly downloads
 
Created
Source

inline-style-editor

Lightweight (~55KB, ~22KB gzipped) tool to graphically change style and CSS (on classes or inline) using a graphical interface.

See demo.

Install

npm install inline-style-editor

Then, to use it:

In a Svelte project

<script>
  import InlineStyleEditor from "inline-style-editor";
</script>

<InlineStyleEditor />

As a JS module

import InlineStyleEditor from "node_modules/inline-style-editor/dist/inline-style-editor.mjs";
new InlineStyleEditor();

Also don't forget to import the css in: node_modules/inline-style-editor/dist/inline-style-editor.css.

Using a CDN:

<link rel="stylesheet" type="text/css" href="https://unpkg.com/inline-style-editor@1.0.0/dist/inline-style-editor.css" />
<script src="https://unpkg.com/inline-style-editor@1.0.0/dist/inline-style-editor.js"></script>

Examples

Manual opening of editor:

const editor = new InlineStyleEditor();
document.body.addEventListener('click', (e) => {
    const target = e.target;
    editor.open(target, e.pageX, e.pageY);
});

Or automatic (in which case it automatically listen to the <body> element for clicks):

new InlineStyleEditor({
  listenOnClick: true,
});

Options

optiontypeDescription
listenOnClickBooleanDefault to false. If true, click events will be listened on the <body> element, and the editor opened where clicked
getAdditionalElemsFunctionA function called everytime the editor is opened. Should return a list of HTMLElement, that will be editable as well
onStyleChangedFunctionA function called everytime a style is modified. The first argument is the current target element, the second the edited CSS rule, or 'inline' if inline, the third the CSS prop name, the fourth the prop value

Suported css properties

  • border-radius
  • border-width
  • border-style
  • border-color
  • font-family
  • font-size
  • font-weight
  • color
  • stroke-width
  • stroke
  • fill
  • stroke-dasharray
  • background-color

FAQs

Package last updated on 06 Sep 2022

Did you know?

Socket

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.

Install

Related posts