Sha256: 82b7e9d7492b8b35148dccebbe57b0808b45186916a113ccad6cf975cda846ca

Contents?: true

Size: 1.32 KB

Versions: 9

Compression:

Stored size: 1.32 KB

Contents

window.EasyMDEs = {};

window.comments = {};
window.comments.clickEditComment = function(el) {
  $(el).hide();
  var $rootComment = $(el).closest('.media-comment');
  var commentKey = $rootComment.attr('id');

  $rootComment.toggleClass('editing');
  window.EasyMDEs[commentKey] ||= new EasyMDE({
    element: document.getElementById($rootComment.attr('id') + '_content'),
    status: false,
    maxHeight: '150px',
    showIcons: ['code'],
    spellChecker: false,
    placeholder: 'Type your comment here...',
    renderingConfig: {
      codeSyntaxHighlighting: true,
    }
  });
};
window.comments.initAddNewComment = function(id) {
  new EasyMDE({
    element: document.getElementById(id),
    status: false,
    maxHeight: '100px',
    showIcons: ['code'],
    spellChecker: false,
    placeholder: 'Type your comment here...',
    renderingConfig: {
      codeSyntaxHighlighting: true,
    }
  });
};
window.comments.renderMarkdown = function(commentKey) {
  var markdownEl = $(commentKey + " p.content-markdown");
  var htmlEl = $(commentKey + " p.content-html");
  markdownEl.hide();
  htmlEl.html(marked.parse(markdownEl.html()));
}
window.comments.cancelEditMode = function(cancelButton) {
  var $rootComment = $(cancelButton).closest('.media-comment');
  $rootComment.toggleClass('editing');
  $rootComment.find('.edit-comment').show();
}

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
rails_execution-0.1.12 app/assets/javascripts/executions/comments.js
rails_execution-0.1.11 app/assets/javascripts/executions/comments.js
rails_execution-0.1.10 app/assets/javascripts/executions/comments.js
rails_execution-0.1.9 app/assets/javascripts/executions/comments.js
rails_execution-0.1.8 app/assets/javascripts/executions/comments.js
rails_execution-0.1.7 app/assets/javascripts/executions/comments.js
rails_execution-0.1.5 app/assets/javascripts/executions/comments.js
rails_execution-0.1.4 app/assets/javascripts/executions/comments.js
rails_execution-0.1.2 app/assets/javascripts/executions/comments.js