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

Allow a more flexible toolbar configuration in the dropdown #2602

Closed
oleq opened this issue Feb 19, 2018 · 7 comments
Closed

Allow a more flexible toolbar configuration in the dropdown #2602

oleq opened this issue Feb 19, 2018 · 7 comments
Labels
package:highlight resolution:expired This issue was closed due to lack of feedback. status:discussion type:feature This issue reports a feature request (an idea for a new functionality or a missing option).

Comments

@oleq
Copy link
Member

oleq commented Feb 19, 2018

A follow-up of ckeditor/ckeditor5-highlight#6 (comment). Quoting myself:

Since the highlight feature dropdown uses a basic ToolbarView, I wonder if we could simply make the highlight configuration compatible with the toolbar config. I mean here a support for toolbar separators (|), that developers may want to use to group the buttons if only to separate pens from markers. WDYT?

image

A mixed-up approach

ClassicEditor
	.create( document.querySelector( '#snippet-custom-highlight-options' ), {
		toolbar: {
			items: [
				'headings', '|', 'highlightDropdown', 'bulletedList', 'numberedList', 'undo', 'redo'
			],
			viewportTopOffset: 60
		},
		highlight: {
			options: [
				{ model: 'greenMarker', class: 'marker-green', ... },
				{ model: 'bluePen', class: 'pen-blue', ... },
				'|',
				{ model: 'fooPen', class: 'pen-foo', ... }
				'|',
				'removeHighlight'
			]
		}
	} )
	.then( editor => {
		window.editor = editor;
	} )
	.catch( err => {
		console.error( err.stack );
	} );

A separate property approach

It makes more sense to me because it doesn't mix up the content logic and the UI.

In such situation, the order in options doesn't matter. We also provide a default toolbar layout, when no specified (and the default is toolbar: [ all options, '|', 'removeHighlight' ])

ClassicEditor
	.create( document.querySelector( '#snippet-custom-highlight-options' ), {
		toolbar: {
			items: [
				'headings', '|', 'highlightDropdown', 'bulletedList', 'numberedList', 'undo', 'redo'
			],
			viewportTopOffset: 60
		},
		highlight: {
			options: [
				{ model: 'greenMarker', class: 'marker-green', ... },
				{ model: 'bluePen', class: 'pen-blue', ... },
				{ model: 'fooPen', class: 'pen-foo', ... }
			],
			toolbar: [ 
				'highlight:greenMarker', 
				'highlight:bluePen', 
				'|', 
				'highlight:fooPen', 
				'|', 
				'removeHighlight' 
			]
		}
	} )
	.then( editor => {
		window.editor = editor;
	} )
	.catch( err => {
		console.error( err.stack );
	} );
@dkonopka
Copy link
Contributor

Separating pens and markers 👍 👍 👍

@oleq
Copy link
Member Author

oleq commented Feb 20, 2018

@jodator
Copy link
Contributor

jodator commented Feb 20, 2018

The second one would be more precise as we can have either highlightDropdown or individual buttons in toolbar:

selection_066 or selection_065

I think that the latter option would be less confusing as you could just omit toolbar setting and use buttons instead.

The question is how to deal with missing toolbar property? Use default algorithm as it is now?

@oleq
Copy link
Member Author

oleq commented Feb 20, 2018

The question is how to deal with missing toolbar property? Use default algorithm as it is now?

Like how to determine the default value of highlight.toolbar? The same way it is determined now.

@mlewand mlewand transferred this issue from ckeditor/ckeditor5-highlight Oct 9, 2019
@mlewand mlewand added this to the backlog milestone Oct 9, 2019
@mlewand mlewand added status:discussion type:feature This issue reports a feature request (an idea for a new functionality or a missing option). package:highlight labels Oct 9, 2019
@pomek pomek removed this from the backlog milestone Feb 21, 2022
@CKEditorBot
Copy link
Collaborator

There has been no activity on this issue for the past year. We've marked it as stale and will close it in 30 days. We understand it may be relevant, so if you're interested in the solution, leave a comment or reaction under this issue.

@CKEditorBot
Copy link
Collaborator

There has been no activity on this issue for the past year. We've marked it as stale and will close it in 30 days. We understand it may still be relevant, so if you're interested in the solution, leave a comment or reaction under this issue.

@CKEditorBot
Copy link
Collaborator

We've closed your issue due to inactivity over the last year. We understand that the issue may still be relevant. If so, feel free to open a new one (and link this issue to it).

@CKEditorBot CKEditorBot added resolution:expired This issue was closed due to lack of feedback. and removed status:stale labels Jan 15, 2024
@CKEditorBot CKEditorBot closed this as not planned Won't fix, can't repro, duplicate, stale Jan 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:highlight resolution:expired This issue was closed due to lack of feedback. status:discussion type:feature This issue reports a feature request (an idea for a new functionality or a missing option).
Projects
None yet
Development

No branches or pull requests

6 participants