new pisilinux web sites

This commit is contained in:
Erkan IŞIK
2026-07-01 16:44:17 +03:00
commit b58488b586
21740 changed files with 2066209 additions and 0 deletions
@@ -0,0 +1,44 @@
# Changelog
## v1.2.5 (4.0.x - 4.6.x)
I updated the code style guide to 2spaces instead of 4.
* [FEATURE] : Updated ACE editor to 1.2.6
* [DOC] : Added the examples directly in the master branch
## v1.2.4 (4.0.x - 4.5.x)
* [FIX] : Fixed C/C++ mode
* [FIX] : Avoid mixed content with cdn script
* [FIX] : Fixed tab size value
* [FEATURE] : Added HiDPI icon
* [FEATURE] : Added Turkish
* [FEATURE] : Added Russian
## v1.2.3 (4.0.x - 4.4.x)
* [FIX] : Fixed auto focus on the editor when opening the dialog.
* [FIX] : Fixed space character encoding
* [FEATURE] : Added property to choose the ACE Editor sources
## v1.2.2 (4.0.x - 4.4.x)
* [FIX] : Fixed ckeditor style overriden by pbckcode plugin
## v1.2.1 (4.0.x - 4.3.x)
* [FIX] : problem with minification for CKEditor Builder
* [FIX] : multiples script loads when you instanciate several CKEditor on the same page
From the v1.2.1, ACE Editor is now loaded from the [jsDelivr CDN](http://www.jsdelivr.com/). The loading will be faster and the plugin size will be smaller.
## v1.2.0 (4.0.x - 4.3.x)
* [FIX] : fix problem of external files loading
* [IMPROVEMENT] : load external files only once
* [FEATURE] : tab size settings
* [FIX] : added CKEditor ACF to parse already saved code
## v1.1.0 (4.0.x - 4.1.x)
* [FEATURE] : added several syntax highlighters (Prism.js, Highlight.js, SyntaxHighlighter.js)
@@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright {yyyy} {name of copyright owner}
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
@@ -0,0 +1,179 @@
# pbckcode
A CKEditor plugin to easily add code into your articles.
The plugin will create a dialog where you will be able to format your code as your will. When you press the **OK** button, the plugin will create a *pre* tag with your code inside.
# Demos
* [Basic configuration](http://prbaron.github.com/pbckcode/basic.html)
* [Use options](http://prbaron.github.com/pbckcode/options.html)
* [Load ACE from custom directory](http://prbaron.github.com/pbckcode/custom-ace.html)
* [Full CKEditor](http://prbaron.github.com/pbckcode/full.html)
# Installation
1. Download the plugin from the Github repository : [https://github.com/prbaron/pbckcode/tags](https://github.com/prbaron/pbckcode/tags)
1. Place the **src** folder into the plugins folder of CKEditor (*{Path to CKEDitor}/plugins/*)
1. Rename the folder to **pbckcode** (it will be easier to call it into CKEditor)
1. Open the config.js file and add the following lines :
```js
CKEDITOR.editorConfig = function(config) {
// CKEDITOR TOOLBAR CUSTOMIZATION
// I only set the needed buttons, so feel frey to add those you want in the array
config.toolbarGroups = [
{name: 'pbckcode'},
// your other buttons here
// get information about available buttons here: bhttp://docs.ckeditor.com/?mobile=/guide/dev_toolbar
];
// CKEDITOR PLUGINS LOADING
config.extraPlugins = 'pbckcode'; // add other plugins here (comma separated)
// ADVANCED CONTENT FILTER (ACF)
// ACF protects your CKEditor instance of adding unofficial tags
// however it strips out the pre tag of pbckcode plugin
// add this rule to enable it, useful when you want to re edit a post
// only needed on v1.1.x
config.allowedContent = 'pre[*]{*}(*)'; // add other rules here
// PBCKCODE CUSTOMIZATION
config.pbckcode = {
// An optional class to your pre tag.
cls: '',
// The syntax highlighter you will use in the output view
highlighter: 'PRETTIFY',
// An array of the available modes for you plugin.
// The key corresponds to the string shown in the select tag.
// The value correspond to the loaded file for ACE Editor.
modes: [['HTML', 'html'], ['CSS', 'css'], ['PHP', 'php'], ['JS', 'javascript']],
// The theme of the ACE Editor of the plugin.
theme: 'textmate',
// Tab indentation (in spaces)
tab_size: '4'
};
};
```
And you are good to go! You will have the same configuration than the demo.
# Options
## highlighter
Choose your synta highlighter output. Remove the option if you want to output a basic <pre> tag, otherwise, choose one of them.
```js
'HIGHLIGHT' // http://highlightjs.org/
'PRETTIFY' // https://code.google.com/p/google-code-prettify/
'PRISM' // http://prismjs.com/
'SYNTAX_HIGHLIGHTER' // http://alexgorbatchev.com/SyntaxHighlighter/
```
## modes
```js
// Available modes
['C/C++' , 'c_cpp']
['C9Search' , 'c9search']
['Clojure' , 'clojure']
['CoffeeScript' , 'coffee']
['ColdFusion' , 'coldfusion']
['C#' , 'csharp']
['CSS' , 'css']
['Diff' , 'diff']
['Glsl' , 'glsl']
['Go' , 'golang']
['Groovy' , 'groovy']
['haXe' , 'haxe']
['HTML' , 'html']
['Jade' , 'jade']
['Java' , 'java']
['JavaScript' , 'javascript']
['JSON' , 'json']
['JSP' , 'jsp']
['JSX' , 'jsx']
['LaTeX' , 'latex']
['LESS' , 'less']
['Liquid' , 'liquid']
['Lua' , 'lua']
['LuaPage' , 'luapage']
['Markdown' , 'markdown']
['OCaml' , 'ocaml']
['Perl' , 'perl']
['pgSQL' , 'pgsql']
['PHP' , 'php']
['Powershell' , 'powershel1']
['Python' , 'python']
['R' , 'ruby']
['OpenSCAD' , 'scad']
['Scala' , 'scala']
['SCSS/Sass' , 'scss']
['SH' , 'sh']
['SQL' , 'sql']
['SVG' , 'svg']
['Tcl' , 'tcl']
['Text' , 'text']
['Textile' , 'textile']
['XML' , 'xml']
['XQuery' , 'xq']
['YAML' , 'yaml']
```
## theme
```js
// Bright themes
'chrome'
'clouds'
'crimson_editor'
'dawn'
'dreamweaver'
'eclipse'
'github'
'solarized_light'
'textmate' // default theme
'tomorrow'
'xcode'
'kuroir'
'katzenmilch'
```
```js
// Dark themes
'ambiance'
'chaos'
'clouds_midnight'
'cobalt'
'idle_fingers'
'kr_theme'
'merbivore'
'merbivore_soft'
'mono_industrial'
'monokai'
'pastel_on_dark'
'solarized_dark'
'terminal'
'tomorrow_night'
'tomorrow_night_blue'
'tomorrow_night_bright'
'tomorrow_night_eighties'
'twilight'
'vibrant_ink'
```
# Special Thanks
* CKEditor : [http://ckeditor.com/](http://ckeditor.com/)
* ACE : [http://ace.ajax.org/](http://ace.ajax.org/)
* Lea Verou : [http://prismjs.com/](http://prismjs.com/)
* Google : [https://code.google.com/p/google-code-prettify/](https://code.google.com/p/google-code-prettify/)
* Ivan Sagalaev : [http://highlightjs.org/](http://highlightjs.org/)
* Alex Gorbatchev : [http://alexgorbatchev.com/SyntaxHighlighter/](http://alexgorbatchev.com/SyntaxHighlighter/)
# Credits
#### Pierre Baron
* Website : [http://www.pierrebaron.fr](http://www.pierrebaron.fr)
* Twitter : [@prbaron](https://twitter.com/prbaron)
* Contact : <prbaron22@gmail.com>
@@ -0,0 +1,102 @@
var PBSyntaxHighlighter = (function() {
"use strict";
var sh;
/**
* Constructor
* @param {String} sh The SyntaxHighlighter
*/
function PBSyntaxHighlighter(sh) {
switch (sh) {
case "HIGHLIGHT" :
this.sh = HIGHLIGHT;
break;
case "PRETTIFY" :
this.sh = PRETTIFY;
break;
case "PRISM" :
this.sh = PRISM;
break;
case "SYNTAX_HIGHLIGHTER" :
this.sh = SYNTAX_HIGHLIGHTER;
break;
default :
this.sh = {
_type: "DEFAULT",
_cls: "",
_tag: 'pre'
};
break;
}
}
/**
* Sets the SyntaxHighlighter type
* @param {String} type The name of the SyntaxHighlighter
*/
PBSyntaxHighlighter.prototype.setType = function(type) {
this.sh._type = type;
};
/**
* Gets the SyntaxHighlighter type
* @return {String} The type of the SyntaxHighlighter
*/
PBSyntaxHighlighter.prototype.getType = function() {
return this.sh._type;
};
/**
* Sets the full class of the SH object
* @param {String} cls the class to add to the Object
*/
PBSyntaxHighlighter.prototype.setCls = function(cls) {
this.sh.cls = this.sh._cls + cls;
};
/**
* Gets the full class of the SH Object
* @return {String} the full class of the SH Object
*/
PBSyntaxHighlighter.prototype.getCls = function() {
return this.sh.cls;
};
/**
* Get the tag to insert into the pre tag
* @return {String} the tag to insert, pre otherwise
*/
PBSyntaxHighlighter.prototype.getTag = function() {
return this.sh._tag;
};
return PBSyntaxHighlighter;
})();
/**********************************/
/* SYNTAX HIGHLIGHTERS DEFINITION */
/**********************************/
var HIGHLIGHT = {
_type: "HIGHLIGHT",
_cls: "", // only show language (done in pbckcode.js)
_tag: 'code'
};
var PRETTIFY = {
_type: "PRETTIFY",
_cls: "prettyprint linenums lang-",
_tag: 'pre'
};
var PRISM = {
_type: "PRISM",
_cls: "language-",
_tag: 'code'
};
var SYNTAX_HIGHLIGHTER = {
_type: "SYNTAX_HIGHLIGHTER",
_cls: "brush: ",
_tag: 'pre'
};
@@ -0,0 +1,205 @@
CKEDITOR.dialog.add('pbckcodeDialog', function(editor) {
var tab_sizes = ['1', '2', '4', '8'];
// CKEditor variables
var dialog;
var shighlighter = new PBSyntaxHighlighter(editor.settings.highlighter);
// ACE variables
var aceEditor, aceSession, whitespace;
// EDITOR panel
var editorPanel = {
id: 'editor',
label: editor.lang.pbckcode.editor,
elements: [
{
type: 'hbox',
children: [
{
type: 'select',
id: 'code-select',
className: 'cke_pbckcode_form',
label: editor.lang.pbckcode.mode,
items: editor.settings.modes,
'default': editor.settings.modes[0][1],
setup: function(element) {
if (element) {
element = element.getAscendant('pre', true);
this.setValue(element.getAttribute('data-pbcklang'));
}
},
commit: function(element) {
if (element) {
element = element.getAscendant('pre', true);
element.setAttribute('data-pbcklang', this.getValue());
}
},
onChange: function() {
aceSession.setMode('ace/mode/' + this.getValue());
}
},
{
type: 'select',
id: 'code-tabsize-select',
className: 'cke_pbckcode_form',
label: editor.lang.pbckcode.tabSize,
items: tab_sizes,
'default': editor.settings.tab_size,
setup: function(element) {
if (element) {
element = element.getAscendant('pre', true);
this.setValue(element.getAttribute('data-pbcktabsize'));
}
},
commit: function(element) {
if (element) {
element = element.getAscendant('pre', true);
element.setAttribute('data-pbcktabsize', this.getValue());
}
},
onChange: function(element) {
if (element) {
whitespace.convertIndentation(aceSession, ' ', this.getValue());
aceSession.setTabSize(this.getValue());
}
}
}
]
},
{
type: 'html',
html: '<div></div>',
id: 'code-textarea',
className: 'cke_pbckcode_ace',
style: 'position: absolute; top: 80px; left: 10px; right: 10px; bottom: 50px;',
setup: function(element) {
// get the value of the editor
var code = element.getHtml();
// replace some regexp
code = code.replace(new RegExp('<br/>', 'g'), '\n')
.replace(new RegExp('<br>', 'g'), '\n')
.replace(new RegExp('&lt;', 'g'), '<')
.replace(new RegExp('&gt;', 'g'), '>')
.replace(new RegExp('&amp;', 'g'), '&')
.replace(new RegExp('&nbsp;', 'g'), ' ');
aceEditor.setValue(code);
},
commit: function(element) {
element.setText(aceEditor.getValue());
}
}
]
};
// dialog code
return {
// Basic properties of the dialog window: title, minimum size.
title: editor.lang.pbckcode.title,
minWidth: 600,
minHeight: 400,
// Dialog window contents definition.
contents: [
editorPanel
],
onLoad: function() {
dialog = this;
// we load the ACE plugin to our div
aceEditor = ace.edit(dialog.getContentElement('editor', 'code-textarea')
.getElement().getId());
// save the aceEditor into the editor object for the resize event
editor.aceEditor = aceEditor;
// set default settings
aceEditor.setTheme('ace/theme/' + editor.settings.theme);
aceEditor.setHighlightActiveLine(true);
aceEditor.setShowInvisibles(true);
aceSession = aceEditor.getSession();
aceSession.setMode('ace/mode/' + editor.settings.modes[0][1]);
aceSession.setTabSize(editor.settings.tab_size);
aceSession.setUseSoftTabs(true);
// load ace extensions
whitespace = ace.require('ace/ext/whitespace');
},
onShow: function() {
// get the selection
var selection = editor.getSelection();
// get the entire element
var element = selection.getStartElement();
// looking for the pre parent tag
if (element) {
element = element.getAscendant('pre', true);
}
// if there is no pre tag, it is an addition. Therefore, it is an edition
if (!element || element.getName() !== 'pre') {
element = new CKEDITOR.dom.element('pre');
if (shighlighter.getTag() !== 'pre') {
element.append(new CKEDITOR.dom.element('code'));
}
this.insertMode = true;
}
else {
if (shighlighter.getTag() !== 'pre') {
element = element.getChild(0);
}
this.insertMode = false;
}
// get the element to fill the inputs
this.element = element;
// focus on the editor
aceEditor.focus();
// we empty the editor
aceEditor.setValue('');
// we fill the inputs
if (!this.insertMode) {
this.setupContent(this.element);
}
},
// This method is invoked once a user clicks the OK button, confirming the dialog.
onOk: function() {
var pre, element;
pre = element = this.element;
if (this.insertMode) {
if (shighlighter.getTag() !== 'pre') {
element = this.element.getChild(0);
}
}
else {
pre = element.getAscendant('pre', true);
}
this.commitContent(element);
// set the full class to the code tag
shighlighter.setCls(pre.getAttribute('data-pbcklang') + ' ' + editor.settings.cls);
element.setAttribute('class', shighlighter.getCls());
// we add a new code tag into ckeditor editor
if (this.insertMode) {
editor.insertElement(pre);
}
}
};
});
/*
* Resize the ACE Editor
*/
CKEDITOR.dialog.on('resize', function(evt) {
var AceEditor = evt.editor.aceEditor;
if (AceEditor !== undefined) {
AceEditor.resize();
}
});
@@ -0,0 +1,38 @@
/*label styling */
.cke_pbckcode_form .cke_dialog_ui_labeled_content {
display: inline-block;
vertical-align: middle;
margin-left: 6px;
}
/*select styling */
.cke_pbckcode_form .cke_dialog_ui_input_select select {
background-color: white;
border: 1px solid #ccc;
border-radius: 4px;
color: #555;
display: inline-block;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
font-size: 12px;
height: auto;
margin-bottom: 0;
padding: 0;
vertical-align: middle;
width: 110px;
}
/* ace reset needed due to ckeditor style */
.cke_pbckcode_ace.ace_editor * {
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Droid Sans Mono', 'Consolas', monospace;
font-size: 12px;
}
.cke_pbckcode_ace .ace_invisible {
opacity: 0;
visibility: hidden;
}
/*good font color on dark theme*/
.cke_pbckcode_ace.ace_dark * {
color: inherit;
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

@@ -0,0 +1,13 @@
CKEDITOR.plugins.setLang("pbckcode", "en",
{
title: 'PBCKCODE',
addCode: 'Add code',
editCode: 'Edit code',
editor: 'Editor',
settings: 'Settings',
mode: 'Mode',
tabSize: 'Tab size',
theme: 'Theme',
softTab: 'Enable soft tabs',
emmet: 'Enable Emmet'
});
@@ -0,0 +1,13 @@
CKEDITOR.plugins.setLang("pbckcode", "fr",
{
title: 'PBCKCODE',
addCode: 'Ajouter du code',
editCode: 'Modifier ce code',
editor: 'Editeur',
settings: 'Réglages',
mode: 'Langage',
tabSize: 'Indentation',
theme: 'Theme',
softTab: 'Enable soft tabs',
emmet: 'Activer Emmet'
});
@@ -0,0 +1,13 @@
CKEDITOR.plugins.setLang("pbckcode", "ru",
{
title: 'PBCKCODE',
addCode: 'Добавить код',
editCode: 'Редактировать код',
editor: 'Редактор',
settings: 'Настройки',
mode: 'Режим',
tabSize: 'Ширина табуляции',
theme: 'Тема',
softTab: 'Включить мягкую табуляцию',
emmet: 'Включить Emmet'
});
@@ -0,0 +1,13 @@
CKEDITOR.plugins.setLang("pbckcode", "tr",
{
title: 'PBCKCODE',
addCode: 'Kod ekle',
editCode: 'Kodu düzenle',
editor: 'Editör',
settings: 'Ayarlar',
mode: 'Mod',
tabSize: 'Sekme boyutu',
theme: 'Tema',
softTab: 'Yumuşak sekmeleri aktif et',
emmet: 'Emmet\'i aktif et'
});
@@ -0,0 +1,109 @@
// needed js files
var js = {
ace: 'ace.js',
aceExtWhitespace: 'ext-whitespace.js',
pbSyntaxHighlighter: CKEDITOR.plugins.getPath('pbckcode') + 'dialogs/PBSyntaxHighlighter.js'
};
var commandName = 'pbckcode';
/**
* Plugin definition
*/
CKEDITOR.plugins.add('pbckcode', {
icons: 'pbckcode',
hidpi: true,
lang: ['fr', 'en', 'ru'],
init: function(editor) {
// if there is no user settings
// create an empty object
if (editor.config.pbckcode === undefined) {
editor.config.pbckcode = {};
}
// default settings object
var DEFAULT_SETTINGS = {
cls: '',
modes: [
['HTML', 'html'],
['CSS', 'css'],
['PHP', 'php'],
['JS', 'javascript']
],
theme: 'textmate',
tab_size: 4,
js: '//cdnjs.cloudflare.com/ajax/libs/ace/1.2.6/'
};
// merge user settings with default settings
editor.settings = CKEDITOR.tools.extend(DEFAULT_SETTINGS, editor.config.pbckcode, true);
editor.settings.js = normalizeJsUrl(editor.settings.js);
// load CSS for the dialog
editor.on('instanceReady', function() {
CKEDITOR.document.appendStyleSheet(this.path + 'dialogs/style.css');
}.bind(this));
// add the button in the toolbar
editor.ui.addButton('pbckcode', {
label: editor.lang.pbckcode.addCode,
command: commandName,
toolbar: 'pbckcode'
});
// link the button to the command
editor.addCommand(commandName, new CKEDITOR.dialogCommand('pbckcodeDialog', {
allowedContent: 'pre[*]{*}(*)'
})
);
// disable the button while the required js files are not loaded
editor.getCommand(commandName).disable();
// add the plugin dialog element to the plugin
CKEDITOR.dialog.add('pbckcodeDialog', this.path + 'dialogs/pbckcode.js');
// add the context menu
if (editor.contextMenu) {
editor.addMenuGroup('pbckcodeGroup');
editor.addMenuItem('pbckcodeItem', {
label: editor.lang.pbckcode.editCode,
icon: this.path + 'icons/pbckcode.png',
command: commandName,
group: 'pbckcodeGroup'
});
editor.contextMenu.addListener(function(element) {
if (element.getAscendant('pre', true)) {
return {pbckcodeItem: CKEDITOR.TRISTATE_OFF};
}
});
}
var scripts = [
getScriptUrl(editor.settings.js, js.ace),
js.pbSyntaxHighlighter
];
// Load the required js files
// enable the button when loaded
CKEDITOR.scriptLoader.load(scripts, function() {
editor.getCommand(commandName).enable();
// need ace to be loaded
CKEDITOR.scriptLoader.load([
getScriptUrl(editor.settings.js, js.aceExtWhitespace)
]);
});
}
});
function normalizeJsUrl(js) {
return js.concat('/')
.replace(new RegExp('([^:]\/)\/+', 'g'), '$1');
}
function getScriptUrl(prefix, scriptName) {
return prefix + scriptName;
}