balthazar / ng-markdown

:memo: [DEPRECATED] Markdown directive for AngularJS
http://apercu.github.io/ng-markdown/
MIT License
12 stars 1 forks source link

using editor twice on same page causes problems. #6

Closed ralyodio closed 10 years ago

ralyodio commented 10 years ago

I'm getting some issues trying to use editor twice on same page.

screen shot 2014-06-29 at 1 27 55 pm

balthazar commented 10 years ago

Have you tried to prefix or suffix each markdown with a different string like on the demo page ?

It may fails cause the directive can't make the difference with the two

balthazar commented 10 years ago

Bump, have you still the issue ?

ralyodio commented 10 years ago

I got it working, but I think you should re-consider how you construct your CSS. You should give each element a common class like .md-editor and .md-preview...and then use the suffix to add an additional class you can associate the preview with the editor with.

balthazar commented 10 years ago

Yeah you right on that point, will change it as soon I find something correct.

So for you, I should use a general class for css purposes and another one specific to distinguish every editor, so still with a prefix and suffix system ? What about an id based ? I generally avoid this, but if it's the best way, why not.

Closing this issue

ralyodio commented 10 years ago

i don't know why you need both prefix AND suffix. Seems like you could just use 'version' instead.

I would avoid ids, simply because you have 2 or 3 elements to group together. Only one unique id per page should be used. Also I recommend you group the entire thing in a div, in which case id is ok.

<div id="md-1" class="md-instance">
     <textarea class="md-editor"></textarea>
     <div class="md-preview"></div>
</div>

Then you CSS could be this (sass/less):

.md-instance {
    .md-editor {
    }
   .md-preview {
   }
}
balthazar commented 10 years ago

Opps yeah was tired, forgot that I have three elements.

The main reason the directive does not wrap all the three element is to allow the user to have a very specific markup, like bootstrap or other, and to allow the elements to not be necessarily next to each other. Really want to keep it that way.