mizzao / meteor-sharejs

Meteor smart package for transparently adding ShareJS editors to an app
MIT License
225 stars 53 forks source link

onRender config function not being called #41

Closed MatejJan closed 9 years ago

MatejJan commented 9 years ago

onRender function runs, but the function we return from there never gets called. As a result, you cannot configure the editor (Ace in my case).

I ran into this problem while working on my own app, but I am able to reproduce it in the demo app too.

Clone from the repository and run the demo. The code editor will stay white (the default). You can see in the deployed version of the demo that it switches to black.

If you add debug lines to configAce:

  configAce: ->
    console.log "onRender called, returning config function …"
    (ace) ->
      console.log "Config function called!"
      # Set some reasonable options on the editor
      ace.setTheme('ace/theme/monokai')
      ace.setShowPrintMargin(false)
      ace.getSession().setUseWrapMode(true)

… you will see that only the fist console.log gets executed, but the second one never does.

DavidSichau commented 9 years ago

I ran the demo and every thing works fine. For me the editor gets the black theme. What setup code are you using?

MatejJan commented 9 years ago

Not sure exactly what you mean, but I did:

dhcp-45-37:~ Retro$ git clone https://github.com/mizzao/meteor-sharejs.git ShareJS
Cloning into 'ShareJS'...
remote: Counting objects: 599, done.
remote: Compressing objects: 100% (13/13), done.
remote: Total 599 (delta 2), reused 0 (delta 0)
Receiving objects: 100% (599/599), 313.17 KiB | 176.00 KiB/s, done.
Resolving deltas: 100% (309/309), done.
Checking connectivity... done.
dhcp-45-37:~ Retro$ cd ShareJS/demo/
dhcp-45-37:demo Retro$ meteor
[[[[[ ~/ShareJS/demo ]]]]]                    

=> Started proxy.                             
=> Started MongoDB.                           

Changes to your project's package version selections:

mizzao:sharejs-ace  downgraded from 1.1.8_1 to 1.1.8

=> Started your app.                          

=> App running at: http://localhost:3000/

And when I go to localhost I get this: screen shot 2015-02-13 at 1 32 16 am

It's the same in chrome and safari.

Meteor version is:

dhcp-45-37:demo Retro$ meteor --version
Meteor 1.0.3.1

Let me know what else I can check/look up.

mizzao commented 9 years ago

First, you need to either git clone --recursive or git submodule update --init. Second, you need to mrt install . in demo/ to create local symlinks to the packages (If you don't have Meteorite installed, you can create them manually.)

Can you show what the browser console says when that page loads?

MatejJan commented 9 years ago

Thanks, creating symlinks does the trick if you have the repository checked out.

@mitar is looking into how to include it in our package without that, since simply adding the dependency (api.use) doesn't seem to be enough.

mitar commented 9 years ago

Yes, it seems the package does not work if it is included as a dependency of another package.

mitar commented 9 years ago

OK, so I can reproduce this. Why it is necessary to create symlinks? Why is not enough to just provide a mizzao:sharejs-ace dependency in the .meteor/packages? So if I run a demo program, it already has a dependency in the .meteor/packages, it compiles nicely, it runs, it shows ACE, only it is not possible to customize it.

mitar commented 9 years ago

And only mizzao:sharejs-base has to be symlinked into packages, that is even more interesting.

mitar commented 9 years ago

Oh, I got it. :-) The problem is that the version 0.7.0 which is released and mizzao:sharejs-ace depends on does not support those callbacks. Only the one from the repository does. Can you please release the newest version of all those packages? So sharejs and mizzao:sharejs-ace with updated dependency?

mizzao commented 9 years ago

I see what happened here, I refactored some code to try and make it cleaner, and that broke across the packages even though they were all in the same repo.

I released v0.7.1, which your app should automatically pull in with meteor update. I don't think I need to re-release the dependent packages, but let me know if for some reason this does not work.

mitar commented 9 years ago

You didn't push binaries, no? It seems you released only source code. Can you log in to build machines and release also platform versions?

mitar commented 9 years ago

https://github.com/meteor/meteor/wiki/Build-Machines

mizzao commented 9 years ago

I ran those, but forgot to type my password in at the end and went to sleep. Sorry, should be good now. :)

Yet another reason to implement meteor/meteor#2759.

mitar commented 9 years ago

Great, it works. But we had to manually update the version in .meteor/versions, meteor update did not do it by itself.

brg2 commented 9 years ago

@mitar Had to do this as well. @mizzao the version is set to 0.7.0 when doing meteor add mizzao:sharejs-ace!