Просмотр исходного кода

! update to smile insert, for now gecko only

Spuds 13 лет назад
Родитель
Сommit
5d17019c07
1 измененных файлов с 9 добавлено и 3 удалено
  1. 9 3
      Themes/default/scripts/editor.js

+ 9 - 3
Themes/default/scripts/editor.js

@@ -669,9 +669,15 @@ smc_Editor.prototype.insertSmiley = function(oSmileyProperties)
 	// In text mode we just add it in as we always did.
 	if (!this.bRichTextEnabled)
 	{		
-		var begin = this.oTextHandle.value.substr(this.oTextHandle.selectionStart - 1, 1);
-		var end = this.oTextHandle.value.substr(this.oTextHandle.selectionEnd, 1);
-		this.insertText((begin != ' ' ? ' ' : '') + oSmileyProperties.sCode + (end != ' ' ? ' ' : ''));
+		// For gecko clients, do a smart insert of the smile
+		if ('selectionStart' in this.oTextHandle)
+		{
+			var begin = this.oTextHandle.value.substr(this.oTextHandle.selectionStart - 1, 1);
+			var end = this.oTextHandle.value.substr(this.oTextHandle.selectionEnd, 1);
+			this.insertText((begin != ' ' ? ' ' : '') + oSmileyProperties.sCode + (end != ' ' ? ' ' : ''));
+		}
+		else
+			this.insertText(oSmileyProperties.sCode);
 	}
 	// Otherwise we need to do a whole image...
 	else