Vlad Kurkin (b_vladi) wrote in changelog,
Vlad Kurkin
b_vladi
changelog

[livejournal] r20366: LJSUP-10019: Possibility of using new an...

Committer: vkurkin
LJSUP-10019: Possibility of using new and old version of photohosting
U   trunk/htdocs/js/entry.js
Modified: trunk/htdocs/js/entry.js
===================================================================
--- trunk/htdocs/js/entry.js	2011-10-18 12:16:29 UTC (rev 20365)
+++ trunk/htdocs/js/entry.js	2011-10-18 12:30:42 UTC (rev 20366)
@@ -1070,19 +1070,24 @@
 	});
 };
 
-InOb.handleInsertImage = function (){
-	// if PhotoHosting enabled - show new popup
-	if(window.ljphotoEnabled){
-		jQuery('#updateForm').photouploader('option', 'type', 'upload')
-			.bind('htmlready', function (event){
-				var htmlOutput = event.htmlStrings.join(' ');
-				jQuery('#draft').val(jQuery('#draft').val() + htmlOutput);
+InOb.handleInsertImageBeta = function (){
+	jQuery('#updateForm').photouploader('option', 'type', 'upload').bind('htmlready',
+		function (event, htmlOutput){
+			var selection = DOM.getSelectedRange($('draft'));
+			var node = $('draft').event;
+			var value = node.value;
+			var start = value.substring(0, selection.start);
+			var end = value.substring(selection.end);
+			node.value = start + htmlOutput + end;
 		}).photouploader('show');
-	} else {
-		onInsertObject('/imgupload.bml');
-	}
 	return true;
 };
+
+InOb.handleInsertImage = function (){
+	onInsertObject('/imgupload.bml');
+	return true;
+};
+
 InOb.handleInsertVideo = function(){
 	var videoUrl = prompt('Please enter a video URL:');
 	var draft = $('draft');

Tags: b_vladi, js, livejournal, vkurkin
Subscribe

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments