plugins/note: allow editing note by clicking on it
This commit is contained in:
parent
478c9b64a9
commit
6077175c57
|
@ -15,6 +15,9 @@ class Note extends Plugin {
|
|||
return file_get_contents(__DIR__ . "/note.js");
|
||||
}
|
||||
|
||||
function get_css() {
|
||||
return file_get_contents(__DIR__ . "/note.css");
|
||||
}
|
||||
|
||||
function hook_article_button($line) {
|
||||
return "<i class='material-icons' onclick=\"Plugins.Note.edit(".$line["id"].")\"
|
||||
|
|
|
@ -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, __ */
|
||||
|
||||
Plugins.Note = {
|
||||
require(['dojo/_base/kernel', 'dojo/ready'], function (dojo, ready) {
|
||||
ready(function() {
|
||||
|
||||
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) {
|
||||
const dialog = new fox.SingleUseDialog({
|
||||
title: __("Edit article note"),
|
||||
|
@ -38,4 +48,11 @@ Plugins.Note = {
|
|||
|
||||
dialog.show();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
PluginHost.register(PluginHost.HOOK_HEADLINE_RENDERED, function() {
|
||||
Plugins.Note.set_click_handler();
|
||||
return true;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue