Mdl2.2 Where is the INSERT ANCHOR button in the tinyMCE editor in Moodle?

Mdl2.2 Where is the INSERT ANCHOR button in the tinyMCE editor in Moodle?

by Peter Evans -
Number of replies: 5

The button is shown below on the TinyMCE site

Can anyone tell me where the INSERT ANCHOR button is in TinyMCE in Moodle? Below is the editor as shown in the fourms on Moodle.org

Any assistance gratefully received.

Peter Evans

Average of ratings: -
In reply to Peter Evans

Re: Mdl2.2 Where is the INSERT ANCHOR button in the tinyMCE editor in Moodle?

by Juan Carlos Borrero (JuanCaBo) -

I just insert the icon for justify texts (also missing)

Check the file in lib/editor/tinymce/lib.php

I just add  justifyfull in the line:

'theme_advanced_buttons2' => "bold,italic,underline,strikethrough,sub,sup,|,justifyleft,justifycenter,jusifyright,justifyfull",

and the button just apears and works

I suppose that if you add anchor to de advanced_buttons1 will appear- Let me Know

In reply to Juan Carlos Borrero (JuanCaBo)

Re: Mdl2.2 Where is the INSERT ANCHOR button in the tinyMCE editor in Moodle?

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Peter,

Just as Juan suggested you can make the anchor toolbutton appear by adding it into the yourmoodle/lib/editor/tinymce/lib.php file. I have tried it in both M2.2.4+ and M2.3.1+ and it appears that it might even be working. At least I can create an anchor and link to it. I can't really test it except to have it open the link in a new window as all the text frames I have tried it in do not have vertical scroll bars with the themes I am using.

In M2.2.4 it is line 142 just add anchor, in the line

'theme_advanced_buttons3' => "bullist,numlist,outdent,indent,|,link,unlink,moodlenolink,anchor,|,image,{$xemoticon}{$xmedia}{$xdragmath}nonbreaking,charmap",

And in M2.3.1 it is line 150 just add anchor, in the line

'theme_advanced_buttons3' => "bullist,numlist,outdent,indent,|,link,unlink,moodlenolink,anchor,|,image,{$xemoticon}{$xmedia}{$xdragmath}nonbreaking,charmap",

If you are using another version, you will just need to look for the right line in lib.php. Make sure you add the comma after the word anchor or it will not show the toolbutton,

Hope this helps,

AL

In reply to AL Rachels

Re: Mdl2.2 Where is the INSERT ANCHOR button in the tinyMCE editor in Moodle?

by S. Kazim Naqvi -

For those who don't wish to tweak around the php code, a simpler alternative is to use little bit of HTML know-how and create an anchor yourself in the following way:

1) If you need to anchor the text "here"; Change to HTML mode by pressing icon labelled HTML in the tool palette.

2) Locate the text to be anchored i.e. "here" in your document

3) Add the text <a name="1">here</a> (1 is the name of anchor to which we can later link, you may use any other permissble name)

4) Once, you do above and return to GUI mode; you should be able to see an anchor icon preceeding the "here" text.

5) You can now link to this anchor (#1) easily

Best

Average of ratings: Useful (1)
In reply to S. Kazim Naqvi

Re: Mdl2.2 Where is the INSERT ANCHOR button in the tinyMCE editor in Moodle?

by Stefan Zuban -

For versions higher than 2.6.3, in ~yourmoodledirectory/lib/editor/tinymce/lib.php file, look for (around line 157)

foreach ($customtoolbar as $line) {


add after the following line:


if ($i==1) $line .= ",anchor";

You should see the anchor icon.

Best regards.