Skip to content

rabisg/meteor-pen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Meteor Pen Editor

Pen Editor repackaged for Meteor

##How to Use

First define a template:

<template name="penEditable">
  <div id="editor">
    {{{content}}}
  </div>
</template>

Then add a rendered callback to initialize the editor

Template.penEditable.rendered = function () {
  this._editor = new Pen('#editor');
};

Additionally, you should also destroy the Pen instance when the template gets destroyed

Template.penEditable.destroyed = function () {
  this._editor.destroy();
};

If the editor is a part of a larger template, you might want to preserve it across re-renders. For more information, see the section template_preserve. In such a case, the rendered callback should have an additional check to ensure the template hasn't already been rendered before.

if(!this._editor) {
  this._editor = new Pen('#editor');
}

About

Pen editor repacked for Meteor

Resources

Stars

Watchers

Forks

Packages

No packages published