Skip to content

Commit

Permalink
Merge pull request codex-team#199 from codex-team/placeholder
Browse files Browse the repository at this point in the history
Add custom placeholder
  • Loading branch information
talyguryn authored Aug 30, 2017
2 parents 91011e6 + 49827b7 commit 73ebe41
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 12 deletions.
2 changes: 1 addition & 1 deletion codex-editor.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion codex-editor.js.map

Large diffs are not rendered by default.

10 changes: 2 additions & 8 deletions example.html
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,10 @@
},
data : {
id: +new Date(),
placeholder: 'Прошлой ночью мне приснилось...',
items: [
{
type : 'paragraph',
type : 'header',
data : {
text : 'Привет от CodeX'
}
Expand All @@ -235,13 +236,6 @@
text : 'Пишите нам на team@ifmo.su'
}
},
{
type : 'list',
data : {
type : 'OL',
items : [1,3,4]
}
}
],
count: 3
}
Expand Down
4 changes: 3 additions & 1 deletion modules/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,9 @@ module.exports = (function (ui) {

initialBlock = editor.tools[initialBlockType].render();

initialBlock.setAttribute('data-placeholder', 'Расскажите свою историю...');
let initialBlockPlaceholder = editor.state.blocks.placeholder || '';

initialBlock.setAttribute('data-placeholder', initialBlockPlaceholder);

editor.content.insertBlock({
type : initialBlockType,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "codex.editor",
"version": "1.7.3",
"version": "1.7.4",
"description": "Codex Editor. Native JS, based on API and Open Source",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 73ebe41

Please sign in to comment.