Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Connie DeCinko 931 posts 1160 karma points
    Dec 02, 2010 @ 20:18
    Connie DeCinko
    0

    TinyMCE Creates Invalid Anchor Tags

    Anchors inserted via the TinyMCE editor create an empty <a> tag with only a name and id.  These work ok in non-IE browsers, however, IE does not like empty tags.  Any link to an empty <a> tag is ignored.

    How can I make a list of links at the top of a page that jump down the page correctly?

    Also, any idea why IE supports #Top while Firefox does not?

     

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Dec 02, 2010 @ 23:07
    Jan Skovgaard
    0

    Hi Connie

    How do you create your anchors?

    If you need to create a anchor that takes the visitor to the top you should be able to reference an id like your #wrapper or whatever you call your main containing <div>...so <a href="#wrapper">To the top</a> should do the trick, right?

    If you're having problems with the code being stripped you could have a look to see what is allowed and edit what is allowed in the tinymceeditor.config file in the config folder.

    You can also disable tidy in the umbracosettings.config file in the same dir. However this is not recommended.

    Hope this helps.

    /Jan

  • Connie DeCinko 931 posts 1160 karma points
    Dec 02, 2010 @ 23:32
    Connie DeCinko
    0

    The problem is not with the return to top.  It's with the target in the lower content.  Say in an FAQ scenario...  I click next to the answer, click the anchor icon and enter Target1.  TinyMCE then creates an HTML tag in the format <a id="Target1" name="Target1"></a>, notice the <a> tag is empty.  IE does not work with this empty tag.

     

  • Connie DeCinko 931 posts 1160 karma points
    May 11, 2011 @ 22:35
    Connie DeCinko
    0

    Has anyone address this bug?  It appears to still occur in Umbraco 4.7.

     

  • Chris Dunsing 18 posts 83 karma points
    Sep 27, 2011 @ 20:59
    Chris Dunsing
    0

    I was just experiencing this bug as well on chrome. The bug has been tracked on codeplex - http://umbraco.codeplex.com/workitem/30147 and it appears the webkit replace is not working.  I commented out the following lines: 

    /*if (tinymce.isWebKit)
    ed.execCommand('mceInsertContent', 0, ed.dom.createHTML('img', { mce_name: 'a', name: document.forms[0].anchorName.value, 'class': 'mceItemAnchor' })); 
    else*/
    ed.execCommand('mceInsertContent', 0, ed.dom.createHTML('a', {name : document.forms[0].anchorName.value, 'class' : 'mceItemAnchor'}, ''));

    The file: /umbraco_client/tinymce3/themes/umbraco/js/anchor.js lines 28 through 32. It has been working so far without ill effects. Props to mirelabudaes for finding a workable solution.

     

  • Wouter 49 posts 76 karma points
    Oct 18, 2011 @ 15:08
    Wouter
    0

    In wich file did you change this? Ik tried changing umbraco_client/tinymce3/themes/umbraco/js/anchor.js but umbraco still seems to use te "old" code and I don't have a clue where it's coming from. I've updated the file to the latest version of the stable tinymce build btw:

    tinyMCEPopup.requireLangPack();
    
    var AnchorDialog = {
        init : function(ed) {
            var action, elm, f = document.forms[0];
    
            this.editor = ed;
            elm = ed.dom.getParent(ed.selection.getNode(), 'A');
            v = ed.dom.getAttrib(elm, 'name');
    
            if (v) {
                this.action = 'update';
                f.anchorName.value = v;
            }
    
            f.insert.value = ed.getLang(elm ? 'update' : 'insert');
        },
    
        update : function() {
            var ed = this.editor, elm, name = document.forms[0].anchorName.value;
    
            if (!name || !/^[a-z][a-z0-9\-\_:\.]*$/i.test(name)) {
                tinyMCEPopup.alert('advanced_dlg.anchor_invalid');
                return;
            }
    
            tinyMCEPopup.restoreSelection();
    
            if (this.action != 'update')
                ed.selection.collapse(1);
    
            elm = ed.dom.getParent(ed.selection.getNode(), 'A');
            if (elm) {
                elm.setAttribute('name', name);
                elm.name = name;
            } else
                ed.execCommand('mceInsertContent', 0, ed.dom.createHTML('a', {name : name, 'class' : 'mceItemAnchor'}, ''));
    
            tinyMCEPopup.close();
        }
    };
    
    tinyMCEPopup.onInit.add(AnchorDialog.init, AnchorDialog);
    
    editted: cleaned-up code blocks
  • Chris Dunsing 18 posts 83 karma points
    Oct 18, 2011 @ 22:22
    Chris Dunsing
    0

    The anchor.js was the location you noted umbraco_client/tinymce3/themes/umbraco/js/anchor.js 

    However, in my case there was no update made on TinyMCE other than the change that I noted above. 

    I know this is lame but did you ensure that you cache had been cleared prior to testing. I had the same issue with it not working until I cleared my browsing data in Chrome and trying to place the anchor tags again.

    Also I see that the following code is new: and is not what I have in my working copy. 

     

    elm = ed.dom.getParent(ed.selection.getNode(),'A');
                   
    if(elm){
                            elm
    .setAttribute('name', name);
                            elm
    .name = name;
                   
    }else

     

    In my copy the following is occuring on every update call:  

    ed.execCommand('mceInsertContent', 0, ed.dom.createHTML('a', {name : document.forms[0].anchorName.value, 'class' : 'mceItemAnchor'}, ''));

     

    Here is what I have:

    update : function() {
    var ed = this.editor;
    tinyMCEPopup.restoreSelection();
    if (this.action != 'update')
    ed.selection.collapse(1);
    ed.execCommand('mceInsertContent', 0, ed.dom.createHTML('a', {name : document.forms[0].anchorName.value, 'class' : 'mceItemAnchor'}, ''));
    tinyMCEPopup.close();
    }

     

     Hope this helps.

  • Sébastien Richer 194 posts 430 karma points
    Nov 22, 2012 @ 21:03
    Sébastien Richer
    0

    http://umbraco.codeplex.com/workitem/30147 This page is no longer found? Weird?

  • Richard Barg 358 posts 532 karma points
    Jun 11, 2013 @ 08:32
    Richard Barg
    0

    Not weird at all. Typical.

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Jun 11, 2013 @ 09:45
    Jan Skovgaard
    0

    No not weird since the issue tracker has been moved to http://issues.umbraco.org since september 2012 and all open issues from codeplex was moved to the new tracker.

    Cheers,
    Jan 

  • lucyconnuk 7 posts 28 karma points
    Jun 11, 2013 @ 18:00
    lucyconnuk
    0

    Is there any link between the old workitem numbers on Codeplex and the new issue numbers on http://issues.umbraco.org ?

  • Funka! 398 posts 661 karma points
    Jun 11, 2013 @ 21:48
    Funka!
    0

    Hello lucyconnuk,

    The best way is to just use the search function in the new issue tracker. For example, you could search for "30147" which was found in the old http://umbraco.codeplex.com/workitem/30147 codeplex URL.

    Howevever, in this case, it seems this issue was not migrated, so the next best bet is to search for related issues using other keywords. If that still does not yield any results, you can always create a new issue.

    I think unforuntately only the "open & active" issues were migrated so any kind of historical tips or hints on older issues may have been lost or at least are not visible to non-administrators.

     

  • lucyconnuk 7 posts 28 karma points
    Jun 12, 2013 @ 12:21
    lucyconnuk
    1

    Thanks Chris Dunsing for your solution, and Funka for your comment.

    I had the problem mentioned on these threads:

    http://our.umbraco.org/forum/ourumb-dev-forum/bugs/25242-Anchor-not-working-in-TinyMCE

    http://our.umbraco.org/forum/using/ui-questions/24203-Anchor-changes-into-img-tag

    ... where editing with Chrome changed anchor tags into empty <img> tags which then didn't work, and Chris's fix solved it for me with no apparent side effects.

  • Iulia Maria Jensen 40 posts 71 karma points
    Jul 23, 2013 @ 09:59
    Iulia Maria Jensen
    0

    The posted solution did not work for me. (commenting out those 2-3 lines)

    Any other suggestions?

  • Mark 255 posts 612 karma points
    Dec 02, 2014 @ 22:08
    Mark
    0

    It worked for me (Umbraco 4.7.1.1). @lulia, for what it's worth (being over a year), I had to also clear the server cache (by removing the app_data\Temp\ClientDependency folder, and recycling the app pool in IIS). Then I completely cleared the browser cache. Then it worked.

    I do wish Umbraco would provide clear documentation on how to do things like correctly clear the browser cache, which often cause problems like this...

Please Sign in or register to post replies

Write your reply to:

Draft