Browse Source

Placeholders, css

Yedidya Kennard 8 years ago
parent
commit
14b5dd06db

+ 8
- 4
src/RichTextEditor.js View File

@@ -14,6 +14,8 @@ export default class RichTextEditor extends Component {
14 14
   static propTypes = {
15 15
     initialTitleHTML: PropTypes.string,
16 16
     initialContentHTML: PropTypes.string,
17
+    titlePlaceholder: PropTypes.string,
18
+    contentPlaceholder: PropTypes.string,
17 19
     editorInitializedCallback: PropTypes.func,
18 20
     customCSS: PropTypes.string
19 21
   };
@@ -62,6 +64,8 @@ export default class RichTextEditor extends Component {
62 64
           if (this.props.customCSS) {
63 65
             this.setCustomCSS(this.props.customCSS);
64 66
           }
67
+          this.setTitlePlaceholder(this.props.titlePlaceholder);
68
+          this.setContentPlaceholder(this.props.contentPlaceholder);
65 69
           this.setTitleHTML(this.props.initialTitleHTML);
66 70
           this.setContentHTML(this.props.initialContentHTML);
67 71
           this.props.editorInitializedCallback && this.props.editorInitializedCallback();
@@ -344,12 +348,12 @@ export default class RichTextEditor extends Component {
344 348
     this._sendAction(actions.setTextColor, color);
345 349
   }
346 350
 
347
-  setTitlePlaceholder() {
348
-    this._sendAction(actions.setTitlePlaceholder);
351
+  setTitlePlaceholder(placeholder) {
352
+    this._sendAction(actions.setTitlePlaceholder, placeholder);
349 353
   }
350 354
 
351
-  setContentPlaceholder() {
352
-    this._sendAction(actions.setContentPlaceholder);
355
+  setContentPlaceholder(placeholder) {
356
+    this._sendAction(actions.setContentPlaceholder, placeholder);
353 357
   }
354 358
 
355 359
   setCustomCSS(css) {

+ 2
- 2
src/WebviewMessageHandler.js View File

@@ -95,10 +95,10 @@ export const InjectedMessageHandler = `
95 95
           zss_editor.setOutdent();
96 96
           break;
97 97
         case '${actions.setTitlePlaceholder}':
98
-          zss_editor.setTitlePlaceholder();
98
+          zss_editor.setTitlePlaceholder(action.data);
99 99
           break;
100 100
         case '${actions.setContentPlaceholder}':
101
-          zss_editor.setContentPlaceholder();
101
+          zss_editor.setContentPlaceholder(action.data);
102 102
           break;
103 103
         case '${actions.getTitleHtml}':
104 104
           var html = zss_editor.getTitleHTML();

+ 1
- 1
src/ZSSRichTextEditor/ZSSRichTextEditor.js View File

@@ -384,7 +384,7 @@ zss_editor.setTextColor = function(color) {
384 384
 }
385 385
 
386 386
 zss_editor.setBackgroundColor = function(color) {
387
-    
387
+
388 388
     if(zss_editor.currentSelection) {
389 389
         zss_editor.restorerange();
390 390
     }

+ 3
- 2
src/ZSSRichTextEditor/style.css View File

@@ -55,11 +55,12 @@ div.zss_editor_title {
55 55
 
56 56
 [placeholder]:empty:before {
57 57
     content: attr(placeholder);
58
-    color: #555;
58
+    color: #c0c0c0;
59 59
 }
60 60
 
61 61
 [placeholder]:empty:focus:before {
62
-    content: "";
62
+    content: attr(placeholder);
63
+    color: #e0e0e0;
63 64
 }
64 65
 
65 66
 hr {