mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
Desktop: Fixes #9950: Link pased in RTE editor is not underlined until switch to another note (#10202)
This commit is contained in:
parent
29daec2c07
commit
8630c8e630
@ -36,6 +36,7 @@ import { focus } from '@joplin/lib/utils/focusHandler';
|
||||
const md5 = require('md5');
|
||||
const { clipboard } = require('electron');
|
||||
const supportedLocales = require('./supportedLocales');
|
||||
import { isLink } from '@joplin/utils/url';
|
||||
|
||||
const logger = Logger.create('TinyMCE');
|
||||
|
||||
@ -1172,7 +1173,7 @@ const TinyMCE = (props: NoteBodyEditorProps, ref: any) => {
|
||||
editor.insertContent(result.html);
|
||||
}
|
||||
} else {
|
||||
if (BaseItem.isMarkdownTag(pastedText)) { // Paste a link to a note
|
||||
if (BaseItem.isMarkdownTag(pastedText) || isLink(pastedText)) { // Paste a link to a note
|
||||
logger.info('onPaste: pasting as a Markdown tag');
|
||||
const result = await markupToHtml.current(MarkupToHtml.MARKUP_LANGUAGE_MARKDOWN, pastedText, markupRenderOptions({ bodyOnly: true }));
|
||||
editor.insertContent(result.html);
|
||||
|
@ -100,3 +100,10 @@ export const fileUriToPath = (path: string, platform = 'linux') => {
|
||||
export const isDataUrl = (path: string) => {
|
||||
return path.startsWith('data:');
|
||||
};
|
||||
|
||||
export const isLink = (text: string) => {
|
||||
if (!text) return false;
|
||||
const linkRegex = /^(https?|file|joplin):\/\/[^)\s]+$/;
|
||||
return !!text.match(linkRegex);
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user