Skip to content

Commit

Permalink
Merge pull request '- Fix for pasting html/markdown' (#62) from v2.1.…
Browse files Browse the repository at this point in the history
  • Loading branch information
Offerel committed Jul 16, 2022
2 parents ef9313f + d739fd8 commit 830f8c0
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
### v2.1.1
- Fix for pasting html/markdown

### v2.1.0
- Rewrite of most parts
- Added markdown linebreak in YAML
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
"name": "offerel/primitivenotes",
"description": "A deadly simple notes plugin for Roundcube",
"keywords": ["notes","plugin","html","markdown","images","pdf","roundcube"],
"homepage": "https://github.com/Offerel/roundcube_primitivenotes",
"homepage": "https://codeberg.org/Offerel/roundcube_primitivenotes",
"type": "roundcube-plugin",
"license": "AGPL-3.0",
"version": "2.1.0",
"version": "2.1.1",
"authors": [
{
"name": "Offerel",
"homepage": "https://github.com/Offerel",
"homepage": "https://codeberg.org/Offerel",
"role": "Developer"
}
],
Expand Down
5 changes: 3 additions & 2 deletions js/primitivenotes.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Roundcube Notes Plugin
*
* @version 2.1.0
* @version 2.1.1
* @author Offerel
* @copyright Copyright (c) 2022, Offerel
* @license GNU General Public License, version 3
Expand Down Expand Up @@ -212,6 +212,7 @@ function pasteParse(event) {
event.stopPropagation();

const pastedString = event.clipboardData.getData('text/html') || event.clipboardData.getData('text/plain');
console.log(pastedString);

for (var i = 0; i < event.clipboardData.items.length ; i++) {
let item = event.clipboardData.items[i];
Expand Down Expand Up @@ -284,7 +285,7 @@ function pasteParse(event) {
}
});

let markdownString = pastedString.startsWith('<html>') ? turndownService.turndown(pastedString) : pastedString;
let markdownString = pastedString.startsWith('<') ? turndownService.turndown(pastedString) : pastedString;

if(markdownString.startsWith('---')) {
let mdArr = markdownString.split('\n');
Expand Down
Loading

0 comments on commit 830f8c0

Please sign in to comment.