Przeglądaj źródła

Placeholders, css

Yedidya Kennard 8 lat temu
rodzic
commit
14b5dd06db

+ 8
- 4
src/RichTextEditor.js Wyświetl plik

14
   static propTypes = {
14
   static propTypes = {
15
     initialTitleHTML: PropTypes.string,
15
     initialTitleHTML: PropTypes.string,
16
     initialContentHTML: PropTypes.string,
16
     initialContentHTML: PropTypes.string,
17
+    titlePlaceholder: PropTypes.string,
18
+    contentPlaceholder: PropTypes.string,
17
     editorInitializedCallback: PropTypes.func,
19
     editorInitializedCallback: PropTypes.func,
18
     customCSS: PropTypes.string
20
     customCSS: PropTypes.string
19
   };
21
   };
62
           if (this.props.customCSS) {
64
           if (this.props.customCSS) {
63
             this.setCustomCSS(this.props.customCSS);
65
             this.setCustomCSS(this.props.customCSS);
64
           }
66
           }
67
+          this.setTitlePlaceholder(this.props.titlePlaceholder);
68
+          this.setContentPlaceholder(this.props.contentPlaceholder);
65
           this.setTitleHTML(this.props.initialTitleHTML);
69
           this.setTitleHTML(this.props.initialTitleHTML);
66
           this.setContentHTML(this.props.initialContentHTML);
70
           this.setContentHTML(this.props.initialContentHTML);
67
           this.props.editorInitializedCallback && this.props.editorInitializedCallback();
71
           this.props.editorInitializedCallback && this.props.editorInitializedCallback();
344
     this._sendAction(actions.setTextColor, color);
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
   setCustomCSS(css) {
359
   setCustomCSS(css) {

+ 2
- 2
src/WebviewMessageHandler.js Wyświetl plik

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

+ 1
- 1
src/ZSSRichTextEditor/ZSSRichTextEditor.js Wyświetl plik

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

+ 3
- 2
src/ZSSRichTextEditor/style.css Wyświetl plik

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