mirror of
https://github.com/UnickSoft/graphonline.git
synced 2026-06-15 21:30:56 +00:00
first commit
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
/**
|
||||
* @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
|
||||
* For licensing, see LICENSE.md or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
(function() {
|
||||
function placeholderDialog( editor, isEdit ) {
|
||||
|
||||
var lang = editor.lang.placeholder,
|
||||
generalLabel = editor.lang.common.generalTab;
|
||||
return {
|
||||
title: lang.title,
|
||||
minWidth: 300,
|
||||
minHeight: 80,
|
||||
contents: [
|
||||
{
|
||||
id: 'info',
|
||||
label: generalLabel,
|
||||
title: generalLabel,
|
||||
elements: [
|
||||
{
|
||||
id: 'text',
|
||||
type: 'text',
|
||||
style: 'width: 100%;',
|
||||
label: lang.text,
|
||||
'default': '',
|
||||
required: true,
|
||||
validate: CKEDITOR.dialog.validate.notEmpty( lang.textMissing ),
|
||||
setup: function( element ) {
|
||||
if ( isEdit )
|
||||
this.setValue( element.getText().slice( 2, -2 ) );
|
||||
},
|
||||
commit: function( element ) {
|
||||
var text = '[[' + this.getValue() + ']]';
|
||||
// The placeholder must be recreated.
|
||||
CKEDITOR.plugins.placeholder.createPlaceholder( editor, element, text );
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
onShow: function() {
|
||||
if ( isEdit )
|
||||
this._element = CKEDITOR.plugins.placeholder.getSelectedPlaceHolder( editor );
|
||||
|
||||
this.setupContent( this._element );
|
||||
},
|
||||
onOk: function() {
|
||||
this.commitContent( this._element );
|
||||
delete this._element;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
CKEDITOR.dialog.add( 'createplaceholder', function( editor ) {
|
||||
return placeholderDialog( editor );
|
||||
});
|
||||
CKEDITOR.dialog.add( 'editplaceholder', function( editor ) {
|
||||
return placeholderDialog( editor, 1 );
|
||||
});
|
||||
})();
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
BIN
Binary file not shown.
|
After Width: | Height: | Size: 714 B |
@@ -0,0 +1,26 @@
|
||||
Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.md or http://ckeditor.com/license
|
||||
|
||||
bg.js Found: 5 Missing: 0
|
||||
cs.js Found: 5 Missing: 0
|
||||
cy.js Found: 5 Missing: 0
|
||||
da.js Found: 5 Missing: 0
|
||||
de.js Found: 5 Missing: 0
|
||||
el.js Found: 5 Missing: 0
|
||||
eo.js Found: 5 Missing: 0
|
||||
et.js Found: 5 Missing: 0
|
||||
fa.js Found: 5 Missing: 0
|
||||
fi.js Found: 5 Missing: 0
|
||||
fr.js Found: 5 Missing: 0
|
||||
he.js Found: 5 Missing: 0
|
||||
hr.js Found: 5 Missing: 0
|
||||
it.js Found: 5 Missing: 0
|
||||
nb.js Found: 5 Missing: 0
|
||||
nl.js Found: 5 Missing: 0
|
||||
no.js Found: 5 Missing: 0
|
||||
pl.js Found: 5 Missing: 0
|
||||
tr.js Found: 5 Missing: 0
|
||||
ug.js Found: 5 Missing: 0
|
||||
uk.js Found: 5 Missing: 0
|
||||
vi.js Found: 3 Missing: 2
|
||||
zh-cn.js Found: 5 Missing: 0
|
||||
Executable
+12
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
|
||||
* For licensing, see LICENSE.md or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
CKEDITOR.plugins.setLang( 'placeholder', 'bg', {
|
||||
title: 'Настройки на контейнера',
|
||||
toolbar: 'Нов контейнер',
|
||||
text: 'Текст за контейнера',
|
||||
edit: 'Промяна на контейнер',
|
||||
textMissing: 'Контейнера трябва да съдържа текст.'
|
||||
});
|
||||
Executable
+12
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
|
||||
* For licensing, see LICENSE.md or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
CKEDITOR.plugins.setLang( 'placeholder', 'cs', {
|
||||
title: 'Vlastnosti vyhrazeného prostoru',
|
||||
toolbar: 'Vytvořit vyhrazený prostor',
|
||||
text: 'Vyhrazený text',
|
||||
edit: 'Upravit vyhrazený prostor',
|
||||
textMissing: 'Vyhrazený prostor musí obsahovat text.'
|
||||
});
|
||||
Executable
+12
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
|
||||
* For licensing, see LICENSE.md or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
CKEDITOR.plugins.setLang( 'placeholder', 'cy', {
|
||||
title: 'Priodweddau\'r Daliwr Geiriau',
|
||||
toolbar: 'Creu Daliwr Geiriau',
|
||||
text: 'Testun y Daliwr Geiriau',
|
||||
edit: 'Golygu\'r Dailwr Geiriau',
|
||||
textMissing: 'Mae\'n rhaid i\'r daliwr geiriau gynnwys testun.'
|
||||
});
|
||||
Executable
+12
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
|
||||
* For licensing, see LICENSE.md or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
CKEDITOR.plugins.setLang( 'placeholder', 'da', {
|
||||
title: 'Egenskaber for pladsholder',
|
||||
toolbar: 'Opret pladsholder',
|
||||
text: 'Tekst til pladsholder',
|
||||
edit: 'Rediger pladsholder',
|
||||
textMissing: 'Pladsholder skal indeholde tekst'
|
||||
});
|
||||
Executable
+12
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
|
||||
* For licensing, see LICENSE.md or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
CKEDITOR.plugins.setLang( 'placeholder', 'de', {
|
||||
title: 'Platzhalter Einstellungen',
|
||||
toolbar: 'Platzhalter erstellen',
|
||||
text: 'Platzhalter Text',
|
||||
edit: 'Platzhalter bearbeiten',
|
||||
textMissing: 'Der Platzhalter muss einen Text beinhalten.'
|
||||
});
|
||||
Executable
+12
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
|
||||
* For licensing, see LICENSE.md or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
CKEDITOR.plugins.setLang( 'placeholder', 'el', {
|
||||
title: 'Ιδιότητες Υποκατάστατου Κειμένου',
|
||||
toolbar: 'Δημιουργία Υποκατάσταστου Κειμένου',
|
||||
text: 'Υποκαθιστόμενο Κείμενο',
|
||||
edit: 'Επεξεργασία Υποκατάσταστου Κειμένου',
|
||||
textMissing: 'Πρέπει να υπάρχει υποκαθιστόμενο κείμενο.'
|
||||
});
|
||||
Executable
+12
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
|
||||
* For licensing, see LICENSE.md or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
CKEDITOR.plugins.setLang( 'placeholder', 'en', {
|
||||
title: 'Placeholder Properties',
|
||||
toolbar: 'Create Placeholder',
|
||||
text: 'Placeholder Text',
|
||||
edit: 'Edit Placeholder',
|
||||
textMissing: 'The placeholder must contain text.'
|
||||
});
|
||||
Executable
+12
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
|
||||
* For licensing, see LICENSE.md or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
CKEDITOR.plugins.setLang( 'placeholder', 'eo', {
|
||||
title: 'Atributoj de la rezervita spaco',
|
||||
toolbar: 'Krei la rezervitan spacon',
|
||||
text: 'Texto de la rezervita spaco',
|
||||
edit: 'Modifi la rezervitan spacon',
|
||||
textMissing: 'La rezervita spaco devas enteni tekston.'
|
||||
});
|
||||
Executable
+12
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
|
||||
* For licensing, see LICENSE.md or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
CKEDITOR.plugins.setLang( 'placeholder', 'et', {
|
||||
title: 'Kohahoidja omadused',
|
||||
toolbar: 'Kohahoidja loomine',
|
||||
text: 'Kohahoidja tekst',
|
||||
edit: 'Kohahoidja muutmine',
|
||||
textMissing: 'Kohahoidja peab sisaldama teksti.'
|
||||
});
|
||||
Executable
+12
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
|
||||
* For licensing, see LICENSE.md or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
CKEDITOR.plugins.setLang( 'placeholder', 'fa', {
|
||||
title: 'ویژگیهای محل نگهداری',
|
||||
toolbar: 'ایجاد یک محل نگهداری',
|
||||
text: 'متن محل نگهداری',
|
||||
edit: 'ویرایش محل نگهداری',
|
||||
textMissing: 'محل نگهداری باید محتوی متن باشد.'
|
||||
});
|
||||
Executable
+12
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
|
||||
* For licensing, see LICENSE.md or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
CKEDITOR.plugins.setLang( 'placeholder', 'fi', {
|
||||
title: 'Paikkamerkin ominaisuudet',
|
||||
toolbar: 'Luo paikkamerkki',
|
||||
text: 'Paikkamerkin teksti',
|
||||
edit: 'Muokkaa paikkamerkkiä',
|
||||
textMissing: 'Paikkamerkin täytyy sisältää tekstiä'
|
||||
});
|
||||
Executable
+12
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
|
||||
* For licensing, see LICENSE.md or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
CKEDITOR.plugins.setLang( 'placeholder', 'fr', {
|
||||
title: 'Propriétés de l\'Espace réservé',
|
||||
toolbar: 'Créer l\'Espace réservé',
|
||||
text: 'Texte de l\'Espace réservé',
|
||||
edit: 'Modifier l\'Espace réservé',
|
||||
textMissing: 'L\'Espace réservé doit contenir du texte.'
|
||||
});
|
||||
Executable
+12
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
|
||||
* For licensing, see LICENSE.md or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
CKEDITOR.plugins.setLang( 'placeholder', 'he', {
|
||||
title: 'מאפייני שומר מקום',
|
||||
toolbar: 'צור שומר מקום',
|
||||
text: 'תוכן שומר המקום',
|
||||
edit: 'ערוך שומר מקום',
|
||||
textMissing: 'שומר המקום חייב להכיל טקסט.'
|
||||
});
|
||||
Executable
+12
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
|
||||
* For licensing, see LICENSE.md or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
CKEDITOR.plugins.setLang( 'placeholder', 'hr', {
|
||||
title: 'Svojstva rezerviranog mjesta',
|
||||
toolbar: 'Napravi rezervirano mjesto',
|
||||
text: 'Tekst rezerviranog mjesta',
|
||||
edit: 'Uredi rezervirano mjesto',
|
||||
textMissing: 'Rezervirano mjesto mora sadržavati tekst.'
|
||||
});
|
||||
Executable
+12
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
|
||||
* For licensing, see LICENSE.md or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
CKEDITOR.plugins.setLang( 'placeholder', 'it', {
|
||||
title: 'Proprietà segnaposto',
|
||||
toolbar: 'Crea segnaposto',
|
||||
text: 'Testo segnaposto',
|
||||
edit: 'Modifica segnaposto',
|
||||
textMissing: 'Il segnaposto deve contenere del testo.'
|
||||
});
|
||||
Executable
+12
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
|
||||
* For licensing, see LICENSE.md or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
CKEDITOR.plugins.setLang( 'placeholder', 'nb', {
|
||||
title: 'Egenskaper for plassholder',
|
||||
toolbar: 'Opprett plassholder',
|
||||
text: 'Tekst for plassholder',
|
||||
edit: 'Rediger plassholder',
|
||||
textMissing: 'Plassholderen må inneholde tekst.'
|
||||
});
|
||||
Executable
+12
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
|
||||
* For licensing, see LICENSE.md or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
CKEDITOR.plugins.setLang( 'placeholder', 'nl', {
|
||||
title: 'Eigenschappen placeholder',
|
||||
toolbar: 'Placeholder aanmaken',
|
||||
text: 'Placeholder tekst',
|
||||
edit: 'Placeholder wijzigen',
|
||||
textMissing: 'De placeholder moet tekst bevatten.'
|
||||
});
|
||||
Executable
+12
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
|
||||
* For licensing, see LICENSE.md or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
CKEDITOR.plugins.setLang( 'placeholder', 'no', {
|
||||
title: 'Egenskaper for plassholder',
|
||||
toolbar: 'Opprett plassholder',
|
||||
text: 'Tekst for plassholder',
|
||||
edit: 'Rediger plassholder',
|
||||
textMissing: 'Plassholderen må inneholde tekst.'
|
||||
});
|
||||
Executable
+12
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
|
||||
* For licensing, see LICENSE.md or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
CKEDITOR.plugins.setLang( 'placeholder', 'pl', {
|
||||
title: 'Właściwości wypełniacza',
|
||||
toolbar: 'Utwórz wypełniacz',
|
||||
text: 'Tekst wypełnienia',
|
||||
edit: 'Edytuj wypełnienie',
|
||||
textMissing: 'Wypełnienie musi posiadać jakiś tekst.'
|
||||
});
|
||||
Executable
+12
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
|
||||
* For licensing, see LICENSE.md or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
CKEDITOR.plugins.setLang( 'placeholder', 'tr', {
|
||||
title: 'Yer tutucu özellikleri',
|
||||
toolbar: 'Yer tutucu oluşturun',
|
||||
text: 'Yer tutucu metini',
|
||||
edit: 'Yer tutucuyu düzenle',
|
||||
textMissing: 'Yer tutucu metin içermelidir.'
|
||||
});
|
||||
Executable
+12
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
|
||||
* For licensing, see LICENSE.md or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
CKEDITOR.plugins.setLang( 'placeholder', 'ug', {
|
||||
title: 'ئورۇن بەلگە خاسلىقى',
|
||||
toolbar: 'ئورۇن بەلگە قۇر',
|
||||
text: 'ئورۇن بەلگە تېكىستى',
|
||||
edit: 'ئورۇن بەلگە تەھرىر',
|
||||
textMissing: 'ئورۇن بەلگىسىدە چوقۇم تېكىست بولۇشى لازىم'
|
||||
});
|
||||
Executable
+12
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
|
||||
* For licensing, see LICENSE.md or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
CKEDITOR.plugins.setLang( 'placeholder', 'uk', {
|
||||
title: 'Налаштування Заповнювача',
|
||||
toolbar: 'Створити Заповнювач',
|
||||
text: 'Текст Заповнювача',
|
||||
edit: 'Редагувати Заповнювач',
|
||||
textMissing: 'Заповнювач повинен містити текст.'
|
||||
});
|
||||
Executable
+12
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
|
||||
* For licensing, see LICENSE.md or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
CKEDITOR.plugins.setLang( 'placeholder', 'vi', {
|
||||
title: 'Thuộc tính đặt chỗ',
|
||||
toolbar: 'Tạo đặt chỗ',
|
||||
text: 'Văn bản đặt chỗ',
|
||||
edit: 'Edit Placeholder', // MISSING
|
||||
textMissing: 'The placeholder must contain text.' // MISSING
|
||||
});
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
|
||||
* For licensing, see LICENSE.md or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
CKEDITOR.plugins.setLang( 'placeholder', 'zh-cn', {
|
||||
title: '占位符属性',
|
||||
toolbar: '创建占位符',
|
||||
text: '占位符文字',
|
||||
edit: '编辑占位符',
|
||||
textMissing: '占位符必需包含有文字'
|
||||
});
|
||||
Executable
+143
@@ -0,0 +1,143 @@
|
||||
/**
|
||||
* @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
|
||||
* For licensing, see LICENSE.md or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview The "placeholder" plugin.
|
||||
*
|
||||
*/
|
||||
|
||||
(function() {
|
||||
var placeholderReplaceRegex = /\[\[[^\]]+\]\]/g;
|
||||
CKEDITOR.plugins.add( 'placeholder', {
|
||||
requires: 'dialog',
|
||||
lang: 'en,bg,cs,cy,da,de,el,eo,et,fa,fi,fr,he,hr,it,ku,nb,nl,no,pl,tr,ug,uk,vi,zh-cn', // %REMOVE_LINE_CORE%
|
||||
icons: 'placeholder', // %REMOVE_LINE_CORE%
|
||||
hidpi: true, // %REMOVE_LINE_CORE%
|
||||
onLoad: function() {
|
||||
CKEDITOR.addCss( '.cke_placeholder' +
|
||||
'{' +
|
||||
'background-color: #ffff00;' +
|
||||
( CKEDITOR.env.gecko ? 'cursor: default;' : '' ) +
|
||||
'}'
|
||||
);
|
||||
},
|
||||
init: function( editor ) {
|
||||
var lang = editor.lang.placeholder;
|
||||
|
||||
editor.addCommand( 'createplaceholder', new CKEDITOR.dialogCommand( 'createplaceholder' ) );
|
||||
editor.addCommand( 'editplaceholder', new CKEDITOR.dialogCommand( 'editplaceholder' ) );
|
||||
|
||||
editor.ui.addButton && editor.ui.addButton( 'CreatePlaceholder', {
|
||||
label: lang.toolbar,
|
||||
command: 'createplaceholder',
|
||||
toolbar: 'insert,5',
|
||||
icon: 'placeholder'
|
||||
});
|
||||
|
||||
if ( editor.addMenuItems ) {
|
||||
editor.addMenuGroup( 'placeholder', 20 );
|
||||
editor.addMenuItems({
|
||||
editplaceholder: {
|
||||
label: lang.edit,
|
||||
command: 'editplaceholder',
|
||||
group: 'placeholder',
|
||||
order: 1,
|
||||
icon: 'placeholder'
|
||||
}
|
||||
});
|
||||
|
||||
if ( editor.contextMenu ) {
|
||||
editor.contextMenu.addListener( function( element, selection ) {
|
||||
if ( !element || !element.data( 'cke-placeholder' ) )
|
||||
return null;
|
||||
|
||||
return { editplaceholder: CKEDITOR.TRISTATE_OFF };
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
editor.on( 'doubleclick', function( evt ) {
|
||||
if ( CKEDITOR.plugins.placeholder.getSelectedPlaceHolder( editor ) )
|
||||
evt.data.dialog = 'editplaceholder';
|
||||
});
|
||||
|
||||
editor.on( 'contentDom', function() {
|
||||
editor.editable().on( 'resizestart', function( evt ) {
|
||||
if ( editor.getSelection().getSelectedElement().data( 'cke-placeholder' ) )
|
||||
evt.data.preventDefault();
|
||||
});
|
||||
});
|
||||
|
||||
CKEDITOR.dialog.add( 'createplaceholder', this.path + 'dialogs/placeholder.js' );
|
||||
CKEDITOR.dialog.add( 'editplaceholder', this.path + 'dialogs/placeholder.js' );
|
||||
},
|
||||
afterInit: function( editor ) {
|
||||
var dataProcessor = editor.dataProcessor,
|
||||
dataFilter = dataProcessor && dataProcessor.dataFilter,
|
||||
htmlFilter = dataProcessor && dataProcessor.htmlFilter;
|
||||
|
||||
if ( dataFilter ) {
|
||||
dataFilter.addRules({
|
||||
text: function( text ) {
|
||||
return text.replace( placeholderReplaceRegex, function( match ) {
|
||||
return CKEDITOR.plugins.placeholder.createPlaceholder( editor, null, match, 1 );
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if ( htmlFilter ) {
|
||||
htmlFilter.addRules({
|
||||
elements: {
|
||||
'span': function( element ) {
|
||||
if ( element.attributes && element.attributes[ 'data-cke-placeholder' ] )
|
||||
delete element.name;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
})();
|
||||
|
||||
CKEDITOR.plugins.placeholder = {
|
||||
createPlaceholder: function( editor, oldElement, text, isGet ) {
|
||||
var element = new CKEDITOR.dom.element( 'span', editor.document );
|
||||
element.setAttributes({
|
||||
contentEditable: 'false',
|
||||
'data-cke-placeholder': 1,
|
||||
'class': 'cke_placeholder'
|
||||
});
|
||||
|
||||
text && element.setText( text );
|
||||
|
||||
if ( isGet )
|
||||
return element.getOuterHtml();
|
||||
|
||||
if ( oldElement ) {
|
||||
if ( CKEDITOR.env.ie ) {
|
||||
element.insertAfter( oldElement );
|
||||
// Some time is required for IE before the element is removed.
|
||||
setTimeout( function() {
|
||||
oldElement.remove();
|
||||
element.focus();
|
||||
}, 10 );
|
||||
} else
|
||||
element.replace( oldElement );
|
||||
} else
|
||||
editor.insertElement( element );
|
||||
|
||||
return null;
|
||||
},
|
||||
|
||||
getSelectedPlaceHolder: function( editor ) {
|
||||
var range = editor.getSelection().getRanges()[ 0 ];
|
||||
range.shrink( CKEDITOR.SHRINK_TEXT );
|
||||
var node = range.startContainer;
|
||||
while ( node && !( node.type == CKEDITOR.NODE_ELEMENT && node.data( 'cke-placeholder' ) ) )
|
||||
node = node.getParent();
|
||||
return node;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,72 @@
|
||||
<!DOCTYPE html>
|
||||
<!--
|
||||
Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.md or http://ckeditor.com/license
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<title>Placeholder Plugin — CKEditor Sample</title>
|
||||
<meta charset="utf-8">
|
||||
<script src="../../../ckeditor.js"></script>
|
||||
<link rel="stylesheet" href="../../../samples/sample.css">
|
||||
<meta name="ckeditor-sample-name" content="Placeholder plugin">
|
||||
<meta name="ckeditor-sample-group" content="Plugins">
|
||||
<meta name="ckeditor-sample-description" content="Using the Placeholder plugin to create uneditable sections that can only be created and modified with a proper dialog window.">
|
||||
</head>
|
||||
<body>
|
||||
<h1 class="samples">
|
||||
<a href="../../../samples/index.html">CKEditor Samples</a> » Using the Placeholder Plugin
|
||||
</h1>
|
||||
<div class="description">
|
||||
<p>
|
||||
This sample shows how to configure CKEditor instances to use the
|
||||
<strong>Placeholder</strong> plugin that lets you insert read-only elements
|
||||
into your content. To enter and modify read-only text, use the
|
||||
<strong>Create Placeholder</strong> button and its matching dialog window.
|
||||
</p>
|
||||
<p>
|
||||
To add a CKEditor instance that uses the <code>placeholder</code> plugin and a related
|
||||
<strong>Create Placeholder</strong> toolbar button, insert the following JavaScript
|
||||
call to your code:
|
||||
</p>
|
||||
<pre class="samples">
|
||||
CKEDITOR.replace( '<em>textarea_id</em>', {
|
||||
<strong>extraPlugins: 'placeholder',</strong>
|
||||
toolbar: [ [ 'Source', 'Bold' ], [<strong>'CreatePlaceholder'</strong>] ]
|
||||
});</pre>
|
||||
<p>
|
||||
Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> attribute of
|
||||
the <code><textarea></code> element to be replaced with CKEditor.
|
||||
</p>
|
||||
</div>
|
||||
<form action="../../../samples/sample_posteddata.php" method="post">
|
||||
<p>
|
||||
<label for="editor1">
|
||||
CKEditor using the <code>placeholder</code> plugin with its default configuration:
|
||||
</label>
|
||||
<textarea cols="80" id="editor1" name="editor1" rows="10"><p>This is a [[sample placeholder]]. You are using <a href="http://ckeditor.com/">CKEditor</a>. </p></textarea>
|
||||
<script>
|
||||
|
||||
CKEDITOR.replace( 'editor1', {
|
||||
extraPlugins: 'placeholder',
|
||||
toolbar: [ [ 'Source', 'CreatePlaceholder' ] ]
|
||||
});
|
||||
|
||||
</script>
|
||||
</p>
|
||||
<p>
|
||||
<input type="submit" value="Submit">
|
||||
</p>
|
||||
</form>
|
||||
<div id="footer">
|
||||
<hr>
|
||||
<p>
|
||||
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
|
||||
</p>
|
||||
<p id="copy">
|
||||
Copyright © 2003-2013, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
|
||||
Knabben. All rights reserved.
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user