Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Color picker CkEditor5 #1812

Closed
jeroenfrenken opened this issue Jun 12, 2019 · 13 comments
Closed

[Question] Color picker CkEditor5 #1812

jeroenfrenken opened this issue Jun 12, 2019 · 13 comments
Labels
type:question This issue asks a question (how to...).

Comments

@jeroenfrenken
Copy link

jeroenfrenken commented Jun 12, 2019

Is this a bug report or feature request? (choose one)

Other (Question)

💻 Version of CKEditor

"@ckeditor/ckeditor5-alignment": "11.1.1",
"@ckeditor/ckeditor5-basic-styles": "11.1.1",
"@ckeditor/ckeditor5-core": "12.1.1",
"@ckeditor/ckeditor5-dev-utils": "12.0.1",
"@ckeditor/ckeditor5-dev-webpack-plugin": "8.0.1",
"@ckeditor/ckeditor5-editor-balloon": "12.1.1",
"@ckeditor/ckeditor5-editor-classic": "12.1.1",
"@ckeditor/ckeditor5-essentials": "11.0.2",
"@ckeditor/ckeditor5-font": "11.1.1",
"@ckeditor/ckeditor5-heading": "11.0.2",
"@ckeditor/ckeditor5-link": "11.0.2",
"@ckeditor/ckeditor5-paragraph": "11.0.2",
"@ckeditor/ckeditor5-remove-format": "10.0.1",
"@ckeditor/ckeditor5-theme-lark": "14.0.0",
"@ckeditor/ckeditor5-ui": "13.0.0",
"@ckeditor/ckeditor5-vue": "1.0.0-beta.2",

📃 Other details that might be useful

CkEditor build from source and using it with Vue

Question

I am looking to use a color picker inside the CkEditor which is inline like so:

Screenshot 2019-06-12 at 14 10 47

I am using the ckeditor5-font plugin for textColor but this only shows a color pallet and not a color picker.

I tried to create a custom plugin but I do not see any option where it is possible to add custom html in a Dropdown.

I have a colorpicker working in plain javascript. And wold love to implement that inside my existing toolbar.

Thank you in advance

@jeroenfrenken jeroenfrenken changed the title Color picker CkEditor5 [QUESTION] Color picker CkEditor5 Jun 12, 2019
@jeroenfrenken jeroenfrenken changed the title [QUESTION] Color picker CkEditor5 [Question] Color picker CkEditor5 Jun 12, 2019
@Mgsy
Copy link
Member

Mgsy commented Jun 14, 2019

cc @oleq

@Mgsy Mgsy added the type:question This issue asks a question (how to...). label Jun 17, 2019
@CodeSkills
Copy link

CodeSkills commented Jun 18, 2019

We are looking for the same fearure. This is the last thing we need to move from v4 to v5.

Example:
image

The "Vice barev..." is "Custom color" buttton which opens

image
Better example is in the original post

The two important parts are:

  • enable user to select color from gradient (ideally radius or square box)
  • HEX input that user can past HEX color code

@oleq
Copy link
Member

oleq commented Jun 24, 2019

At this moment, the editor does not offer the color picker feature. But it is possible to use external components in CKEditor 5 dropdowns to bring one.

You'll need to create a new plugin for that and use the DropdownView API. Once rendered, dropdown.panelView.element is a DOM element you can use as a host for the 3rd-party color picker component.

@Mgsy Mgsy added the pending:feedback This issue is blocked by necessary feedback. label Jun 24, 2019
@CodeSkills
Copy link

Is it possible to use that plugin to extend the font color provided functionality, like the picture above? To add the "More colors" button below the predefined colors ?

@oleq
Copy link
Member

oleq commented Jun 24, 2019

I don't think it's an easy task. You'd need to customize the ColorUI plugin so it supports the additional button, some logic to switch between the grid/the picker, and handle the UI interaction (what to display in the grid if the color was selected via the picker?). I'm not sure our API allows customizations so deep.

Developing your own ColorUI plugin sounds like an easier way.

@jeroenfrenken
Copy link
Author

At this moment, the editor does not offer the color picker feature. But it is possible to use external components in CKEditor 5 dropdowns to bring one.

You'll need to create a new plugin for that and use the DropdownView API. Once rendered, dropdown.panelView.element is a DOM element you can use as a host for the 3rd-party color picker component.

Will look into this thanks for your reply

@Mgsy Mgsy closed this as completed Jun 24, 2019
@Mgsy Mgsy added resolution:fixed and removed pending:feedback This issue is blocked by necessary feedback. labels Jun 24, 2019
@AGachet
Copy link

AGachet commented Oct 23, 2019

Yo @jeroenfrenken, did you create your plugin ? If you can share it, it could be appreciate :).
I have the same needs...

@jeroenfrenken
Copy link
Author

@AGachet I went with the default color picker from CK so no option to change color's. I am thinking to write my own plugin in the future when the needs are higher in our product. If so I will share it with you :)

@silvian-io
Copy link

silvian-io commented Nov 11, 2019

I was searching for the same solution. If you are not interested in a specific color code, but only in a greater range of options, I generated 200 color codes that are in a king of optical "order":

image

Add this to you ckeditor config:

fontColor: {
columns: 10,
documentColors: 200,
colors: [
{color: 'hsl(6, 54%, 95%)', label:' '}, {color: 'hsl(6, 54%, 89%)', label:' '}, {color: 'hsl(6, 54%, 78%)', label:' '}, {color: 'hsl(6, 54%, 68%)', label:' '}, {color: 'hsl(6, 54%, 57%)', label:' '}, {color: 'hsl(6, 63%, 46%)', label:' '}, {color: 'hsl(6, 63%, 41%)', label:' '}, {color: 'hsl(6, 63%, 35%)', label:' '}, {color: 'hsl(6, 63%, 29%)', label:' '}, {color: 'hsl(6, 63%, 24%)', label:' '}, {color: 'hsl(6, 78%, 96%)', label:' '}, {color: 'hsl(6, 78%, 91%)', label:' '}, {color: 'hsl(6, 78%, 83%)', label:' '}, {color: 'hsl(6, 78%, 74%)', label:' '}, {color: 'hsl(6, 78%, 66%)', label:' '}, {color: 'hsl(6, 78%, 57%)', label:' '}, {color: 'hsl(6, 59%, 50%)', label:' '}, {color: 'hsl(6, 59%, 43%)', label:' '}, {color: 'hsl(6, 59%, 37%)', label:' '}, {color: 'hsl(6, 59%, 30%)', label:' '}, {color: 'hsl(283, 39%, 95%)', label:' '}, {color: 'hsl(283, 39%, 91%)', label:' '}, {color: 'hsl(283, 39%, 81%)', label:' '}, {color: 'hsl(283, 39%, 72%)', label:' '}, {color: 'hsl(283, 39%, 63%)', label:' '}, {color: 'hsl(283, 39%, 53%)', label:' '}, {color: 'hsl(283, 34%, 47%)', label:' '}, {color: 'hsl(283, 34%, 40%)', label:' '}, {color: 'hsl(283, 34%, 34%)', label:' '}, {color: 'hsl(283, 34%, 28%)', label:' '}, {color: 'hsl(282, 39%, 95%)', label:' '}, {color: 'hsl(282, 39%, 89%)', label:' '}, {color: 'hsl(282, 39%, 79%)', label:' '}, {color: 'hsl(282, 39%, 68%)', label:' '}, {color: 'hsl(282, 39%, 58%)', label:' '}, {color: 'hsl(282, 44%, 47%)', label:' '}, {color: 'hsl(282, 44%, 42%)', label:' '}, {color: 'hsl(282, 44%, 36%)', label:' '}, {color: 'hsl(282, 44%, 30%)', label:' '}, {color: 'hsl(282, 44%, 25%)', label:' '}, {color: 'hsl(204, 51%, 94%)', label:' '}, {color: 'hsl(204, 51%, 89%)', label:' '}, {color: 'hsl(204, 51%, 78%)', label:' '}, {color: 'hsl(204, 51%, 67%)', label:' '}, {color: 'hsl(204, 51%, 55%)', label:' '}, {color: 'hsl(204, 64%, 44%)', label:' '}, {color: 'hsl(204, 64%, 39%)', label:' '}, {color: 'hsl(204, 64%, 34%)', label:' '}, {color: 'hsl(204, 64%, 28%)', label:' '}, {color: 'hsl(204, 64%, 23%)', label:' '}, {color: 'hsl(204, 70%, 95%)', label:' '}, {color: 'hsl(204, 70%, 91%)', label:' '}, {color: 'hsl(204, 70%, 81%)', label:' '}, {color: 'hsl(204, 70%, 72%)', label:' '}, {color: 'hsl(204, 70%, 63%)', label:' '}, {color: 'hsl(204, 70%, 53%)', label:' '}, {color: 'hsl(204, 62%, 47%)', label:' '}, {color: 'hsl(204, 62%, 40%)', label:' '}, {color: 'hsl(204, 62%, 34%)', label:' '}, {color: 'hsl(204, 62%, 28%)', label:' '}, {color: 'hsl(168, 55%, 94%)', label:' '}, {color: 'hsl(168, 55%, 88%)', label:' '}, {color: 'hsl(168, 55%, 77%)', label:' '}, {color: 'hsl(168, 55%, 65%)', label:' '}, {color: 'hsl(168, 55%, 54%)', label:' '}, {color: 'hsl(168, 76%, 42%)', label:' '}, {color: 'hsl(168, 76%, 37%)', label:' '}, {color: 'hsl(168, 76%, 32%)', label:' '}, {color: 'hsl(168, 76%, 27%)', label:' '}, {color: 'hsl(168, 76%, 22%)', label:' '}, {color: 'hsl(168, 42%, 94%)', label:' '}, {color: 'hsl(168, 42%, 87%)', label:' '}, {color: 'hsl(168, 42%, 74%)', label:' '}, {color: 'hsl(168, 42%, 61%)', label:' '}, {color: 'hsl(168, 45%, 49%)', label:' '}, {color: 'hsl(168, 76%, 36%)', label:' '}, {color: 'hsl(168, 76%, 31%)', label:' '}, {color: 'hsl(168, 76%, 27%)', label:' '}, {color: 'hsl(168, 76%, 23%)', label:' '}, {color: 'hsl(168, 76%, 19%)', label:' '}, {color: 'hsl(145, 45%, 94%)', label:' '}, {color: 'hsl(145, 45%, 88%)', label:' '}, {color: 'hsl(145, 45%, 77%)', label:' '}, {color: 'hsl(145, 45%, 65%)', label:' '}, {color: 'hsl(145, 45%, 53%)', label:' '}, {color: 'hsl(145, 63%, 42%)', label:' '}, {color: 'hsl(145, 63%, 37%)', label:' '}, {color: 'hsl(145, 63%, 32%)', label:' '}, {color: 'hsl(145, 63%, 27%)', label:' '}, {color: 'hsl(145, 63%, 22%)', label:' '}, {color: 'hsl(145, 61%, 95%)', label:' '}, {color: 'hsl(145, 61%, 90%)', label:' '}, {color: 'hsl(145, 61%, 80%)', label:' '}, {color: 'hsl(145, 61%, 69%)', label:' '}, {color: 'hsl(145, 61%, 59%)', label:' '}, {color: 'hsl(145, 63%, 49%)', label:' '}, {color: 'hsl(145, 63%, 43%)', label:' '}, {color: 'hsl(145, 63%, 37%)', label:' '}, {color: 'hsl(145, 63%, 31%)', label:' '}, {color: 'hsl(145, 63%, 25%)', label:' '}, {color: 'hsl(48, 89%, 95%)', label:' '}, {color: 'hsl(48, 89%, 90%)', label:' '}, {color: 'hsl(48, 89%, 80%)', label:' '}, {color: 'hsl(48, 89%, 70%)', label:' '}, {color: 'hsl(48, 89%, 60%)', label:' '}, {color: 'hsl(48, 89%, 50%)', label:' '}, {color: 'hsl(48, 88%, 44%)', label:' '}, {color: 'hsl(48, 88%, 38%)', label:' '}, {color: 'hsl(48, 88%, 32%)', label:' '}, {color: 'hsl(48, 88%, 26%)', label:' '}, {color: 'hsl(37, 90%, 95%)', label:' '}, {color: 'hsl(37, 90%, 90%)', label:' '}, {color: 'hsl(37, 90%, 80%)', label:' '}, {color: 'hsl(37, 90%, 71%)', label:' '}, {color: 'hsl(37, 90%, 61%)', label:' '}, {color: 'hsl(37, 90%, 51%)', label:' '}, {color: 'hsl(37, 86%, 45%)', label:' '}, {color: 'hsl(37, 86%, 39%)', label:' '}, {color: 'hsl(37, 86%, 33%)', label:' '}, {color: 'hsl(37, 86%, 27%)', label:' '}, {color: 'hsl(28, 80%, 95%)', label:' '}, {color: 'hsl(28, 80%, 90%)', label:' '}, {color: 'hsl(28, 80%, 81%)', label:' '}, {color: 'hsl(28, 80%, 71%)', label:' '}, {color: 'hsl(28, 80%, 61%)', label:' '}, {color: 'hsl(28, 80%, 52%)', label:' '}, {color: 'hsl(28, 74%, 46%)', label:' '}, {color: 'hsl(28, 74%, 39%)', label:' '}, {color: 'hsl(28, 74%, 33%)', label:' '}, {color: 'hsl(28, 74%, 27%)', label:' '}, {color: 'hsl(24, 71%, 94%)', label:' '}, {color: 'hsl(24, 71%, 88%)', label:' '}, {color: 'hsl(24, 71%, 77%)', label:' '}, {color: 'hsl(24, 71%, 65%)', label:' '}, {color: 'hsl(24, 71%, 53%)', label:' '}, {color: 'hsl(24, 100%, 41%)', label:' '}, {color: 'hsl(24, 100%, 36%)', label:' '}, {color: 'hsl(24, 100%, 31%)', label:' '}, {color: 'hsl(24, 100%, 26%)', label:' '}, {color: 'hsl(24, 100%, 22%)', label:' '}, {color: 'hsl(192, 15%, 99%)', label:' '}, {color: 'hsl(192, 15%, 99%)', label:' '}, {color: 'hsl(192, 15%, 97%)', label:' '}, {color: 'hsl(192, 15%, 96%)', label:' '}, {color: 'hsl(192, 15%, 95%)', label:' '}, {color: 'hsl(192, 15%, 94%)', label:' '}, {color: 'hsl(192, 5%, 82%)', label:' '}, {color: 'hsl(192, 3%, 71%)', label:' '}, {color: 'hsl(192, 2%, 60%)', label:' '}, {color: 'hsl(192, 1%, 49%)', label:' '}, {color: 'hsl(204, 8%, 98%)', label:' '}, {color: 'hsl(204, 8%, 95%)', label:' '}, {color: 'hsl(204, 8%, 90%)', label:' '}, {color: 'hsl(204, 8%, 86%)', label:' '}, {color: 'hsl(204, 8%, 81%)', label:' '}, {color: 'hsl(204, 8%, 76%)', label:' '}, {color: 'hsl(204, 5%, 67%)', label:' '}, {color: 'hsl(204, 4%, 58%)', label:' '}, {color: 'hsl(204, 3%, 49%)', label:' '}, {color: 'hsl(204, 3%, 40%)', label:' '}, {color: 'hsl(184, 9%, 96%)', label:' '}, {color: 'hsl(184, 9%, 92%)', label:' '}, {color: 'hsl(184, 9%, 85%)', label:' '}, {color: 'hsl(184, 9%, 77%)', label:' '}, {color: 'hsl(184, 9%, 69%)', label:' '}, {color: 'hsl(184, 9%, 62%)', label:' '}, {color: 'hsl(184, 6%, 54%)', label:' '}, {color: 'hsl(184, 5%, 47%)', label:' '}, {color: 'hsl(184, 5%, 40%)', label:' '}, {color: 'hsl(184, 5%, 32%)', label:' '}, {color: 'hsl(184, 6%, 95%)', label:' '}, {color: 'hsl(184, 6%, 91%)', label:' '}, {color: 'hsl(184, 6%, 81%)', label:' '}, {color: 'hsl(184, 6%, 72%)', label:' '}, {color: 'hsl(184, 6%, 62%)', label:' '}, {color: 'hsl(184, 6%, 53%)', label:' '}, {color: 'hsl(184, 5%, 46%)', label:' '}, {color: 'hsl(184, 5%, 40%)', label:' '}, {color: 'hsl(184, 5%, 34%)', label:' '}, {color: 'hsl(184, 5%, 27%)', label:' '}, {color: 'hsl(210, 12%, 93%)', label:' '}, {color: 'hsl(210, 12%, 86%)', label:' '}, {color: 'hsl(210, 12%, 71%)', label:' '}, {color: 'hsl(210, 12%, 57%)', label:' '}, {color: 'hsl(210, 15%, 43%)', label:' '}, {color: 'hsl(210, 29%, 29%)', label:' '}, {color: 'hsl(210, 29%, 25%)', label:' '}, {color: 'hsl(210, 29%, 22%)', label:' '}, {color: 'hsl(210, 29%, 18%)', label:' '}, {color: 'hsl(210, 29%, 15%)', label:' '}, {color: 'hsl(210, 9%, 92%)', label:' '}, {color: 'hsl(210, 9%, 85%)', label:' '}, {color: 'hsl(210, 9%, 70%)', label:' '}, {color: 'hsl(210, 9%, 55%)', label:' '}, {color: 'hsl(210, 14%, 39%)', label:' '}, {color: 'hsl(210, 29%, 24%)', label:' '}, {color: 'hsl(210, 29%, 21%)', label:' '}, {color: 'hsl(210, 29%, 18%)', label:' '}, {color: 'hsl(210, 29%, 16%)', label:' '}, {color: 'hsl(210, 29%, 13%)', label:' '}
]
},

@pshurygin
Copy link

Is anyone is looking for some directions, here is the implementation of plugin to display color palette inside ckeditor dropdown:
https://github.com/pshurygin/ckeditor5-font/tree/master/src
It is based on official FontColor feature & jscolor colorpicker.
Please beware that this exact implementation is probably not ready-to-use as-is, because it contains some more changes to FontColorPlugin, which are required for my project. For example, document colors are replaced with theme colors. Also, there are only 4 translations.

@AGachet
Copy link

AGachet commented Dec 2, 2019

or you can take a look on that => https://www.npmjs.com/package/@solomoto/ckeditor5-font-color
This package implements support for the font color feature with color picker.

@anakochevska
Copy link

@pshurygin I was using your plugin and it was working perfectly! Nice job! :)
But now, I had to update the CKEditor, and an error appeared when I installed your plugin again: Uncaught CKEditorError: ckeditor-duplicated-modules: Some CKEditor 5 modules are duplicated (probably the cause are different versions of some dependencies).
Would it be possible to update your plugin to use latest CK Editor? (I think 23 is the version)

@ignaciocasal
Copy link

@pshurygin I was using your plugin and it was working perfectly! Nice job! :)
But now, I had to update the CKEditor, and an error appeared when I installed your plugin again: Uncaught CKEditorError: ckeditor-duplicated-modules: Some CKEditor 5 modules are duplicated (probably the cause are different versions of some dependencies).
Would it be possible to update your plugin to use latest CK Editor? (I think 23 is the version)

Hey, maybe it's too late but there is a pending pull request in the @pshurygin plugin that solves the problem!
#pshurygin/ckeditor5-font-color@9ea27ab

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:question This issue asks a question (how to...).
Projects
None yet
Development

No branches or pull requests

9 participants