I'm new to GetSimple and this is my first time to use it. GetSimple is indeed simple to use, love it!
I want to share how to use Codemirror for CKeditor source.
Since I don't know the GetSimple change from each version, for information, I use GetSimple 3.2.0.
This is the screenshot when we done:
The step is:
Use Codemirror if HTML Editor is disabled.
This is the screenshot when we done:
I'm not fully understand -yet- how to make a plugin for this share.
So I decide to share it with manual modification. If someone can make a plugin for this, feel free to do it.
I want to share how to use Codemirror for CKeditor source.
Since I don't know the GetSimple change from each version, for information, I use GetSimple 3.2.0.
This is the screenshot when we done:
The step is:
- I use CKEditor v.4.0.1.1, you can download it here: http://ckeditor.com/download
note: Make sure you download the full package. If you choose standard, some item at toolbar will not appear.
- Rename (or delete) current ckeditor in admin\template\js\ then copy the new version.
- Open: admin\edit.php
- Find skin : 'getsimple' and change it to skin : 'moono'
- Download Codemirror plugin for CKEditor http://ckeditor.com/addon/codemirror
- Copy the codemirror folder to admin\template\js\ckeditor\plugins
- Open: admin\template\js\ckeditor\config.js
- Put code bellow before the config.toolbarGroups
Code:config.extraPlugins = 'codemirror';
config.codemirror = {
theme: 'default',
lineNumbers: true,
lineWrapping: true,
matchBrackets: true,
autoCloseTags: true,
autoCloseBrackets: true,
enableSearchTools: 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)
enableCodeFolding: true,
enableCodeFormatting: true,
autoFormatOnStart: true,
autoFormatOnUncomment: true,
highlightActiveLine: true,
highlightMatches: true,
showFormatButton: true,
showCommentButton: true,
showUncommentButton: true
}; - If you want to change the Codemirror theme, you can see the available file in admin\template\js\ckeditor\plugins\codemirror\theme\. Codemirror theme demo at http://codemirror.net/demo/theme.html
- Go to Page to see the result.
Use Codemirror if HTML Editor is disabled.
This is the screenshot when we done:
- Open: admin\edit.php
- Find <?php } ?> at line 365 and make sure it is the closed bracket for the <?php if ($HTMLEDITOR != '') { ?> at line 320
- Replace it with code bellow:
- Code:
<?php } else { ?>
<script type="text/javascript" src="template/js/codemirror/lib/codemirror-compressed.js"></script>
<link rel="stylesheet" href="template/js/codemirror/lib/codemirror.css">
<link rel="stylesheet" href="template/js/codemirror/theme/default.css">
<script type="text/javascript">
window.onload = function() {
var editor = CodeMirror.fromTextArea(document.getElementById("post-content"), {
lineNumbers: true,
lineWrapping: true,
matchBrackets: true,
indentUnit: 4,
indentWithTabs: true,
enterMode: "keep",
mode:"application/x-httpd-php",
tabMode: "shift",
onCursorActivity: function() {
editor.setLineClass(hlLine, null);
hlLine = editor.setLineClass(editor.getCursor().line, "activeline");
}
});
var hlLine = editor.setLineClass(0, "activeline");
}
</script>
<?php } ?> - To show the blue active line, put code bellow at the end of admin\template\js\codemirror\lib\codemirror.css
Code:.CodeMirror {font:13px/1.4em monospace;}
.CodeMirror .activeline { background: #e8f2ff; } - Disable HTML editor in setting and go to Page to see the result.
I'm not fully understand -yet- how to make a plugin for this share.
So I decide to share it with manual modification. If someone can make a plugin for this, feel free to do it.