1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-05-17 16:28:19 +03:00

fix выделения текста для цитирования

This commit is contained in:
Mzhelskiy Maxim 2011-08-30 06:34:44 +00:00
parent 6f568cbb77
commit 3724e20cf6
3 changed files with 11 additions and 3 deletions

View file

@ -24,7 +24,7 @@ function getMarkitupSettings() {
{name: ls.lang.get('panel_i'), className:'editor-italic', key:'I', openWith:'(!(<em>|!|<i>)!)', closeWith:'(!(</em>|!|</i>)!)' },
{name: ls.lang.get('panel_s'), className:'editor-stroke', key:'S', openWith:'<s>', closeWith:'</s>' },
{name: ls.lang.get('panel_u'), className:'editor-underline', key:'U', openWith:'<u>', closeWith:'</u>' },
{name: ls.lang.get('panel_quote'), className:'editor-quote', key:'Q', openWith:'<blockquote>', closeWith:'</blockquote>' },
{name: ls.lang.get('panel_quote'), className:'editor-quote', key:'Q', replaceWith: function(m) { if (m.selectionOuter) return '<blockquote>'+m.selectionOuter+'</blockquote>'; else if (m.selection) return '<blockquote>'+m.selection+'</blockquote>'; else return '<blockquote></blockquote>' } },
{name: ls.lang.get('panel_code'), className:'editor-code', openWith:'<code>', closeWith:'</code>' },
{separator:'---------------' },
{name: ls.lang.get('panel_list'), className:'editor-ul', openWith:'<ul>\n', closeWith:'</ul>\n' },

View file

@ -227,6 +227,14 @@ ls.tools = (function ($) {
});
}
/**
* Возвращает выделенный текст на странице
*/
this.getSelectedText = function(){
if ($.browser.msie) return document.selection.createRange().text;
return document.getSelection();
}
return this;
}).call(ls.tools || {},jQuery);

View file

@ -23,7 +23,7 @@ function getMarkitupSettings() {
{name: ls.lang.get('panel_i'), className:'editor-italic', key:'I', openWith:'(!(<em>|!|<i>)!)', closeWith:'(!(</em>|!|</i>)!)' },
{name: ls.lang.get('panel_s'), className:'editor-stroke', key:'S', openWith:'<s>', closeWith:'</s>' },
{name: ls.lang.get('panel_u'), className:'editor-underline', key:'U', openWith:'<u>', closeWith:'</u>' },
{name: ls.lang.get('panel_quote'), className:'editor-quote', key:'Q', openWith:'<blockquote>', closeWith:'</blockquote>' },
{name: ls.lang.get('panel_quote'), className:'editor-quote', key:'Q', replaceWith: function(m) { if (m.selectionOuter) return '<blockquote>'+m.selectionOuter+'</blockquote>'; else if (m.selection) return '<blockquote>'+m.selection+'</blockquote>'; else return '<blockquote></blockquote>' } },
{name: ls.lang.get('panel_code'), className:'editor-code', openWith:'<code>', closeWith:'</code>' },
{separator:'---------------' },
{name: ls.lang.get('panel_list'), className:'editor-ul', openWith:' <li>', closeWith:'</li>', multiline: true, openBlockWith:'<ul>\n', closeBlockWith:'\n</ul>' },
@ -51,7 +51,7 @@ function getMarkitupCommentSettings() {
{name: ls.lang.get('panel_s'), className:'editor-stroke', key:'S', openWith:'<s>', closeWith:'</s>' },
{name: ls.lang.get('panel_u'), className:'editor-underline', key:'U', openWith:'<u>', closeWith:'</u>' },
{separator:'---------------' },
{name: ls.lang.get('panel_quote'), className:'editor-quote', key:'Q', openWith:'<blockquote>', closeWith:'</blockquote>' },
{name: ls.lang.get('panel_quote'), className:'editor-quote', key:'Q', replaceWith: function(m) { if (m.selectionOuter) return '<blockquote>'+m.selectionOuter+'</blockquote>'; else if (m.selection) return '<blockquote>'+m.selection+'</blockquote>'; else return '<blockquote></blockquote>' } },
{name: ls.lang.get('panel_code'), className:'editor-code', openWith:'<code>', closeWith:'</code>' },
{name: ls.lang.get('panel_image'), className:'editor-picture', key:'P', beforeInsert: function(h) { $('#form_upload_img').jqmShow(); } },
{name: ls.lang.get('panel_image'), className:'editor-image', replaceWith:'<img src="[!['+ls.lang.get('panel_image_promt')+':!:http://]!]" />' },