Skip to content

Commit 38a9ec7

Browse files
author
Marcelo Tosco @capynet
committed
Added source code.
0 parents  commit 38a9ec7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+7617
-0
lines changed

dialogs/codesnippet.js

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
/**
2+
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
3+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4+
*/
5+
6+
'use strict';
7+
8+
( function() {
9+
CKEDITOR.dialog.add( 'codeSnippet', function( editor ) {
10+
var snippetLangs = editor._.codesnippet.langs,
11+
lang = editor.lang.codesnippet,
12+
clientHeight = document.documentElement.clientHeight,
13+
langSelectItems = [],
14+
snippetLangId;
15+
16+
langSelectItems.push( [ editor.lang.common.notSet, '' ] );
17+
18+
for ( snippetLangId in snippetLangs )
19+
langSelectItems.push( [ snippetLangs[ snippetLangId ], snippetLangId ] );
20+
21+
// Size adjustments.
22+
var size = CKEDITOR.document.getWindow().getViewPaneSize(),
23+
// Make it maximum 800px wide, but still fully visible in the viewport.
24+
width = Math.min( size.width - 70, 800 ),
25+
// Make it use 2/3 of the viewport height.
26+
height = size.height / 1.5;
27+
28+
// Low resolution settings.
29+
if ( clientHeight < 650 ) {
30+
height = clientHeight - 220;
31+
}
32+
33+
return {
34+
title: lang.title,
35+
minHeight: 200,
36+
resizable: CKEDITOR.DIALOG_RESIZE_NONE,
37+
contents: [
38+
{
39+
id: 'info',
40+
elements: [
41+
{
42+
id: 'lang',
43+
type: 'select',
44+
label: lang.language,
45+
items: langSelectItems,
46+
setup: function( widget ) {
47+
if ( widget.ready && widget.data.lang )
48+
this.setValue( widget.data.lang );
49+
50+
// The only way to have an empty select value in Firefox is
51+
// to set a negative selectedIndex.
52+
if ( CKEDITOR.env.gecko && ( !widget.data.lang || !widget.ready ) )
53+
this.getInputElement().$.selectedIndex = -1;
54+
},
55+
commit: function( widget ) {
56+
widget.setData( 'lang', this.getValue() );
57+
}
58+
},
59+
{
60+
id: 'code',
61+
type: 'textarea',
62+
label: lang.codeContents,
63+
setup: function( widget ) {
64+
this.setValue( widget.data.code );
65+
},
66+
commit: function( widget ) {
67+
widget.setData( 'code', this.getValue() );
68+
},
69+
required: true,
70+
validate: CKEDITOR.dialog.validate.notEmpty( lang.emptySnippetError ),
71+
inputStyle: 'cursor:auto;' +
72+
'width:' + width + 'px;' +
73+
'height:' + height + 'px;' +
74+
'tab-size:4;' +
75+
'text-align:left;',
76+
'class': 'cke_source'
77+
}
78+
]
79+
}
80+
]
81+
};
82+
} );
83+
}() );

icons/codesnippet.png

532 Bytes
Loading

icons/hidpi/codesnippet.png

1.02 KB
Loading

lang/ar.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/**
2+
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
3+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4+
*/
5+
6+
CKEDITOR.plugins.setLang( 'codesnippet', 'ar', {
7+
button: 'أدمج قصاصة الشيفرة',
8+
codeContents: 'محتوى الشيفرة',
9+
emptySnippetError: 'قصاصة الشيفرة لايمكن أن تكون فارغة.',
10+
language: 'لغة',
11+
title: 'قصاصة الشيفرة',
12+
pathName: 'قصاصة الشيفرة'
13+
} );

lang/az.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/**
2+
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
3+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4+
*/
5+
6+
CKEDITOR.plugins.setLang( 'codesnippet', 'az', {
7+
button: 'Kodun parçasını əlavə et',
8+
codeContents: 'Kod',
9+
emptySnippetError: 'Kodun parçasını boş ola bilməz',
10+
language: 'Programlaşdırma dili',
11+
title: 'Kodun parçasını',
12+
pathName: 'kodun parçasını'
13+
} );

lang/bg.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/**
2+
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
3+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4+
*/
5+
6+
CKEDITOR.plugins.setLang( 'codesnippet', 'bg', {
7+
button: 'Въвеждане на блок с код',
8+
codeContents: 'Съдържание на кода',
9+
emptySnippetError: 'Блока с код не може да бъде празен.',
10+
language: 'Език',
11+
title: 'Блок с код',
12+
pathName: 'блок с код'
13+
} );

lang/ca.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/**
2+
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
3+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4+
*/
5+
6+
CKEDITOR.plugins.setLang( 'codesnippet', 'ca', {
7+
button: 'Insereix el fragment de codi',
8+
codeContents: 'Contingut del codi',
9+
emptySnippetError: 'El fragment de codi no pot estar buit.',
10+
language: 'Idioma',
11+
title: 'Fragment de codi',
12+
pathName: 'fragment de codi'
13+
} );

lang/cs.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/**
2+
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
3+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4+
*/
5+
6+
CKEDITOR.plugins.setLang( 'codesnippet', 'cs', {
7+
button: 'Vložit úryvek kódu',
8+
codeContents: 'Obsah kódu',
9+
emptySnippetError: 'Úryvek kódu nemůže být prázdný.',
10+
language: 'Jazyk',
11+
title: 'Úryvek kódu',
12+
pathName: 'úryvek kódu'
13+
} );

lang/da.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/**
2+
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
3+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4+
*/
5+
6+
CKEDITOR.plugins.setLang( 'codesnippet', 'da', {
7+
button: 'Indsæt kodestykket her',
8+
codeContents: 'Koden',
9+
emptySnippetError: 'Kodestykket kan ikke være tomt.',
10+
language: 'Sprog',
11+
title: 'Kodestykke',
12+
pathName: 'kodestykke'
13+
} );

lang/de-ch.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/**
2+
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
3+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4+
*/
5+
6+
CKEDITOR.plugins.setLang( 'codesnippet', 'de-ch', {
7+
button: 'Codeschnipsel einfügen',
8+
codeContents: 'Codeinhalt',
9+
emptySnippetError: 'Ein Codeschnipsel darf nicht leer sein.',
10+
language: 'Sprache',
11+
title: 'Codeschnipsel',
12+
pathName: 'Codeschnipsel'
13+
} );

0 commit comments

Comments
 (0)