Issues with Redactor WYSIWYG editor by Imperavi while tabbing into the text editor

The problem occurs when you tab into the text editor instead of clicking on it.

If you are not focused on the text editor and use tab to move into the text editor, the editor will not properly focus on the line where the cursor appears. This doesn’t generally cause problems for most text editing purposes – until one tries to paste an image. The Redactor text editor does not seem to pick up on the fact that an image is pasted – and thus will not call the function that the user has supplied to Redactor to be run on image paste.

You can replicate this on the Redactor home page – Imperavi.com. Delete everything in the text editor, then unfocus the editor by clicking outside of it, then use tab to move your cursor into the editor, and finally – with a picture loaded into your clipboard – use ctrl + v to paste the image into the editor. If you use the inspection tool you will see that the image has not been wrapped in a figure tag – which is what usually happens when an image is input into the editor while it is correctly highlighted, or via dropping, or with the image input box.

Has anyone else experienced this issue? Any suggestions other than setting the tabIndex to -1 and not allowing people to tab into the editor – I would like for people to be able to do this.

Here is the configuration I use for this text editor:

Redactor(‘#EmailBody’, {
minHeight: ‘300px’,
embed: false,
command: false,
paste: {
plainText: true,
},
toolbar: {
target: ‘#toolbar-placeholder’
},
buttons: {
toolbar: toolbarOptions,
},
image: {
url: false,
// move to function in collection.js when wanting to
// use again on other pages
upload: function (upload, data) {
// increment the image count
let imageCount = parseInt($(‘#ImageCount’).val());
$(‘#ImageCount’).val(imageCount + 1);

        // create new file input
        let fileInput = document.createElement('input');
        fileInput.type = 'file';
        fileInput.name = 'Image' + imageCount;
        fileInput.id = 'Image' + imageCount;
        fileInput.style.display = 'none';
        fileInput.accept = 'image/png, image/jpeg';

        // store image in file input
        const dataTransfer = new DataTransfer();
        dataTransfer.items.add(data.files[0]);
        fileInput.files = dataTransfer.files;

        $('#image-uploads-store').append(fileInput);

        // file url
        let fileUrl = URL.createObjectURL(data.files[0]);

        // create response
        let response = {
            "file": {
                "url": fileUrl,
                "id": `Image${imageCount-1}`,
            }
        };

        // call complete
        upload.complete(response, data.e);
    }
}

});

Pretty much the upload function will create a hidden file input and put the image in there so we can retrieve it from the request on the postback – but that function is irrelevant to the problem. The issue is just that this function does not run when the editor is properly focused.

Using Redactor v4.1.4 and jQuery 1.8.2

Notes:

  • plainText: true shouldn’t interfere because it avoids images
  • I’ve looked through the documentation to see if there is anything to do with tabbing into the editor but there is nothing
  • I’ve tried using the editor.paste.before function to interrupt it somehow but it does not run when the editor isn’t properly focused and you paste an image

I’m expecting that when a user uses tab to enter the editor that it focuses properly and the images paste appropriately and the function runs.

New contributor

Boaty McBoatface is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật