1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-07-08 01:14:24 +03:00

Fixes #299: Переделать получение настроек для редактора MarkItUp!

This commit is contained in:
Denis Shakhov 2013-07-02 10:53:08 +07:00
parent 5049912aea
commit 2e2fa31049
3 changed files with 128 additions and 132 deletions

View file

@ -6,8 +6,11 @@ var ls = ls || {};
ls.settings = (function ($) { ls.settings = (function ($) {
this.getMarkitup = function() { this.get = function (sSettingsName) {
return { return this[sSettingsName];
};
this.markitup = {
onShiftEnter: {keepDefault:false, replaceWith:'<br />\n'}, onShiftEnter: {keepDefault:false, replaceWith:'<br />\n'},
onCtrlEnter: {keepDefault:false, openWith:'\n<p>', closeWith:'</p>'}, onCtrlEnter: {keepDefault:false, openWith:'\n<p>', closeWith:'</p>'},
onTab: {keepDefault:false, replaceWith:' '}, onTab: {keepDefault:false, replaceWith:' '},
@ -35,11 +38,9 @@ ls.settings = (function ($) {
{name: ls.lang.get('panel_clear_tags'), className:'editor-clean', replaceWith: function(markitup) { return markitup.selection.replace(/<(.*?)>/g, "") } }, {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 '<cut name="'+markitup.selection+'">'; else return '<cut>' }} {name: ls.lang.get('panel_cut'), className:'editor-cut', replaceWith: function(markitup) { if (markitup.selection) return '<cut name="'+markitup.selection+'">'; else return '<cut>' }}
] ]
}
}; };
this.getMarkitupComment = function() { this.markitupComment = {
return {
onShiftEnter: {keepDefault:false, replaceWith:'<br />\n'}, onShiftEnter: {keepDefault:false, replaceWith:'<br />\n'},
onTab: {keepDefault:false, replaceWith:' '}, onTab: {keepDefault:false, replaceWith:' '},
markupSet: [ markupSet: [
@ -56,11 +57,9 @@ ls.settings = (function ($) {
{separator:'---------------' }, {separator:'---------------' },
{name: ls.lang.get('panel_clear_tags'), className:'editor-clean', replaceWith: function(markitup) { return markitup.selection.replace(/<(.*?)>/g, "") } } {name: ls.lang.get('panel_clear_tags'), className:'editor-clean', replaceWith: function(markitup) { return markitup.selection.replace(/<(.*?)>/g, "") } }
] ]
}
}; };
this.getTinymce = function() { this.tinymce = {
return {
mode : "specific_textareas", mode : "specific_textareas",
editor_selector : "mce-editor", editor_selector : "mce-editor",
theme : "advanced", theme : "advanced",
@ -90,11 +89,9 @@ ls.settings = (function ($) {
underline : {inline : 'u', exact : true}, underline : {inline : 'u', exact : true},
strikethrough : {inline : 's', exact : true} strikethrough : {inline : 's', exact : true}
} }
}
}; };
this.getTinymceComment = function() { this.tinymceComment = {
return {
mode : "textareas", mode : "textareas",
theme : "advanced", theme : "advanced",
skin : "livestreet", skin : "livestreet",
@ -133,7 +130,6 @@ ls.settings = (function ($) {
} }
}); });
} }
}
}; };
return this; return this;

View file

@ -26,12 +26,12 @@
{hookb run='editor_init_wysiwyg' sEditorType=$sEditorType sEditorSelector=$sEditorSelector} {hookb run='editor_init_wysiwyg' sEditorType=$sEditorType sEditorSelector=$sEditorSelector}
{if $sEditorType == 'comment'} {if $sEditorType == 'comment'}
{$sSettings = 'ls.settings.getTinymceComment()'} {$sSettings = 'ls.settings.get("tinymceComment")'}
{else} {else}
{hook run='editor_init_wysiwyg_settings' sEditorType=$sEditorType assign='sSettings'} {hook run='editor_init_wysiwyg_settings' sEditorType=$sEditorType assign='sSettings'}
{if ! $sSettings} {if ! $sSettings}
{$sSettings = 'ls.settings.getTinymce()'} {$sSettings = 'ls.settings.get("tinymce")'}
{/if} {/if}
{/if} {/if}
@ -53,12 +53,12 @@
{include file='modals/modal.upload_image.tpl'} {include file='modals/modal.upload_image.tpl'}
{if $sEditorType == 'comment'} {if $sEditorType == 'comment'}
{$sSettings = 'ls.settings.getMarkitupComment()'} {$sSettings = 'ls.settings.get("markitupComment")'}
{else} {else}
{hook run='editor_init_markup_settings' sEditorType=$sEditorType assign='sSettings'} {hook run='editor_init_markup_settings' sEditorType=$sEditorType assign='sSettings'}
{if ! $sSettings} {if ! $sSettings}
{$sSettings = 'ls.settings.getMarkitup()'} {$sSettings = 'ls.settings.get("markitup")'}
{/if} {/if}
{/if} {/if}

View file

@ -26,12 +26,12 @@
{hookb run='editor_init_wysiwyg' sEditorType=$sEditorType sEditorSelector=$sEditorSelector} {hookb run='editor_init_wysiwyg' sEditorType=$sEditorType sEditorSelector=$sEditorSelector}
{if $sEditorType == 'comment'} {if $sEditorType == 'comment'}
{$sSettings = 'ls.settings.getTinymceComment()'} {$sSettings = 'ls.settings.get("tinymceComment")'}
{else} {else}
{hook run='editor_init_wysiwyg_settings' sEditorType=$sEditorType assign='sSettings'} {hook run='editor_init_wysiwyg_settings' sEditorType=$sEditorType assign='sSettings'}
{if ! $sSettings} {if ! $sSettings}
{$sSettings = 'ls.settings.getTinymce()'} {$sSettings = 'ls.settings.get("tinymce")'}
{/if} {/if}
{/if} {/if}
@ -53,12 +53,12 @@
{include file='modals/modal.upload_image.tpl'} {include file='modals/modal.upload_image.tpl'}
{if $sEditorType == 'comment'} {if $sEditorType == 'comment'}
{$sSettings = 'ls.settings.getMarkitupComment()'} {$sSettings = 'ls.settings.get("markitupComment")'}
{else} {else}
{hook run='editor_init_markup_settings' sEditorType=$sEditorType assign='sSettings'} {hook run='editor_init_markup_settings' sEditorType=$sEditorType assign='sSettings'}
{if ! $sSettings} {if ! $sSettings}
{$sSettings = 'ls.settings.getMarkitup()'} {$sSettings = 'ls.settings.get("markitup")'}
{/if} {/if}
{/if} {/if}