orbit-basic/app/assets/javascripts/ckeditor/config.js.erb

134 lines
5.4 KiB
Plaintext

/**
* @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.editorConfig = function( config ) {
config.uiColor = '#e6e6e6';
config.language = 'en';
config.height = 400;
config.resize_minHeight = 400;
config.toolbarCanCollapse = true;
// config.allowedContent = true;
config.keystrokes = [
[ CKEDITOR.CTRL + 90 /*Z*/, 'undo' ], //撤銷
[ CKEDITOR.CTRL + 89 /*Y*/, 'redo' ], //重做
[ CKEDITOR.CTRL + CKEDITOR.SHIFT + 90 /*Z*/, 'redo' ], //
[ CKEDITOR.CTRL + 76 /*L*/, 'link' ], //鏈結
[ CKEDITOR.CTRL + 66 /*B*/, 'bold' ], //粗體
[ CKEDITOR.CTRL + 73 /*I*/, 'italic' ], //斜體
[ CKEDITOR.CTRL + 85 /*U*/, 'underline' ], //下劃線
[ CKEDITOR.ALT + 109 /*-*/, 'toolbarCollapse' ]
];
config.autoGrow_onStartup = true;
config.forcePasteAsPlainText = false;
// config.filebrowserBrowseUrl = '/browser/browse.php';
// config.filebrowserImageBrowseUrl = '/browser/browse.php?type=Images';
// config.filebrowserUploadUrl = '/uploader/upload.php';
config.filebrowserBrowseUrl = "<%= Rails.application.routes.url_helpers.admin_assets_path %>";
config.filebrowserImageBrowseUrl = "<%= Rails.application.routes.url_helpers.admin_assets_path %>?type=images&module_app_id=<%= ModuleApp.first(conditions: {title: 'Asset'}).id.to_s %>";
// config.filebrowserUploadUrl = "<%= Rails.application.routes.url_helpers.file_upload_admin_assets_path %>";
// config.contentsCss = '/orbit_4.0.1/assets/javascripts/lib/ckeditor/plugins/stylesheetparser/samples/assets/sample.css';
// Load from a list of definitions.
// config.stylesSet = [
// { name: 'Strong Emphasis', element: 'strong' },
// { name: 'Emphasis', element: 'em' },
// ];
//Font Config
// config.fontSize_sizes = '12/12px;13/13px;14/14px;16/16px;18/18px;20/20px;24/24px;30/30px;36/36px;42/42px;48/48px;';
config.font_names = 'Arial;Comic Sans MS;Courier New;Georgia;Helvetica;Lucida Sans Unicode;Tahoma;Times New Roman;Trebuchet MS;Verdana;微軟正黑體';
// Define changes to default configuration here.
// For the complete reference:
// http://docs.ckeditor.com/#!/api/CKEDITOR.config
// The toolbar groups arrangement, optimized for two toolbar rows.
config.toolbarGroups = [
{ name: 'document', groups: [ 'mode', 'document', 'doctools' ] },
{ name: 'clipboard', groups: [ 'clipboard', 'undo' ] },
{ name: 'editing', groups: [ 'find', 'selection', 'spellchecker' ] },
{ name: 'links' },
{ name: 'insert' },
{ name: 'forms' },
{ name: 'tools' },
{ name: 'others' },
{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
{ name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ] },
{ name: 'styles' },
{ name: 'colors' },
{ name: 'about' }
];
// Paste from Word Config
// config.pasteFromWordPromptCleanup = true;
// config.pasteFromWordCleanupFile = true;
config.pasteFromWordRemoveFontStyles = false;
config.pasteFromWordNumberedHeadingToList = true;
config.pasteFromWordRemoveStyles = false;
// Codemirror Config
config.codemirror = {
// Whether or not you want to show line numbers
lineNumbers: true,
// Whether or not you want to use line wrapping
lineWrapping: true,
// Whether or not you want to highlight matching braces
matchBrackets: true,
// Whether or not you want tags to automatically close themselves
autoCloseTags: true,
// Whether or not you want Brackets to automatically close themselves
autoCloseBrackets: true,
// Whether or not to enable search tools, CTRL+F (Find), CTRL+SHIFT+F (Replace), CTRL+SHIFT+R (Replace All), CTRL+G (Find Next), CTRL+SHIFT+G (Find Previous)
enableSearchTools: true,
// Whether or not you wish to enable code folding (requires 'lineNumbers' to be set to 'true')
enableCodeFolding: true,
// Whether or not to enable code formatting
enableCodeFormatting: true,
// Whether or not to automatically format code should be done when the editor is loaded
autoFormatOnStart: true,
// Whether or not to automatically format code should be done every time the source view is opened
autoFormatOnModeChange: true,
// Whether or not to automatically format code which has just been uncommented
autoFormatOnUncomment: true,
// Whether or not to highlight the currently active line
highlightActiveLine: true,
// Whether or not to show the search Code button on the toolbar
showSearchButton: true,
// Whether or not to highlight all matches of current word/selection
highlightMatches: true,
// Whether or not to show the format button on the toolbar
showFormatButton: true,
// Whether or not to show the comment button on the toolbar
showCommentButton: true,
// Whether or not to show the uncomment button on the toolbar
showUncommentButton: true,
// Whether or not to show the showAutoCompleteButton button on the toolbar
showAutoCompleteButton: true
}
// Magicline Config
config.magicline_color = '#0088CC';
// Remove some buttons, provided by the standard plugins, which we don't
// need to have in the Standard(s) toolbar.
config.removeButtons = 'Cut,Copy,Paste';
// Se the most common block elements.
config.format_tags = 'p;h1;h2;h3;pre;div';
// Make dialogs simpler.
config.removeDialogTabs = 'image:advanced;link:advanced';
};
CKEDITOR.on('instanceReady',function(){
$('.cke_button').tooltip({
position: {
my: "center bottom-4",
at: "center top"
}
});
});