From 7556625914e8b0d0afa79fb108a5fdbcf478efc9 Mon Sep 17 00:00:00 2001 From: buddh4 Date: Thu, 20 Jul 2017 18:04:15 +0200 Subject: [PATCH] Removed redundant markdown addition. --- static/js/humhub/humhub.ui.additions.js | 43 ------------------------- 1 file changed, 43 deletions(-) diff --git a/static/js/humhub/humhub.ui.additions.js b/static/js/humhub/humhub.ui.additions.js index c3bc475b47..01d63e3b2d 100644 --- a/static/js/humhub/humhub.ui.additions.js +++ b/static/js/humhub/humhub.ui.additions.js @@ -9,7 +9,6 @@ humhub.module('ui.additions', function (module, require, $) { var event = require('event'); var object = require('util.object'); - var richtext = require('ui.richtext', true); var _additions = {}; @@ -124,49 +123,7 @@ humhub.module('ui.additions', function (module, require, $) { }); }); - module.register('markdown', '[data-ui-markdown]', function ($match) { - var converter = new Markdown.getSanitizingConverter(); - Markdown.Extra.init(converter); - $match.each(function () { - var $this = $(this); - if ($this.data('markdownProcessed')) { - return; - } - - - // Export all richtext features - var features = {}; - $this.find('[data-richtext-feature], .oembed_snippet').each(function () { - var $this = $(this); - - var featureKey = $this.data('guid') || '@-'+$this.attr('id'); - - // old oembeds - if($this.is('.oembed_snippted') && !$this.data('guid')) { - featureKey = '@-oembed-'+$this.data('url'); - } - - features[featureKey] = $this.clone(); - // We add a space to make sure our placeholder is not appended to any link or something. - $this.replaceWith(' '+featureKey); - }); - - var text = richtext.Richtext.plainText($this.clone()); - var result = converter.makeHtml(text); - - // Rewrite richtext feature - $.each(features, function (featureKey, $element) { - result = result.replace(new RegExp('( )?'+featureKey.trim(), 'g'), $('
').html($element).html()); - }); - - - $this.html(result).data('markdownProcessed', true); - - // Make sure to add noopener to all links - $this.find('a').attr('rel', 'noopener noreferrer'); - }); - }); $(document).on('click.humhub-ui-additions', function () { $('.tooltip').remove();