Skip to content

Commit

Permalink
feat: Button for selecting markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
kordwarshuis committed Jan 30, 2024
1 parent 927d970 commit 64ea1c7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion public/js/collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function loadCollections() {
}

domString += `
<h2 id="markdownformat">In Markdown-format:</h2>
<button id="select-markdown" type="button" class="btn btn-info btn-sm float-end">Select</button><h2 id="markdownformat">In Markdown-format:</h2>
<div id="markdown-container"></div>`;
}
document.getElementById('container-collection').innerHTML = domString;
Expand All @@ -71,13 +71,19 @@ function loadCollections() {
const turndownService = new TurndownService()
const markdown = turndownService.turndown(document.getElementById('container-collection-for-markdown'))
const markdownContainer = document.getElementById('markdown-container');
const selectMarkdownButton = document.getElementById('select-markdown');
markdownContainer.innerHTML = `
<textarea rows="15" cols="33" class="form-control" id="markdown" rows="3">${markdown}</textarea>
`;

markdownContainer.addEventListener('click', function (e) {
e.target.select();
});

selectMarkdownButton.addEventListener('click', function () {
const markdownContainerTextarea = document.querySelector('#markdown-container textarea');
markdownContainerTextarea.select();
});
});

chrome.storage.local.get(['role'], function (result) {
Expand Down

0 comments on commit 64ea1c7

Please sign in to comment.