From 5399e4410495f411adad63331d265a09e9b25f8d Mon Sep 17 00:00:00 2001 From: Enrico Fasoli Date: Thu, 9 Oct 2014 18:18:13 +0200 Subject: [PATCH] added ace editor --- .meteor/packages | 2 +- .meteor/versions | 2 ++ client/client.coffee | 10 ++++++++++ client/style.less | 12 ++++++++++++ client/templates.html | 3 ++- 5 files changed, 27 insertions(+), 2 deletions(-) diff --git a/.meteor/packages b/.meteor/packages index 576ae48..7b2249c 100644 --- a/.meteor/packages +++ b/.meteor/packages @@ -15,4 +15,4 @@ mrt:moment reactive-var kevohagan:sweetalert accounts-twitter - +mandrill:ace diff --git a/.meteor/versions b/.meteor/versions index bf41967..9d01bea 100644 --- a/.meteor/versions +++ b/.meteor/versions @@ -36,6 +36,7 @@ less@1.0.9 livedata@1.0.10 localstorage@1.0.0 logging@1.0.3 +mandrill:ace@1.0.2 meteor-platform@1.1.1 meteor@1.1.1 minifiers@1.1.0 @@ -63,6 +64,7 @@ sha@1.0.0 spacebars-compiler@1.0.2 spacebars@1.0.2 srp@1.0.0 +standard-app-packages@1.0.2 templating@1.0.7 tracker@1.0.2 twitter@1.1.0 diff --git a/client/client.coffee b/client/client.coffee index 553e26c..d8ec21b 100644 --- a/client/client.coffee +++ b/client/client.coffee @@ -61,6 +61,9 @@ Router.map -> controller: loggedInController waitOn: -> Meteor.subscribe 'doc', @params._id data: -> docs.findOne @params._id + action: -> + if !Meteor.user() then @render '404' + else if @ready() then @render() @route 'profile', path: '/@:user' waitOn: -> @@ -102,6 +105,13 @@ Template.home.events else Meteor.subscribe 'user' notify type: 'success', msg: 'Logged in' + +Template.editor.rendered = -> + ed = MandrillAce.getInstance(); ed.isFocused() + #ed.setTheme 'ace/theme/monokai' + ed.setMode 'ace/mode/markdown' + if Router.current().data().text + ed.ace.setValue Router.current().data().text Template.editor.isPublic = -> return "checked" if @public is yes Template.editor.showTitleChecked = -> return "checked" unless @showTitle is no Template.editor.events diff --git a/client/style.less b/client/style.less index 28cddde..3a54018 100644 --- a/client/style.less +++ b/client/style.less @@ -49,6 +49,18 @@ #title { margin-bottom: 1em; } + +#mandrill_ace { + height: 400px; + /* + position: absolute; + width: 300px; + top: 0; + right: 0; + bottom: 0; + left: 0; + */ +} #editor { margin-top: 1em; margin-bottom: 1em; diff --git a/client/templates.html b/client/templates.html index b35912f..6062378 100644 --- a/client/templates.html +++ b/client/templates.html @@ -106,7 +106,8 @@ You will be able to delete your account and all your data whenever you want. Show title in document Make document visible on your profile - + + {{> mandrill_ace}}

Remember that this app is still in development so you should keep a backup of your text somewhere else in case something goes wrong!