mirror of
https://github.com/codex-team/editor.js
synced 2024-05-24 17:42:22 +02:00
Merge 7757fba782
into 5eafda5ec4
This commit is contained in:
commit
b0a0496979
|
@ -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>';
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue