Skip to content

Commit

Permalink
Use a new approach for multilang tags highlighting
Browse files Browse the repository at this point in the history
The previous approach had some assumptions (e.g., it assumed there was
a singe instance of the editor on the same page) that lead to some
bugs and corner cases. Now the plugin hooks on the form submit event
and clean the highlighting <span> tags there. The cleaning doesn't use
any regexes any longer. Instead it uses DOM operations that are more
robust and potentially faster.

Also multilang tag highlighting <span>'s are now removed/added when
switching to/from HTML view, reducing clutter when editing the HTML code.

Some initial coding style cleanup work has been carried out. More to follow.

Tested in Firefox 56 and Chromium 61.0.3163.100.

Closes eljulians#2 eljulians#18 eljulians#21
  • Loading branch information
iarenaza committed Oct 5, 2017
1 parent cd20395 commit b6b131c
Show file tree
Hide file tree
Showing 6 changed files with 516 additions and 886 deletions.
7 changes: 3 additions & 4 deletions default-css.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

$multilang2_default_css = <<< EOF
defined('MOODLE_INTERNAL') || die();

$multilang2defaultcss = "
outline: 1px dotted;
padding: 0.1em;
margin: 0em 0.1em;
background-color: #ffffaa;
EOF
;
";
2 changes: 1 addition & 1 deletion settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@
get_string('highlight', 'atto_multilang2'), get_string('highlight_desc', 'atto_multilang2'), 1));
$settings->add(new admin_setting_configtextarea('atto_multilang2/customcss',
get_string('customcss', 'atto_multilang2'), get_string('customcss_desc', 'atto_multilang2'),
$multilang2_default_css, PARAM_RAW));
$multilang2defaultcss, PARAM_RAW));
4 changes: 2 additions & 2 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@

defined('MOODLE_INTERNAL') || die();

$plugin->version = 2017052400; // The current plugin version (Date: YYYYMMDDXX).
$plugin->release = 'v3.3.1.7 (version v1.7 for Moodle 3.3) (2016121100)';
$plugin->version = 2017100200; // The current plugin version (Date: YYYYMMDDXX).
$plugin->release = 'v3.3.1.8 (version v1.8 for Moodle 3.3) (2016121100)';
$plugin->requires = 2017051500; // Required Moodle version.
$plugin->component = 'atto_multilang2'; // Full name of the plugin (used for diagnostics).
$plugin->maturity = MATURITY_STABLE;
Expand Down
Loading

0 comments on commit b6b131c

Please sign in to comment.