mirror of
https://github.com/laurent22/joplin.git
synced 2025-01-14 18:27:44 +02:00
Desktop: Fixes #9607: Copied and pasted text from Firefox to RTE does not include images
This commit is contained in:
parent
b1877fcd0d
commit
11e1a49b5c
@ -12,6 +12,7 @@ import { fileUriToPath } from '@joplin/utils/url';
|
||||
import { MarkupLanguage } from '@joplin/renderer';
|
||||
import { HtmlToMarkdownHandler, MarkupToHtmlHandler } from './types';
|
||||
import markupRenderOptions from './markupRenderOptions';
|
||||
import { fileExtension, filename, safeFileExtension, safeFilename } from '@joplin/utils/path';
|
||||
const joplinRendererUtils = require('@joplin/renderer').utils;
|
||||
const { clipboard } = require('electron');
|
||||
const mimeUtils = require('@joplin/lib/mime-utils.js').mime;
|
||||
@ -154,7 +155,11 @@ export async function processPastedHtml(html: string, htmlToMd: HtmlToMarkdownHa
|
||||
|
||||
const downloadImage = async (imageSrc: string) => {
|
||||
try {
|
||||
const filePath = `${Setting.value('tempDir')}/${md5(Date.now() + Math.random())}`;
|
||||
const fileExt = safeFileExtension(fileExtension(imageSrc));
|
||||
const name = safeFilename(filename(imageSrc));
|
||||
const pieces = [name ? name : md5(Date.now() + Math.random())];
|
||||
if (fileExt) pieces.push(fileExt);
|
||||
const filePath = `${Setting.value('tempDir')}/${pieces.join('.')}`;
|
||||
await shim.fetchBlob(imageSrc, { path: filePath });
|
||||
const createdResource = await shim.createResourceFromPath(filePath);
|
||||
await shim.fsDriver().remove(filePath);
|
||||
|
Loading…
Reference in New Issue
Block a user