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

userStyles - more than 3 users? #131

Open
porjo opened this issue Oct 13, 2017 · 3 comments
Open

userStyles - more than 3 users? #131

porjo opened this issue Oct 13, 2017 · 3 comments

Comments

@porjo
Copy link

porjo commented Oct 13, 2017

Edits made by users 1,2,3 get a different colour but users 4,5,6 get same colours as 1,2,3. It would be nice if user 4,5,6,[...] had unique colours.

One solution would be to have the the option of having colours auto-generated by lite plugin. In my use-case I don't particularly care if the same user gets the same colour all the time, just so long as different users have contrasting colours so I can easily distinguish between different edits.

@porjo porjo changed the title userStyle - more than 3 users? userStyles - more than 3 users? Oct 13, 2017
@imdfl
Copy link
Collaborator

imdfl commented Oct 13, 2017

The styles associated with user ids are set in the plugin css file (ckeditor/plugins/lite/css/lite.css). For example, the style of the classes .ice-ins.ice-cts-2 determines the style of inserted text by the user with style index 2.
Styles are associated with the users' internal style ids, which by default go from 1 up, in the order of the users' introduction into the system. You can associate this internal style identifier with a specific user through the lite.userStyles configuration option:

lite.userStyles = {
		"21": 3, // user id 21 is associated with style id 3
		"15": 1,
		"18": 2
	};

@porjo
Copy link
Author

porjo commented Oct 15, 2017

Thanks for the explanation. How do I ensure that user 4,5,6 have a different colour from 1,2,3 without having to modify lite.css? I've tried, for example, setting class .ice-cts-4 in my site's global stylesheet but that doesn't get applied as ckeditor is inside an iframe.

@imdfl
Copy link
Collaborator

imdfl commented Oct 18, 2017

Well, The current code does not generate styles, it only creates classes that should match styles defined in lite.css.
However, not all is lost. You can use the lite.cssPath configuration option (in your ckeditor config) to force LITE to load your own css instead of lite.css (I'll try to add an option to make this config an array, so you could augment lite.css instead of replacing it).

For example, if your page is editor.html and there are css and ckeditor folders next to it, with ckeditor containing plugins/lite/* and the css folder containing your own file, say porjo.css, then if you set the lite.cssPath option to "../../../css/porjo.css" (this is relative to the location of the plugin), LITE will use this file instead of lite.css.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants