Arek Wtykło

arteCode dla CKEditora

@@ -3,33 +3,71 @@ @@ -3,33 +3,71 @@
3 * For licensing, see LICENSE.md or http://ckeditor.com/license 3 * For licensing, see LICENSE.md or http://ckeditor.com/license
4 */ 4 */
5 5
  6 +CKEDITOR.plugins.add('artecode', {
  7 + init: function (editor) {
  8 + editor.addCommand('insertJS', {
  9 + exec: function (editor) {
  10 + editor.insertHtml('<p><br/></p><pre><code class="line-numbers language-javascript">Amazing Js code</code></pre>');
  11 + }
  12 + });
  13 + editor.ui.addButton('insertJS', {
  14 + label: 'Wstaw JS',
  15 + command: 'insertJS',
  16 + icon: this.path + 'js.png'
  17 + });
  18 +
  19 + editor.addCommand('insertHTML', {
  20 + exec: function (editor) {
  21 + editor.insertHtml('<p><br/></p><pre><code class="line-numbers language-html">Amazing HTML5 code</code></pre>');
  22 + }
  23 + });
  24 + editor.ui.addButton('insertHTML', {
  25 + label: 'Wstaw HTML',
  26 + command: 'insertHTML',
  27 + icon: this.path + 'html5.png'
  28 + });
  29 +
  30 + editor.addCommand('insertCSS', {
  31 + exec: function (editor) {
  32 + editor.insertHtml('<p><br/></p><pre><code class="line-numbers language-css">Amazing CSS3 code</code></pre>');
  33 + }
  34 + });
  35 + editor.ui.addButton('insertCSS', {
  36 + label: 'Wstaw CSS3',
  37 + command: 'insertCSS',
  38 + icon: this.path + 'css3.png'
  39 + });
  40 +
  41 + editor.addCommand('insertBash', {
  42 + exec: function (editor) {
  43 + editor.insertHtml('<p><br/></p><pre><code class="line-numbers language-bash">Amazing Bash code</code></pre>');
  44 + }
  45 + });
  46 + editor.ui.addButton('insertBash', {
  47 + label: 'Wstaw Bash',
  48 + command: 'insertBash',
  49 + icon: this.path + 'bash.png'
  50 + });
  51 +
  52 + editor.addCommand('insertPhp', {
  53 + exec: function (editor) {
  54 + editor.insertHtml('<p><br/></p><pre><code class="line-numbers language-php">Amazing PHP7 code</code></pre>');
  55 + }
  56 + });
  57 + editor.ui.addButton('insertPhp', {
  58 + label: 'Wstaw PHP',
  59 + command: 'insertPhp',
  60 + icon: this.path + 'php7.png'
  61 + });
  62 + }
  63 +});
  64 +
  65 +
6 CKEDITOR.editorConfig = function (config) { 66 CKEDITOR.editorConfig = function (config) {
7 -// alert('df');  
8 - // Define changes to default configuration here. For example:  
9 - // config.language = 'fr';  
10 -// config.uiColor = '#AADC6E';  
11 -// config.uiColor = 'fff';  
12 -  
13 -// config.toolbar = [  
14 -// {name: 'document', groups: ['mode', 'document', 'doctools'], items: ['Source', '-', 'Save', '-', 'Templates']},  
15 -// {name: 'clipboard', groups: ['clipboard', 'undo'], items: ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo']},  
16 -// '/',  
17 -// {name: 'basicstyles', groups: ['basicstyles', 'cleanup'], items: ['Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat']},  
18 -// {name: 'insert', items: ['Image', 'Flash', 'Table', 'HorizontalRule', 'Smiley', 'SpecialChar', 'PageBreak', 'Iframe']},  
19 -// {name: 'paragraph', groups: ['list', 'indent', 'blocks', 'align', 'bidi'], items: ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', 'CreateDiv', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-', 'BidiLtr', 'BidiRtl']},  
20 -// {name: 'links', items: ['Link', 'Unlink', 'Anchor']},  
21 -// '/',  
22 -// {name: 'styles', items: ['Format', 'Font', 'FontSize']},  
23 -// {name: 'colors', items: ['TextColor', 'BGColor']},  
24 -// {name: 'editing', groups: ['find', 'selection', 'spellchecker'], items: ['Replace']},  
25 -// {name: 'tools', items: ['Maximize', 'ShowBlocks']},  
26 -// {name: 'others', items: ['-']},  
27 -// {name: 'about', items: ['About']}  
28 -// ];  
29 -//  
30 config.toolbar = [ 67 config.toolbar = [
31 {name: 'document', groups: ['mode', 'document', 'doctools', 'clipboard', 'undo'], items: ['Source', '-', 'Save', '-', 'Templates', 'Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo']}, 68 {name: 'document', groups: ['mode', 'document', 'doctools', 'clipboard', 'undo'], items: ['Source', '-', 'Save', '-', 'Templates', 'Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo']},
32 {name: 'basicstyles', groups: ['basicstyles', 'cleanup'], items: ['Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat']}, 69 {name: 'basicstyles', groups: ['basicstyles', 'cleanup'], items: ['Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat']},
  70 + {name: 'artecode', items: ['insertPhp', 'insertHTML', 'insertJS', 'insertCSS', 'insertBash']},
33 {name: 'insert', items: ['Image', 'Flash', 'Table', 'HorizontalRule', 'Smiley', 'SpecialChar', 'PageBreak', 'Iframe']}, 71 {name: 'insert', items: ['Image', 'Flash', 'Table', 'HorizontalRule', 'Smiley', 'SpecialChar', 'PageBreak', 'Iframe']},
34 {name: 'paragraph', groups: ['list', 'indent', 'blocks', 'align', 'bidi'], items: ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', 'CreateDiv', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-', 'BidiLtr', 'BidiRtl']}, 72 {name: 'paragraph', groups: ['list', 'indent', 'blocks', 'align', 'bidi'], items: ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', 'CreateDiv', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-', 'BidiLtr', 'BidiRtl']},
35 {name: 'links', items: ['Link', 'Unlink', 'Anchor']}, 73 {name: 'links', items: ['Link', 'Unlink', 'Anchor']},