Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

placeholder does not show #106

Closed
alidcast opened this issue Sep 5, 2016 · 3 comments
Closed

placeholder does not show #106

alidcast opened this issue Sep 5, 2016 · 3 comments

Comments

@alidcast
Copy link

alidcast commented Sep 5, 2016

When I inspect the page, the placeholder is appearing as a tag for the element. But it is not appearing on the page when the mobiledoc is empty.

Based on the documentation, so far I have this:

// template.hbs
{{#mobiledoc-editor
    mobiledoc=mobiledoc
    placeholder=placeholder
    as |editor|}}
    <div class="toolbar">
        {{mobiledoc-markup-button editor=editor for="strong"}}
        {{mobiledoc-section-button editor=editor for="h2"}}
    </div>
{{/mobiledoc-editor}}
// component.js
...
export default Ember.Component.extend({
  mobiledoc: {
    version: '0.3.0',
    atoms: [],
    markups: [],
    cards: [],
    sections: []
  },

  placeholder: 'Write here'

});

Is there something else I need to do to get the placeholder to work?

@bantic
Copy link
Contributor

bantic commented Sep 6, 2016

@alidcastano Can you check what version of Mobiledoc-Kit you are using? npm ls mobiledoc-kit. The placeholder code changed recently and that may affect you.

The placeholder is rendered with css using this rule:

.__mobiledoc-editor.__has-no-content:after {
  content: attr(data-placeholder);
  color: #bbb;
  cursor: text;
  position: absolute;
  top: 0;
}

Can you use your devtools to check the CSS that is applied to the mobiledoc-editor element? You should also confirm that your editor has the __has-no-content class on it.

thanks!

@alidcast
Copy link
Author

alidcast commented Sep 7, 2016

Ah, didn't know the placeholder was rendered with css. The problem is that I use ember-component-css addon to specify css inside component pod directories. But recently the addon has had problems importing external libraries, and for that reason, wasn't importing the mobiledoc's css.

I temporarily added @import 'node_modules/ember-mobiledoc-editor/node_modules/mobiledoc-kit/dist/css/mobiledoc-kit'; to mains stylesheet. Now everything works.

@bantic
Copy link
Contributor

bantic commented Sep 7, 2016

@alidcastano Great, glad that is working for you!

@bantic bantic closed this as completed Sep 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants