Committer: vkurkin
LJSUP-9255: Cannot upload image from computerU trunk/htdocs/js/ck/plugins/livejournal/plugin.js U trunk/htdocs/js/entry.js
Modified: trunk/htdocs/js/ck/plugins/livejournal/plugin.js =================================================================== --- trunk/htdocs/js/ck/plugins/livejournal/plugin.js 2011-08-18 06:37:23 UTC (rev 19766) +++ trunk/htdocs/js/ck/plugins/livejournal/plugin.js 2011-08-18 06:44:08 UTC (rev 19767) @@ -462,7 +462,7 @@ editor.insertHtml(html); }); } else { - editor.openDialog('image'); + InOb.handleInsertImage(); } }, editorFocus: false @@ -470,7 +470,7 @@ editor.on('doubleclick', function() { if (ljNoteData.LJImage.node){ - editor.openDialog('image'); + editor.execCommand('LJImage'); } }); @@ -541,7 +541,7 @@ command.fire('state'); } - function justifyCommand(editor, name, value) { + function JustifyCommand(editor, name, value) { this.name = name; this.value = value; @@ -611,7 +611,7 @@ } } - justifyCommand.prototype = { + JustifyCommand.prototype = { exec : function(editor) { if(ljNoteData.LJLike.node){ ljNoteData.LJLike.node.removeAttribute('contenteditable'); @@ -670,10 +670,10 @@ } }; - var left = new justifyCommand(editor, 'justifyleft', 'left'), - center = new justifyCommand(editor, 'justifycenter', 'center'), - right = new justifyCommand(editor, 'justifyright', 'right'), - justify = new justifyCommand(editor, 'justifyblock', 'justify'); + var left = new JustifyCommand(editor, 'justifyleft', 'left'), + center = new JustifyCommand(editor, 'justifycenter', 'center'), + right = new JustifyCommand(editor, 'justifyright', 'right'), + justify = new JustifyCommand(editor, 'justifyblock', 'justify'); editor.addCommand('justifyleft', left); editor.addCommand('justifycenter', center); Modified: trunk/htdocs/js/entry.js =================================================================== --- trunk/htdocs/js/entry.js 2011-08-18 06:37:23 UTC (rev 19766) +++ trunk/htdocs/js/entry.js 2011-08-18 06:44:08 UTC (rev 19767) @@ -888,11 +888,17 @@ } ta = ta.event; - var selection = DOM.getSelectedRange($('draft')); - var value = ta.value; - var start = value.substring(0, selection.start); - var end = value.substring(selection.end); - ta.value = start + "\n<img src=\"" + url + "\"" + w + h + " />" + end; + var html = "<img src=\"" + url + "\"" + w + h + " />"; + + if(window.switchedRteOn){ + CKEDITOR.instances.draft.insertHtml(html); + } else { + var selection = DOM.getSelectedRange($('draft')); + var value = ta.value; + var start = value.substring(0, selection.start); + var end = value.substring(selection.end); + ta.value = start + "\n" + html + end; + } return true; }; @@ -1124,10 +1130,7 @@ } var div_err = InOb.popid('img_error'); - if(div_err){ - div_err.style.display = 'block'; - } - if(! div_err){ + if(!div_err){ return InOb.fail('Unable to get error div'); } @@ -1151,9 +1154,11 @@ } if(url.value == ''){ + div_err.style.display = 'block'; InOb.setError('You must specify the image\'s URL'); return false; } else if(url.value.match(/html?$/i)){ + div_err.style.display = 'block'; InOb.setError('It looks like you are trying to insert a web page, not an image'); return false; } @@ -1347,4 +1352,4 @@ InOb.setTitle = function (title){ var wintitle = currentPopupWindow.document.getElementById('wintitle'); wintitle.innerHTML = title; -}; +}; \ No newline at end of file