Итак, что я пытаюсь добиться, так это то, что когда любой пользователь пытается получить доступ к области текста Ckeditor, будет какой-то текст, который нельзя использовать для изменения, но он может редактировать некоторый текст, и он может добавить больше текста, если онхочет в пустом пространстве я также использую слияния почты в моем коде, так что вы можете пропустить фантастику ckeditor.on ('dialogDefinition')
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="robots" content="noindex, nofollow">
<title>Using placeholders</title>
<script src="https://cdn.ckeditor.com/4.11.4/standard-all/ckeditor.js"></script>
</head>
<body>
<textarea cols="10" id="editor1" name="editor1" rows="10" data-sample-short><p>This is some <strong>sample text</strong>. You are using <a href="https://ckeditor.com/">CKEditor</a>.</p>
<p contenteditable="false">
This text can be edited by the user.
</p>
<p class="a">
This text can be edited by the user. aa
</p>
<p contenteditable="false">
This text can be edited by the user.
</p>
</textarea>
<script>
CKEDITOR.replace('editor1', {
extraPlugins: 'placeholder',
height: 220,
readOnly:true
});
CKEDITOR.on('dialogDefinition', function(event) {
if ('placeholder' == event.data.name) {
var input = event.data.definition.getContents('info').get('name');
input.type = 'select';
input.items = [ ['Company'], ['Email'], ['First Name'], ['Last Name'] ];
input.setup = function() {
this.setValue('Company');
};
}
});
</script>
</body>
</html>