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

[Part 1] Port Auto Link #2479

Merged
merged 11 commits into from
Mar 7, 2024
Merged

[Part 1] Port Auto Link #2479

merged 11 commits into from
Mar 7, 2024

Conversation

juliaroldi
Copy link
Contributor

@juliaroldi juliaroldi commented Mar 5, 2024

Port AutoLink and UnlinkWhenBackspaceAfterLink content edit features into AutoFormatPlugin
After porting AutoLink, AutoFormatPlugin will handle automatically create link from pasted url segments, and after porting UnlinkWhenBackspaceAfterLink, will automatically remove the link of text segment, if backspace key is pressed when the cursor is after a link.

autoLink

Another PR will be created to handle AutoLink while typing.

@juliaroldi juliaroldi changed the title add link features Poet Auto Link Part 1 Mar 5, 2024
@juliaroldi juliaroldi changed the title Poet Auto Link Part 1 Port Auto Link Part 1 Mar 5, 2024
@juliaroldi juliaroldi marked this pull request as ready for review March 6, 2024 14:21
@juliaroldi juliaroldi changed the title Port Auto Link Part 1 [Part 1] Port Auto Link Mar 6, 2024
@@ -1,7 +1,7 @@
import { getObjectKeys } from 'roosterjs-content-model-dom';

/**
* @internal
* Data of the matched link
*/
export interface LinkData {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this to roosterjs-content-model-types/lib/parameters

@@ -27,6 +40,8 @@ export type AutoFormatOptions = {
const DefaultOptions: Required<AutoFormatOptions> = {
autoBullet: true,
autoNumbering: true,
autoUnlink: true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest set autoUnlink to false by default since we didn't use it

break;
}
}
}

private handleContentChangedEvent(editor: IEditor, event: ContentChangedEvent) {
const { autoLink } = this.options;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original auto link feature also work when press SPACE or ENTER

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see you put it in part 2. that is ok.

@juliaroldi juliaroldi merged commit a2bda0d into master Mar 7, 2024
7 checks passed
@juliaroldi juliaroldi deleted the u/juliaroldi/auto-link branch March 7, 2024 19:27
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

Successfully merging this pull request may close these issues.

2 participants