Committer: vkurkin
LJSUP-10019: Possibility of using new and old version of photohostingU 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');