Moodle
  1. Moodle
  2. MDL-10243

Adding support for all utf-8 symbols in "insert spaceial characterl" in HTMLarea editor

    Details

    • Type: New Feature New Feature
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 1.9
    • Fix Version/s: None
    • Component/s: HTML Editor (TinyMCE)
    • Labels:
      None
    • Affected Branches:
      MOODLE_19_STABLE
    • Rank:
      3689

      Description

      Moodle supports TeX filter to write complex expressions. However the use of TeX expressions is highly difficult and beyond general public usage.

      However, almost anybody need to write some alphas o betas here or there. Or writing a mathematical operator, or some Arrows to point something. Nowadays text processors (MS-word and OpenOffice, for instace) have an "insert symbol" feature that allows to add any special symbol that cannot be accessed by keyboard typing. The full utf-8 range of symbols is available.

      However, the HTMLarea editor only displays a reduced set of special characters in the insert special character" dialog. This patch is intended to add support for all other symbol blocks existing in the utf-8 encoding: the full 154 blocks with chars from U+0000 to U+10FFFF. Now this dialog will display the full range of unicode utf-8 characters supported by the web broser/font combination. A combo-box allows to choose the unicode block to show within UCS: Basic Latin, Greek, Math operators an so on. Even Arabic, gujarati, katakana and all others blocks, if desired.

      To avoid making that selector too clumsy I have added a visibility setting that controls which of the 154 unicode blocks of characters are available. This could be added as as site setting in the admin tree (no done yet).

      The attachment is tested in 1.9 HEAD, but should work as well in 1.7 and 1.8

        Activity

        Enrique Castro created issue -
        Hide
        Enrique Castro added a comment -

        Just a correction
        I'm using this with a table of 256 symbols. Thus, to work as intended I forgot a small change:
        file dlg_ins_char.php
        line 152
        from document.write(tab(7,32)) -----to ----> document.write(tab(8,32))

        Show
        Enrique Castro added a comment - Just a correction I'm using this with a table of 256 symbols. Thus, to work as intended I forgot a small change: file dlg_ins_char.php line 152 from document.write(tab(7,32)) -----to ----> document.write(tab(8,32))
        Hide
        Enrique Castro added a comment -

        Updated file, tested with 1.9 and HEAD
        With instructions

        Added trailing semicolon fixing for IE browser suggested by Dean Stringer

        Show
        Enrique Castro added a comment - Updated file, tested with 1.9 and HEAD With instructions Added trailing semicolon fixing for IE browser suggested by Dean Stringer
        Enrique Castro made changes -
        Field Original Value New Value
        Attachment utf-8_symbolsets.zip [ 13588 ]
        Enrique Castro made changes -
        Affects Version/s 1.9.1 [ 10240 ]
        Affects Version/s 2.0 [ 10122 ]
        Hide
        Janne Mikkonen added a comment -

        Yep! I'm cool with this. Only thing is that it should change the pop-up window size when you change special character set.

        Show
        Janne Mikkonen added a comment - Yep! I'm cool with this. Only thing is that it should change the pop-up window size when you change special character set.
        Hide
        Enrique Castro added a comment -

        Hi Janne,
        Yes, I added in dlg_ins_char.php by line 127
        window.resizeBy(60,0);

        So it just work out of the box. There is a visible change in window size upon dialog window opening and rendering.

        If that "on the fly change" is considered "ugly", the same size can be obtained, if this is going to keep, by setting window size on call.
        lib/editor/htmlarea/dialog.js by line 36 (the switch for inserting image toolbuttons and on)
        case "dlg_ins_char": x = 540; y = 290; break;

        Now the size is only 480 x 290

        Show
        Enrique Castro added a comment - Hi Janne, Yes, I added in dlg_ins_char.php by line 127 window.resizeBy(60,0); So it just work out of the box. There is a visible change in window size upon dialog window opening and rendering. If that "on the fly change" is considered "ugly", the same size can be obtained, if this is going to keep, by setting window size on call. lib/editor/htmlarea/dialog.js by line 36 (the switch for inserting image toolbuttons and on) case "dlg_ins_char": x = 540; y = 290; break; Now the size is only 480 x 290
        Hide
        Janne Mikkonen added a comment -

        I've made some minor changes to dlg_ins_char.php and utf8_blocks.php file. Without these changes I couldn't get it to work with IE 7.

        Show
        Janne Mikkonen added a comment - I've made some minor changes to dlg_ins_char.php and utf8_blocks.php file. Without these changes I couldn't get it to work with IE 7.
        Janne Mikkonen made changes -
        Attachment utf8_symbols.zip [ 13593 ]
        Hide
        Enrique Castro added a comment - - edited

        Updated with changes introduced by Janne for IE7
        Now dialog window resizes automatically expanding or shrinking to fit content (I realize that's what you meant before: not initial size, but width changes upon different symbol pages )
        I'm NULL at Javascript but I think that measuring window width is cross-browser.

        Show
        Enrique Castro added a comment - - edited Updated with changes introduced by Janne for IE7 Now dialog window resizes automatically expanding or shrinking to fit content (I realize that's what you meant before: not initial size, but width changes upon different symbol pages ) I'm NULL at Javascript but I think that measuring window width is cross-browser.
        Enrique Castro made changes -
        Attachment utf-8_symbolsets.zip [ 13630 ]
        Petr Škoda made changes -
        Affects Version/s 1.9.1 [ 10240 ]
        Affects Version/s 2.0 [ 10122 ]
        Martin Dougiamas made changes -
        Assignee Janne Mikkonen [ julmis ] Mathieu Petit-Clair [ scyrma ]
        Martin Dougiamas made changes -
        Workflow jira [ 21315 ] MDL Workflow [ 42308 ]
        Martin Dougiamas made changes -
        Workflow MDL Workflow [ 42308 ] MDL Full Workflow [ 70729 ]
        Mathieu Petit-Clair made changes -
        Assignee Mathieu Petit-Clair [ scyrma ]

          People

          • Votes:
            19 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

            • Created:
              Updated: