From 80a3ed6e6fba7225882a963f114b2e384ca61eaa Mon Sep 17 00:00:00 2001 From: "tai.letan" Date: Wed, 22 Jan 2025 18:19:39 +0700 Subject: [PATCH] TinyMCE: Add a tooltip next to the content and comment fields in blog #857668 --- comment_form.php | 3 +++ lang/en/oublog.php | 5 +++++ post_form.php | 3 +++ styles.css | 7 +++++++ 4 files changed, 18 insertions(+) diff --git a/comment_form.php b/comment_form.php index 19e0882..79db7e7 100644 --- a/comment_form.php +++ b/comment_form.php @@ -66,6 +66,9 @@ public function definition() { $mform->addElement($messagetype, 'messagecomment', get_string('comment', 'oublog'), array('cols' => 50, 'rows' => 30), array('maxfiles' => EDITOR_UNLIMITED_FILES, 'maxbytes' => $maxbytes)); + if (editors_get_preferred_editor() instanceof \editor_tiny\editor) { + $mform->addHelpButton('messagecomment', 'messageshortcuts', 'oublog'); + } $mform->setType('messagecomment', PARAM_CLEANHTML); $mform->addRule('messagecomment', null, 'required', null, 'server'); diff --git a/lang/en/oublog.php b/lang/en/oublog.php index 23ca258..001e6f7 100644 --- a/lang/en/oublog.php +++ b/lang/en/oublog.php @@ -74,6 +74,11 @@ $string['removeblogs'] = 'Remove all blog entries'; $string['title'] = 'Title'; $string['message'] = 'Message'; +$string['messageshortcuts'] = 'Keyboard shortcuts'; +$string['messageshortcuts_help'] = ' +Access buttons in the menu bar using Alt + F9 (Windows) or ⌥ + F9 (Mac).
+Access the toolbar using Alt + F10 (Windows) or ⌥ + F10 (Mac) including the help menu which contains a full list of keyboard shortcuts. +'; $string['tags'] = 'Tags'; $string['tagsfield'] = 'Tags (separated by commas)'; $string['allowcomments'] = 'Allow comments'; diff --git a/post_form.php b/post_form.php index b817a43..9cecee2 100644 --- a/post_form.php +++ b/post_form.php @@ -64,6 +64,9 @@ public function definition() { $mform->addElement('editor', 'message', get_string('message', 'oublog'), array('cols' => 50, 'rows' => 30), array('maxfiles' => EDITOR_UNLIMITED_FILES, 'maxbytes' => $maxbytes)); + if (editors_get_preferred_editor() instanceof \editor_tiny\editor) { + $mform->addHelpButton('message', 'messageshortcuts', 'oublog'); + } $mform->addRule('message', null, 'required', null, 'client'); if ($this->restricttags) { diff --git a/styles.css b/styles.css index a9483fa..378a247 100644 --- a/styles.css +++ b/styles.css @@ -789,3 +789,10 @@ oublog-filter-tagcount { .gecko #oublog-tags { display: block; } +@media only screen and (max-width: 767px), +(max-width: 1024px) and (orientation: landscape) and (pointer: coarse) { + #page-mod-oublog-editpost div[id^=fitem_id_message] .btn.btn-link[data-content*="help-popover-container"], + #page-mod-oublog-editcomment div[id^=fitem_id_messagecomment] .btn.btn-link[data-content*="help-popover-container"] { + display: none; + } +}