Allow markdown and html annotations.

This commit is contained in:
Andrea Alberti 2024-06-30 12:22:45 +02:00
parent 7f03224672
commit 9b7c73d4b6
3 changed files with 16 additions and 11 deletions

View file

@ -1,7 +1,7 @@
{
"id": "plugins-annotations",
"name": "Plugins Annotations",
"version": "1.1.1",
"version": "1.2.0",
"minAppVersion": "1.5.0",
"description": "Allows adding personal comments to each installed plugin.",
"author": "Andrea Alberti",

View file

@ -272,8 +272,8 @@ export default class PluginsAnnotations extends Plugin {
if (descriptionDiv) {
const commentDiv = descriptionDiv.querySelector('.plugin-comment');
if (!commentDiv) {
const comment_container = document.createElement('div');
comment_container.className = 'plugin-comment';
const annotation_container = document.createElement('div');
annotation_container.className = 'plugin-comment';
const annotation_div = document.createElement('div');
annotation_div.className = 'plugin-comment-annotation';
@ -285,7 +285,7 @@ export default class PluginsAnnotations extends Plugin {
if (isPlaceholder) {
annotation_div.classList.add('plugin-comment-placeholder');
if (this.settings.hide_placeholders) {
comment_container.classList.add('plugin-comment-placeholder');
annotation_container.classList.add('plugin-comment-placeholder');
}
}
@ -316,7 +316,7 @@ export default class PluginsAnnotations extends Plugin {
}
annotation_div.classList.remove('plugin-comment-placeholder');
if (this.settings.hide_placeholders) {
comment_container.classList.remove('plugin-comment-placeholder');
annotation_container.classList.remove('plugin-comment-placeholder');
}
const range = document.createRange();
range.selectNodeContents(annotation_div);
@ -339,7 +339,7 @@ export default class PluginsAnnotations extends Plugin {
annotation_div.innerText = placeholder;
annotation_div.classList.add('plugin-comment-placeholder');
if (this.settings.hide_placeholders) {
comment_container.classList.add('plugin-comment-placeholder');
annotation_container.classList.add('plugin-comment-placeholder');
}
isPlaceholder = true;
} else {
@ -370,8 +370,8 @@ export default class PluginsAnnotations extends Plugin {
this.debouncedSaveAnnotations();
});
comment_container.appendChild(annotation_div);
descriptionDiv.appendChild(comment_container);
annotation_container.appendChild(annotation_div);
descriptionDiv.appendChild(annotation_container);
}
}
}

View file

@ -24,12 +24,17 @@
margin-bottom: 0;
}
/* Show comment container when hovering over the plugin container */
.setting-item:hover .plugin-comment.plugin-comment-placeholder {
display: block;
.plugin-comment-annotation::after {
content: "" !important;
}
.plugin-comment-annotation {
width: 100%;
}
/* Show comment container when hovering over the plugin container */
.setting-item:hover .plugin-comment.plugin-comment-placeholder {
display: block;
}