-
Notifications
You must be signed in to change notification settings - Fork 166
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
[Part 2] Port Auto link #2485
[Part 2] Port Auto link #2485
Conversation
if (!unlink) { | ||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why need this parameter? If unlink is false, we should not call this function at all
*/ | ||
export function createLinkAfterSpace(editor: IEditor, autoLink: boolean) { | ||
if (!autoLink) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
@@ -5,7 +5,10 @@ import type { IEditor } from 'roosterjs-content-model-types'; | |||
/** | |||
* @internal | |||
*/ | |||
export function createLink(editor: IEditor) { | |||
export function createLink(editor: IEditor, autoLink: boolean) { | |||
if (!autoLink) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
triggerList(editor, model, listType, styleType, index); | ||
rawEvent.preventDefault(); | ||
normalizeContentModel(model); | ||
if (shouldSearchForBullet || shouldSearchForNumbering) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here, check outside to reduce unnecessary parameters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already use these parameter on line 20 and 21, then we cannot remove them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I return this check to outside the function anyway?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. In that case we can keep it
triggerList(editor, model, listType, styleType, index); | ||
rawEvent.preventDefault(); | ||
normalizeContentModel(model); | ||
if (shouldSearchForBullet || shouldSearchForNumbering) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. In that case we can keep it
This change is part of the effort to port the Auto Link from the legacy ContentEdit feature into
AutoFormatPlugin
. After this changeAutoFormatPlugin
will automatically transform a typed url when space key is pressed after the text segment.