I've made Smiles to support tinyMCE

ules/smileys/smileys.js smileys.js
32,42c32,46
< if (document.selection) {
< this.focus();
< document.selection.createRange().text = smiley;
< }
< else if (this.selectionStart || this.selectionStart == '0') {
< var cursorPos = this.selectionEnd + smiley.length;
< this.value = this.value.substring(0, this.selectionStart) + smiley + this.value.substring(this.selectionEnd);
< this.selectionStart = this.selectionEnd = cursorPos;
< }
< else {
< this.value = this.value + smiley;
---
> if(typeof tinyMCE != "undefined" ) tinyMCE.execCommand('mceInsertContent',false, smiley);
> else{
>
> if (document.selection) {
> this.focus();
> document.selection.createRange().text = smiley;
> }
> else if (this.selectionStart || this.selectionStart == '0') {
> var cursorPos = this.selectionEnd + smiley.length;
> this.value = this.value.substring(0, this.selectionStart) + smiley + this.value.substring(this.selectionEnd);
> this.selectionStart = this.selectionEnd = cursorPos;
> }
> else {
> this.value = this.value + smiley;
> }

Comments

ilya1st’s picture

Status: Active » Needs review

see above post

maartenvg’s picture

thanks, this saves me a lot of work figuring that out myself. For me it works like a charm.

Gurpartap Singh’s picture

Assigned: Unassigned » Gurpartap Singh
Status: Needs review » Fixed

Fixed, Thanks!!

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.