This commit is contained in:
Carl Omondi 2024-04-28 12:21:36 +05:30 committed by GitHub
commit b0a0496979
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -195,9 +195,16 @@ export default class Paste extends Module {
} catch (e) { } // Do nothing and continue execution as usual if error appears
}
/**
* If text was drag'n'dropped, wrap content with P tag to insert it as the new Block
*/
// Creates an <a> tag for links within plain texts
const values = plainData.split(` `).map((word) => {
return ((word.startsWith(`http:`)) || (word.startsWith(`https:`))) ? `<a href="${word}">${word}</a>` : word;
});
htmlData = values.join(` `);
// /**
// * If text was drag'n'dropped, wrap content with P tag to insert it as the new Block
// */
if (isDragNDrop && plainData.trim() && htmlData.trim()) {
htmlData = '<p>' + (htmlData.trim() ? htmlData : plainData) + '</p>';
}