Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Offtopic) How to correctly paste text #19

Closed
ghost opened this issue Mar 14, 2014 · 1 comment
Closed

(Offtopic) How to correctly paste text #19

ghost opened this issue Mar 14, 2014 · 1 comment

Comments

@ghost
Copy link

ghost commented Mar 14, 2014

So I have script which translates latin keyboard to other language.
Here is a function which is responsible for pasting this script

function pasteTo(field) {
    if (document.selection) {
        field.focus();
        var sel = document.selection.createRange();
        if(sel) {
            sel.text = this;
            field.focus();
        }
    } else if (field.selectionStart || field.selectionStart == '0') {
        var startPos = field.selectionStart;
        var endPos = field.selectionEnd;
        var scrollTop = field.scrollTop;
        field.value = field.value.substring(0, startPos)+ this+ field.value.substring(endPos,field.value.length);
        field.focus();
        field.selectionStart = startPos + this.length;
        field.selectionEnd = startPos + this.length;
        field.scrollTop = scrollTop;
    } else if($(field).hasClass('froala-element')) {
        console.log(field)
        console.log(this);
                    // need help here
    } else {
        field.value += this;
        field.focus();
    }
};

So I can deal with usual textarea and input elements, but problem rises with Froala.

I went through froala methods but coud not really decide how to correctly deal with this so maybe you can help me here.
field is element where I'm typing and this is a key (one letter) to paste

@stefanneculai
Copy link
Contributor

We keep this repo for specific purposes as it is written in the read me. It is not for tech support:
4) For feature requests, tech support and general discussion, don't use GitHub Issues. See http://editor.froala.com/contact for the appropriate channels.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant