Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,49 @@ | ||
/** | ||
|
||
/** | ||
* @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 ) { | ||
/** | ||
* @fileOverview Definition for placeholder plugin dialog. | ||
* | ||
*/ | ||
|
||
'use strict'; | ||
|
||
CKEDITOR.dialog.add( 'placeholder', function( editor ) { | ||
var lang = editor.lang.placeholder, | ||
generalLabel = editor.lang.common.generalTab, | ||
validNameRegex = /^[^\[\]\<\>]+$/; | ||
|
||
var lang = editor.lang.placeholder, | ||
generalLabel = editor.lang.common.generalTab; | ||
return { | ||
title: lang.title, | ||
minWidth: 300, | ||
minHeight: 80, | ||
contents: [ | ||
{ | ||
return { | ||
title: lang.title, | ||
minWidth: 300, | ||
minHeight: 80, | ||
contents: [ | ||
{ | ||
id: 'info', | ||
label: generalLabel, | ||
title: generalLabel, | ||
elements: [ | ||
// Dialog window UI 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 ); | ||
id: 'name', | ||
type: 'text', | ||
style: 'width: 100%;', | ||
label: lang.name, | ||
'default': '', | ||
required: true, | ||
validate: CKEDITOR.dialog.validate.regex( validNameRegex, lang.invalidName ), | ||
setup: function( widget ) { | ||
this.setValue( widget.data.name ); | ||
}, | ||
commit: function( widget ) { | ||
widget.setData( 'name', this.getValue() ); | ||
} | ||
} | ||
} | ||
] | ||
} | ||
], | ||
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 ); | ||
}); | ||
})(); | ||
] | ||
}; | ||
} ); |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
/** | ||
/** | ||
* @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.' | ||
toolbar: 'Placeholder', | ||
name: 'Placeholder Name', | ||
invalidName: 'The placeholder can not be empty and can not contain any of following characters: [, ], <, >' | ||
}); |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.