mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-20 12:11:29 +00:00
plugins/note: allow editing note by clicking on it
This commit is contained in:
@@ -15,6 +15,9 @@ class Note extends Plugin {
|
|||||||
return file_get_contents(__DIR__ . "/note.js");
|
return file_get_contents(__DIR__ . "/note.js");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function get_css() {
|
||||||
|
return file_get_contents(__DIR__ . "/note.css");
|
||||||
|
}
|
||||||
|
|
||||||
function hook_article_button($line) {
|
function hook_article_button($line) {
|
||||||
return "<i class='material-icons' onclick=\"Plugins.Note.edit(".$line["id"].")\"
|
return "<i class='material-icons' onclick=\"Plugins.Note.edit(".$line["id"].")\"
|
||||||
|
|||||||
3
plugins/note/note.css
Normal file
3
plugins/note/note.css
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
.article-note[data-note-for] {
|
||||||
|
cursor : pointer;
|
||||||
|
}
|
||||||
@@ -1,6 +1,16 @@
|
|||||||
/* global dojo, Plugins, xhr, App, Notify, fox, __ */
|
/* global require, Plugins, PluginHost, xhr, App, Notify, fox, __ */
|
||||||
|
|
||||||
|
require(['dojo/_base/kernel', 'dojo/ready'], function (dojo, ready) {
|
||||||
|
ready(function() {
|
||||||
|
|
||||||
Plugins.Note = {
|
Plugins.Note = {
|
||||||
|
set_click_handler: function() {
|
||||||
|
document.querySelectorAll(".article-note[data-note-for]").forEach((note) => {
|
||||||
|
note.onclick = function() {
|
||||||
|
Plugins.Note.edit(this.getAttribute('data-note-for'));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
edit: function(id) {
|
edit: function(id) {
|
||||||
const dialog = new fox.SingleUseDialog({
|
const dialog = new fox.SingleUseDialog({
|
||||||
title: __("Edit article note"),
|
title: __("Edit article note"),
|
||||||
@@ -39,3 +49,10 @@ Plugins.Note = {
|
|||||||
dialog.show();
|
dialog.show();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
PluginHost.register(PluginHost.HOOK_HEADLINE_RENDERED, function() {
|
||||||
|
Plugins.Note.set_click_handler();
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user