Skip to content

Commit

Permalink
Release new version 1.3 because of changes during the approval process.
Browse files Browse the repository at this point in the history
Changes are:
- rename capability
- improve styling in dialogue
- fix glitch in copy&paste
- move capability check to is_enabled()
- wording in behat tests
  • Loading branch information
srobotta committed Feb 26, 2024
1 parent 44e2ce1 commit 109db9f
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 13 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Moodle Tiny editor HTML Block plugin

![Release](https://img.shields.io/badge/Release-1.2-blue.svg)
![Release](https://img.shields.io/badge/Release-1.3-blue.svg)
![Supported](https://img.shields.io/badge/Moodle-4.1+-orange.svg)
[![Moodle Plugin CI](https://github.com/srobotta/moodle-tiny_htmlblock/workflows/Moodle%20Plugin%20CI/badge.svg?branch=master)](https://github.com/srobotta/moodle-tiny_htmlblock/actions?query=workflow%3A%22Moodle+Plugin+CI%22+branch%3Amaster)
[![License GPL-3.0](https://img.shields.io/github/license/srobotta/moodle-tiny_htmlblock?color=lightgrey)](https://github.com/srobotta/moodle-tiny_htmlblock/blob/master/LICENSE)
Expand Down Expand Up @@ -143,6 +143,11 @@ What is missing/not working:

## Version History

### 1.3
- Additional fixes from the approval feedback.
- Rename capability to `tiny/htmlblock:add`.
- Different styling in the html block list in the dialogue.

### 1.2
- Fix [tiny/htmlblock:viewmenu does not seem to have any effect #2](https://github.com/srobotta/moodle-tiny_htmlblock/issues/2)
- Fix [Module and course settings not accessible #4](https://github.com/srobotta/moodle-tiny_htmlblock/issues/4)
Expand Down
25 changes: 21 additions & 4 deletions classes/plugininfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,30 @@ public static function get_available_menuitems(): array {
*/
public static function get_available_buttons(): array {
return [
'tiny_fontcolor/tiny_htmlblock_btn',
'tiny_htmlblock/tiny_htmlblock_btn',
];
}

/**
* Is the plugin enabled? This is the case when the capabilities are meet. However,
* if there are no html blocks defined for the current context, then the button and
* menu item do not appear either.
*
* @param context $context The context that the editor is used within
* @param array $options The options passed in when requesting the editor
* @param array $fpoptions The filepicker options passed in when requesting the editor
* @param editor|null $editor The editor instance in which the plugin is initialised
* @return boolean
*/
public static function is_enabled(
context $context,
array $options,
array $fpoptions,
?editor $editor = null
): bool {
return has_capability('tiny/htmlblock:add', $context);
}

/**
* Returns the configuration values the plugin needs to take into consideration.
*
Expand All @@ -73,9 +93,6 @@ public static function get_plugin_configuration_for_context(context $context, ar
?editor $editor = null): array {
global $PAGE;

if (!has_capability('tiny/htmlblock:viewmenu', $context)) {
return ['htmlblocks' => []];
}
$currentcat = null;
if ($PAGE->course) {
$currentcat = \core_course_category::get($PAGE->course->category, 0 /* IGNORE_MISSING */);
Expand Down
2 changes: 1 addition & 1 deletion db/access.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
defined('MOODLE_INTERNAL') || die();

$capabilities = [
'tiny/htmlblock:viewmenu' => [
'tiny/htmlblock:add' => [
'captype' => 'write',
'contextlevel' => CONTEXT_COURSE,
'archetypes' => [
Expand Down
4 changes: 2 additions & 2 deletions styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
padding: 3px;
list-style: none;
margin-left: -2rem;
cursor: pointer;
}
.tiny_htmlblock li:hover {
border: 1px solid #777;
}
.tiny_htmlblock li.selected {
border: 1px solid #777;
background-color: #ccc;
border: 3px solid #777;
}
5 changes: 2 additions & 3 deletions tests/behat/htmlblock.feature
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,10 @@ Feature: Tiny editor admin settings for htmlblock plugin
When I log in as "admin"
And I open my profile in edit mode
And I wait until the page is ready
When I click on the "Insert > HTML blocks" menu item for the "Description" TinyMCE editor
And I click on the "Insert > HTML blocks" menu item for the "Description" TinyMCE editor
And I wait "1" seconds
Then I should see "Go home X"
And I should not see "Text framed"
And I click on "Cancel" "button" in the "Tiny HTML Blocks" "dialogue"
When I am on the "C1" "Course" page logged in as "admin"
And I turn editing mode on
And I edit the section "1"
Expand All @@ -58,5 +57,5 @@ Feature: Tiny editor admin settings for htmlblock plugin
And I click on the "HTML blocks" button for the "Description" TinyMCE editor
And I click on "li[title='Heading X3']" "css_element"
And I click on "Insert" "button" in the "Tiny HTML Blocks" "dialogue"
When I click on "Update profile" "button"
And I click on "Update profile" "button"
Then I should see "Go homez"
4 changes: 2 additions & 2 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
defined('MOODLE_INTERNAL') || die();

$plugin->component = 'tiny_htmlblock';
$plugin->release = '1.2';
$plugin->version = 2024022300;
$plugin->release = '1.3';
$plugin->version = 2024022600;
$plugin->requires = 2022112800;
$plugin->maturity = MATURITY_RC;

0 comments on commit 109db9f

Please sign in to comment.