TylerGarlick / angular-redactor

Redactor WYSIWYG directives for redactor editor
MIT License
208 stars 83 forks source link

textarea auto focused and insert first image not work #25

Open williamherry opened 9 years ago

williamherry commented 9 years ago

Hi, I find some weird thing about this directive plugin, don't have this issue if I directly use redactor

I am use redactor on a textarea within a modal, when model show up, that textarea is focused, I mean the cursor is blink, if start input, everything is find, but if I click one time and then input, the inputed text will go to next line, click multi time have so such issue

another issue is the first image inserted into not show up, I am feeling this two issue are related, how can I not make this textarea focused?

samvloeberghs commented 9 years ago

you could try the focus option: focus: true => focus : false?

From their website ( http://imperavi.com/redactor/docs/settings/focus/#setting-focus ) : By default, Redactor doesn't receive focus on load, because there may be other input fields on a page. However, to set focus to Redactor, you can use this setting.

Perhaps you set it to focus somewhere? So explicitly state not to focus.

Just my first thougts :)

wiliame commented 9 years ago

I updated from bower version to this new version and autofocus appeared. Well, and placeholder disappeared too.

wiliame commented 9 years ago

Well... thats because of the "insert.set" fix, I fixed it checking first if the value is empty, but maybe it will be better to set the value without autofocussing it.

if(ngModel.$viewValue) { $_element.redactor('set', ngModel.$viewValue || ''); }

lanocturne commented 9 years ago

I have same auto focus issue like wiliame mentioned. If you put focusCallback fn on the scope config, you may find the callback gets called after redactor is initialized. Also yes, I set focus: false.

venkat290 commented 9 years ago

i had a same focus issue.how to focus last cursor position in redactor using jquery.