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

Enabling highlithg in 2SCM should be available as plugin method #7665

Closed
jodator opened this issue Jul 22, 2020 · 3 comments
Closed

Enabling highlithg in 2SCM should be available as plugin method #7665

jodator opened this issue Jul 22, 2020 · 3 comments
Labels
domain:dx This issue reports a developer experience problem or possible improvement. package:basic-styles package:link package:typing resolution:expired This issue was closed due to lack of feedback. status:stale type:improvement This issue reports a possible enhancement of an existing feature.

Comments

@jodator
Copy link
Contributor

jodator commented Jul 22, 2020

📝 Provide a description of the improvement

This is how two-step caret movement is initialised for the link:

// Enable two-step caret movement for `linkHref` attribute.
const twoStepCaretMovementPlugin = editor.plugins.get( TwoStepCaretMovement );
twoStepCaretMovementPlugin.registerAttribute( 'linkHref' );
// Setup highlight over selected link.
inlineHighlight( editor, 'linkHref', 'a', HIGHLIGHT_CLASS );

The problem with that it uses two different means to enable a fully-functional feature.

Options

Option 1: Make inline highlight an option for: registerAttribute() 

twoStepCaretMovementPlugin.registerAttribute( 'linkHref', {
	highlight: {
		tagName: 'a',
		classes: {
			HIGHTLIGHT_CLASS
		}
	}
} );

Option 2: Expose inlineHighlight as plugin method

twoStepCaretMovementPlugin.inlineHighlight( 'linkHref', 'a', HIGHLIGHT_CLASS );

Option 3: Leave as-is

Pros & cons

Option 1:

  • pros:
    •  addition to exiting API
  • cons:
    •  optional breaking change if inlineHighlight will not be exposed.

Option 2:

  • cons:
    • new method, slightly worse API than option 1
    • optional breaking change if inlineHighlight will not be exposed.

Option 3:

  • pros:
    • no work 😄
  • cons:
    • it's ugly API

My personal favourite: 1.


If you'd like to see this improvement implemented, add a 👍 reaction to this post.

@jodator jodator added type:improvement This issue reports a possible enhancement of an existing feature. package:basic-styles package:link package:typing labels Jul 22, 2020
@tomalec
Copy link
Contributor

tomalec commented Jul 22, 2020

(By my 👍 I mean Option 1 | Option 2 :) )

@mlewand mlewand added this to the backlog milestone Aug 17, 2020
@mlewand mlewand added the domain:dx This issue reports a developer experience problem or possible improvement. label Aug 17, 2020
@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 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 the resolution:expired This issue was closed due to lack of feedback. label Nov 13, 2023
@CKEditorBot CKEditorBot closed this as not planned Won't fix, can't repro, duplicate, stale Nov 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:dx This issue reports a developer experience problem or possible improvement. package:basic-styles package:link package:typing resolution:expired This issue was closed due to lack of feedback. status:stale type:improvement This issue reports a possible enhancement of an existing feature.
Projects
None yet
Development

No branches or pull requests

5 participants