lnmunhoz/meteor-autoform-markdown-editor

preview option does not work

Closed this issue · 17 comments

preview option does not work

Hi @aliyekurumlu. Could you provide more information about what is happening?

When I click on 'Preview' tab, page stays as it is.
But I see a change in url
in write mode url is like:
http://localhost:3000/dashboards#write
then it turns to
http://localhost:3000/dashboards#preview

But appearance stays the same with markdown language view.
I am using iron router . Could this be a part of problem?

This is my source code in coffeescript:

 Router.route '/dashboards',
   name: 'dashboards'
   template: 'dashboards'
onRun: ->
    Session.set 'selectedDashboard', 'bepiDashboard'
    Session.set 'selectedDashboardLanguage', Session.get 'current_language'
    this.next()
 onBeforeAction: ->
    unless Roles.userIsInRole Meteor.userId(), 'bepi'
      Router.go 'home'
    else
        Translation.addContext 'languages', 'general','survey'
    this.next()
 waitOn: -> 
     Meteor.subscribe 'pages', {}
  data: ->
      if this.ready()
          db = Pages.findOne
              page:Session.get 'selectedDashboard'
              language:Session.get 'selectedDashboardLanguage'
         data = 
             dashboard: 
                  dashboardEditor: toMarkdown db.html
            schema: new SimpleSchema 
                 dashboardEditor:
                      type: String,
                      autoform: 
                           type: 'markdownEditor'
                           rows: 20
                           label: false
            return data

Do you have bootstrap in your project? This project depends on it.

yes I use bootstrap in my project

Maybe it's related to iron-router. I will test and update you.

Best,
Lucas.

http://lucasmunhoz.com

2016-08-09 10:23 GMT-03:00 aliyekurumlu notifications@github.com:

yes I use bootstrap in my project


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#1 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AELJA4-4-WMtAqLDRXyK5hdFTKIQnscNks5qeH9AgaJpZM4JGAyU
.

@aliyekurumlu Could you try update this package on your project?

Let me know if fixes your problem.

Hi Lucas

Thanks for the effort.

I update the package with:

meteor add lnmunhoz:autoform-markdown-editor

and re-run the project. I am afraid it did not make any difference

kind regards
ALiye Kurumlu

On 09 Aug 2016, at 16:10, Lucas N. Munhoz notifications@github.com wrote:

Could you try update this package on your project?

Let me know if fixes your problem.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub #1 (comment), or mute the thread https://github.com/notifications/unsubscribe-auth/AQIhgEERGesM0mUWiGyrG8aw7bZMjPvyks5qeIpugaJpZM4JGAyU.

Try meteor update lnmunhoz:autoform-markdown-editor

Best,
Lucas.

http://lucasmunhoz.com

2016-08-09 11:31 GMT-03:00 aliyekurumlu notifications@github.com:

Hi Lucas

Thanks for the effort.

I update the package with:

meteor add lnmunhoz:autoform-markdown-editor

and re-run the project. I am afraid it did not make any difference

kind regards
ALiye Kurumlu

On 09 Aug 2016, at 16:10, Lucas N. Munhoz notifications@github.com
wrote:

Could you try update this package on your project?

Let me know if fixes your problem.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <
https://github.com/lnmunhoz/meteor-autoform-markdown-
editor/issues/1#issuecomment-238565077>, or mute the thread <
https://github.com/notifications/unsubscribe-auth/
AQIhgEERGesM0mUWiGyrG8aw7bZMjPvyks5qeIpugaJpZM4JGAyU>.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#1 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AELJA-6j91u-quMahtbqJQHfCN3rYa8Kks5qeI9CgaJpZM4JGAyU
.

Nop!

Now is updated to 1.0.2 but there is still no changes I don’t see the preview page

kind regards
ALiye Kurumlu

On 09 Aug 2016, at 17:41, Lucas N. Munhoz notifications@github.com wrote:

meteor update lnmunhoz:autoform-markdown-editor

@aliyekurumlu Please try to update again. The new version should be 1.0.4.

Perfect!

It works now.

On 09 Aug 2016, at 21:44, Lucas N. Munhoz notifications@github.com wrote:

@aliyekurumlu https://github.com/aliyekurumlu Please try to update again. The new version should be 1.0.4.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub #1 (comment), or mute the thread https://github.com/notifications/unsubscribe-auth/AQIhgHI2XtBRoZmENIdrf8V5kEtsjqT2ks5qeNiZgaJpZM4JGAyU.

Awesome!

It looks like I was too quick to reply.

Now when the page first loaded I see indeed the Preview content correctly but when I change the context of the "Write" , Preview does not follow.

If you look at my source code , context of the Write and Preview depends on 2 session parameter. Whenever these 2 parameters are changed , Write and Preview should also change.

Write view does this correct but Preview view seems to stays forever as it is loaded for the first time.

@aliyekurumlu I think maybe you should fork the project and adapt to your own needs. I am using this component in another project and working really well. Maybe because of your session variables you need some custom logic.

I will be here to help in case you need.

I'll try

Hi Lucas

I have fixed my problem . The issue is
Template.afMarkdownEditor.rendered is called only ones. Therefore when the context of Write is changed, preview is not updated. I have made a Template.afMarkdownEditor.events handler and it does exactly the same as the below.

Template.afMarkdownEditor.rendered = function() {
var textArea = Template.instance().$('.markdownInput');
Template.instance().markdownInput.set(textArea.val());
};

kind regards
ALiye Kurumlu

Nice!

If you submit a pull request I can merge here.

Best,
Lucas.

On Aug 17, 2016 11:26 AM, "aliyekurumlu" notifications@github.com wrote:

Hi Lucas

I have fixed my problem . The issue is
Template.afMarkdownEditor.rendered is called only ones. Therefore when
the context of Write is changed, preview is not updated. I have made a
Template.afMarkdownEditor.events handler and it does exactly the same
as the below.

Template.afMarkdownEditor.rendered = function() {
var textArea = Template.instance().$('.markdownInput');
Template.instance().markdownInput.set(textArea.val());
};

kind regards
ALiye Kurumlu


You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
#1 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AELJA-YWcS6siQqmXKAoRb2pbQHR-26Mks5qgxoBgaJpZM4JGAyU
.