Copied to clipboard

Flag this post as spam?

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


  • Tom Engan 430 posts 1173 karma points
    Oct 13, 2015 @ 13:48
    Tom Engan
    0

    Validation when using RTE: rel and id attribute - not fixed in v. 7.4.0.

    After upgrading to 7.4.0, I still get error messages on validations (validator.w3.org) when I put images into the control Rich text editor

    • rel attribute: Still getting numerical value (the same value as in data-id)

    • id attribute: Gets the same value (__mcenew) for all images

    When images are inserted as control Image there are no id, rel and data-id attribute in the img-tag.

    Is there a solution on how validation can be correct when using the RTE-control?

    NOTE: Text changed to version 7.4.0.

  • Tom Engan 430 posts 1173 karma points
    Oct 21, 2015 @ 13:28
    Tom Engan
    0

    I think I remember this should be fixed in 7.3.0, but maybe I remember wrong. Anyone..?

  • Paul 184 posts 646 karma points
    Oct 29, 2015 @ 14:59
    Paul
    0

    Not sure about 7.3, but this is certainly a bug we've encountered in 7.2.8

    It looks like the problem is within the umbraco.service.js

    Answer below :-) \/ \/

  • Paul 184 posts 646 karma points
    Oct 29, 2015 @ 15:15
    Paul
    100
            * @ngdoc method
        * @name umbraco.services.tinyMceService#createMediaPicker
        * @methodOf umbraco.services.tinyMceService
        *
        * @description
        * Creates the umbrco insert media tinymce plugin
        *
        * @param {Object} editor the TinyMCE editor instance        
        * @param {Object} $scope the current controller scope
        */
        createMediaPicker: function (editor) {
            editor.addButton('umbmediapicker', {
                icon: 'custom icon-picture',
                tooltip: 'Media Picker',
                onclick: function () {
    
                    var selectedElm = editor.selection.getNode(),
                        currentTarget;
    
    
                    if(selectedElm.nodeName === 'IMG'){
                        var img = $(selectedElm);
                        currentTarget = {
                            altText: img.attr("alt"),
                            url: img.attr("src"),
                            id: img.attr("id")
                        };
                    }
    
                    userService.getCurrentUser().then(function(userData) {
                        dialogService.mediaPicker({
                            currentTarget: currentTarget,
                            onlyImages: true,
                            showDetails: true,
                            startNodeId: userData.startMediaId,
                            callback: function (img) {
    
                                if (img) {
    
                                    var data = {
                                        alt: img.altText || "",
                                        src: (img.url) ? img.url : "nothing.jpg",
                                        id: img.id
                                    };
    
                                    editor.insertContent(editor.dom.createHTML('img', data));
    
                                    $timeout(function () {
                                        var imgElm = editor.dom.get('img.id');
                                        var size = editor.dom.getSize(imgElm);
    
                                        if (editor.settings.maxImageSize && editor.settings.maxImageSize !== 0) {
                                            var newSize = imageHelper.scaleToMaxSize(editor.settings.maxImageSize, size.w, size.h);
    
                                            var s = "width: " + newSize.width + "px; height:" + newSize.height + "px;";
                                            editor.dom.setAttrib(imgElm, 'style', s);
                                            editor.dom.setAttrib(imgElm, 'id', null);
    
                                            if (img.url) {
                                                var src = img.url + "?width=" + newSize.width + "&height=" + newSize.height;
                                                editor.dom.setAttrib(imgElm, 'data-mce-src', src);
                                            }
                                        }
                                    }, 500);
                                }
                            }
                        });
                    });
    
    
                }
            });
        },
    

    This fixes the problem in 7.2.8, I suspect it'd work on earlier versions too.

  • Tom Engan 430 posts 1173 karma points
    Nov 17, 2015 @ 10:47
    Tom Engan
    0

    Thanks, no error messages on validations (validator.w3.org).

    I have Umbraco version 7.3.1 assembly: 1.0.5780.28249, and this bug is still there..

  • Tom Engan 430 posts 1173 karma points
    Dec 02, 2015 @ 14:00
    Tom Engan
    0

    This solution work, but will dissapair with every upgrading to a new version. I've now installed Umbraco version 7.3.3, and this is still not fixed.

  • Tom Engan 430 posts 1173 karma points
    Dec 14, 2015 @ 16:41
    Tom Engan
    0

    And the same in 7.3.4 - still not fixed.

  • Tom Engan 430 posts 1173 karma points
    Feb 15, 2016 @ 23:45
    Tom Engan
    0

    Just installed version 7.4.0, and still not implemented. When will this solution be an official part of Umbraco?

    Bug since 7.2.1 still in progress: http://issues.umbraco.org/issue/U4-6228

Please Sign in or register to post replies

Write your reply to:

Draft