From 2e2fa3104990db0b06c19f618fe3c62f5b0a544d Mon Sep 17 00:00:00 2001 From: Denis Shakhov Date: Tue, 2 Jul 2013 10:53:08 +0700 Subject: [PATCH] =?UTF-8?q?Fixes=20#299:=20=D0=9F=D0=B5=D1=80=D0=B5=D0=B4?= =?UTF-8?q?=D0=B5=D0=BB=D0=B0=D1=82=D1=8C=20=D0=BF=D0=BE=D0=BB=D1=83=D1=87?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BD=D0=B0=D1=81=D1=82=D1=80=D0=BE?= =?UTF-8?q?=D0=B5=D0=BA=20=D0=B4=D0=BB=D1=8F=20=D1=80=D0=B5=D0=B4=D0=B0?= =?UTF-8?q?=D0=BA=D1=82=D0=BE=D1=80=D0=B0=20MarkItUp!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- templates/framework/js/livestreet/settings.js | 244 +++++++++--------- .../skin/developer/forms/editor.init.tpl | 8 +- templates/skin/synio/forms/editor.init.tpl | 8 +- 3 files changed, 128 insertions(+), 132 deletions(-) diff --git a/templates/framework/js/livestreet/settings.js b/templates/framework/js/livestreet/settings.js index d2d4e068..97cdd834 100644 --- a/templates/framework/js/livestreet/settings.js +++ b/templates/framework/js/livestreet/settings.js @@ -6,133 +6,129 @@ var ls = ls || {}; ls.settings = (function ($) { - this.getMarkitup = function() { - return { - onShiftEnter: {keepDefault:false, replaceWith:'
\n'}, - onCtrlEnter: {keepDefault:false, openWith:'\n

', closeWith:'

'}, - onTab: {keepDefault:false, replaceWith:' '}, - markupSet: [ - {name:'H4', className:'editor-h4', openWith:'

', closeWith:'

' }, - {name:'H5', className:'editor-h5', openWith:'
', closeWith:'
' }, - {name:'H6', className:'editor-h6', openWith:'
', closeWith:'
' }, - {separator:'---------------' }, - {name: ls.lang.get('panel_b'), className:'editor-bold', key:'B', openWith:'(!(|!|)!)', closeWith:'(!(|!|)!)' }, - {name: ls.lang.get('panel_i'), className:'editor-italic', key:'I', openWith:'(!(|!|)!)', closeWith:'(!(|!|)!)' }, - {name: ls.lang.get('panel_s'), className:'editor-stroke', key:'S', openWith:'', closeWith:'' }, - {name: ls.lang.get('panel_u'), className:'editor-underline', key:'U', openWith:'', closeWith:'' }, - {name: ls.lang.get('panel_quote'), className:'editor-quote', key:'Q', replaceWith: function(m) { if (m.selectionOuter) return '
'+m.selectionOuter+'
'; else if (m.selection) return '
'+m.selection+'
'; else return '
' } }, - {name: ls.lang.get('panel_code'), className:'editor-code', openWith:'<(!(code|!|codeline)!)>', closeWith:'' }, - {separator:'---------------' }, - {name: ls.lang.get('panel_list'), className:'editor-ul', openWith:'
  • ', closeWith:'
  • ', multiline: true, openBlockWith:'' }, - {name: ls.lang.get('panel_list'), className:'editor-ol', openWith:'
  • ', closeWith:'
  • ', multiline: true, openBlockWith:'
      \n', closeBlockWith:'\n
    ' }, - {name: ls.lang.get('panel_list_li'), className:'editor-li', openWith:'
  • ', closeWith:'
  • ' }, - {separator:'---------------' }, - {name: ls.lang.get('panel_image'), className:'editor-picture', key:'P', beforeInsert: function(h) { jQuery('#window_upload_img').jqmShow(); } }, - {name: ls.lang.get('panel_video'), className:'editor-video', replaceWith:'' }, - {name: ls.lang.get('panel_url'), className:'editor-link', key:'L', openWith:'', closeWith:'', placeHolder:'Your text to link...' }, - {name: ls.lang.get('panel_user'), className:'editor-user', replaceWith:'' }, - {separator:'---------------' }, - {name: ls.lang.get('panel_clear_tags'), className:'editor-clean', replaceWith: function(markitup) { return markitup.selection.replace(/<(.*?)>/g, "") } }, - {name: ls.lang.get('panel_cut'), className:'editor-cut', replaceWith: function(markitup) { if (markitup.selection) return ''; else return '' }} - ] + this.get = function (sSettingsName) { + return this[sSettingsName]; + }; + + this.markitup = { + onShiftEnter: {keepDefault:false, replaceWith:'
    \n'}, + onCtrlEnter: {keepDefault:false, openWith:'\n

    ', closeWith:'

    '}, + onTab: {keepDefault:false, replaceWith:' '}, + markupSet: [ + {name:'H4', className:'editor-h4', openWith:'

    ', closeWith:'

    ' }, + {name:'H5', className:'editor-h5', openWith:'
    ', closeWith:'
    ' }, + {name:'H6', className:'editor-h6', openWith:'
    ', closeWith:'
    ' }, + {separator:'---------------' }, + {name: ls.lang.get('panel_b'), className:'editor-bold', key:'B', openWith:'(!(|!|)!)', closeWith:'(!(|!|)!)' }, + {name: ls.lang.get('panel_i'), className:'editor-italic', key:'I', openWith:'(!(|!|)!)', closeWith:'(!(|!|)!)' }, + {name: ls.lang.get('panel_s'), className:'editor-stroke', key:'S', openWith:'', closeWith:'' }, + {name: ls.lang.get('panel_u'), className:'editor-underline', key:'U', openWith:'', closeWith:'' }, + {name: ls.lang.get('panel_quote'), className:'editor-quote', key:'Q', replaceWith: function(m) { if (m.selectionOuter) return '
    '+m.selectionOuter+'
    '; else if (m.selection) return '
    '+m.selection+'
    '; else return '
    ' } }, + {name: ls.lang.get('panel_code'), className:'editor-code', openWith:'<(!(code|!|codeline)!)>', closeWith:'' }, + {separator:'---------------' }, + {name: ls.lang.get('panel_list'), className:'editor-ul', openWith:'
  • ', closeWith:'
  • ', multiline: true, openBlockWith:'
      \n', closeBlockWith:'\n
    ' }, + {name: ls.lang.get('panel_list'), className:'editor-ol', openWith:'
  • ', closeWith:'
  • ', multiline: true, openBlockWith:'
      \n', closeBlockWith:'\n
    ' }, + {name: ls.lang.get('panel_list_li'), className:'editor-li', openWith:'
  • ', closeWith:'
  • ' }, + {separator:'---------------' }, + {name: ls.lang.get('panel_image'), className:'editor-picture', key:'P', beforeInsert: function(h) { jQuery('#window_upload_img').jqmShow(); } }, + {name: ls.lang.get('panel_video'), className:'editor-video', replaceWith:'' }, + {name: ls.lang.get('panel_url'), className:'editor-link', key:'L', openWith:'', closeWith:'', placeHolder:'Your text to link...' }, + {name: ls.lang.get('panel_user'), className:'editor-user', replaceWith:'' }, + {separator:'---------------' }, + {name: ls.lang.get('panel_clear_tags'), className:'editor-clean', replaceWith: function(markitup) { return markitup.selection.replace(/<(.*?)>/g, "") } }, + {name: ls.lang.get('panel_cut'), className:'editor-cut', replaceWith: function(markitup) { if (markitup.selection) return ''; else return '' }} + ] + }; + + this.markitupComment = { + onShiftEnter: {keepDefault:false, replaceWith:'
    \n'}, + onTab: {keepDefault:false, replaceWith:' '}, + markupSet: [ + {name: ls.lang.get('panel_b'), className:'editor-bold', key:'B', openWith:'(!(|!|)!)', closeWith:'(!(|!|)!)' }, + {name: ls.lang.get('panel_i'), className:'editor-italic', key:'I', openWith:'(!(|!|)!)', closeWith:'(!(|!|)!)' }, + {name: ls.lang.get('panel_s'), className:'editor-stroke', key:'S', openWith:'', closeWith:'' }, + {name: ls.lang.get('panel_u'), className:'editor-underline', key:'U', openWith:'', closeWith:'' }, + {separator:'---------------' }, + {name: ls.lang.get('panel_quote'), className:'editor-quote', key:'Q', replaceWith: function(m) { if (m.selectionOuter) return '
    '+m.selectionOuter+'
    '; else if (m.selection) return '
    '+m.selection+'
    '; else return '
    ' } }, + {name: ls.lang.get('panel_code'), className:'editor-code', openWith:'<(!(code|!|codeline)!)>', closeWith:'' }, + {name: ls.lang.get('panel_image'), className:'editor-picture', key:'P', beforeInsert: function(h) { jQuery('#window_upload_img').jqmShow(); } }, + {name: ls.lang.get('panel_url'), className:'editor-link', key:'L', openWith:'', closeWith:'', placeHolder:'Your text to link...' }, + {name: ls.lang.get('panel_user'), className:'editor-user', replaceWith:'' }, + {separator:'---------------' }, + {name: ls.lang.get('panel_clear_tags'), className:'editor-clean', replaceWith: function(markitup) { return markitup.selection.replace(/<(.*?)>/g, "") } } + ] + }; + + this.tinymce = { + mode : "specific_textareas", + editor_selector : "mce-editor", + theme : "advanced", + skin : "livestreet", + theme_advanced_toolbar_location : "top", + theme_advanced_toolbar_align : "left", + theme_advanced_buttons1 : "lshselect,bold,italic,underline,strikethrough,|,bullist,numlist,|,undo,redo,|,lslink,unlink,lsvideo,lsimage,pagebreak,code", + theme_advanced_buttons2 : "", + theme_advanced_buttons3 : "", + theme_advanced_statusbar_location : "bottom", + theme_advanced_resizing : true, + theme_advanced_resize_horizontal : 0, + theme_advanced_resizing_use_cookie : 0, + theme_advanced_path : false, + object_resizing : true, + force_br_newlines : true, + forced_root_block : '', // Needed for 3.x + force_p_newlines : false, + plugins : "lseditor,safari,inlinepopups,media,pagebreak,autoresize", + convert_urls : false, + extended_valid_elements : "embed[src|type|allowscriptaccess|allowfullscreen|width|height]", + pagebreak_separator : "", + media_strict : false, + language : 'ru', + inline_styles: false, + formats : { + underline : {inline : 'u', exact : true}, + strikethrough : {inline : 's', exact : true} } }; - this.getMarkitupComment = function() { - return { - onShiftEnter: {keepDefault:false, replaceWith:'
    \n'}, - onTab: {keepDefault:false, replaceWith:' '}, - markupSet: [ - {name: ls.lang.get('panel_b'), className:'editor-bold', key:'B', openWith:'(!(|!|)!)', closeWith:'(!(|!|)!)' }, - {name: ls.lang.get('panel_i'), className:'editor-italic', key:'I', openWith:'(!(|!|)!)', closeWith:'(!(|!|)!)' }, - {name: ls.lang.get('panel_s'), className:'editor-stroke', key:'S', openWith:'', closeWith:'' }, - {name: ls.lang.get('panel_u'), className:'editor-underline', key:'U', openWith:'', closeWith:'' }, - {separator:'---------------' }, - {name: ls.lang.get('panel_quote'), className:'editor-quote', key:'Q', replaceWith: function(m) { if (m.selectionOuter) return '
    '+m.selectionOuter+'
    '; else if (m.selection) return '
    '+m.selection+'
    '; else return '
    ' } }, - {name: ls.lang.get('panel_code'), className:'editor-code', openWith:'<(!(code|!|codeline)!)>', closeWith:'' }, - {name: ls.lang.get('panel_image'), className:'editor-picture', key:'P', beforeInsert: function(h) { jQuery('#window_upload_img').jqmShow(); } }, - {name: ls.lang.get('panel_url'), className:'editor-link', key:'L', openWith:'', closeWith:'', placeHolder:'Your text to link...' }, - {name: ls.lang.get('panel_user'), className:'editor-user', replaceWith:'' }, - {separator:'---------------' }, - {name: ls.lang.get('panel_clear_tags'), className:'editor-clean', replaceWith: function(markitup) { return markitup.selection.replace(/<(.*?)>/g, "") } } - ] - } - }; - - this.getTinymce = function() { - return { - mode : "specific_textareas", - editor_selector : "mce-editor", - theme : "advanced", - skin : "livestreet", - theme_advanced_toolbar_location : "top", - theme_advanced_toolbar_align : "left", - theme_advanced_buttons1 : "lshselect,bold,italic,underline,strikethrough,|,bullist,numlist,|,undo,redo,|,lslink,unlink,lsvideo,lsimage,pagebreak,code", - theme_advanced_buttons2 : "", - theme_advanced_buttons3 : "", - theme_advanced_statusbar_location : "bottom", - theme_advanced_resizing : true, - theme_advanced_resize_horizontal : 0, - theme_advanced_resizing_use_cookie : 0, - theme_advanced_path : false, - object_resizing : true, - force_br_newlines : true, - forced_root_block : '', // Needed for 3.x - force_p_newlines : false, - plugins : "lseditor,safari,inlinepopups,media,pagebreak,autoresize", - convert_urls : false, - extended_valid_elements : "embed[src|type|allowscriptaccess|allowfullscreen|width|height]", - pagebreak_separator : "", - media_strict : false, - language : 'ru', - inline_styles: false, - formats : { - underline : {inline : 'u', exact : true}, - strikethrough : {inline : 's', exact : true} - } - } - }; - - this.getTinymceComment = function() { - return { - mode : "textareas", - theme : "advanced", - skin : "livestreet", - theme_advanced_toolbar_location : "top", - theme_advanced_toolbar_align : "left", - theme_advanced_buttons1 : "bold,italic,underline,strikethrough,lslink,lsquote", - theme_advanced_buttons2 : "", - theme_advanced_buttons3 : "", - theme_advanced_statusbar_location : "bottom", - theme_advanced_resizing : true, - theme_advanced_resize_horizontal : 0, - theme_advanced_resizing_use_cookie : 0, - theme_advanced_path : false, - object_resizing : true, - force_br_newlines : true, - forced_root_block : '', // Needed for 3.x - force_p_newlines : false, - plugins : "lseditor,safari,inlinepopups,media,pagebreak,autoresize", - convert_urls : false, - extended_valid_elements : "embed[src|type|allowscriptaccess|allowfullscreen|width|height]", - pagebreak_separator : "", - media_strict : false, - language : 'ru', - inline_styles: false, - formats : { - underline : {inline : 'u', exact : true}, - strikethrough : {inline : 's', exact : true} - }, - setup : function(ed) { - // Display an alert onclick - ed.onKeyPress.add(function(ed, e) { - key = e.keyCode || e.which; - if(e.ctrlKey && (key == 13)) { - $('#comment-button-submit').click(); - return false; - } - }); - } + this.tinymceComment = { + mode : "textareas", + theme : "advanced", + skin : "livestreet", + theme_advanced_toolbar_location : "top", + theme_advanced_toolbar_align : "left", + theme_advanced_buttons1 : "bold,italic,underline,strikethrough,lslink,lsquote", + theme_advanced_buttons2 : "", + theme_advanced_buttons3 : "", + theme_advanced_statusbar_location : "bottom", + theme_advanced_resizing : true, + theme_advanced_resize_horizontal : 0, + theme_advanced_resizing_use_cookie : 0, + theme_advanced_path : false, + object_resizing : true, + force_br_newlines : true, + forced_root_block : '', // Needed for 3.x + force_p_newlines : false, + plugins : "lseditor,safari,inlinepopups,media,pagebreak,autoresize", + convert_urls : false, + extended_valid_elements : "embed[src|type|allowscriptaccess|allowfullscreen|width|height]", + pagebreak_separator : "", + media_strict : false, + language : 'ru', + inline_styles: false, + formats : { + underline : {inline : 'u', exact : true}, + strikethrough : {inline : 's', exact : true} + }, + setup : function(ed) { + // Display an alert onclick + ed.onKeyPress.add(function(ed, e) { + key = e.keyCode || e.which; + if(e.ctrlKey && (key == 13)) { + $('#comment-button-submit').click(); + return false; + } + }); } }; diff --git a/templates/skin/developer/forms/editor.init.tpl b/templates/skin/developer/forms/editor.init.tpl index 54f7231a..c6fb61c4 100644 --- a/templates/skin/developer/forms/editor.init.tpl +++ b/templates/skin/developer/forms/editor.init.tpl @@ -26,12 +26,12 @@ {hookb run='editor_init_wysiwyg' sEditorType=$sEditorType sEditorSelector=$sEditorSelector} {if $sEditorType == 'comment'} - {$sSettings = 'ls.settings.getTinymceComment()'} + {$sSettings = 'ls.settings.get("tinymceComment")'} {else} {hook run='editor_init_wysiwyg_settings' sEditorType=$sEditorType assign='sSettings'} {if ! $sSettings} - {$sSettings = 'ls.settings.getTinymce()'} + {$sSettings = 'ls.settings.get("tinymce")'} {/if} {/if} @@ -53,12 +53,12 @@ {include file='modals/modal.upload_image.tpl'} {if $sEditorType == 'comment'} - {$sSettings = 'ls.settings.getMarkitupComment()'} + {$sSettings = 'ls.settings.get("markitupComment")'} {else} {hook run='editor_init_markup_settings' sEditorType=$sEditorType assign='sSettings'} {if ! $sSettings} - {$sSettings = 'ls.settings.getMarkitup()'} + {$sSettings = 'ls.settings.get("markitup")'} {/if} {/if} diff --git a/templates/skin/synio/forms/editor.init.tpl b/templates/skin/synio/forms/editor.init.tpl index 54f7231a..c6fb61c4 100644 --- a/templates/skin/synio/forms/editor.init.tpl +++ b/templates/skin/synio/forms/editor.init.tpl @@ -26,12 +26,12 @@ {hookb run='editor_init_wysiwyg' sEditorType=$sEditorType sEditorSelector=$sEditorSelector} {if $sEditorType == 'comment'} - {$sSettings = 'ls.settings.getTinymceComment()'} + {$sSettings = 'ls.settings.get("tinymceComment")'} {else} {hook run='editor_init_wysiwyg_settings' sEditorType=$sEditorType assign='sSettings'} {if ! $sSettings} - {$sSettings = 'ls.settings.getTinymce()'} + {$sSettings = 'ls.settings.get("tinymce")'} {/if} {/if} @@ -53,12 +53,12 @@ {include file='modals/modal.upload_image.tpl'} {if $sEditorType == 'comment'} - {$sSettings = 'ls.settings.getMarkitupComment()'} + {$sSettings = 'ls.settings.get("markitupComment")'} {else} {hook run='editor_init_markup_settings' sEditorType=$sEditorType assign='sSettings'} {if ! $sSettings} - {$sSettings = 'ls.settings.getMarkitup()'} + {$sSettings = 'ls.settings.get("markitup")'} {/if} {/if}