Socket
Book a DemoInstallSign in
Socket

@limpopo113/editorjs-color-picker

Package Overview
Dependencies
Maintainers
0
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@limpopo113/editorjs-color-picker

https://github.com/user-attachments/assets/c22b0e96-a0a2-4187-ba7a-0e8be3cfe9d1

1.1.2
latest
npmnpm
Version published
Weekly downloads
1
Maintainers
0
Weekly downloads
 
Created
Source

Color Picker Tool for Editor.js

https://github.com/user-attachments/assets/c22b0e96-a0a2-4187-ba7a-0e8be3cfe9d1

Installation

Get the package

yarn add editorjs-color-picker

Usage

Add a new Tool to the tools property of the Editor.js initial config.

import ColorPicker from 'editorjs-color-picker';

const editor = new EditorJS({
  ...

  tools: {
    ...
    ColorPicker: {
      class: ColorPicker,
    },
  }

  ...
});

If you don't want the text to retain its colors every time you copy and paste it into the editor, you can use the ColorPickerWithoutSanitize class.

import { ColorPickerWithoutSanitize } from 'editorjs-color-picker';

const editor = new EditorJS({
  ...

  tools: {
    ...
    ColorPicker: {
      class: ColorPickerWithoutSanitize,
    },
  }

  ...
});

Config Params

The Paragraph Tool supports these configuration parameters:

FieldTypeDescription
colorsstring[](there are default colors) Array of colors you want
columnsnumber(default: 7) Number of columns to display

Issues with Copy and Paste

If you copy and paste text with a different background color, it adopts the style of the <span>.
The only solution I’ve found so far, without modifying the paragraph component and its onPaste handler, is to apply this style.
For now, I’m only attaching it here without adding it to the library, as it might interfere with other plugins.
So, anyone interested should try applying this style:

.ce-paragraph span {
  background-color: unset !important;
}

If anyone finds a more elegant solution, can open a PR, and we’ll fix it.

FAQs

Package last updated on 07 Feb 2025

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

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.